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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jan 17 18:13:04 CET 2009


Revision: 35881
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35881&view=rev
Author:   fingolfin
Date:     2009-01-17 17:13:04 +0000 (Sat, 17 Jan 2009)

Log Message:
-----------
Merged gui/ThemeData.cpp into ThemeEngine.cpp

Modified Paths:
--------------
    scummvm/trunk/dists/msvc7/scummvm.vcproj
    scummvm/trunk/dists/msvc71/scummvm.vcproj
    scummvm/trunk/dists/msvc8/scummvm.vcproj
    scummvm/trunk/dists/msvc9/scummvm.vcproj
    scummvm/trunk/gui/ThemeEngine.cpp
    scummvm/trunk/gui/ThemeEngine.h
    scummvm/trunk/gui/module.mk

Removed Paths:
-------------
    scummvm/trunk/gui/ThemeData.cpp
    scummvm/trunk/gui/ThemeData.h

Modified: scummvm/trunk/dists/msvc7/scummvm.vcproj
===================================================================
--- scummvm/trunk/dists/msvc7/scummvm.vcproj	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/dists/msvc7/scummvm.vcproj	2009-01-17 17:13:04 UTC (rev 35881)
@@ -897,12 +897,6 @@
 				RelativePath="..\..\gui\themebrowser.h">
 			</File>
 			<File
-				RelativePath="..\..\gui\ThemeData.cpp">
-			</File>
-			<File
-				RelativePath="..\..\gui\ThemeData.h">
-			</File>
-			<File
 				RelativePath="..\..\gui\ThemeEngine.cpp">
 			</File>
 			<File

Modified: scummvm/trunk/dists/msvc71/scummvm.vcproj
===================================================================
--- scummvm/trunk/dists/msvc71/scummvm.vcproj	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/dists/msvc71/scummvm.vcproj	2009-01-17 17:13:04 UTC (rev 35881)
@@ -911,12 +911,6 @@
 				RelativePath="..\..\gui\themebrowser.h">
 			</File>
 			<File
-				RelativePath="..\..\gui\ThemeData.cpp">
-			</File>
-			<File
-				RelativePath="..\..\gui\ThemeData.h">
-			</File>
-			<File
 				RelativePath="..\..\gui\ThemeEngine.cpp">
 			</File>
 			<File

Modified: scummvm/trunk/dists/msvc8/scummvm.vcproj
===================================================================
--- scummvm/trunk/dists/msvc8/scummvm.vcproj	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/dists/msvc8/scummvm.vcproj	2009-01-17 17:13:04 UTC (rev 35881)
@@ -1226,14 +1226,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\gui\ThemeData.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\gui\ThemeData.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\gui\ThemeEngine.cpp"
 				>
 			</File>

Modified: scummvm/trunk/dists/msvc9/scummvm.vcproj
===================================================================
--- scummvm/trunk/dists/msvc9/scummvm.vcproj	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/dists/msvc9/scummvm.vcproj	2009-01-17 17:13:04 UTC (rev 35881)
@@ -1231,14 +1231,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\gui\ThemeData.cpp"
-				>
-			</File>
-			<File
-				RelativePath="..\..\gui\ThemeData.h"
-				>
-			</File>
-			<File
 				RelativePath="..\..\gui\ThemeEngine.cpp"
 				>
 			</File>

Deleted: scummvm/trunk/gui/ThemeData.cpp
===================================================================
--- scummvm/trunk/gui/ThemeData.cpp	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/gui/ThemeData.cpp	2009-01-17 17:13:04 UTC (rev 35881)
@@ -1,136 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "gui/ThemeData.h"
-
-#include "graphics/VectorRenderer.h"
-
-namespace GUI {
-
-/**********************************************************
- *	Data definitions for theme engine elements
- *********************************************************/
-const ThemeEngine::DrawDataInfo ThemeEngine::kDrawDataDefaults[] = {
-	{kDDMainDialogBackground,		"mainmenu_bg",		true,	kDDNone},
-	{kDDSpecialColorBackground,		"special_bg",		true,	kDDNone},
-	{kDDPlainColorBackground,		"plain_bg",			true,	kDDNone},
-	{kDDDefaultBackground,			"default_bg",		true,	kDDNone},
-	{kDDTextSelectionBackground,	"text_selection",	false,	kDDNone},
-
-	{kDDWidgetBackgroundDefault,	"widget_default",	true,	kDDNone},
-	{kDDWidgetBackgroundSmall,		"widget_small",		true,	kDDNone},
-	{kDDWidgetBackgroundEditText,	"widget_textedit",	true,	kDDNone},
-	{kDDWidgetBackgroundSlider,		"widget_slider",	true,	kDDNone},
-
-	{kDDButtonIdle,					"button_idle",		true,	kDDWidgetBackgroundSlider},
-	{kDDButtonHover,				"button_hover",	false,	kDDButtonIdle},
-	{kDDButtonDisabled,				"button_disabled",	true,	kDDNone},
-
-	{kDDSliderFull,					"slider_full",		false,	kDDNone},
-	{kDDSliderHover,				"slider_hover",		false,	kDDNone},
-	{kDDSliderDisabled,				"slider_disabled",	true,	kDDNone},
-
-	{kDDCheckboxDefault,			"checkbox_default",			true,	kDDNone},
-	{kDDCheckboxDisabled,			"checkbox_disabled",		true,	kDDNone},
-	{kDDCheckboxSelected,			"checkbox_selected",		false,	kDDCheckboxDefault},
-
-	{kDDTabActive,					"tab_active",				false,	kDDTabInactive},
-	{kDDTabInactive,				"tab_inactive",				true,	kDDNone},
-	{kDDTabBackground,				"tab_background",			true,	kDDNone},
-
-	{kDDScrollbarBase,				"scrollbar_base",			true,	kDDNone},
-
-	{kDDScrollbarButtonIdle,		"scrollbar_button_idle",	true,	kDDNone},
-	{kDDScrollbarButtonHover,		"scrollbar_button_hover",	false,	kDDScrollbarButtonIdle},
-
-	{kDDScrollbarHandleIdle,		"scrollbar_handle_idle",	false,	kDDNone},
-	{kDDScrollbarHandleHover,		"scrollbar_handle_hover",	false,	kDDScrollbarBase},
-
-	{kDDPopUpIdle,					"popup_idle",	true,	kDDNone},
-	{kDDPopUpHover,					"popup_hover",	false,	kDDPopUpIdle},
-	{kDDPopUpDisabled,				"popup_disabled",	true,	kDDNone},
-
-	{kDDCaret,						"caret",		false,	kDDNone},
-	{kDDSeparator,					"separator",	true,	kDDNone},
-};
-
-const ThemeEngine::TextDataInfo ThemeEngine::kTextDataDefaults[] = {
-	{kTextDataDefault,		"text_default"},
-	{kTextDataHover,		"text_hover"},
-	{kTextDataDisabled,		"text_disabled"},
-	{kTextDataInverted,		"text_inverted"},
-	{kTextDataButton,		"text_button"},
-	{kTextDataButtonHover,	"text_button_hover"},
-	{kTextDataNormalFont,	"text_normal"}
-};
-
-
-/**********************************************************
- *	ThemeItem functions for drawing queues.
- *********************************************************/
-void ThemeItemDrawData::drawSelf(bool draw, bool restore) {
-
-	Common::Rect extendedRect = _area;
-	extendedRect.grow(_engine->kDirtyRectangleThreshold + _data->_backgroundOffset);
-
-	if (restore)
-		_engine->restoreBackground(extendedRect);
-
-	if (draw) {
-		Common::List<Graphics::DrawStep>::const_iterator step;
-		for (step = _data->_steps.begin(); step != _data->_steps.end(); ++step)
-			_engine->renderer()->drawStep(_area, *step, _dynamicData);
-	}
-
-	_engine->addDirtyRect(extendedRect);
-}
-
-void ThemeItemTextData::drawSelf(bool draw, bool restore) {
-	if (_restoreBg || restore)
-		_engine->restoreBackground(_area);
-
-	if (draw) {
-		_engine->renderer()->setFgColor(_data->_color.r, _data->_color.g, _data->_color.b);
-		_engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis);
-	}
-
-	_engine->addDirtyRect(_area);
-}
-
-void ThemeItemBitmap::drawSelf(bool draw, bool restore) {
-	if (restore)
-		_engine->restoreBackground(_area);
-
-	if (draw) {
-		if (_alpha)
-			_engine->renderer()->blitAlphaBitmap(_bitmap, _area);
-		else
-			_engine->renderer()->blitSubSurface(_bitmap, _area);
-	}
-
-	_engine->addDirtyRect(_area);
-}
-
-}

