diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/KeysDialog.cpp | 6 | ||||
-rw-r--r-- | gui/TabWidget.cpp | 4 | ||||
-rw-r--r-- | gui/browser.cpp | 6 | ||||
-rw-r--r-- | gui/chooser.cpp | 5 | ||||
-rw-r--r-- | gui/launcher.cpp | 36 | ||||
-rw-r--r-- | gui/options.cpp | 34 | ||||
-rw-r--r-- | gui/saveload.cpp | 6 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 4 | ||||
-rw-r--r-- | gui/widget.cpp | 59 | ||||
-rw-r--r-- | gui/widget.h | 3 |
10 files changed, 109 insertions, 54 deletions
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp index 65b14f9078..85ee53b72e 100644 --- a/gui/KeysDialog.cpp +++ b/gui/KeysDialog.cpp @@ -40,9 +40,9 @@ enum { KeysDialog::KeysDialog(const Common::String &title) : GUI::Dialog("KeysDialog") { - new ButtonWidget(this, "KeysDialog.Map", _("Map"), kMapCmd, 0); - new ButtonWidget(this, "KeysDialog.Ok", _("OK"), kOKCmd, 0); - new ButtonWidget(this, "KeysDialog.Cancel", _("Cancel"), kCloseCmd, 0); + new ButtonWidget(this, "KeysDialog.Map", _("Map"), kMapCmd); + new ButtonWidget(this, "KeysDialog.Ok", _("OK"), kOKCmd); + new ButtonWidget(this, "KeysDialog.Cancel", _("Cancel"), kCloseCmd); _actionsList = new ListWidget(this, "KeysDialog.List"); _actionsList->setNumberingMode(kListNumberingZero); diff --git a/gui/TabWidget.cpp b/gui/TabWidget.cpp index 3eb45297f3..691eebf033 100644 --- a/gui/TabWidget.cpp +++ b/gui/TabWidget.cpp @@ -63,8 +63,8 @@ void TabWidget::init() { int x = _w - _butRP - _butW * 2 - 2; int y = _butTP - _tabHeight; - _navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", kCmdLeft, 0); - _navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", kCmdRight, 0); + _navLeft = new ButtonWidget(this, x, y, _butW, _butH, "<", kCmdLeft); + _navRight = new ButtonWidget(this, x + _butW + 2, y, _butW, _butH, ">", kCmdRight); } TabWidget::~TabWidget() { diff --git a/gui/browser.cpp b/gui/browser.cpp index 86fadf667e..000359e1e7 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -66,9 +66,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; // Buttons - new ButtonWidget(this, "Browser.Up", _("Go up"), kGoUpCmd, 0); - new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd, 0); - new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd, 0); + new ButtonWidget(this, "Browser.Up", _("Go up"), kGoUpCmd); + new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd); + new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd); } void BrowserDialog::open() { diff --git a/gui/chooser.cpp b/gui/chooser.cpp index 0155bb2afb..7039e40947 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -23,6 +23,7 @@ */ #include "common/system.h" +#include "common/translation.h" #include "gui/chooser.h" #include "gui/GuiManager.h" #include "gui/ListWidget.h" @@ -45,8 +46,8 @@ ChooserDialog::ChooserDialog(const String &title, String dialogId) _list->setEditable(false); // Buttons - new ButtonWidget(this, dialogId + ".Cancel", "Cancel", kCloseCmd, 0); - _chooseButton = new ButtonWidget(this, dialogId + ".Choose", "Choose", kChooseCmd, 0); + new ButtonWidget(this, dialogId + ".Cancel", _("Cancel"), kCloseCmd); + _chooseButton = new ButtonWidget(this, dialogId + ".Choose", _("Choose"), kChooseCmd); _chooseButton->setEnabled(false); } diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 3634ef7e3d..b12c56dbde 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -202,7 +202,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) // _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX")); - _globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", _("Override global graphic settings"), kCmdGlobalGraphicsOverride, 0); + _globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", _("Override global graphic settings"), kCmdGlobalGraphicsOverride); addGraphicControls(tab, "GameOptions_Graphics."); @@ -211,7 +211,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) // tab->addTab(_("Audio")); - _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), kCmdGlobalAudioOverride, 0); + _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), kCmdGlobalAudioOverride); addAudioControls(tab, "GameOptions_Audio."); addSubtitleControls(tab, "GameOptions_Audio."); @@ -221,7 +221,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) // tab->addTab(_("Volume")); - _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), kCmdGlobalVolumeOverride, 0); + _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), kCmdGlobalVolumeOverride); addVolumeControls(tab, "GameOptions_Volume."); @@ -230,7 +230,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) // tab->addTab(_("MIDI")); - _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), kCmdGlobalMIDIOverride, 0); + _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), kCmdGlobalMIDIOverride); if (_guioptions & Common::GUIO_NOMIDI) _globalMIDIOverride->setEnabled(false); @@ -246,15 +246,15 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) // in the small version of the GUI. // GUI: Button + Label for the game path - new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), kCmdGameBrowser, 0); + new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), kCmdGameBrowser); _gamePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.GamepathText", gamePath); // GUI: Button + Label for the additional path - new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), kCmdExtraBrowser, 0); + new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), kCmdExtraBrowser); _extraPathWidget = new StaticTextWidget(tab, "GameOptions_Paths.ExtrapathText", extraPath); // GUI: Button + Label for the save path - new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), kCmdSaveBrowser, 0); + new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), kCmdSaveBrowser); _savePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.SavepathText", savePath); // Activate the first tab @@ -262,8 +262,8 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _tabWidget = tab; // Add OK & Cancel buttons - new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), kCloseCmd, 0); - new ButtonWidget(this, "GameOptions.Ok", _("OK"), kOKCmd, 0); + new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), kCloseCmd); + new ButtonWidget(this, "GameOptions.Ok", _("OK"), kOKCmd); } void EditGameDialog::open() { @@ -497,22 +497,22 @@ LauncherDialog::LauncherDialog() new StaticTextWidget(this, "Launcher.Version", gScummVMFullVersion); #endif - new ButtonWidget(this, "Launcher.QuitButton", _("Quit"), kQuitCmd, 'Q'); - new ButtonWidget(this, "Launcher.AboutButton", _("About..."), kAboutCmd, 'B'); - new ButtonWidget(this, "Launcher.OptionsButton", _("Options..."), kOptionsCmd, 'O'); + new ButtonWidget(this, "Launcher.QuitButton", _("~Q~uit"), kQuitCmd); + new ButtonWidget(this, "Launcher.AboutButton", _("A~b~out..."), kAboutCmd); + new ButtonWidget(this, "Launcher.OptionsButton", _("~O~ptions..."), kOptionsCmd); _startButton = - new ButtonWidget(this, "Launcher.StartButton", _("Start"), kStartCmd, 'S'); + new ButtonWidget(this, "Launcher.StartButton", _("~S~tart"), kStartCmd); _loadButton = - new ButtonWidget(this, "Launcher.LoadGameButton", _("Load..."), kLoadGameCmd, 'L'); + new ButtonWidget(this, "Launcher.LoadGameButton", _("~L~oad..."), kLoadGameCmd); // Above the lowest button rows: two more buttons (directly below the list box) _addButton = - new ButtonWidget(this, "Launcher.AddGameButton", _("Add Game..."), kAddGameCmd, 'A'); + new ButtonWidget(this, "Launcher.AddGameButton", _("~A~dd Game..."), kAddGameCmd); _editButton = - new ButtonWidget(this, "Launcher.EditGameButton", _("Edit Game..."), kEditGameCmd, 'E'); + new ButtonWidget(this, "Launcher.EditGameButton", _("~E~dit Game..."), kEditGameCmd); _removeButton = - new ButtonWidget(this, "Launcher.RemoveGameButton", _("Remove Game"), kRemoveGameCmd, 'R'); + new ButtonWidget(this, "Launcher.RemoveGameButton", _("~R~emove Game"), kRemoveGameCmd); // Search box _searchDesc = 0; @@ -526,7 +526,7 @@ LauncherDialog::LauncherDialog() _searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", _("Search:")); _searchWidget = new EditTextWidget(this, "Launcher.Search", _search, kSearchCmd); - _searchClearButton = new ButtonWidget(this, "Launcher.SearchClearButton", "C", kSearchClearCmd, 0); + _searchClearButton = new ButtonWidget(this, "Launcher.SearchClearButton", "C", kSearchClearCmd); // Add list with game titles _list = new ListWidget(this, "Launcher.GameList", kListSearchCmd); diff --git a/gui/options.cpp b/gui/options.cpp index 9ea3c7a1e8..be83624254 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -613,10 +613,10 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr } // Fullscreen checkbox - _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), 0, 0); + _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode")); // Aspect ratio checkbox - _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), 0, 0); + _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction")); _enableGraphicSettings = true; } @@ -657,18 +657,18 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefix) { // SoundFont - _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", _("SoundFont:"), kChooseSoundFontCmd, 0); + _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", _("SoundFont:"), kChooseSoundFontCmd); _soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", _("None")); - _soundFontClearButton = new ButtonWidget(boss, prefix + "mcFontClearButton", "C", kClearSoundFontCmd, 0); + _soundFontClearButton = new ButtonWidget(boss, prefix + "mcFontClearButton", "C", kClearSoundFontCmd); // Multi midi setting - _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", _("Mixed AdLib/MIDI mode"), 0, 0); + _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", _("Mixed AdLib/MIDI mode")); // Native mt32 setting - _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _("True Roland MT-32 (disable GM emulation)"), 0, 0); + _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _("True Roland MT-32 (disable GM emulation)")); // GS Extensions setting - _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), 0, 0); + _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode")); // MIDI gain setting (FluidSynth uses this) _midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", _("MIDI gain:")); @@ -685,7 +685,7 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefi void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &prefix, int maxSliderVal) { _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", _("Text and Speech:")); - _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0); + _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle); // Subtitle speed _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", _("Subtitle speed:")); @@ -707,7 +707,7 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _musicVolumeLabel->setFlags(WIDGET_CLEARBG); - _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", _("Mute All"), kMuteAllChanged, 0); + _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", _("Mute All"), kMuteAllChanged); _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _("SFX volume:")); @@ -794,24 +794,24 @@ GlobalOptionsDialog::GlobalOptionsDialog() // truncated in the small version of the GUI. // Save game path - new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", _("Save Path: "), kChooseSaveDirCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", _("Save Path: "), kChooseSaveDirCmd); _savePath = new StaticTextWidget(tab, "GlobalOptions_Paths.SavePath", "/foo/bar"); - new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", _("Theme Path:"), kChooseThemeDirCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", _("Theme Path:"), kChooseThemeDirCmd); _themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", _("None")); - new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", _("Extra Path:"), kChooseExtraDirCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", _("Extra Path:"), kChooseExtraDirCmd); _extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", _("None")); #ifdef DYNAMIC_MODULES - new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", _("Plugins Path:"), kChoosePluginsDirCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", _("Plugins Path:"), kChoosePluginsDirCmd); _pluginsPath = new StaticTextWidget(tab, "GlobalOptions_Paths.PluginsPath", _("None")); #endif #endif tab->addTab(_("Misc")); - new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), kChooseThemeCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), kChooseThemeCmd); _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName()); @@ -829,7 +829,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() } #ifdef SMALL_SCREEN_DEVICE - new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), kChooseKeyMappingCmd, 0); + new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), kChooseKeyMappingCmd); #endif // TODO: joystick setting @@ -858,8 +858,8 @@ GlobalOptionsDialog::GlobalOptionsDialog() _tabWidget = tab; // Add OK & Cancel buttons - new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), kCloseCmd, 0); - new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), kOKCmd, 0); + new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), kCloseCmd); + new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), kOKCmd); #ifdef SMALL_SCREEN_DEVICE _keysDialog = new KeysDialog(); diff --git a/gui/saveload.cpp b/gui/saveload.cpp index 85bbd252c7..bd5aadc206 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -62,11 +62,11 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter); // Buttons - new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), kCloseCmd, 0); - _chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, kChooseCmd, 0); + new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), kCloseCmd); + _chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, kChooseCmd); _chooseButton->setEnabled(false); - _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), kDelCmd, 0); + _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), kDelCmd); _deleteButton->setEnabled(false); _delSupport = _metaInfoSupport = _thumbnailSupport = false; diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index 43a9ed8d0a..987408e1b4 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -53,8 +53,8 @@ ThemeBrowser::ThemeBrowser() : Dialog("Browser") { _backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain; // Buttons - new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd, 0); - new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd, 0); + new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd); + new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd); } void ThemeBrowser::open() { diff --git a/gui/widget.cpp b/gui/widget.cpp index e4b37dc3c2..c47c6099ba 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -177,6 +177,51 @@ bool Widget::isVisible() const { return !(_flags & WIDGET_INVISIBLE); } +uint8 Widget::parseHotkey(const Common::String &label) { + if (!label.contains('~')) + return 0; + + int state = 0; + uint8 hotkey = 0; + + for (uint i = 0; i < label.size() && state != 3; i++) { + switch (state) { + case 0: + if (label[i] == '~') + state = 1; + break; + case 1: + if (label[i] != '~') { + state = 2; + hotkey = label[i]; + } else + state = 0; + break; + case 2: + if (label[i] == '~') + state = 3; + else + state = 0; + break; + } + } + + if (state == 3) + return hotkey; + + return 0; +} + +Common::String Widget::cleanupHotkey(const Common::String &label) { + Common::String res; + + for (uint i = 0; i < label.size() ; i++) + if (label[i] != '~') + res = res + label[i]; + + return res; +} + #pragma mark - StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &text, Graphics::TextAlign align) @@ -228,15 +273,21 @@ void StaticTextWidget::drawWidget() { #pragma mark - ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &label, uint32 cmd, uint8 hotkey) - : StaticTextWidget(boss, x, y, w, h, label, Graphics::kTextAlignCenter), CommandSender(boss), - _cmd(cmd), _hotkey(hotkey) { + : StaticTextWidget(boss, x, y, w, h, cleanupHotkey(label), Graphics::kTextAlignCenter), CommandSender(boss), + _cmd(cmd) { + + if (hotkey == 0) + _hotkey = parseHotkey(label); + setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); _type = kButtonWidget; } ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Common::String &label, uint32 cmd, uint8 hotkey) - : StaticTextWidget(boss, name, label), CommandSender(boss), - _cmd(cmd), _hotkey(hotkey) { + : StaticTextWidget(boss, name, cleanupHotkey(label)), CommandSender(boss), + _cmd(cmd) { + if (hotkey == 0) + _hotkey = parseHotkey(label); setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); _type = kButtonWidget; } diff --git a/gui/widget.h b/gui/widget.h index ebadc53241..3bbc565bbe 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -135,6 +135,9 @@ public: void setVisible(bool e); bool isVisible() const; + uint8 parseHotkey(const Common::String &label); + Common::String cleanupHotkey(const Common::String &label); + protected: void updateState(int oldFlags, int newFlags); |