Skip to content

Commit

Permalink
GUI: Only use image for delete when applicable in PredictiveDialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Jan 24, 2016
1 parent 4a092ee commit 83df1eb
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gui/ThemeEngine.h
Expand Up @@ -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;

Expand Down
30 changes: 26 additions & 4 deletions gui/predictivedialog.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions gui/predictivedialog.h
Expand Up @@ -68,6 +68,8 @@ class PredictiveDialog : public GUI::Dialog {
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);
Expand Down
2 changes: 2 additions & 0 deletions gui/themes/default.inc
Expand Up @@ -633,6 +633,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='Tooltip.XDelta' value='16'/> "
"<def var='Tooltip.YDelta' value='16'/>"
"<def var='Predictive.Button.Width' value='60' />"
"<def var='Predictive.ShowDeletePic' value='0'/>"
"<widget name='OptionsLabel' "
"size='110,Globals.Line.Height' "
"textalign='right' "
Expand Down Expand Up @@ -1920,6 +1921,7 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<def var='Tooltip.YDelta' value='8'/>"
"<def var='Predictive.Button.Width' value='45' />"
"<def var='Predictive.Button.Height' value='15' />"
"<def var='Predictive.ShowDeletePic' value='0'/>"
"<widget name='Button' "
"size='72,16' "
"/>"
Expand Down
Binary file modified gui/themes/scummclassic.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion gui/themes/scummclassic/THEMERC
@@ -1 +1 @@
[SCUMMVM_STX0.8.20:ScummVM Classic Theme:No Author]
[SCUMMVM_STX0.8.21:ScummVM Classic Theme:No Author]
1 change: 1 addition & 0 deletions gui/themes/scummclassic/classic_layout.stx
Expand Up @@ -49,6 +49,7 @@
<def var = 'Tooltip.YDelta' value = '16'/>

<def var = 'Predictive.Button.Width' value = '60' />
<def var = 'Predictive.ShowDeletePic' value = '0'/>

<widget name = 'OptionsLabel'
size = '110, Globals.Line.Height'
Expand Down
1 change: 1 addition & 0 deletions gui/themes/scummclassic/classic_layout_lowres.stx
Expand Up @@ -51,6 +51,7 @@

<def var = 'Predictive.Button.Width' value = '45' />
<def var = 'Predictive.Button.Height' value = '15' />
<def var = 'Predictive.ShowDeletePic' value = '0'/>

<widget name = 'Button'
size = '72, 16'
Expand Down
Binary file modified gui/themes/scummmodern.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion gui/themes/scummmodern/THEMERC
@@ -1 +1 @@
[SCUMMVM_STX0.8.20:ScummVM Modern Theme:No Author]
[SCUMMVM_STX0.8.21:ScummVM Modern Theme:No Author]
1 change: 1 addition & 0 deletions gui/themes/scummmodern/scummmodern_layout.stx
Expand Up @@ -56,6 +56,7 @@
<def var = 'Tooltip.YDelta' value = '32'/>

<def var = 'Predictive.Button.Width' value = '60' />
<def var = 'Predictive.ShowDeletePic' value = '1'/>

<widget name = 'OptionsLabel'
size = '115, Globals.Line.Height'
Expand Down
1 change: 1 addition & 0 deletions gui/themes/scummmodern/scummmodern_layout_lowres.stx
Expand Up @@ -41,6 +41,7 @@

<def var = 'Predictive.Button.Width' value = '45' />
<def var = 'Predictive.Button.Height' value = '15' />
<def var = 'Predictive.ShowDeletePic' value = '0'/>

<widget name = 'Button'
size = '72, 16'
Expand Down

0 comments on commit 83df1eb

Please sign in to comment.