diff --git a/Changes.txt b/Changes.txt index 988baedd5..fd0887312 100644 --- a/Changes.txt +++ b/Changes.txt @@ -14,11 +14,13 @@ 6.5.2 to 6.5.3 (XXX, 2021) + * Added context-sensitive help (TODO: doc) + * Improved support of multiple monitors with different resolutions. * Improved analog input reading (Paddles, Keyboards...). - * Fixed QuadTari handling for controller types other than Joysticks. + * Fixed QuadTari support for controller types other than Joysticks. * Fixed palette and TV effects saving for Retron77. diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index f865a0a20..b227c4e98 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -811,6 +811,7 @@ PhysicalKeyboardHandler::DefaultMenuMapping = { {Event::UITabNext, KBDK_BACKSPACE}, // back (FRY) #else // defining duplicate keys must be avoided! {Event::UIPrevDir, KBDK_BACKSPACE}, + {Event::UIHelp, KBDK_F1}, #endif }; diff --git a/src/common/jsonDefinitions.hxx b/src/common/jsonDefinitions.hxx index 9d0f023db..ad7e360ee 100644 --- a/src/common/jsonDefinitions.hxx +++ b/src/common/jsonDefinitions.hxx @@ -267,6 +267,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, { {Event::UIPrevDir, "UIPrevDir"}, {Event::UITabPrev, "UITabPrev"}, {Event::UITabNext, "UITabNext"}, + {Event::UIHelp, "UIHelp"}, {Event::MouseAxisXMove, "MouseAxisXMove"}, {Event::MouseAxisYMove, "MouseAxisYMove"}, {Event::MouseAxisXValue, "MouseAxisXValue"}, diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index 8cf789ea6..6a0534cd0 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -168,6 +168,7 @@ class Event SALeftAxis0Value, SALeftAxis1Value, SARightAxis0Value, SARightAxis1Value, PaddleFourFire, PaddleFiveFire, PaddleSixFire, PaddleSevenFire, + UIHelp, LastType }; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 8380b25b3..a10f6ea4b 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -3306,7 +3306,9 @@ EventHandler::MenuActionList EventHandler::ourMenuActionList = { { { Event::UIPrevDir, "Parent directory", "" }, { Event::ToggleFullScreen, "Toggle fullscreen", "" }, - { Event::Quit, "Quit", "" } + { Event::Quit, "Quit", "" }, + { Event::UIHelp, "Help" "" } + } }; // Event groups diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index 1e37a46e4..645ef4a74 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -646,7 +646,7 @@ class EventHandler REFRESH_SIZE = 0, #endif EMUL_ACTIONLIST_SIZE = 211 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE, - MENU_ACTIONLIST_SIZE = 18 + MENU_ACTIONLIST_SIZE = 19 ; // The event(s) assigned to each combination event diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index ea59b42ad..90ee3dafe 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -152,9 +152,13 @@ void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger) _debuggerHelp = debugger; if(_helpWidget == nullptr) + { _helpWidget = new ButtonWidget(this, _font, _w - _font.getMaxCharWidth() * 3.5, 0, - _font.getMaxCharWidth() * 3.5, buttonHeight(), "?", + _font.getMaxCharWidth() * 3.5 + 0.5, buttonHeight(), "?", kHelpCmd); + _helpWidget->setBGColor(kColorTitleBar); + _helpWidget->setTextColor(kColorTitleText); + } if(hasTitle() && hasHelp()) _helpWidget->clearFlags(Widget::FLAG_INVISIBLE); @@ -166,10 +170,26 @@ void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string Dialog::getHelpURL() { - if(_debuggerHelp) - return "https://stella-emu.github.io/docs/debugger.html#" + _helpAnchor; - else - return "https://stella-emu.github.io/docs/index.html#" + _helpAnchor; + if(!_helpAnchor.empty()) + { + if(_debuggerHelp) + return "https://stella-emu.github.io/docs/debugger.html#" + _helpAnchor; + else + return "https://stella-emu.github.io/docs/index.html#" + _helpAnchor; + } + return EmptyString; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Dialog::openHelp() +{ + if(hasHelp()) + { + if(SDL_OpenURL(getHelpURL().c_str())) + { + cerr << "error opening URL " << getHelpURL() << endl; + } + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -831,6 +851,9 @@ bool Dialog::handleNavEvent(Event::Type e, bool repeated) return true; } break; + case Event::UIHelp: + openHelp(); + return true; default: return false; @@ -880,14 +903,9 @@ void Dialog::handleCommand(CommandSender* sender, int cmd, int data, int id) break; case kHelpCmd: - if(hasHelp()) - { - if(SDL_OpenURL(getHelpURL().c_str())) - { - cerr << "error opening URL " << getHelpURL() << endl; - } + openHelp(); break; - } + default: break; } diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index ac0e96dd2..4e1f6ad22 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -98,7 +98,6 @@ class Dialog : public GuiObject bool hasTitle() { return !_title.empty(); } void setHelpAnchor(const string& helpAnchor, bool debugger = false); - const string getHelpURL(); virtual bool isShading() const { return true; } @@ -201,8 +200,6 @@ class Dialog : public GuiObject virtual bool repeatEnabled() { return true; } - bool hasHelp() { return !getHelpURL().empty(); } - private: enum { kHelpCmd = 'DlHp' @@ -212,6 +209,9 @@ class Dialog : public GuiObject bool handleNavEvent(Event::Type e, bool repeated = false); void getTabIdForWidget(Widget* w); bool cycleTab(int direction); + const string getHelpURL(); + bool hasHelp() { return !getHelpURL().empty(); } + void openHelp(); protected: const GUI::Font& _font; diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index dbbae7046..7c78b6867 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -84,7 +84,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent, addToFocusList(wid); - setHelpAnchor(" "); + setHelpAnchor("Hotkeys"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index b41d4a03d..6d1452ef1 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -235,8 +235,6 @@ void InputDialog::addDevicePortTab() // Add items for virtual device ports addToFocusList(wid, myTab, tabID); - - setHelpAnchor("Input"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/RomAuditDialog.cxx b/src/gui/RomAuditDialog.cxx index 40cec0fd7..27baecda6 100644 --- a/src/gui/RomAuditDialog.cxx +++ b/src/gui/RomAuditDialog.cxx @@ -83,6 +83,8 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent, // Add OK and Cancel buttons addOKCancelBGroup(wid, font, "Audit", "Close"); addBGroupToFocusList(wid); + + setHelpAnchor("ROMAudit"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx index 4a17ffbb2..0cdc3052d 100644 --- a/src/gui/WhatsNewDialog.cxx +++ b/src/gui/WhatsNewDialog.cxx @@ -55,9 +55,12 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, add(ypos, "fixed paddle button bug for jittering controllers"); add(ypos, "improved switching between joysticks and paddles"); add(ypos, "improved memory usage in UI mode"); + add(ypos, "fixed broken Driving Controller support for Stelladaptor/2600-daptor devices"); + add(ypos, "fixed missing QuadTari option in UI"); } - add(ypos, "fixed broken Driving Controller support for Stelladaptor/2600-daptor devices"); - add(ypos, "fixed missing QuadTari option in UI"); + add(ypos, "improved analog input reading"); + add(ypos, "fixed QuadTari support for some controller types"); + add(ypos, "fixed palette and TV effects saving"); #else if(version < "6.5") { @@ -70,9 +73,13 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, add(ypos, "added sound to Time Machine playback"); add(ypos, "moved settings, properties etc. to an SQLite database"); add(ypos, "fixed paddle button bug for jittering controllers"); + add(ypos, "fixed broken Driving Controller support for Stelladaptor/2600-daptor devices"); + add(ypos, "fixed missing QuadTari option in UI"); } - add(ypos, "fixed broken Driving Controller support for Stelladaptor/2600-daptor devices"); - add(ypos, "fixed missing QuadTari option in UI"); + add(ypos, "added context-sensitive help"); + add(ypos, "improved analog input reading"); + add(ypos, "improved multi-monitor support"); + add(ypos, "fixed QuadTari support for some controller types"); add(ypos, ELLIPSIS + " (for a complete list see 'docs/Changes.txt')"); #endif