From d460f8f70a1527000d3857e788ce5cff34adf7c1 Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Thu, 30 Sep 2021 17:17:49 +0100 Subject: [PATCH] GUI: Avoid showing ellipses in smaller labels --- gui/options.cpp | 12 ++++++------ gui/themes/default.inc | 2 +- gui/themes/residualvm/remastered_layout_lowres.stx | 2 +- gui/themes/scummclassic/classic_layout_lowres.stx | 2 +- gui/themes/scummmodern/scummmodern_layout_lowres.stx | 2 +- .../scummremastered/remastered_layout_lowres.stx | 2 +- gui/widget.cpp | 8 +++++--- gui/widget.h | 5 +++-- 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/gui/options.cpp b/gui/options.cpp index 5824eb3d14d..7362d958d10 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1250,7 +1250,7 @@ void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &pr else _kbdMouseSpeedDesc = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedDesc", _c("Pointer Speed:", "lowres"), _("Speed for keyboard/joystick mouse pointer control")); _kbdMouseSpeedSlider = new SliderWidget(boss, prefix + "grKbdMouseSpeedSlider", _("Speed for keyboard/joystick mouse pointer control"), kKbdMouseSpeedChanged); - _kbdMouseSpeedLabel = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedLabel", Common::U32String(" ")); + _kbdMouseSpeedLabel = new StaticTextWidget(boss, prefix + "grKbdMouseSpeedLabel", Common::U32String(" "), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _kbdMouseSpeedSlider->setMinValue(0); _kbdMouseSpeedSlider->setMaxValue(7); _kbdMouseSpeedLabel->setFlags(WIDGET_CLEARBG); @@ -1263,7 +1263,7 @@ void OptionsDialog::addControlControls(GuiObject *boss, const Common::String &pr else _joystickDeadzoneDesc = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneDesc", _c("Joy Deadzone:", "lowres"), _("Analog joystick Deadzone")); _joystickDeadzoneSlider = new SliderWidget(boss, prefix + "grJoystickDeadzoneSlider", _("Analog joystick Deadzone"), kJoystickDeadzoneChanged); - _joystickDeadzoneLabel = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneLabel", Common::U32String(" ")); + _joystickDeadzoneLabel = new StaticTextWidget(boss, prefix + "grJoystickDeadzoneLabel", Common::U32String(" "), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _joystickDeadzoneSlider->setMinValue(1); _joystickDeadzoneSlider->setMaxValue(10); _joystickDeadzoneLabel->setFlags(WIDGET_CLEARBG); @@ -1673,7 +1673,7 @@ void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &p // Subtitle speed _subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", Common::U32String(), kSubtitleSpeedChanged); - _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", Common::U32String("100%")); + _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal); _subSpeedLabel->setFlags(WIDGET_CLEARBG); @@ -1688,7 +1688,7 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre else _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _c("Music volume:", "lowres")); _musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", Common::U32String(), kMusicVolumeChanged); - _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", Common::U32String("100%")); + _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _musicVolumeLabel->setFlags(WIDGET_CLEARBG); @@ -1700,7 +1700,7 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre else _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _c("SFX volume:", "lowres"), _("Special sound effects volume")); _sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", _("Special sound effects volume"), kSfxVolumeChanged); - _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", Common::U32String("100%")); + _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG); @@ -1710,7 +1710,7 @@ void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &pre else _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _c("Speech volume:", "lowres")); _speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", Common::U32String(), kSpeechVolumeChanged); - _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", Common::U32String("100%")); + _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", Common::U32String("100%"), Common::U32String(), ThemeEngine::kFontStyleBold, Common::UNK_LANG, false); _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume); _speechVolumeLabel->setFlags(WIDGET_CLEARBG); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index cf29265d9b4..c73b6465a6b 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -3304,7 +3304,7 @@ const char *defaultXML1 = "" "textalign='end' " "/>" "" " getWidgetTextHAlign(name), g_gui.useRTL() && _useRTL); setFont(font, lang); + _useEllipsis = useEllipsis; } void StaticTextWidget::setValue(int value) { @@ -328,7 +330,7 @@ void StaticTextWidget::setAlign(Graphics::TextAlign align) { void StaticTextWidget::drawWidget() { g_gui.theme()->drawText( Common::Rect(_x, _y, _x + _w, _y + _h), - _label, _state, _align, ThemeEngine::kTextInversionNone, 0, true, _font + _label, _state, _align, ThemeEngine::kTextInversionNone, 0, _useEllipsis, _font ); } diff --git a/gui/widget.h b/gui/widget.h index 6f7ffa26131..e747f99e68f 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -201,10 +201,11 @@ protected: Common::U32String _label; Graphics::TextAlign _align; ThemeEngine::FontStyle _font; + bool _useEllipsis; public: - StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG); - StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG); + StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true); + StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip = Common::U32String(), ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold, Common::Language lang = Common::UNK_LANG, bool useEllipsis = true); void setValue(int value); void setLabel(const Common::U32String &label); void handleMouseEntered(int button) override { readLabel(); }