[Scummvm-cvs-logs] scummvm master -> 1b11139dc53da2dc95f74eb19e3a903d7d786f84

tsoliman tarek at bashasoliman.com
Tue Dec 13 15:41:29 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c6e001a1f5 GUI: Move addClearButton() from options.cpp to widget.cpp
be0f8407b6 GUI: Handle adding clear buttons that don't exist in layouts
1b11139dc5 KEYMAPPER: Switch to using addClearButton()


Commit: c6e001a1f5f76735f695301a6a1faeda90c284e6
    https://github.com/scummvm/scummvm/commit/c6e001a1f5f76735f695301a6a1faeda90c284e6
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-13T06:36:41-08:00

Commit Message:
GUI: Move addClearButton() from options.cpp to widget.cpp

This is so it can be used outside options.cpp

Changed paths:
    gui/options.cpp
    gui/options.h
    gui/widget.cpp
    gui/widget.h
    po/POTFILES



diff --git a/gui/options.cpp b/gui/options.cpp
index dfa30d1..4fa5a82 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -1033,22 +1033,6 @@ void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String se
 		ConfMan.removeKey(setting, _domain);
 }
 
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
-	ButtonWidget *button;
-
-#ifndef DISABLE_FANCY_THEMES
-	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
-		button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
-		((PicButtonWidget *)button)->useThemeTransparency(true);
-		((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
-	} else
-#endif
-		button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
-
-	return button;
-}
-
-
 int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
 	if (_guioptions.contains(GUIO_NOSUBTITLES))
 		return kSubtitlesSpeech; // Speech only
diff --git a/gui/options.h b/gui/options.h
index 479f836..92ce3e5 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -43,8 +43,6 @@ class GuiObject;
 class RadiobuttonGroup;
 class RadiobuttonWidget;
 
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);
-
 class OptionsDialog : public Dialog {
 public:
 	OptionsDialog(const Common::String &domain, int x, int y, int w, int h);
diff --git a/gui/widget.cpp b/gui/widget.cpp
index d11ebda..9fa864e 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -23,6 +23,7 @@
 #include "common/system.h"
 #include "common/rect.h"
 #include "common/textconsole.h"
+#include "common/translation.h"
 #include "graphics/pixelformat.h"
 #include "gui/widget.h"
 #include "gui/gui-manager.h"
@@ -302,6 +303,21 @@ void ButtonWidget::setLabel(const Common::String &label) {
 	StaticTextWidget::setLabel(cleanupHotkey(label));
 }
 
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
+	ButtonWidget *button;
+
+#ifndef DISABLE_FANCY_THEMES
+	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
+		button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
+		((PicButtonWidget *)button)->useThemeTransparency(true);
+		((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
+	} else
+#endif
+		button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
+
+	return button;
+}
+
 #pragma mark -
 
 PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd, uint8 hotkey)
diff --git a/gui/widget.h b/gui/widget.h
index 428ab79..9894dc4 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -354,6 +354,8 @@ protected:
 	void drawWidget();
 };
 
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);
+
 } // End of namespace GUI
 
 #endif
diff --git a/po/POTFILES b/po/POTFILES
index 14ab568..9898958 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -13,6 +13,7 @@ gui/options.cpp
 gui/saveload.cpp
 gui/themebrowser.cpp
 gui/ThemeEngine.cpp
+gui/widget.cpp
 
 base/main.cpp
 


Commit: be0f8407b69f7878cd2e0a42856fd4ccd0c695e0
    https://github.com/scummvm/scummvm/commit/be0f8407b69f7878cd2e0a42856fd4ccd0c695e0
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-13T06:37:18-08:00

Commit Message:
GUI: Handle adding clear buttons that don't exist in layouts

The buttons in the keymapper are dynamically generated and don't exist in
the layout; They have no name.

Changed paths:
    gui/widget.cpp
    gui/widget.h



diff --git a/gui/widget.cpp b/gui/widget.cpp
index 9fa864e..82007c5 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -303,17 +303,23 @@ void ButtonWidget::setLabel(const Common::String &label) {
 	StaticTextWidget::setLabel(cleanupHotkey(label));
 }
 
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd) {
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x, int y, int w, int h) {
 	ButtonWidget *button;
 
 #ifndef DISABLE_FANCY_THEMES
 	if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
-		button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
+		if (!name.empty())
+			button = new PicButtonWidget(boss, name, _("Clear value"), cmd);
+		else
+			button = new PicButtonWidget(boss, x, y, w, h, _("Clear value"), cmd);
 		((PicButtonWidget *)button)->useThemeTransparency(true);
 		((PicButtonWidget *)button)->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageEraser));
 	} else
 #endif
-		button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
+		if (!name.empty())
+			button = new ButtonWidget(boss, name, "C", _("Clear value"), cmd);
+		else
+			button = new ButtonWidget(boss, x, y, w, h, "C", _("Clear value"), cmd);
 
 	return button;
 }
diff --git a/gui/widget.h b/gui/widget.h
index 9894dc4..789fc09 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -354,7 +354,7 @@ protected:
 	void drawWidget();
 };
 
-ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd);
+ButtonWidget *addClearButton(GuiObject *boss, const Common::String &name, uint32 cmd, int x=0, int y=0, int w=0, int h=0);
 
 } // End of namespace GUI
 


Commit: 1b11139dc53da2dc95f74eb19e3a903d7d786f84
    https://github.com/scummvm/scummvm/commit/1b11139dc53da2dc95f74eb19e3a903d7d786f84
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-13T06:37:19-08:00

Commit Message:
KEYMAPPER: Switch to using addClearButton()

Changed paths:
    backends/keymapper/remap-dialog.cpp



diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index b0f42fe..4813beb 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -172,16 +172,7 @@ void RemapDialog::reflowLayout() {
 				new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignRight);
 			widg.keyButton =
 				new GUI::ButtonWidget(this, 0, 0, 0, 0, "", 0, kRemapCmd + i);
-#ifndef DISABLE_FANCY_THEMES
-			if (g_gui.xmlEval()->getVar("Globals.ShowSearchPic") == 1 && g_gui.theme()->supportsImages()) {
-				widg.clearButton = new GUI::PicButtonWidget(this, 0, 0, clearButtonWidth, clearButtonHeight, _("Clear value"), kClearCmd + i);
-				((GUI::PicButtonWidget *)widg.clearButton)->useThemeTransparency(true);
-				((GUI::PicButtonWidget *)widg.clearButton)->setGfx(g_gui.theme()->getImageSurface(GUI::ThemeEngine::kImageEraser));
-			}
-			else
-#endif
-				widg.clearButton = new GUI::ButtonWidget(this, 0, 0, 0, 0, "C", _("Clear value"), kClearCmd + i);
-
+			widg.clearButton = addClearButton(this, "", kClearCmd, 0, 0, clearButtonWidth, clearButtonHeight);
 			_keymapWidgets.push_back(widg);
 		} else {
 			widg = _keymapWidgets[i];






More information about the Scummvm-git-logs mailing list