[Scummvm-cvs-logs] SF.net SVN: scummvm:[33616] scummvm/branches/gsoc2008-gui/gui
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Mon Aug 4 19:44:24 CEST 2008
Revision: 33616
http://scummvm.svn.sourceforge.net/scummvm/?rev=33616&view=rev
Author: Tanoku
Date: 2008-08-04 17:44:18 +0000 (Mon, 04 Aug 2008)
Log Message:
-----------
Layout parsing. Work in progress. Looks like a GUI!
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/gui/ThemeEval.h
scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeEval.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeEval.h 2008-08-04 17:41:07 UTC (rev 33615)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeEval.h 2008-08-04 17:44:18 UTC (rev 33616)
@@ -79,8 +79,8 @@
virtual const char *getName() { return "Global Layout"; }
- int16 getParentW() { return parent ? parent->w : g_system->getOverlayWidth(); }
- int16 getParentH() { return parent ? parent->w : g_system->getOverlayHeight(); }
+ int16 getParentW() { return parent ? parent->w - parent->paddingLeft - parent->paddingRight : g_system->getOverlayWidth(); }
+ int16 getParentH() { return parent ? parent->h - parent->paddingTop - parent->paddingBottom : g_system->getOverlayHeight(); }
int16 getParentX() { return parent ? parent->x : 0; }
int16 getParentY() { return parent ? parent->y : 0; }
@@ -209,18 +209,10 @@
const char *getName() { return "Horizontal Layout"; }
void reflowLayout() {
- int curX, curY, mul;
-
- if (parsingMode == kLayoutParseLeft2Right) {
- curX = paddingLeft;
- curY = paddingTop;
- mul = 1;
- } else {
- curX = getParentW() - paddingRight;
- curY = paddingTop;
- mul = -1;
- }
-
+ int curX, curY;
+
+ curX = paddingLeft;
+ curY = paddingTop;
w = paddingLeft + paddingRight;
for (uint i = 0; i < children.size(); ++i) {
@@ -235,15 +227,24 @@
assert(children[i]->h != -1);
- children[i]->setX((parsingMode == kLayoutParseRight2Left) ? (curX - children[i]->w) : (curX));
+ children[i]->setX(curX);
children[i]->setY(curY);
if (children[i]->h == -1)
children[i]->h = h - paddingTop - paddingBottom;
+
+ if (children[i]->w == -1)
+ children[i]->w = getParentW() - w - spacing;
h = MAX(h, (int16)(children[i]->h + paddingTop + paddingBottom));
-
- curX += (children[i]->w + spacing) * mul;
+
+ if (parsingMode == kLayoutParseRight2Left) {
+ for (int j = i - 1; j >= 0; --j)
+ children[j]->setX(children[i]->w + spacing);
+ } else {
+ curX += (children[i]->w + spacing);
+ }
+
w += children[i]->w + spacing;
}
}
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp 2008-08-04 17:41:07 UTC (rev 33615)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeParser.cpp 2008-08-04 17:44:18 UTC (rev 33616)
@@ -508,13 +508,19 @@
return parserError("Layouts need a specific type (vertical or horizontal).");
GUI::ThemeLayout::LayoutType type = GUI::ThemeLayout::kLayoutNone;
+ GUI::ThemeLayout::LayoutParsing parsing = GUI::ThemeLayout::kLayoutParseDefault;
if (node->values["type"] == "vertical")
type = GUI::ThemeLayout::kLayoutVertical;
else if (node->values["type"] == "horizontal")
type = GUI::ThemeLayout::kLayoutHorizontal;
+
+ if (node->values.contains("direction")) {
+ if (node->values["direction"] == "right2left")
+ parsing = GUI::ThemeLayout::kLayoutParseRight2Left;
+ }
- _theme->themeEval()->addLayout(type, GUI::ThemeLayout::kLayoutParseDefault);
+ _theme->themeEval()->addLayout(type, parsing);
return true;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list