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

sev at users.sourceforge.net sev at users.sourceforge.net
Tue Mar 7 17:44:01 CET 2006


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

Log Message:
-----------
o Converted most (all?) widgets to new scheme.
o Converted global options dialog to new scheme.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/dialogs.cpp
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ListWidget.h
    scummvm/trunk/gui/PopUpWidget.cpp
    scummvm/trunk/gui/PopUpWidget.h
    scummvm/trunk/gui/TabWidget.cpp
    scummvm/trunk/gui/TabWidget.h
    scummvm/trunk/gui/chooser.cpp
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/editable.cpp
    scummvm/trunk/gui/editable.h
    scummvm/trunk/gui/eval.cpp
    scummvm/trunk/gui/eval.h
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/newgui.h
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/gui/options.h
    scummvm/trunk/gui/theme-config.cpp
    scummvm/trunk/gui/theme.h
    scummvm/trunk/gui/themes/default-theme.ini
    scummvm/trunk/gui/widget.cpp
    scummvm/trunk/gui/widget.h
Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/engines/scumm/dialogs.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -693,15 +693,18 @@
 	GUI::WidgetSize ws;
 	int buttonWidth;
 	int buttonHeight;
+	int sliderHeight;
 
 	if (screenW >= 400 && screenH >= 300) {
 		ws = GUI::kBigWidgetSize;
 		buttonWidth = kBigButtonWidth;
 		buttonHeight = kBigButtonHeight;
+		sliderHeight = GUI::kBigSliderHeight;
 	} else {
 		ws = GUI::kNormalWidgetSize;
 		buttonWidth = kButtonWidth;
 		buttonHeight = kButtonHeight;
+		sliderHeight = GUI::kSliderHeight;
 	}
 
 	int yoffset = 8;
@@ -710,7 +713,8 @@
 	// Sound controllers
 	//
 
-	yoffset = addVolumeControls(this, yoffset, ws) + 4;
+	addVolumeControls(this, "scummoptions_");
+	yoffset += (sliderHeight + 4) * 8;
 
 	//
 	// Some misc options

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/ListWidget.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -33,11 +33,11 @@
 	init(boss, w, ws);
 }
 
-ListWidget::ListWidget(GuiObject *boss, String name, WidgetSize ws)
-	: EditableWidget(boss, name, ws), CommandSender(boss) {
+ListWidget::ListWidget(GuiObject *boss, String name)
+	: EditableWidget(boss, name), CommandSender(boss) {
 	int w = g_gui.evaluator()->getVar(name + ".w");
 
-	init(boss, w, ws);
+	init(boss, w, g_gui.getWidgetSize());
 }
 
 void ListWidget::init(GuiObject *boss, int w, WidgetSize ws) {

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/ListWidget.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -63,7 +63,7 @@
 
 public:
 	ListWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kDefaultWidgetSize);
-	ListWidget(GuiObject *boss, String name, WidgetSize ws = kDefaultWidgetSize);
+	ListWidget(GuiObject *boss, String name);
 	virtual ~ListWidget();
 
 	void init(GuiObject *boss, int w, WidgetSize ws);

Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -336,6 +336,16 @@
 
 PopUpWidget::PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint labelWidth, WidgetSize ws)
 	: Widget(boss, x, y - 1, w, h + 2), CommandSender(boss), _ws(ws), _label(label), _labelWidth(labelWidth) {
+	init();
+}
+
+PopUpWidget::PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth)
+	: Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(labelWidth) {
+	_ws = g_gui.getWidgetSize();
+	init();
+}
+
+void PopUpWidget::init() {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
 	setHints(THEME_HINT_SAVE_BACKGROUND);
 	_type = kPopUpWidget;

Modified: scummvm/trunk/gui/PopUpWidget.h
===================================================================
--- scummvm/trunk/gui/PopUpWidget.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/PopUpWidget.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -49,7 +49,7 @@
 	};
 	typedef Common::Array<Entry> EntryList;
 protected:
-	const WidgetSize		_ws;
+	WidgetSize		_ws;
 	EntryList		_entries;
 	int				_selectedItem;
 
@@ -58,7 +58,10 @@
 
 public:
 	PopUpWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint labelWidth = 0, WidgetSize ws = kDefaultWidgetSize);
+	PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth = 0);
 
+	void init();
+
 	void handleMouseDown(int x, int y, int button, int clickCount);
 
 	void appendEntry(const String &entry, uint32 tag = (uint32)-1);

Modified: scummvm/trunk/gui/TabWidget.cpp
===================================================================
--- scummvm/trunk/gui/TabWidget.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/TabWidget.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -38,7 +38,16 @@
 
 TabWidget::TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws)
 	: Widget(boss, x, y, w, h), _ws(ws) {
+	init();
+}
 
+TabWidget::TabWidget(GuiObject *boss, String name)
+	: Widget(boss, name) {
+	_ws = g_gui.getWidgetSize();
+	init();
+}
+
+void TabWidget::init() {
 	_flags = WIDGET_ENABLED;
 	_type = kTabWidget;
 	_activeTab = -1;

Modified: scummvm/trunk/gui/TabWidget.h
===================================================================
--- scummvm/trunk/gui/TabWidget.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/TabWidget.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -40,12 +40,15 @@
 	TabList _tabs;
 	int _tabWidth;
 	int _tabHeight;
-	const WidgetSize _ws;
+	WidgetSize _ws;
 
 public:
 	TabWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kDefaultWidgetSize);
+	TabWidget(GuiObject *boss, String name);
 	~TabWidget();
 
+	void init();
+
 	virtual int16	getChildY() const;
 
 	// Problem: how to add items to a tab?

Modified: scummvm/trunk/gui/chooser.cpp
===================================================================
--- scummvm/trunk/gui/chooser.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/chooser.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -62,14 +62,14 @@
 	int yoffset = 6;
 
 	// Headline
-	new StaticTextWidget(this, "chooser_headline", title, kTextAlignCenter, ws);
+	new StaticTextWidget(this, "chooser_headline", title, kTextAlignCenter);
 
 	yoffset += kLineHeight + 2;
 
 	// Add choice list
 	// HACK: Subtracting -12 from the height makes the list look good when
 	// it's used to list savegames in the 320x200 version of the GUI.
-	_list = new ListWidget(this, "chooser_list", ws);
+	_list = new ListWidget(this, "chooser_list");
 	_list->setNumberingMode(kListNumberingOff);
 
 	// Buttons

Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/dialog.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -323,6 +323,8 @@
 
 	w = g_gui.getFontHeight() + 10 + g_gui.getStringWidth(label);
 
