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.
This commit is contained in:
Stephen Anthony 2017-07-15 17:36:06 -02:30
parent 199627f0cb
commit 43c22af274
6 changed files with 15 additions and 25 deletions

View File

@ -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-

View File

@ -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]);

View File

@ -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;

View File

@ -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),

View File

@ -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];

View File

@ -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;