diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index b227c4e98..853ed4cea 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -811,7 +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}, + {Event::UIHelp, KBDK_F1}, #endif }; diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx index 62c47b050..743c966bd 100644 --- a/src/gui/AboutDialog.cxx +++ b/src/gui/AboutDialog.cxx @@ -87,6 +87,8 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent, } addToFocusList(wid); + + setHelpURL("https://stella-emu.github.io/index.html"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index f8778a9d4..72608fa5b 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -146,21 +146,21 @@ void Dialog::setTitle(const string& title) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger) +void Dialog::initHelp() { #ifndef RETRON77 - _helpAnchor = helpAnchor; - _debuggerHelp = debugger; - if(hasTitle()) { if(_helpWidget == nullptr) { + string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode); + _helpWidget = new ButtonWidget(this, _font, _w - _font.getMaxCharWidth() * 3.5, 0, _font.getMaxCharWidth() * 3.5 + 0.5, buttonHeight(), "?", kHelpCmd); _helpWidget->setBGColor(kColorTitleBar); _helpWidget->setTextColor(kColorTitleText); + _helpWidget->setToolTip("Click or press " + key + " for help."); } if(hasHelp()) @@ -171,9 +171,29 @@ void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger) #endif } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger) +{ + _helpAnchor = helpAnchor; + _debuggerHelp = debugger; + + initHelp(); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Dialog::setHelpURL(const string& helpURL) +{ + _helpURL = helpURL; + + initHelp(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string Dialog::getHelpURL() { + if(!_helpURL.empty()) + return _helpURL; + if(!_helpAnchor.empty()) { if(_debuggerHelp) diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index 4e1f6ad22..112712792 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -98,6 +98,7 @@ class Dialog : public GuiObject bool hasTitle() { return !_title.empty(); } void setHelpAnchor(const string& helpAnchor, bool debugger = false); + void setHelpURL(const string& helpURL); virtual bool isShading() const { return true; } @@ -209,6 +210,7 @@ class Dialog : public GuiObject bool handleNavEvent(Event::Type e, bool repeated = false); void getTabIdForWidget(Widget* w); bool cycleTab(int direction); + void initHelp(); const string getHelpURL(); bool hasHelp() { return !getHelpURL().empty(); } void openHelp(); @@ -231,6 +233,7 @@ class Dialog : public GuiObject int _layer{0}; unique_ptr _toolTip; string _helpAnchor; + string _helpURL; bool _debuggerHelp{false}; ButtonWidget* _helpWidget{nullptr};