diff options
author | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-10-31 11:08:43 +0000 |
commit | 94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1 (patch) | |
tree | 3df2a4ae7967c56d464729669fc06ce4e93dff36 /gui/ThemeEngine.cpp | |
parent | 8df4278ba8cfbf71228e1927f9db635a9a30a57f (diff) | |
parent | dca3c8d8bfc6c4db38cf8e8291818dd472041d4e (diff) | |
download | scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.gz scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.tar.bz2 scummvm-rg350-94c8d0a14df429a1b25bd9f5c5d75497fd0ddbd1.zip |
Updated with latest from trunk
svn-id: r53976
Diffstat (limited to 'gui/ThemeEngine.cpp')
-rw-r--r-- | gui/ThemeEngine.cpp | 90 |
1 files changed, 11 insertions, 79 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 9cc98d83ce..d9a1e05855 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -44,8 +44,6 @@ #include "gui/ThemeEval.h" #include "gui/ThemeParser.h" -#define GUI_ENABLE_BUILTIN_THEME - namespace GUI { const char * const ThemeEngine::kImageLogo = "logo.bmp"; @@ -331,15 +329,12 @@ ThemeEngine::~ThemeEngine() { * Rendering mode management *********************************************************/ const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = { - { _s("Disabled GFX"), "none", kGfxDisabled }, - { _s("Standard Renderer (16bpp)"), "normal_16bpp", kGfxStandard16bit }, + { _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled }, + { _s("Standard Renderer (16bpp)"), _s("Standard (16bpp)"), "normal_16bpp", kGfxStandard16bit }, #ifndef DISABLE_FANCY_THEMES - { _s("Antialiased Renderer (16bpp)"), "aa_16bpp", kGfxAntialias16bit } + { _s("Antialiased Renderer (16bpp)"), _s("Antialiased (16bpp)"), "aa_16bpp", kGfxAntialias16bit } #endif }; - -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Standard Renderer (16bpp)", "lowres") -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Antialiased Renderer (16bpp)", "lowres") const uint ThemeEngine::_rendererModesSize = ARRAYSIZE(ThemeEngine::_rendererModes); @@ -578,25 +573,26 @@ bool ThemeEngine::addFont(TextData textId, const Common::String &file) { if (!_texts[textId]->_fontPtr) { // First try to load localized font _texts[textId]->_fontPtr = loadFont(localized); - + if (_texts[textId]->_fontPtr) FontMan.assignFontToName(file, _texts[textId]->_fontPtr); - // Fallback to non-localized font + // Fallback to non-localized font and default translation else { // Try built-in fonts _texts[textId]->_fontPtr = FontMan.getFontByName(file); - + // Try to load it if (!_texts[textId]->_fontPtr) { _texts[textId]->_fontPtr = loadFont(file); if (!_texts[textId]->_fontPtr) error("Couldn't load font '%s'", file.c_str()); - + FontMan.assignFontToName(file, _texts[textId]->_fontPtr); } - warning("Failed to load localized font '%s'. Using non-localized font instead", file.c_str()); + TransMan.setLanguage("C"); + warning("Failed to load localized font '%s'. Using non-localized font and default GUI language instead", file.c_str()); } } } @@ -716,7 +712,7 @@ bool ThemeEngine::loadDefaultXML() { // file inside the themes directory. // Use the Python script "makedeftheme.py" to convert a normal XML theme // into the "default.inc" file, which is ready to be included in the code. -#ifdef GUI_ENABLE_BUILTIN_THEME +#ifndef DISABLE_GUI_BUILTIN_THEME const char *defaultXML = #include "themes/default.inc" ; @@ -1192,70 +1188,6 @@ void ThemeEngine::debugWidgetPosition(const char *name, const Common::Rect &r) { _screen.vLine(r.right, r.top, r.bottom, 0xFFFF); } -ThemeEngine::StoredState *ThemeEngine::storeState(const Common::Rect &r) { - StoredState *state = new StoredState; - byte *dst; - byte *src; - - state->r.top = r.top; - state->r.bottom = r.bottom; - state->r.left = r.left; - state->r.right = r.right; - - state->r.clip(_screen.w, _screen.h); - - state->screen.create(state->r.width(), state->r.height(), _screen.bytesPerPixel); - state->backBuffer.create(state->r.width(), state->r.height(), _backBuffer.bytesPerPixel); - - src = (byte *)_screen.getBasePtr(state->r.left, state->r.top); - dst = (byte *)state->screen.getBasePtr(0, 0); - - for (int i = state->r.height(); i > 0; i--) { - memcpy(dst, src, state->r.width() * _screen.bytesPerPixel); - src += _screen.pitch; - dst += state->screen.pitch; - } - - src = (byte *)_backBuffer.getBasePtr(state->r.left, state->r.top); - dst = (byte *)state->backBuffer.getBasePtr(0, 0); - - for (int i = state->r.height(); i > 0; i--) { - memcpy(dst, src, state->r.width() * _backBuffer.bytesPerPixel); - src += _backBuffer.pitch; - dst += state->backBuffer.pitch; - } - - return state; -} - -void ThemeEngine::restoreState(StoredState *state) { - byte *dst; - byte *src; - - if (!state) - return; - - src = (byte *)state->screen.getBasePtr(0, 0); - dst = (byte *)_screen.getBasePtr(state->r.left, state->r.top); - - for (int i = state->r.height(); i > 0; i--) { - memcpy(dst, src, state->r.width() * _screen.bytesPerPixel); - src += state->screen.pitch; - dst += _screen.pitch; - } - - src = (byte *)state->backBuffer.getBasePtr(0, 0); - dst = (byte *)_backBuffer.getBasePtr(state->r.left, state->r.top); - - for (int i = state->r.height(); i > 0; i--) { - memcpy(dst, src, state->r.width() * _backBuffer.bytesPerPixel); - src += state->backBuffer.pitch; - dst += _backBuffer.pitch; - } - - addDirtyRect(state->r); -} - /********************************************************** * Screen/overlay management *********************************************************/ @@ -1661,7 +1593,7 @@ struct TDComparator { } // end of anonymous namespace void ThemeEngine::listUsableThemes(Common::List<ThemeDescriptor> &list) { -#ifdef GUI_ENABLE_BUILTIN_THEME +#ifndef DISABLE_GUI_BUILTIN_THEME ThemeDescriptor th; th.name = "ScummVM Classic Theme (Builtin Version)"; th.id = "builtin"; |