added help links to most dialogs (see #740)

TODO: tab specific help?
This commit is contained in:
thrust26 2021-04-17 13:31:36 +02:00
parent 29ec5c5e66
commit 89966a9a2e
18 changed files with 88 additions and 10 deletions

View File

@ -3732,7 +3732,7 @@
</table>
<br>
<p><b>Emulation</b> dialog:</p>
<p><b><a name="Emulation">Emulation</a></b> dialog:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_emulation.png"></td>
@ -3769,7 +3769,7 @@
</table>
<br>
<p><b>Input Settings</b> dialog:</p>
<p><b><a name="Input">Input Settings</a></b> dialog:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/eventmapping.png"></td>
@ -3807,7 +3807,6 @@
</tr>
<tr>
<td colspan="3"><center><img src="graphics/options_misc_light.png"></center></td>
</tr>
</table>
<br>
@ -3840,7 +3839,7 @@
</tr>
</table>
<br>
<p><b>Developer Settings</b> dialog:</p>
<p><b><a name="Developer">Developer Settings</a></b> dialog:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer.png"></td>
@ -3851,7 +3850,7 @@
</tr>
</table>
<br>
<p><b>Game Properties</b> dialog:</p>
<p><b><a name="GameProperties">Game Properties</a></b> dialog:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_gameinfo_emulation.png"></td>
@ -3862,7 +3861,7 @@
</tr>
</table>
<br>
<p><b>Audit ROMs</b> dialog:</p>
<p><b><a name="Audit">Audit ROMs</a></b> dialog:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/romaudit.png"></td>
@ -4053,7 +4052,7 @@
contains the following items:</p>
<p><ol>
<li><p><b>Power-on options</b>: Selecting this option shows a dialog whereby
<li><p><b><a name="PowerOn">Power-on options</a></b>: Selecting this option shows a dialog whereby
ROM properties can be temporarily overridden, and joystick/console buttons can be
temporarily held down. Selecting options from this dialog will cause all ROMs launched
after that to use those properties you specify. Clicking <b>Defaults</b> will disable
@ -4127,8 +4126,8 @@
</blockquote></br>
<h2><b><a name="Adaptor">Stelladaptor/2600-daptor Support</a></b></h2>
<blockquote>
<blockquote> H
<p>Stella supports real Atari 2600 joysticks, paddles, driving controllers
and trackballs (CX22/CX80 'Trak-Ball', Atari and Amiga mouse) using the
<a href="http://www.grandideastudio.com/stelladaptor-2600">Stelladaptor</a> and

View File

@ -107,6 +107,8 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
wid.clear();
addOKCancelBGroup(wid, font);
addBGroupToFocusList(wid);
setHelpAnchor("Cheats");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -253,7 +253,7 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDebug::disassemblePC(bool force)
{
return (disassembleAddr(myDebugger.cpuDebug().pc(), force));
return disassembleAddr(myDebugger.cpuDebug().pc(), force);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -106,6 +106,8 @@ CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
// We don't have a close/cancel button, but we still want the cancel
// event to be processed
processCancelWithoutWidget(true);
setHelpAnchor("CommandMenu");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -223,7 +225,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
break;
default:
return;
Dialog::handleCommand(sender, cmd, data, 0);
}
// Console commands should be performed right away, after leaving the menu

View File

@ -80,6 +80,8 @@ DeveloperDialog::DeveloperDialog(OSystem& osystem, DialogContainer& parent,
// Activate the first tab
myTab->setActiveTab(0);
setHelpAnchor("Debugger");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -144,6 +144,34 @@ void Dialog::setTitle(const string& title)
_h += _th;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::setHelpAnchor(const string& helpAnchor, bool debugger)
{
#ifndef RETRON77
_helpAnchor = helpAnchor;
_debuggerHelp = debugger;
if(_helpWidget == nullptr)
_helpWidget = new ButtonWidget(this, _font, _w - _font.getMaxCharWidth() * 3.5, 0,
_font.getMaxCharWidth() * 3.5, buttonHeight(), "?",
kHelpCmd);
if(hasTitle() && hasHelp())
_helpWidget->clearFlags(Widget::FLAG_INVISIBLE);
else
_helpWidget->setFlags(Widget::FLAG_INVISIBLE);
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::setPosition()
{
@ -851,6 +879,15 @@ void Dialog::handleCommand(CommandSender* sender, int cmd, int data, int id)
close();
break;
case kHelpCmd:
if(hasHelp())
{
if(SDL_OpenURL(getHelpURL().c_str()))
{
cerr << "error opening URL " << getHelpURL() << endl;
}
break;
}
default:
break;
}

View File

@ -97,6 +97,9 @@ class Dialog : public GuiObject
void setTitle(const string& title);
bool hasTitle() { return !_title.empty(); }
void setHelpAnchor(const string& helpAnchor, bool debugger = false);
const string getHelpURL();
virtual bool isShading() const { return true; }
/**
@ -198,7 +201,13 @@ class Dialog : public GuiObject
virtual bool repeatEnabled() { return true; }
bool hasHelp() { return !getHelpURL().empty(); }
private:
enum {
kHelpCmd = 'DlHp'
};
void buildCurrentFocusList(int tabID = -1);
bool handleNavEvent(Event::Type e, bool repeated = false);
void getTabIdForWidget(Widget* w);
@ -221,6 +230,9 @@ class Dialog : public GuiObject
int _th{0};
int _layer{0};
unique_ptr<ToolTip> _toolTip;
string _helpAnchor;
bool _debuggerHelp{false};
ButtonWidget* _helpWidget{nullptr};
private:
struct Focus {

View File

@ -157,6 +157,8 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
addDefaultsOKCancelBGroup(wid, font);
addToFocusList(wid);
setHelpAnchor("Emulation");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -95,6 +95,8 @@ GameInfoDialog::GameInfoDialog(
_extraWidget->setToolTip("Export the current ROM's properties\n"
"into the default directory.");
addBGroupToFocusList(wid);
setHelpAnchor("Properties");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -130,6 +130,8 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
addDefaultsOKCancelBGroup(wid, font, "Load ROM", "Cancel");
addToFocusList(wid);
setHelpAnchor("PowerOn");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -83,6 +83,8 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
}
addToFocusList(wid);
setHelpAnchor(" ");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -206,6 +206,8 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
addToFocusList(wid);
_focusedWidget = _okWidget; // start with focus on 'Save' button
setHelpAnchor("Highscores");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -96,6 +96,8 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
WidgetArray wid;
addDefaultsOKCancelBGroup(wid, _font);
addBGroupToFocusList(wid);
setHelpAnchor("Input");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -233,6 +235,8 @@ void InputDialog::addDevicePortTab()
// Add items for virtual device ports
addToFocusList(wid, myTab, tabID);
setHelpAnchor("Input");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -85,6 +85,8 @@ LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
addOKCancelBGroup(wid, font);
addToFocusList(wid);
setHelpAnchor("Logs");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -146,6 +146,8 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
{
myRomAuditButton->clearFlags(Widget::FLAG_ENABLED);
}
setHelpAnchor("Options");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -93,6 +93,8 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
addDefaultsOKCancelBGroup(wid, font);
addToFocusList(wid);
setHelpAnchor("Snapshots");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -311,6 +311,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
addDefaultsOKCancelBGroup(wid, font);
addBGroupToFocusList(wid);
setHelpAnchor("UserInterface");
#ifndef WINDOWED_SUPPORT
myCenter->clearFlags(Widget::FLAG_ENABLED);
#endif

View File

@ -90,6 +90,8 @@ VideoAudioDialog::VideoAudioDialog(OSystem& osystem, DialogContainer& parent,
// Activate the first tab
myTab->setActiveTab(0);
setHelpAnchor("VideoAudio");
// Disable certain functions when we know they aren't present
#ifndef WINDOWED_SUPPORT
myFullscreen->clearFlags(Widget::FLAG_ENABLED);