fixed bug when leaving 'Options' in debugger

This commit is contained in:
thrust26 2017-12-17 13:52:50 +01:00
parent 7f08d9b74c
commit 0def7adb61
5 changed files with 19 additions and 11 deletions

View File

@ -63,7 +63,7 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
// Inform the TIA output widget about its associated zoom widget // Inform the TIA output widget about its associated zoom widget
myTiaOutput->setZoomWidget(myTiaZoom); myTiaOutput->setZoomWidget(myTiaZoom);
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, false); myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, OptionsDialog::debugger);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -160,7 +160,7 @@ 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 // Create an options dialog, similar to the in-game one
myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, true); myOptions = make_unique<OptionsDialog>(osystem, parent, this, w, h, OptionsDialog::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

View File

@ -26,5 +26,5 @@ Menu::Menu(OSystem& osystem)
: DialogContainer(osystem) : DialogContainer(osystem)
{ {
myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr, myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr,
FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, false); FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, OptionsDialog::emulator);
} }

View File

@ -45,9 +45,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, bool global) GuiObject* boss, int max_w, int max_h, stellaMode mode)
: Dialog(osystem, parent), : Dialog(osystem, parent),
myIsGlobal(global) myMode(mode)
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
const int buttonWidth = font.getStringWidth("Developer Settings" + ELLIPSIS) + 20, const int buttonWidth = font.getStringWidth("Developer Settings" + ELLIPSIS) + 20,
@ -122,7 +122,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
addCancelWidget(b); addCancelWidget(b);
// Now create all the dialogs attached to each menu button // Now create all the dialogs attached to each menu button
myVideoDialog = make_unique<VideoDialog>(osystem, parent, font, max_w, max_h, myIsGlobal); myVideoDialog = make_unique<VideoDialog>(osystem, parent, font, max_w, max_h, myMode == launcher);
myAudioDialog = make_unique<AudioDialog>(osystem, parent, font); myAudioDialog = make_unique<AudioDialog>(osystem, parent, font);
myInputDialog = make_unique<InputDialog>(osystem, parent, font, max_w, max_h); myInputDialog = make_unique<InputDialog>(osystem, parent, font, max_w, max_h);
myUIDialog = make_unique<UIDialog>(osystem, parent, font); myUIDialog = make_unique<UIDialog>(osystem, parent, font);
@ -141,7 +141,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(myIsGlobal) if(myMode == launcher)
{ {
myCheatCodeButton->clearFlags(WIDGET_ENABLED); myCheatCodeButton->clearFlags(WIDGET_ENABLED);
} }
@ -225,7 +225,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
case kLoggerCmd: case kLoggerCmd:
// This dialog is resizable under certain conditions, so we need // This dialog is resizable under certain conditions, so we need
// to re-create it as necessary // to re-create it as necessary
if(!myIsGlobal) if(myMode != launcher)
{ {
uInt32 w = 0, h = 0; uInt32 w = 0, h = 0;
bool uselargefont = getResizableBounds(w, h); bool uselargefont = getResizableBounds(w, h);
@ -249,7 +249,7 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
break; break;
case kExitCmd: case kExitCmd:
if(myIsGlobal) if(myMode != emulator)
close(); close();
else else
instance().eventHandler().leaveMenuMode(); instance().eventHandler().leaveMenuMode();

View File

@ -45,8 +45,16 @@ class DeveloperDialog;
class OptionsDialog : public Dialog class OptionsDialog : public Dialog
{ {
public: public:
// Current Stella mode
enum stellaMode
{
launcher,
emulator,
debugger
};
OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss, OptionsDialog(OSystem& osystem, DialogContainer& parent, GuiObject* boss,
int max_w, int max_h, bool global); int max_w, int max_h, stellaMode mode);
virtual ~OptionsDialog(); virtual ~OptionsDialog();
private: private:
@ -75,7 +83,7 @@ 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
bool myIsGlobal; stellaMode myMode;
enum { enum {
kVidCmd = 'VIDO', kVidCmd = 'VIDO',