+	debug(0, "%s: %d", label.c_str(), g_gui.getStringWidth(label));
+
 	return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);
 }
 

Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/editable.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -30,7 +30,7 @@
 	init();
 }
 
-EditableWidget::EditableWidget(GuiObject *boss, String name, WidgetSize ws)
+EditableWidget::EditableWidget(GuiObject *boss, String name)
  : Widget(boss, name) {
 	init();
 }

Modified: scummvm/trunk/gui/editable.h
===================================================================
--- scummvm/trunk/gui/editable.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/editable.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -48,7 +48,7 @@
 
 public:
 	EditableWidget(GuiObject *boss, int x, int y, int w, int h, WidgetSize ws = kNormalWidgetSize);
-	EditableWidget(GuiObject *boss, String name, WidgetSize ws = kNormalWidgetSize);
+	EditableWidget(GuiObject *boss, String name);
 	virtual ~EditableWidget();
 
 	void init();

Modified: scummvm/trunk/gui/eval.cpp
===================================================================
--- scummvm/trunk/gui/eval.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/eval.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -127,7 +127,7 @@
 
 	switch (_tokenType) {
 	case tVariable:
-		*result = getVar(_token);
+		*result = getVar_(_token);
 		if (*result == EVAL_UNDEF_VAR)
 			exprError(eUndefVar);
 		getToken();
@@ -237,6 +237,9 @@
 	{"kBigSliderWidth", GUI::kBigSliderWidth},
 	{"kBigSliderHeight", GUI::kBigSliderHeight},
 
+	{"kNormalWidgetSize", GUI::kNormalWidgetSize},
+	{"kBigWidgetSize", GUI::kBigWidgetSize},
+
 	{"false", 0},
 	{"true", 1},
 	{NULL, 0}
@@ -252,7 +255,7 @@
 	return EVAL_UNDEF_VAR;
 }
 
-int Eval::getVar(const char *s, bool includeAliases) {
+int Eval::getVar_(const char *s, bool includeAliases) {
 	int i;
 	int val;
 

Modified: scummvm/trunk/gui/eval.h
===================================================================
--- scummvm/trunk/gui/eval.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/eval.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -67,7 +67,7 @@
 	void setVariable(const String name, int val) { _vars[name] = val; }
 	void setAlias(const String name, const String val) { _aliases[name] = val; }
 
-	int getVar(String s) { return getVar(s.c_str()); };
+	int getVar(String s) { return getVar_(s.c_str()); };
 
 	void reset();
 
@@ -84,7 +84,7 @@
 	void arith(char op, int *r, int *h);
 	void unary(char op, int *r);
 	void exprError(int error);
-	int getVar(const char *s, bool includeAliases = true);
+	int getVar_(const char *s, bool includeAliases = true);
 	int getBuiltinVar(const char *s);
 
 	char _input[256];

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/launcher.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -257,7 +257,7 @@
 	_globalGraphicsOverride = addCheckbox(tab, x, yoffset, "Override global graphic settings", kCmdGlobalGraphicsOverride, 0, ws);
 	yoffset += _globalGraphicsOverride->getHeight();
 
-	yoffset = addGraphicControls(tab, yoffset, ws);
+	addGraphicControls(tab, "gameoptions_");
 
 	//
 	// 4) The audio tab
@@ -268,7 +268,7 @@
 	_globalAudioOverride = addCheckbox(tab, x, yoffset, "Override global audio settings", kCmdGlobalAudioOverride, 0, ws);
 	yoffset += _globalAudioOverride->getHeight();
 
-	yoffset = addAudioControls(tab, yoffset, ws);
+	addAudioControls(tab, "gameoptions_");
 
 	//
 	// 5) The MIDI tab
@@ -279,7 +279,7 @@
 	_globalMIDIOverride = addCheckbox(tab, x, yoffset, "Override global MIDI settings", kCmdGlobalMIDIOverride, 0, ws);
 	yoffset += _globalMIDIOverride->getHeight();
 
-	yoffset = addMIDIControls(tab, yoffset, ws);
+	addMIDIControls(tab, "gameoptions_");
 
 	//
 	// 6) The volume tab
@@ -290,7 +290,7 @@
 	_globalVolumeOverride = addCheckbox(tab, x, yoffset, "Override global volume settings", kCmdGlobalVolumeOverride, 0, ws);
 	yoffset += _globalVolumeOverride->getHeight();
 
-	yoffset = addVolumeControls(tab, yoffset, ws);
+	addVolumeControls(tab, "gameoptions_");
 
 
 	// Activate the first tab
@@ -487,35 +487,28 @@
 	_w = screenW;
 	_h = screenH;
 
-	GUI::WidgetSize ws;
-
-	if (screenW >= 400 && screenH >= 300)
-		ws = GUI::kBigWidgetSize;
-	else
-		ws = GUI::kNormalWidgetSize;
-
 	// Show ScummVM version
-	new StaticTextWidget(this, "launcher_version", gScummVMFullVersion, kTextAlignCenter, ws);
+	new StaticTextWidget(this, "launcher_version", gScummVMFullVersion, kTextAlignCenter);
 
 	// Add some buttons at the bottom
 	// TODO: Rearrange them a bit? In particular, we could put a slightly smaller space
 	// between About and Options, and in exchange remove those a bit from Quit and Start.
-	new ButtonWidget(this, "launcher_quit_button", "Quit", kQuitCmd, 'Q', ws);
-	new ButtonWidget(this, "launcher_about_button", "About", kAboutCmd, 'B', ws);
-	new ButtonWidget(this, "launcher_options_button", "Options", kOptionsCmd, 'O', ws);
+	new ButtonWidget(this, "launcher_quit_button", "Quit", kQuitCmd, 'Q');
+	new ButtonWidget(this, "launcher_about_button", "About", kAboutCmd, 'B');
+	new ButtonWidget(this, "launcher_options_button", "Options", kOptionsCmd, 'O');
 	_startButton =
-			new ButtonWidget(this, "launcher_start_button", "Start", kStartCmd, 'S', ws);
+			new ButtonWidget(this, "launcher_start_button", "Start", kStartCmd, 'S');
 
 	// Above the lowest button rows: two more buttons (directly below the list box)
-	new ButtonWidget(this, "launcher_addGame_button", "Add Game...", kAddGameCmd, 'A', ws);
+	new ButtonWidget(this, "launcher_addGame_button", "Add Game...", kAddGameCmd, 'A');
 	_editButton =
-		new ButtonWidget(this, "launcher_editGame_button", "Edit Game...", kEditGameCmd, 'E', ws);
+		new ButtonWidget(this, "launcher_editGame_button", "Edit Game...", kEditGameCmd, 'E');
 	_removeButton =
-		new ButtonWidget(this, "launcher_removeGame_button", "Remove Game", kRemoveGameCmd, 'R', ws);
+		new ButtonWidget(this, "launcher_removeGame_button", "Remove Game", kRemoveGameCmd, 'R');
 
 
 	// Add list with game titles
-	_list = new ListWidget(this, "launcher_list", ws);
+	_list = new ListWidget(this, "launcher_list");
 	_list->setEditable(false);
 	_list->setNumberingMode(kListNumberingOff);
 
@@ -762,7 +755,7 @@
 		editGame(item);
 		break;
 	case kOptionsCmd: {
-		GlobalOptionsDialog options;
+		GlobalOptionsDialog options("globaloptions");
 		options.runModal();
 		}
 		break;

Modified: scummvm/trunk/gui/newgui.h
===================================================================
--- scummvm/trunk/gui/newgui.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/newgui.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -78,6 +78,11 @@
 	int getStringWidth(const Common::String &str) const { return _theme->getStringWidth(str); }
 	int getCharWidth(byte c) const { return _theme->getCharWidth(c); }
 
+	WidgetSize getWidgetSize() {
+		return (WidgetSize)(_theme->_evaluator->getVar("widgetSize"));
+	}
+
+
 protected:
 	OSystem			*_system;
 

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/options.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -325,22 +325,13 @@
 	_speechVolumeLabel->setEnabled(enabled);
 }
 
-int OptionsDialog::addGraphicControls(GuiObject *boss, int yoffset, WidgetSize ws) {
-	const int x = 10;
-	const int w = _w - 2 * 10;
+void OptionsDialog::addGraphicControls(GuiObject *boss, String prefix) {
 	const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
 
-	int labelWidth;
+	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
 
-	if (ws == kBigWidgetSize) {
-		labelWidth = 150;
-	} else {
-		labelWidth = 100;
-	}
-
 	// The GFX mode popup
-	_gfxPopUp = addPopUp(boss, x-5, yoffset, w+5, "Graphics mode: ", labelWidth, ws);
-	yoffset += _gfxPopUp->getHeight() + 4;
+	_gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup", "Graphics mode: ", labelWidth);
 
 	_gfxPopUp->appendEntry("<default>");
 	_gfxPopUp->appendEntry("");
@@ -350,8 +341,7 @@
 	}
 
 	// RenderMode popup
-	_renderModePopUp = addPopUp(boss, x-5, yoffset, w+5, "Render mode: ", labelWidth, ws);
-	yoffset += _renderModePopUp->getHeight() + 4;
+	_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup", "Render mode: ", labelWidth);
 	_renderModePopUp->appendEntry("<default>", Common::kRenderDefault);
 	_renderModePopUp->appendEntry("");
 	const Common::RenderModeDescription *rm = Common::g_renderModes;
@@ -360,12 +350,10 @@
 	}
 
 	// Fullscreen checkbox
-	_fullscreenCheckbox = addCheckbox(boss, x, yoffset, "Fullscreen mode", 0, 0, ws);
-	yoffset += _fullscreenCheckbox->getHeight();
+	_fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", "Fullscreen mode", 0, 0);
 
 	// Aspect ratio checkbox
-	_aspectCheckbox = addCheckbox(boss, x, yoffset, "Aspect ratio correction", 0, 0, ws);
-	yoffset += _aspectCheckbox->getHeight();
+	_aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", "Aspect ratio correction", 0, 0);
 
 #ifdef SMALL_SCREEN_DEVICE
 	_fullscreenCheckbox->setState(TRUE);
@@ -374,25 +362,13 @@
 #endif
 
 	_enableGraphicSettings = true;
-
-	return yoffset;
 }
 
