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
d7fe5510bb
commit
35971d3353
|
@ -563,7 +563,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
|
||||||
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
|
new StaticTextWidget(boss, lfont, xpos, ypos+2, 2*fontWidth, fontHeight,
|
||||||
"PF", TextAlign::Left);
|
"PF", TextAlign::Left);
|
||||||
xpos += 2*fontWidth + 5;
|
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]->setTarget(this);
|
||||||
myPF[0]->setID(kPF0ID);
|
myPF[0]->setID(kPF0ID);
|
||||||
addFocusWidget(myPF[0]);
|
addFocusWidget(myPF[0]);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
|
ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows, int colchars)
|
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();
|
_rowHeight = font.getLineHeight();
|
||||||
_colWidth = colchars * font.getMaxCharWidth() + 8;
|
_colWidth = colchars * font.getMaxCharWidth() + 8;
|
||||||
|
|
|
@ -24,8 +24,9 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
|
TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows)
|
int x, int y, int cols, int rows,
|
||||||
: ToggleWidget(boss, font, x, y, cols, rows, 1)
|
int shiftBits)
|
||||||
|
: ToggleWidget(boss, font, x, y, cols, rows, shiftBits)
|
||||||
{
|
{
|
||||||
_rowHeight = _colWidth = font.getLineHeight();
|
_rowHeight = _colWidth = font.getLineHeight();
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ class TogglePixelWidget : public ToggleWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
|
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;
|
~TogglePixelWidget() override = default;
|
||||||
|
|
||||||
void setColor(ColorId color) { _pixelColor = color; }
|
void setColor(ColorId color) { _pixelColor = color; }
|
||||||
|
@ -42,7 +43,6 @@ class TogglePixelWidget : public ToggleWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor};
|
ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor};
|
||||||
bool _swapBits{false};
|
|
||||||
bool _crossBits{false};
|
bool _crossBits{false};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
|
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 shiftBits)
|
||||||
int clicksToChange)
|
|
||||||
: Widget(boss, font, x, y, 16, 16),
|
: Widget(boss, font, x, y, 16, 16),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
_rows(rows),
|
_rows(rows),
|
||||||
|
@ -34,7 +33,7 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_rowHeight(0),
|
_rowHeight(0),
|
||||||
_colWidth(0),
|
_colWidth(0),
|
||||||
_selectedItem(0),
|
_selectedItem(0),
|
||||||
_clicksToChange(clicksToChange),
|
_shiftBits(shiftBits),
|
||||||
_editable(true)
|
_editable(true)
|
||||||
{
|
{
|
||||||
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
|
_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,
|
// If this was a double click and the mouse is still over the selected item,
|
||||||
// send the double click command
|
// send the double click command
|
||||||
if (clickCount == _clicksToChange && (_selectedItem == findItem(x, y)))
|
if (clickCount == 1 && (_selectedItem == findItem(x, y)))
|
||||||
{
|
{
|
||||||
_stateList[_selectedItem] = !_stateList[_selectedItem];
|
_stateList[_selectedItem] = !_stateList[_selectedItem];
|
||||||
_changedList[_selectedItem] = !_changedList[_selectedItem];
|
_changedList[_selectedItem] = !_changedList[_selectedItem];
|
||||||
|
@ -225,11 +224,19 @@ string ToggleWidget::getToolTip(Common::Point pos) const
|
||||||
const int idx = getToolTipIndex(pos);
|
const int idx = getToolTipIndex(pos);
|
||||||
Int32 val = 0;
|
Int32 val = 0;
|
||||||
|
|
||||||
for(int col = 0; col < _cols; ++col)
|
if(_swapBits)
|
||||||
{
|
for(int col = _cols - 1; col >= 0; --col)
|
||||||
val <<= 1;
|
{
|
||||||
val += _stateList[idx + 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 hex = Common::Base::toString(val, Common::Base::Fmt::_16);
|
||||||
const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
|
const string dec = Common::Base::toString(val, Common::Base::Fmt::_10);
|
||||||
|
|
|
@ -33,8 +33,8 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToggleWidget(GuiObject* boss, const GUI::Font& font,
|
ToggleWidget(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 clicksToChange = 2);
|
int shiftBits = 0);
|
||||||
~ToggleWidget() override = default;
|
~ToggleWidget() override = default;
|
||||||
|
|
||||||
const BoolArray& getState() { return _stateList; }
|
const BoolArray& getState() { return _stateList; }
|
||||||
|
@ -60,8 +60,9 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
int _rowHeight; // explicitly set in child classes
|
int _rowHeight; // explicitly set in child classes
|
||||||
int _colWidth; // explicitly set in child classes
|
int _colWidth; // explicitly set in child classes
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
int _clicksToChange; // number of clicks to register a change
|
|
||||||
bool _editable;
|
bool _editable;
|
||||||
|
bool _swapBits{false};
|
||||||
|
int _shiftBits{0}; // shift bits for tooltip display
|
||||||
|
|
||||||
BoolArray _stateList;
|
BoolArray _stateList;
|
||||||
BoolArray _changedList;
|
BoolArray _changedList;
|
||||||
|
|
Loading…
Reference in New Issue