diff options
| -rw-r--r-- | gui/theme-config.cpp | 60 | ||||
| -rw-r--r-- | gui/theme.h | 1 | ||||
| -rw-r--r-- | gui/themes/modern.ini | 6 | 
3 files changed, 60 insertions, 7 deletions
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 12e8090ce0..708a84ba09 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -517,6 +517,58 @@ bool Theme::isThemeLoadingRequired() {  	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 @@ void Theme::loadTheme(Common::ConfigFile &config, bool reset) {  		_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()); diff --git a/gui/theme.h b/gui/theme.h index b1defc17cf..5d75e73a9f 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -181,6 +181,7 @@ public:  	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; diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index a1d9a34557..0bc67b7edb 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -152,7 +152,7 @@ cursor_hotspot_x=0  cursor_hotspot_y=0  [XxY] -def_launcherX=23 +skipFor=320xY  def_widgetSize=kBigWidgetSize  def_buttonWidth=120  def_buttonHeight=25 @@ -162,7 +162,7 @@ def_kLineHeight=16  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=(w / 2 - 283 / 2) 5 283 80  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  | 