-int OptionsDialog::addAudioControls(GuiObject *boss, int yoffset, WidgetSize ws) {
-	const int x = 10;
-	const int w = _w - 20;
+void OptionsDialog::addAudioControls(GuiObject *boss, String prefix) {
+	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
 
-	int labelWidth;
-
-	if (ws == kBigWidgetSize) {
-		labelWidth = 150;
-	} else {
-		labelWidth = 100;
-	}
-
 	// The MIDI mode popup & a label
-	_midiPopUp = addPopUp(boss, x-5, yoffset, w+5, "Music driver: ", labelWidth, ws);
-	yoffset += _midiPopUp->getHeight() + 4;
+	_midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup", "Music driver: ", labelWidth);
 
 	// Populate it
 	const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
@@ -402,99 +378,58 @@
 	}
 
 	// Subtitles on/off
-	_subCheckbox = addCheckbox(boss, x, yoffset, "Display subtitles", 0, 0, ws);
-	yoffset += _subCheckbox->getHeight();
+	_subCheckbox = new CheckboxWidget(boss, prefix + "auSubtitlesCheckbox", "Display subtitles", 0, 0);
 
-	yoffset += 18;
-
 	_enableAudioSettings = true;
-
-	return yoffset;
 }
 
-int OptionsDialog::addMIDIControls(GuiObject *boss, int yoffset, WidgetSize ws) {
-	const int x = 10;
-	int spacing;
-	int buttonWidth, buttonHeight;
-
-	if (ws == kBigWidgetSize) {
-		buttonWidth = kBigButtonWidth;
-		buttonHeight = kBigButtonHeight;
-		spacing = 2;
-	} else {
-		buttonWidth = kButtonWidth;
-		buttonHeight = kButtonHeight;
-		spacing = 1;
-	}
-
+void OptionsDialog::addMIDIControls(GuiObject *boss, String prefix) {
 	// SoundFont
-	_soundFontButton = addButton(boss, x, yoffset, "SoundFont:", kChooseSoundFontCmd, 0, ws);
-	_soundFont = new StaticTextWidget(boss, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft, ws);
-	yoffset += buttonHeight + 2 * spacing;
+	_soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", "SoundFont:", kChooseSoundFontCmd, 0);
+	_soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", "None", kTextAlignLeft);
 
 	// Multi midi setting
-	_multiMidiCheckbox = addCheckbox(boss, x, yoffset, "Mixed Adlib/MIDI mode", 0, 0, ws);
-	yoffset += _multiMidiCheckbox->getHeight() + spacing;
+	_multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", "Mixed Adlib/MIDI mode", 0, 0);
 
 	// Native mt32 setting
-	_mt32Checkbox = addCheckbox(boss, x, yoffset, "True Roland MT-32 (disable GM emulation)", 0, 0, ws);
-	yoffset += _mt32Checkbox->getHeight() + spacing;
+	_mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", "True Roland MT-32 (disable GM emulation)", 0, 0);
 
 	// GS Extensions setting
-	_enableGSCheckbox = addCheckbox(boss, x, yoffset, "Enable Roland GS Mode", 0, 0, ws);
-	yoffset += _enableGSCheckbox->getHeight() + spacing;
+	_enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", "Enable Roland GS Mode", 0, 0);
 
 	_enableMIDISettings = true;
-
-	return yoffset;
 }
 
-int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws) {
+void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) {
 	const char *slider_labels[] = {
 		"Music volume:",
 		"SFX volume:",
 		"Speech volume:"
 	};
 
-	int textwidth = 0;
-
-	for (int i = 0; i < ARRAYSIZE(slider_labels); i++) {
-		int width = g_gui.getStringWidth(slider_labels[i]);
-
-		if (width > textwidth)
-			textwidth = width;
-	}
-
-	int xoffset = textwidth + 15;
-
 	// Volume controllers
-	new StaticTextWidget(boss, 10, yoffset + 2, textwidth, kLineHeight, slider_labels[0], kTextAlignRight, ws);
-	_musicVolumeSlider = addSlider(boss, xoffset, yoffset, kMusicVolumeChanged, ws);
-	_musicVolumeLabel = new StaticTextWidget(boss, xoffset + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	new StaticTextWidget(boss, prefix + "vcMusicText", slider_labels[0], kTextAlignRight);
+	_musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged);
+	_musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%", kTextAlignLeft);
 	_musicVolumeSlider->setMinValue(0);
 	_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += _musicVolumeSlider->getHeight() + 4;
 
-	new StaticTextWidget(boss, 10, yoffset + 2, textwidth, kLineHeight, slider_labels[1], kTextAlignRight, ws);
-	_sfxVolumeSlider = addSlider(boss, xoffset, yoffset, kSfxVolumeChanged, ws);
-	_sfxVolumeLabel = new StaticTextWidget(boss, xoffset + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	new StaticTextWidget(boss, prefix + "vcSfxText", slider_labels[1], kTextAlignRight);
+	_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
+	_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%", kTextAlignLeft);
 	_sfxVolumeSlider->setMinValue(0);
 	_sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += _sfxVolumeSlider->getHeight() + 4;
 
-	new StaticTextWidget(boss, 10, yoffset + 2, textwidth, kLineHeight, slider_labels[2], kTextAlignRight, ws);
-	_speechVolumeSlider = addSlider(boss, xoffset, yoffset, kSpeechVolumeChanged, ws);
-	_speechVolumeLabel = new StaticTextWidget(boss, xoffset + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	new StaticTextWidget(boss, prefix + "vcSpeechText" , slider_labels[2], kTextAlignRight);
+	_speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged);
+	_speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%", kTextAlignLeft);
 	_speechVolumeSlider->setMinValue(0);
 	_speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_speechVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += _speechVolumeSlider->getHeight() + 4;
 
 	_enableVolumeSettings = true;
-
-	return yoffset;
 }
 
 #pragma mark -
@@ -506,80 +441,81 @@
 	const int screenW = g_system->getOverlayWidth();
 	const int screenH = g_system->getOverlayHeight();
 
-	GUI::WidgetSize ws;
-	int buttonWidth, buttonHeight;
-
 	if (screenW >= 400 && screenH >= 300) {
-		ws = GUI::kBigWidgetSize;
-		buttonWidth = kBigButtonWidth;
-		buttonHeight = kBigButtonHeight;
 		_w = screenW - 2 * 10;
 		_h = screenH - 2 * 40;
 		_x = 10;
 		_y = 40;
 	} else {
-		ws = GUI::kNormalWidgetSize;
-		buttonWidth = kButtonWidth;
-		buttonHeight = kButtonHeight;
 		_w = screenW - 2 * 10;
 		_h = screenH - 1 * 20;
 		_x = 10;
 		_y = 20;
 	}
 
-	const int vBorder = 5;	// Tab border
-	int yoffset;
+	init();
+}
 
