From 83df1eb43be7c4fa5cc14d743f91c507d905c564 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 24 Jan 2016 03:06:47 +0100 Subject: GUI: Only use image for delete when applicable in PredictiveDialog. --- gui/ThemeEngine.h | 2 +- gui/predictivedialog.cpp | 30 ++++++++++++++++++--- gui/predictivedialog.h | 2 ++ gui/themes/default.inc | 2 ++ gui/themes/scummclassic.zip | Bin 111302 -> 111410 bytes gui/themes/scummclassic/THEMERC | 2 +- gui/themes/scummclassic/classic_layout.stx | 1 + gui/themes/scummclassic/classic_layout_lowres.stx | 1 + gui/themes/scummmodern.zip | Bin 1487079 -> 1487187 bytes gui/themes/scummmodern/THEMERC | 2 +- gui/themes/scummmodern/scummmodern_layout.stx | 1 + .../scummmodern/scummmodern_layout_lowres.stx | 1 + 12 files changed, 37 insertions(+), 7 deletions(-) diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 68be2e0b26..7acf830f76 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -36,7 +36,7 @@ #include "graphics/pixelformat.h" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.20" +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.21" class OSystem; diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index ee8973bc62..402bf0c06b 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -24,6 +24,7 @@ #include "gui/widget.h" #include "gui/widgets/edittext.h" #include "gui/gui-manager.h" +#include "gui/ThemeEval.h" #include "common/config-manager.h" #include "common/translation.h" @@ -89,11 +90,13 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") { _btns[kAddAct]->setEnabled(false); #ifndef DISABLE_FANCY_THEMES - _btns[kDelAct] = new PicButtonWidget(this, "Predictive.Delete", _("Delete char"), kDelCmd); - ((PicButtonWidget *)_btns[kDelAct])->useThemeTransparency(true); - ((PicButtonWidget *)_btns[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn)); + if (g_gui.xmlEval()->getVar("Globals.Predictive.ShowDeletePic") == 1 && g_gui.theme()->supportsImages()) { + _btns[kDelAct] = new PicButtonWidget(this, "Predictive.Delete", _("Delete char"), kDelCmd); + ((PicButtonWidget *)_btns[kDelAct])->useThemeTransparency(true); + ((PicButtonWidget *)_btns[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn)); + } else #endif - _btns[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd); + _btns[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd); // I18N: Pre means 'Predictive', leave '*' as is _btns[kModeAct] = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), 0, kModeCmd); _edittext = new EditTextWidget(this, "Predictive.Word", _search, 0, 0, 0); @@ -171,6 +174,25 @@ PredictiveDialog::~PredictiveDialog() { free(_btns); } +void PredictiveDialog::reflowLayout() { +#ifndef DISABLE_FANCY_THEMES + removeWidget(_btns[kDelAct]); + _btns[kDelAct]->setNext(0); + delete _btns[kDelAct]; + _btns[kDelAct] = nullptr; + + if (g_gui.xmlEval()->getVar("Globals.Predictive.ShowDeletePic") == 1 && g_gui.theme()->supportsImages()) { + _btns[kDelAct] = new PicButtonWidget(this, "Predictive.Delete", _("Delete char"), kDelCmd); + ((PicButtonWidget *)_btns[kDelAct])->useThemeTransparency(true); + ((PicButtonWidget *)_btns[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelbtn)); + } else { + _btns[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd); + } +#endif + + Dialog::reflowLayout(); +} + void PredictiveDialog::saveUserDictToFile() { if (_userDictHasChanged) { ConfMan.registerDefault("user_dictionary", "user.dic"); diff --git a/gui/predictivedialog.h b/gui/predictivedialog.h index 32d769d6ca..7f9b31e2d3 100644 --- a/gui/predictivedialog.h +++ b/gui/predictivedialog.h @@ -68,6 +68,8 @@ public: PredictiveDialog(); ~PredictiveDialog(); + virtual void reflowLayout(); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); virtual void handleKeyUp(Common::KeyState state); virtual void handleKeyDown(Common::KeyState state); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 90d7967bc0..e367bcb3c7 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -633,6 +633,7 @@ const char *defaultXML1 = "" " " "" "" +"" "" "" "" +"" "" diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index d7016cab58..1d8b8dad05 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index 8f40cb2a7e..7e58285d08 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.20:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.21:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 26656deaf9..18c2a1f889 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -49,6 +49,7 @@ + + + +