[Scummvm-cvs-logs] SF.net SVN: scummvm: [24513] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Oct 25 23:49:41 CEST 2006


Revision: 24513
          http://svn.sourceforge.net/scummvm/?rev=24513&view=rev
Author:   lordhoto
Date:     2006-10-25 14:49:33 -0700 (Wed, 25 Oct 2006)

Log Message:
-----------
- Fix crash if theme_logo.visible is set to true in a classic theme config file

Modified Paths:
--------------
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/theme.h

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-10-25 21:20:31 UTC (rev 24512)
+++ scummvm/trunk/gui/launcher.cpp	2006-10-25 21:49:33 UTC (rev 24513)
@@ -474,13 +474,11 @@
 
 #ifndef DISABLE_FANCY_THEMES
 	_logo = 0;
-	if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
+	if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1 && g_gui.theme()->supportsImages()) {
 		_logo = new GraphicsWidget(this, "launcher_logo");
 		_logo->useThemeTransparency(true);
-		ThemeModern *th = (ThemeModern *)g_gui.theme();
+		_logo->setGfx(g_gui.theme()->getImageSurface(Theme::kImageLogo));
 
-		_logo->setGfx(th->getImageSurface(th->kThemeLogo));
-
 		new StaticTextWidget(this, "launcher_version", gScummVMVersionDate);
 	} else
 		new StaticTextWidget(this, "launcher_version", gScummVMFullVersion);
@@ -866,7 +864,7 @@
 
 void LauncherDialog::reflowLayout() {
 #ifndef DISABLE_FANCY_THEMES
-	if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
+	if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1 && g_gui.theme()->supportsImages()) {
 		StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
 		if (ver) {
 			ver->setAlign((Graphics::TextAlignment)g_gui.evaluator()->getVar("launcher_version.align"));
@@ -876,9 +874,7 @@
 		if (!_logo)
 			_logo = new GraphicsWidget(this, "launcher_logo");
 		_logo->useThemeTransparency(true);
-		ThemeModern *th = (ThemeModern *)g_gui.theme();
-
-		_logo->setGfx(th->getImageSurface(th->kThemeLogo));
+		_logo->setGfx(g_gui.theme()->getImageSurface(Theme::kImageLogo));
 	} else {
 		StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
 		if (ver) {

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-10-25 21:20:31 UTC (rev 24512)
+++ scummvm/trunk/gui/theme.h	2006-10-25 21:49:33 UTC (rev 24513)
@@ -218,6 +218,14 @@
 
 	const String &getStylefileName() const { return _stylefile; }
 	const String &getThemeName() const { return _stylename; }
+
+	virtual bool supportsImages() const { return false; }
+
+	enum kThemeImages {
+		kImageLogo = 0
+	};
+
+	virtual const Graphics::Surface *getImageSurface(const kThemeImages n) const { return 0; }
 protected:
 	bool loadConfigFile(const String &file);
 	void getColorFromConfig(const String &name, OverlayColor &col);
@@ -377,7 +385,6 @@
 	void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, int deltax, State state, TextAlign align);
 	void drawCaret(const Common::Rect &r, bool erase, State state);
 	void drawLineSeparator(const Common::Rect &r, State state);
-	const Graphics::Surface *getImageSurface(int n) { return _images[n]; }
 
 	void restoreBackground(Common::Rect r, bool special = false);
 	bool addDirtyRect(Common::Rect r, bool backup = false, bool special = false);
@@ -385,6 +392,8 @@
 	int getTabSpacing() const;
 	int getTabPadding() const;
 
+	bool supportsImages() const { return true; }
+	const Graphics::Surface *getImageSurface(const kThemeImages n) const { return n == kImageLogo ? _images[kThemeLogo] : 0; }
 private:
 	void colorFade(const Common::Rect &r, OverlayColor start, OverlayColor end, uint factor = 1);
 	void drawRect(const Common::Rect &r, const Graphics::Surface *corner, const Graphics::Surface *top,
@@ -443,7 +452,6 @@
 private:
 	void processExtraValues();
 
-public:
 	enum ImageHandles {
 		kDialogBkgdCorner = 0,
 		kDialogBkgdTop = 1,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list