From f4f8bb435dc13276a608b11bc55007e8761725d8 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 5 May 2019 00:05:28 +0200 Subject: [PATCH] add R77 help dialog --- src/gui/HelpDialog.cxx | 9 +++--- src/gui/MinUICommandDialog.cxx | 22 ++++++++------- src/gui/OptionsDialog.cxx | 2 +- src/gui/StellaSettingsDialog.cxx | 45 ++++++++++++++++++++++++++---- src/gui/StellaSettingsDialog.hxx | 19 +++++++++++++ src/gui/module.mk | 1 + src/windows/Stella.vcxproj | 4 ++- src/windows/Stella.vcxproj.filters | 6 ++++ 8 files changed, 87 insertions(+), 21 deletions(-) diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index cf797d203..2b1148121 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -19,6 +19,7 @@ #include "Dialog.hxx" #include "Widget.hxx" #include "Font.hxx" + #include "HelpDialog.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -120,12 +121,12 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title) case 2: title = "Special commands"; - ADD_BIND("Ctrl g", "Grab mouse (keep in window)"); ADD_BIND("Ctrl f", "Switch between NTSC/PAL/SECAM"); - ADD_BIND("Ctrl s", "Save game properties to a"); - ADD_BIND("", " new file"); + ADD_BIND("Alt p", "Toggle 'phosphor' effect"); + ADD_BIND("Ctrl p", "Switch palette"); ADD_LINE(); - ADD_BIND("Ctrl 0", "Toggle controller for Mouse"); + ADD_BIND("Ctrl g", "Grab mouse (keep in window)"); + ADD_BIND("Ctrl 0", "Toggle controller for mouse"); ADD_BIND("Ctrl 1", "Toggle Stelladaptor left/right"); break; diff --git a/src/gui/MinUICommandDialog.cxx b/src/gui/MinUICommandDialog.cxx index 88f8ea3e2..cb5ab7df1 100644 --- a/src/gui/MinUICommandDialog.cxx +++ b/src/gui/MinUICommandDialog.cxx @@ -97,10 +97,10 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent wid.push_back(myStretchButton); myPhosphorButton = ADD_CD_BUTTON("", kPhosphorCmd); wid.push_back(myPhosphorButton); - bw = ADD_CD_BUTTON("Settings"+ ELLIPSIS, kSettings); - wid.push_back(bw); bw = ADD_CD_BUTTON("Fry", kFry); wid.push_back(bw); + bw = ADD_CD_BUTTON("Settings" + ELLIPSIS, kSettings); + wid.push_back(bw); // Bottom row xoffset = HBORDER + (buttonWidth + HGAP) / 2; @@ -185,7 +185,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd, consoleCmd = true; break; - // Column 2 + // Column 2 case kSaveStateCmd: event = Event::SaveState; consoleCmd = true; @@ -217,11 +217,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd, updateWinds(); break; - case GuiObject::kCloseCmd: - instance().eventHandler().leaveMenuMode(); - break; - - // Column 3 + // Column 3 case kFormatCmd: instance().console().toggleFormat(); updateTVFormat(); @@ -237,13 +233,18 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd, instance().console().togglePhosphor(); break; + case kFry: + instance().eventHandler().leaveMenuMode(); + instance().console().fry(); + break; + case kSettings: openSettings(); break; - case kFry: + // Bottom row + case GuiObject::kCloseCmd: instance().eventHandler().leaveMenuMode(); - instance().console().fry(); break; case kExitGameCmd: @@ -316,3 +317,4 @@ void MinUICommandDialog::openSettings() myOptionsDialog->open(); } } + diff --git a/src/gui/OptionsDialog.cxx b/src/gui/OptionsDialog.cxx index e7c37a243..7ce15e48a 100644 --- a/src/gui/OptionsDialog.cxx +++ b/src/gui/OptionsDialog.cxx @@ -70,7 +70,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, if (minSettings) { ButtonWidget* bw = new ButtonWidget(this, _font, xoffset, yoffset, - _w - HBORDER * 2, buttonHeight, "Switch to Basic Settings" + ELLIPSIS, kBasSetCmd); + _w - HBORDER * 2, buttonHeight, "Use Basic Settings", kBasSetCmd); wid.push_back(bw); yoffset += rowHeight + GAP * 2; _h += rowHeight + GAP * 2; diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index dcf16f0c2..40186de31 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -23,6 +23,14 @@ #include "NTSCFilter.hxx" #include "PopUpWidget.hxx" #include "MessageBox.hxx" +// FIXME - use the R77 define in the final release +// use the '1' define for testing +#if defined(RETRON77) +// #if 1 +#include "R77HelpDialog.hxx" +#else +#include "HelpDialog.hxx" +#endif #include "StellaSettingsDialog.hxx" @@ -30,16 +38,19 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode) : Dialog(osystem, parent, font, "Basic settings"), - myMode(mode) + myMode(mode), + myHelpDialog(nullptr) { const int VBORDER = 8; const int HBORDER = 10; const int INDENT = 20; const int buttonHeight = font.getLineHeight() + 6, lineHeight = font.getLineHeight(), - fontWidth = font.getMaxCharWidth(); + fontWidth = font.getMaxCharWidth(), + buttonWidth = _font.getStringWidth("Help" + ELLIPSIS) + 32; const int VGAP = 5; int xpos, ypos; + ButtonWidget* bw = nullptr; WidgetArray wid; VariantList items; @@ -50,9 +61,13 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa xpos = HBORDER; ypos = VBORDER + _th; - myAdvancedSettings = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2, buttonHeight, - "Switch to Advanced Settings" + ELLIPSIS, kAdvancedSettings); - wid.push_back(myAdvancedSettings); + bw = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2 - buttonWidth - 8, buttonHeight, + "Use Advanced Settings" + ELLIPSIS, kAdvancedSettings); + wid.push_back(bw); + bw = new ButtonWidget(this, font, bw->getRight() + 8, ypos, buttonWidth, buttonHeight, + "Help" + ELLIPSIS, kHelp); + wid.push_back(bw); + ypos += lineHeight + VGAP*4; new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:"); @@ -338,6 +353,10 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd, instance().eventHandler().leaveMenuMode(); break; + case kHelp: + openHelp(); + break; + case kScanlinesChanged: if(myTVScanIntense->getValue() == 0) myTVScanIntense->setValueLabel("Off"); @@ -481,3 +500,19 @@ int StellaSettingsDialog::valueToLevel(int value) } return 0; } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void StellaSettingsDialog::openHelp() +{ + // Create an help dialog, similar to the in-game one + // FIXME - use the R77 define in the final release + // use the '1' define for testing + if (myHelpDialog == nullptr) + #if defined(RETRON77) + // #if 1 + myHelpDialog = make_unique(instance(), parent(), _font); + #else + myHelpDialog = make_unique(instance(), parent(), _font); + #endif + myHelpDialog->open(); +} \ No newline at end of file diff --git a/src/gui/StellaSettingsDialog.hxx b/src/gui/StellaSettingsDialog.hxx index c794d8581..919e8b10e 100644 --- a/src/gui/StellaSettingsDialog.hxx +++ b/src/gui/StellaSettingsDialog.hxx @@ -19,6 +19,14 @@ #define STELLA_OPTIONS_DIALOG_HXX class PopUpWidget; +// FIXME - use the R77 define in the final release +// use the '1' define for testing +#if defined(RETRON77) +// #if 1 +class R77HelpDialog; +#else +class HelpDialog; +#endif #include "Props.hxx" #include "Menu.hxx" @@ -57,6 +65,8 @@ class StellaSettingsDialog : public Dialog int levelToValue(int level); int valueToLevel(int value); + void openHelp(); + private: // advanced settings mode: ButtonWidget* myAdvancedSettings; @@ -86,6 +96,14 @@ class StellaSettingsDialog : public Dialog StaticTextWidget* myRightPortDetected; unique_ptr myConfirmMsg; + // FIXME - use the R77 define in the final release + // use the '1' define for testing + #if defined(RETRON77) + // #if 1 + unique_ptr myHelpDialog; + #else + unique_ptr myHelpDialog; + #endif // Indicates if this dialog is used for global (vs. in-game) settings Menu::AppMode myMode; @@ -93,6 +111,7 @@ class StellaSettingsDialog : public Dialog enum { kAdvancedSettings = 'SSad', kConfirmSwitchCmd = 'SScf', + kHelp = 'SShl', kScanlinesChanged = 'SSsc', kPhosphorChanged = 'SSph' }; diff --git a/src/gui/module.mk b/src/gui/module.mk index 68bf66af8..fff96d32a 100644 --- a/src/gui/module.mk +++ b/src/gui/module.mk @@ -35,6 +35,7 @@ MODULE_OBJS := \ src/gui/OptionsDialog.o \ src/gui/PopUpWidget.o \ src/gui/ProgressDialog.o \ + src/gui/R77HelpDialog.o \ src/gui/RadioButtonWidget.o \ src/gui/RomAuditDialog.o \ src/gui/RomInfoWidget.o \ diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 104038853..23c629144 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -504,6 +504,7 @@ + @@ -1228,6 +1229,7 @@ + @@ -1405,4 +1407,4 @@ - + \ No newline at end of file diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index f0f35d00d..6c3bdfce7 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -972,6 +972,9 @@ Source Files + + Source Files\gui + @@ -1988,6 +1991,9 @@ Header Files + + Header Files\gui +