From 6f8c4250f9260d7c9edee46a5784f9ee2fb87130 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 6 Jun 2006 23:57:14 +0000 Subject: Move whole theme ini file to evaluator. Next step is caching. Also now it is possible to use per-resolution gfx and colors, i.e. complete customization. svn-id: r22964 --- gui/theme-config.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gui/theme-config.cpp') diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 11bdbfa04f..74c283f5c1 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -451,6 +451,9 @@ void Theme::processSingleLine(const String §ion, const String &prefix, const value = _evaluator->eval(String(&(str.c_str()[start]), i - start), section, name + postfixes[npostfix], start); + if (value == EVAL_STRING_VAR) + _evaluator->setStringVar(prefixedname, _evaluator->lastToken()); + // process VAR=VALUE construct if (npostfix == 0) _evaluator->setVar(name, value); @@ -463,6 +466,8 @@ void Theme::processSingleLine(const String §ion, const String &prefix, const _evaluator->getVar(prefixedname + ".x") + _evaluator->getVar(prefixedname + ".w")); _evaluator->setVar(prefixedname + ".y2", _evaluator->getVar(prefixedname + ".y") + _evaluator->getVar(prefixedname + ".h")); + } else if (npostfix == 2) { // Specify shortcuts for R G B + setRGBAlias(prefixedname); } if (npostfix != 0) @@ -539,6 +544,19 @@ void Theme::setSpecialAlias(const String &alias, const String &name) { } } +void Theme::setRGBAlias(const String &name) { + const char *frompostfixes[] = {".x", ".y", ".w"}; + const char *topostfixes[] = {".r", ".g", ".b"}; + int i; + + for (i = 0; i < ARRAYSIZE(frompostfixes); i++) { + String from(name + frompostfixes[i]); + String to(name + topostfixes[i]); + + _evaluator->setAlias(to.c_str(), from); + } +} + bool Theme::isThemeLoadingRequired() { int x = g_system->getOverlayWidth(), y = g_system->getOverlayHeight(); -- cgit v1.2.3