diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/dialog.cpp | 6 | ||||
-rw-r--r-- | gui/dialog.h | 2 | ||||
-rw-r--r-- | gui/launcher.cpp | 51 | ||||
-rw-r--r-- | gui/options.cpp | 41 | ||||
-rw-r--r-- | gui/options.h | 8 |
5 files changed, 60 insertions, 48 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 6f629bfd4e..9ab22c26ef 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -289,13 +289,17 @@ Widget *Dialog::findWidget(int x, int y) { } ButtonWidget *Dialog::addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) { + return addButton(this, x, y, label, cmd, hotkey, ws); +} + +ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) { int w = kButtonWidth; int h = kButtonHeight; if (ws == kBigWidgetSize) { w = kBigButtonWidth; h = kBigButtonHeight; } - return new ButtonWidget(this, x, y, w, h, label, cmd, hotkey, ws); + return new ButtonWidget(boss, x, y, w, h, label, cmd, hotkey, ws); } CheckboxWidget *Dialog::addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) { diff --git a/gui/dialog.h b/gui/dialog.h index 0309709a51..77e372144a 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -87,7 +87,9 @@ protected: Widget *findWidget(int x, int y); // Find the widget at pos x,y if any + ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize); ButtonWidget *addButton(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize); + CheckboxWidget *addCheckbox(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize); CheckboxWidget *addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index cdffd49c17..0d79eea04c 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -146,11 +146,17 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) _h = screenH - 2 * 40; // TODO/FIXME GUI::WidgetSize ws; + int buttonHeight; + int buttonWidth; if (screenW >= 400 && screenH >= 300) { ws = GUI::kBigWidgetSize; + buttonHeight = kBigButtonHeight; + buttonWidth = kBigButtonWidth; } else { ws = GUI::kNormalWidgetSize; + buttonHeight = kButtonHeight; + buttonWidth = kButtonWidth; } const int x = 5; @@ -171,7 +177,7 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) } // GUI: Add tab widget - TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - 24 - 2 * vBorder, ws); + TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - buttonHeight - 8 - 2 * vBorder, ws); // // 1) The game tab @@ -180,12 +186,12 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) yoffset = vBorder; // GUI: Label & edit widget for the game ID - new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "ID: ", kTextAlignRight); + new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "ID: ", kTextAlignRight, ws); _domainWidget = new DomainEditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, _domain); yoffset += 16; // GUI: Label & edit widget for the description - new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "Name: ", kTextAlignRight); + new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "Name: ", kTextAlignRight, ws); _descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10, kLineHeight, description); yoffset += 16; @@ -212,26 +218,27 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) // 2) The 'Path' tab tab->addTab("Paths"); yoffset = vBorder; + // GUI: Button + Label for the game path - new ButtonWidget(tab, x, yoffset, kButtonWidth + 14, 16, "Game Path:", kCmdGameBrowser, 0); - _gamePathWidget = new StaticTextWidget(tab, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, gamePath, kTextAlignLeft); - yoffset += 18; + addButton(tab, x, yoffset, "Game Path:", kCmdGameBrowser, 0, ws); + _gamePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, gamePath, kTextAlignLeft, ws); + yoffset += buttonHeight + 2; // GUI: Button + Label for the additional path - new ButtonWidget(tab, x, yoffset, kButtonWidth + 14, 16, "Extra Path:", kCmdExtraBrowser, 0); - _extraPathWidget = new StaticTextWidget(tab, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, extraPath, kTextAlignLeft); + addButton(tab, x, yoffset, "Extra Path:", kCmdExtraBrowser, 0, ws); + _extraPathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, extraPath, kTextAlignLeft, ws); if (extraPath.isEmpty() || !ConfMan.hasKey("extrapath", _domain)) { _extraPathWidget->setLabel("None"); } - yoffset += 18; + yoffset += buttonHeight + 2; // GUI: Button + Label for the save path - new ButtonWidget(tab, x, yoffset, kButtonWidth + 14, 16, "Save Path:", kCmdSaveBrowser, 0); - _savePathWidget = new StaticTextWidget(tab, x + kButtonWidth + 20, yoffset + 3, _w - (x + kButtonWidth + 20) - 10, kLineHeight, savePath, kTextAlignLeft); + addButton(tab, x, yoffset, "Save Path:", kCmdSaveBrowser, 0, ws); + _savePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, savePath, kTextAlignLeft, ws); if (savePath.isEmpty() || !ConfMan.hasKey("savepath", _domain)) { _savePathWidget->setLabel("Default"); } - yoffset += 18; + yoffset += buttonHeight + 2; // // 3) The graphics tab @@ -239,10 +246,10 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) tab->addTab("Gfx"); yoffset = vBorder; - _globalGraphicsOverride = addCheckbox(tab, x, yoffset, "Override global graphic settings", kCmdGlobalGraphicsOverride, 0); + _globalGraphicsOverride = addCheckbox(tab, x, yoffset, "Override global graphic settings", kCmdGlobalGraphicsOverride, 0, ws); yoffset += _globalGraphicsOverride->getHeight(); - yoffset = addGraphicControls(tab, yoffset); + yoffset = addGraphicControls(tab, yoffset, ws); // // 4) The audio tab @@ -250,10 +257,10 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) tab->addTab("Audio"); yoffset = vBorder; - _globalAudioOverride = addCheckbox(tab, x, yoffset, "Override global audio settings", kCmdGlobalAudioOverride, 0); + _globalAudioOverride = addCheckbox(tab, x, yoffset, "Override global audio settings", kCmdGlobalAudioOverride, 0, ws); yoffset += _globalAudioOverride->getHeight(); - yoffset = addAudioControls(tab, yoffset); + yoffset = addAudioControls(tab, yoffset, ws); // // 5) The MIDI tab @@ -261,10 +268,10 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) tab->addTab("MIDI"); yoffset = vBorder; - _globalMIDIOverride = addCheckbox(tab, x, yoffset, "Override global MIDI settings", kCmdGlobalMIDIOverride, 0); + _globalMIDIOverride = addCheckbox(tab, x, yoffset, "Override global MIDI settings", kCmdGlobalMIDIOverride, 0, ws); yoffset += _globalMIDIOverride->getHeight(); - yoffset = addMIDIControls(tab, yoffset); + yoffset = addMIDIControls(tab, yoffset, ws); // // 6) The volume tab @@ -272,18 +279,18 @@ EditGameDialog::EditGameDialog(const String &domain, GameSettings target) tab->addTab("Volume"); yoffset = vBorder; - _globalVolumeOverride = addCheckbox(tab, x, yoffset, "Override global volume settings", kCmdGlobalVolumeOverride, 0); + _globalVolumeOverride = addCheckbox(tab, x, yoffset, "Override global volume settings", kCmdGlobalVolumeOverride, 0, ws); yoffset += _globalVolumeOverride->getHeight(); - yoffset = addVolumeControls(tab, yoffset); + yoffset = addVolumeControls(tab, yoffset, ws); // Activate the first tab tab->setActiveTab(0); // Add OK & Cancel buttons - addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); - addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0); + addButton(_w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws); + addButton(_w - (buttonWidth + 10), _h - buttonHeight - 8, "OK", kOKCmd, 0, ws); } void EditGameDialog::open() { diff --git a/gui/options.cpp b/gui/options.cpp index ca6ea27af8..8eae066528 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -84,7 +84,6 @@ OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h) _musicVolumeSlider(0), _musicVolumeLabel(0), _sfxVolumeSlider(0), _sfxVolumeLabel(0), _speechVolumeSlider(0), _speechVolumeLabel(0) { - } void OptionsDialog::open() { @@ -309,7 +308,7 @@ void OptionsDialog::setVolumeSettingsState(bool enabled) { _speechVolumeLabel->setEnabled(enabled); } -int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) { +int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset, WidgetSize ws) { const int x = 10; const int w = _w - 2 * 10; const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); @@ -336,11 +335,11 @@ int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) { } // Fullscreen checkbox - _fullscreenCheckbox = addCheckbox(boss, x, yoffset, "Fullscreen mode", 0, 0); + _fullscreenCheckbox = addCheckbox(boss, x, yoffset, "Fullscreen mode", 0, 0, ws); yoffset += _fullscreenCheckbox->getHeight(); // Aspect ratio checkbox - _aspectCheckbox = addCheckbox(boss, x, yoffset, "Aspect ratio correction", 0, 0); + _aspectCheckbox = addCheckbox(boss, x, yoffset, "Aspect ratio correction", 0, 0, ws); yoffset += _aspectCheckbox->getHeight(); #ifdef _WIN32_WCE @@ -354,7 +353,7 @@ int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset) { return yoffset; } -int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset) { +int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset, WidgetSize ws) { const int x = 10; const int w = _w - 20; @@ -370,7 +369,7 @@ int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset) { } // Subtitles on/off - _subCheckbox = addCheckbox(boss, x, yoffset, "Display subtitles", 0, 0); + _subCheckbox = addCheckbox(boss, x, yoffset, "Display subtitles", 0, 0, ws); yoffset += _subCheckbox->getHeight(); yoffset += 18; @@ -380,7 +379,7 @@ int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset) { return yoffset; } -int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) { +int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset, WidgetSize ws) { const int x = 10; // SoundFont @@ -389,15 +388,15 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) { yoffset += 18; // Multi midi setting - _multiMidiCheckbox = addCheckbox(boss, x, yoffset, "Mixed Adlib/MIDI mode", 0, 0); + _multiMidiCheckbox = addCheckbox(boss, x, yoffset, "Mixed Adlib/MIDI mode", 0, 0, ws); yoffset += _multiMidiCheckbox->getHeight(); // Native mt32 setting - _mt32Checkbox = addCheckbox(boss, x, yoffset, "True Roland MT-32 (disable GM emulation)", 0, 0); + _mt32Checkbox = addCheckbox(boss, x, yoffset, "True Roland MT-32 (disable GM emulation)", 0, 0, ws); yoffset += _mt32Checkbox->getHeight(); // GS Extensions setting - _enableGSCheckbox = addCheckbox(boss, x, yoffset, "Enable Roland GS Mode", 0, 0); + _enableGSCheckbox = addCheckbox(boss, x, yoffset, "Enable Roland GS Mode", 0, 0, ws); yoffset += _enableGSCheckbox->getHeight(); _enableMIDISettings = true; @@ -405,25 +404,25 @@ int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset) { return yoffset; } -int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) { +int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws) { // Volume controllers - new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Music volume: ", kTextAlignRight); + new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Music volume: ", kTextAlignRight, ws); _musicVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kMusicVolumeChanged); - _musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); + _musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _musicVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; - new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "SFX volume: ", kTextAlignRight); + new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "SFX volume: ", kTextAlignRight, ws); _sfxVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSfxVolumeChanged); - _sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); + _sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; - new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Speech volume: ", kTextAlignRight); + new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Speech volume: ", kTextAlignRight, ws); _speechVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSpeechVolumeChanged); - _speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); + _speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws); _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _speechVolumeLabel->setFlags(WIDGET_CLEARBG); yoffset += 16; @@ -469,15 +468,15 @@ GlobalOptionsDialog::GlobalOptionsDialog() // tab->addTab("Graphics"); yoffset = vBorder; - yoffset = addGraphicControls(tab, yoffset); + yoffset = addGraphicControls(tab, yoffset, ws); // // 2) The audio tab // tab->addTab("Audio"); yoffset = vBorder; - yoffset = addAudioControls(tab, yoffset); - yoffset = addVolumeControls(tab, yoffset); + yoffset = addAudioControls(tab, yoffset, ws); + yoffset = addVolumeControls(tab, yoffset, ws); // TODO: cd drive setting // @@ -485,7 +484,7 @@ GlobalOptionsDialog::GlobalOptionsDialog() // tab->addTab("MIDI"); yoffset = vBorder; - yoffset = addMIDIControls(tab, yoffset); + yoffset = addMIDIControls(tab, yoffset, ws); // // 4) The miscellaneous tab diff --git a/gui/options.h b/gui/options.h index 9a68f16ca0..107c903c2f 100644 --- a/gui/options.h +++ b/gui/options.h @@ -56,10 +56,10 @@ protected: ButtonWidget *_soundFontButton; StaticTextWidget *_soundFont; - int addGraphicControls(GuiObject *boss, int yoffset); - int addAudioControls(GuiObject *boss, int yoffset); - int addMIDIControls(GuiObject *boss, int yoffset); - int addVolumeControls(GuiObject *boss, int yoffset); + int addGraphicControls(GuiObject *boss, int yoffset, WidgetSize ws); + int addAudioControls(GuiObject *boss, int yoffset, WidgetSize ws); + int addMIDIControls(GuiObject *boss, int yoffset, WidgetSize ws); + int addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws); void setGraphicSettingsState(bool enabled); void setAudioSettingsState(bool enabled); |