mirror of https://github.com/stella-emu/stella.git
added alternative theme, switchable via hotkey. this is a preparation for SDL2 supporting system theme change events (day/night) soon
This commit is contained in:
parent
05a048186e
commit
790bc51c83
|
@ -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
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.7 KiB |
|
@ -2034,6 +2034,11 @@
|
|||
<td>Alt + Return</td>
|
||||
<td>Cmd + Return</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Toggle UI theme</td>
|
||||
<td>Alt + T</td>
|
||||
<td>Cmd + T</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Exit Stella</td>
|
||||
<td>Control + Q</td>
|
||||
|
@ -3149,7 +3154,17 @@
|
|||
|
||||
<tr>
|
||||
<td><pre>-uipalette <standard|classic|light|dark></pre></td>
|
||||
<td>Use the specified palette for UI elements.</td>
|
||||
<td>Define default palette/theme for UI elements.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-uipalette2 <standard|classic|light|dark></pre></td>
|
||||
<td>Define alternative palette/theme for UI elements.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-altpalette <1|0></pre></td>
|
||||
<td>Use alternative palette/theme for UI elements.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
@ -3850,7 +3865,8 @@
|
|||
<td valign="top">
|
||||
<table border="1" cellpadding="4">
|
||||
<tr><th>Item</th><th>Brief description</th><th>For more information,<br>see <a href="#CommandLine">Command Line</a></th></tr>
|
||||
<tr><td>Theme</td><td>Theme to use for UI elements (see examples)</td><td>-uipalette</td></tr>
|
||||
<tr><td>Theme #1</td><td>Default theme to use for UI elements (see examples)</td><td>-uipalette</td></tr>
|
||||
<tr><td>Theme #2</td><td>Alternative theme to use for UI elements (see examples)</td><td>-uipalette2</td></tr>
|
||||
<tr><td>Dialogs font</td><td>The font used in the dialogs</td><td>-dialogfont</td></tr>
|
||||
<tr><td>HiDPI mode</td><td>Scale the UI by a factor of two when enabled</td><td>-hidpi</td></tr>
|
||||
<tr><td>Dialogs position</td><td>Position of dialogs with Stella window</td><td>-dialogpos</td></tr>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
} };
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 <name> Last played ROM, automatically selected in\n"
|
||||
<< " launcher\n"
|
||||
<< " -romloadcount <number> Number of ROM to load next from multicard\n"
|
||||
<< " -uipalette <standard| Selects GUI theme\n"
|
||||
<< " -uipalette <standard| Set GUI theme\n"
|
||||
<< " classic|\n"
|
||||
<< " light|dark>\n"
|
||||
<< " -uipalette2 <standard| Set alternative GUI theme\n"
|
||||
<< " classic|\n"
|
||||
<< " light|dark>\n"
|
||||
<< " -altuipalette <0|1> Enable alternative GUI theme\n"
|
||||
<< " -hidpi <0|1> Enable HiDPI mode\n"
|
||||
<< " -dialogfont <small| Use the specified font in the dialogs\n"
|
||||
<< " low_medium|\n"
|
||||
|
|
|
@ -83,9 +83,16 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
VarList::push_back(items, "Classic", "classic");
|
||||
VarList::push_back(items, "Light", "light");
|
||||
VarList::push_back(items, "Dark", "dark");
|
||||
myPalettePopup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "Theme ", lwidth);
|
||||
wid.push_back(myPalettePopup);
|
||||
myPalette1Popup = new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
|
||||
items, "Theme #1 ", lwidth);
|
||||
myPalette1Popup->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");
|
||||
|
|
|
@ -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};
|
||||
|
|
Loading…
Reference in New Issue