diff --git a/gui/PopUpWidget.cpp b/gui/PopUpWidget.cpp index 4792833580e..9be652b8d69 100644 --- a/gui/PopUpWidget.cpp +++ b/gui/PopUpWidget.cpp @@ -356,15 +356,13 @@ void PopUpDialog::drawMenuEntry(int entry, bool hilite) { // PopUpWidget // -PopUpWidget::PopUpWidget(GuiObject *boss, const String &name, const String &label, uint labelWidth) - : Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(labelWidth) { +PopUpWidget::PopUpWidget(GuiObject *boss, const String &name, const String &label) + : Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(0) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_IGNORE_DRAG); _type = kPopUpWidget; _selectedItem = -1; - - if (!_label.empty() && _labelWidth == 0) - _labelWidth = g_gui.getStringWidth(_label); + _labelWidth = g_gui.xmlEval()->getVar("Globals.PopUpWidget.labelWidth"); } void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) { @@ -396,6 +394,7 @@ void PopUpWidget::handleMouseWheel(int x, int y, int direction) { } void PopUpWidget::reflowLayout() { + _labelWidth = g_gui.xmlEval()->getVar("Globals.PopUpWidget.labelWidth"); _leftPadding = g_gui.xmlEval()->getVar("Globals.PopUpWidget.Padding.Left", 0); _rightPadding = g_gui.xmlEval()->getVar("Globals.PopUpWidget.Padding.Right", 0); _labelSpacing = g_gui.xmlEval()->getVar("Globals.PopUpWidget.labelSpacing", 10); diff --git a/gui/PopUpWidget.h b/gui/PopUpWidget.h index 3f65106ac17..23d57579922 100644 --- a/gui/PopUpWidget.h +++ b/gui/PopUpWidget.h @@ -56,16 +56,14 @@ protected: int _selectedItem; String _label; - uint _labelWidth; + int _labelWidth; int _leftPadding; int _rightPadding; int _labelSpacing; public: - PopUpWidget(GuiObject *boss, const String &name, const String &label, uint labelWidth = 0); - - void changeLabelWidth(uint newWidth) { _labelWidth = newWidth; } + PopUpWidget(GuiObject *boss, const String &name, const String &label); void handleMouseDown(int x, int y, int button, int clickCount); void handleMouseWheel(int x, int y, int direction); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 119e3596f8b..4d54a60eb0e 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -121,8 +121,6 @@ class EditGameDialog : public OptionsDialog { public: EditGameDialog(const String &domain, const String &desc); - virtual void reflowLayout(); - void open(); void close(); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); @@ -147,8 +145,6 @@ protected: EditGameDialog::EditGameDialog(const String &domain, const String &desc) : OptionsDialog(domain, "GameOptions") { - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - // GAME: Path to game data (r/o), extra data (r/o), and save data (r/w) String gamePath(ConfMan.get("path", _domain)); String extraPath(ConfMan.get("extrapath", _domain)); @@ -177,7 +173,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) _descriptionWidget = new EditTextWidget(tab, "GameOptions_Game.Desc", description); // Language popup - _langPopUp = new PopUpWidget(tab, "GameOptions_Game.Lang", "Language:", labelWidth); + _langPopUp = new PopUpWidget(tab, "GameOptions_Game.Lang", "Language:"); _langPopUp->appendEntry(""); _langPopUp->appendEntry(""); const Common::LanguageDescription *l = Common::g_languages; @@ -186,7 +182,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) } // Platform popup - _platformPopUp = new PopUpWidget(tab, "GameOptions_Game.Platform", "Platform:", labelWidth); + _platformPopUp = new PopUpWidget(tab, "GameOptions_Game.Platform", "Platform:"); _platformPopUp->appendEntry(""); _platformPopUp->appendEntry(""); const Common::PlatformDescription *p = Common::g_platforms; @@ -260,17 +256,6 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) new ButtonWidget(this, "GameOptions.Ok", "OK", kOKCmd, 0); } -void EditGameDialog::reflowLayout() { - OptionsDialog::reflowLayout(); - - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - - if (_langPopUp) - _langPopUp->changeLabelWidth(labelWidth); - if (_platformPopUp) - _platformPopUp->changeLabelWidth(labelWidth); -} - void EditGameDialog::open() { OptionsDialog::open(); diff --git a/gui/options.cpp b/gui/options.cpp index 77d564fdb41..78010e351a3 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -515,10 +515,8 @@ void OptionsDialog::setSubtitleSettingsState(bool enabled) { void OptionsDialog::addGraphicControls(GuiObject *boss, const String &prefix) { const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes(); - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - // The GFX mode popup - _gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup", "Graphics mode:", labelWidth); + _gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup", "Graphics mode:"); _gfxPopUp->appendEntry(""); _gfxPopUp->appendEntry(""); @@ -528,7 +526,7 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const String &prefix) { } // RenderMode popup - _renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", "Render mode:", labelWidth); + _renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", "Render mode:"); _renderModePopUp->appendEntry("", Common::kRenderDefault); _renderModePopUp->appendEntry(""); const Common::RenderModeDescription *rm = Common::g_renderModes; @@ -546,10 +544,8 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const String &prefix) { } void OptionsDialog::addAudioControls(GuiObject *boss, const String &prefix) { - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - // The MIDI mode popup & a label - _midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup", "Music driver:", labelWidth); + _midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup", "Music driver:"); // Populate it const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers(); @@ -559,7 +555,7 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const String &prefix) { } // Sample rate settings - _outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup", "Output rate:", labelWidth); + _outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup", "Output rate:"); for (int i = 0; outputRateLabels[i]; i++) { _outputRatePopUp->appendEntry(outputRateLabels[i], outputRateValues[i]); @@ -652,19 +648,8 @@ int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) { void OptionsDialog::reflowLayout() { Dialog::reflowLayout(); - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - if (_graphicsTabId != -1 && _tabWidget) _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX"); - - if (_midiPopUp) - _midiPopUp->changeLabelWidth(labelWidth); - if (_outputRatePopUp) - _outputRatePopUp->changeLabelWidth(labelWidth); - if (_gfxPopUp) - _gfxPopUp->changeLabelWidth(labelWidth); - if (_renderModePopUp) - _renderModePopUp->changeLabelWidth(labelWidth); } #pragma mark - @@ -731,14 +716,12 @@ GlobalOptionsDialog::GlobalOptionsDialog() _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName()); - int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - - _rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.Renderer", "GUI Renderer:", labelWidth); + _rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.Renderer", "GUI Renderer:"); for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i) _rendererPopUp->appendEntry(GUI::ThemeEngine::_rendererModes[i].name, GUI::ThemeEngine::_rendererModes[i].mode); - _autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriod", "Autosave:", labelWidth); + _autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriod", "Autosave:"); for (int i = 0; savePeriodLabels[i]; i++) { _autosavePeriodPopUp->appendEntry(savePeriodLabels[i], savePeriodValues[i]); diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 2508ff4a5b1..015d989db1f 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -27,10 +27,10 @@ - + diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 09143856675..b1fd9e3f439 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -27,11 +27,11 @@ - - + + diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 96d3f69663e..ee027526e42 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -27,7 +27,6 @@ - @@ -39,6 +38,7 @@ + @@ -705,4 +705,17 @@ + + + + + + + + diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index fb4b0a6950d..bfa2fab798f 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -27,10 +27,10 @@ - +