improved context-sensitive help, now also works per widget, tab or tab group

This commit is contained in:
thrust26 2021-04-18 17:59:06 +02:00
parent 278e1fdd3f
commit be68b984cf
22 changed files with 175 additions and 30 deletions

View File

@ -1780,12 +1780,12 @@
</tr>
<tr>
<td>Switch mouse to <i>previous</i> controller emulation mode</br>(see <b><a href="#Controller">Controller Properties</a></b>)</td>
<td>Switch mouse to <i>previous</i> controller emulation mode</br>(see <b><a href="#ControllerProps">Controller Properties</a></b>)</td>
<td>Shift-Control + 0</td>
<td>Shift-Control + 0</td>
</tr>
<tr>
<td>Switch mouse to <i>next</i> controller emulation modes</br>(see <b><a href="#Controller">Controller Properties</a></b>)</td>
<td>Switch mouse to <i>next</i> controller emulation modes</br>(see <b><a href="#ControllerProps">Controller Properties</a></b>)</td>
<td>Control + 0</td>
<td>Control + 0</td>
</tr>
@ -2584,7 +2584,7 @@
</tr>
</table>
<p>For details how to configure high scores definintions for a game see
<p>For details how to configure high scores definitions for a game see
<a href="#HighScoreProps"><b>High Scores Properties</b></a></h2>.</p>
</blockquote></br>
@ -3353,7 +3353,7 @@
<tr>
<td><pre>-bs &lt;type&gt;</pre></td>
<td>Set "Cart.Type" property. See the <a href="#Emulation"><b>Emulation Properties</b></a> section
<td>Set "Cart.Type" property. See the <a href="#EmulationProps"><b>Emulation Properties</b></a> section
for valid types.</td>
</tr>
@ -3394,7 +3394,7 @@
<tr>
<td><pre>-lc &lt;type&gt;</pre></td>
<td>Set "Controller.Left" property. See the <a href="#Controller"><b>Controller Properties</b></a>
<td>Set "Controller.Left" property. See the <a href="#ControllerProps"><b>Controller Properties</b></a>
section for valid types.</td>
</tr>
@ -3412,7 +3412,7 @@
<tr>
<td><pre>-rc &lt;type&gt;</pre></td>
<td>Set "Controller.Right" property. See the <a href="#Controller"><b>Controller Properties</b></a>
<td>Set "Controller.Right" property. See the <a href="#ControllerProps"><b>Controller Properties</b></a>
section for valid types.</td>
</tr>
@ -3432,7 +3432,7 @@
<tr>
<td><pre>-bc &lt;type&gt;</pre></td>
<td>Set both "Controller.Left" and "Controller.Right" properties.
See the <a href="#Controller"><b>Controller Properties</b></a> section for valid types.</td>
See the <a href="#ControllerProps"><b>Controller Properties</b></a> section for valid types.</td>
</tr>
<tr>
@ -3459,12 +3459,12 @@
<tr>
<td><pre>-ma &lt;Auto|XY&gt;</pre></td>
<td>Set "Controller.MouseAxis" property.
See the <a href="#Controller"><b>Controller Properties</b></a> section for valid types.</td>
See the <a href="#ControllerProps"><b>Controller Properties</b></a> section for valid types.</td>
</tr>
<tr>
<td><pre>-format &lt;format&gt;</pre></td>
<td>Set "Display.Format" property. See the <a href="#Emulation"><b>Emulation Properties</b></a> section
<td>Set "Display.Format" property. See the <a href="#EmulationProps"><b>Emulation Properties</b></a> section
for valid formats.</td></td>
</tr>
@ -3619,7 +3619,7 @@
<p><b>Options Menu</b> dialog:<br><br>
<img src="graphics/options.png">
<br><br>
<p><b><a name="VideoAudio">Video & Audio Settings</a></b> dialog (Display):</p>
<p><b><a name="VideoAudio">Video & Audio Settings</a></b> dialog <a name="VideoAudioDisplay">(Display):</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_video.png"></td>
@ -3645,7 +3645,7 @@
</table>
<br>
<p><b>Video & Audio Settings</b> dialog (Palettes):</p>
<p><b>Video & Audio Settings</b> dialog <a name="VideoAudioPalettes">(Palettes):</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_video_palettes.png"></td>
@ -3670,7 +3670,7 @@
</table>
<br>
<p><b>Video & Audio Settings</b> dialog (TV Effects):</p>
<p><b>Video & Audio Settings</b> dialog <a name="VideoAudioEffects">(TV Effects)</a>:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_video_tv.png"></td>
@ -3696,7 +3696,7 @@
</table>
<br>
<p><b>Video & Audio Settings</b> dialog (Audio):</p>
<p><b>Video & Audio Settings</b> dialog <a name="VideoAudioAudio">(Audio)</a>:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_audio.png"></td>
@ -3942,7 +3942,7 @@
</p></br>
<p><b>Device and port</b> settings can be configured under the 'Devices & Ports' tab, shown below:</p>
<p><b><a name="DevicesPorts">Device and port</a></b> settings can be configured under the 'Devices & Ports' tab, shown below:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/eventmapping_devsports.png"></td>
@ -3969,7 +3969,7 @@
</tr>
</table>
<p><b>Mouse</b> settings can be configured under the 'Mouse' tab, shown below:</p>
<p><b><a name="Mouse">Mouse</a></b> settings can be configured under the 'Mouse' tab, shown below:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/eventmapping_mouse.png"></td>
@ -4233,7 +4233,7 @@
Two sets ('Player settings', 'Developer settings') allow easy adjustment of all settings
for different use cases (playing or developing games) at once.</p>
<p><b>Developer Settings</b> dialog (Emulator)</p>
<p><b>Developer Settings</b> dialog <a name="DeveloperEmulator">(Emulator)</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer_emulation.png"></td>
@ -4270,7 +4270,7 @@
</tr>
</table>
<p><b>Developer Settings</b> dialog (TIA):</p>
<p><b>Developer Settings</b> dialog <a name="DeveloperTIA">(TIA):</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer_tia.png"></td>
@ -4300,7 +4300,7 @@
</tr>
</table>
<p><b>Developer Settings</b> dialog (Video):</p>
<p><b>Developer Settings</b> dialog <a name="DeveloperVideo">(Video)</a>:</p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer_video.png"></td>
@ -4327,7 +4327,7 @@
</tr>
</table>
<p><b>Developer Settings</b> dialog (Time Machine)</p>
<p><b>Developer Settings</b> dialog <a name="DeveloperTimeMachine">(Time Machine)</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer_timemachine.png"></td>
@ -4382,7 +4382,7 @@
</tr>
</table>
<p><b>Developer Settings</b> dialog (Debugger)</p>
<p><b>Developer Settings</b> dialog <a name="DeveloperDebugger">(Debugger)</a></p>
<table border="5" cellpadding="2" frame="box" rules="none">
<tr>
<td><img src="graphics/options_developer_debugger.png"></td>
@ -4677,7 +4677,7 @@ Ms Pac-Man (Stella extended codes):
<p>Stella supports the properties described below:</p>
<h3><a name="Emulation"><b>Emulation Properties</b></a></h3>
<h3><a name="EmulationProps"><b>Emulation Properties</b></a></h3>
<p>
<img src="graphics/options_gameinfo_emulation.png">
</p>
@ -4804,7 +4804,7 @@ Ms Pac-Man (Stella extended codes):
<p><b>Note:</b> Items marked as '*' are deprecated, and will probably be
removed in a future release.</p>
-->
<h3><a name="Consoler"><b>Console Properties</b></a></h3>
<h3><a name="ConsoleProps"><b>Console Properties</b></a></h3>
<p>
<img src="graphics/options_gameinfo_console.png">
</p>
@ -4830,7 +4830,7 @@ Ms Pac-Man (Stella extended codes):
</table>
</br>
<h3><a name="Controller"><b>Controller Properties</b></a></h3>
<h3><a name="ControllerProps"><b>Controller Properties</b></a></h3>
<p>
<img src="graphics/options_gameinfo_controller.png">
</p>
@ -4950,7 +4950,7 @@ Ms Pac-Man (Stella extended codes):
</table>
</br>
<h3><a name="Cartridge"><b>Cartridge Properties</b></h3></a>
<h3><a name="CartridgeProps"><b>Cartridge Properties</b></h3></a>
<p>
<img src="graphics/options_gameinfo_cartridge.png">
</p>
@ -5026,7 +5026,7 @@ Ms Pac-Man (Stella extended codes):
<tr><td>Note</td><td>Allows defining some free text which explains the high scores properties.</td></tr>
</table>
<p>To find the required definition values, you can use Stella's built-in <a href="debugger.html">debugger</a>.
Please share your results, so that we can extend the list of supported games.</p>
Please share your results, so that we can extend the <b><a href="#HighScoreGames">list</a></b> of supported games.</p>
<p>Note: To verify the definitions, the current values of the addresses and the resulting score are displayed.</p>
</td>
</tr>

