focus highlighting added to more widgets

added some missing tab keys to debugger
fixed frame colors for CheckboxWidget and RadioButtonWidget
brightened inverted highlight color for "Light"
This commit is contained in:
thrust26 2018-01-26 11:33:46 +01:00
parent a20f21f741
commit f58e914729
18 changed files with 120 additions and 44 deletions

View File

@ -78,7 +78,7 @@ int CartDebugWidget::addBaseInformation(int bytes, const string& manufacturer,
fwidth, lines * myLineHeight, false);
myDesc->setEditable(false);
myDesc->setList(sl);
addFocusWidget(myDesc);
y += myDesc->getHeight() + 4;
return y;

View File

@ -442,24 +442,32 @@ void DebuggerDialog::addRomArea()
const GUI::Rect& r = getRomBounds();
const int VBORDER = 4;
const string ELLIPSIS = "\x1d";
WidgetArray wid1, wid2;
ButtonWidget* b;
int bwidth = myLFont->getStringWidth("Frame +1 "),
bheight = myLFont->getLineHeight() + 2;
int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Step", kDDStepCmd);
b = new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Step", kDDStepCmd);
wid2.push_back(b);
buttonY += bheight + 4;
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Trace", kDDTraceCmd);
b = new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Trace", kDDTraceCmd);
wid2.push_back(b);
buttonY += bheight + 4;
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Scan +1", kDDSAdvCmd);
b = new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Scan +1", kDDSAdvCmd);
wid2.push_back(b);
buttonY += bheight + 4;
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Frame +1", kDDAdvCmd);
b = new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Frame +1", kDDAdvCmd);
wid2.push_back(b);
buttonY += bheight + 4;
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Exit", kDDExitCmd);
b = new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, "Exit", kDDExitCmd);
wid2.push_back(b);
bwidth = bheight; // 7 + 12;
bheight = bheight * 3 + 4 * 2;
@ -469,7 +477,6 @@ void DebuggerDialog::addRomArea()
myRewindButton =
new ButtonWidget(this, *myLFont, buttonX, buttonY,
bwidth, bheight, LEFT_ARROW, 7, 11, kDDRewindCmd);
myRewindButton->clearFlags(WIDGET_ENABLED);
buttonY += bheight + 4;
@ -485,7 +492,11 @@ void DebuggerDialog::addRomArea()
bwidth = myLFont->getStringWidth("Options " + ELLIPSIS);
bheight = myLFont->getLineHeight() + 2;
new ButtonWidget(this, *myLFont, xpos, r.top + 5, bwidth, bheight, "Options" + ELLIPSIS, kDDOptionsCmd);
b = new ButtonWidget(this, *myLFont, xpos, r.top + 5, bwidth, bheight,
"Options" + ELLIPSIS, kDDOptionsCmd);
wid1.push_back(b);
wid1.push_back(myRewindButton);
wid1.push_back(myUnwindButton);
DataGridOpsWidget* ops = new DataGridOpsWidget(this, *myLFont, xpos, ypos);
@ -494,6 +505,9 @@ void DebuggerDialog::addRomArea()
myCpu = new CpuWidget(this, *myLFont, *myNFont, xpos, ypos, max_w);
addToFocusList(myCpu->getFocusList());
addToFocusList(wid1);
addToFocusList(wid2);
xpos = r.left + 10; ypos += myCpu->getHeight() + 10;
myRam = new RiotRamWidget(this, *myLFont, *myNFont, xpos, ypos, r.width() - 10);
addToFocusList(myRam->getFocusList());

View File

@ -96,12 +96,12 @@ void DelayQueueWidget::drawWidget(bool hilite)
w = _w,
lineHeight = _font.getLineHeight();
surface.frameRect(x, y, w, _h, kShadowColor);
surface.frameRect(x, y, w, _h, kColor);
y += 1;
x += 1;
w -= 1;
surface.fillRect(x, y, w - 1, _h - 2, kBGColorHi);
surface.fillRect(x, y, w - 1, _h - 2, kDlgColor);
y += 2;
x += 2;

