diff --git a/Changes.txt b/Changes.txt index fdac5948c..779db32b2 100644 --- a/Changes.txt +++ b/Changes.txt @@ -22,6 +22,8 @@ * Enhanced Game Properties dialog for multigame ROMs. + * Added 2nd UI theme and hotkey for toggling UI theme. + * Added optional type format detection based on colors used. * Added Joy2B+ controller support. @@ -34,6 +36,8 @@ * Fixed broken 7800 pause key support. + * Fixed broken mouse and Stelladaptor input for Driving Controller. + * Added user defined CPU cycle timers to debugger. * For UNIX systems: Now defaults to using system-installed libsqlite3 diff --git a/docs/graphics/options_misc.png b/docs/graphics/options_misc.png index f4ebf7ca4..f8d676b2b 100644 Binary files a/docs/graphics/options_misc.png and b/docs/graphics/options_misc.png differ diff --git a/docs/index.html b/docs/index.html index c56982542..566b056cc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2034,6 +2034,11 @@

Hotkeys

Alt + Return Cmd + Return + + Toggle UI theme + Alt + T + Cmd + T + Exit Stella Control + Q @@ -3149,7 +3154,17 @@

Using the Command Line

-uipalette <standard|classic|light|dark>
- Use the specified palette for UI elements. + Define default palette/theme for UI elements. + + + +
-uipalette2 <standard|classic|light|dark>
+ Define alternative palette/theme for UI elements. + + + +
-altpalette <1|0>
+ Use alternative palette/theme for UI elements. @@ -3850,7 +3865,8 @@

Changing Options

- + + diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index 2936ba99a..e66ca015d 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -836,6 +836,7 @@ PhysicalKeyboardHandler::DefaultMenuMapping = { {Event::UITabPrev, KBDK_TAB, KBDM_SHIFT | KBDM_CTRL}, {Event::UITabNext, KBDK_TAB, KBDM_CTRL}, + {Event::ToggleUIPalette, KBDK_T, MOD3}, {Event::ToggleFullScreen, KBDK_RETURN, MOD3}, #ifdef BSPF_MACOS diff --git a/src/common/jsonDefinitions.hxx b/src/common/jsonDefinitions.hxx index 642f27ec3..b3e74590f 100644 --- a/src/common/jsonDefinitions.hxx +++ b/src/common/jsonDefinitions.hxx @@ -284,6 +284,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, { {Event::UITabPrev, "UITabPrev"}, {Event::UITabNext, "UITabNext"}, {Event::UIHelp, "UIHelp"}, + {Event::ToggleUIPalette, "ToggleUIPalette" }, {Event::MouseAxisXMove, "MouseAxisXMove"}, {Event::MouseAxisYMove, "MouseAxisYMove"}, {Event::MouseAxisXValue, "MouseAxisXValue"}, diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index 2211351ab..efa863f4d 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -148,7 +148,7 @@ class Event SelectHome, SelectEnd, SelectAll, Delete, DeleteLeftWord, DeleteRightWord, DeleteHome, DeleteEnd, Backspace, Cut, Copy, Paste, Undo, Redo, - AbortEdit, EndEdit, + AbortEdit, EndEdit, ToggleUIPalette, HighScoresMenuMode, // Input settings diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 904273b94..36d53a489 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -237,6 +237,14 @@ void EventHandler::set7800Mode() myIs7800 = false; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void EventHandler::toggleUIPalette() +{ + myOSystem.settings().setValue("altuipalette", !myOSystem.settings().getBool("altuipalette")); + myOSystem.frameBuffer().setUIPalette(); + myOSystem.frameBuffer().update(FrameBuffer::UpdateMode::REDRAW); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EventHandler::changeMouseControl(int direction) { @@ -529,6 +537,13 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) } return; + case Event::ToggleUIPalette: + if(pressed && !repeated) + { + toggleUIPalette(); + } + break; + case Event::ToggleFullScreen: if(pressed && !repeated) { @@ -3109,6 +3124,7 @@ EventHandler::MenuActionList EventHandler::ourMenuActionList = { { { Event::UIPrevDir, "Parent directory" }, { Event::ToggleFullScreen, "Toggle fullscreen" }, + { Event::ToggleUIPalette, "Toggle UI theme" }, { Event::Quit, "Quit" } } }; diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 9d2453278..93e64acd1 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -98,6 +98,11 @@ class EventHandler */ void set7800Mode(); + /** + Toggle between UI theme #1 and #2. + */ + void toggleUIPalette(); + /** Collects and dispatches any pending events. This method should be called regularly (at X times per second, where X is the game framerate). @@ -527,7 +532,7 @@ class EventHandler REFRESH_SIZE = 0, #endif EMUL_ACTIONLIST_SIZE = 232 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE, - MENU_ACTIONLIST_SIZE = 19 + MENU_ACTIONLIST_SIZE = 20 ; // The event(s) assigned to each combination event diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 38c18810b..9eef64bc9 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -989,11 +989,13 @@ void FrameBuffer::setTIAPalette(const PaletteArray& rgb_palette) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBuffer::setUIPalette() { + const Settings& settings = myOSystem.settings(); + const string& key = settings.getBool("altuipalette") ? "uipalette2" : "uipalette"; // Set palette for UI (upper area of full palette) const UIPaletteArray& ui_palette = - (myOSystem.settings().getString("uipalette") == "classic") ? ourClassicUIPalette : - (myOSystem.settings().getString("uipalette") == "light") ? ourLightUIPalette : - (myOSystem.settings().getString("uipalette") == "dark") ? ourDarkUIPalette : + (settings.getString(key) == "classic") ? ourClassicUIPalette : + (settings.getString(key) == "light") ? ourLightUIPalette : + (settings.getString(key) == "dark") ? ourDarkUIPalette : ourStandardUIPalette; for(size_t i = 0, j = myFullPalette.size() - ui_palette.size(); diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 92ee2c2b4..307ae6a72 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -181,6 +181,8 @@ Settings::Settings() setPermanent("dbg.display", 0); #endif setPermanent("uipalette", "standard"); + setPermanent("uipalette2", "dark"); + setPermanent("altuipalette", "false"); setPermanent("hidpi", "false"); setPermanent("listdelay", "300"); setPermanent("mwheel", "4"); @@ -648,9 +650,13 @@ void Settings::usage() << " -lastrom Last played ROM, automatically selected in\n" << " launcher\n" << " -romloadcount Number of ROM to load next from multicard\n" - << " -uipalette \n" + << " -uipalette2 \n" + << " -altuipalette <0|1> Enable alternative GUI theme\n" << " -hidpi <0|1> Enable HiDPI mode\n" << " -dialogfont setToolTip("Primary theme.", Event::ToggleUIPalette, EventMode::kMenuMode); + wid.push_back(myPalette1Popup); + ypos += lineHeight + VGAP; + + myPalette2Popup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight, + items, "Theme #2 ", lwidth); + myPalette2Popup->setToolTip("Alternative theme.", Event::ToggleUIPalette, EventMode::kMenuMode); + wid.push_back(myPalette2Popup); ypos += lineHeight + VGAP; // Dialog font @@ -128,8 +135,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, wid.push_back(myCenter); // Delay between quick-selecting characters in ListWidget - xpos = HBORDER; ypos += lineHeight + VGAP * 4; - const int swidth = myPalettePopup->getWidth() - lwidth; + xpos = HBORDER; ypos += lineHeight + VGAP * 3; + const int swidth = myPalette1Popup->getWidth() - lwidth; myListDelaySlider = new SliderWidget(myTab, font, xpos, ypos, swidth, lineHeight, "List input delay ", 0, kListDelay, font.getStringWidth("1 second")); @@ -388,8 +395,10 @@ void UIDialog::loadConfig() myLauncherExitWidget->setState(exitlauncher); // UI palette - const string& pal = settings.getString("uipalette"); - myPalettePopup->setSelected(pal, "standard"); + const string& pal1 = settings.getString("uipalette"); + myPalette1Popup->setSelected(pal1, "standard"); + const string& pal2 = settings.getString("uipalette2"); + myPalette2Popup->setSelected(pal2, "dark"); // Dialog font const string& dialogFont = settings.getString("dialogfont"); @@ -478,7 +487,9 @@ void UIDialog::saveConfig() // UI palette settings.setValue("uipalette", - myPalettePopup->getSelectedTag().toString()); + myPalette1Popup->getSelectedTag().toString()); + settings.setValue("uipalette2", + myPalette2Popup->getSelectedTag().toString()); instance().frameBuffer().setUIPalette(); instance().frameBuffer().update(FrameBuffer::UpdateMode::REDRAW); @@ -526,7 +537,8 @@ void UIDialog::setDefaults() switch(myTab->getActiveTab()) { case 0: // Misc. options - myPalettePopup->setSelected("standard"); + myPalette1Popup->setSelected("standard"); + myPalette2Popup->setSelected("dark"); myDialogFontPopup->setSelected("medium", ""); myHidpiWidget->setState(false); myPositionPopup->setSelected("0"); diff --git a/src/gui/UIDialog.hxx b/src/gui/UIDialog.hxx index e3b7172bf..d67e24c84 100644 --- a/src/gui/UIDialog.hxx +++ b/src/gui/UIDialog.hxx @@ -66,7 +66,8 @@ class UIDialog : public Dialog, public CommandSender CheckboxWidget* myLauncherExitWidget{nullptr}; // Misc options - PopUpWidget* myPalettePopup{nullptr}; + PopUpWidget* myPalette1Popup{nullptr}; + PopUpWidget* myPalette2Popup{nullptr}; PopUpWidget* myDialogFontPopup{nullptr}; CheckboxWidget* myHidpiWidget{nullptr}; PopUpWidget* myPositionPopup{nullptr};
ItemBrief descriptionFor more information,
see Command Line
ThemeTheme to use for UI elements (see examples)-uipalette
Theme #1Default theme to use for UI elements (see examples)-uipalette
Theme #2Alternative theme to use for UI elements (see examples)-uipalette2
Dialogs fontThe font used in the dialogs-dialogfont
HiDPI modeScale the UI by a factor of two when enabled-hidpi
Dialogs positionPosition of dialogs with Stella window-dialogpos