diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index f3a853f40..85a45911f 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -285,7 +285,7 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, getDynamicBounds(w, h); myOptions = make_unique(instance(), parent(), this, w, h, - OptionsMenu::AppMode::debugger); + AppMode::debugger); } myOptions->open(); diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index d10de8301..e6cd4badd 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -44,6 +44,9 @@ class Dialog : public GuiObject friend class DialogContainer; public: + // Current Stella mode + enum class AppMode { launcher, emulator, debugger }; + using RenderCallback = std::function; Dialog(OSystem& instance, DialogContainer& parent, diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx index cdfeaf58e..e51ecbc3a 100644 --- a/src/gui/HighScoresDialog.cxx +++ b/src/gui/HighScoresDialog.cxx @@ -98,7 +98,7 @@ static constexpr std::array NEXT_GFX_LARGE = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent, int max_w, int max_h, - OptionsMenu::AppMode mode) + AppMode mode) : Dialog(osystem, parent, osystem.frameBuffer().font(), "High Scores"), _max_w{max_w}, _max_h{max_h}, @@ -219,7 +219,7 @@ HighScoresDialog::~HighScoresDialog() void HighScoresDialog::loadConfig() { // Enable blending (only once is necessary) - if (myMode == OptionsMenu::AppMode::emulator && !surface().attributes().blending) + if (myMode == AppMode::emulator && !surface().attributes().blending) { surface().attributes().blending = true; surface().attributes().blendalpha = 90; @@ -314,7 +314,7 @@ void HighScoresDialog::handleCommand(CommandSender* sender, int cmd, int data, i saveConfig(); [[fallthrough]]; case kCloseCmd: - if(myMode != OptionsMenu::AppMode::emulator) + if(myMode != AppMode::emulator) close(); else instance().eventHandler().leaveMenuMode(); diff --git a/src/gui/HighScoresDialog.hxx b/src/gui/HighScoresDialog.hxx index 530088632..d3d3a4e94 100644 --- a/src/gui/HighScoresDialog.hxx +++ b/src/gui/HighScoresDialog.hxx @@ -47,7 +47,7 @@ class HighScoresDialog : public Dialog static constexpr uInt32 NUM_RANKS = 10; HighScoresDialog(OSystem& osystem, DialogContainer& parent, - int max_w, int max_h, OptionsMenu::AppMode mode); + int max_w, int max_h, AppMode mode); ~HighScoresDialog() override; protected: @@ -110,7 +110,7 @@ class HighScoresDialog : public Dialog StaticTextWidget* myMD5Widget{nullptr}; StaticTextWidget* myCheckSumWidget{nullptr}; - OptionsMenu::AppMode myMode{OptionsMenu::AppMode::emulator}; + AppMode myMode{AppMode::emulator}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/HighScoresMenu.cxx b/src/gui/HighScoresMenu.cxx index 9ca4d0b29..9a65d1c06 100644 --- a/src/gui/HighScoresMenu.cxx +++ b/src/gui/HighScoresMenu.cxx @@ -38,7 +38,7 @@ Dialog* HighScoresMenu::baseDialog() if (myHighScoresDialog == nullptr) myHighScoresDialog = new HighScoresDialog(myOSystem, *this, FBMinimum::Width, FBMinimum::Height, - OptionsMenu::AppMode::emulator); + Dialog::AppMode::emulator); return myHighScoresDialog; } diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index c97d47791..a8976e8a6 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -926,10 +926,10 @@ void LauncherDialog::openSettings() // Create an options dialog, similar to the in-game one if (instance().settings().getBool("basic_settings")) myDialog = make_unique(instance(), parent(), - _w, _h, OptionsMenu::AppMode::launcher); + _w, _h, AppMode::launcher); else myDialog = make_unique(instance(), parent(), this, _w, _h, - OptionsMenu::AppMode::launcher); + AppMode::launcher); myDialog->open(); } @@ -938,7 +938,7 @@ void LauncherDialog::openHighScores() { // Create an high scores dialog, similar to the in-game one myDialog = make_unique(instance(), parent(), _w, _h, - OptionsMenu::AppMode::launcher); + AppMode::launcher); myDialog->open(); } diff --git a/src/gui/MinUICommandDialog.cxx b/src/gui/MinUICommandDialog.cxx index e58094b53..de3728d98 100644 --- a/src/gui/MinUICommandDialog.cxx +++ b/src/gui/MinUICommandDialog.cxx @@ -321,14 +321,14 @@ void MinUICommandDialog::openSettings() if (instance().settings().getBool("basic_settings")) { myDialog = make_unique(instance(), parent(), - 1280, 720, OptionsMenu::AppMode::launcher); + 1280, 720, AppMode::launcher); myDialog->open(); } else { myDialog = make_unique(instance(), parent(), this, FBMinimum::Width, FBMinimum::Height, - OptionsMenu::AppMode::launcher); + AppMode::launcher); myDialog->open(); } } @@ -337,6 +337,6 @@ void MinUICommandDialog::openSettings() void MinUICommandDialog::openHighscores() { myDialog = make_unique(instance(), parent(), - 1280, 720, OptionsMenu::AppMode::emulator); + 1280, 720, AppMode::emulator); myDialog->open(); } diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index 646be5220..32c72e368 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -47,13 +47,13 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, - GuiObject* boss, int max_w, int max_h, OptionsMenu::AppMode mode) + GuiObject* boss, int max_w, int max_h, AppMode mode) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"), myBoss{boss}, myMode{mode} { // do not show basic settings options in debugger - bool minSettings = osystem.settings().getBool("minimal_ui") && mode != OptionsMenu::AppMode::debugger; + bool minSettings = osystem.settings().getBool("minimal_ui") && mode != AppMode::debugger; const int buttonHeight = Dialog::buttonHeight(), VBORDER = Dialog::vBorder(), HBORDER = Dialog::hBorder(), @@ -138,7 +138,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, addToFocusList(wid); // Certain buttons are disabled depending on mode - if(myMode == OptionsMenu::AppMode::launcher) + if(myMode == AppMode::launcher) { myCheatCodeButton->clearFlags(Widget::FLAG_ENABLED); } @@ -186,7 +186,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, case kBasSetCmd: // enable basic settings instance().settings().setValue("basic_settings", true); - if (myMode != OptionsMenu::AppMode::emulator) + if (myMode != AppMode::emulator) close(); else instance().eventHandler().leaveMenuMode(); @@ -297,7 +297,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd, break; case kExitCmd: - if(myMode != OptionsMenu::AppMode::emulator) + if(myMode != AppMode::emulator) close(); else instance().eventHandler().leaveMenuMode(); diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx index ce16245c6..7388289e4 100644 --- a/src/gui/OptionsDialog.hxx +++ b/src/gui/OptionsDialog.hxx @@ -30,7 +30,7 @@ class OptionsDialog : public Dialog { public: OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss, - int max_w, int max_h, OptionsMenu::AppMode mode); + int max_w, int max_h, AppMode mode); ~OptionsDialog() override; private: @@ -46,7 +46,7 @@ class OptionsDialog : public Dialog GuiObject* myBoss{nullptr}; // Indicates if this dialog is used for global (vs. in-game) settings - OptionsMenu::AppMode myMode{OptionsMenu::AppMode::emulator}; + AppMode myMode{AppMode::emulator}; enum { kBasSetCmd = 'BAST', diff --git a/src/gui/OptionsMenu.cxx b/src/gui/OptionsMenu.cxx index f12c6bed9..ed4af6353 100644 --- a/src/gui/OptionsMenu.cxx +++ b/src/gui/OptionsMenu.cxx @@ -44,14 +44,14 @@ Dialog* OptionsMenu::baseDialog() { if (stellaSettingDialog == nullptr) stellaSettingDialog = new StellaSettingsDialog(myOSystem, *this, - 1280, 720, AppMode::emulator); + 1280, 720, Dialog::AppMode::emulator); return stellaSettingDialog; } else { if (optionsDialog == nullptr) optionsDialog = new OptionsDialog(myOSystem, *this, nullptr, - FBMinimum::Width, FBMinimum::Height, AppMode::emulator); + FBMinimum::Width, FBMinimum::Height, Dialog::AppMode::emulator); return optionsDialog; } } diff --git a/src/gui/OptionsMenu.hxx b/src/gui/OptionsMenu.hxx index 3329d18ca..bb3e02215 100644 --- a/src/gui/OptionsMenu.hxx +++ b/src/gui/OptionsMenu.hxx @@ -32,9 +32,6 @@ class OptionsDialog; class OptionsMenu : public DialogContainer { public: - // Current Stella mode - enum class AppMode { launcher, emulator, debugger }; - /** Create a new menu stack */ diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index 604b836d0..15c87611f 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -30,7 +30,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent, - int max_w, int max_h, OptionsMenu::AppMode mode) + int max_w, int max_h, AppMode mode) : Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"), myMode{mode} { @@ -351,7 +351,7 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd, saveConfig(); [[fallthrough]]; case GuiObject::kCloseCmd: - if (myMode != OptionsMenu::AppMode::emulator) + if (myMode != AppMode::emulator) close(); else instance().eventHandler().leaveMenuMode(); @@ -363,7 +363,7 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd, case kConfirmSwitchCmd: instance().settings().setValue("basic_settings", false); - if (myMode != OptionsMenu::AppMode::emulator) + if (myMode != AppMode::emulator) close(); else instance().eventHandler().leaveMenuMode(); diff --git a/src/gui/StellaSettingsDialog.hxx b/src/gui/StellaSettingsDialog.hxx index a0349eb12..5e05a6d6a 100644 --- a/src/gui/StellaSettingsDialog.hxx +++ b/src/gui/StellaSettingsDialog.hxx @@ -39,7 +39,7 @@ class StellaSettingsDialog : public Dialog { public: StellaSettingsDialog(OSystem& osystem, DialogContainer& parent, - int max_w, int max_h, OptionsMenu::AppMode mode); + int max_w, int max_h, AppMode mode); ~StellaSettingsDialog() override; private: @@ -103,7 +103,7 @@ class StellaSettingsDialog : public Dialog #endif // Indicates if this dialog is used for global (vs. in-game) settings - OptionsMenu::AppMode myMode{OptionsMenu::AppMode::emulator}; + AppMode myMode{AppMode::emulator}; enum { kAdvancedSettings = 'SSad',