+GlobalOptionsDialog::GlobalOptionsDialog(String name)
+	: OptionsDialog(Common::ConfigManager::kApplicationDomain, name) {
+	init();
+}
+
+void GlobalOptionsDialog::init() {
+	const int screenW = g_system->getOverlayWidth();
+	const int screenH = g_system->getOverlayHeight();
+
+	GUI::WidgetSize ws;
+
+	if (screenW >= 400 && screenH >= 300) {
+		ws = GUI::kBigWidgetSize;
+	} else {
+		ws = GUI::kNormalWidgetSize;
+	}
+
 	// The tab widget
-	TabWidget *tab = new TabWidget(this, 0, vBorder, _w, _h - buttonHeight - 8 - 2 * vBorder, ws);
+	TabWidget *tab = new TabWidget(this, "globaloptions_tabwidget");
 	tab->setHints(THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND);
 
 	//
 	// 1) The graphics tab
 	//
 	tab->addTab("Graphics");
-	yoffset = vBorder;
-	yoffset = addGraphicControls(tab, yoffset, ws);
+	addGraphicControls(tab, "globaloptions_");
 
 	//
 	// 2) The audio tab
 	//
 	tab->addTab("Audio");
-	yoffset = vBorder;
-	yoffset = addAudioControls(tab, yoffset, ws);
-	yoffset = addVolumeControls(tab, yoffset, ws);
+	addAudioControls(tab, "globaloptions_");
+	addVolumeControls(tab, "globaloptions_");
 	// TODO: cd drive setting
 
 	//
 	// 3) The MIDI tab
 	//
 	tab->addTab("MIDI");
-	yoffset = vBorder;
-	yoffset = addMIDIControls(tab, yoffset, ws);
+	addMIDIControls(tab, "globaloptions_");
 
 	//
 	// 4) The miscellaneous tab
 	//
 	tab->addTab("Paths");
-	yoffset = vBorder;
 
 #if !( defined(__DC__) || defined(__GP32__) )
 	// These two buttons have to be extra wide, or the text will be
 	// truncated in the small version of the GUI.
 
 	// Save game path
-	new ButtonWidget(tab, 5, yoffset, buttonWidth + 5, buttonHeight, "Save Path: ", kChooseSaveDirCmd, 0, ws);
-	_savePath = new StaticTextWidget(tab, 5 + buttonWidth + 20, yoffset + 3, _w - (5 + buttonWidth + 20) - 10, kLineHeight, "/foo/bar", kTextAlignLeft, ws);
-	yoffset += buttonHeight + 4;
+	new ButtonWidget(tab, "globaloptions_savebutton", "Save Path: ", kChooseSaveDirCmd, 0);
+	_savePath = new StaticTextWidget(tab, "globaloptions_savepath", "/foo/bar", kTextAlignLeft);
 
-	new ButtonWidget(tab, 5, yoffset, buttonWidth + 5, buttonHeight, "Extra Path:", kChooseExtraDirCmd, 0, ws);
-	_extraPath = new StaticTextWidget(tab, 5 + buttonWidth + 20, yoffset + 3, _w - (5 + buttonWidth + 20) - 10, kLineHeight, "None", kTextAlignLeft, ws);
-	yoffset += buttonHeight + 4;
+	new ButtonWidget(tab, "globaloptions_extrabutton", "Extra Path:", kChooseExtraDirCmd, 0);
+	_extraPath = new StaticTextWidget(tab, "globaloptions_extrapath", "None", kTextAlignLeft);
 #endif
 
 #ifdef SMALL_SCREEN_DEVICE
-	addButton(tab, 5, yoffset, "Keys", kChooseKeyMappingCmd, 0, ws);
-	yoffset += buttonHeight + 4;
+	new ButtonWidget(tab, "globaloptions_keysbutton", "Keys", kChooseKeyMappingCmd, 0);
 #endif
 
 	// TODO: joystick setting
@@ -589,8 +525,8 @@
 	tab->setActiveTab(0);
 
 	// Add OK & Cancel buttons
-	addButton(this, _w - 2 * (buttonWidth + 10), _h - buttonHeight - 8, "Cancel", kCloseCmd, 0, ws);
-	addButton(this, _w - (buttonWidth + 10), _h - buttonHeight - 8, "OK", kOKCmd, 0, ws);
+	new ButtonWidget(this, "globaloptions_cancel", "Cancel", kCloseCmd, 0);
+	new ButtonWidget(this, "globaloptions_ok", "OK", kOKCmd, 0);
 
 #ifdef SMALL_SCREEN_DEVICE
 	_keysDialog = new KeysDialog();

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/options.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -60,10 +60,10 @@
 	ButtonWidget *_soundFontButton;
 	StaticTextWidget *_soundFont;
 
-	int addGraphicControls(GuiObject *boss, int yoffset, WidgetSize ws);
-	int addAudioControls(GuiObject *boss, int yoffset, WidgetSize ws);
-	int addMIDIControls(GuiObject *boss, int yoffset, WidgetSize ws);
-	int addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws);
+	void addGraphicControls(GuiObject *boss, String prefix);
+	void addAudioControls(GuiObject *boss, String prefix);
+	void addMIDIControls(GuiObject *boss, String prefix);
+	void addVolumeControls(GuiObject *boss, String prefix);
 
 	void setGraphicSettingsState(bool enabled);
 	void setAudioSettingsState(bool enabled);
