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.
displayedBreakPoints_ = CBreakPoints::GetBreakpoints();
displayedMemChecks_= CBreakPoints::GetMemChecks();
Update();
for (int i = 0; i < GetRowCount(); i++)
{
@ -321,6 +320,8 @@ void CtrlBreakpointList::reloadBreakpoints()
else
SetCheckState(i, displayedBreakPoints_[index].IsEnabled());
}
Update();
}
void CtrlBreakpointList::editBreakpoint(int itemIndex)

View file

@ -402,27 +402,36 @@ void GenericListControl::ProcessUpdate() {
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();
InvalidateRect(handle, nullptr, TRUE);
UpdateWindow(handle);
ListView_RedrawItems(handle, 0, newRows - 1);
UpdateWindow(handle);
updating = false;
}
void GenericListControl::SetCheckState(int item, bool state)
{
updating = true;
ListView_SetCheckState(handle,item,state ? TRUE : FALSE);
updating = false;
void GenericListControl::SetCheckState(int item, bool state) {
pendingActions_.push_back({ Action::CHECK, item, state ? 1 : 0 });
Update();
}
void GenericListControl::SetItemState(int item, uint8_t state) {
updating = true;
ListView_SetItemState(handle, item, (state & 0xF) << 12, LVIS_STATEIMAGEMASK);
ListView_RedrawItems(handle, item, item);
updating = false;
pendingActions_.push_back({ Action::IMAGE, item, (int)state });
Update();
}
void GenericListControl::ResizeColumns()

View file

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