From cb581c61b26269296e3e9f4837ae793e562a84db Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 9 Nov 2008 12:38:30 +0000 Subject: Partially merge classes Theme and ThemeEngine (saves another couple KB), somebody (Tanoku?) should do a proper merge svn-id: r34951 --- gui/ThemeEngine.h | 4 ++++ gui/newgui.h | 4 ++-- gui/theme.cpp | 8 +++++--- gui/theme.h | 40 ++++++++++++++++++---------------------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 19b6f42ae8..a9e687d4c1 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -559,6 +559,10 @@ protected: void debugWidgetPosition(const char *name, const Common::Rect &r); + const Graphics::Font *loadFont(const Common::String &filename); + const Graphics::Font *loadFontFromArchive(const Common::String &filename); + Common::String genCacheFilename(const char *filename); + public: /** * Default values from GUI::Theme diff --git a/gui/newgui.h b/gui/newgui.h index 90d3723d54..d4143db178 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -79,7 +79,7 @@ public: bool isActive() const { return ! _dialogStack.empty(); } bool loadNewTheme(Common::String file, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled); - Theme *theme() { return _theme; } + ThemeEngine *theme() { return _theme; } ThemeEval *xmlEval() { return _theme->getEvaluator(); } @@ -105,7 +105,7 @@ public: protected: OSystem *_system; - Theme *_theme; + ThemeEngine *_theme; // bool _needRedraw; RedrawStatus _redrawStatus; diff --git a/gui/theme.cpp b/gui/theme.cpp index 6e05ab9701..36bf9c5191 100644 --- a/gui/theme.cpp +++ b/gui/theme.cpp @@ -27,13 +27,15 @@ #include "common/archive.h" #include "common/unzip.h" +#include "gui/ThemeEngine.h" + namespace GUI { Theme::Theme() : _loadedThemeX(0), _loadedThemeY(0) {} Theme::~Theme() {} -const Graphics::Font *Theme::loadFontFromArchive(const Common::String &filename) { +const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &filename) { Common::Archive *arch = 0; const Graphics::NewFont *font = 0; @@ -65,7 +67,7 @@ const Graphics::Font *Theme::loadFontFromArchive(const Common::String &filename) return font; } -const Graphics::Font *Theme::loadFont(const Common::String &filename) { +const Graphics::Font *ThemeEngine::loadFont(const Common::String &filename) { const Graphics::Font *font = 0; Common::String cacheFilename = genCacheFilename(filename.c_str()); Common::File fontFile; @@ -101,7 +103,7 @@ const Graphics::Font *Theme::loadFont(const Common::String &filename) { return font; } -Common::String Theme::genCacheFilename(const char *filename) { +Common::String ThemeEngine::genCacheFilename(const char *filename) { Common::String cacheName(filename); for (int i = cacheName.size() - 1; i >= 0; --i) { if (cacheName[i] == '.') { diff --git a/gui/theme.h b/gui/theme.h index 0b20613fe4..14eaebd769 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -133,25 +133,25 @@ public: * * @see deinit */ - virtual bool init() = 0; +// virtual bool init() = 0; /** * Unloads all data used by the theme renderer. */ - virtual void deinit() = 0; +// virtual void deinit() = 0; /** * Updates the renderer to changes to resolution, * bit depth and other video related configuration. */ - virtual void refresh() = 0; +// virtual void refresh() = 0; /** * Checks if the theme supplies its own cursor. * * @return true if using an own cursor */ - virtual bool ownCursor() const { return false; } +// virtual bool ownCursor() const { return false; } /** * Enables the theme renderer for use. @@ -171,7 +171,7 @@ public: * @see disable * @see init */ - virtual void enable() = 0; +// virtual void enable() = 0; /** * Disables the theme renderer. @@ -186,7 +186,7 @@ public: * @see enable * @see uninit */ - virtual void disable() = 0; +// virtual void disable() = 0; /** * Tells the theme renderer that a new dialog is opened. @@ -205,14 +205,14 @@ public: * * @see closeAllDialogs */ - virtual void openDialog(bool topDialog, ShadingStyle shading = kShadingNone) = 0; +// virtual void openDialog(bool topDialog, ShadingStyle shading = kShadingNone) = 0; /** * This indicates that all dialogs have been closed. * * @see openDialog */ - virtual void closeAllDialogs() = 0; +// virtual void closeAllDialogs() = 0; /** * Closes the topmost dialog, and redraws the screen @@ -226,13 +226,13 @@ public: * the dialog, we return false, which means we need to redraw * the dialog stack from scratch. */ - virtual void startBuffering() = 0; - virtual void finishBuffering() = 0; +// virtual void startBuffering() = 0; +// virtual void finishBuffering() = 0; /** * Clear the complete GUI screen. */ - virtual void clearAll() = 0; +// virtual void clearAll() = 0; /** * Update the GUI screen aka overlay. @@ -240,8 +240,9 @@ public: * This does NOT call OSystem::updateScreen, * it just copies all (changed) data to the overlay. */ - virtual void updateScreen() = 0; +// virtual void updateScreen() = 0; +/* virtual const Graphics::Font *getFont(FontStyle font = kFontStyleBold) const = 0; virtual int getFontHeight(FontStyle font = kFontStyleBold) const = 0; virtual int getStringWidth(const Common::String &str, FontStyle font = kFontStyleBold) const = 0; @@ -268,7 +269,7 @@ public: virtual int getTabSpacing() const = 0; virtual int getTabPadding() const = 0; - +*/ Graphics::TextAlignment convertAligment(TextAlign align) const { switch (align) { case kTextAlignLeft: @@ -303,14 +304,14 @@ public: bool isThemeLoadingRequired(); - virtual ThemeEval *getEvaluator() = 0; +// virtual ThemeEval *getEvaluator() = 0; static bool themeConfigUseable(const Common::FSNode &node, Common::String &themeName); static bool themeConfigParseHeader(Common::String header, Common::String &themeName); - virtual const Common::String &getThemeFileName() const = 0; - virtual const Common::String &getThemeName() const = 0; - virtual int getGraphicsMode() const = 0; +// virtual const Common::String &getThemeFileName() const = 0; +// virtual const Common::String &getThemeName() const = 0; +// virtual int getGraphicsMode() const = 0; /** * Checks if the theme renderer supports drawing of images. @@ -335,11 +336,6 @@ public: */ virtual const Graphics::Surface *getImageSurface(const kThemeImages n) const { return 0; } -protected: - const Graphics::Font *loadFont(const Common::String &filename); - const Graphics::Font *loadFontFromArchive(const Common::String &filename); - Common::String genCacheFilename(const char *filename); - public: bool needThemeReload() { return ((_loadedThemeX != g_system->getOverlayWidth()) || (_loadedThemeY != g_system->getOverlayHeight())); } -- cgit v1.2.3