GUI: Avoid showing ellipses in smaller labels

This commit is contained in:
Cameron Cawley 2021-09-30 17:17:49 +01:00
parent b444f53685
commit d460f8f70a
8 changed files with 19 additions and 16 deletions

View file

@ -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);

View file

@ -3304,7 +3304,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"textalign='end' "
"/>"
"<widget name='SmallLabel' "
"size='18,Globals.Line.Height' "
"size='20,Globals.Line.Height' "
"/>"
"<widget name='CloudTabLabel' "
"size='180,Globals.Line.Height' "

View file

@ -67,7 +67,7 @@
textalign = 'end'
/>
<widget name = 'SmallLabel'
size = '18, Globals.Line.Height'
size = '20, Globals.Line.Height'
/>
<widget name = 'CloudTabLabel'
size = '170, Globals.Line.Height'

View file

@ -65,7 +65,7 @@
textalign = 'end'
/>
<widget name = 'SmallLabel'
size = '18, Globals.Line.Height'
size = '20, Globals.Line.Height'
/>
<widget name = 'CloudTabLabel'
size = '180, Globals.Line.Height'

View file

@ -65,7 +65,7 @@
textalign = 'end'
/>
<widget name = 'SmallLabel'
size = '18, Globals.Line.Height'
size = '20, Globals.Line.Height'
/>
<widget name = 'CloudTabLabel'
size = '170, Globals.Line.Height'

View file

@ -67,7 +67,7 @@
textalign = 'end'
/>
<widget name = 'SmallLabel'
size = '18, Globals.Line.Height'
size = '20, Globals.Line.Height'
/>
<widget name = 'CloudTabLabel'
size = '170, Globals.Line.Height'

View file

@ -285,22 +285,24 @@ void Widget::read(const Common::U32String &str) {
#pragma mark -
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang)
StaticTextWidget::StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &text, Graphics::TextAlign align, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
: Widget(boss, x, y, w, h, tooltip) {
setFlags(WIDGET_ENABLED);
_type = kStaticTextWidget;
_label = text;
_align = Graphics::convertTextAlignH(align, g_gui.useRTL() && _useRTL);
setFont(font, lang);
_useEllipsis = useEllipsis;
}
StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang)
StaticTextWidget::StaticTextWidget(GuiObject *boss, const Common::String &name, const Common::U32String &text, const Common::U32String &tooltip, ThemeEngine::FontStyle font, Common::Language lang, bool useEllipsis)
: Widget(boss, name, tooltip) {
setFlags(WIDGET_ENABLED | WIDGET_CLEARBG);
_type = kStaticTextWidget;
_label = text;
_align = Graphics::convertTextAlignH(g_gui.xmlEval()->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
);
}

View file

@ -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(); }