@@ -115,8 +115,10 @@
 	typedef Common::String String;
 public:
 	GlobalOptionsDialog();
+	GlobalOptionsDialog(String name);
 	~GlobalOptionsDialog();
 
+	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-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/theme-config.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -27,38 +27,159 @@
 const char *Theme::_defaultConfigINI = "\n\
 # Define our classic greenish theme here\n\
 [320xY]\n\
+def_widgetSize=kNormalWidgetSize\n\
+def_buttonWidth=kButtonWidth\n\
 def_buttonHeight=kButtonHeight\n\
+def_sliderWidth=kSliderWidth\n\
+def_sliderHeight=kSliderHeight\n\
 def_kLineHeight=12\n\
+def_kFontHeight=10\n\
+def_globOptionsW=(w - 2 * 10)\n\
+def_globOptionsH=(h - 1 * 40)\n\
+def_tabPopupsLabelW=100\n\
+def_midiControlsSpacing=1\n\
 use=XxY\n\
 \n\
 [XxY]\n\
+def_widgetSize=kBigWidgetSize\n\
+def_buttonWidth=kBigButtonWidth\n\
 def_buttonHeight=kBigButtonHeight\n\
+def_sliderWidth=kBigSliderWidth\n\
+def_sliderHeight=kBigSliderHeight\n\
 def_kLineHeight=16\n\
+def_kFontHeight=14\n\
+def_globOptionsW=(w - 2 * 10)\n\
+def_globOptionsH=(h - 2 * 40)\n\
+def_tabPopupsLabelW=150\n\
+def_midiControlsSpacing=2\n\
 chooser_headline=10 6 (w - 2 * 16) (kLineHeight)\n\
 chooser_list=10 (6 + kLineHeight + 2) (w - 2 * 16) (h - self.y - buttonHeight - 12)\n\
+\n\
+## launcher\n\
 hBorder=10\n\
 launcher_version=hBorder 8 (w - 2 * hBorder) kLineHeight\n\
 top=(h - 8 - buttonHeight)\n\
 numButtons=4\n\
 space=8\n\
-buttonWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)\n\
-launcher_quit_button=hBorder top buttonWidth buttonHeight\n\
-launcher_about_button=(prev.x2 + space) top buttonWidth buttonHeight\n\
-launcher_options_button=(prev.x2 + space) top buttonWidth buttonHeight\n\
-launcher_start_button=(prev.x2 + space) top buttonWidth buttonHeight\n\
+butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)\n\
+launcher_quit_button=hBorder top butWidth buttonHeight\n\
+launcher_about_button=(prev.x2 + space) top butWidth buttonHeight\n\
+launcher_options_button=(prev.x2 + space) top butWidth buttonHeight\n\
+launcher_start_button=(prev.x2 + space) top butWidth buttonHeight\n\
 top=(top - buttonHeight * 2)\n\
 numButtons=3\n\
 space=10\n\
-buttonWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)\n\
-launcher_addGame_button=hBorder top buttonWidth buttonHeight\n\
-launcher_editGame_button=(prev.x2 + space) top buttonWidth buttonHeight\n\
-launcher_removeGame_button=(prev.x2 + space) top buttonWidth buttonHeight\n\
+butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)\n\
+launcher_addGame_button=hBorder top butWidth buttonHeight\n\
+launcher_editGame_button=(prev.x2 + space) top butWidth buttonHeight\n\
+launcher_removeGame_button=(prev.x2 + space) top butWidth buttonHeight\n\
 launcher_list=hBorder (kLineHeight + 16) (w - 2 * hBorder) (top - kLineHeight - 20)\n\
+\n\
+# global options\n\
+globaloptions=10 40 globOptionsW globOptionsH\n\
+set_parent=globaloptions\n\
+vBorder=5\n\
+globaloptions_tabwidget=0, vBorder parent.w (parent.h - buttonHeight -8 - 2 * vBorder)\n\
+\n\
+# graphics tab\n\
+opYoffset=vBorder\n\
+opWidth=globOptionsW\n\
+useWithPrefix=graphicsControls globaloptions_\n\
+\n\
+# audio tab\n\
+opYoffset=vBorder\n\
+opWidth=globOptionsW\n\
+useWithPrefix=audioControls globaloptions_\n\
+useWithPrefix=volumeControls globaloptions_\n\
+\n\
+# MIDI tab\n\
+opYoffset=vBorder\n\
+opWidth=globOptionsW\n\
+useWithPrefix=midiControls globaloptions_\n\
+\n\
+# paths tab\n\
+yoffset=vBorder\n\
+globaloptions_savebutton=5 yoffset (buttonWidth + 5) buttonHeight\n\
+globaloptions_savepath=(prev.x2 + 20) (vBorder + 3) (parent.w - (5 + buttonWidth + 20) - 10) kLineHeight\n\
+yoffset=(yoffset + buttonHeight + 4)\n\
+globaloptions_extrabutton=5 yoffset (buttonWidth + 5) buttonHeight\n\
+globaloptions_extrapath=(prev.x2 + 20) (vBorder + 3) (parent.w - (5 + buttonWidth + 20) - 10) kLineHeight\n\
+yoffset=(yoffset + buttonHeight + 4)\n\
+globaloptions_keysbutton=5 yoffset buttonWidth buttonHeight\n\
+\n\
+globaloptions_ok=(parent.w - (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight\n\
+globaloptions_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight\n\
+\n\
+# game options\n\
+opYoffset=(vBorder + buttonHeight)\n\
+opWidth=globOptionsW\n\
+useWithPrefix=graphicsControls gameoptions_\n\
+\n\
+opYoffset=(vBorder + buttonHeight)\n\
+useWithPrefix=audioControls gameoptions_\n\
+\n\
+opYoffset=(vBorder + buttonHeight)\n\
+useWithPrefix=volumeControls gameoptions_\n\
+\n\
+opYoffset=(vBorder + buttonHeight)\n\
+useWithPrefix=midiControls gameoptions_\n\
+\n\
+### SCUMM game options\n\
+opYoffset=8\n\
+useWithPrefix=volumeControls scummoptions_\n\
+\n\
+[graphicsControls]\n\
+gcx=10\n\
+gcw=(opWidth - 2 * 10)\n\
+grModePopup=(gcx - 5) opYoffset (gcw + 5) kLineHeight\n\
+opYoffset=(opYoffset + kLineHeight + 4)\n\
+grRenderPopup=(gcx - 5) opYoffset (gcw + 5) kLineHeight\n\
+opYoffset=(opYoffset + kLineHeight + 4)\n\
+grFullscreenCheckbox=gcx opYoffset (kFontHeight + 10 + 96) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight)\n\
+grAspectCheckbox=gcx opYoffset (kFontHeight + 10 + 136) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight)\n\
+\n\
+[audioControls]\n\
+aux=10\n\
+auw=(opWidth - 2 * 10)\n\
+auMidiPopup=(aux - 5) opYoffset (auw + 5) kLineHeight\n\
+opYoffset=(opYoffset + kLineHeight + 4)\n\
+auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight + 18)\n\
+\n\
+[volumeControls]\n\
+vctextw=95\n\
+vcxoff=(vctextw + 15)\n\
+vcMusicText=10 (opYoffset + 2) vctextw kLineHeight\n\
+vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight\n\
+vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n\
+opYoffset=(opYoffset + sliderHeight + 4)\n\
+vcSfxText=10 (opYoffset + 2) vctextw kLineHeight\n\
+vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight\n\
+vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n\
+opYoffset=(opYoffset + sliderHeight + 4)\n\
+vcSpeechText=10 (opYoffset + 2) vctextw kLineHeight\n\
+vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight\n\
+vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight\n\
+opYoffset=(opYoffset + sliderHeight + 4)\n\
+\n\
+[midiControls]\n\
+mcx=10\n\
+mcFontButton=mcx opYoffset buttonWidth buttonHeight\n\
+mcFontPath=(prev.x2 + 20) (opYoffset + 3) (opWidth - (buttonWidth + 20) - 10) kLineHeight\n\
+opYoffset=(opYoffset + buttonHeight + 2 * midiControlsSpacing)\n\
+mcMixedCheckbox=mcx opYoffset (kFontHeight + 10 + 135) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n\
+mcMt32Checkbox=mcx opYoffset (kFontHeight + 10 + 256) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n\
+mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight\n\
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)\n\
 ";
 
 using Common::String;
 
