[Scummvm-cvs-logs] SF.net SVN: scummvm: [21131] scummvm/trunk/gui

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Mar 7 11:04:01 CET 2006


Revision: 21131
Author:   sev
Date:     2006-03-07 11:02:42 -0800 (Tue, 07 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21131&view=rev

Log Message:
-----------
o More widgets fot alternative constructors
o Cleanup of launcher dialog
o Implemented useWithPrefix keyword

Modified Paths:
--------------
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/dialog.h
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/gui/options.h
    scummvm/trunk/gui/theme-config.cpp
    scummvm/trunk/gui/theme.h
Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/dialog.cpp	2006-03-07 19:02:42 UTC (rev 21131)
@@ -45,6 +45,12 @@
 	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 }
 
+Dialog::Dialog(String name)
+	: GuiObject(name),
+	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) {
+	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
+}
+
 Dialog::~Dialog() {
 	delete _firstWidget;
 	_firstWidget = 0;

Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/dialog.h	2006-03-07 19:02:42 UTC (rev 21131)
@@ -52,6 +52,7 @@
 
 public:
 	Dialog(int x, int y, int w, int h);
+	Dialog(Common::String name);
 	virtual ~Dialog();
 
 	virtual int runModal();

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/launcher.cpp	2006-03-07 19:02:42 UTC (rev 21131)
@@ -477,19 +477,6 @@
 
 #pragma mark -
 
-#define BEGIN_BUTTONS(numButtons, hSpace, top) \
-	{ \
-		const int space = hSpace; \
-		const int width = (_w - 2 * hBorder - space * (numButtons - 1)) / numButtons; \
-		int x = hBorder; \
-		const int y = top;
-
-#define ADD(name, cmd, hotkey) \
-	new ButtonWidget(this, x, y, width, buttonHeight, name, cmd, hotkey, ws); x += space + width
-
-#define END_BUTTONS \
-	}
-
 LauncherDialog::LauncherDialog(GameDetector &detector)
 	: Dialog(0, 0, 320, 200), _detector(detector) {
 	_drawingHints |= THEME_HINT_MAIN_DIALOG;
@@ -497,22 +484,15 @@
 	const int screenW = g_system->getOverlayWidth();
 	const int screenH = g_system->getOverlayHeight();
 
-	const int hBorder = 10;
-
 	_w = screenW;
 	_h = screenH;
 
 	GUI::WidgetSize ws;
-	int buttonHeight;
-	int top;
 
-	if (screenW >= 400 && screenH >= 300) {
+	if (screenW >= 400 && screenH >= 300)
 		ws = GUI::kBigWidgetSize;
-		buttonHeight = kBigButtonHeight;
-	} else {
+	else
 		ws = GUI::kNormalWidgetSize;
-		buttonHeight = kButtonHeight;
-	}
 
 	// Show ScummVM version
 	new StaticTextWidget(this, "launcher_version", gScummVMFullVersion, kTextAlignCenter, ws);

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/options.cpp	2006-03-07 19:02:42 UTC (rev 21131)
@@ -73,20 +73,36 @@
 
 
 OptionsDialog::OptionsDialog(const String &domain, int x, int y, int w, int h)
-	: Dialog(x, y, w, h),
-	_domain(domain),
-	_enableGraphicSettings(false),
-	_gfxPopUp(0), _renderModePopUp(0), _fullscreenCheckbox(0), _aspectCheckbox(0),
-	_enableAudioSettings(false),
-	_subCheckbox(0),
-	_enableMIDISettings(false),
-	_multiMidiCheckbox(0), _mt32Checkbox(0), _enableGSCheckbox(0),
-	_enableVolumeSettings(false),
-	_musicVolumeSlider(0), _musicVolumeLabel(0),
-	_sfxVolumeSlider(0), _sfxVolumeLabel(0),
-	_speechVolumeSlider(0), _speechVolumeLabel(0) {
+	: Dialog(x, y, w, h), _domain(domain) {
+	init();
 }
 
+OptionsDialog::OptionsDialog(const String &domain, String name)
+	: Dialog(name), _domain(domain) {
+	init();
+}
+
+void OptionsDialog::init() {
+	_enableGraphicSettings = false;
+	_gfxPopUp = 0;
+	_renderModePopUp = 0;
+	_fullscreenCheckbox = 0;
+	_aspectCheckbox = 0;
+	_enableAudioSettings = false;
+	_subCheckbox = 0;
+	_enableMIDISettings = false;
+	_multiMidiCheckbox = 0;
+	_mt32Checkbox = 0;
+	_enableGSCheckbox = 0;
+	_enableVolumeSettings = false;
+	_musicVolumeSlider = 0;
+	_musicVolumeLabel = 0;
+	_sfxVolumeSlider = 0;
+	_sfxVolumeLabel = 0;
+	_speechVolumeSlider = 0;
+	_speechVolumeLabel = 0;
+}
+
 void OptionsDialog::open() {
 	Dialog::open();
 

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/options.h	2006-03-07 19:02:42 UTC (rev 21131)
@@ -41,7 +41,10 @@
 	typedef Common::String String;
 public:
 	OptionsDialog(const String &domain, int x, int y, int w, int h);
+	OptionsDialog(const String &domain, String name);
 
+	void init();
+
 	void open();
 	void close();
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);

Modified: scummvm/trunk/gui/theme-config.cpp
===================================================================
--- scummvm/trunk/gui/theme-config.cpp	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/theme-config.cpp	2006-03-07 19:02:42 UTC (rev 21131)
@@ -120,7 +120,7 @@
 }
 
 
-void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs) {
+void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs, const String prefix) {
 	debug(3, "Reading section: [%s]", name.c_str());
 
 	const Common::ConfigFile::SectionKeyList &keys = config.getKeys(name);
@@ -128,16 +128,16 @@
 	Common::ConfigFile::SectionKeyList::const_iterator iterk;
 	for (iterk = keys.begin(); iterk != keys.end(); ++iterk) {
 		if (iterk->key == "set_parent") {
-			setSpecialAlias("parent", iterk->value);
+			setSpecialAlias("parent", prefix + iterk->value);
 			continue;
 		}
 		if (iterk->key.hasPrefix("set_")) {
-			_evaluator->setAlias(name, iterk->key, iterk->value);
+			_evaluator->setAlias(name, iterk->key, prefix + iterk->value);
 			continue;
 		}
 		if (iterk->key.hasPrefix("def_")) {
 			if (!skipDefs)
-				_evaluator->setVariable(name, iterk->key, iterk->value);
+				_evaluator->setVariable(name, prefix + iterk->key, iterk->value);
 			continue;
 		}
 		if (iterk->key == "use") {
@@ -148,7 +148,15 @@
 			processResSection(config, iterk->value, true);
 			continue;
 		}
-		processSingleLine(name, iterk->key, iterk->value);
+		if (iterk->key == "useWithPrefix") {
+			if (iterk->value == name)
+				error("Theme section [%s]: cannot use itself", name.c_str());
+			if (!config.hasSection(name))
+				error("Undefined use of section [%s]", name.c_str());
+			processResSection(config, iterk->value, true, iterk->value + "_");
+			continue;
+		}
+		processSingleLine(name, prefix + iterk->key, iterk->value);
 	}
 }
 

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-03-07 18:43:40 UTC (rev 21130)
+++ scummvm/trunk/gui/theme.h	2006-03-07 19:02:42 UTC (rev 21131)
@@ -169,7 +169,7 @@
 		return kTextAlignCenter;
 	}
 
-	void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false);
+	void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false, const String prefix = "");
 	void processSingleLine(const String &section, const String name, const String str);
 	void setSpecialAlias(const String alias, const String &name);
 


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