From 43c22af2742064a2974049c345e874b9c116ce03 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 15 Jul 2017 17:36:06 -0230 Subject: [PATCH] Fixed bug with missile colouring in debugger not changing colour until after an instruction was executed. Also, toggle-able widgets (pixel and bits) in the debugger can now be toggled with a single mouse click, not a double-click. These fix issue #15. --- Changes.txt | 2 ++ src/debugger/gui/TiaWidget.cxx | 24 ++++-------------------- src/debugger/gui/ToggleBitWidget.cxx | 2 +- src/debugger/gui/TogglePixelWidget.cxx | 2 +- src/debugger/gui/ToggleWidget.cxx | 6 ++++-- src/debugger/gui/ToggleWidget.hxx | 4 +++- 6 files changed, 15 insertions(+), 25 deletions(-) diff --git a/Changes.txt b/Changes.txt index ade3f0c1d..84000ce95 100644 --- a/Changes.txt +++ b/Changes.txt @@ -74,6 +74,8 @@ - The TIA tab now shows 'old' contents of player and ball registers - Various UI items are crossed out when disabled, to more clearly indicate their current state + - Various UI items that previously required a double-click to toggle + (pixel and bit widgets) now require only a single-click. - Command completion now works with internal functions and pseudo-ops (basically, anything starting with the '_' character) - System labels (aka, register names, etc) can now be typed in lower- diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index b78bc60f7..aac78501a 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -1012,16 +1012,8 @@ void TiaWidget::loadConfig() // M0 register info //////////////////////////// // enaM0 - if(tia.enaM0()) - { - myEnaM0->setColor(state.coluRegs[0]); - myEnaM0->setIntState(1, false); - } - else - { - myEnaM0->setColor(kBGColorLo); - myEnaM0->setIntState(0, false); - } + myEnaM0->setColor(state.coluRegs[0]); + myEnaM0->setIntState(tia.enaM0() ? 1: 0, false); // posM0 myPosM0->setList(0, state.pos[M0], state.pos[M0] != oldstate.pos[M0]); @@ -1039,16 +1031,8 @@ void TiaWidget::loadConfig() // M1 register info //////////////////////////// // enaM1 - if(tia.enaM1()) - { - myEnaM1->setColor(state.coluRegs[1]); - myEnaM1->setIntState(1, false); - } - else - { - myEnaM1->setColor(kBGColorLo); - myEnaM1->setIntState(0, false); - } + myEnaM1->setColor(state.coluRegs[1]); + myEnaM1->setIntState(tia.enaM1() ? 1: 0, false); // posM1 myPosM1->setList(0, state.pos[M1], state.pos[M1] != oldstate.pos[M1]); diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx index 857b62629..489fecd38 100644 --- a/src/debugger/gui/ToggleBitWidget.cxx +++ b/src/debugger/gui/ToggleBitWidget.cxx @@ -25,7 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int cols, int rows, int colchars) - : ToggleWidget(boss, font, x, y, cols, rows) + : ToggleWidget(boss, font, x, y, cols, rows, 1) { _rowHeight = font.getLineHeight(); _colWidth = colchars * font.getMaxCharWidth() + 8; diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx index ffb8a8db2..a8baba42d 100644 --- a/src/debugger/gui/TogglePixelWidget.cxx +++ b/src/debugger/gui/TogglePixelWidget.cxx @@ -25,7 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int cols, int rows) - : ToggleWidget(boss, font, x, y, cols, rows), + : ToggleWidget(boss, font, x, y, cols, rows, 1), _pixelColor(0), _backgroundColor(kDlgColor), _swapBits(false), diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index 70a8bde92..82fcb23b6 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -21,7 +21,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int cols, int rows) + int x, int y, int cols, int rows, + int clicksToChange) : Widget(boss, font, x, y, 16, 16), CommandSender(boss), _rows(rows), @@ -31,6 +32,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font, _rowHeight(0), _colWidth(0), _selectedItem(0), + _clicksToChange(clicksToChange), _editable(true) { _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | @@ -66,7 +68,7 @@ void ToggleWidget::handleMouseUp(int x, int y, int button, int clickCount) // If this was a double click and the mouse is still over the selected item, // send the double click command - if (clickCount == 2 && (_selectedItem == findItem(x, y))) + if (clickCount == _clicksToChange && (_selectedItem == findItem(x, y))) { _stateList[_selectedItem] = !_stateList[_selectedItem]; _changedList[_selectedItem] = !_changedList[_selectedItem]; diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx index eb264972b..337ce0322 100644 --- a/src/debugger/gui/ToggleWidget.hxx +++ b/src/debugger/gui/ToggleWidget.hxx @@ -33,7 +33,8 @@ class ToggleWidget : public Widget, public CommandSender public: ToggleWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int cols, int rows); + int x, int y, int cols, int rows, + int clicksToChange = 2); virtual ~ToggleWidget() = default; const BoolArray& getState() { return _stateList; } @@ -55,6 +56,7 @@ class ToggleWidget : public Widget, public CommandSender int _rowHeight; // explicitly set in child classes int _colWidth; // explicitly set in child classes int _selectedItem; + int _clicksToChange; // number of clicks to register a change bool _editable; BoolArray _stateList;