Debugger: Correct check of pending list item.

Since updating is async now, setting the check state should be too.
This commit is contained in:
Unknown W. Brackets 2022-12-31 09:58:24 -08:00
parent d65c7fb05e
commit bfc659ab5f
3 changed files with 32 additions and 11 deletions

View file

@ -307,7 +307,6 @@ void CtrlBreakpointList::reloadBreakpoints()
// Update the items we're displaying from the debugger. // Update the items we're displaying from the debugger.
displayedBreakPoints_ = CBreakPoints::GetBreakpoints(); displayedBreakPoints_ = CBreakPoints::GetBreakpoints();
displayedMemChecks_= CBreakPoints::GetMemChecks(); displayedMemChecks_= CBreakPoints::GetMemChecks();
Update();
for (int i = 0; i < GetRowCount(); i++) for (int i = 0; i < GetRowCount(); i++)
{ {
@ -321,6 +320,8 @@ void CtrlBreakpointList::reloadBreakpoints()
else else
SetCheckState(i, displayedBreakPoints_[index].IsEnabled()); SetCheckState(i, displayedBreakPoints_[index].IsEnabled());
} }
Update();
} }
void CtrlBreakpointList::editBreakpoint(int itemIndex) void CtrlBreakpointList::editBreakpoint(int itemIndex)

View file

@ -402,27 +402,36 @@ void GenericListControl::ProcessUpdate() {
ListView_DeleteItem(handle,--items); ListView_DeleteItem(handle,--items);
} }
for (auto &act : pendingActions_) {
switch (act.action) {
case Action::CHECK:
ListView_SetCheckState(handle, act.item, act.state ? TRUE : FALSE);
break;
case Action::IMAGE:
ListView_SetItemState(handle, act.item, (act.state & 0xF) << 12, LVIS_STATEIMAGEMASK);
break;
}
}
pendingActions_.clear();
ResizeColumns(); ResizeColumns();
InvalidateRect(handle, nullptr, TRUE); InvalidateRect(handle, nullptr, TRUE);
UpdateWindow(handle);
ListView_RedrawItems(handle, 0, newRows - 1); ListView_RedrawItems(handle, 0, newRows - 1);
UpdateWindow(handle);
updating = false; updating = false;
} }
void GenericListControl::SetCheckState(int item, bool state) void GenericListControl::SetCheckState(int item, bool state) {
{ pendingActions_.push_back({ Action::CHECK, item, state ? 1 : 0 });
updating = true; Update();
ListView_SetCheckState(handle,item,state ? TRUE : FALSE);
updating = false;
} }
void GenericListControl::SetItemState(int item, uint8_t state) { void GenericListControl::SetItemState(int item, uint8_t state) {
updating = true; pendingActions_.push_back({ Action::IMAGE, item, (int)state });
ListView_SetItemState(handle, item, (state & 0xF) << 12, LVIS_STATEIMAGEMASK); Update();
ListView_RedrawItems(handle, item, item);
updating = false;
} }
void GenericListControl::ResizeColumns() void GenericListControl::ResizeColumns()

View file

@ -105,4 +105,15 @@ private:
volatile bool inResizeColumns; volatile bool inResizeColumns;
volatile bool updating; volatile bool updating;
bool updateScheduled_ = false; bool updateScheduled_ = false;
enum class Action {
CHECK,
IMAGE,
};
struct PendingAction {
Action action;
int item;
int state;
};
std::vector<PendingAction> pendingActions_;
}; };