diff options
author | Vicent Marti | 2008-08-05 09:54:36 +0000 |
---|---|---|
committer | Vicent Marti | 2008-08-05 09:54:36 +0000 |
commit | 70ef50343499ee6736389a0cad006ea6eeeca5bd (patch) | |
tree | e0028232162506214317b6cdce0be43fc0ff531e | |
parent | dd46f8305e5c430b3af5511e81f621262149380d (diff) | |
download | scummvm-rg350-70ef50343499ee6736389a0cad006ea6eeeca5bd.tar.gz scummvm-rg350-70ef50343499ee6736389a0cad006ea6eeeca5bd.tar.bz2 scummvm-rg350-70ef50343499ee6736389a0cad006ea6eeeca5bd.zip |
Massive refactoring on the layout parsing API.
Added support for layout spacings.
Fixed bug in theme conversion python script.
svn-id: r33630
-rw-r--r-- | common/xmlparser.h | 2 | ||||
-rw-r--r-- | dists/msvc9/scummvm.vcproj | 4 | ||||
-rw-r--r-- | gui/ThemeEval.h | 373 | ||||
-rw-r--r-- | gui/ThemeParser.cpp | 33 | ||||
-rw-r--r-- | gui/ThemeParser.h | 6 | ||||
-rw-r--r-- | gui/ThemeRenderer.h | 2 | ||||
-rw-r--r-- | gui/module.mk | 1 | ||||
-rw-r--r-- | gui/newgui.h | 3 | ||||
-rw-r--r-- | gui/theme.h | 2 | ||||
-rw-r--r-- | gui/themes/default.inc | 2 | ||||
-rw-r--r-- | gui/themes/makedeftheme.py | 3 | ||||
-rw-r--r-- | gui/themes/modern.stx | 2 |
12 files changed, 171 insertions, 262 deletions
diff --git a/common/xmlparser.h b/common/xmlparser.h index 0510ec0ab6..2f73b5905d 100644 --- a/common/xmlparser.h +++ b/common/xmlparser.h @@ -504,7 +504,7 @@ protected: while (isValidNameChar(_text[_pos])) _token += _text[_pos++]; - return isspace(_text[_pos]) != 0 || _text[_pos] == '>' || _text[_pos] == '='; + return isspace(_text[_pos]) != 0 || _text[_pos] == '>' || _text[_pos] == '=' || _text[_pos] == '/'; } /** diff --git a/dists/msvc9/scummvm.vcproj b/dists/msvc9/scummvm.vcproj index 5da3451ded..1a6d3519c8 100644 --- a/dists/msvc9/scummvm.vcproj +++ b/dists/msvc9/scummvm.vcproj @@ -1244,6 +1244,10 @@ > </File> <File + RelativePath="..\..\gui\ThemeEval.cpp" + > + </File> + <File RelativePath="..\..\gui\ThemeRenderer.h" > </File> diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index 2c57e2732c..87af99c944 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -40,227 +40,179 @@ namespace GUI { class ThemeLayout { -public: - int16 x, y, w, h; - int paddingTop, paddingBottom, paddingLeft, paddingRight; - int spacing; - Common::Array<ThemeLayout*> children; - ThemeLayout *parent; - uint16 debugcolor; - +public: enum LayoutType { - kLayoutNone, + kLayoutMain, kLayoutVertical, kLayoutHorizontal, kLayoutWidget }; - enum LayoutParsing { - kLayoutParseDefault, - kLayoutParseTop2Bottom, - kLayoutParseBottom2Top, - kLayoutParseLeft2Right, - kLayoutParseRight2Left - } parsingMode; + ThemeLayout(ThemeLayout *p, const Common::String &name) : + _parent(p), _name(name), _x(0), _y(0), _w(-1), _h(-1), _reverse(false), + _paddingLeft(0), _paddingRight(0), _paddingTop(0), _paddingBottom(0) { } + + virtual ~ThemeLayout() { + _children.clear(); + } + + virtual void reflowLayout() = 0; + + void addChild(ThemeLayout *child) { _children.push_back(child); } + + void setPadding(int8 left, int8 right, int8 top, int8 bottom) { + _paddingLeft = left; + _paddingRight = right; + _paddingTop = top; + _paddingBottom = bottom; + } - virtual LayoutType getLayoutType() { return kLayoutNone; } - virtual void reflowLayout() { - assert(children.size() <= 1); + void setSpacing(int8 spacing) { + _spacing = spacing; + } + + int16 getParentX() { return _parent ? _parent->_x : 0; } + int16 getParentY() { return _parent ? _parent->_y : 0; } + + int16 getParentW() { + ThemeLayout *p = _parent; + int width = 0; - if (children.size()) { - children[0]->w = w; - children[0]->h = h; - children[0]->reflowLayout(); - children[0]->setX(0); - children[0]->setY(0); + while (p && p->getLayoutType() != kLayoutMain) { + width += p->_paddingRight + p->_paddingLeft; + if (p->getLayoutType() == kLayoutHorizontal) { + for (uint i = 0; i < p->_children.size(); ++i) + if (p->_children[i]->getLayoutType() == kLayoutWidget) + width += p->_children[i]->getHeight() + p->_spacing; + } + p = p->_parent; } + + return p->getWidth() - width; } - virtual const char *getName() { return "Global Layout"; } + int16 getParentH() { + ThemeLayout *p = _parent; + int height = 0; + + while (p && p->getLayoutType() != kLayoutMain) { + height += p->_paddingBottom + p->_paddingTop; + if (p->getLayoutType() == kLayoutVertical) { + for (uint i = 0; i < p->_children.size(); ++i) + if (p->_children[i]->getLayoutType() == kLayoutWidget) + height += p->_children[i]->getHeight() + p->_spacing; + } + p = p->_parent; + } + + return p->getHeight() - height; + } - 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; } + int16 getX() { return _x; } + int16 getY() { return _y; } + int16 getWidth() { return _w; } + int16 getHeight() { return _h; } void setX(int newX) { - x += newX; - for (uint i = 0; i < children.size(); ++i) - children[i]->setX(newX); + _x += newX; + for (uint i = 0; i < _children.size(); ++i) + _children[i]->setX(newX); } void setY(int newY) { - y += newY; - for (uint i = 0; i < children.size(); ++i) - children[i]->setY(newY); + _y += newY; + for (uint i = 0; i < _children.size(); ++i) + _children[i]->setY(newY); } - ThemeLayout(ThemeLayout *p) : parent(p), x(0), y(0), w(-1), h(-1) { debugcolor = rand() % 0xFFFF; } + void setWidth(int16 width) { _w = width; } + void setHeight(int16 height) { _h = height; } - virtual void debugPrintIndent(int indent) { - while (indent--) - printf(" "); - } - void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) { - uint16 color = debugcolor; - font->drawString(screen, getName(), x, y, w, color, Graphics::kTextAlignRight, 0, true); - screen->hLine(x, y, x + w, color); - screen->hLine(x, y + h, x + w, color); - screen->vLine(x, y, y + h, color); - screen->vLine(x + w, y, y + h, color); + uint16 color = 0xFFFF; + font->drawString(screen, getName(), _x, _y, _w, color, Graphics::kTextAlignRight, 0, true); + screen->hLine(_x, _y, _x + _w, color); + screen->hLine(_x, _y + _h, _x + _w , color); + screen->vLine(_x, _y, _y + _h, color); + screen->vLine(_x + _w, _y, _y + _h, color); - for (uint i = 0; i < children.size(); ++i) - children[i]->debugDraw(screen, font); + for (uint i = 0; i < _children.size(); ++i) + _children[i]->debugDraw(screen, font); } - virtual void debugPrint(int indent = 0) { - debugPrintIndent(indent); - switch (getLayoutType()) { - case kLayoutNone: - printf("Dialog Layout :: "); - break; - - case kLayoutVertical: - printf("Vertical Layout :: "); - break; - - case kLayoutHorizontal: - printf("Horizontal Layout :: "); - break; - - case kLayoutWidget: - printf("WIDGET (%s) :: ", getName()); - break; - } + virtual LayoutType getLayoutType() = 0; + virtual const char *getName() { return _name.c_str(); } - printf("X: %d / Y: %d / W: %d / H: %d\n", x, y, w, h); - - for (uint i = 0; i < children.size(); ++i) - children[i]->debugPrint(indent + 1); - } + virtual bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h); - virtual ~ThemeLayout() { - children.clear(); - } +protected: + int16 _x, _y, _w, _h; + int8 _paddingTop, _paddingBottom, _paddingLeft, _paddingRight; + int8 _spacing; + Common::Array<ThemeLayout*> _children; + ThemeLayout *_parent; + bool _reverse; + Common::String _name; }; -class ThemeLayoutVertical : public ThemeLayout { +class ThemeLayoutMain : public ThemeLayout { public: - LayoutType getLayoutType() { return kLayoutVertical; } - - ThemeLayoutVertical(ThemeLayout *p) : ThemeLayout(p) {} - - const char *getName() { return "Vertical Layout"; } - - void reflowLayout() { - int curX, curY, mul; - - if (parsingMode == kLayoutParseTop2Bottom) { - curX = paddingLeft; - curY = paddingTop; - mul = 1; - } else { - curX = paddingLeft; - curY = getParentH() - paddingBottom; - mul = -1; - } + ThemeLayoutMain() : ThemeLayout(0, "") {} + void reflowLayout(); + const char *getName() { return "Global Layout"; } + LayoutType getLayoutType() { return kLayoutMain; } +}; - h = paddingTop + paddingBottom; - - for (uint i = 0; i < children.size(); ++i) { - assert(children[i]->getLayoutType() != kLayoutVertical); - - children[i]->reflowLayout(); - - if (i != children.size() - 1) - assert(children[i]->h != -1); - - if (i == 0) - assert(children[i]->w != -1); - - children[i]->setX(curX); - children[i]->setY((parsingMode == kLayoutParseBottom2Top) ? curY - children[i]->h : curY); - - if (children[i]->w == -1) - children[i]->w = w - paddingLeft - paddingRight; - - w = MAX(w, (int16)(children[i]->w + paddingLeft + paddingRight)); - - if (children[i]->h == -1) - children[i]->h = 32; - - h += children[i]->h + spacing; - - curY += (children[i]->h + spacing) * mul; - } - - +class ThemeLayoutVertical : public ThemeLayout { +public: + ThemeLayoutVertical(ThemeLayout *p, int spacing, bool reverse) : ThemeLayout(p, "") { + _spacing = spacing; + _reverse = reverse; } + + void reflowLayout(); + const char *getName() { return "Vertical Layout"; } + LayoutType getLayoutType() { return kLayoutVertical; } }; class ThemeLayoutHorizontal : public ThemeLayout { public: - LayoutType getLayoutType() { return kLayoutHorizontal; } - - ThemeLayoutHorizontal(ThemeLayout *p) : ThemeLayout(p) {} - - const char *getName() { return "Horizontal Layout"; } - - void reflowLayout() { - int curX, curY; - - curX = paddingLeft; - curY = paddingTop; - w = paddingLeft + paddingRight; - - for (uint i = 0; i < children.size(); ++i) { - assert(children[i]->getLayoutType() != kLayoutHorizontal); - - children[i]->reflowLayout(); - - if (i != children.size() - 1) - assert(children[i]->w != -1); - - if (i == 0) - assert(children[i]->h != -1); - - - 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)); - - 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; - } + ThemeLayoutHorizontal(ThemeLayout *p, int spacing, bool reverse) : + ThemeLayout(p, "") { + _spacing = spacing; + _reverse = reverse; } + + void reflowLayout(); + const char *getName() { return "Horizontal Layout"; } + LayoutType getLayoutType() { return kLayoutHorizontal; } }; class ThemeLayoutWidget : public ThemeLayout { public: + ThemeLayoutWidget(ThemeLayout *p, const Common::String &name) : ThemeLayout(p, name) {} + bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h); + void reflowLayout() {} LayoutType getLayoutType() { return kLayoutWidget; } - void reflowLayout() { - +}; + +class ThemeLayoutSpacing : public ThemeLayout { +public: + ThemeLayoutSpacing(ThemeLayout *p, int size) : ThemeLayout(p, "") { + if (p->getLayoutType() == kLayoutHorizontal) { + _w = size; + _h = 1; + } else if (p->getLayoutType() == kLayoutVertical) { + _w = 1; + _h = size; + } } - ThemeLayoutWidget(ThemeLayout *p, const Common::String &name) : ThemeLayout(p), widgetName(name) {} - const char *getName() { return widgetName.c_str(); } - - Common::String widgetName; + bool getWidgetData(const Common::String &name, int16 &x, int16 &y, int16 &w, int16 &h) { return false; } + void reflowLayout() {} + LayoutType getLayoutType() { return kLayoutWidget; } + const char *getName() { return "SPACE"; } }; class ThemeEval { @@ -275,7 +227,7 @@ public: int getVar(const Common::String &s) { if (!_vars.contains(s)) { warning("Missing variable: '%s'", s.c_str()); - return -1; + return -13375; //EVAL_UNDEF_VAR } return _vars[s]; @@ -289,66 +241,15 @@ public: bool hasVar(const Common::String &name) { return _vars.contains(name); } - void addDialog(const Common::String &name) { - ThemeLayout *layout = new ThemeLayout(0); - _layouts[name] = layout; - - layout->x = 0; - layout->y = 0; - layout->w = g_system->getOverlayWidth(); - layout->h = g_system->getOverlayHeight(); - - layout->paddingBottom = getVar("Globals.Padding.Bottom", 0); - layout->paddingTop = getVar("Globals.Padding.Top", 0); - layout->paddingRight = getVar("Globals.Padding.Right", 0); - layout->paddingLeft = getVar("Globals.Padding.Left", 0); - - _curLayout.push(layout); - } - - void addLayout(ThemeLayout::LayoutType type, ThemeLayout::LayoutParsing parsingMode) { - ThemeLayout *layout = 0; - ThemeLayout::LayoutParsing def = ThemeLayout::kLayoutParseDefault; - - if (type == ThemeLayout::kLayoutVertical) { - layout = new ThemeLayoutVertical(_curLayout.top()); - def = ThemeLayout::kLayoutParseTop2Bottom; - } else if (type == ThemeLayout::kLayoutHorizontal) { - layout = new ThemeLayoutHorizontal(_curLayout.top()); - def = ThemeLayout::kLayoutParseLeft2Right; - } - - layout->parsingMode = (parsingMode == ThemeLayout::kLayoutParseDefault) ? def : parsingMode; - layout->paddingBottom = getVar("Globals.Padding.Bottom", 0); - layout->paddingTop = getVar("Globals.Padding.Top", 0); - layout->paddingRight = getVar("Globals.Padding.Right", 0); - layout->paddingLeft = getVar("Globals.Padding.Left", 0); - - layout->spacing = 4; - - _curLayout.top()->children.push_back(layout); - _curLayout.push(layout); - } + void addDialog(const Common::String &name); + void addLayout(ThemeLayout::LayoutType type, bool reverse); + void addWidget(const Common::String &name, int w, int h); + void addSpacing(int size); - void closeLayout() { - _curLayout.pop(); - } + void closeLayout() { _curLayout.pop(); } + void closeDialog() { _curLayout.pop()->reflowLayout(); } - void closeDialog() { - _curLayout.top()->reflowLayout(); - printf("DEBUG LAYOUT PRINT:\n"); - - _curLayout.top()->debugPrint(); - } - void addWidget(const Common::String &name, int w, int h) { - ThemeLayoutWidget *widget = new ThemeLayoutWidget(_curLayout.top(), name); - - widget->w = w; - widget->h = h; - - _curLayout.top()->children.push_back(widget); - } void debugPrint() { printf("Debug variable list:\n"); @@ -360,7 +261,7 @@ public: } void debugDraw(Graphics::Surface *screen, const Graphics::Font *font) { - _curLayout.top()->debugDraw(screen, font); + _layouts["Dialog.Launcher"]->debugDraw(screen, font); } private: diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 982a2b59ae..889acfedba 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -492,11 +492,7 @@ bool ThemeParser::parserCallback_child(ParserNode *node) { } bool ThemeParser::parserCallback_dialog(ParserNode *node) { - Common::String var = "Dialog." + node->values["name"] + "."; - -// if (!parseCommonLayoutProps(node, var)) -// return parserError("Error when parsing Layout properties of '%s'.", var.c_str()); - + Common::String var = "Dialog." + node->values["name"]; _theme->themeEval()->addDialog(var); return true; @@ -504,23 +500,22 @@ bool ThemeParser::parserCallback_dialog(ParserNode *node) { bool ThemeParser::parserCallback_layout(ParserNode *node) { - if (!node->values.contains("type")) - 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; + _theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutVertical, node->values["direction"] == "bottom2top"); else if (node->values["type"] == "horizontal") - type = GUI::ThemeLayout::kLayoutHorizontal; + _theme->themeEval()->addLayout(GUI::ThemeLayout::kLayoutHorizontal, node->values["direction"] == "right2left"); - if (node->values.contains("direction")) { - if (node->values["direction"] == "right2left") - parsing = GUI::ThemeLayout::kLayoutParseRight2Left; - } - - _theme->themeEval()->addLayout(type, parsing); + return true; +} + +bool ThemeParser::parserCallback_space(ParserNode *node) { + int size = -1; + + if (node->values.contains("size")) + if (!parseIntegerKey(node->values["size"].c_str(), 1, &size)) + return parserError("Invalid value for Spacing size."); + + _theme->themeEval()->addSpacing(size); return true; } diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h index 07bb530894..e94e8cbc8e 100644 --- a/gui/ThemeParser.h +++ b/gui/ThemeParser.h @@ -439,6 +439,8 @@ protected: XML_PROP(type, true) XML_PROP(align, false) XML_PROP(direction, false) + XML_PROP(padding, false) + XML_PROP(spacing, false) XML_KEY(widget) XML_PROP(name, true) XML_PROP(width, false) @@ -446,7 +448,7 @@ protected: KEY_END() XML_KEY(space) - XML_PROP(size, true) + XML_PROP(size, false) KEY_END() XML_KEY_RECURSIVE(layout) @@ -475,7 +477,7 @@ protected: bool parserCallback_dialog(ParserNode *node); bool parserCallback_child(ParserNode *node); bool parserCallback_layout(ParserNode *node); - bool parserCallback_space(ParserNode *node) { return true; } + bool parserCallback_space(ParserNode *node); bool closedKeyCallback(ParserNode *node); diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h index 7c18f73fea..35d2f31d40 100644 --- a/gui/ThemeRenderer.h +++ b/gui/ThemeRenderer.h @@ -412,6 +412,8 @@ public: void finishBuffering() { _buffering = false; } + + void *evaluator() { return _themeEval; } protected: diff --git a/gui/module.mk b/gui/module.mk index 4afe11201a..0711f236a4 100644 --- a/gui/module.mk +++ b/gui/module.mk @@ -24,6 +24,7 @@ MODULE_OBJS := \ themebrowser.o \ widget.o \ theme.o \ + ThemeEval.o \ ThemeClassic.o \ ThemeModern.o \ ThemeParser.o \ diff --git a/gui/newgui.h b/gui/newgui.h index ae58b2efe8..5fabe4ea1f 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -39,6 +39,7 @@ namespace GUI { class Dialog; class Eval; +class ThemeEval; #define g_gui (GUI::NewGui::instance()) @@ -77,7 +78,9 @@ public: bool loadNewTheme(const Common::String &file); Theme *theme() { return _theme; } + Eval *evaluator() { return _theme->_evaluator; } + ThemeEval *xmlEval() { return (ThemeEval*)_theme->evaluator(); } const Graphics::Font &getFont(Theme::FontStyle style = Theme::kFontStyleBold) const { return *(_theme->getFont(style)); } int getFontHeight(Theme::FontStyle style = Theme::kFontStyleBold) const { return _theme->getFontHeight(style); } diff --git a/gui/theme.h b/gui/theme.h index f8a4946a6b..0d0fadb8ad 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -365,6 +365,8 @@ public: void loadTheme(Common::ConfigFile &config, bool reset = true); void loadTheme(Common::ConfigFile &config, bool reset, bool doBackendSpecificPostProcessing); Eval *_evaluator; + + virtual void *evaluator() { return (void*)_evaluator; } static bool themeConfigUseable(const Common::String &file, const Common::String &style="", Common::String *cStyle=0, Common::ConfigFile *cfg=0); diff --git a/gui/themes/default.inc b/gui/themes/default.inc index fb5bd8dcf3..04fd941819 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1 +1 @@ -" <render_info> <palette> <color name = 'darkred' rgb = '168, 42, 12' /> <color name = 'brightred' rgb = '200, 124, 104' /> <color name = 'xtrabrightred' rgb = '251, 241, 206' /> <color name = 'blandyellow' rgb = '247, 228, 166' /> <color name = 'bgreen' rgb = '96, 160, 8' /> <color name = 'blue' rgb = '0, 255, 255' /> <color name = 'black' rgb = '0, 0, 0' /> <color name = 'white' rgb = '255, 255, 255' /> <color name = 'shadowcolor' rgb = '63, 60, 17' /> </palette> <fonts> <font id = 'text_default' type = 'default' color = 'black' /> <font id = 'text_hover' type = 'default' color = 'bgreen' /> <font id = 'text_disabled' type = 'default' color = '128, 128, 128' /> <font id = 'text_inverted' type = 'default' color = '0, 0, 0' /> <font id = 'text_button' type = 'default' color = 'white' /> <font id = 'text_button_hover' type = 'default' color = 'blandyellow' /> </fonts> <defaults fill = 'gradient' fg_color = 'white' bevel_color = '237, 169, 72'/> <drawdata id = 'text_selection' cache = false> <drawstep func = 'square' fill = 'foreground' fg_color = 'bgreen' /> </drawdata> <drawdata id = 'mainmenu_bg' cache = false> <drawstep func = 'fill' fill = 'gradient' gradient_start = '208, 112, 8' gradient_end = '232, 192, 16' /> </drawdata> <drawdata id = 'separator' cache = false> <drawstep func = 'square' fill = 'foreground' height = '1' ypos = 'center' fg_color = 'black' /> </drawdata> <drawdata id = 'scrollbar_base' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'background' fg_color = '176, 164, 160' bg_color = '240, 228, 160' /> </drawdata> <drawdata id = 'scrollbar_handle_hover' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'gradient' fg_color = 'blandyellow' gradient_start = 'xtrabrightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'scrollbar_handle_idle' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'gradient' fg_color = 'blandyellow' gradient_start = 'brightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'scrollbar_button_idle' cache = false> <drawstep func = 'roundedsq' radius = '4' fill = 'none' fg_color = '176, 164, 160' stroke = 1 /> <drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' /> </drawdata> <drawdata id = 'scrollbar_button_hover' cache = false> <drawstep func = 'roundedsq' radius = '4' fill = 'background' fg_color = '120, 120, 120' bg_color = '206, 121, 99' stroke = 1 /> <drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' /> </drawdata> <drawdata id = 'tab_active' cache = false> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'tab' radius = '4' stroke = '0' fill = 'gradient' gradient_end = 'xtrabrightred' gradient_start = 'blandyellow' shadow = 3 /> </drawdata> <drawdata id = 'tab_inactive' cache = false> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'tab' radius = '4' stroke = '0' fill = 'foreground' fg_color = '240, 205, 118' shadow = 3 /> </drawdata> <drawdata id = 'tab_background' cache = false> <drawstep func = 'tab' radius = '8' stroke = '0' fill = 'foreground' fg_color = '232, 180, 81' shadow = 3 /> </drawdata> <drawdata id = 'widget_slider' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'foreground' fg_color = 'blandyellow' bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'slider_full' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 4 fill = 'gradient' fg_color = '123, 112, 56' gradient_start = 'brightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'slider_hover' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 4 fill = 'gradient' fg_color = '123, 112, 56' gradient_start = 'xtrabrightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'popup_idle' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'foreground' fg_color = '250, 237, 190' shadow = 2 /> <drawstep func = 'triangle' fg_color = '63, 60, 52' fill = 'foreground' width = 'height' height = 'auto' xpos = 'right' ypos = 'center' orientation = 'bottom' /> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'right' /> </drawdata> <drawdata id = 'popup_hover' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'gradient' gradient_start = 'blandyellow' gradient_end = '250, 237, 190' shadow = 0 /> <drawstep func = 'triangle' fg_color = '63, 60, 52' fill = 'foreground' width = 'height' height = 'auto' xpos = 'right' ypos = 'center' orientation = 'bottom' /> <text font = 'text_hover' vertical_align = 'center' horizontal_align = 'right' /> </drawdata> <drawdata id = 'default_bg' cache = false> <drawstep func = 'roundedsq' radius = 12 stroke = 0 fg_color = 'xtrabrightred' fill = 'foreground' shadow = 3 /> </drawdata> <drawdata id = 'button_idle' cache = false> <text font = 'text_button' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '6' stroke = 1 fill = 'gradient' shadow = 0 fg_color = 'shadowcolor' gradient_start = 'brightred' gradient_end = 'darkred' bevel = 1 /> </drawdata> <drawdata id = 'button_hover' cache = false> <text font = 'text_button_hover' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '6' gradient_factor = 1 stroke = 1 fill = 'gradient' shadow = 0 fg_color = 'shadowcolor' gradient_start = 'xtrabrightred' gradient_end = 'darkred' bevel_color = 'xtrabrightred' bevel = 1 /> </drawdata> <drawdata id = 'button_disabled' cache = false> <text font = 'text_disabled' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '8' stroke = 0 fill = 'foreground' fg_color = '200, 200, 200' shadow = 3 /> </drawdata> <drawdata id = 'checkbox_disabled' cache = false> <text font = 'text_disabled' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'none' radius = 4 fg_color = 'black' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'checkbox_selected' cache = false> <text font = 'text_default' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'gradient' radius = 4 fg_color = 'white' gradient_start = 'brightred' gradient_end = 'darkred' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'checkbox_default' cache = false> <text font = 'text_default' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'foreground' radius = 4 fg_color = 'blandyellow' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'widget_default' cache = false> <drawstep func = 'roundedsq' gradient_factor = 6 radius = '8' fill = 'gradient' gradient_start = '240, 224, 136' gradient_end = 'xtrabrightred' shadow = 3 /> </drawdata> </render_info> <layout_info> <globals> <def var = 'Widget.Size' value = '32' /> <def var = 'Line.Height' value = '16' /> <def var = 'Font.Height' value = '16' /> <def var = 'Padding.Bottom' value = '16' /> <def var = 'Padding.Left' value = '16' /> <def var = 'Padding.Right' value = '16' /> <def var = 'Padding.Top' value = '16' /> <widget name = 'Inset' pos = '23, 94' size = '666, 666' /> <widget name = 'Button' size = '120, 25' /> <widget name = 'Slider' size = '666, 666' /> <widget name = 'ListWidget' padding = '7, 5, 5, 5' /> <widget name = 'PopUpWidget' padding = '7, 5, 0, 0' /> <widget name = 'EditTextWidget' padding = '7, 5, 0, 0' /> <widget name = 'Console' padding = '7, 5, 5, 5' /> <widget name = 'TabWidget'> <child name = 'Tab' size = '75, 27' padding = '0, 0, 8, 0' /> <child name = 'NavButton' size = '15, 18' padding = '0, 3, 4, 0' /> </widget> </globals> <dialog name = 'Launcher'> <layout type = 'vertical' align = 'center'> <widget name = 'Version' width = '247' height = 'Globals.Line.Height' /> <widget name = 'Logo' width = '283' height = '80' /> <layout type = 'horizontal' direction = 'right2left'> <layout type = 'vertical'> <widget name = 'StartButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <space size = 20 /> <widget name = 'AddGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'EditGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'RemoveGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'OptionsButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'AboutButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'QuittButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> </layout> <widget name = 'GameList'/> </layout> </layout> </dialog> </layout_info> " +" <render_info> <palette> <color name = 'darkred' rgb = '168, 42, 12' /> <color name = 'brightred' rgb = '200, 124, 104' /> <color name = 'xtrabrightred' rgb = '251, 241, 206' /> <color name = 'blandyellow' rgb = '247, 228, 166' /> <color name = 'bgreen' rgb = '96, 160, 8' /> <color name = 'blue' rgb = '0, 255, 255' /> <color name = 'black' rgb = '0, 0, 0' /> <color name = 'white' rgb = '255, 255, 255' /> <color name = 'shadowcolor' rgb = '63, 60, 17' /> </palette> <fonts> <font id = 'text_default' type = 'default' color = 'black' /> <font id = 'text_hover' type = 'default' color = 'bgreen' /> <font id = 'text_disabled' type = 'default' color = '128, 128, 128' /> <font id = 'text_inverted' type = 'default' color = '0, 0, 0' /> <font id = 'text_button' type = 'default' color = 'white' /> <font id = 'text_button_hover' type = 'default' color = 'blandyellow' /> </fonts> <defaults fill = 'gradient' fg_color = 'white' bevel_color = '237, 169, 72'/> <drawdata id = 'text_selection' cache = false> <drawstep func = 'square' fill = 'foreground' fg_color = 'bgreen' /> </drawdata> <drawdata id = 'mainmenu_bg' cache = false> <drawstep func = 'fill' fill = 'gradient' gradient_start = '208, 112, 8' gradient_end = '232, 192, 16' /> </drawdata> <drawdata id = 'separator' cache = false> <drawstep func = 'square' fill = 'foreground' height = '1' ypos = 'center' fg_color = 'black' /> </drawdata> <drawdata id = 'scrollbar_base' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'background' fg_color = '176, 164, 160' bg_color = '240, 228, 160' /> </drawdata> <drawdata id = 'scrollbar_handle_hover' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'gradient' fg_color = 'blandyellow' gradient_start = 'xtrabrightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'scrollbar_handle_idle' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 6 fill = 'gradient' fg_color = 'blandyellow' gradient_start = 'brightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'scrollbar_button_idle' cache = false> <drawstep func = 'roundedsq' radius = '4' fill = 'none' fg_color = '176, 164, 160' stroke = 1 /> <drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' /> </drawdata> <drawdata id = 'scrollbar_button_hover' cache = false> <drawstep func = 'roundedsq' radius = '4' fill = 'background' fg_color = '120, 120, 120' bg_color = '206, 121, 99' stroke = 1 /> <drawstep func = 'triangle' fg_color = '0, 0, 0' fill = 'foreground' width = 'auto' height = 'auto' xpos = 'center' ypos = 'center' orientation = 'top' /> </drawdata> <drawdata id = 'tab_active' cache = false> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'tab' radius = '4' stroke = '0' fill = 'gradient' gradient_end = 'xtrabrightred' gradient_start = 'blandyellow' shadow = 3 /> </drawdata> <drawdata id = 'tab_inactive' cache = false> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'tab' radius = '4' stroke = '0' fill = 'foreground' fg_color = '240, 205, 118' shadow = 3 /> </drawdata> <drawdata id = 'tab_background' cache = false> <drawstep func = 'tab' radius = '8' stroke = '0' fill = 'foreground' fg_color = '232, 180, 81' shadow = 3 /> </drawdata> <drawdata id = 'widget_slider' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'foreground' fg_color = 'blandyellow' bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'slider_full' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 4 fill = 'gradient' fg_color = '123, 112, 56' gradient_start = 'brightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'slider_hover' cache = false> <drawstep func = 'roundedsq' stroke = 1 radius = 4 fill = 'gradient' fg_color = '123, 112, 56' gradient_start = 'xtrabrightred' gradient_end = 'darkred' /> </drawdata> <drawdata id = 'popup_idle' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'foreground' fg_color = '250, 237, 190' shadow = 2 /> <drawstep func = 'triangle' fg_color = '63, 60, 52' fill = 'foreground' width = 'height' height = 'auto' xpos = 'right' ypos = 'center' orientation = 'bottom' /> <text font = 'text_default' vertical_align = 'center' horizontal_align = 'right' /> </drawdata> <drawdata id = 'popup_hover' cache = false> <drawstep func = 'roundedsq' stroke = 0 radius = 4 fill = 'gradient' gradient_start = 'blandyellow' gradient_end = '250, 237, 190' shadow = 0 /> <drawstep func = 'triangle' fg_color = '63, 60, 52' fill = 'foreground' width = 'height' height = 'auto' xpos = 'right' ypos = 'center' orientation = 'bottom' /> <text font = 'text_hover' vertical_align = 'center' horizontal_align = 'right' /> </drawdata> <drawdata id = 'default_bg' cache = false> <drawstep func = 'roundedsq' radius = 12 stroke = 0 fg_color = 'xtrabrightred' fill = 'foreground' shadow = 3 /> </drawdata> <drawdata id = 'button_idle' cache = false> <text font = 'text_button' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '6' stroke = 1 fill = 'gradient' shadow = 0 fg_color = 'shadowcolor' gradient_start = 'brightred' gradient_end = 'darkred' bevel = 1 /> </drawdata> <drawdata id = 'button_hover' cache = false> <text font = 'text_button_hover' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '6' gradient_factor = 1 stroke = 1 fill = 'gradient' shadow = 0 fg_color = 'shadowcolor' gradient_start = 'xtrabrightred' gradient_end = 'darkred' bevel_color = 'xtrabrightred' bevel = 1 /> </drawdata> <drawdata id = 'button_disabled' cache = false> <text font = 'text_disabled' vertical_align = 'center' horizontal_align = 'center' /> <drawstep func = 'roundedsq' radius = '8' stroke = 0 fill = 'foreground' fg_color = '200, 200, 200' shadow = 3 /> </drawdata> <drawdata id = 'checkbox_disabled' cache = false> <text font = 'text_disabled' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'none' radius = 4 fg_color = 'black' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'checkbox_selected' cache = false> <text font = 'text_default' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'gradient' radius = 4 fg_color = 'white' gradient_start = 'brightred' gradient_end = 'darkred' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'checkbox_default' cache = false> <text font = 'text_default' vertical_align = 'top' horizontal_align = 'left' /> <drawstep func = 'roundedsq' fill = 'foreground' radius = 4 fg_color = 'blandyellow' shadow = 0 bevel = 1 bevel_color = 'shadowcolor' /> </drawdata> <drawdata id = 'widget_default' cache = false> <drawstep func = 'roundedsq' gradient_factor = 6 radius = '8' fill = 'gradient' gradient_start = '240, 224, 136' gradient_end = 'xtrabrightred' shadow = 3 /> </drawdata> </render_info> <layout_info> <globals> <def var = 'Widget.Size' value = '32' /> <def var = 'Line.Height' value = '16' /> <def var = 'Font.Height' value = '16' /> <def var = 'Padding.Bottom' value = '16' /> <def var = 'Padding.Left' value = '16' /> <def var = 'Padding.Right' value = '16' /> <def var = 'Padding.Top' value = '16' /> <widget name = 'Inset' pos = '23, 94' size = '666, 666' /> <widget name = 'Button' size = '120, 25' /> <widget name = 'Slider' size = '666, 666' /> <widget name = 'ListWidget' padding = '7, 5, 5, 5' /> <widget name = 'PopUpWidget' padding = '7, 5, 0, 0' /> <widget name = 'EditTextWidget' padding = '7, 5, 0, 0' /> <widget name = 'Console' padding = '7, 5, 5, 5' /> <widget name = 'TabWidget'> <child name = 'Tab' size = '75, 27' padding = '0, 0, 8, 0' /> <child name = 'NavButton' size = '15, 18' padding = '0, 3, 4, 0' /> </widget> </globals> <dialog name = 'Launcher'> <layout type = 'vertical' align = 'center'> <widget name = 'Version' width = '247' height = 'Globals.Line.Height' /> <widget name = 'Logo' width = '283' height = '80' /> <layout type = 'horizontal' direction = 'right2left'> <layout type = 'vertical'> <widget name = 'StartButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'AddGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'EditGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'RemoveGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'OptionsButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'AboutButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <widget name = 'QuittButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> <space/> </layout> <widget name = 'GameList'/> </layout> </layout> </dialog> </layout_info> " diff --git a/gui/themes/makedeftheme.py b/gui/themes/makedeftheme.py index fc09e6b1f0..f347516fff 100644 --- a/gui/themes/makedeftheme.py +++ b/gui/themes/makedeftheme.py @@ -6,14 +6,13 @@ import re def main(): theme_file = open(sys.argv[1], "r") def_file = open("default.inc", "w") - comment = re.compile("\/\*(.*)\*\/") try: output = "\"" for line in theme_file: output += (line.rstrip("\n\r ").lstrip() + " ") - output = re.sub("\/\*(.*)\*\/", "", output) + output = re.sub("\/\*(.*?)\*\/", "", output) def_file.write(output + "\"\n") finally: theme_file.close() diff --git a/gui/themes/modern.stx b/gui/themes/modern.stx index c26a7856af..b13dc1fc98 100644 --- a/gui/themes/modern.stx +++ b/gui/themes/modern.stx @@ -480,7 +480,6 @@ width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> - <space size = 20 /> <widget name = 'AddGameButton' width = 'Globals.Button.Width' height = 'Globals.Button.Height' @@ -505,6 +504,7 @@ width = 'Globals.Button.Width' height = 'Globals.Button.Height' /> + <space/> </layout> <widget name = 'GameList'/> </layout> |