added help hotkey in UI mode (F1)

added missing anchors
This commit is contained in:
thrust26 2021-04-17 16:55:40 +02:00
parent 89966a9a2e
commit a91aea1b22
12 changed files with 57 additions and 25 deletions

View File

@ -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.

View File

@ -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
};

View File

@ -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"},

View File

@ -168,6 +168,7 @@ class Event
SALeftAxis0Value, SALeftAxis1Value, SARightAxis0Value, SARightAxis1Value,
PaddleFourFire, PaddleFiveFire, PaddleSixFire, PaddleSevenFire,
UIHelp,
LastType
};

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -84,7 +84,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
addToFocusList(wid);
setHelpAnchor(" ");
setHelpAnchor("Hotkeys");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -235,8 +235,6 @@ void InputDialog::addDevicePortTab()
// Add items for virtual device ports
addToFocusList(wid, myTab, tabID);
setHelpAnchor("Input");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -83,6 +83,8 @@ RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
// Add OK and Cancel buttons
addOKCancelBGroup(wid, font, "Audit", "Close");
addBGroupToFocusList(wid);
setHelpAnchor("ROMAudit");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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