-void Theme::processSingleLine(const String &section, const String name, const String str) {
+void Theme::processSingleLine(const String &section, const String prefix, const String name, const String str) {
 	int level = 0;
 	int start = 0;
 	uint i;
@@ -71,7 +192,7 @@
 		String from, to;
 
 		from = String("self.") + postfixes[i];
-		to = name + "." + postfixes[i];
+		to = prefix + name + "." + postfixes[i];
 
 		_evaluator->setAlias(from, to);
 		_evaluator->setVariable(to, EVAL_UNDEF_VAR);
@@ -80,7 +201,7 @@
 	for (i = 0; i < str.size(); i++) {
 		if (isspace(str[i]) && level == 0) {
 			value = _evaluator->eval(String(&(str.c_str()[start]), i - start), section, name, start);
-			_evaluator->setVariable(name + "." + postfixes[npostfix++], value);
+			_evaluator->setVariable(prefix + name + "." + postfixes[npostfix++], value);
 			start = i + 1;
 		}
 		if (str[i] == '(')
@@ -105,18 +226,18 @@
 	if (npostfix == 0)
 		_evaluator->setVariable(name, value);
 	else
-		_evaluator->setVariable(name + "." + postfixes[npostfix], value);
+		_evaluator->setVariable(prefix + name + "." + postfixes[npostfix], value);
 
 	// If we have all 4 parameters, set .x2 and .y2
 	if (npostfix == 3) {
-		_evaluator->setVariable(name + ".x2", _evaluator->getVar(name + ".x") + 
-								_evaluator->getVar(name + ".w"));
-		_evaluator->setVariable(name + ".y2", _evaluator->getVar(name + ".y") + 
-								_evaluator->getVar(name + ".h"));
+		_evaluator->setVariable(prefix + name + ".x2", 
+			_evaluator->getVar(prefix + name + ".x") + _evaluator->getVar(prefix + name + ".w"));
+		_evaluator->setVariable(prefix + name + ".y2", 
+			_evaluator->getVar(prefix +name + ".y") + _evaluator->getVar(prefix + name + ".h"));
 	}
 
 	if (npostfix != 0)
-		setSpecialAlias("prev", name);
+		setSpecialAlias("prev", prefix + name);
 }
 
 
@@ -166,7 +287,7 @@
 			processResSection(config, n, true, pref);
 			continue;
 		}
-		processSingleLine(name, prefix + iterk->key, iterk->value);
+		processSingleLine(name, prefix, iterk->key, iterk->value);
 	}
 }
 

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/theme.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -31,6 +31,7 @@
 #include "graphics/surface.h"
 #include "graphics/fontman.h"
 