View File

@ -82,6 +82,8 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& lfont,
myAudEffV = new StaticTextWidget(boss, lfont, myAudV->getRight() + fontWidth, myAudV->getTop() + 2,
"100% (eff. volume)");
setHelpAnchor("AudioTab", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -47,7 +47,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
new StaticTextWidget(boss, lfont, xpos, ypos + 2, lwidth-2, fontHeight,
"PC ", TextAlign::Left);
myPCGrid =
new DataGridWidget(boss, nfont, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::Fmt::_16);
new DataGridWidget(this, nfont, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::Fmt::_16);
myPCGrid->setTarget(this);
myPCGrid->setID(kPCRegID);
addFocusWidget(myPCGrid);
@ -62,6 +62,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = x + lwidth; ypos = myPCGrid->getBottom() + VGAP;
myCpuGrid =
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::Fmt::_16);
myCpuGrid->setHelpAnchor("CPURegisters", true);
myCpuGrid->setTarget(this);
myCpuGrid->setID(kCpuRegID);
addFocusWidget(myCpuGrid);
@ -70,6 +71,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
xpos = myPCGrid->getRight() + 10;
myCpuGridDecValue =
new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 3, 8, Common::Base::Fmt::_10);
myCpuGridDecValue->setHelpAnchor("CPURegisters", true);
myCpuGridDecValue->setTarget(this);
myCpuGridDecValue->setID(kCpuRegDecID);
addFocusWidget(myCpuGridDecValue);
@ -143,6 +145,8 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
myCpuDataDest->setToolTip("Destination label of last write.");
myCpuDataDest->setEditable(false, true);
setHelpAnchor("DataOpButtons", true);
_h = ypos + myPSRegister->getHeight() - y;
}

