diff options
author | Jordi Vilalta Prat | 2008-12-22 11:22:15 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2008-12-22 11:22:15 +0000 |
commit | b1999a2a16b83aa031df2ce1cb266b7fea8847da (patch) | |
tree | a042bbc975ead7e8b38243d0d25822d70e72fe69 /gui | |
parent | 2ec51ef3585d9450ddf21cff9212c0bc7f0b6a3f (diff) | |
download | scummvm-rg350-b1999a2a16b83aa031df2ce1cb266b7fea8847da.tar.gz scummvm-rg350-b1999a2a16b83aa031df2ce1cb266b7fea8847da.tar.bz2 scummvm-rg350-b1999a2a16b83aa031df2ce1cb266b7fea8847da.zip |
Fixed indentation and removed whitespaces at the end of line
svn-id: r35481
Diffstat (limited to 'gui')
-rw-r--r-- | gui/Actions.h | 2 | ||||
-rw-r--r-- | gui/ListWidget.cpp | 12 | ||||
-rw-r--r-- | gui/TabWidget.h | 2 | ||||
-rw-r--r-- | gui/ThemeData.cpp | 76 | ||||
-rw-r--r-- | gui/ThemeEngine.cpp | 10 | ||||
-rw-r--r-- | gui/ThemeEngine.h | 38 | ||||
-rw-r--r-- | gui/ThemeEval.cpp | 46 | ||||
-rw-r--r-- | gui/ThemeEval.h | 36 | ||||
-rw-r--r-- | gui/ThemeLayout.cpp | 70 | ||||
-rw-r--r-- | gui/ThemeLayout.h | 2 | ||||
-rw-r--r-- | gui/ThemeParser.cpp | 214 | ||||
-rw-r--r-- | gui/ThemeParser.h | 44 | ||||
-rw-r--r-- | gui/console.cpp | 6 | ||||
-rw-r--r-- | gui/dialog.cpp | 4 | ||||
-rw-r--r-- | gui/dialog.h | 2 | ||||
-rw-r--r-- | gui/launcher.cpp | 4 | ||||
-rw-r--r-- | gui/launcher.h | 2 | ||||
-rw-r--r-- | gui/massadd.cpp | 4 | ||||
-rw-r--r-- | gui/newgui.cpp | 20 | ||||
-rw-r--r-- | gui/newgui.h | 2 | ||||
-rw-r--r-- | gui/options.cpp | 14 | ||||
-rw-r--r-- | gui/options.h | 2 | ||||
-rw-r--r-- | gui/saveload.cpp | 12 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 12 |
24 files changed, 318 insertions, 318 deletions
diff --git a/gui/Actions.h b/gui/Actions.h index b68a391dd2..67faa03cba 100644 --- a/gui/Actions.h +++ b/gui/Actions.h @@ -58,7 +58,7 @@ public: bool saveMapping(); unsigned int getMapping(ActionType action); void setMapping(ActionType action, unsigned int keyCode); - Key& getKeyAction(ActionType action); + Key& getKeyAction(ActionType action); // Action domain virtual Common::String domain() = 0; diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 37cbd668ce..cb0ef54888 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -374,7 +374,7 @@ void ListWidget::drawWidget() { if (_hasFocus) inverted = true; else - g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), + g_gui.theme()->drawWidgetBackground(Common::Rect(_x, y - 1, _x + _w - 1, y + fontHeight - 1), 0, ThemeEngine::kWidgetBackgroundBorderSmall); } @@ -386,7 +386,7 @@ void ListWidget::drawWidget() { char temp[10]; sprintf(temp, "%2d. ", (pos + _numberingMode)); buffer = temp; - g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), + g_gui.theme()->drawText(Common::Rect(_x, y, _x + r.left + _leftPadding, y + fontHeight - 2), buffer, _state, Graphics::kTextAlignLeft, inverted, _leftPadding); pad = 0; } @@ -397,7 +397,7 @@ void ListWidget::drawWidget() { buffer = _editString; adjustOffset(); width = _w - r.left - _hlRightPadding - _leftPadding - scrollbarW; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + width, y + fontHeight-2), buffer, _state, Graphics::kTextAlignLeft, inverted, pad); } else { int maxWidth = _textWidth[i]; @@ -410,7 +410,7 @@ void ListWidget::drawWidget() { width = _w - r.left - _hlRightPadding - scrollbarW; if (width > maxWidth) maxWidth = width; - g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), + g_gui.theme()->drawText(Common::Rect(_x + r.left, y, _x + r.left + maxWidth, y + fontHeight-2), buffer, _state, Graphics::kTextAlignLeft, inverted, pad); } @@ -499,12 +499,12 @@ void ListWidget::reflowLayout() { // We do a rough rounding on the decimal places of Entries Per Page, // to add another entry even if it goes a tad over the padding. _entriesPerPage = ((_h - _topPadding - _bottomPadding) << 16) / kLineHeight; - + if ((uint)(_entriesPerPage & 0xFFFF) >= 0xF000) _entriesPerPage += (1 << 16); _entriesPerPage >>= 16; - + assert(_entriesPerPage > 0); delete[] _textWidth; diff --git a/gui/TabWidget.h b/gui/TabWidget.h index 3dffcd2afe..973d65dddb 100644 --- a/gui/TabWidget.h +++ b/gui/TabWidget.h @@ -85,7 +85,7 @@ public: * Widgets are always added to the active tab. */ void setActiveTab(int tabID); - + void setTabTitle(int tabID, const String &title) { assert(0 <= tabID && tabID < (int)_tabs.size()); _tabs[tabID].title = title; diff --git a/gui/ThemeData.cpp b/gui/ThemeData.cpp index d1593a0642..e05ca7f988 100644 --- a/gui/ThemeData.cpp +++ b/gui/ThemeData.cpp @@ -41,57 +41,57 @@ 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}, + {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}, + {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}, + {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}, + {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}, + {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}, + {kDDTabActive, "tab_active", false, kDDTabInactive}, + {kDDTabInactive, "tab_inactive", true, kDDNone}, + {kDDTabBackground, "tab_background", true, kDDNone}, - {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, + {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, - {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, - {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, + {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, + {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, - {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone}, - {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase}, + {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}, + {kDDPopUpIdle, "popup_idle", true, kDDNone}, + {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle}, + {kDDPopUpDisabled, "popup_disabled", true, kDDNone}, - {kDDCaret, "caret", false, kDDNone}, - {kDDSeparator, "separator", 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"} + {kTextDataDefault, "text_default"}, + {kTextDataHover, "text_hover"}, + {kTextDataDisabled, "text_disabled"}, + {kTextDataInverted, "text_inverted"}, + {kTextDataButton, "text_button"}, + {kTextDataButtonHover, "text_button_hover"}, + {kTextDataNormalFont, "text_normal"} }; diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 839f351aa7..06f36a50d2 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -55,7 +55,7 @@ ThemeEngine::ThemeEngine(Common::String fileName, GraphicsMode mode) : _buffering(false), _bytesPerPixel(0), _graphicsMode(kGfxDisabled), _font(0), _initOk(false), _themeOk(false), _enabled(false), _cursor(0), _loadedThemeX(0), _loadedThemeY(0) { - + _system = g_system; _parser = new ThemeParser(this); _themeEval = new GUI::ThemeEval(); @@ -514,7 +514,7 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeName) { #endif } else if (node.isDirectory()) { -// FIXME: This warning makes no sense whatsoever. Who added this? +// FIXME: This warning makes no sense whatsoever. Who added this? // warning("Don't know how to open theme '%s'", themeName.c_str()); archive = new Common::FSDirectory(node); } @@ -1090,7 +1090,7 @@ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &fil #endif } else { Common::FSDirectory *dir = new Common::FSDirectory(node); - if (!dir || !dir->getFSNode().isDirectory()) + if (!dir || !dir->getFSNode().isDirectory()) return 0; arch = dir; @@ -1163,7 +1163,7 @@ Common::String ThemeEngine::genCacheFilename(const char *filename) { * Static Theme XML functions *********************************************************/ -bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) { +bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) { header.trim(); if (header.empty()) @@ -1197,7 +1197,7 @@ bool ThemeEngine::themeConfigUseable(const Common::FSNode &node, Common::String stream.open("THEMERC", zipArchive); } #endif - } else if (node.isDirectory()) { + } else if (node.isDirectory()) { Common::FSNode headerfile = node.getChild("THEMERC"); if (!headerfile.exists() || !headerfile.isReadable() || headerfile.isDirectory()) return false; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 43f2a8c8eb..8eac37e251 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -114,10 +114,10 @@ protected: * @see kDrawDataDefaults[] for implementation. */ static const 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 */ + 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 */ } kDrawDataDefaults[]; @@ -155,7 +155,7 @@ public: kWidgetBackgroundEditText, //!< Background used for edit text fields kWidgetBackgroundSlider //!< Background used for sliders }; - + //! Dialog background type enum DialogBackground { kDialogBackgroundMain, @@ -198,13 +198,13 @@ public: kShadingDim, //!< Dimming unused areas kShadingLuminance //!< Converting colors to luminance for unused areas }; - + //! Special image ids for images used in the GUI enum kThemeImages { kImageLogo = 0, //!< ScummVM Logo used in the launcher kImageLogoSmall //!< ScummVM logo used in the GMM }; - + /** Graphics mode enumeration. * Each item represents a set of BPP and Renderer modes for a given * surface. @@ -214,7 +214,7 @@ public: kGfxStandard16bit, /** 2BPP with the standard (aliased) renderer. */ kGfxAntialias16bit /** 2BPP with the optimized AA renderer. */ }; - + /** Constant value to expand dirty rectangles, to make sure they are fully copied */ static const int kDirtyRectangleThreshold = 1; @@ -276,7 +276,7 @@ public: void closeAllDialogs() {} /** Drawing area has been removed: it was too hackish. A workaround is on the works. - TODO: finish the workaround for the credits dialog + TODO: finish the workaround for the credits dialog TODO: remove this from the original GUI::Theme API */ void resetDrawArea() {} @@ -345,7 +345,7 @@ public: /** * Actual implementation of a Dirty Rect drawing routine. - * Dirty rectangles are queued on a list and are later merged/calculated + * Dirty rectangles are queued on a list and are later merged/calculated * before the actual drawing. * * @param r Area of the dirty rect. @@ -412,7 +412,7 @@ public: * filename. * * @param fontName Identifier name for the font. - * @param file Name of the font file. + * @param file Name of the font file. * @param r, g, b Color of the font. */ bool addFont(const Common::String &fontName, const Common::String &file, int r, int g, int b); @@ -420,7 +420,7 @@ public: /** * Interface for the ThemeParser class: Loads a bitmap file to use on the GUI. - * The filename is also used as its identifier. + * The filename is also used as its identifier. * * @param filename Name of the bitmap file. */ @@ -483,7 +483,7 @@ public: * bitmap and sets it as the active cursor. * * @param filename File name of the bitmap to load. - * @param hotspotX X Coordinate of the bitmap which does the cursor click. + * @param hotspotX X Coordinate of the bitmap which does the cursor click. * @param hotspotY Y Coordinate of the bitmap which does the cursor click. * @param scale Scale at which the bitmap is supposed to be used. */ @@ -617,22 +617,22 @@ protected: void debugWidgetPosition(const char *name, const Common::Rect &r); public: - + /** * LEGACY: Old GUI::Theme API */ - - bool needThemeReload() { + + bool needThemeReload() { return ((_loadedThemeX != g_system->getOverlayWidth()) || - (_loadedThemeY != g_system->getOverlayHeight())); + (_loadedThemeY != g_system->getOverlayHeight())); } const Graphics::Font *loadFont(const Common::String &filename); const Graphics::Font *loadFontFromArchive(const Common::String &filename); Common::String genCacheFilename(const char *filename); - + bool isThemeLoadingRequired(); - + static bool themeConfigUseable(const Common::FSNode &node, Common::String &themeName); static bool themeConfigParseHeader(Common::String header, Common::String &themeName); diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index 753455e799..5d841c6ad7 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -44,45 +44,45 @@ void ThemeEval::reset() { _vars.clear(); _curDialog.clear(); _curLayout.clear(); - + for (LayoutsMap::iterator i = _layouts.begin(); i != _layouts.end(); ++i) delete i->_value; - + _layouts.clear(); } bool ThemeEval::getWidgetData(const Common::String &widget, int16 &x, int16 &y, uint16 &w, uint16 &h) { Common::StringTokenizer tokenizer(widget, "."); - + if (widget.hasPrefix("Dialog.")) tokenizer.nextToken(); Common::String dialogName = "Dialog." + tokenizer.nextToken(); Common::String widgetName = tokenizer.nextToken(); - - if (!_layouts.contains(dialogName)) + + if (!_layouts.contains(dialogName)) return false; if (widgetName.empty()) return _layouts[dialogName]->getDialogData(x, y, w, h); - + return _layouts[dialogName]->getWidgetData(widgetName, x, y, w, h); } -void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled) { +void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled) { int typeW = -1; int typeH = -1; - + if (!type.empty()) { typeW = getVar("Globals." + type + ".Width", -1); typeH = getVar("Globals." + type + ".Height", -1); } - - ThemeLayoutWidget *widget = new ThemeLayoutWidget(_curLayout.top(), name, - typeW == -1 ? w : typeW, + + ThemeLayoutWidget *widget = new ThemeLayoutWidget(_curLayout.top(), name, + typeW == -1 ? w : typeW, typeH == -1 ? h : typeH); - + _curLayout.top()->addChild(widget); setVar(_curDialog + "." + name + ".Enabled", enabled ? 1 : 0); } @@ -90,9 +90,9 @@ void ThemeEval::addWidget(const Common::String &name, int w, int h, const Common void ThemeEval::addDialog(const Common::String &name, const Common::String &overlays, bool enabled, int inset) { int16 x, y; uint16 w, h; - + ThemeLayout *layout = 0; - + if (overlays == "screen") { layout = new ThemeLayoutMain(inset, inset, g_system->getOverlayWidth() - 2 * inset, g_system->getOverlayHeight() - 2 * inset); } else if (overlays == "screen_center") { @@ -100,13 +100,13 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over } else if (getWidgetData(overlays, x, y, w, h)) { layout = new ThemeLayoutMain(x + inset, y + inset, w - 2 * inset, h - 2 * inset); } - + if (!layout) error("Error when loading dialog position for '%s'", overlays.c_str()); - + if (_layouts.contains(name)) delete _layouts[name]; - + _layouts[name] = layout; layout->setPadding( @@ -115,7 +115,7 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over getVar("Globals.Padding.Top", 0), getVar("Globals.Padding.Bottom", 0) ); - + _curLayout.push(layout); _curDialog = name; setVar(name + ".Enabled", enabled ? 1 : 0); @@ -123,24 +123,24 @@ void ThemeEval::addDialog(const Common::String &name, const Common::String &over void ThemeEval::addLayout(ThemeLayout::LayoutType type, int spacing, bool center) { ThemeLayout *layout = 0; - + if (spacing == -1) spacing = getVar("Globals.Layout.Spacing", 4); - + if (type == ThemeLayout::kLayoutVertical) layout = new ThemeLayoutVertical(_curLayout.top(), spacing, center); else if (type == ThemeLayout::kLayoutHorizontal) layout = new ThemeLayoutHorizontal(_curLayout.top(), spacing, center); assert(layout); - + layout->setPadding( getVar("Globals.Padding.Left", 0), getVar("Globals.Padding.Right", 0), getVar("Globals.Padding.Top", 0), getVar("Globals.Padding.Bottom", 0) ); - + _curLayout.top()->addChild(layout); _curLayout.push(layout); } @@ -153,7 +153,7 @@ void ThemeEval::addSpace(int size) { bool ThemeEval::addImportedLayout(const Common::String &name) { if (!_layouts.contains(name)) return false; - + _curLayout.top()->importLayout(_layouts[name]); return true; } diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index 5fe0e73bd3..07242e890e 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -34,57 +34,57 @@ #include "gui/ThemeLayout.h" namespace GUI { - + class ThemeEval { typedef Common::HashMap<Common::String, int> VariablesMap; typedef Common::HashMap<Common::String, ThemeLayout *> LayoutsMap; - + public: ThemeEval() { buildBuiltinVars(); } - + ~ThemeEval(); - + void buildBuiltinVars(); - + int getVar(const Common::String &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 + return -13375; //EVAL_UNDEF_VAR } - + int getVar(const Common::String &s, int def) { if (_vars.contains(s)) return _vars[s]; - + if (_builtin.contains(s)) return _builtin[s]; return def; } - + void setVar(const Common::String &name, int val) { _vars[name] = val; } - + 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, int inset = 0); void addLayout(ThemeLayout::LayoutType type, int spacing, bool center = false); void addWidget(const Common::String &name, int w, int h, const Common::String &type, bool enabled = true); bool addImportedLayout(const Common::String &name); void addSpace(int size); - + void addPadding(int16 l, int16 r, int16 t, int16 b) { _curLayout.top()->setPadding(l, r, t, b); } - + void closeLayout() { _curLayout.pop(); } void closeDialog() { _curLayout.pop()->reflowLayout(); _curDialog.clear(); } - + bool getWidgetData(const Common::String &widget, int16 &x, int16 &y, uint16 &w, uint16 &h); #ifdef LAYOUT_DEBUG_DIALOG @@ -92,13 +92,13 @@ public: _layouts[LAYOUT_DEBUG_DIALOG]->debugDraw(screen, font); } #endif - + void reset(); - + private: VariablesMap _vars; VariablesMap _builtin; - + LayoutsMap _layouts; Common::Stack<ThemeLayout *> _curLayout; Common::String _curDialog; diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp index 676fa0789b..415a77ef0d 100644 --- a/gui/ThemeLayout.cpp +++ b/gui/ThemeLayout.cpp @@ -37,17 +37,17 @@ namespace GUI { void ThemeLayout::importLayout(ThemeLayout *layout) { assert(layout->getLayoutType() == kLayoutMain); - + if (layout->_children.size() == 0) return; - + layout = layout->_children[0]; - + if (getLayoutType() == layout->getLayoutType()) { for (uint i = 0; i < layout->_children.size(); ++i) - _children.push_back(layout->_children[i]->makeClone()); + _children.push_back(layout->_children[i]->makeClone()); } else { - _children.push_back(layout->makeClone()); + _children.push_back(layout->makeClone()); } } @@ -56,14 +56,14 @@ bool ThemeLayout::getWidgetData(const Common::String &name, int16 &x, int16 &y, if (_children[i]->getWidgetData(name, x, y, w, h)) return true; } - + return false; } int16 ThemeLayout::getParentW() { ThemeLayout *p = _parent; int width = 0; - + while (p && p->getLayoutType() != kLayoutMain) { width += p->_paddingRight + p->_paddingLeft; if (p->getLayoutType() == kLayoutHorizontal) { @@ -72,14 +72,14 @@ int16 ThemeLayout::getParentW() { } p = p->_parent; } - + return p->getWidth() - width; } int16 ThemeLayout::getParentH() { ThemeLayout *p = _parent; int height = 0; - + while (p && p->getLayoutType() != kLayoutMain) { height += p->_paddingBottom + p->_paddingTop; if (p->getLayoutType() == kLayoutVertical) { @@ -88,7 +88,7 @@ int16 ThemeLayout::getParentH() { } p = p->_parent; } - + return p->getHeight() - height; } @@ -99,28 +99,28 @@ bool ThemeLayoutWidget::getWidgetData(const Common::String &name, int16 &x, int1 w = _w; h = _h; return true; } - + return false; } void ThemeLayoutMain::reflowLayout() { assert(_children.size() <= 1); - + if (_children.size()) { _children[0]->resetLayout(); _children[0]->setWidth(_w); _children[0]->setHeight(_h); _children[0]->reflowLayout(); - + if (_w == -1) _w = _children[0]->getWidth(); - + if (_h == -1) _h = _children[0]->getHeight(); - + if (_y == -1) _y = (g_system->getOverlayHeight() >> 1) - (_h >> 1); - + if (_x == -1) _x = (g_system->getOverlayWidth() >> 1) - (_w >> 1); } @@ -130,41 +130,41 @@ void ThemeLayoutVertical::reflowLayout() { int curX, curY; int resize[8]; int rescount = 0; - + curX = _paddingLeft; curY = _paddingTop; _h = _paddingTop + _paddingBottom; - + for (uint i = 0; i < _children.size(); ++i) { - + _children[i]->resetLayout(); _children[i]->reflowLayout(); if (_children[i]->getWidth() == -1) _children[i]->setWidth((_w == -1 ? getParentW() : _w) - _paddingLeft - _paddingRight); - + if (_children[i]->getHeight() == -1) { resize[rescount++] = i; _children[i]->setHeight(0); } - + _children[i]->setY(curY); - + if (_centered && _children[i]->getWidth() < _w && _w != -1) { _children[i]->setX((_w >> 1) - (_children[i]->getWidth() >> 1)); } else _children[i]->setX(curX); - curY += _children[i]->getHeight() + _spacing; + curY += _children[i]->getHeight() + _spacing; _w = MAX(_w, (int16)(_children[i]->getWidth() + _paddingLeft + _paddingRight)); _h += _children[i]->getHeight() + _spacing; } - + _h -= _spacing; - + if (rescount) { int newh = (getParentH() - _h - _paddingBottom) / rescount; - + for (int i = 0; i < rescount; ++i) { _children[resize[i]]->setHeight(newh); _h += newh; @@ -182,12 +182,12 @@ void ThemeLayoutHorizontal::reflowLayout() { curX = _paddingLeft; curY = _paddingTop; _w = _paddingLeft + _paddingRight; - + for (uint i = 0; i < _children.size(); ++i) { - + _children[i]->resetLayout(); _children[i]->reflowLayout(); - + if (_children[i]->getHeight() == -1) _children[i]->setHeight((_h == -1 ? getParentH() : _h) - _paddingTop - _paddingBottom); @@ -195,24 +195,24 @@ void ThemeLayoutHorizontal::reflowLayout() { resize[rescount++] = i; _children[i]->setWidth(0); } - + _children[i]->setX(curX); - + if (_centered && _children[i]->getHeight() < _h && _h != -1) _children[i]->setY((_h >> 1) - (_children[i]->getHeight() >> 1)); else _children[i]->setY(curY); - + curX += (_children[i]->getWidth() + _spacing); _w += _children[i]->getWidth() + _spacing; _h = MAX(_h, (int16)(_children[i]->getHeight() + _paddingTop + _paddingBottom)); } - + _w -= _spacing; - + if (rescount) { int neww = (getParentW() - _w - _paddingRight) / rescount; - + for (int i = 0; i < rescount; ++i) { _children[resize[i]]->setWidth(neww); _w += neww; diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h index 2d119023ad..39675686f1 100644 --- a/gui/ThemeLayout.h +++ b/gui/ThemeLayout.h @@ -158,7 +158,7 @@ protected: class ThemeLayoutVertical : public ThemeLayout { public: ThemeLayoutVertical(ThemeLayout *p, int spacing, bool center) : - ThemeLayout(p, "") { + ThemeLayout(p, "") { _spacing = spacing; _centered = center; } diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index bbcfc6302e..1a82671c7b 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -38,8 +38,8 @@ namespace GUI { -ThemeParser::ThemeParser(ThemeEngine *parent) : XMLParser() { - +ThemeParser::ThemeParser(ThemeEngine *parent) : XMLParser() { + _drawFunctions["circle"] = &Graphics::VectorRenderer::drawCallback_CIRCLE; _drawFunctions["square"] = &Graphics::VectorRenderer::drawCallback_SQUARE; _drawFunctions["roundedsq"] = &Graphics::VectorRenderer::drawCallback_ROUNDSQ; @@ -75,7 +75,7 @@ void ThemeParser::cleanup() { Graphics::DrawStep *ThemeParser::defaultDrawStep() { Graphics::DrawStep *step = new Graphics::DrawStep; - + memset(step, 0, sizeof(Graphics::DrawStep)); step->xAlign = Graphics::DrawStep::kVectorAlignManual; @@ -121,9 +121,9 @@ bool ThemeParser::parserCallback_defaults(ParserNode *node) { return parseDrawStep(node, step, false); } -bool ThemeParser::parserCallback_font(ParserNode *node) { +bool ThemeParser::parserCallback_font(ParserNode *node) { int red, green, blue; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; @@ -133,15 +133,15 @@ bool ThemeParser::parserCallback_font(ParserNode *node) { getPaletteColor(node->values["color"], red, green, blue); else if (!parseIntegerKey(node->values["color"].c_str(), 3, &red, &green, &blue)) return parserError("Error parsing color value for font definition."); - + if (!_theme->addFont(node->values["id"], node->values["file"], red, green, blue)) return parserError("Error loading Font in theme engine."); - + return true; } -bool ThemeParser::parserCallback_fonts(ParserNode *node) { - return true; +bool ThemeParser::parserCallback_fonts(ParserNode *node) { + return true; } bool ThemeParser::parserCallback_cursor(ParserNode *node) { @@ -149,18 +149,18 @@ bool ThemeParser::parserCallback_cursor(ParserNode *node) { node->ignore = true; return true; } - + int spotx, spoty, scale; - + if (!parseIntegerKey(node->values["hotspot"].c_str(), 2, &spotx, &spoty)) return parserError("Error parsing cursor Hot Spot coordinates."); - + if (!parseIntegerKey(node->values["scale"].c_str(), 1, &scale)) return parserError("Error parsing cursor scale."); - + if (!_theme->createCursor(node->values["file"], spotx, spoty, scale)) return parserError("Error creating Bitmap Cursor."); - + return true; } @@ -169,17 +169,17 @@ bool ThemeParser::parserCallback_bitmap(ParserNode *node) { node->ignore = true; return true; } - + if (!_theme->addBitmap(node->values["filename"])) return parserError("Error loading Bitmap file '%s'", node->values["filename"].c_str()); - + return true; } -bool ThemeParser::parserCallback_text(ParserNode *node) { +bool ThemeParser::parserCallback_text(ParserNode *node) { Graphics::TextAlign alignH; GUI::ThemeEngine::TextAlignVertical alignV; - + if (node->values["horizontal_align"] == "left") alignH = Graphics::kTextAlignLeft; else if (node->values["horizontal_align"] == "right") @@ -187,7 +187,7 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { else if (node->values["horizontal_align"] == "center") alignH = Graphics::kTextAlignCenter; else return parserError("Invalid value for text alignment."); - + if (node->values["vertical_align"] == "top") alignV = GUI::ThemeEngine::kTextAlignVTop; else if (node->values["vertical_align"] == "center") @@ -195,7 +195,7 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { else if (node->values["vertical_align"] == "bottom") alignV = GUI::ThemeEngine::kTextAlignVBottom; else return parserError("Invalid value for text alignment."); - + if (!_theme->addTextData(getParentNode(node)->values["id"], node->values["font"], alignH, alignV)) return parserError("Error adding Text Data for '%s'.", getParentNode(node)->values["id"].c_str()); @@ -205,14 +205,14 @@ bool ThemeParser::parserCallback_text(ParserNode *node) { bool ThemeParser::parserCallback_render_info(ParserNode *node) { if (resolutionCheck(node->values["resolution"]) == false) node->ignore = true; - + return true; } bool ThemeParser::parserCallback_layout_info(ParserNode *node) { if (resolutionCheck(node->values["resolution"]) == false) node->ignore = true; - + return true; } @@ -243,7 +243,7 @@ bool ThemeParser::parserCallback_color(ParserNode *node) { bool ThemeParser::parserCallback_drawstep(ParserNode *node) { Graphics::DrawStep *drawstep = newDrawStep(); - Common::String functionName = node->values["func"]; + Common::String functionName = node->values["func"]; if (_drawFunctions.contains(functionName) == false) return parserError("%s is not a valid drawing function name", functionName.c_str()); @@ -261,14 +261,14 @@ bool ThemeParser::parserCallback_drawstep(ParserNode *node) { bool ThemeParser::parserCallback_drawdata(ParserNode *node) { bool cached = false; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } if (node->values.contains("cache")) { - if (node->values["cache"] == "true") + if (node->values["cache"] == "true") cached = true; else if (node->values["cache"] == "false") cached = false; @@ -350,13 +350,13 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (functionSpecific) { assert(stepNode->values.contains("func")); Common::String functionName = stepNode->values["func"]; - + if (functionName == "bitmap") { if (!stepNode->values.contains("file")) return parserError("Need to specify a filename for Bitmap blitting."); - + drawstep->blitSrc = _theme->getBitmap(stepNode->values["file"]); - + if (!drawstep->blitSrc) return parserError("The given filename hasn't been loaded into the GUI."); } @@ -391,20 +391,20 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (stepNode->values.contains("size")) { warning("The <size> keyword has been deprecated. Use <width> and <height> instead"); } - + if (stepNode->values.contains("width") && stepNode->values["width"] != "auto") { drawstep->autoWidth = false; - + val = stepNode->values["width"]; if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->w = x; else if (val == "height") drawstep->w = -1; else return parserError("Invalid value for vector width."); - + if (stepNode->values.contains("xpos")) { val = stepNode->values["xpos"]; - + if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->x = x; else if (val == "center") @@ -413,16 +413,16 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->xAlign = Graphics::DrawStep::kVectorAlignLeft; else if (val == "right") drawstep->xAlign = Graphics::DrawStep::kVectorAlignRight; - else + else return parserError("Invalid value for X Position"); } else { return parserError("When width is not set to 'auto', a <xpos> tag must be included."); } } - + if (stepNode->values.contains("height") && stepNode->values["height"] != "auto") { drawstep->autoHeight = false; - + val = stepNode->values["height"]; if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->h = x; @@ -432,7 +432,7 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst if (stepNode->values.contains("ypos")) { val = stepNode->values["ypos"]; - + if (parseIntegerKey(val.c_str(), 1, &x)) drawstep->y = x; else if (val == "center") @@ -441,13 +441,13 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->yAlign = Graphics::DrawStep::kVectorAlignTop; else if (val == "bottom") drawstep->yAlign = Graphics::DrawStep::kVectorAlignBottom; - else + else return parserError("Invalid value for Y Position"); } else { return parserError("When height is not set to 'auto', a <ypos> tag must be included."); } } - + if (drawstep->h == -1 && drawstep->w == -1) return parserError("Cross-reference in Vector Size: Height is set to width and width is set to height."); } @@ -477,30 +477,30 @@ bool ThemeParser::parserCallback_def(ParserNode *node) { node->ignore = true; return true; } - + Common::String var = "Globals." + node->values["var"]; int value; - + if (_theme->getEvaluator()->hasVar(node->values["value"]) == true) value = _theme->getEvaluator()->getVar(node->values["value"]); - + else if (!parseIntegerKey(node->values["value"].c_str(), 1, &value)) return parserError("Invalid definition for '%s'.", var.c_str()); - + _theme->getEvaluator()->setVar(var, value); - return true; + return true; } bool ThemeParser::parserCallback_widget(ParserNode *node) { Common::String var; - + if (getParentNode(node)->name == "globals") { - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } - + var = "Globals." + node->values["name"] + "."; if (!parseCommonLayoutProps(node, var)) return parserError("Error parsing Layout properties of '%s'.", var.c_str()); @@ -517,24 +517,24 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) { else if (node->values["enabled"] != "true") return parserError("Invalid value for Widget enabling (expecting true/false)"); } - + if (node->values.contains("width")) { if (_theme->getEvaluator()->hasVar(node->values["width"]) == true) width = _theme->getEvaluator()->getVar(node->values["width"]); - + else if (!parseIntegerKey(node->values["width"].c_str(), 1, &width)) return parserError("Corrupted width value in key for %s", var.c_str()); } - + if (node->values.contains("height")) { if (_theme->getEvaluator()->hasVar(node->values["height"]) == true) height = _theme->getEvaluator()->getVar(node->values["height"]); - + else if (!parseIntegerKey(node->values["height"].c_str(), 1, &height)) return parserError("Corrupted height value in key for %s", var.c_str()); } - - _theme->getEvaluator()->addWidget(var, width, height, node->values["type"], enabled); + + _theme->getEvaluator()->addWidget(var, width, height, node->values["type"], enabled); } return true; @@ -544,26 +544,26 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { Common::String var = "Dialog." + node->values["name"]; bool enabled = true; int inset = 0; - + if (resolutionCheck(node->values["resolution"]) == false) { node->ignore = true; return true; } - + if (node->values.contains("enabled")) { if (node->values["enabled"] == "false") enabled = false; else if (node->values["enabled"] != "true") return parserError("Invalid value for Dialog enabling (expecting true/false)"); } - + if (node->values.contains("inset")) { if (!parseIntegerKey(node->values["inset"].c_str(), 1, &inset)) return false; } - + _theme->getEvaluator()->addDialog(var, node->values["overlays"], enabled, inset); - + if (node->values.contains("shading")) { int shading = 0; if (node->values["shading"] == "dim") @@ -571,15 +571,15 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { else if (node->values["shading"] == "luminance") shading = 2; else return parserError("Invalid value for Dialog background shading."); - + _theme->getEvaluator()->setVar(var + ".Shading", shading); } - + return true; } bool ThemeParser::parserCallback_import(ParserNode *node) { - + if (!_theme->getEvaluator()->addImportedLayout(node->values["layout"])) return parserError("Error importing external layout"); return true; @@ -587,12 +587,12 @@ bool ThemeParser::parserCallback_import(ParserNode *node) { bool ThemeParser::parserCallback_layout(ParserNode *node) { int spacing = -1; - + if (node->values.contains("spacing")) { if (!parseIntegerKey(node->values["spacing"].c_str(), 1, &spacing)) return false; } - + if (node->values["type"] == "vertical") _theme->getEvaluator()->addLayout(GUI::ThemeLayout::kLayoutVertical, spacing, node->values["center"] == "true"); else if (node->values["type"] == "horizontal") @@ -603,27 +603,27 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) { if (node->values.contains("padding")) { int paddingL, paddingR, paddingT, paddingB; - + if (!parseIntegerKey(node->values["padding"].c_str(), 4, &paddingL, &paddingR, &paddingT, &paddingB)) return false; - + _theme->getEvaluator()->addPadding(paddingL, paddingR, paddingT, paddingB); } - + return true; } bool ThemeParser::parserCallback_space(ParserNode *node) { int size = -1; - + if (node->values.contains("size")) { if (_theme->getEvaluator()->hasVar(node->values["size"])) size = _theme->getEvaluator()->getVar(node->values["size"]); - + else if (!parseIntegerKey(node->values["size"].c_str(), 1, &size)) return parserError("Invalid value for Spacing size."); } - + _theme->getEvaluator()->addSpace(size); return true; } @@ -633,151 +633,151 @@ bool ThemeParser::closedKeyCallback(ParserNode *node) { _theme->getEvaluator()->closeLayout(); else if (node->name == "dialog") _theme->getEvaluator()->closeDialog(); - + return true; } bool ThemeParser::parseCommonLayoutProps(ParserNode *node, const Common::String &var) { if (node->values.contains("size")) { int width, height; - + if (!parseIntegerKey(node->values["size"].c_str(), 2, &width, &height)) { Common::StringTokenizer tokenizer(node->values["size"], " ,"); Common::String wtoken, htoken; char *parseEnd; - + wtoken = tokenizer.nextToken(); - + if (_theme->getEvaluator()->hasVar(wtoken)) { width = _theme->getEvaluator()->getVar(wtoken); } else { width = strtol(wtoken.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == '%' && *(parseEnd + 1) == 0)) return false; - + if (wtoken.lastChar() == '%') width = g_system->getOverlayWidth() * width / 100; } - + htoken = tokenizer.nextToken(); - + if (_theme->getEvaluator()->hasVar(htoken)) { height = _theme->getEvaluator()->getVar(htoken); } else { height = strtol(htoken.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == '%' && *(parseEnd + 1) == 0)) return false; - + if (htoken.lastChar() == '%') height = g_system->getOverlayHeight() * height / 100; } - + if (!tokenizer.empty()) return false; } - - + + _theme->getEvaluator()->setVar(var + "Width", width); _theme->getEvaluator()->setVar(var + "Height", height); } - + if (node->values.contains("pos")) { int x, y; - + if (!parseIntegerKey(node->values["pos"].c_str(), 2, &x, &y)) { Common::StringTokenizer tokenizer(node->values["pos"], " ,"); Common::String xpos, ypos; char *parseEnd; - + xpos = tokenizer.nextToken(); - + if (xpos == "center") { if (!_theme->getEvaluator()->hasVar(var + "Width")) return false; - + x = (g_system->getOverlayWidth() / 2) - (_theme->getEvaluator()->getVar(var + "Width") / 2); - + } else if (_theme->getEvaluator()->hasVar(xpos)) { x = _theme->getEvaluator()->getVar(xpos); } else { x = strtol(xpos.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == 'r' && *(parseEnd + 1) == 0)) return false; - + if (xpos.lastChar() == 'r') x = g_system->getOverlayWidth() - x; - } - + } + ypos = tokenizer.nextToken(); - + if (ypos == "center") { if (!_theme->getEvaluator()->hasVar(var + "Height")) return false; - + y = (g_system->getOverlayHeight() / 2) - (_theme->getEvaluator()->getVar(var + "Height") / 2); - + } else if (_theme->getEvaluator()->hasVar(ypos)) { y = _theme->getEvaluator()->getVar(ypos); } else { y = strtol(ypos.c_str(), &parseEnd, 10); - + if (*parseEnd != 0 && !(*parseEnd == 'b' && *(parseEnd + 1) == 0)) return false; - + if (ypos.lastChar() == 'b') y = g_system->getOverlayHeight() - y; } - + if (!tokenizer.empty()) return false; } - + _theme->getEvaluator()->setVar(var + "X", x); _theme->getEvaluator()->setVar(var + "Y", y); } - + if (node->values.contains("padding")) { int paddingL, paddingR, paddingT, paddingB; - + if (!parseIntegerKey(node->values["padding"].c_str(), 4, &paddingL, &paddingR, &paddingT, &paddingB)) return false; - + _theme->getEvaluator()->setVar(var + "Padding.Left", paddingL); _theme->getEvaluator()->setVar(var + "Padding.Right", paddingR); _theme->getEvaluator()->setVar(var + "Padding.Top", paddingT); _theme->getEvaluator()->setVar(var + "Padding.Bottom", paddingB); } - + return true; } bool ThemeParser::resolutionCheck(const Common::String &resolution) { if (resolution.empty()) return true; - + Common::StringTokenizer globTokenizer(resolution, ", "); Common::String cur, w, h; bool definedRes = false; - + while (!globTokenizer.empty()) { bool ignore = false; cur = globTokenizer.nextToken(); - + if (cur[0] == '-') { ignore = true; cur.deleteChar(0); } else { definedRes = true; } - + Common::StringTokenizer resTokenizer(cur, "x"); w = resTokenizer.nextToken(); h = resTokenizer.nextToken(); - if ((w == "X" || atoi(w.c_str()) == g_system->getOverlayWidth()) && + if ((w == "X" || atoi(w.c_str()) == g_system->getOverlayWidth()) && (h == "Y" || atoi(h.c_str()) == g_system->getOverlayHeight())) return !ignore; } diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index 58812a7907..520b319a06 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -32,30 +32,30 @@ namespace GUI { -class ThemeEngine; +class ThemeEngine; class ThemeParser : public Common::XMLParser { typedef void (Graphics::VectorRenderer::*DrawingFunctionCallback)(const Common::Rect &, const Graphics::DrawStep &); public: ThemeParser(ThemeEngine *parent); - + virtual ~ThemeParser(); - + bool getPaletteColor(const Common::String &name, int &r, int &g, int &b) { if (!_palette.contains(name)) return false; - + r = _palette[name].r; g = _palette[name].g; b = _palette[name].b; - + return true; } protected: ThemeEngine *_theme; - + CUSTOM_XML_PARSER(ThemeParser) { XML_KEY(render_info) XML_PROP(resolution, false) @@ -74,14 +74,14 @@ protected: XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(bitmaps) XML_KEY(bitmap) XML_PROP(filename, true) XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(cursor) XML_PROP(file, true) XML_PROP(hotspot, true) @@ -162,7 +162,7 @@ protected: XML_PROP(value, true) XML_PROP(resolution, false) KEY_END() - + XML_KEY(widget) XML_PROP(name, true) XML_PROP(size, false) @@ -171,7 +171,7 @@ protected: XML_PROP(resolution, false) KEY_END() KEY_END() - + XML_KEY(dialog) XML_PROP(name, true) XML_PROP(overlays, true) @@ -184,11 +184,11 @@ protected: XML_PROP(center, false) XML_PROP(padding, false) XML_PROP(spacing, false) - + XML_KEY(import) XML_PROP(layout, true) KEY_END() - + XML_KEY(widget) XML_PROP(name, true) XML_PROP(width, false) @@ -196,18 +196,18 @@ protected: XML_PROP(type, false) XML_PROP(enabled, false) KEY_END() - + XML_KEY(space) XML_PROP(size, false) KEY_END() - + XML_KEY_RECURSIVE(layout) KEY_END() KEY_END() - KEY_END() - + KEY_END() + } PARSER_END(); - + /** Render info callbacks */ bool parserCallback_render_info(ParserNode *node); bool parserCallback_defaults(ParserNode *node); @@ -221,8 +221,8 @@ protected: bool parserCallback_bitmaps(ParserNode *node) { return true; } bool parserCallback_bitmap(ParserNode *node); bool parserCallback_cursor(ParserNode *node); - - + + /** Layout info callbacks */ bool parserCallback_layout_info(ParserNode *node); bool parserCallback_globals(ParserNode *node) { return true; } @@ -232,11 +232,11 @@ protected: bool parserCallback_layout(ParserNode *node); bool parserCallback_space(ParserNode *node); bool parserCallback_import(ParserNode *node); - + bool closedKeyCallback(ParserNode *node); - + bool resolutionCheck(const Common::String &resolution); - + void cleanup(); Graphics::DrawStep *newDrawStep(); diff --git a/gui/console.cpp b/gui/console.cpp index 92e5132c22..5ad4051e16 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -109,7 +109,7 @@ void ConsoleDialog::init() { // Calculate the real width/height (rounded to char/line multiples) _w = (uint16)(_widthPercent * screenW); _h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight); - + _w = _w - _w / 20; _h = _h * kConsoleLineHeight + 2; @@ -142,7 +142,7 @@ void ConsoleDialog::open() { // Calculate the real width/height (rounded to char/line multiples) uint16 w = (uint16)(_widthPercent * screenW); uint16 h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight); - + h = h * kConsoleLineHeight + 2; w = w - w / 20; @@ -202,7 +202,7 @@ void ConsoleDialog::drawLine(int line, bool restoreBg) { g_gui.theme()->drawChar(Common::Rect(x, y, x+kConsoleCharWidth, y+kConsoleLineHeight), c, _font); x += kConsoleCharWidth; } - + g_gui.theme()->updateScreen(); } diff --git a/gui/dialog.cpp b/gui/dialog.cpp index ce3e5d609c..dc2e270f44 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -44,7 +44,7 @@ namespace GUI { Dialog::Dialog(int x, int y, int w, int h) : GuiObject(x, y, w, h), - _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), + _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _backgroundType(GUI::ThemeEngine::kDialogBackgroundDefault) {} Dialog::Dialog(const Common::String &name) @@ -144,7 +144,7 @@ void Dialog::drawDialog() { // Draw all children Widget *w = _firstWidget; while (w) { - //if (w->_debugVisible) + //if (w->_debugVisible) w->draw(); w = w->_next; } diff --git a/gui/dialog.h b/gui/dialog.h index 0aa52c4972..726ba85cd0 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -48,7 +48,7 @@ protected: Widget *_focusedWidget; Widget *_dragWidget; bool _visible; - + ThemeEngine::DialogBackground _backgroundType; private: diff --git a/gui/launcher.cpp b/gui/launcher.cpp index a484638338..d28e322d15 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -256,7 +256,7 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc) if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) { _savePathWidget->setLabel("Default"); } - + // Activate the first tab tab->setActiveTab(0); _tabWidget = tab; @@ -815,7 +815,7 @@ void LauncherDialog::loadGame(int item) { target.toLowercase(); if (plugin) { - if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && + if ((*plugin)->hasFeature(MetaEngine::kSupportsListSaves) && (*plugin)->hasFeature(MetaEngine::kSupportsLoadingDuringStartup)) { int slot = _loadDialog->runModal(plugin, target); if (slot >= 0) { diff --git a/gui/launcher.h b/gui/launcher.h index 9d75c9a435..b9a76c80ca 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -74,7 +74,7 @@ protected: void removeGame(int item); void editGame(int item); void loadGame(int item); - + void selectGame(const String &name); }; diff --git a/gui/massadd.cpp b/gui/massadd.cpp index db94d4308b..ae37db46f9 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -76,7 +76,7 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir) _gameProgressText = new StaticTextWidget(this, "MassAdd.GameProgressText", "... progress ..."); - + _dirProgressText->setAlign(Graphics::kTextAlignCenter); _gameProgressText->setAlign(Graphics::kTextAlignCenter); @@ -186,7 +186,7 @@ void MassAddDialog::handleTickle() { assert(dom); if ((*dom)["gameid"] == result["gameid"] && - (*dom)["platform"] == result["platform"] && + (*dom)["platform"] == result["platform"] && (*dom)["language"] == result["language"]) { duplicate = true; break; diff --git a/gui/newgui.cpp b/gui/newgui.cpp index aa778b834c..900ac21d36 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -72,7 +72,7 @@ NewGui::NewGui() : _redrawStatus(kRedrawDisabled), Common::String themefile(ConfMan.get("gui_theme")); if (themefile.compareToIgnoreCase("default") == 0) themefile = "builtin"; - + ConfMan.registerDefault("gui_renderer", ThemeEngine::findModeConfigName(ThemeEngine::_defaultRendererMode)); ThemeEngine::GraphicsMode gfxMode = (ThemeEngine::GraphicsMode)ThemeEngine::findMode(ConfMan.get("gui_renderer")); @@ -87,9 +87,9 @@ NewGui::~NewGui() { bool NewGui::loadNewTheme(Common::String filename, ThemeEngine::GraphicsMode gfx) { if (_theme && filename == _theme->getThemeFileName() && gfx == _theme->getGraphicsMode()) return true; - + Common::String oldTheme = (_theme != 0) ? _theme->getThemeFileName() : ""; - + if (gfx == ThemeEngine::kGfxDisabled) gfx = ThemeEngine::_defaultRendererMode; @@ -122,7 +122,7 @@ void NewGui::redraw() { if (_redrawStatus == kRedrawDisabled) return; - + if (_dialogStack.empty()) return; @@ -134,7 +134,7 @@ void NewGui::redraw() { _theme->openDialog(true); for (i = 0; i < _dialogStack.size() - 1; i++) { - _dialogStack[i]->drawDialog(); + _dialogStack[i]->drawDialog(); } _theme->finishBuffering(); @@ -195,13 +195,13 @@ void NewGui::runLoop() { animateCursor(); // _theme->updateScreen(); // _system->updateScreen(); - + if (lastRedraw + waitTime < _system->getMillis()) { _theme->updateScreen(); _system->updateScreen(); lastRedraw = _system->getMillis(); } - + Common::Event event; while (eventMan->pollEvent(event)) { @@ -224,7 +224,7 @@ void NewGui::runLoop() { _redrawStatus = kRedrawFull; redraw(); } - + if (lastRedraw + waitTime < _system->getMillis()) { _theme->updateScreen(); _system->updateScreen(); @@ -314,10 +314,10 @@ void NewGui::restoreState() { _stateIsSaved = false; } -void NewGui::openDialog(Dialog *dialog) { +void NewGui::openDialog(Dialog *dialog) { _dialogStack.push(dialog); _redrawStatus = kRedrawOpenDialog; - + // We reflow the dialog just before opening it. If the screen changed // since the last time we looked, also refresh the loaded theme, // and reflow all other open dialogs, too. diff --git a/gui/newgui.h b/gui/newgui.h index 29eb58638e..cec22d2335 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -74,7 +74,7 @@ public: bool loadNewTheme(Common::String file, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled); ThemeEngine *theme() { return _theme; } - + ThemeEval *xmlEval() { return _theme->getEvaluator(); } const Graphics::Font &getFont(ThemeEngine::FontStyle style = ThemeEngine::kFontStyleBold) const { return *(_theme->getFont(style)); } diff --git a/gui/options.cpp b/gui/options.cpp index 8ac1720e25..9a53a425ec 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -648,7 +648,7 @@ void OptionsDialog::reflowLayout() { Dialog::reflowLayout(); int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - + if (_graphicsTabId != -1 && _tabWidget) _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX"); @@ -724,15 +724,15 @@ GlobalOptionsDialog::GlobalOptionsDialog() new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", "Theme:", kChooseThemeCmd, 0); _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName()); - + int labelWidth = g_gui.xmlEval()->getVar("Globals.TabLabelWidth"); - + _rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.Renderer", "GUI Renderer:", labelWidth); - + for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i) _rendererPopUp->appendEntry(GUI::ThemeEngine::_rendererModes[i].name, GUI::ThemeEngine::_rendererModes[i].mode); - + _autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriod", "Autosave:", labelWidth); for (int i = 0; savePeriodLabels[i]; i++) { @@ -809,7 +809,7 @@ void GlobalOptionsDialog::open() { if (value == savePeriodValues[i]) _autosavePeriodPopUp->setSelected(i); } - + ThemeEngine::GraphicsMode mode = ThemeEngine::findMode(ConfMan.get("gui_renderer")); if (mode == ThemeEngine::kGfxDisabled) mode = ThemeEngine::_defaultRendererMode; @@ -843,7 +843,7 @@ void GlobalOptionsDialog::close() { #endif ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain); - + GUI::ThemeEngine::GraphicsMode selected = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag(); const char *cfg = GUI::ThemeEngine::findModeConfigName(selected); if (!ConfMan.get("gui_renderer").equalsIgnoreCase(cfg)) { diff --git a/gui/options.h b/gui/options.h index 187e163b79..63caf68c32 100644 --- a/gui/options.h +++ b/gui/options.h @@ -81,7 +81,7 @@ protected: void setMIDISettingsState(bool enabled); void setVolumeSettingsState(bool enabled); void setSubtitleSettingsState(bool enabled); - + TabWidget *_tabWidget; int _graphicsTabId; diff --git a/gui/saveload.cpp b/gui/saveload.cpp index bce0df3583..dd75e5f7b1 100644 --- a/gui/saveload.cpp +++ b/gui/saveload.cpp @@ -53,7 +53,7 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel) _list = new GUI::ListWidget(this, "ScummSaveLoad.List"); _list->setNumberingMode(GUI::kListNumberingZero); setSaveMode(false); - + _gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10); _date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", Graphics::kTextAlignCenter); @@ -143,7 +143,7 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da break; case kDelCmd: if (selItem >= 0 && _delSupport) { - MessageDialog alert("Do you really want to delete this savegame?", + MessageDialog alert("Do you really want to delete this savegame?", "Delete", "Cancel"); if (alert.runModal() == GUI::kMessageOK) { (*_plugin)->removeSaveState(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str())); @@ -167,11 +167,11 @@ void SaveLoadChooser::reflowLayout() { if (g_gui.xmlEval()->getVar("Globals.ScummSaveLoad.ExtInfo.Visible") == 1 && _thumbnailSupport) { int16 x, y; uint16 w, h; - + if (!g_gui.xmlEval()->getWidgetData("ScummSaveLoad.Thumbnail", x, y, w, h)) error("Error when loading position data for Save/Load Thumbnails."); - - int thumbW = kThumbnailWidth; + + int thumbW = kThumbnailWidth; int thumbH = ((g_system->getHeight() % 200 && g_system->getHeight() != 350) ? kThumbnailHeight2 : kThumbnailHeight1); int thumbX = x + (w >> 1) - (thumbW >> 1); int thumbY = y + kLineHeight; @@ -183,7 +183,7 @@ void SaveLoadChooser::reflowLayout() { textLines++; _container->resize(x, y, w, h - (kLineHeight * textLines)); - _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); + _gfxWidget->resize(thumbX, thumbY, thumbW, thumbH); int height = thumbY + thumbH + kLineHeight; diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index c7b255cc1e..a1091ee70d 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -150,11 +150,11 @@ void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) { fslist.push_back(node); // Yup, also scan the dir itself for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { - + Entry th; if (isTheme(*i, th)) { bool add = true; - + for (ThList::const_iterator p = list.begin(); p != list.end(); ++p) { if (p->name == th.name || p->file == th.file) { add = false; @@ -163,14 +163,14 @@ void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) { } if (add) - list.push_back(th); + list.push_back(th); } } } bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) { - out.file = node.getPath(); - + out.file = node.getPath(); + #ifdef USE_ZLIB if (!out.file.hasSuffix(".zip") && !node.isDirectory()) return false; @@ -178,7 +178,7 @@ bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) { if (!node.isDirectory()) return false; #endif - + if (!ThemeEngine::themeConfigUseable(node, out.name)) return false; |