+#include "gui/widget.h"
 #include "gui/eval.h"
 
 namespace GUI {
@@ -170,7 +171,7 @@
 	}
 
 	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 processSingleLine(const String &section, const String prefix, const String name, const String str);
 	void setSpecialAlias(const String alias, const String &name);
 
 	bool isThemeLoadingRequired();

Modified: scummvm/trunk/gui/themes/default-theme.ini
===================================================================
--- scummvm/trunk/gui/themes/default-theme.ini	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/themes/default-theme.ini	2006-03-08 01:42:02 UTC (rev 21137)
@@ -131,30 +131,151 @@
 pshadow_bottom_height=4
 
 [320xY]
+def_widgetSize=kNormalWidgetSize
+def_buttonWidth=kButtonWidth
 def_buttonHeight=kButtonHeight
+def_sliderWidth=kSliderWidth
+def_sliderHeight=kSliderHeight
 def_kLineHeight=12
+def_kFontHeight=10
+def_globOptionsW=(w - 2 * 10)
+def_globOptionsH=(h - 1 * 40)
+def_tabPopupsLabelW=100
+def_midiControlsSpacing=1
 use=XxY
 
 [XxY]
+def_widgetSize=kBigWidgetSize
+def_buttonWidth=kBigButtonWidth
 def_buttonHeight=kBigButtonHeight
+def_sliderWidth=kBigSliderWidth
+def_sliderHeight=kBigSliderHeight
 def_kLineHeight=16
+def_kFontHeight=14
+def_globOptionsW=(w - 2 * 10)
+def_globOptionsH=(h - 2 * 40)
+def_tabPopupsLabelW=150
+def_midiControlsSpacing=2
 chooser_headline=10 6 (w - 2 * 16) (kLineHeight)
 chooser_list=10 (6 + kLineHeight + 2) (w - 2 * 16) (h - self.y - buttonHeight - 12)
+
+## launcher
 hBorder=10
 launcher_version=hBorder 8 (w - 2 * hBorder) kLineHeight
 top=(h - 8 - buttonHeight)
 numButtons=4
 space=8
-buttonWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)
-launcher_quit_button=hBorder top buttonWidth buttonHeight
-launcher_about_button=(prev.x2 + space) top buttonWidth buttonHeight
-launcher_options_button=(prev.x2 + space) top buttonWidth buttonHeight
-launcher_start_button=(prev.x2 + space) top buttonWidth buttonHeight
+butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)
+launcher_quit_button=hBorder top butWidth buttonHeight
+launcher_about_button=(prev.x2 + space) top butWidth buttonHeight
+launcher_options_button=(prev.x2 + space) top butWidth buttonHeight
+launcher_start_button=(prev.x2 + space) top butWidth buttonHeight
 top=(top - buttonHeight * 2)
 numButtons=3
 space=10
-buttonWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)
-launcher_addGame_button=hBorder top buttonWidth buttonHeight
-launcher_editGame_button=(prev.x2 + space) top buttonWidth buttonHeight
-launcher_removeGame_button=(prev.x2 + space) top buttonWidth buttonHeight
+butWidth=((w - 2 * hBorder - space * (numButtons - 1)) / numButtons)
+launcher_addGame_button=hBorder top butWidth buttonHeight
+launcher_editGame_button=(prev.x2 + space) top butWidth buttonHeight
+launcher_removeGame_button=(prev.x2 + space) top butWidth buttonHeight
 launcher_list=hBorder (kLineHeight + 16) (w - 2 * hBorder) (top - kLineHeight - 20)
