mirror of https://github.com/stella-emu/stella.git
add option to switch settings mode in minimal UI
This commit is contained in:
parent
a7cf51995e
commit
75650f1930
|
@ -67,7 +67,7 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
myTiaOutput->setZoomWidget(myTiaZoom);
|
myTiaOutput->setZoomWidget(myTiaZoom);
|
||||||
|
|
||||||
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h,
|
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h,
|
||||||
OptionsDialog::AppMode::debugger);
|
Menu::AppMode::debugger);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -118,6 +118,7 @@ Settings::Settings()
|
||||||
setPermanent("uipalette", "standard");
|
setPermanent("uipalette", "standard");
|
||||||
setPermanent("listdelay", "300");
|
setPermanent("listdelay", "300");
|
||||||
setPermanent("mwheel", "4");
|
setPermanent("mwheel", "4");
|
||||||
|
setPermanent("basic_settings", false);
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
setPermanent("autoslot", "false");
|
setPermanent("autoslot", "false");
|
||||||
|
|
|
@ -157,7 +157,7 @@ void DialogContainer::reStack()
|
||||||
while(!myDialogStack.empty())
|
while(!myDialogStack.empty())
|
||||||
myDialogStack.top()->close();
|
myDialogStack.top()->close();
|
||||||
|
|
||||||
myBaseDialog->open();
|
getBaseDialog()->open();
|
||||||
|
|
||||||
// Reset all continuous events
|
// Reset all continuous events
|
||||||
reset();
|
reset();
|
||||||
|
|
|
@ -141,6 +141,11 @@ class DialogContainer
|
||||||
*/
|
*/
|
||||||
const Dialog* baseDialog() const { return myBaseDialog; }
|
const Dialog* baseDialog() const { return myBaseDialog; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Return the bottom-most dialog of this container. Can be overwritten.
|
||||||
|
*/
|
||||||
|
virtual Dialog* getBaseDialog() { return myBaseDialog; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Inform the container that it should resize according to the current
|
Inform the container that it should resize according to the current
|
||||||
screen dimensions. We make this virtual, since the container may or
|
screen dimensions. We make this virtual, since the container may or
|
||||||
|
|
|
@ -55,7 +55,9 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
myPattern(nullptr),
|
myPattern(nullptr),
|
||||||
myAllFiles(nullptr),
|
myAllFiles(nullptr),
|
||||||
myRomInfoWidget(nullptr),
|
myRomInfoWidget(nullptr),
|
||||||
mySelectedItem(0)
|
mySelectedItem(0),
|
||||||
|
myStellaSettingsDialog(nullptr),
|
||||||
|
myOptionsDialog(nullptr)
|
||||||
{
|
{
|
||||||
myUseMinimalUI = instance().settings().getBool("minimal_ui");
|
myUseMinimalUI = instance().settings().getBool("minimal_ui");
|
||||||
|
|
||||||
|
@ -206,10 +208,6 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
}
|
}
|
||||||
mySelectedItem = 0; // Highlight 'Rom Listing'
|
mySelectedItem = 0; // Highlight 'Rom Listing'
|
||||||
|
|
||||||
// Create an options dialog, similar to the in-game one
|
|
||||||
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h,
|
|
||||||
OptionsDialog::AppMode::launcher);
|
|
||||||
|
|
||||||
// Create a game list, which contains all the information about a ROM that
|
// Create a game list, which contains all the information about a ROM that
|
||||||
// the launcher needs
|
// the launcher needs
|
||||||
myGameList = make_unique<GameList>();
|
myGameList = make_unique<GameList>();
|
||||||
|
@ -226,9 +224,6 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
// ROM properties
|
// ROM properties
|
||||||
myGlobalProps = make_unique<GlobalPropsDialog>(this,
|
myGlobalProps = make_unique<GlobalPropsDialog>(this,
|
||||||
myUseMinimalUI ? osystem.frameBuffer().launcherFont() : osystem.frameBuffer().font());
|
myUseMinimalUI ? osystem.frameBuffer().launcherFont() : osystem.frameBuffer().font());
|
||||||
if (myUseMinimalUI)
|
|
||||||
myStellaSettingsDialog =
|
|
||||||
make_unique<StellaSettingsDialog>(osystem, parent, osystem.frameBuffer().launcherFont(), w, h);
|
|
||||||
|
|
||||||
// Do we show only ROMs or all files?
|
// Do we show only ROMs or all files?
|
||||||
bool onlyROMs = instance().settings().getBool("launcherroms");
|
bool onlyROMs = instance().settings().getBool("launcherroms");
|
||||||
|
@ -468,7 +463,7 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_F8:
|
case KBDK_F8:
|
||||||
myStellaSettingsDialog->open();
|
openSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_F4:
|
case KBDK_F4:
|
||||||
|
@ -553,7 +548,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
case kOptionsCmd:
|
case kOptionsCmd:
|
||||||
myOptions->open();
|
openSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPrevDirCmd:
|
case kPrevDirCmd:
|
||||||
|
@ -640,3 +635,22 @@ void LauncherDialog::startGame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void LauncherDialog::openSettings()
|
||||||
|
{
|
||||||
|
// Create an options dialog, similar to the in-game one
|
||||||
|
if (instance().settings().getBool("basic_settings"))
|
||||||
|
{
|
||||||
|
if (myStellaSettingsDialog == nullptr)
|
||||||
|
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||||
|
instance().frameBuffer().launcherFont(), _w, _h, Menu::AppMode::launcher);
|
||||||
|
myStellaSettingsDialog->open();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (myOptionsDialog == nullptr)
|
||||||
|
myOptionsDialog = make_unique<OptionsDialog>(instance(), parent(), this, _w, _h,
|
||||||
|
Menu::AppMode::launcher);
|
||||||
|
myOptionsDialog->open();
|
||||||
|
}
|
||||||
|
}
|
|
@ -99,13 +99,14 @@ class LauncherDialog : public Dialog
|
||||||
void showOnlyROMs(bool state);
|
void showOnlyROMs(bool state);
|
||||||
bool matchPattern(const string& s, const string& pattern) const;
|
bool matchPattern(const string& s, const string& pattern) const;
|
||||||
void startGame();
|
void startGame();
|
||||||
|
void openSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unique_ptr<OptionsDialog> myOptions;
|
unique_ptr<OptionsDialog> myOptionsDialog;
|
||||||
|
unique_ptr<StellaSettingsDialog> myStellaSettingsDialog;
|
||||||
unique_ptr<GameList> myGameList;
|
unique_ptr<GameList> myGameList;
|
||||||
unique_ptr<ContextMenu> myMenu;
|
unique_ptr<ContextMenu> myMenu;
|
||||||
unique_ptr<GlobalPropsDialog> myGlobalProps;
|
unique_ptr<GlobalPropsDialog> myGlobalProps;
|
||||||
unique_ptr<StellaSettingsDialog> myStellaSettingsDialog;
|
|
||||||
unique_ptr<BrowserDialog> myRomDir;
|
unique_ptr<BrowserDialog> myRomDir;
|
||||||
|
|
||||||
ButtonWidget* myStartButton;
|
ButtonWidget* myStartButton;
|
||||||
|
|
|
@ -18,13 +18,33 @@
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
#include "FrameBufferConstants.hxx"
|
#include "FrameBufferConstants.hxx"
|
||||||
#include "OptionsDialog.hxx"
|
#include "OptionsDialog.hxx"
|
||||||
|
#include "StellaSettingsDialog.hxx"
|
||||||
|
#include "FrameBuffer.hxx"
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Menu.hxx"
|
#include "Menu.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Menu::Menu(OSystem& osystem)
|
Menu::Menu(OSystem& osystem)
|
||||||
: DialogContainer(osystem)
|
: DialogContainer(osystem),
|
||||||
|
stellaSettingDialog(nullptr),
|
||||||
|
optionsDialog(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Dialog* Menu::getBaseDialog()
|
||||||
{
|
{
|
||||||
myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr,
|
if (myOSystem.settings().getBool("basic_settings"))
|
||||||
FBMinimum::Width, FBMinimum::Height, OptionsDialog::AppMode::emulator);
|
{
|
||||||
|
if (stellaSettingDialog == nullptr)
|
||||||
|
stellaSettingDialog = new StellaSettingsDialog(myOSystem, *this, myOSystem.frameBuffer().font(),
|
||||||
|
FBMinimum::Width, FBMinimum::Height, AppMode::emulator);
|
||||||
|
return stellaSettingDialog;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (optionsDialog == nullptr)
|
||||||
|
optionsDialog = new OptionsDialog(myOSystem, *this, nullptr,
|
||||||
|
FBMinimum::Width, FBMinimum::Height, AppMode::emulator);
|
||||||
|
return optionsDialog;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#define MENU_HXX
|
#define MENU_HXX
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
class StellaSettingsDialog;
|
||||||
|
class OptionsDialog;
|
||||||
|
|
||||||
#include "DialogContainer.hxx"
|
#include "DialogContainer.hxx"
|
||||||
|
|
||||||
|
@ -30,12 +32,20 @@ class OSystem;
|
||||||
class Menu : public DialogContainer
|
class Menu : public DialogContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// Current Stella mode
|
||||||
|
enum class AppMode { launcher, emulator, debugger };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Create a new menu stack
|
Create a new menu stack
|
||||||
*/
|
*/
|
||||||
explicit Menu(OSystem& osystem);
|
explicit Menu(OSystem& osystem);
|
||||||
virtual ~Menu() = default;
|
virtual ~Menu() = default;
|
||||||
|
|
||||||
|
StellaSettingsDialog* stellaSettingDialog;
|
||||||
|
OptionsDialog* optionsDialog;
|
||||||
|
|
||||||
|
Dialog* getBaseDialog() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
Menu() = delete;
|
Menu() = delete;
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent)
|
MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent)
|
||||||
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands")
|
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"),
|
||||||
|
myStellaSettingsDialog(nullptr)
|
||||||
{
|
{
|
||||||
const int HBORDER = 10;
|
const int HBORDER = 10;
|
||||||
const int VBORDER = 10;
|
const int VBORDER = 10;
|
||||||
|
@ -101,9 +102,6 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent
|
||||||
wid.push_back(bw);
|
wid.push_back(bw);
|
||||||
|
|
||||||
addToFocusList(wid);
|
addToFocusList(wid);
|
||||||
|
|
||||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(osystem, parent, _font,
|
|
||||||
FBMinimum::Width, FBMinimum::Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -219,7 +217,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
if(myStellaSettingsDialog == nullptr || myStellaSettingsDialog->shouldResize(w, h))
|
if(myStellaSettingsDialog == nullptr || myStellaSettingsDialog->shouldResize(w, h))
|
||||||
{
|
{
|
||||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||||
instance().frameBuffer().font(), w, h);
|
instance().frameBuffer().font(), w, h, Menu::AppMode::emulator);
|
||||||
}
|
}
|
||||||
myStellaSettingsDialog->open();
|
myStellaSettingsDialog->open();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "OptionsDialog.hxx"
|
#include "OptionsDialog.hxx"
|
||||||
#include "Launcher.hxx"
|
#include "Launcher.hxx"
|
||||||
#include "Settings.hxx"
|
#include "Settings.hxx"
|
||||||
|
#include "Menu.hxx"
|
||||||
|
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
#include "CheatCodeDialog.hxx"
|
#include "CheatCodeDialog.hxx"
|
||||||
|
@ -46,10 +47,12 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
GuiObject* boss, int max_w, int max_h, AppMode mode)
|
GuiObject* boss, int max_w, int max_h, Menu::AppMode mode)
|
||||||
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"),
|
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"),
|
||||||
myMode(mode)
|
myMode(mode)
|
||||||
{
|
{
|
||||||
|
// do not show basic settings options in debugger
|
||||||
|
bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger;
|
||||||
const int buttonHeight = _font.getLineHeight() + 6,
|
const int buttonHeight = _font.getLineHeight() + 6,
|
||||||
rowHeight = _font.getLineHeight() + 10;
|
rowHeight = _font.getLineHeight() + 10;
|
||||||
const int VBORDER = 10 + _th;
|
const int VBORDER = 10 + _th;
|
||||||
|
@ -62,6 +65,15 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
WidgetArray wid;
|
WidgetArray wid;
|
||||||
ButtonWidget* b = nullptr;
|
ButtonWidget* b = nullptr;
|
||||||
|
|
||||||
|
if (minSettings)
|
||||||
|
{
|
||||||
|
ButtonWidget* bw = new ButtonWidget(this, _font, xoffset, yoffset,
|
||||||
|
_w - 10 * 2, buttonHeight, "Switch to Basic Settings" + ELLIPSIS, kBasSetCmd);
|
||||||
|
wid.push_back(bw);
|
||||||
|
yoffset += rowHeight + 8;
|
||||||
|
_h += rowHeight + 8;
|
||||||
|
}
|
||||||
|
|
||||||
auto ADD_OD_BUTTON = [&](const string& label, int cmd)
|
auto ADD_OD_BUTTON = [&](const string& label, int cmd)
|
||||||
{
|
{
|
||||||
ButtonWidget* bw = new ButtonWidget(this, _font, xoffset, yoffset,
|
ButtonWidget* bw = new ButtonWidget(this, _font, xoffset, yoffset,
|
||||||
|
@ -93,7 +105,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
wid.push_back(b);
|
wid.push_back(b);
|
||||||
|
|
||||||
// Move to second column
|
// Move to second column
|
||||||
xoffset += buttonWidth + 10; yoffset = VBORDER;
|
xoffset += buttonWidth + 10; yoffset = minSettings ? VBORDER + rowHeight + 8 : VBORDER;
|
||||||
|
|
||||||
myGameInfoButton = ADD_OD_BUTTON("Game Properties" + ELLIPSIS, kInfoCmd);
|
myGameInfoButton = ADD_OD_BUTTON("Game Properties" + ELLIPSIS, kInfoCmd);
|
||||||
wid.push_back(myGameInfoButton);
|
wid.push_back(myGameInfoButton);
|
||||||
|
@ -140,7 +152,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
addToFocusList(wid);
|
addToFocusList(wid);
|
||||||
|
|
||||||
// Certain buttons are disabled depending on mode
|
// Certain buttons are disabled depending on mode
|
||||||
if(myMode == AppMode::launcher)
|
if(myMode == Menu::AppMode::launcher)
|
||||||
{
|
{
|
||||||
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
|
myCheatCodeButton->clearFlags(WIDGET_ENABLED);
|
||||||
}
|
}
|
||||||
|
@ -183,6 +195,15 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
|
case kBasSetCmd:
|
||||||
|
// enable basic settings
|
||||||
|
instance().settings().setValue("basic_settings", true);
|
||||||
|
if (myMode != Menu::AppMode::emulator)
|
||||||
|
close();
|
||||||
|
else
|
||||||
|
instance().eventHandler().leaveMenuMode();
|
||||||
|
break;
|
||||||
|
|
||||||
case kVidCmd:
|
case kVidCmd:
|
||||||
{
|
{
|
||||||
// This dialog is resizable under certain conditions, so we need
|
// This dialog is resizable under certain conditions, so we need
|
||||||
|
@ -302,7 +323,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kExitCmd:
|
case kExitCmd:
|
||||||
if(myMode != AppMode::emulator)
|
if(myMode != Menu::AppMode::emulator)
|
||||||
close();
|
close();
|
||||||
else
|
else
|
||||||
instance().eventHandler().leaveMenuMode();
|
instance().eventHandler().leaveMenuMode();
|
||||||
|
|
|
@ -37,16 +37,14 @@ class AboutDialog;
|
||||||
class LoggerDialog;
|
class LoggerDialog;
|
||||||
class DeveloperDialog;
|
class DeveloperDialog;
|
||||||
|
|
||||||
|
#include "Menu.hxx"
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
|
|
||||||
class OptionsDialog : public Dialog
|
class OptionsDialog : public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Current Stella mode
|
|
||||||
enum class AppMode { launcher, emulator, debugger };
|
|
||||||
|
|
||||||
OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss,
|
OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss,
|
||||||
int max_w, int max_h, AppMode mode);
|
int max_w, int max_h, Menu::AppMode mode);
|
||||||
virtual ~OptionsDialog();
|
virtual ~OptionsDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -74,9 +72,10 @@ class OptionsDialog : public Dialog
|
||||||
ButtonWidget* myCheatCodeButton;
|
ButtonWidget* myCheatCodeButton;
|
||||||
|
|
||||||
// Indicates if this dialog is used for global (vs. in-game) settings
|
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||||
AppMode myMode;
|
Menu::AppMode myMode;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
kBasSetCmd = 'BAST',
|
||||||
kVidCmd = 'VIDO',
|
kVidCmd = 'VIDO',
|
||||||
kAudCmd = 'AUDO',
|
kAudCmd = 'AUDO',
|
||||||
kInptCmd = 'INPT',
|
kInptCmd = 'INPT',
|
||||||
|
|
|
@ -22,18 +22,21 @@
|
||||||
#include "ControllerDetector.hxx"
|
#include "ControllerDetector.hxx"
|
||||||
#include "NTSCFilter.hxx"
|
#include "NTSCFilter.hxx"
|
||||||
#include "PopUpWidget.hxx"
|
#include "PopUpWidget.hxx"
|
||||||
|
#include "MessageBox.hxx"
|
||||||
|
|
||||||
#include "StellaSettingsDialog.hxx"
|
#include "StellaSettingsDialog.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font, int max_w, int max_h)
|
const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode)
|
||||||
: Dialog(osystem, parent, font, "Stella settings")
|
: Dialog(osystem, parent, font, "Stella settings"),
|
||||||
|
myMode(mode)
|
||||||
{
|
{
|
||||||
const int VBORDER = 8;
|
const int VBORDER = 8;
|
||||||
const int HBORDER = 10;
|
const int HBORDER = 10;
|
||||||
const int INDENT = 20;
|
const int INDENT = 20;
|
||||||
const int lineHeight = font.getLineHeight(),
|
const int buttonHeight = font.getLineHeight() + 6,
|
||||||
|
lineHeight = font.getLineHeight(),
|
||||||
fontWidth = font.getMaxCharWidth();
|
fontWidth = font.getMaxCharWidth();
|
||||||
const int VGAP = 5;
|
const int VGAP = 5;
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
|
@ -42,15 +45,20 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
|
||||||
VariantList items;
|
VariantList items;
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
setSize(33 * fontWidth + HBORDER * 2, 13 * (lineHeight + VGAP) + VGAP * 8 + 6 + _th, max_w, max_h);
|
setSize(33 * fontWidth + HBORDER * 2, 14 * (lineHeight + VGAP) + VGAP * 9 + 6 + _th, max_w, max_h);
|
||||||
|
|
||||||
xpos = HBORDER;
|
xpos = HBORDER;
|
||||||
ypos = VBORDER + _th;
|
ypos = VBORDER + _th;
|
||||||
|
|
||||||
|
myAdvancedSettings = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2, buttonHeight,
|
||||||
|
"Switch to Advanced Settings" + ELLIPSIS, kAdvancedSettings);
|
||||||
|
ypos += lineHeight + VGAP*4;
|
||||||
|
|
||||||
new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:");
|
new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:");
|
||||||
xpos += INDENT;
|
xpos += INDENT;
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
|
|
||||||
addUIOptions(wid, xpos, ypos, font);
|
addUIOptions(wid, xpos, ypos, font);
|
||||||
ypos += VGAP * 4;
|
ypos += VGAP * 4;
|
||||||
addVideoOptions(wid, xpos, ypos, font);
|
addVideoOptions(wid, xpos, ypos, font);
|
||||||
|
@ -284,15 +292,32 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
case GuiObject::kOKCmd:
|
|
||||||
saveConfig();
|
|
||||||
close();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GuiObject::kDefaultsCmd:
|
case GuiObject::kDefaultsCmd:
|
||||||
setDefaults();
|
setDefaults();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GuiObject::kOKCmd:
|
||||||
|
saveConfig();
|
||||||
|
// falls through
|
||||||
|
case GuiObject::kCloseCmd:
|
||||||
|
if (myMode != Menu::AppMode::emulator)
|
||||||
|
close();
|
||||||
|
else
|
||||||
|
instance().eventHandler().leaveMenuMode();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kAdvancedSettings:
|
||||||
|
switchSettingsMode();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kConfirmSwitchCmd:
|
||||||
|
instance().settings().setValue("basic_settings", false);
|
||||||
|
if (myMode != Menu::AppMode::emulator)
|
||||||
|
close();
|
||||||
|
else
|
||||||
|
instance().eventHandler().leaveMenuMode();
|
||||||
|
break;
|
||||||
|
|
||||||
case kScanlinesChanged:
|
case kScanlinesChanged:
|
||||||
if(myTVScanIntense->getValue() == 0)
|
if(myTVScanIntense->getValue() == 0)
|
||||||
myTVScanIntense->setValueLabel("Off");
|
myTVScanIntense->setValueLabel("Off");
|
||||||
|
@ -309,6 +334,26 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void StellaSettingsDialog::switchSettingsMode()
|
||||||
|
{
|
||||||
|
StringList msg;
|
||||||
|
|
||||||
|
msg.push_back("Warning!");
|
||||||
|
msg.push_back("");
|
||||||
|
msg.push_back("Advanced settings should be");
|
||||||
|
msg.push_back("handled with care! When in");
|
||||||
|
msg.push_back("doubt, read the manual.");
|
||||||
|
msg.push_back("");
|
||||||
|
msg.push_back("If you are sure you want to");
|
||||||
|
msg.push_back("proceed with the switch, click");
|
||||||
|
msg.push_back("'OK', otherwise click 'Cancel'.");
|
||||||
|
|
||||||
|
myConfirmMsg = make_unique<GUI::MessageBox>(this, instance().frameBuffer().font(), msg,
|
||||||
|
_w-16, _h, kConfirmSwitchCmd, "OK", "Cancel", "Switch settings mode", false);
|
||||||
|
myConfirmMsg->show();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void StellaSettingsDialog::loadControllerProperties(const Properties& props)
|
void StellaSettingsDialog::loadControllerProperties(const Properties& props)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,17 +21,19 @@
|
||||||
class PopUpWidget;
|
class PopUpWidget;
|
||||||
|
|
||||||
#include "Props.hxx"
|
#include "Props.hxx"
|
||||||
|
#include "Menu.hxx"
|
||||||
#include "Dialog.hxx"
|
#include "Dialog.hxx"
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
class Font;
|
class Font;
|
||||||
|
class MessageBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
class StellaSettingsDialog : public Dialog
|
class StellaSettingsDialog : public Dialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
const GUI::Font& font, int max_w, int max_h);
|
const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode);
|
||||||
virtual ~StellaSettingsDialog() = default;
|
virtual ~StellaSettingsDialog() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -45,6 +47,9 @@ class StellaSettingsDialog : public Dialog
|
||||||
|
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
|
||||||
|
// switch to advanced settings after user confirmation
|
||||||
|
void switchSettingsMode();
|
||||||
|
|
||||||
// load the properties for the controller settings
|
// load the properties for the controller settings
|
||||||
void loadControllerProperties(const Properties& props);
|
void loadControllerProperties(const Properties& props);
|
||||||
|
|
||||||
|
@ -53,6 +58,9 @@ class StellaSettingsDialog : public Dialog
|
||||||
int valueToLevel(int value);
|
int valueToLevel(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// advanced settings mode:
|
||||||
|
ButtonWidget* myAdvancedSettings;
|
||||||
|
|
||||||
// UI theme
|
// UI theme
|
||||||
PopUpWidget* myThemePopup;
|
PopUpWidget* myThemePopup;
|
||||||
|
|
||||||
|
@ -76,7 +84,14 @@ class StellaSettingsDialog : public Dialog
|
||||||
PopUpWidget* myRightPort;
|
PopUpWidget* myRightPort;
|
||||||
StaticTextWidget* myRightPortDetected;
|
StaticTextWidget* myRightPortDetected;
|
||||||
|
|
||||||
|
unique_ptr<GUI::MessageBox> myConfirmMsg;
|
||||||
|
|
||||||
|
// Indicates if this dialog is used for global (vs. in-game) settings
|
||||||
|
Menu::AppMode myMode;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
kAdvancedSettings = 'SSad',
|
||||||
|
kConfirmSwitchCmd = 'SScf',
|
||||||
kScanlinesChanged = 'SSsc',
|
kScanlinesChanged = 'SSsc',
|
||||||
kPhosphorChanged = 'SSph'
|
kPhosphorChanged = 'SSph'
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,8 @@ SettingsR77::SettingsR77()
|
||||||
setPermanent("exitlauncher", "true");
|
setPermanent("exitlauncher", "true");
|
||||||
|
|
||||||
setTemporary("minimal_ui", true);
|
setTemporary("minimal_ui", true);
|
||||||
|
setPermanent("basic_settings", true);
|
||||||
|
|
||||||
setPermanent("dev.settings", false);
|
setPermanent("dev.settings", false);
|
||||||
// record states for 60 seconds
|
// record states for 60 seconds
|
||||||
setPermanent("plr.timemachine", true);
|
setPermanent("plr.timemachine", true);
|
||||||
|
|
Loading…
Reference in New Issue