Commit 8249411f authored by thrust26's avatar thrust26
Browse files

enhanced help with optional direct URL

parent c68871ec
Pipeline #20546 passed with stages
in 7 minutes and 14 seconds
......@@ -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
};
......
......@@ -87,6 +87,8 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
}
addToFocusList(wid);
setHelpURL("https://stella-emu.github.io/index.html");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
......@@ -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)
......
......@@ -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> _toolTip;
string _helpAnchor;
string _helpURL;
bool _debuggerHelp{false};
ButtonWidget* _helpWidget{nullptr};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment