diff options
author | Vicent Marti | 2008-08-01 10:18:47 +0000 |
---|---|---|
committer | Vicent Marti | 2008-08-01 10:18:47 +0000 |
commit | 9bd3b07647bfbd5016f06a4f055a4310b3269587 (patch) | |
tree | 0ebafb8d7d9d9275aac96282395972e46d099d0a /gui | |
parent | 7d797c878dd8f880a9e0045a93a3a7c44cb14c04 (diff) | |
download | scummvm-rg350-9bd3b07647bfbd5016f06a4f055a4310b3269587.tar.gz scummvm-rg350-9bd3b07647bfbd5016f06a4f055a4310b3269587.tar.bz2 scummvm-rg350-9bd3b07647bfbd5016f06a4f055a4310b3269587.zip |
Support for XML layout with unspecified keys.
XML Layout parsing. WIP.
svn-id: r33488
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeParser.cpp | 20 | ||||
-rw-r--r-- | gui/ThemeParser.h | 1 |
2 files changed, 17 insertions, 4 deletions
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index a7c310b5bc..4ac6a65932 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -446,7 +446,6 @@ bool ThemeParser::parserCallback_def(ParserNode *node) { bool ThemeParser::parserCallback_widget(ParserNode *node) { Common::String var; - int width, height, x, y, paddingL, paddingR, paddingT, paddingB; if (getParentNode(node)->name == "globals") var = "Globals." + node->values["name"] + "."; @@ -455,25 +454,38 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) { else assert(!"Corruption in XML parser."); + if (!parseCommonLayoutProps(node, var)) + return parserError("Error when parsing Layout properties of '%s'.", var.c_str()); + + 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)) - return parserError("Invalid definition for '%sSize'.", var.c_str()); + return false; _theme->themeEval()->setVar(var + "Width", width); _theme->themeEval()->setVar(var + "Height", height); } if (node->values.contains("pos")) { + int x, y; + if (!parseIntegerKey(node->values["pos"].c_str(), 2, &x, &y)) - return parserError("Invalid definition for '%sPosition'.", var.c_str()); + return false; _theme->themeEval()->setVar(var + "X", x); _theme->themeEval()->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 parserError("Invalid definition for '%sPadding'.", var.c_str()); + return false; _theme->themeEval()->setVar(var + "Padding.Left", paddingL); _theme->themeEval()->setVar(var + "Padding.Right", paddingR); diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index c9483fcc8d..c4e744c44c 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -468,6 +468,7 @@ protected: Graphics::DrawStep *newDrawStep(); Graphics::DrawStep *defaultDrawStep(); bool parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawstep, bool functionSpecific); + bool parseCommonLayoutProps(ParserNode *node, const Common::String &var); Graphics::DrawStep *_defaultStepGlobal; Graphics::DrawStep *_defaultStepLocal; |