mirror of https://github.com/stella-emu/stella.git
added considering bit order in PF pixel tooltip display
removed unused click count from ToggleWidget
This commit is contained in:
parent
0dbd87f787
commit
d4cd97617e
|
@ -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]);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue