[Scummvm-cvs-logs] CVS: scummvm/gui launcher.cpp,1.71,1.72 options.cpp,1.36,1.37 options.h,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Tue Nov 4 17:17:16 CET 2003


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv1805

Modified Files:
	launcher.cpp options.cpp options.h 
Log Message:
save fullscreen/aspect ratio settings; fix midi driver selection (driver was set immediately when you choose it from popup; this made it impossible to 'Cancel' the change)

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- launcher.cpp	5 Nov 2003 00:59:03 -0000	1.71
+++ launcher.cpp	5 Nov 2003 01:15:09 -0000	1.72
@@ -89,11 +89,12 @@
 	const String &_domain;
 	EditTextWidget *_descriptionWidget;
 	EditTextWidget *_domainWidget;
-	CheckboxWidget *_fullscreenCheckbox;
-	
 	PopUpWidget *_langPopUp;
 	PopUpWidget *_platformPopUp;
+
 	PopUpWidget *_gfxPopUp;
+	CheckboxWidget *_fullscreenCheckbox;
+	CheckboxWidget *_aspectCheckbox;
 };
 
 EditGameDialog::EditGameDialog(const String &domain, GameSettings target)
@@ -202,7 +203,11 @@
 	// GUI:  Full screen checkbox
 	_fullscreenCheckbox = new CheckboxWidget(tab, 15, yoffset, 200, 16, "Fullscreen mode", 0, 'F');
 	_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen", _domain));
+	yoffset += 16;
 
+	_aspectCheckbox = new CheckboxWidget(tab, 15, yoffset, 200, 16, "Aspect ratio correction");
+	_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio", _domain));
+	yoffset += 16;
 
 	//
 	// 3) The audio tab
@@ -236,6 +241,7 @@
 		}
 		ConfMan.set("description", _descriptionWidget->getLabel(), newDomain);
 		ConfMan.set("fullscreen", _fullscreenCheckbox->getState(), newDomain);
+		ConfMan.set("aspect_ratio", _aspectCheckbox->getState(), newDomain);
 
 		Common::Language lang = (Common::Language)_langPopUp->getSelectedTag();
 		if (lang < 0)

Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- options.cpp	4 Nov 2003 22:00:36 -0000	1.36
+++ options.cpp	5 Nov 2003 01:15:10 -0000	1.37
@@ -65,7 +65,6 @@
 GlobalOptionsDialog::GlobalOptionsDialog(GameDetector &detector)
 	: Dialog(10, 20, 320 - 2 * 10, 200 - 2 * 20) {
 
-	CheckboxWidget *check;
 	const int vBorder = 5;
 	int yoffset;
 
@@ -80,40 +79,38 @@
 
 	// The GFX mode popup & a label
 	// TODO - add an API to query the list of available GFX modes, and to get/set the mode
-	//new StaticTextWidget(tab, 5, vBorder+2, 100, kLineHeight, "Graphics mode: ", kTextAlignRight);
-	PopUpWidget *gfxPopUp;
-	gfxPopUp = new PopUpWidget(tab, 5, yoffset, 280, kLineHeight, "Graphics mode: ", 100);
+	_gfxPopUp = new PopUpWidget(tab, 5, yoffset, 280, kLineHeight, "Graphics mode: ", 100);
 	yoffset += 16;
 
 	// Ender: We don't really want a <default> here at all, we want to setSelected to the current global
-	gfxPopUp->appendEntry("<default>");
-	gfxPopUp->appendEntry("");
-	gfxPopUp->appendEntry("Normal (no scaling)");
-	gfxPopUp->appendEntry("2x");
-	gfxPopUp->appendEntry("3x");
-	gfxPopUp->appendEntry("2xSAI");
-	gfxPopUp->appendEntry("Super2xSAI");
-	gfxPopUp->appendEntry("SuperEagle");
-	gfxPopUp->appendEntry("AdvMAME2x");
-	gfxPopUp->appendEntry("AdvMAME3x");
-	gfxPopUp->appendEntry("hq2x");
-	gfxPopUp->appendEntry("hq3x");
-	gfxPopUp->appendEntry("TV2x");
-	gfxPopUp->appendEntry("DotMatrix");
-	gfxPopUp->setSelected(0);
+	_gfxPopUp->appendEntry("<default>");
+	_gfxPopUp->appendEntry("");
+	_gfxPopUp->appendEntry("Normal (no scaling)");
+	_gfxPopUp->appendEntry("2x");
+	_gfxPopUp->appendEntry("3x");
+	_gfxPopUp->appendEntry("2xSAI");
+	_gfxPopUp->appendEntry("Super2xSAI");
+	_gfxPopUp->appendEntry("SuperEagle");
+	_gfxPopUp->appendEntry("AdvMAME2x");
+	_gfxPopUp->appendEntry("AdvMAME3x");
+	_gfxPopUp->appendEntry("hq2x");
+	_gfxPopUp->appendEntry("hq3x");
+	_gfxPopUp->appendEntry("TV2x");
+	_gfxPopUp->appendEntry("DotMatrix");
+	_gfxPopUp->setSelected(0);
 	
 	// FIXME - disable GFX popup for now
-	gfxPopUp->setEnabled(false);
+	_gfxPopUp->setEnabled(false);
 	
 #if 1
 	// TODO: Aspect ratio setting
 	// TODO: Fullscreen setting
-	check = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Fullscreen mode");
-	check->setState(ConfMan.getBool("fullscreen"));
+	_fullscreenCheckbox = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Fullscreen mode");
+	_fullscreenCheckbox->setState(ConfMan.getBool("fullscreen"));
 	yoffset += 16;
 
-	check = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Aspect ratio correction");
-	check->setState(ConfMan.getBool("aspect_ratio"));
+	_aspectCheckbox = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Aspect ratio correction");
+	_aspectCheckbox->setState(ConfMan.getBool("aspect_ratio"));
 	yoffset += 16;
 #endif
 
@@ -164,12 +161,12 @@
 	// TODO: cd drive setting
 	// TODO: multi midi setting
 	// TODO: native mt32 setting
-	check = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Mixed Adlib/MIDI mode");
-	check->setState(ConfMan.getBool("multi_midi"));
+	_multiMidiCheckbox = new CheckboxWidget(tab, 10, yoffset, 280, 16, "Mixed Adlib/MIDI mode");
+	_multiMidiCheckbox->setState(ConfMan.getBool("multi_midi"));
 	yoffset += 16;
 
-	check = new CheckboxWidget(tab, 10, yoffset, 280, 16, "True Roland MT-32 (disable GM emulation)");
-	check->setState(ConfMan.getBool("native_mt32"));
+	_mt32Checkbox = new CheckboxWidget(tab, 10, yoffset, 280, 16, "True Roland MT-32 (disable GM emulation)");
+	_mt32Checkbox->setState(ConfMan.getBool("native_mt32"));
 	yoffset += 16;
 #endif
 
@@ -220,18 +217,20 @@
 
 void GlobalOptionsDialog::open() {
 	Dialog::open();
+	
+	int vol;
 
-	_soundVolumeMaster = ConfMan.getInt("master_volume");
-	_masterVolumeSlider->setValue(_soundVolumeMaster);
-	_masterVolumeLabel->setValue(_soundVolumeMaster);
+	vol = ConfMan.getInt("master_volume");
+	_masterVolumeSlider->setValue(vol);
+	_masterVolumeLabel->setValue(vol);
 
-	_soundVolumeMusic = ConfMan.getInt("music_volume");
-	_musicVolumeSlider->setValue(_soundVolumeMusic);
-	_musicVolumeLabel->setValue(_soundVolumeMusic);
+	vol = ConfMan.getInt("music_volume");
+	_musicVolumeSlider->setValue(vol);
+	_musicVolumeLabel->setValue(vol);
 
-	_soundVolumeSfx = ConfMan.getInt("sfx_volume");
-	_sfxVolumeSlider->setValue(_soundVolumeSfx);
-	_sfxVolumeLabel->setValue(_soundVolumeSfx);
+	vol = ConfMan.getInt("sfx_volume");
+	_sfxVolumeSlider->setValue(vol);
+	_sfxVolumeLabel->setValue(vol);
 }
 
 void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
@@ -245,38 +244,43 @@
 		}
 		break;
 	case kMasterVolumeChanged:
-		_soundVolumeMaster = _masterVolumeSlider->getValue();
-		_masterVolumeLabel->setValue(_soundVolumeMaster);
+		_masterVolumeLabel->setValue(_masterVolumeSlider->getValue());
 		_masterVolumeLabel->draw();
 		break;
 	case kMusicVolumeChanged:
-		_soundVolumeMusic = _musicVolumeSlider->getValue();
-		_musicVolumeLabel->setValue(_soundVolumeMusic);
+		_musicVolumeLabel->setValue(_musicVolumeSlider->getValue());
 		_musicVolumeLabel->draw();
 		break;
 	case kSfxVolumeChanged:
-		_soundVolumeSfx = _sfxVolumeSlider->getValue();
-		_sfxVolumeLabel->setValue(_soundVolumeSfx);
+		_sfxVolumeLabel->setValue(_sfxVolumeSlider->getValue());
 		_sfxVolumeLabel->draw();
 		break;
-	case kPopUpItemSelectedCmd:
-		if (sender == _midiPopUp) {
-			const MidiDriverDescription *md = getAvailableMidiDrivers();
-			for (; md->name; md++) {
-				if (md->id == (int) data) {
-					ConfMan.set("music_driver", md->name);
-					break;
-				}
+	case kOKCmd: {
+		setResult(1);
+		// TODO: All these settings should take effect immediately.
+		// There are two ways to ensure that:
+		// 1) Add code here which pushes the changes on to the mixer/backend
+		// 2) Implement the ConfigManager callback API; then, let the mixer/backend
+		//    and any other interested parties register for notifications sent
+		//    whenever these config values change.
+		ConfMan.set("master_volume", _masterVolumeSlider->getValue());
+		ConfMan.set("music_volume", _musicVolumeSlider->getValue());
+		ConfMan.set("sfx_volume", _sfxVolumeSlider->getValue());
+		ConfMan.set("fullscreen", _fullscreenCheckbox->getState());
+		ConfMan.set("aspect_ratio", _aspectCheckbox->getState());
+
+		const MidiDriverDescription *md = getAvailableMidiDrivers();
+		for (; md->name; md++) {
+			if (md->id == (int)_midiPopUp->getSelectedTag()) {
+				ConfMan.set("music_driver", md->name);
+				break;
 			}
 		}
-		break;
-	case kOKCmd:
-		setResult(1);
-		ConfMan.set("master_volume", _soundVolumeMaster);
-		ConfMan.set("music_volume", _soundVolumeMusic);
-		ConfMan.set("sfx_volume", _soundVolumeSfx);
+		if (!md->name)
+			ConfMan.removeKey("music_driver", Common::ConfigManager::kApplicationDomain);
+
 		close();
-		break;
+		break; }
 	default:
 		Dialog::handleCommand(sender, cmd, data);
 	}

Index: options.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- options.h	2 Nov 2003 14:50:44 -0000	1.8
+++ options.h	5 Nov 2003 01:15:10 -0000	1.9
@@ -26,6 +26,7 @@
 #include "common/list.h"
 
 class BrowserDialog;
+class CheckboxWidget;
 class GameDetector;
 class PopUpWidget;
 class SliderWidget;
@@ -42,14 +43,14 @@
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
 protected:
-	BrowserDialog	*_browser;
-	StaticTextWidget*_savePath;
+	BrowserDialog *_browser;
+	StaticTextWidget *_savePath;
 
-	PopUpWidget *_midiPopUp;
+	PopUpWidget *_gfxPopUp;
+	CheckboxWidget *_fullscreenCheckbox;
+	CheckboxWidget *_aspectCheckbox;
 
-	int _soundVolumeMaster;
-	int _soundVolumeMusic;
-	int _soundVolumeSfx;
+	PopUpWidget *_midiPopUp;
 
 	SliderWidget *_masterVolumeSlider;
 	SliderWidget *_musicVolumeSlider;
@@ -58,6 +59,9 @@
 	StaticTextWidget *_masterVolumeLabel;
 	StaticTextWidget *_musicVolumeLabel;
 	StaticTextWidget *_sfxVolumeLabel;
+
+	CheckboxWidget *_multiMidiCheckbox;
+	CheckboxWidget *_mt32Checkbox;
 };
 
 #endif





More information about the Scummvm-git-logs mailing list