diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeEval.cpp | 17 | ||||
-rw-r--r-- | gui/ThemeEval.h | 40 | ||||
-rw-r--r-- | gui/ThemeRenderer.cpp | 11 | ||||
-rw-r--r-- | gui/themes/default.inc | 23 | ||||
-rw-r--r-- | gui/themes/modern.stx | 24 |
5 files changed, 96 insertions, 19 deletions
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index 426ca4fc40..b452e1c2f5 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -29,6 +29,7 @@ #include "common/hashmap.h" #include "common/hash-str.h" #include "common/xmlparser.h" +#include "graphics/scaler.h" #include "gui/ThemeRenderer.h" #include "gui/ThemeParser.h" @@ -160,6 +161,22 @@ void ThemeLayoutHorizontal::reflowLayout() { } } +void ThemeEval::buildBuiltinVars() { + _builtin["kThumbnailWidth"] = kThumbnailWidth; + _builtin["kThumbnailHeight"] = kThumbnailHeight1; + _builtin["kThumbnailHeight2"] = kThumbnailHeight2; + + _builtin["kButtonWidth"] = GUI::kButtonWidth; + _builtin["kButtonHeight"] = GUI::kButtonHeight; + _builtin["kSliderWidth"] = GUI::kSliderWidth; + _builtin["kSliderHeight"] = GUI::kSliderHeight; + _builtin["kBigButtonWidth"] = GUI::kBigButtonWidth; + _builtin["kBigButtonHeight"] = GUI::kBigButtonHeight; + _builtin["kBigSliderWidth"] = GUI::kBigSliderWidth; + _builtin["kBigSliderWidth"] = GUI::kBigSliderWidth; + _builtin["kBigSliderHeight"] = GUI::kBigSliderHeight; +} + void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled) { int typeW = -1; diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index ba6e3381ac..7df4d60aa4 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -91,8 +91,7 @@ public: width += p->_paddingRight + p->_paddingLeft; if (p->getLayoutType() == kLayoutHorizontal) { for (uint i = 0; i < p->_children.size(); ++i) - if (p->_children[i]->getLayoutType() == kLayoutWidget) - width += p->_children[i]->getHeight() + p->_spacing; + width += p->_children[i]->getHeight() + p->_spacing; } p = p->_parent; } @@ -108,8 +107,7 @@ public: height += p->_paddingBottom + p->_paddingTop; if (p->getLayoutType() == kLayoutVertical) { for (uint i = 0; i < p->_children.size(); ++i) - if (p->_children[i]->getLayoutType() == kLayoutWidget) - height += p->_children[i]->getHeight() + p->_spacing; + height += p->_children[i]->getHeight() + p->_spacing; } p = p->_parent; } @@ -304,25 +302,37 @@ class ThemeEval { typedef Common::HashMap<Common::String, ThemeLayout*> LayoutsMap; public: - ThemeEval() {} + ThemeEval() { + buildBuiltinVars(); + } ~ThemeEval() {} + void buildBuiltinVars(); + int getVar(const Common::String &s) { - if (!_vars.contains(s)) { - error("CRITICAL: Missing variable: '%s'", s.c_str()); - return -13375; //EVAL_UNDEF_VAR - } - - return _vars[s]; + if (_vars.contains(s)) + return _vars[s]; + + if (_builtin.contains(s)) + return _builtin[s]; + + error("CRITICAL: Missing variable: '%s'", s.c_str()); + return -13375; //EVAL_UNDEF_VAR } int getVar(const Common::String &s, int def) { - return (_vars.contains(s)) ? _vars[s] : def; + if (_vars.contains(s)) + return _vars[s]; + + if (_builtin.contains(s)) + return _builtin[s]; + + return def; } void setVar(const String &name, int val) { _vars[name] = val; } - bool hasVar(const Common::String &name) { return _vars.contains(name); } + bool hasVar(const Common::String &name) { return _vars.contains(name) || _builtin.contains(name); } void addDialog(const Common::String &name, const Common::String &overlays, bool enabled = true); void addLayout(ThemeLayout::LayoutType type, int spacing, bool reverse, bool center = false); @@ -365,12 +375,14 @@ public: } void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) { - _layouts["Dialog.ScummConfig"]->debugDraw(screen, font); + _layouts["Dialog.ScummSaveLoad"]->debugDraw(screen, font); // _layouts["Dialog.GameOptions_Graphics"]->debugDraw(screen, font); } private: VariablesMap _vars; + VariablesMap _builtin; + LayoutsMap _layouts; Common::Stack<ThemeLayout*> _curLayout; Common::String _curDialog; diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 49e0d3bb35..6244895719 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -592,8 +592,9 @@ void ThemeRenderer::drawPopUpWidget(const Common::Rect &r, const Common::String void ThemeRenderer::drawSurface(const Common::Rect &r, const Graphics::Surface &surface, WidgetStateInfo state, int alpha, bool themeTrans) { if (!ready()) return; - - debugWidgetPosition("Surface", r); + + _vectorRenderer->blitSubSurface(&surface, r); + addDirtyRect(r); } void ThemeRenderer::drawWidgetBackground(const Common::Rect &r, uint16 hints, WidgetBackground background, WidgetStateInfo state) { @@ -718,9 +719,9 @@ void ThemeRenderer::updateScreen() { renderDirtyScreen(); -// _vectorRenderer->fillSurface(); -// themeEval()->debugDraw(_screen, _font); -// _vectorRenderer->copyWholeFrame(_system); + // _vectorRenderer->fillSurface(); + // themeEval()->debugDraw(_screen, _font); + // _vectorRenderer->copyWholeFrame(_system); } void ThemeRenderer::renderDirtyScreen() { diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 1206ffc914..4c1e57a52c 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -858,4 +858,27 @@ "</layout> " "</layout> " "</dialog> " +"<dialog name = 'ScummSaveLoad' overlays = 'screen'> " +"<layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true' direction = 'bottom2top'> " +"<layout type = 'horizontal' padding = '0, 0, 16, 0' direction = 'right2left'> " +"<widget name = 'Choose' " +"type = 'Button' " +"/> " +"<widget name = 'Cancel' " +"type = 'Button' " +"/> " +"<space/> " +"</layout> " +"<layout type = 'horizontal' padding = '0, 0, 0, 0' direction = 'right2left' spacing = '16'> " +"<layout type = 'vertical' padding = '0, 0, 0, 0'> " +"<widget name = 'Thumbnail' " +"width = '180' " +"height = '200' " +"/> " +"<space/> " +"</layout> " +"<widget name = 'List' /> " +"</layout> " +"</layout> " +"</dialog> " "</layout_info> " diff --git a/gui/themes/modern.stx b/gui/themes/modern.stx index 26c0fcdfff..a0a4bfad0a 100644 --- a/gui/themes/modern.stx +++ b/gui/themes/modern.stx @@ -938,4 +938,28 @@ </layout> </layout> </dialog> + + <dialog name = 'ScummSaveLoad' overlays = 'screen'> + <layout type = 'vertical' padding = '8, 8, 8, 8' center = 'true' direction = 'bottom2top'> + <layout type = 'horizontal' padding = '0, 0, 16, 0' direction = 'right2left'> + <widget name = 'Choose' + type = 'Button' + /> + <widget name = 'Cancel' + type = 'Button' + /> + <space/> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' direction = 'right2left' spacing = '16'> + <layout type = 'vertical' padding = '0, 0, 0, 0'> + <widget name = 'Thumbnail' + width = '180' + height = '200' + /> + <space/> + </layout> + <widget name = 'List' /> + </layout> + </layout> + </dialog> </layout_info>
\ No newline at end of file |