From 39c28e434beb94addd9788e7ab7c4dd9d66ca12e Mon Sep 17 00:00:00 2001
From: Vicent Marti
Date: Thu, 7 Aug 2008 23:23:21 +0000
Subject: SCUMM general and options dialog. Misc fixes.
svn-id: r33692
---
gui/ThemeEval.cpp | 21 ++++++--
gui/ThemeEval.h | 4 +-
gui/ThemeParser.cpp | 8 ++-
gui/ThemeRenderer.cpp | 6 +--
gui/newgui.cpp | 11 -----
gui/object.h | 3 --
gui/themes/default.inc | 127 ++++++++++++++++++++++++++++++++++++++++++-----
gui/themes/modern.stx | 130 ++++++++++++++++++++++++++++++++++++++++++++-----
8 files changed, 260 insertions(+), 50 deletions(-)
(limited to 'gui')
diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp
index cadaf0ba6a..426ca4fc40 100644
--- a/gui/ThemeEval.cpp
+++ b/gui/ThemeEval.cpp
@@ -64,8 +64,17 @@ void ThemeLayoutMain::reflowLayout() {
_children[0]->setHeight(_h);
_children[0]->reflowLayout();
-// _children[0]->setX(_x);
-// _children[0]->setY(_y);
+ 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);
}
}
@@ -171,13 +180,15 @@ 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) {
int16 x, y;
- uint16 w, h;
+ int16 w, h;
- if (overlays == "screen" || overlays.empty()) {
+ if (overlays == "screen") {
x = y = 0;
w = g_system->getOverlayWidth();
h = g_system->getOverlayHeight();
- } else if (!getWidgetData(overlays, x, y, w, h)) {
+ } else if (overlays == "screen_center") {
+ x = y = w = h = -1;
+ } else if (!getWidgetData(overlays, x, y, (uint16&)w, (uint16&)h)) {
error("Error when loading dialog position for '%s'", overlays.c_str());
}
diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h
index c507e8a3df..ba6e3381ac 100644
--- a/gui/ThemeEval.h
+++ b/gui/ThemeEval.h
@@ -365,8 +365,8 @@ public:
}
void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) {
- _layouts["Dialog.GameOptions"]->debugDraw(screen, font);
- _layouts["Dialog.GameOptions_Graphics"]->debugDraw(screen, font);
+ _layouts["Dialog.ScummConfig"]->debugDraw(screen, font);
+// _layouts["Dialog.GameOptions_Graphics"]->debugDraw(screen, font);
}
private:
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 4d74750b39..010fcaeaf3 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -565,9 +565,13 @@ bool ThemeParser::parserCallback_layout(ParserNode *node) {
bool ThemeParser::parserCallback_space(ParserNode *node) {
int size = -1;
- if (node->values.contains("size"))
- if (!parseIntegerKey(node->values["size"].c_str(), 1, &size))
+ if (node->values.contains("size")) {
+ if (_theme->themeEval()->hasVar(node->values["size"]))
+ size = _theme->themeEval()->getVar(node->values["size"]);
+
+ else if (!parseIntegerKey(node->values["size"].c_str(), 1, &size))
return parserError("Invalid value for Spacing size.");
+ }
_theme->themeEval()->addSpace(size);
return true;
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index 454015d338..49e0d3bb35 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -718,9 +718,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/newgui.cpp b/gui/newgui.cpp
index e45c081e9b..9a0d8cef88 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -60,18 +60,7 @@ void GuiObject::reflowLayout() {
if (!_name.empty()) {
if (!g_gui.xmlEval()->getWidgetData(_name, _x, _y, _w, _h)) {
warning("Could not load widget position for '%s'", _name.c_str());
-
-// if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
-// error("Undefined variable %s.x", _name.c_str());
-// if ((_y = g_gui.evaluator()->getVar(_name + ".y")) == EVAL_UNDEF_VAR)
-// error("Undefined variable %s.y", _name.c_str());
-// _w = g_gui.evaluator()->getVar(_name + ".w");
-// _h = g_gui.evaluator()->getVar(_name + ".h");
- _w = _x = _y = _h = 32;
- _debugVisible = false;
}
-
- _debugVisible = true;
if (_x < 0)
error("Widget <%s> has x < 0: %d", _name.c_str(), _x);
diff --git a/gui/object.h b/gui/object.h
index 9e5ea5fa60..01046bd668 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -78,10 +78,7 @@ public:
virtual uint16 getWidth() const { return _w; }
virtual uint16 getHeight() const { return _h; }
-// Tanoku-TODO: fix this back
virtual bool isVisible() const = 0;
- bool _debugVisible;
-
virtual void draw() = 0;
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 9295e31a7d..1206ffc914 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -72,6 +72,16 @@
"gradient_end = '232, 192, 16' "
"/> "
" "
+" "
+" "
+" "
" "
" "
+" "
" "
" "
" "
" "
" "
" "
@@ -545,8 +557,7 @@
"type = 'Slider' "
"/> "
" "
" "
" "
@@ -557,8 +568,7 @@
"type = 'Slider' "
"/> "
" "
" "
" "
@@ -569,8 +579,7 @@
"type = 'Slider' "
"/> "
" "
" "
" "
@@ -606,8 +615,7 @@
"type = 'Slider' "
"/> "
" "
" "
" "
@@ -755,4 +763,99 @@
" "
" "
" "
+" "
+" "
" "
diff --git a/gui/themes/modern.stx b/gui/themes/modern.stx
index be55749806..26c0fcdfff 100644
--- a/gui/themes/modern.stx
+++ b/gui/themes/modern.stx
@@ -104,6 +104,17 @@
gradient_end = '232, 192, 16'
/>
+
+
+
+
+
@@ -612,8 +625,7 @@
type = 'Slider'
/>
@@ -624,8 +636,7 @@
type = 'Slider'
/>
@@ -636,8 +647,7 @@
type = 'Slider'
/>
@@ -674,8 +684,7 @@
type = 'Slider'
/>
@@ -832,4 +841,101 @@
+
+
+
+
\ No newline at end of file
--
cgit v1.2.3