View File

@ -46,6 +46,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
const int bwidth = lfont.getStringWidth("Compare " + ELLIPSIS),
bheight = myLineHeight + 2;
const int VGAP = 4;
WidgetArray wid;
int ypos = y + myLineHeight;
@ -63,28 +64,35 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
myUndoButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Undo", kUndoCmd);
wid.push_back(myUndoButton);
myUndoButton->setTarget(this);
by += bheight + VGAP;
myRevertButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Revert", kRevertCmd);
wid.push_back(myRevertButton);
myRevertButton->setTarget(this);
by += bheight + VGAP * 6;
mySearchButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Search" + ELLIPSIS, kSearchCmd);
wid.push_back(mySearchButton);
mySearchButton->setTarget(this);
by += bheight + VGAP;
myCompareButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Compare" + ELLIPSIS, kCmpCmd);
wid.push_back(myCompareButton);
myCompareButton->setTarget(this);
by += bheight + VGAP;
myRestartButton = new ButtonWidget(boss, lfont, bx, by, bwidth, bheight,
"Reset", kRestartCmd);
wid.push_back(myRestartButton);
myRestartButton->setTarget(this);
addToFocusList(wid);
// Labels for RAM grid
myRamStart =
new StaticTextWidget(_boss, lfont, xpos - _font.getStringWidth("xxxx"),

View File

@ -288,6 +288,20 @@ void RomListWidget::handleMouseWheel(int x, int y, int direction)
myScrollBar->handleMouseWheel(x, y, direction);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomListWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool RomListWidget::handleText(char text)
{
@ -458,9 +472,7 @@ void RomListWidget::drawWidget(bool hilite)
const GUI::Rect& l = getLineRect();
// Draw a thin frame around the list and to separate columns
s.hLine(_x, _y, _x + _w - 1, kColor);
s.hLine(_x, _y + _h - 1, _x + _w - 1, kShadowColor);
s.vLine(_x, _y, _y + _h - 1, kColor);
s.frameRect(_x, _y, _w, _h, hilite ? kWidColorHi : kColor);
s.vLine(_x + CheckboxWidget::boxSize() + 5, _y, _y + _h - 1, kColor);
// Draw the list items

View File

@ -61,6 +61,8 @@ class RomListWidget : public EditableWidget
void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
void handleMouseWheel(int x, int y, int direction) override;
void handleMouseEntered() override;
void handleMouseLeft() override;
bool handleText(char text) override;
bool handleKeyDown(StellaKey key, StellaMod mod) override;
bool handleKeyUp(StellaKey key, StellaMod mod) override;

View File

@ -164,9 +164,18 @@ void TiaZoomWidget::handleMouseMoved(int x, int y)
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaZoomWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
myMouseMoving = false;
}
@ -242,7 +251,7 @@ void TiaZoomWidget::drawWidget(bool hilite)
FBSurface& s = dialog().surface();
s.fillRect(_x+1, _y+1, _w-2, _h-2, kBGColor);
s.frameRect(_x, _y, _w, _h, kColor);
s.frameRect(_x, _y, _w, _h, hilite ? kWidColorHi : kColor);
// Draw the zoomed image
// This probably isn't as efficient as it can be, but it's a small area

View File

@ -35,6 +35,9 @@ class TiaZoomWidget : public Widget, public CommandSender
void loadConfig() override;
void setPos(int x, int y);
protected:
void handleMouseEntered() override;
private:
void zoom(int level);
void recalc();

View File

@ -1034,7 +1034,7 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
},
// Classic
{ 0x686868, 0x000000, 0x404040, 0x404040, 0x404040, // base
0x20a020, 0x00ff00, 0xc80000, 0x20a020, // text
0x20a020, 0x00ff00, 0xc80000, 0x000000, // text
0x000000, 0x000000, 0x00ff00, 0xc80000, // UI elements
0x000000, 0x000000, 0x686868, 0x00ff00, 0x20a020, 0x00ff00, // buttons
0x20a020, // checkbox
@ -1044,9 +1044,8 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
0x20a020, 0x20a020, 0x000000 // other
},
// Light
{
0x808080, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, // base
0x000000, 0x0078d7, 0x0078d7, 0xffffff, // text
{ 0x808080, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, // base
0x000000, 0xBDDEF9, 0x0078d7, 0x000000, // text
0xf0f0f0, 0xffffff, 0x0078d7, 0x0f0f0f, // UI elements
0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons
0x333333, // checkbox

View File

@ -47,6 +47,20 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheckListWidget::setList(const StringList& list, const BoolArray& state)
{
@ -85,10 +99,7 @@ void CheckListWidget::drawWidget(bool hilite)
int i, pos, len = int(_list.size());
// Draw a thin frame around the list and to separate columns
s.hLine(_x, _y, _x + _w - 1, kColor);
s.hLine(_x, _y + _h - 1, _x + _w - 1, kShadowColor);
s.vLine(_x, _y, _y + _h - 1, kColor);
s.frameRect(_x, _y, _w, _h, hilite ? kWidColorHi : kColor);
s.vLine(_x + CheckboxWidget::boxSize() + 5, _y, _y + _h - 1, kColor);
// Draw the list items

View File

@ -37,13 +37,16 @@ class CheckListWidget : public ListWidget
int x, int y, int w, int h);
virtual ~CheckListWidget() = default;
void setStyle(CheckStyle style);
void setList(const StringList& list, const BoolArray& state);
void setLine(int line, const string& str, const bool& state);
bool getState(int line);
bool getSelectedState() { return getState(_selectedItem); }
protected:
void handleMouseEntered() override;
void handleMouseLeft() override;
private:
bool handleEvent(Event::Type e) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;

View File

@ -560,7 +560,7 @@ void ContextMenu::drawDialog()
int offset = _selectedOffset;
if(_showScroll)
{
s.hLine(x, y+_rowHeight-1, w+2, kShadowColor);
s.hLine(x, y+_rowHeight-1, w+2, kColor);
s.drawBitmap(up_arrow, ((_w-_x)>>1)-4, (_rowHeight>>1)+y-4, _scrollUpColor, 8);
y += _rowHeight;
offset--;
@ -571,14 +571,14 @@ void ContextMenu::drawDialog()
bool hilite = offset == current;
if(hilite) s.fillRect(x, y, w, _rowHeight, kTextColorHi);
s.drawString(_font, _entries[i].first, x + 1, y + 2, w,
!hilite ? kTextColor : kWidColor);
!hilite ? kTextColor : kTextColorInv);
y += _rowHeight;
}
// Show bottom scroll area
if(_showScroll)
{
s.hLine(x, y, w+2, kShadowColor);
s.hLine(x, y, w+2, kColor);
s.drawBitmap(down_arrow, ((_w-_x)>>1)-4, (_rowHeight>>1)+y-4, _scrollDnColor, 8);
}

View File

@ -209,8 +209,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
myTVJitterRecLabelWidget = new StaticTextWidget(myTab, font,
myTVJitterRecWidget->getRight() + 4,
myTVJitterRecWidget->getTop() + 2,
5 * fontWidth, fontHeight, "", TextAlign::Left);
wid.push_back(myTVJitterRecLabelWidget);
5 * fontWidth, fontHeight, "");
ypos += lineHeight + VGAP;
myColorLossWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
@ -434,7 +433,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myDebuggerWidthLabel =
new StaticTextWidget(myTab, font,
xpos + myDebuggerWidthSlider->getWidth() + 4,
ypos + 1, 4 * fontWidth, fontHeight, "", TextAlign::Left);
ypos + 1, 4 * fontWidth, fontHeight, "");
ypos += lineHeight + VGAP;
myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos-1, "Debugger height (*) ",
@ -446,7 +445,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myDebuggerHeightLabel =
new StaticTextWidget(myTab, font,
xpos + myDebuggerHeightSlider->getWidth() + 4,
ypos + 1, 4 * fontWidth, fontHeight, "", TextAlign::Left);
ypos + 1, 4 * fontWidth, fontHeight, "");
ypos += lineHeight + VGAP * 4;
myGhostReadsTrapWidget = new CheckboxWidget(myTab, font, HBORDER, ypos + 1,

View File

@ -160,7 +160,7 @@ void RadioButtonWidget::drawWidget(bool hilite)
FBSurface& s = _boss->dialog().surface();
// Draw the outer bounding circle
s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kWidColorHi : kShadowColor, 14, 14);
s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kWidColorHi : kColor, 14, 14);
// Draw the inner bounding circle with enabled color
s.drawBitmap(radio_img_innercircle, _x + 1, _y + _boxY + 1, isEnabled()
@ -170,7 +170,7 @@ void RadioButtonWidget::drawWidget(bool hilite)
if(_state)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled()
? hilite ? kWidColorHi : kCheckColor
: kShadowColor, 10);
: kColor, 10);
// Finally draw the label
s.drawString(_font, _label, _x + 20, _y + _textY, _w,

View File

@ -209,6 +209,7 @@ void ScrollBarWidget::checkBounds(int old_pos)
void ScrollBarWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -216,6 +217,7 @@ void ScrollBarWidget::handleMouseLeft()
{
_part = kNoPart;
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -250,7 +252,7 @@ void ScrollBarWidget::drawWidget(bool hilite)
int bottomY = _y + _h;
bool isSinglePage = (_numEntries <= _entriesPerPage);
s.frameRect(_x, _y, _w, _h, kShadowColor);
s.frameRect(_x, _y, _w, _h, hilite ? kWidColorHi : kColor);
if(_draggingPart != kNoPart)
_part = _draggingPart;

View File

@ -39,6 +39,20 @@ void StringListWidget::setList(const StringList& list)
ListWidget::recalc();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseEntered()
{
setFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::handleMouseLeft()
{
clearFlags(WIDGET_HILITED);
setDirty();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StringListWidget::drawWidget(bool hilite)
{
@ -46,9 +60,7 @@ void StringListWidget::drawWidget(bool hilite)
int i, pos, len = int(_list.size());
// Draw a thin frame around the list.
s.hLine(_x, _y, _x + _w - 1, kColor);
s.hLine(_x, _y + _h - 1, _x + _w - 1, kShadowColor);
s.vLine(_x, _y, _y + _h - 1, kColor);
s.frameRect(_x, _y, _w, _h, hilite && _hilite ? kWidColorHi : kColor);
// Draw the list items
for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++)

View File

@ -32,6 +32,8 @@ class StringListWidget : public ListWidget
bool wantsFocus() const override { return true; }
protected:
void handleMouseEntered() override;
void handleMouseLeft() override;
void drawWidget(bool hilite) override;
GUI::Rect getEditRect() const override;

View File

@ -609,13 +609,13 @@ void CheckboxWidget::drawWidget(bool hilite)
FBSurface& s = _boss->dialog().surface();
if(_drawBox)
s.frameRect(_x, _y + _boxY, 14, 14, hilite ? kWidColorHi : kShadowColor);
s.frameRect(_x, _y + _boxY, 14, 14, hilite && isEnabled() && isEditable() ? kWidColorHi : kColor);
// Do we draw a square or cross?
s.fillRect(_x + 1, _y + _boxY + 1, 12, 12, _changed ? kDbgChangedColor
: isEnabled() ? _bgcolor : kColor);
if(_state)
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite ? kWidColorHi : kCheckColor
: kShadowColor, 10);
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() ? hilite && isEditable() ? kWidColorHi : kCheckColor
: kColor, 10);
// Finally draw the label
s.drawString(_font, _label, _x + 20, _y + _textY, _w,