[Scummvm-cvs-logs] SF.net SVN: scummvm: [22151] scummvm/trunk/gui
sev at users.sourceforge.net
sev at users.sourceforge.net
Tue Apr 25 08:01:02 CEST 2006
Revision: 22151
Author: sev
Date: 2006-04-25 07:59:42 -0700 (Tue, 25 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22151&view=rev
Log Message:
-----------
- minor cleanup in modern.ini
- implement skipFor theme section keyword
Modified Paths:
--------------
scummvm/trunk/gui/theme-config.cpp
scummvm/trunk/gui/theme.h
scummvm/trunk/gui/themes/modern.ini
Modified: scummvm/trunk/gui/theme-config.cpp
===================================================================
--- scummvm/trunk/gui/theme-config.cpp 2006-04-25 14:27:41 UTC (rev 22150)
+++ scummvm/trunk/gui/theme-config.cpp 2006-04-25 14:59:42 UTC (rev 22151)
@@ -517,6 +517,58 @@
return true;
}
+bool Theme::sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h) {
+ if (!config.hasKey("skipFor", name))
+ return false;
+
+ String res;
+
+ config.getKey("skipFor", name, res);
+
+ int x, y;
+ int phase = 0;
+ const char *ptr = res.c_str();
+
+ x = y = 0;
+
+ while (ptr && phase != 2) {
+ switch (phase) {
+ case 0:
+ if (*ptr >= '0' && *ptr <= '9') {
+ x = x * 10 + *ptr - '0';
+ } else if (*ptr == 'X') {
+ phase = 1;
+ } else if (*ptr == 'x') {
+ phase = 1;
+ } else {
+ error("Syntax error. Wrong resolution in skipFor in section %s", name);
+ }
+ break;
+ case 1:
+ if (*ptr >= '0' && *ptr <= '9') {
+ x = x * 10 + *ptr - '0';
+ } else if (*ptr == 'Y') {
+ phase = 2;
+ } else {
+ error("Syntax error. Wrong resolution in skipFor in section %s", name);
+ }
+ break;
+ default:
+ break;
+ }
+
+ ptr++;
+ }
+
+ if (x != w && x)
+ return false;
+
+ if (y != h && y)
+ return false;
+
+ return true;
+}
+
void Theme::loadTheme(Common::ConfigFile &config, bool reset) {
char name[80];
int x = g_system->getOverlayWidth(), y = g_system->getOverlayHeight();
@@ -525,19 +577,19 @@
_evaluator->reset();
strcpy(name, "XxY");
- if (config.hasSection(name))
+ if (config.hasSection(name) && !sectionIsSkipped(config, "XxY", x, y))
processResSection(config, name);
sprintf(name, "%dxY", x);
- if (config.hasSection(name))
+ if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y))
processResSection(config, name);
sprintf(name, "Xx%d", y);
- if (config.hasSection(name))
+ if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y))
processResSection(config, name);
sprintf(name, "%dx%d", x, y);
- if (config.hasSection(name))
+ if (config.hasSection(name) && !sectionIsSkipped(config, name, x, y))
processResSection(config, name);
debug(3, "Number of variables: %d", _evaluator->getNumVars());
Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h 2006-04-25 14:27:41 UTC (rev 22150)
+++ scummvm/trunk/gui/theme.h 2006-04-25 14:59:42 UTC (rev 22151)
@@ -181,6 +181,7 @@
void setSpecialAlias(const String alias, const String &name);
bool isThemeLoadingRequired();
+ bool sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h);
void loadTheme(Common::ConfigFile &config, bool reset = true);
Eval *_evaluator;
Modified: scummvm/trunk/gui/themes/modern.ini
===================================================================
--- scummvm/trunk/gui/themes/modern.ini 2006-04-25 14:27:41 UTC (rev 22150)
+++ scummvm/trunk/gui/themes/modern.ini 2006-04-25 14:59:42 UTC (rev 22151)
@@ -152,7 +152,7 @@
cursor_hotspot_y=0
[XxY]
-def_launcherX=23
+skipFor=320xY
def_widgetSize=kBigWidgetSize
def_buttonWidth=120
def_buttonHeight=25
@@ -162,7 +162,7 @@
def_kFontHeight=14
def_insetX=23
def_insetY=94
-def_insetW=(w - buttonWidth - 17 * 2 - launcherX)
+def_insetW=(w - buttonWidth - 17 * 2 - insetX)
def_insetH=(h - 23 - insetY)
def_gameOptionsLabelWidth=90
def_tabPopupsLabelW=110
@@ -208,7 +208,7 @@
launcher_logo.visible=true
space1=20
space2=5
-launcher_list=launcherX 94 (w - buttonWidth - 17 * 2 - self.x) (h - 23 - self.y)
+launcher_list=insetX insetY (w - buttonWidth - 17 * 2 - self.x) (h - 23 - self.y)
launcher_start_button=(prev.x2 + 17) prev.y buttonWidth buttonHeight
launcher_addGame_button=prev.x (prev.y2 + space1) prev.w prev.h
launcher_editGame_button=prev.x (prev.y2 + space2) prev.w prev.h
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