diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index 5f6ba56ab..20aba0763 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -563,7 +563,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont, new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight, "PF", TextAlign::Left); xpos += 2*fontWidth + 5; - myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1); + myPF[0] = new TogglePixelWidget(boss, nfont, xpos, ypos+1, 4, 1, 4); myPF[0]->setTarget(this); myPF[0]->setID(kPF0ID); addFocusWidget(myPF[0]); diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx index 479f31225..39ca7dcce 100644 --- a/src/debugger/gui/ToggleBitWidget.cxx +++ b/src/debugger/gui/ToggleBitWidget.cxx @@ -26,7 +26,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, 1) + : ToggleWidget(boss, font, x, y, cols, rows) { _rowHeight = font.getLineHeight(); _colWidth = colchars * font.getMaxCharWidth() + 8; diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx index fdc1609bc..b7dd5dbdf 100644 --- a/src/debugger/gui/TogglePixelWidget.cxx +++ b/src/debugger/gui/TogglePixelWidget.cxx @@ -24,8 +24,9 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int cols, int rows) - : ToggleWidget(boss, font, x, y, cols, rows, 1) + int x, int y, int cols, int rows, + int shiftBits) + : ToggleWidget(boss, font, x, y, cols, rows, shiftBits) { _rowHeight = _colWidth = font.getLineHeight(); diff --git a/src/debugger/gui/TogglePixelWidget.hxx b/src/debugger/gui/TogglePixelWidget.hxx index 6177cac45..c748210f2 100644 --- a/src/debugger/gui/TogglePixelWidget.hxx +++ b/src/debugger/gui/TogglePixelWidget.hxx @@ -25,7 +25,8 @@ class TogglePixelWidget : public ToggleWidget { public: TogglePixelWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int cols, int rows); + int x, int y, int cols = 1, int rows = 1, + int shiftBits = 0); ~TogglePixelWidget() override = default; void setColor(ColorId color) { _pixelColor = color; } @@ -42,7 +43,6 @@ class TogglePixelWidget : public ToggleWidget private: ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor}; - bool _swapBits{false}; bool _crossBits{false}; private: diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index 3d2fca262..60f4ee154 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -23,8 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int cols, int rows, - int clicksToChange) + int x, int y, int cols, int rows, int shiftBits) : Widget(boss, font, x, y, 16, 16), CommandSender(boss), _rows(rows), @@ -34,7 +33,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font, _rowHeight(0), _colWidth(0), _selectedItem(0), - _clicksToChange(clicksToChange), + _shiftBits(shiftBits), _editable(true) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS | @@ -70,7 +69,7 @@ void ToggleWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount) // If this was a double click and the mouse is still over the selected item, // send the double click command - if (clickCount == _clicksToChange && (_selectedItem == findItem(x, y))) + if (clickCount == 1 && (_selectedItem == findItem(x, y))) { _stateList[_selectedItem] = !_stateList[_selectedItem]; _changedList[_selectedItem] = !_changedList[_selectedItem]; @@ -225,11 +224,19 @@ string ToggleWidget::getToolTip(Common::Point pos) const const int idx = getToolTipIndex(pos); Int32 val = 0; - for(int col = 0; col < _cols; ++col) - { - val <<= 1; - val += _stateList[idx + col]; - } + if(_swapBits) + for(int col = _cols - 1; col >= 0; --col) + { + val <<= 1; + val += _stateList[idx + col]; + } + else + for(int col = 0; col < _cols; ++col) + { + val <<= 1; + val += _stateList[idx + col]; + } + val <<= _shiftBits; const string hex = Common::Base::toString(val, Common::Base::Fmt::_16); const string dec = Common::Base::toString(val, Common::Base::Fmt::_10); diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx index 060a52e13..5f4ec13a7 100644 --- a/src/debugger/gui/ToggleWidget.hxx +++ b/src/debugger/gui/ToggleWidget.hxx @@ -33,8 +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 clicksToChange = 2); + int x, int y, int cols = 1, int rows = 1, + int shiftBits = 0); ~ToggleWidget() override = default; const BoolArray& getState() { return _stateList; } @@ -60,8 +60,9 @@ 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; + bool _swapBits{false}; + int _shiftBits{0}; // shift bits for tooltip display BoolArray _stateList; BoolArray _changedList;