Deleted: scummvm/trunk/gui/ThemeData.h
===================================================================
--- scummvm/trunk/gui/ThemeData.h	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/gui/ThemeData.h	2009-01-17 17:13:04 UTC (rev 35881)
@@ -1,117 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef GUI_THEME_DATA_H
-#define GUI_THEME_DATA_H
-
-#include "gui/ThemeEngine.h"
-
-namespace GUI {
-
-struct TextDrawData {
-	const Graphics::Font *_fontPtr;
-
-	struct {
-		uint8 r, g, b;
-	} _color;
-};
-
-struct WidgetDrawData {
-	/** List of all the steps needed to draw this widget */
-	Common::List<Graphics::DrawStep> _steps;
-
-	int _textDataId;
-	Graphics::TextAlign _textAlignH;
-	GUI::ThemeEngine::TextAlignVertical _textAlignV;
-
-	/** Extra space that the widget occupies when it's drawn.
-	    E.g. when taking into account rounded corners, drop shadows, etc
-		Used when restoring the widget background */
-	uint16 _backgroundOffset;
-
-	bool _buffer;
-};
-
-class ThemeItem {
-
-public:
-	ThemeItem(ThemeEngine *engine, const Common::Rect &area) :
-		_engine(engine), _area(area) {}
-	virtual ~ThemeItem() {}
-
-	virtual void drawSelf(bool doDraw, bool doRestore) = 0;
-
-protected:
-	ThemeEngine *_engine;
-	Common::Rect _area;
-};
-
-class ThemeItemDrawData : public ThemeItem {
-public:
-	ThemeItemDrawData(ThemeEngine *engine, const WidgetDrawData *data, const Common::Rect &area, uint32 dynData) :
-		ThemeItem(engine, area), _dynamicData(dynData), _data(data) {}
-
-	void drawSelf(bool draw, bool restore);
-
-protected:
-	uint32 _dynamicData;
-	const WidgetDrawData *_data;
-};
-
-class ThemeItemTextData : public ThemeItem {
-public:
-	ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const Common::Rect &area, const Common::String &text,
-		Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
-		bool ellipsis, bool restoreBg, int deltaX) :
-		ThemeItem(engine, area), _data(data), _text(text), _alignH(alignH), _alignV(alignV),
-		_ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {}
-
-	void drawSelf(bool draw, bool restore);
-
-protected:
-	const TextDrawData *_data;
-	Common::String _text;
-	Graphics::TextAlign _alignH;
-	GUI::ThemeEngine::TextAlignVertical _alignV;
-	bool _ellipsis;
-	bool _restoreBg;
-	int _deltax;
-};
-
-class ThemeItemBitmap : public ThemeItem {
-public:
-	ThemeItemBitmap(ThemeEngine *engine, const Common::Rect &area, const Graphics::Surface *bitmap, bool alpha) :
-		ThemeItem(engine, area), _bitmap(bitmap), _alpha(alpha) {}
-
-	void drawSelf(bool draw, bool restore);
-
-protected:
-	const Graphics::Surface *_bitmap;
-	bool _alpha;
-};
-
-}
-
-#endif

Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/gui/ThemeEngine.cpp	2009-01-17 17:13:04 UTC (rev 35881)
@@ -41,7 +41,6 @@
 #include "gui/ThemeEngine.h"
 #include "gui/ThemeEval.h"
 #include "gui/ThemeParser.h"
-#include "gui/ThemeData.h"
 
 #ifdef MACOSX
 #include <CoreFoundation/CoreFoundation.h>
