GUI: Added in-place hotkeys for widgets.

Now it is possible to specify hotkeys in place for ButtonWidget
and CheckboxWidget (the only widgets with hotkeys now).

Use de-facto standard with putting hotkey between tildes (~).
Like '~O~pen'. The tildes gets stripped before after hotkey
is extracted.

This is done for giving translators possibility to specify
their own hotkeys.

Old hotkeys defined at widget instance creation are left for
leaving possibility to specify non-printable hotkeys such as
Common::ASCII_ESCAPE.

Translation files were updated respectively.

svn-id: r49766
This commit is contained in:
Eugene Sandulenko 2010-06-15 10:47:31 +00:00
parent 9ebed7b3d9
commit 3fafa07ab0
17 changed files with 1322 additions and 498 deletions

View file

@ -86,31 +86,31 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
StaticTextWidget *version = new StaticTextWidget(this, "GlobalMenu.Version", gScummVMVersionDate);
version->setAlign(Graphics::kTextAlignCenter);
new GUI::ButtonWidget(this, "GlobalMenu.Resume", _("Resume"), kPlayCmd, 'P');
new GUI::ButtonWidget(this, "GlobalMenu.Resume", _("~R~esume"), kPlayCmd, 'P');
_loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", _("Load"), kLoadCmd, 'L');
_loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", _("~L~oad"), kLoadCmd);
// TODO: setEnabled -> setVisible
_loadButton->setEnabled(_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime));
_saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", _("Save"), kSaveCmd, 'S');
_saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", _("~S~ave"), kSaveCmd);
// TODO: setEnabled -> setVisible
_saveButton->setEnabled(_engine->hasFeature(Engine::kSupportsSavingDuringRuntime));
new GUI::ButtonWidget(this, "GlobalMenu.Options", _("Options"), kOptionsCmd, 'O');
new GUI::ButtonWidget(this, "GlobalMenu.Options", _("~O~ptions"), kOptionsCmd);
// The help button is disabled by default.
// To enable "Help", an engine needs to use a subclass of MainMenuDialog
// (at least for now, we might change how this works in the future).
_helpButton = new GUI::ButtonWidget(this, "GlobalMenu.Help", _("Help"), kHelpCmd, 'H');
_helpButton = new GUI::ButtonWidget(this, "GlobalMenu.Help", _("~H~elp"), kHelpCmd);
_helpButton->setEnabled(false);
new GUI::ButtonWidget(this, "GlobalMenu.About", _("About"), kAboutCmd, 'A');
new GUI::ButtonWidget(this, "GlobalMenu.About", _("~A~bout"), kAboutCmd);
_rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", _("Return to Launcher"), kRTLCmd, 'R');
_rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", _("~R~eturn to Launcher"), kRTLCmd);
_rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL));
new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("Quit"), kQuitCmd, 'Q');
new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("~Q~uit"), kQuitCmd);
_aboutDialog = new GUI::AboutDialog();
_optionsDialog = new ConfigDialog(_engine->hasFeature(Engine::kSupportsSubtitleOptions));
@ -298,11 +298,11 @@ ConfigDialog::ConfigDialog(bool subtitleControls)
// Add the buttons
//
new GUI::ButtonWidget(this, "GlobalConfig.Ok", _("OK"), GUI::kOKCmd, 'O');
new GUI::ButtonWidget(this, "GlobalConfig.Cancel", _("Cancel"), GUI::kCloseCmd, 'C');
new GUI::ButtonWidget(this, "GlobalConfig.Ok", _("~O~K"), GUI::kOKCmd);
new GUI::ButtonWidget(this, "GlobalConfig.Cancel", _("~C~ancel"), GUI::kCloseCmd);
#ifdef SMALL_SCREEN_DEVICE
new GUI::ButtonWidget(this, "GlobalConfig.Keys", _("Keys"), kKeysCmd, 'K');
new GUI::ButtonWidget(this, "GlobalConfig.Keys", _("~K~eys"), kKeysCmd);
_keysDialog = NULL;
#endif
}