From 21989844a9800fe76af93c6b2d70ffd76bf73546 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 7 Aug 2008 10:53:33 +0000 Subject: Game Options menu parsing. Added support for importing layouts inside other layouts. Misc bugfixes. svn-id: r33676 --- gui/ThemeParser.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'gui/ThemeParser.cpp') diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 868b6fa9e7..eec0826a8f 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -458,6 +458,14 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) { var = node->values["name"]; int width = -1; int height = -1; + bool enabled = true; + + if (node->values.contains("enabled")) { + if (node->values["enabled"] == "false") + enabled = false; + else if (node->values["enabled"] != "true") + return parserError("Invalid value for Widget enabling (expecting true/false)"); + } if (node->values.contains("width")) { if (_theme->themeEval()->hasVar(node->values["width"]) == true) @@ -475,7 +483,7 @@ bool ThemeParser::parserCallback_widget(ParserNode *node) { return parserError("Corrupted height value in key for %s", var.c_str()); } - _theme->themeEval()->addWidget(var, width, height, node->values["type"]); + _theme->themeEval()->addWidget(var, width, height, node->values["type"], enabled); } return true; @@ -492,7 +500,16 @@ bool ThemeParser::parserCallback_child(ParserNode *node) { bool ThemeParser::parserCallback_dialog(ParserNode *node) { Common::String var = "Dialog." + node->values["name"]; - _theme->themeEval()->addDialog(var, node->values["overlays"]); + bool enabled = 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)"); + } + + _theme->themeEval()->addDialog(var, node->values["overlays"], enabled); if (node->values.contains("shading")) { int shading = 0; @@ -508,6 +525,13 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { return true; } +bool ThemeParser::parserCallback_import(ParserNode *node) { + + if (!_theme->themeEval()->addImportedLayout(node->values["layout"])) + return parserError("Error when importing external layout"); + return true; +} + bool ThemeParser::parserCallback_layout(ParserNode *node) { int spacing = -1; @@ -535,8 +559,6 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) { _theme->themeEval()->addPadding(paddingL, paddingR, paddingT, paddingB); } - - return true; } -- cgit v1.2.3