@@ -51,7 +50,212 @@
 
 namespace GUI {
 
+struct TextDrawData {
+	const Graphics::Font *_fontPtr;
+
+	struct {
+		uint8 r, g, b;
+	} _color;
+};
+
+struct WidgetDrawData {
+	/** List of all the steps needed to draw this widget */
+	Common::List<Graphics::DrawStep> _steps;
+
+	int _textDataId;
+	Graphics::TextAlign _textAlignH;
+	GUI::ThemeEngine::TextAlignVertical _textAlignV;
+
+	/** Extra space that the widget occupies when it's drawn.
+	    E.g. when taking into account rounded corners, drop shadows, etc
+		Used when restoring the widget background */
+	uint16 _backgroundOffset;
+
+	bool _buffer;
+};
+
+class ThemeItem {
+
+public:
+	ThemeItem(ThemeEngine *engine, const Common::Rect &area) :
+		_engine(engine), _area(area) {}
+	virtual ~ThemeItem() {}
+
+	virtual void drawSelf(bool doDraw, bool doRestore) = 0;
+
+protected:
+	ThemeEngine *_engine;
+	Common::Rect _area;
+};
+
+class ThemeItemDrawData : public ThemeItem {
+public:
+	ThemeItemDrawData(ThemeEngine *engine, const WidgetDrawData *data, const Common::Rect &area, uint32 dynData) :
+		ThemeItem(engine, area), _dynamicData(dynData), _data(data) {}
+
+	void drawSelf(bool draw, bool restore);
+
+protected:
+	uint32 _dynamicData;
+	const WidgetDrawData *_data;
+};
+
+class ThemeItemTextData : public ThemeItem {
+public:
+	ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const Common::Rect &area, const Common::String &text,
+		Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV,
+		bool ellipsis, bool restoreBg, int deltaX) :
+		ThemeItem(engine, area), _data(data), _text(text), _alignH(alignH), _alignV(alignV),
+		_ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {}
+
+	void drawSelf(bool draw, bool restore);
+
+protected:
+	const TextDrawData *_data;
+	Common::String _text;
+	Graphics::TextAlign _alignH;
+	GUI::ThemeEngine::TextAlignVertical _alignV;
+	bool _ellipsis;
+	bool _restoreBg;
+	int _deltax;
+};
+
+class ThemeItemBitmap : public ThemeItem {
+public:
+	ThemeItemBitmap(ThemeEngine *engine, const Common::Rect &area, const Graphics::Surface *bitmap, bool alpha) :
+		ThemeItem(engine, area), _bitmap(bitmap), _alpha(alpha) {}
+
+	void drawSelf(bool draw, bool restore);
+
+protected:
+	const Graphics::Surface *_bitmap;
+	bool _alpha;
+};
+
+
+
 /**********************************************************
+ *	Data definitions for theme engine elements
+ *********************************************************/
+struct DrawDataInfo {
+	DrawData id;		//!< The actual ID of the DrawData item.
+	const char *name;	//!< The name of the DrawData item as it appears in the Theme Description files
+	bool buffer;		//!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
+	DrawData parent;	//!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
+};
+
+/**
+ * Default values for each DrawData item.
+ */
+static const DrawDataInfo kDrawDataDefaults[] = {
+	{kDDMainDialogBackground,		"mainmenu_bg",		true,	kDDNone},
+	{kDDSpecialColorBackground,		"special_bg",		true,	kDDNone},
+	{kDDPlainColorBackground,		"plain_bg",			true,	kDDNone},
+	{kDDDefaultBackground,			"default_bg",		true,	kDDNone},
+	{kDDTextSelectionBackground,	"text_selection",	false,	kDDNone},
+
+	{kDDWidgetBackgroundDefault,	"widget_default",	true,	kDDNone},
+	{kDDWidgetBackgroundSmall,		"widget_small",		true,	kDDNone},
+	{kDDWidgetBackgroundEditText,	"widget_textedit",	true,	kDDNone},
+	{kDDWidgetBackgroundSlider,		"widget_slider",	true,	kDDNone},
+
+	{kDDButtonIdle,					"button_idle",		true,	kDDWidgetBackgroundSlider},
+	{kDDButtonHover,				"button_hover",	false,	kDDButtonIdle},
+	{kDDButtonDisabled,				"button_disabled",	true,	kDDNone},
+
+	{kDDSliderFull,					"slider_full",		false,	kDDNone},
+	{kDDSliderHover,				"slider_hover",		false,	kDDNone},
+	{kDDSliderDisabled,				"slider_disabled",	true,	kDDNone},
+
+	{kDDCheckboxDefault,			"checkbox_default",			true,	kDDNone},
+	{kDDCheckboxDisabled,			"checkbox_disabled",		true,	kDDNone},
+	{kDDCheckboxSelected,			"checkbox_selected",		false,	kDDCheckboxDefault},
+
+	{kDDTabActive,					"tab_active",				false,	kDDTabInactive},
+	{kDDTabInactive,				"tab_inactive",				true,	kDDNone},
+	{kDDTabBackground,				"tab_background",			true,	kDDNone},
+
+	{kDDScrollbarBase,				"scrollbar_base",			true,	kDDNone},
+
+	{kDDScrollbarButtonIdle,		"scrollbar_button_idle",	true,	kDDNone},
+	{kDDScrollbarButtonHover,		"scrollbar_button_hover",	false,	kDDScrollbarButtonIdle},
+
+	{kDDScrollbarHandleIdle,		"scrollbar_handle_idle",	false,	kDDNone},
+	{kDDScrollbarHandleHover,		"scrollbar_handle_hover",	false,	kDDScrollbarBase},
+
+	{kDDPopUpIdle,					"popup_idle",	true,	kDDNone},
+	{kDDPopUpHover,					"popup_hover",	false,	kDDPopUpIdle},
+	{kDDPopUpDisabled,				"popup_disabled",	true,	kDDNone},
+
+	{kDDCaret,						"caret",		false,	kDDNone},
+	{kDDSeparator,					"separator",	true,	kDDNone},
+};
+
+struct TextDataInfo {
+	TextData id;
+	const char *name;
+};
+
+static const TextDataInfo kTextDataDefaults[] = {
+	{kTextDataDefault,		"text_default"},
+	{kTextDataHover,		"text_hover"},
+	{kTextDataDisabled,		"text_disabled"},
+	{kTextDataInverted,		"text_inverted"},
+	{kTextDataButton,		"text_button"},
+	{kTextDataButtonHover,	"text_button_hover"},
+	{kTextDataNormalFont,	"text_normal"}
+};
+
+
+/**********************************************************
+ *	ThemeItem functions for drawing queues.
+ *********************************************************/
+void ThemeItemDrawData::drawSelf(bool draw, bool restore) {
+
+	Common::Rect extendedRect = _area;
+	extendedRect.grow(_engine->kDirtyRectangleThreshold + _data->_backgroundOffset);
+
+	if (restore)
+		_engine->restoreBackground(extendedRect);
+
+	if (draw) {
+		Common::List<Graphics::DrawStep>::const_iterator step;
+		for (step = _data->_steps.begin(); step != _data->_steps.end(); ++step)
+			_engine->renderer()->drawStep(_area, *step, _dynamicData);
+	}
+
+	_engine->addDirtyRect(extendedRect);
+}
+
+void ThemeItemTextData::drawSelf(bool draw, bool restore) {
+	if (_restoreBg || restore)
+		_engine->restoreBackground(_area);
+
+	if (draw) {
+		_engine->renderer()->setFgColor(_data->_color.r, _data->_color.g, _data->_color.b);
+		_engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis);
+	}
+
+	_engine->addDirtyRect(_area);
+}
+
+void ThemeItemBitmap::drawSelf(bool draw, bool restore) {
+	if (restore)
+		_engine->restoreBackground(_area);
+
+	if (draw) {
+		if (_alpha)
+			_engine->renderer()->blitAlphaBitmap(_bitmap, _area);
+		else
+			_engine->renderer()->blitSubSurface(_bitmap, _area);
+	}
+
+	_engine->addDirtyRect(_area);
+}
+
+
+
+/**********************************************************
  *	ThemeEngine class
  *********************************************************/
 ThemeEngine::ThemeEngine(Common::String id, GraphicsMode mode) :