+
+# global options
+globaloptions=10 40 globOptionsW globOptionsH
+set_parent=globaloptions
+vBorder=5
+globaloptions_tabwidget=0, vBorder parent.w (parent.h - buttonHeight -8 - 2 * vBorder)
+
+# graphics tab
+opYoffset=vBorder
+opWidth=globOptionsW
+useWithPrefix=graphicsControls globaloptions_
+
+# audio tab
+opYoffset=vBorder
+opWidth=globOptionsW
+useWithPrefix=audioControls globaloptions_
+useWithPrefix=volumeControls globaloptions_
+
+# MIDI tab
+opYoffset=vBorder
+opWidth=globOptionsW
+useWithPrefix=midiControls globaloptions_
+
+# paths tab
+yoffset=vBorder
+globaloptions_savebutton=5 yoffset (buttonWidth + 5) buttonHeight
+globaloptions_savepath=(prev.x2 + 20) (vBorder + 3) (parent.w - (5 + buttonWidth + 20) - 10) kLineHeight
+yoffset=(yoffset + buttonHeight + 4)
+globaloptions_extrabutton=5 yoffset (buttonWidth + 5) buttonHeight
+globaloptions_extrapath=(prev.x2 + 20) (vBorder + 3) (parent.w - (5 + buttonWidth + 20) - 10) kLineHeight
+yoffset=(yoffset + buttonHeight + 4)
+globaloptions_keysbutton=5 yoffset buttonWidth buttonHeight
+
+globaloptions_ok=(parent.w - (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight
+globaloptions_cancel=(parent.w - 2 * (buttonWidth + 10)) (parent.h - buttonHeight - 8) buttonWidth buttonHeight
+
+# game options
+opYoffset=(vBorder + buttonHeight)
+opWidth=globOptionsW
+useWithPrefix=graphicsControls gameoptions_
+
+opYoffset=(vBorder + buttonHeight)
+useWithPrefix=audioControls gameoptions_
+
+opYoffset=(vBorder + buttonHeight)
+useWithPrefix=volumeControls gameoptions_
+
+opYoffset=(vBorder + buttonHeight)
+useWithPrefix=midiControls gameoptions_
+
+### SCUMM game options
+opYoffset=8
+useWithPrefix=volumeControls scummoptions_
+
+[graphicsControls]
+gcx=10
+gcw=(opWidth - 2 * 10)
+grModePopup=(gcx - 5) opYoffset (gcw + 5) kLineHeight
+opYoffset=(opYoffset + kLineHeight + 4)
+grRenderPopup=(gcx - 5) opYoffset (gcw + 5) kLineHeight
+opYoffset=(opYoffset + kLineHeight + 4)
+grFullscreenCheckbox=gcx opYoffset (kFontHeight + 10 + 96) buttonHeight
+opYoffset=(opYoffset + buttonHeight)
+grAspectCheckbox=gcx opYoffset (kFontHeight + 10 + 136) buttonHeight
+opYoffset=(opYoffset + buttonHeight)
+
+[audioControls]
+aux=10
+auw=(opWidth - 2 * 10)
+auMidiPopup=(aux - 5) opYoffset (auw + 5) kLineHeight
+opYoffset=(opYoffset + kLineHeight + 4)
+auSubtitlesCheckbox=aux opYoffset (kFontHeight + 10 + 102) buttonHeight
+opYoffset=(opYoffset + buttonHeight + 18)
+
+[volumeControls]
+vctextw=95
+vcxoff=(vctextw + 15)
+vcMusicText=10 (opYoffset + 2) vctextw kLineHeight
+vcMusicSlider=vcxoff opYoffset sliderWidth sliderHeight
+vcMusicLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight
+opYoffset=(opYoffset + sliderHeight + 4)
+vcSfxText=10 (opYoffset + 2) vctextw kLineHeight
+vcSfxSlider=vcxoff opYoffset sliderWidth sliderHeight
+vcSfxLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight
+opYoffset=(opYoffset + sliderHeight + 4)
+vcSpeechText=10 (opYoffset + 2) vctextw kLineHeight
+vcSpeechSlider=vcxoff opYoffset sliderWidth sliderHeight
+vcSpeechLabel=(vcxoff + prev.w + 10) (opYoffset + 2) 24 kLineHeight
+opYoffset=(opYoffset + sliderHeight + 4)
+
+[midiControls]
+mcx=10
+mcFontButton=mcx opYoffset buttonWidth buttonHeight
+mcFontPath=(prev.x2 + 20) (opYoffset + 3) (opWidth - (buttonWidth + 20) - 10) kLineHeight
+opYoffset=(opYoffset + buttonHeight + 2 * midiControlsSpacing)
+mcMixedCheckbox=mcx opYoffset (kFontHeight + 10 + 135) buttonHeight
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)
+mcMt32Checkbox=mcx opYoffset (kFontHeight + 10 + 256) buttonHeight
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)
+mcGSCheckbox=mcx opYoffset (kFontHeight + 10 + 142) buttonHeight
+opYoffset=(opYoffset + buttonHeight + midiControlsSpacing)

Modified: scummvm/trunk/gui/widget.cpp
===================================================================
--- scummvm/trunk/gui/widget.cpp	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/widget.cpp	2006-03-08 01:42:02 UTC (rev 21137)
@@ -130,8 +130,9 @@
 	_label = text;
 }
 
-StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text, TextAlignment align, WidgetSize ws)
-	: Widget(boss, name), _align(align), _ws(ws) {
+StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text, TextAlignment align)
+	: Widget(boss, name), _align(align) {
+	_ws = g_gui.getWidgetSize();
 	_flags = WIDGET_ENABLED;
 	_type = kStaticTextWidget;
 	_label = text;
@@ -174,8 +175,8 @@
 	_type = kButtonWidget;
 }
 
-ButtonWidget::ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws)
-	: StaticTextWidget(boss, name, label, kTextAlignCenter, ws), CommandSender(boss),
+ButtonWidget::ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey)
+	: StaticTextWidget(boss, name, label, kTextAlignCenter), CommandSender(boss),
 	  _cmd(cmd), _hotkey(hotkey) {
 	_flags = WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG;
 	_type = kButtonWidget;
@@ -198,6 +199,12 @@
 	_type = kCheckboxWidget;
 }
 
+CheckboxWidget::CheckboxWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey)
+	: ButtonWidget(boss, name, label, cmd, hotkey), _state(false) {
+	_flags = WIDGET_ENABLED;
+	_type = kCheckboxWidget;
+}
+
 void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) {
 		toggleState();
@@ -227,6 +234,13 @@
 	_type = kSliderWidget;
 }
 
+SliderWidget::SliderWidget(GuiObject *boss, String name, uint32 cmd)
+	: Widget(boss, name), CommandSender(boss),
+	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) {
+	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
+	_type = kSliderWidget;
+}
+
 void SliderWidget::handleMouseMoved(int x, int y, int button) {
 	if (isEnabled() && _isDragging && x >= 0) {
 		int newValue = posToValue(x);

Modified: scummvm/trunk/gui/widget.h
===================================================================
--- scummvm/trunk/gui/widget.h	2006-03-08 01:38:27 UTC (rev 21136)
+++ scummvm/trunk/gui/widget.h	2006-03-08 01:42:02 UTC (rev 21137)
@@ -161,10 +161,10 @@
 
 	String					_label;
 	TextAlignment			_align;
-	const WidgetSize		_ws;
+	WidgetSize				_ws;
 public:
 	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align, WidgetSize ws = kDefaultWidgetSize);
-	StaticTextWidget(GuiObject *boss, String name, const String &text, TextAlignment align, WidgetSize ws = kDefaultWidgetSize);
+	StaticTextWidget(GuiObject *boss, String name, const String &text, TextAlignment align);
 	void setValue(int value);
 	void setLabel(const String &label);
 	const String &getLabel() const		{ return _label; }
@@ -183,7 +183,7 @@
 	uint8	_hotkey;
 public:
 	ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0, WidgetSize ws = kDefaultWidgetSize);
-	ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0, WidgetSize ws = kDefaultWidgetSize);
+	ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
 
 	void setCmd(uint32 cmd)				{ _cmd = cmd; }
 	uint32 getCmd() const				{ return _cmd; }
@@ -202,6 +202,7 @@
 	bool	_state;
 public:
 	CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0, WidgetSize ws = kDefaultWidgetSize);
+	CheckboxWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
 
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	virtual void handleMouseEntered(int button)	{ setFlags(WIDGET_HILITED); draw(); }
@@ -225,6 +226,7 @@
 	uint	_labelWidth;
 public:
 	SliderWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd = 0);
+	SliderWidget(GuiObject *boss, Common::String name, uint32 cmd = 0);
 
 	void setCmd(uint32 cmd)		{ _cmd = cmd; }
 	uint32 getCmd() const		{ return _cmd; }


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