View File

@ -600,6 +600,7 @@ void DebuggerDialog::addRomArea()
xpos = r.x() + 10; ypos += myCpu->getHeight() + 10;
myRam = new RiotRamWidget(this, *myLFont, *myNFont, xpos, ypos, r.w() - 10);
//myRam->setHelpAnchor("M6532", true); // TODO: doesn't work
addToFocusList(myRam->getFocusList());
// Add the DataGridOpsWidget to any widgets which contain a
@ -626,6 +627,7 @@ void DebuggerDialog::addRomArea()
tabID = myRomTab->addTab(" Disassembly ", TabWidget::AUTO_WIDTH);
myRom = new RomWidget(myRomTab, *myLFont, *myNFont, 2, 2, tabWidth - 1,
tabHeight - myRomTab->getTabHeight() - 2);
myRom->setHelpAnchor("Disassembly", true);
myRomTab->setParentWidget(tabID, myRom);
addToFocusList(myRom->getFocusList(), myRomTab, tabID);
@ -637,6 +639,7 @@ void DebuggerDialog::addRomArea()
tabHeight - myRomTab->getTabHeight() - 2);
if(myCartInfo != nullptr)
{
//myCartInfo->setHelpAnchor("BankswitchInformation", true); // TODO: doesn't work
myRomTab->setParentWidget(tabID, myCartInfo);
addToFocusList(myCartInfo->getFocusList(), myRomTab, tabID);
tabID = myRomTab->addTab(" States ", TabWidget::AUTO_WIDTH);
@ -648,6 +651,7 @@ void DebuggerDialog::addRomArea()
tabHeight - myRomTab->getTabHeight() - 2);
if(myCartDebug) // TODO - make this always non-null
{
//myRomTab->setHelpAnchor("BankswitchInformation", true); // TODO: doesn't work
myRomTab->setParentWidget(tabID, myCartDebug);
addToFocusList(myCartDebug->getFocusList(), myRomTab, tabID);
@ -660,6 +664,7 @@ void DebuggerDialog::addRomArea()
tabHeight - myRomTab->getTabHeight() - 2, *myCartDebug);
if(myCartRam) // TODO - make this always non-null
{
myCartRam->setHelpAnchor("CartridgeRAMInformation", true);
myRomTab->setParentWidget(tabID, myCartRam);
addToFocusList(myCartRam->getFocusList(), myRomTab, tabID);
myCartRam->setOpsWidget(ops);

View File

@ -74,6 +74,7 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
clearScreen();
addFocusWidget(this);
setHelpAnchor("PromptTab", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -265,6 +265,8 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
myPause->setID(kPauseID);
myPause->setTarget(this);
addFocusWidget(myPause);
setHelpAnchor("IOTab", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -138,6 +138,8 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// Calculate actual dimensions
_w = myColorClocks->getRight() - x;
_h = myColorClocks->getBottom();
//setHelpAnchor("TIAInfo", true); // TODO: does not work due to missing focus
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -51,6 +51,8 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(l, "Save snapshot", "snap");
#endif
myMenu = make_unique<ContextMenu>(this, font, l);
//setHelpAnchor("TIADisplay", true); // TODO: does not work due to missing focus
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -667,6 +667,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
"HMCLR", kHmclrCmd);
b->setTarget(this);
addFocusWidget(b);
setHelpAnchor("TIATab", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -65,6 +65,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(l, "4x zoom", "4");
VarList::push_back(l, "8x zoom", "8");
myMenu = make_unique<ContextMenu>(this, font, l);
setHelpAnchor("TIAZoom", true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -209,6 +209,8 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
// Add items for tab 0
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperEmulator");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -313,6 +315,8 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
// Add items for tab 2
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperTIA");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -418,6 +422,8 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
// Add items for tab 2
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperVideo");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -552,6 +558,8 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
"(*) Any size change clears the buffer");
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperTimeMachine");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -646,6 +654,8 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
#endif
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DeveloperDebugger");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -189,8 +189,29 @@ void Dialog::setHelpURL(const string& helpURL)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Dialog::getHelpURL()
const string Dialog::getHelpURL() const
{
// 1. check individual widget
if(_focusedWidget && _focusedWidget->hasHelp())
return _focusedWidget->getHelpURL();
if(_tabID < int(_myTabList.size()))
{
TabWidget* activeTabGroup = _myTabList[_tabID].widget;
// 2. check active tab
int activeTab = activeTabGroup->getActiveTab();
const Widget* parentTab = activeTabGroup->parentWidget(activeTab);
if(parentTab->hasHelp())
return parentTab->getHelpURL();
// 3. check active tab group
if(activeTabGroup && activeTabGroup->hasHelp())
return activeTabGroup->getHelpURL();
}
// 4. check dialog
if(!_helpURL.empty())
return _helpURL;
@ -201,6 +222,7 @@ const string Dialog::getHelpURL()
else
return "https://stella-emu.github.io/docs/index.html#" + _helpAnchor;
}
// no help found
return EmptyString;
}

View File

@ -97,6 +97,7 @@ class Dialog : public GuiObject
void setTitle(const string& title);
bool hasTitle() { return !_title.empty(); }
void initHelp();
void setHelpAnchor(const string& helpAnchor, bool debugger = false);
void setHelpURL(const string& helpURL);
@ -210,9 +211,8 @@ 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(); }
const string getHelpURL() const override;
bool hasHelp() const override { return !getHelpURL().empty(); }
void openHelp();
protected:

View File

@ -194,6 +194,7 @@ void GameInfoDialog::addEmulationTab()
// Add items for tab 0
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("EmulationProps");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -246,6 +247,8 @@ void GameInfoDialog::addConsoleTab()
// Add items for tab 1
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("ConsoleProps");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -396,6 +399,8 @@ void GameInfoDialog::addControllersTab()
// Add items for tab 2
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("ControllerProps");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -455,6 +460,8 @@ void GameInfoDialog::addCartridgeTab()
// Add items for tab 3
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("CartridgeProps");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -650,6 +657,8 @@ void GameInfoDialog::addHighScoresTab()
// Add items for tab 4
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("HighScoreProps");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -147,6 +147,9 @@ class GuiObject : public CommandReceiver
virtual void draw() = 0;
virtual void drawChain() = 0;
virtual const string getHelpURL() const = 0;
virtual bool hasHelp() const = 0;
private:
OSystem& myOSystem;
DialogContainer& myParent;

View File

@ -72,6 +72,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
EventMode::kEmulationMode);
myTab->setParentWidget(tabID, myEmulEventMapper);
addToFocusList(myEmulEventMapper->getFocusList(), myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("Remapping");
// 2) Event mapper for UI actions
tabID = myTab->addTab(" UI Events ", TabWidget::AUTO_WIDTH);
@ -81,6 +82,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
EventMode::kMenuMode);
myTab->setParentWidget(tabID, myMenuEventMapper);
addToFocusList(myMenuEventMapper->getFocusList(), myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("Remapping");
// 3) Devices & ports
addDevicePortTab();
@ -235,6 +237,8 @@ void InputDialog::addDevicePortTab()
// Add items for virtual device ports
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("DevicesPorts");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -323,6 +327,8 @@ void InputDialog::addMouseTab()
// Add items for mouse
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("Mouse");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -186,6 +186,21 @@ void TabWidget::setParentWidget(int tabID, Widget* parent)
_tabs[tabID].parentWidget = parent;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget* TabWidget::parentWidget(int tabID)
{
assert(0 <= tabID && tabID < int(_tabs.size()));
if(!_tabs[tabID].parentWidget)
{
// create dummy widget if not existing
Widget* w = new Widget(_boss, _font, 0, 0, 0, 0);
setParentWidget(tabID, w);
}
return _tabs[tabID].parentWidget;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{

View File

@ -54,6 +54,7 @@ class TabWidget : public Widget, public CommandSender
// setActiveTab changes the value of _firstWidget. This means Widgets added afterwards
// will be added to the active tab.
void setParentWidget(int tabID, Widget* parent);
Widget* parentWidget(int tabID);
int getTabWidth() { return _tabWidth; }
int getTabHeight() { return _tabHeight; }

View File

@ -196,6 +196,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add items for tab 0
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("UserInterface");
//////////////////////////////////////////////////////////
// 2) Launcher options
wid.clear();
@ -296,6 +298,9 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add items for tab 1
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("ROMInfo");
//////////////////////////////////////////////////////////
// All ROM settings are disabled while in game mode
if(!myIsGlobal)
{
@ -313,6 +318,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
setHelpAnchor("UserInterface");
#ifndef WINDOWED_SUPPORT
myCenter->clearFlags(Widget::FLAG_ENABLED);
#endif

View File

@ -195,6 +195,8 @@ void VideoAudioDialog::addDisplayTab()
// Add items for tab 0
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("VideoAudioDisplay");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -326,6 +328,8 @@ void VideoAudioDialog::addPaletteTab()
// Add items for tab 2
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("VideoAudioPalettes");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -412,6 +416,8 @@ void VideoAudioDialog::addTVEffectsTab()
// Add items for tab 3
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("VideoAudioEffects");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -541,6 +547,8 @@ void VideoAudioDialog::addAudioTab()
// Add items for tab 4
addToFocusList(wid, myTab, tabID);
myTab->parentWidget(tabID)->setHelpAnchor("VideoAudioAudio");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -284,6 +284,40 @@ void Widget::setToolTip(const string& text)
_toolTipText = text;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setHelpAnchor(const string& helpAnchor, bool debugger)
{
_helpAnchor = helpAnchor;
_debuggerHelp = debugger;
dialog().initHelp();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Widget::setHelpURL(const string& helpURL)
{
_helpURL = helpURL;
dialog().initHelp();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Widget::getHelpURL() const
{
if(!_helpURL.empty())
return _helpURL;
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;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget* Widget::findWidgetInChain(Widget* w, int x, int y)
{

View File

@ -118,6 +118,9 @@ class Widget : public GuiObject
virtual bool changedToolTip(const Common::Point& oldPos,
const Common::Point& newPos) const { return false; }
void setHelpAnchor(const string& helpAnchor, bool debugger = false);
void setHelpURL(const string& helpURL);
virtual void loadConfig() { }
protected:
@ -137,6 +140,9 @@ class Widget : public GuiObject
void handleCommand(CommandSender* sender, int cmd, int data, int id) override
{ assert(_boss); _boss->handleCommand(sender, cmd, data, id); }
const string getHelpURL() const override;
bool hasHelp() const override { return !getHelpURL().empty(); }
protected:
GuiObject* _boss{nullptr};
const GUI::Font& _font;
@ -153,6 +159,9 @@ class Widget : public GuiObject
ColorId _textcolorlo{kBGColorLo};
ColorId _shadowcolor{kShadowColor};
string _toolTipText;
string _helpAnchor;
string _helpURL;
bool _debuggerHelp{false};
public:
static Widget* findWidgetInChain(Widget* start, int x, int y);