aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/main.cpp1
-rw-r--r--engines/dialogs.cpp1
-rw-r--r--gui/ThemeEngine.cpp24
-rw-r--r--gui/ThemeEngine.h64
-rw-r--r--gui/ThemeEval.cpp2
-rw-r--r--gui/ThemeParser.cpp1
-rw-r--r--gui/dialog.h4
-rw-r--r--gui/newgui.cpp1
-rw-r--r--gui/object.cpp1
-rw-r--r--gui/themebrowser.cpp3
-rw-r--r--gui/widget.h2
11 files changed, 64 insertions, 40 deletions
diff --git a/base/main.cpp b/base/main.cpp
index b4a344aa9e..9169f9883b 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -37,6 +37,7 @@
#include "base/plugins.h"
#include "base/version.h"
+#include "common/archive.h"
#include "common/config-manager.h"
#include "common/events.h"
#include "common/file.h"
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index c1d9499583..a4997b8958 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -36,6 +36,7 @@
#include "gui/launcher.h"
#include "gui/ListWidget.h"
#include "gui/theme.h"
+#include "gui/ThemeEval.h"
#include "engines/dialogs.h"
#include "engines/engine.h"
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 64e2fc373e..bb46d35140 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -361,6 +361,28 @@ void ThemeEngine::deinit() {
}
}
+void ThemeEngine::freeRenderer() {
+ delete _vectorRenderer;
+ _vectorRenderer = 0;
+}
+
+void ThemeEngine::freeBackbuffer() {
+ if (_backBuffer != 0) {
+ _backBuffer->free();
+ delete _backBuffer;
+ _backBuffer = 0;
+ }
+}
+
+void ThemeEngine::freeScreen() {
+ if (_screen != 0) {
+ _screen->free();
+ delete _screen;
+ _screen = 0;
+ }
+}
+
+
void ThemeEngine::unloadTheme() {
if (!_themeOk)
return;
@@ -499,7 +521,7 @@ void ThemeEngine::restoreBackground(Common::Rect r, bool special) {
/**********************************************************
* Theme elements management
*********************************************************/
-void ThemeEngine::addDrawStep(const Common::String &drawDataId, Graphics::DrawStep step) {
+void ThemeEngine::addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step) {
DrawData id = getDrawDataId(drawDataId);
assert(_widgets[id] != 0);
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index d0205b8c0a..19b6f42ae8 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef THEME_ENGINE_H
-#define THEME_ENGINE_H
+#ifndef GUI_THEME_ENGINE_H
+#define GUI_THEME_ENGINE_H
#include "common/scummsys.h"
#include "graphics/surface.h"
@@ -33,19 +33,27 @@
#include "graphics/surface.h"
#include "graphics/fontman.h"
-#include "gui/dialog.h"
-#include "gui/ThemeParser.h"
-#include "graphics/VectorRenderer.h"
-#include "gui/ThemeEval.h"
+//#include "gui/dialog.h"
+//#include "gui/ThemeParser.h"
+//#include "graphics/VectorRenderer.h"
+//#include "gui/ThemeEval.h"
+#include "gui/theme.h"
+namespace Graphics {
+struct DrawStep;
+class VectorRenderer;
+}
namespace GUI {
struct WidgetDrawData;
struct DrawDataInfo;
struct TextDrawData;
+class Dialog;
+class GuiObject;
class ThemeEval;
class ThemeItem;
+class ThemeParser;
class ThemeEngine : public Theme {
protected:
@@ -226,13 +234,13 @@ public:
}
}
- const Graphics::Font *getFont(FontStyle font) const;
+ const Graphics::Font *getFont(FontStyle font = kFontStyleBold) const;
int getFontHeight(FontStyle font = kFontStyleBold) const;
- int getStringWidth(const Common::String &str, FontStyle font) const;
+ int getStringWidth(const Common::String &str, FontStyle font = kFontStyleBold) const;
- int getCharWidth(byte c, FontStyle font) const;
+ int getCharWidth(byte c, FontStyle font = kFontStyleBold) const;
/**
@@ -268,13 +276,11 @@ public:
void drawLineSeparator(const Common::Rect &r, WidgetStateInfo state = kStateEnabled);
- void drawDialogBackground(const Common::Rect &r, DialogBackground type, WidgetStateInfo state);
+ void drawDialogBackground(const Common::Rect &r, DialogBackground type, WidgetStateInfo state = kStateEnabled);
- void drawText(const Common::Rect &r, const Common::String &str,
- WidgetStateInfo state, TextAlign align, bool inverted, int deltax, bool useEllipsis, FontStyle font);
+ void drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, TextAlign align = kTextAlignCenter, bool inverted = false, int deltax = 0, bool useEllipsis = true, FontStyle font = kFontStyleBold);
- void drawChar(const Common::Rect &r, byte ch,
- const Graphics::Font *font, WidgetStateInfo state);
+ void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state = kStateEnabled);
/**
* Actual implementation of a Dirty Rect drawing routine.
@@ -326,7 +332,7 @@ public:
* @param drawDataId The representing DrawData name, as found on Theme Description XML files.
* @param step The actual DrawStep struct to be added.
*/
- void addDrawStep(const Common::String &drawDataId, Graphics::DrawStep step);
+ void addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step);
/**
* Interfacefor the ThemeParser class: Parsed DrawData sets are added via this function.
@@ -393,7 +399,7 @@ public:
void startBuffering() { _buffering = true; }
ThemeEval *getEvaluator() { return _themeEval; }
- VectorRenderer *renderer() { return _vectorRenderer; }
+ Graphics::VectorRenderer *renderer() { return _vectorRenderer; }
bool supportsImages() const { return true; }
bool ownCursor() const { return _useCursor; }
@@ -440,12 +446,13 @@ public:
*/
bool isWidgetCached(DrawData type, const Common::Rect &r);
-protected:
+public:
const Common::String &getThemeName() const { return _themeName; }
const Common::String &getThemeFileName() const { return _themeFileName; }
int getGraphicsMode() const { return _graphicsMode; }
+protected:
/**
* Initializes the drawing screen surfaces, _screen and _backBuffer.
* If the surfaces already exist, they are cleared and re-initialized.
@@ -497,32 +504,17 @@ protected:
/**
* Frees the vector renderer.
*/
- void freeRenderer() {
- delete _vectorRenderer;
- _vectorRenderer = 0;
- }
+ void freeRenderer();
/**
* Frees the Back buffer surface, only if it's available.
*/
- void freeBackbuffer() {
- if (_backBuffer != 0) {
- _backBuffer->free();
- delete _backBuffer;
- _backBuffer = 0;
- }
- }
+ void freeBackbuffer();
/**
* Frees the main screen drawing surface, only if it's available.
*/
- void freeScreen() {
- if (_screen != 0) {
- _screen->free();
- delete _screen;
- _screen = 0;
- }
- }
+ void freeScreen();
TextData getTextData(DrawData ddId);
@@ -567,12 +559,14 @@ protected:
void debugWidgetPosition(const char *name, const Common::Rect &r);
+public:
/**
* Default values from GUI::Theme
*/
int getTabSpacing() const { return 0; }
int getTabPadding() const { return 3; }
+protected:
OSystem *_system; /** Global system object. */
/** Vector Renderer object, does the actual drawing on screen */
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index 4437809599..abf58534bd 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -35,6 +35,8 @@
#include "gui/ThemeParser.h"
#include "gui/ThemeEval.h"
+#include "gui/widget.h"
+
namespace GUI {
ThemeEval::~ThemeEval() {
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 627e7dc210..ced47a1ef1 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -31,6 +31,7 @@
#include "common/xmlparser.h"
#include "gui/ThemeEngine.h"
+#include "gui/ThemeEval.h"
#include "gui/ThemeParser.h"
#include "gui/newgui.h"
#include "graphics/VectorRenderer.h"
diff --git a/gui/dialog.h b/gui/dialog.h
index 71edb63ee3..281bcd7258 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -22,8 +22,8 @@
* $Id$
*/
-#ifndef DIALOG_H
-#define DIALOG_H
+#ifndef GUI_DIALOG_H
+#define GUI_DIALOG_H
#include "common/scummsys.h"
#include "common/str.h"
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 3fe0ffacb0..eca71c2d7a 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -30,6 +30,7 @@
#include "gui/newgui.h"
#include "gui/dialog.h"
#include "gui/ThemeEngine.h"
+#include "gui/ThemeEval.h"
#include "common/config-manager.h"
diff --git a/gui/object.cpp b/gui/object.cpp
index f3022ad61a..c6f554ab83 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -26,6 +26,7 @@
#include "gui/object.h"
#include "gui/widget.h"
#include "gui/newgui.h"
+#include "gui/ThemeEval.h"
namespace GUI {
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index 7d3933cfbe..19ac97ada3 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -26,6 +26,7 @@
#include "gui/ListWidget.h"
#include "gui/widget.h"
#include "gui/theme.h"
+#include "common/fs.h"
#ifdef MACOSX
#include "CoreFoundation/CoreFoundation.h"
@@ -164,7 +165,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) {
}
if (node.lookupFile(fslist, "THEMERC", false, true, 1)) {
- for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
+ for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) {
Entry th;
if (isTheme(i->getParent(), th)) {
diff --git a/gui/widget.h b/gui/widget.h
index 3e111f28d4..705c232da9 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -30,7 +30,7 @@
#include "common/keyboard.h"
#include "graphics/surface.h"
#include "gui/object.h"
-#include "gui/theme.h"
+#include "gui/ThemeEngine.h"
namespace GUI {