From 19730fa18398a42e6fdd8269d7026292c3a4f1f1 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 17 Dec 2017 00:48:30 +0100 Subject: [PATCH] third 'uipalette' scheme 'Light' added modernized UI via 'FLAT_UI' preprocessor define added --- src/debugger/gui/DataGridWidget.cxx | 9 ++- src/emucore/FrameBuffer.cxx | 22 +++++++- src/emucore/FrameBuffer.hxx | 2 +- src/gui/CheckListWidget.cxx | 9 +++ src/gui/ContextMenu.cxx | 4 ++ src/gui/Dialog.cxx | 4 ++ src/gui/PopUpWidget.cxx | 49 +++++++++++++++- src/gui/PopUpWidget.hxx | 4 ++ src/gui/RadioButtonWidget.cxx | 79 ++++++++++++++++++++++++++ src/gui/StringListWidget.cxx | 9 +++ src/gui/TabWidget.cxx | 33 ++++++++++- src/gui/TabWidget.hxx | 6 +- src/gui/UIDialog.cxx | 1 + src/gui/Widget.cxx | 87 +++++++++++++++++++++++++++-- src/gui/Widget.hxx | 4 +- src/windows/Stella.vcxproj | 8 +-- 16 files changed, 312 insertions(+), 18 deletions(-) diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index ac52903a9..7d6f710b0 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -599,21 +599,26 @@ void DataGridWidget::drawWidget(bool hilite) int x = _x + 4 + (col * _colWidth); int y = _y + 2 + (row * _rowHeight); int pos = row*_cols + col; + uInt32 color = kTextColor; // Draw the selected item inverted, on a highlighted background. if (_currentRow == row && _currentCol == col && _hasFocus && !_editMode) + { s.fillRect(x - 4, y - 2, _colWidth+1, _rowHeight+1, kTextColorHi); +#ifdef FLAT_UI + color = kWidColor; +#endif + } if (_selectedItem == pos && _editMode) { adjustOffset(); - s.drawString(_font, editString(), x, y, _colWidth, kTextColor, + s.drawString(_font, editString(), x, y, _colWidth, color, TextAlign::Left, -_editScrollOffset, false); } else { - uInt32 color = kTextColor; if(_changedList[pos]) { s.fillRect(x - 3, y - 1, _colWidth-1, _rowHeight-1, kDbgChangedColor); diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 35c54e577..c444fc0e3 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -130,7 +130,11 @@ bool FrameBuffer::initialize() } // Set palette for GUI (upper area of array, doesn't change during execution) - int palID = myOSystem.settings().getString("uipalette") == "classic" ? 1 : 0; + int palID = 0; + if(myOSystem.settings().getString("uipalette") == "classic") + palID = 1; + else if(myOSystem.settings().getString("uipalette") == "light") + palID = 2; for(int i = 0, j = 256; i < kNumColors-256; ++i, ++j) { @@ -937,12 +941,16 @@ void FrameBuffer::VideoModeList::setZoom(uInt32 zoom) kScrollColor Normal scrollbar color kScrollColorHi Highlighted scrollbar color + // Slider colors + kSliderColor, + kSliderColorHi + // Debugger colors kDbgChangedColor Background color for changed cells kDbgChangedTextColor Text color for changed cells kDbgColorHi Highlighted color in debugger data cells */ -uInt32 FrameBuffer::ourGUIColors[2][kNumColors-256] = { +uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = { // Standard { 0x686868, 0x000000, 0xa38c61, 0xdccfa5, 0x404040, 0x000000, 0x62a108, 0x9f0000, 0xc9af7c, 0xf0f0cf, 0xc80000, @@ -961,5 +969,15 @@ uInt32 FrameBuffer::ourGUIColors[2][kNumColors-256] = { 0x20a020, 0x00ff00, 0x20a020, 0x00ff00, 0xc80000, 0x00ff00, 0xc8c8ff + }, + // Light + { + 0x686868, 0x000000, 0xc0c0c0, 0xe1e1e1, 0x333333, 0x000000, 0x0078d7, 0x0078d7, // base + 0xf0f0f0, 0xffffff, 0x0f0f0f, // elements + 0xe1e1e1, 0xe5f1fb, 0x202020, 0x000000, // buttons + 0x333333, // checkbox + 0x808080, 0x0078d7, // scrollbar + 0x333333, 0x0078d7, // slider + 0x800000, 0xffff80, 0x00e0e0 // debugger } }; diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx index 575448d4b..0c8758608 100644 --- a/src/emucore/FrameBuffer.hxx +++ b/src/emucore/FrameBuffer.hxx @@ -520,7 +520,7 @@ class FrameBuffer vector> mySurfaceList; // Holds UI palette data (standard and classic colours) - static uInt32 ourGUIColors[2][kNumColors-256]; + static uInt32 ourGUIColors[3][kNumColors-256]; private: // Following constructors and assignment operators not supported diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 5caf3f103..b50ef9699 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -117,11 +117,20 @@ void CheckListWidget::drawWidget(bool hilite) if (_selectedItem == pos && _editMode) { adjustOffset(); +#ifndef FLAT_UI s.drawString(_font, editString(), _x + r.left, y, r.width(), kTextColor, TextAlign::Left, -_editScrollOffset, false); } else s.drawString(_font, _list[pos], _x + r.left, y, r.width(), kTextColor); +#else + s.drawString(_font, editString(), _x + r.left, y, r.width(), kTextColor, + TextAlign::Left, -_editScrollOffset, false); + } + else + s.drawString(_font, _list[pos], _x + r.left, y, r.width(), + _selectedItem == pos && hilite && _hasFocus && !_editMode ? kWidColor : kTextColor); +#endif } // Only draw the caret while editing, and if it's in the current viewport diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index ea7915503..3e046a21f 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -58,7 +58,11 @@ void ContextMenu::addItems(const VariantList& items) maxwidth = std::max(maxwidth, _font.getStringWidth(e.first)); _x = _y = 0; +#ifndef FLAT_UI _w = maxwidth + 10; +#else + _w = maxwidth + 10 + 5; +#endif _h = 1; // recalculate this in ::recalc() _scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 63c9c3be8..a6ecbef68 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -271,7 +271,11 @@ void Dialog::drawDialog() { // cerr << "Dialog::drawDialog(): w = " << _w << ", h = " << _h << " @ " << &s << endl << endl; s.fillRect(_x, _y, _w, _h, kDlgColor); +#ifndef FLAT_UI s.box(_x, _y, _w, _h, kColor, kShadowColor); +#else + s.frameRect(_x, _y, _w, _h, kColor); +#endif // !FLAT_UI // Make all child widget dirty Widget* w = _firstWidget; diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index 7cd6532ee..f7182f02b 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -24,6 +24,7 @@ #include "PopUpWidget.hxx" // Little up/down arrow +#ifndef FLAT_UI static uInt32 up_down_arrows[8] = { 0b00000000, 0b00001000, @@ -34,6 +35,18 @@ static uInt32 up_down_arrows[8] = { 0b00011100, 0b00001000, }; +#else +static uInt32 down_arrow[8] = { + 0b100000001, + 0b110000011, + 0b111000111, + 0b011101110, + 0b001111100, + 0b000111000, + 0b000010000, + 0b000000000 +}; +#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, @@ -53,7 +66,11 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, if(!_label.empty() && _labelWidth == 0) _labelWidth = _font.getStringWidth(_label); +#ifndef FLAT_UI _w = w + _labelWidth + 15; +#else + _w = w + _labelWidth + 23; +#endif // vertically center the arrows and text myTextY = (_h - _font.getFontHeight()) / 2; @@ -137,6 +154,22 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction) } } +#ifdef FLAT_UI +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void PopUpWidget::handleMouseEntered(int button) +{ + setFlags(WIDGET_HILITED); + setDirty(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void PopUpWidget::handleMouseLeft(int button) +{ + clearFlags(WIDGET_HILITED); + setDirty(); +} +#endif + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool PopUpWidget::handleEvent(Event::Type e) { @@ -190,18 +223,32 @@ void PopUpWidget::drawWidget(bool hilite) s.drawString(_font, _label, _x, _y + myTextY, _labelWidth, isEnabled() ? _textcolor : uInt32(kColor), TextAlign::Right); +#ifndef FLAT_UI // Draw a thin frame around us. 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.vLine(x + w - 1, _y, _y +_h - 1, kShadowColor); +#else + s.frameRect(x, _y, w - 16, _h, kColor); + s.frameRect(x + w - 17, _y, 17, _h, hilite ? kTextColorHi : kColor); +#endif // !FLAT_UI +#ifndef FLAT_UI // Fill the background s.fillRect(x + 1, _y + 1, w - 2, _h - 2, kWidColor); - // Draw an arrow pointing down at the right end to signal this is a dropdown/popup s.drawBitmap(up_down_arrows, x+w - 10, _y + myArrowsY, !isEnabled() ? kColor : hilite ? kTextColorHi : kTextColor); +#else + // Fill the background + s.fillRect(x + 1, _y + 1, w - 2 - 16, _h - 2, kWidColor); + s.fillRect(x + w - 15 - 1, _y + 1, 15, _h - 2, kBGColorHi); + //s.vLine(x + w - 17, _y, _y + _h - 1, kShadowColor); + // Draw an arrow pointing down at the right end to signal this is a dropdown/popup + s.drawBitmap(down_arrow, x + w - 13, _y + myArrowsY + 1, + !isEnabled() ? kCheckColor : kTextColor, 9u, 8u); +#endif // Draw the selected entry, if any const string& name = myMenu->getSelectedName(); diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx index df3423bb7..0b2a586c3 100644 --- a/src/gui/PopUpWidget.hxx +++ b/src/gui/PopUpWidget.hxx @@ -63,6 +63,10 @@ class PopUpWidget : public Widget, public CommandSender protected: void handleMouseDown(int x, int y, int button, int clickCount) override; void handleMouseWheel(int x, int y, int direction) override; +#ifdef FLAT_UI + void handleMouseEntered(int button) override; + void handleMouseLeft(int button) override; +#endif bool handleEvent(Event::Type e) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void drawWidget(bool hilite) override; diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 0e9e58a26..7c981e8c9 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -21,6 +21,7 @@ #include "RadioButtonWidget.hxx" /* Radiobutton bitmaps */ +#ifndef FLAT_UI static uInt32 radio_img_outercircle[14] = { 0b00001111110000, @@ -76,6 +77,69 @@ static uInt32 radio_img_inactive[8] = 0b01111110, 0b00111100 }; +#else +static uInt32 radio_img_outercircle[14] = +{ + 0b00001111110000, + 0b00110000001100, + 0b01000000000010, + 0b01000000000010, + 0b10000000000001, + 0b10000000000001, + 0b10000000000001, + 0b10000000000001, + 0b10000000000001, + 0b10000000000001, + 0b01000000000010, + 0b01000000000010, + 0b00110000001100, + 0b00001111110000 +}; + +static uInt32 radio_img_innercircle[12] = +{ + 0b000111111000, + 0b011111111110, + 0b011111111110, + 0b111111111111, + 0b111111111111, + 0b111111111111, + 0b111111111111, + 0b111111111111, + 0b111111111111, + 0b011111111110, + 0b011111111110, + 0b000111111000 +}; + +static uInt32 radio_img_active[10] = +{ + 0b0011111100, + 0b0111111110, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b0111111110, + 0b0011111100, +}; + +static uInt32 radio_img_inactive[10] = +{ + 0b0011111100, + 0b0111111110, + 0b1111001111, + 0b1110000111, + 0b1100000011, + 0b1100000011, + 0b1110000111, + 0b1111001111, + 0b0111111110, + 0b0011111100 +}; +#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, @@ -153,6 +217,7 @@ void RadioButtonWidget::drawWidget(bool hilite) { FBSurface& s = _boss->dialog().surface(); +#ifndef FLAT_UI // Draw the outer bounding circle s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, kShadowColor, 14, 14); @@ -162,6 +227,20 @@ void RadioButtonWidget::drawWidget(bool hilite) // draw state if(_state) s.drawBitmap(_img, _x + 3, _y + _boxY + 3, isEnabled() ? kCheckColor : kShadowColor); +#else + // Draw the outer bounding circle + s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kScrollColorHi : kShadowColor, 14, 14); + + // Draw the inner bounding circle with enabled color + s.drawBitmap(radio_img_innercircle, _x + 1, _y + _boxY + 1, isEnabled() + ? _bgcolor : kColor, 12, 12); + + // draw state + if(_state) + s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() + ? hilite ? kScrollColorHi : kCheckColor + : kShadowColor, 10); +#endif // Finally draw the label s.drawString(_font, _label, _x + 20, _y + _textY, _w, diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index 3cdc5102b..a2161e101 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -68,11 +68,20 @@ void StringListWidget::drawWidget(bool hilite) if (_selectedItem == pos && _editMode) { adjustOffset(); +#ifndef FLAT_UI s.drawString(_font, editString(), _x + r.left, y, r.width(), kTextColor, TextAlign::Left, -_editScrollOffset, false); } else s.drawString(_font, _list[pos], _x + r.left, y, r.width(), kTextColor); +#else + s.drawString(_font, editString(), _x + r.left, y, r.width(), kTextColor, + TextAlign::Left, -_editScrollOffset, false); + } + else + s.drawString(_font, _list[pos], _x + r.left, y, r.width(), + _selectedItem == pos && _hilite && _hasFocus && !_editMode ? kWidColor : kTextColor); +#endif } // Only draw the caret while editing, and if it's in the current viewport diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 31756d56b..22bd2ec13 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -193,6 +193,20 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TabWidget::handleMouseEntered(int button) +{ + setFlags(WIDGET_HILITED); + setDirty(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TabWidget::handleMouseLeft(int button) +{ + clearFlags(WIDGET_HILITED); + setDirty(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) { @@ -239,11 +253,12 @@ void TabWidget::loadConfig() updateActiveTab(); } +#ifndef FLAT_UI // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::box(int x, int y, int width, int height, uInt32 colorA, uInt32 colorB, bool omitBottom) { -//cerr << "TabWidget::box\n"; + //cerr << "TabWidget::box\n"; FBSurface& s = _boss->dialog().surface(); s.hLine(x + 1, y, x + width - 2, colorA); @@ -259,6 +274,7 @@ void TabWidget::box(int x, int y, int width, int height, s.vLine(x + width - 1, y + 1, y + height - (omitBottom ? 1 : 2), colorB); s.vLine(x + width - 2, y + 1, y + height - (omitBottom ? 2 : 1), colorB); } +#endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::drawWidget(bool hilite) @@ -275,9 +291,11 @@ void TabWidget::drawWidget(bool hilite) const int left2 = right1 + _tabWidth; const int right2 = _x + _w - 2; +#ifndef FLAT_UI // Draw horizontal line s.hLine(left1, _y + _tabHeight - 2, right1, kShadowColor); s.hLine(left2, _y + _tabHeight - 2, right2, kShadowColor); +#endif // Iterate over all tabs and draw them int i, x = _x + kTabLeftOffset; @@ -285,14 +303,24 @@ void TabWidget::drawWidget(bool hilite) { uInt32 fontcolor = _tabs[i].enabled ? kTextColor : kColor; uInt32 boxcolor = (i == _activeTab) ? kColor : kShadowColor; +#ifndef FLAT_UI int yOffset = (i == _activeTab) ? 0 : 2; box(x, _y + yOffset, _tabWidth, _tabHeight - yOffset, boxcolor, boxcolor, (i == _activeTab)); s.drawString(_font, _tabs[i].title, x + kTabPadding, _y + yOffset / 2 + (_tabHeight - _fontHeight - 1), _tabWidth - 2 * kTabPadding, fontcolor, TextAlign::Center); +#else + int yOffset = (i == _activeTab) ? 0 : 1; + s.fillRect(x, _y, _tabWidth, _tabHeight, (i == _activeTab) + ? kDlgColor : kBGColorHi); + s.drawString(_font, _tabs[i].title, x + kTabPadding + yOffset, + _y + yOffset + (_tabHeight - _fontHeight - 1), + _tabWidth - 2 * kTabPadding, (i == _activeTab |true) ? fontcolor : kColor, TextAlign::Center); +#endif x += _tabWidth + kTabSpacing; } +#ifndef FLAT_UI // Draw a frame around the widget area (belows the tabs) s.hLine(left1, _y + _tabHeight - 1, right1, kColor); s.hLine(left2, _y + _tabHeight - 1, right2, kColor); @@ -300,6 +328,9 @@ void TabWidget::drawWidget(bool hilite) s.hLine(_x+1, _y + _h - 1, _x + _w - 2, kColor); s.vLine(_x + _w - 2, _y + _tabHeight - 1, _y + _h - 2, kColor); s.vLine(_x + _w - 1, _y + _tabHeight - 1, _y + _h - 2, kShadowColor); +#else + s.hLine(right1, _y, left2, kScrollColorHi); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx index 4c71d0858..8ca79abce 100644 --- a/src/gui/TabWidget.hxx +++ b/src/gui/TabWidget.hxx @@ -60,6 +60,9 @@ class TabWidget : public Widget, public CommandSender protected: void handleMouseDown(int x, int y, int button, int clickCount) override; + void handleMouseEntered(int button) override; + void handleMouseLeft(int button) override; + void handleCommand(CommandSender* sender, int cmd, int data, int id) override; bool handleEvent(Event::Type event) override; @@ -93,9 +96,10 @@ class TabWidget : public Widget, public CommandSender }; private: +#ifndef FLAT_UI void box(int x, int y, int width, int height, uInt32 colorA, uInt32 colorB, bool omitBottom); - +#endif void updateActiveTab(); private: diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index d7bedf004..9c7ca195e 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -151,6 +151,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, items.clear(); VarList::push_back(items, "Standard", "standard"); VarList::push_back(items, "Classic", "classic"); + VarList::push_back(items, "Light", "light"); myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, items, "Interface Palette (*) ", lwidth); wid.push_back(myPalettePopup); diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 1e008ac4a..82f072404 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -90,7 +90,11 @@ void Widget::draw() // Draw border if(hasBorder) { +#ifndef FLAT_UI s.box(_x, _y, _w, _h, kColor, kShadowColor); +#else + s.frameRect(_x, _y, _w, _h, (_flags & WIDGET_HILITED) ? kScrollColorHi : kColor); +#endif // !FLAT_UI _x += 4; _y += 4; _w -= 8; @@ -442,6 +446,7 @@ void ButtonWidget::drawWidget(bool hilite) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* 8x8 checkbox bitmap */ +#ifndef FLAT_UI static uInt32 checked_img_active[8] = { 0b11111111, @@ -477,7 +482,49 @@ static uInt32 checked_img_circle[8] = 0b01111110, 0b00011000 }; +#else +static uInt32 checked_img_active[10] = +{ + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111 +}; +static uInt32 checked_img_inactive[10] = +{ + 0b1111111111, + 0b1111111111, + 0b1111001111, + 0b1110000111, + 0b1100000011, + 0b1100000011, + 0b1110000111, + 0b1111001111, + 0b1111111111, + 0b1111111111 +}; + +static uInt32 checked_img_circle[10] = +{ + 0b0001111000, + 0b0111111110, + 0b0111111110, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b1111111111, + 0b0111111110, + 0b0111111110, + 0b0001111000 +}; +#endif // !FLAT_UI // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label, @@ -512,6 +559,20 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, setFill(CheckboxWidget::Normal); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CheckboxWidget::handleMouseEntered(int button) +{ + setFlags(WIDGET_HILITED); + setDirty(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CheckboxWidget::handleMouseLeft(int button) +{ + clearFlags(WIDGET_HILITED); + setDirty(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) { @@ -574,14 +635,24 @@ void CheckboxWidget::drawWidget(bool hilite) { FBSurface& s = _boss->dialog().surface(); +#ifndef FLAT_UI // Draw the box if(_drawBox) s.box(_x, _y + _boxY, 14, 14, kColor, kShadowColor); - // Do we draw a square or cross? s.fillRect(_x + 2, _y + _boxY + 2, 10, 10, isEnabled() ? _bgcolor : kColor); if(_state) s.drawBitmap(_img, _x + 3, _y + _boxY + 3, isEnabled() ? kCheckColor : kShadowColor); +#else + if(_drawBox) + s.frameRect(_x, _y + _boxY, 14, 14, hilite ? kScrollColorHi : kShadowColor); + // Do we draw a square or cross? + s.fillRect(_x + 1, _y + _boxY + 1, 12, 12, isEnabled() ? _bgcolor : kColor); + if(_state) + s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled() + ? hilite ? kScrollColorHi : kCheckColor + : kShadowColor, 10); +#endif // Finally draw the label s.drawString(_font, _label, _x + 20, _y + _textY, _w, @@ -725,17 +796,25 @@ void SliderWidget::drawWidget(bool hilite) if(_labelWidth > 0) s.drawString(_font, _label, _x, _y + 2, _labelWidth, isEnabled() ? kTextColor : kColor, TextAlign::Right); - +#ifndef FLAT_UI // Draw the box s.box(_x + _labelWidth, _y, _w - _labelWidth, _h, kColor, kShadowColor); - // Fill the box s.fillRect(_x + _labelWidth + 2, _y + 2, _w - _labelWidth - 4, _h - 4, !isEnabled() ? kBGColorHi : kWidColor); - // Draw the 'bar' s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, !isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor); +#else + // Draw the box + s.frameRect(_x + _labelWidth, _y, _w - _labelWidth, _h, hilite ? kSliderColorHi : kShadowColor); + // Fill the box + s.fillRect(_x + _labelWidth + 1, _y + 1, _w - _labelWidth - 2, _h - 2, + !isEnabled() ? kBGColorHi : kWidColor); + // Draw the 'bar' + s.fillRect(_x + _labelWidth + 2, _y + 2, valueToPos(_value), _h - 4, + !isEnabled() ? kColor : hilite ? kSliderColorHi : kSliderColor); +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index f7b23e042..047cebe01 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -268,8 +268,8 @@ class CheckboxWidget : public ButtonWidget bool getState() const { return _state; } void handleMouseUp(int x, int y, int button, int clickCount) override; - void handleMouseEntered(int button) override { } - void handleMouseLeft(int button) override { } + void handleMouseEntered(int button) override; + void handleMouseLeft(int button) override; static int boxSize() { return 14; } // box is square diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 37c361957..c63e35bdd 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -111,7 +111,7 @@ /MP /std:c++latest %(AdditionalOptions) Disabled ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -142,7 +142,7 @@ /MP /std:c++latest %(AdditionalOptions) Disabled ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) false EnableFastChecks MultiThreadedDLL @@ -171,7 +171,7 @@ true false ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false @@ -204,7 +204,7 @@ Default true ..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories) - BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) + FLAT_UI;BSPF_WINDOWS;WIN32;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions) MultiThreadedDLL false