@@ -1012,12 +1216,27 @@
 	return ready() ? _texts[fontStyleToData(font)]->_fontPtr->getCharWidth(c) : 0;
 }
 
-ThemeEngine::TextData ThemeEngine::getTextData(DrawData ddId) {
+TextData ThemeEngine::getTextData(DrawData ddId) const {
 	return _widgets[ddId] ? (TextData)_widgets[ddId]->_textDataId : kTextDataNone;
 }
 
 
+DrawData ThemeEngine::getDrawDataId(const Common::String &name) const {
+	for (int i = 0; i < kDrawDataMAX; ++i)
+		if (name.compareToIgnoreCase(kDrawDataDefaults[i].name) == 0)
+			return kDrawDataDefaults[i].id;
 
+	return kDDNone;
+}
+
+TextData ThemeEngine::getTextDataId(const Common::String &name) const {
+	for (int i = 0; i < kTextDataMAX; ++i)
+		if (name.compareToIgnoreCase(kTextDataDefaults[i].name) == 0)
+			return kTextDataDefaults[i].id;
+
+	return kTextDataNone;
+}
+
 /**********************************************************
  *	External data loading
  *********************************************************/

Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/gui/ThemeEngine.h	2009-01-17 17:13:04 UTC (rev 35881)
@@ -43,6 +43,7 @@
 
 struct WidgetDrawData;
 struct DrawDataInfo;
+struct TextDataInfo;
 struct TextDrawData;
 class Dialog;
 class GuiObject;
@@ -50,95 +51,74 @@
 class ThemeItem;
 class ThemeParser;
 
-class ThemeEngine {
-protected:
-	typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap;
+/**
+ *	DrawData sets enumeration.
+ *	Each DD set corresponds to the actual looks
+ *	of a widget in a given state.
+ */
+enum DrawData {
+	kDDMainDialogBackground,
+	kDDSpecialColorBackground,
+	kDDPlainColorBackground,
+	kDDDefaultBackground,
+	kDDTextSelectionBackground,
 
-	friend class GUI::Dialog;
-	friend class GUI::GuiObject;
+	kDDWidgetBackgroundDefault,
+	kDDWidgetBackgroundSmall,
+	kDDWidgetBackgroundEditText,
+	kDDWidgetBackgroundSlider,
 
-	/**
-	 *	DrawData sets enumeration.
-	 *	Each DD set corresponds to the actual looks
-	 *	of a widget in a given state.
-	*/
-	enum DrawData {
-		kDDMainDialogBackground,
-		kDDSpecialColorBackground,
-		kDDPlainColorBackground,
-		kDDDefaultBackground,
-		kDDTextSelectionBackground,
+	kDDButtonIdle,
+	kDDButtonHover,
+	kDDButtonDisabled,
 
-		kDDWidgetBackgroundDefault,
-		kDDWidgetBackgroundSmall,
-		kDDWidgetBackgroundEditText,
-		kDDWidgetBackgroundSlider,
+	kDDSliderFull,
+	kDDSliderHover,
+	kDDSliderDisabled,
 
-		kDDButtonIdle,
-		kDDButtonHover,
-		kDDButtonDisabled,
+	kDDCheckboxDefault,
+	kDDCheckboxDisabled,
+	kDDCheckboxSelected,
 
-		kDDSliderFull,
-		kDDSliderHover,
-		kDDSliderDisabled,
+	kDDTabActive,
+	kDDTabInactive,
+	kDDTabBackground,
 
-		kDDCheckboxDefault,
-		kDDCheckboxDisabled,
-		kDDCheckboxSelected,
+	kDDScrollbarBase,
+	kDDScrollbarButtonIdle,
+	kDDScrollbarButtonHover,
+	kDDScrollbarHandleIdle,
+	kDDScrollbarHandleHover,
 
-		kDDTabActive,
-		kDDTabInactive,
-		kDDTabBackground,
+	kDDPopUpIdle,
+	kDDPopUpHover,
+	kDDPopUpDisabled,
 
-		kDDScrollbarBase,
-		kDDScrollbarButtonIdle,
-		kDDScrollbarButtonHover,
-		kDDScrollbarHandleIdle,
-		kDDScrollbarHandleHover,
+	kDDCaret,
+	kDDSeparator,
+	kDrawDataMAX,
+	kDDNone = -1
+};
 
-		kDDPopUpIdle,
-		kDDPopUpHover,
-		kDDPopUpDisabled,
+enum TextData {
+	kTextDataNone = -1,
+	kTextDataDefault = 0,
+	kTextDataHover,
+	kTextDataDisabled,
+	kTextDataInverted,
+	kTextDataButton,
+	kTextDataButtonHover,
+	kTextDataNormalFont,
+	kTextDataMAX
+};
 
-		kDDCaret,
-		kDDSeparator,
-		kDrawDataMAX,
-		kDDNone = -1
-	};
+class ThemeEngine {
+protected:
+	typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap;
 
-	/**
-	 * Default values for each DrawData item.
-	 * @see kDrawDataDefaults[] for implementation.
-	 */
-	struct DrawDataInfo {
-		DrawData id;		//!< The actual ID of the DrawData item.
-		const char *name;	//!< The name of the DrawData item as it appears in the Theme Description files
-		bool buffer;		//!< Sets whether this item is buffered on the backbuffer or drawn directly to the screen.
-		DrawData parent;	//!< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover
-	};
+	friend class GUI::Dialog;
+	friend class GUI::GuiObject;
 
-	static const DrawDataInfo kDrawDataDefaults[];
-
-
-	enum TextData {
-		kTextDataNone = -1,
-		kTextDataDefault = 0,
-		kTextDataHover,
-		kTextDataDisabled,
-		kTextDataInverted,
-		kTextDataButton,
-		kTextDataButtonHover,
-		kTextDataNormalFont,
-		kTextDataMAX
-	};
-
-	struct TextDataInfo {
-		TextData id;
-		const char *name;
-	};
-
-	static const TextDataInfo kTextDataDefaults[];
-
 public:
 	//! Vertical alignment of the text.
 	enum TextAlignVertical {
@@ -354,21 +334,12 @@
 	 *	@param name The representing name, as found on Theme Description XML files.
 	 *	@see kDrawDataDefaults[]
 	 */
-	DrawData getDrawDataId(const Common::String &name) {
-		for (int i = 0; i < kDrawDataMAX; ++i)
-			if (name.compareToIgnoreCase(kDrawDataDefaults[i].name) == 0)
-				return kDrawDataDefaults[i].id;
+	DrawData getDrawDataId(const Common::String &name) const;
 
-		return kDDNone;
-	}
+	TextData getTextDataId(const Common::String &name) const;
 
-	TextData getTextDataId(const Common::String &name) {
-		for (int i = 0; i < kTextDataMAX; ++i)
-			if (name.compareToIgnoreCase(kTextDataDefaults[i].name) == 0)
-				return kTextDataDefaults[i].id;
+	TextData getTextData(DrawData ddId) const;
 
-		return kTextDataNone;
-	}
 
 	/**
 	 *	Interface for ThemeParser class: Parsed DrawSteps are added via this function.
@@ -532,8 +503,6 @@
 	 */
 	void renderDirtyScreen();
 
-	TextData getTextData(DrawData ddId);
-
 	/**
 	 *	Calculates the background threshold offset of a given DrawData item.
 	 *	After fully loading all DrawSteps of a DrawData item, this function must be

Modified: scummvm/trunk/gui/module.mk
===================================================================
--- scummvm/trunk/gui/module.mk	2009-01-17 16:57:50 UTC (rev 35880)
+++ scummvm/trunk/gui/module.mk	2009-01-17 17:13:04 UTC (rev 35881)
@@ -23,7 +23,6 @@
 	themebrowser.o \
 	ThemeEngine.o \
 	ThemeEval.o \
-	ThemeData.o \
 	ThemeLayout.o \
 	ThemeParser.o \
 	widget.o


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