[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.55,1.56 dialog.h,1.36,1.37 options.cpp,1.84,1.85 widget.cpp,1.50,1.51 widget.h,1.44,1.45

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Wed May 18 09:00:13 CEST 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21638

Modified Files:
	dialog.cpp dialog.h options.cpp widget.cpp widget.h 
Log Message:
Added big slider widget. There is nothing in the widget itself that's
dependent on size, so the two different sizes are handled through a new
addSlider() function.

Figuring out why the big widget won't let you set volume to 0 is left as an
exercise for the reader.


Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- dialog.cpp	18 May 2005 14:11:52 -0000	1.55
+++ dialog.cpp	18 May 2005 15:58:38 -0000	1.56
@@ -323,6 +323,24 @@
 	return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);
 }
 
+SliderWidget *Dialog::addSlider(int x, int y, uint32 cmd, WidgetSize ws) {
+	return addSlider(this, x, y, cmd, ws);
+}
+
+SliderWidget *Dialog::addSlider(GuiObject *boss, int x, int y, uint32 cmd, WidgetSize ws) {
+	int w, h;
+
+	if (ws == kBigWidgetSize) {
+		w = kBigSliderWidth;
+		h = kBigSliderHeight;
+	} else {
+		w = kSliderWidth;
+		h = kSliderHeight;
+	}
+
+	return new SliderWidget(boss, x, y, w, h, cmd);
+}
+
 uint32 GuiObject::getMillis() {
 	return g_system->getMillis();
 }

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- dialog.h	18 May 2005 14:11:52 -0000	1.36
+++ dialog.h	18 May 2005 15:58:39 -0000	1.37
@@ -93,6 +93,9 @@
 	CheckboxWidget *addCheckbox(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
 	CheckboxWidget *addCheckbox(int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
 
+	SliderWidget *addSlider(GuiObject *boss, int x, int y, uint32 cmd, WidgetSize ws = kDefaultWidgetSize);
+	SliderWidget *addSlider(int x, int y, uint32 cmd, WidgetSize ws = kDefaultWidgetSize);
+
 	void setResult(int result) { _result = result; }
 	int getResult() const { return _result; }
 };

Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- options.cpp	18 May 2005 14:11:52 -0000	1.84
+++ options.cpp	18 May 2005 15:58:39 -0000	1.85
@@ -407,25 +407,28 @@
 int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset, WidgetSize ws) {
 	// Volume controllers
 	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Music volume: ", kTextAlignRight, ws);
-	_musicVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kMusicVolumeChanged);
-	_musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
-	_musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
+	_musicVolumeSlider = addSlider(boss, 105, yoffset, kMusicVolumeChanged, ws);
+	_musicVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	_musicVolumeSlider->setMinValue(0);
+	_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += 16;
+	yoffset += _musicVolumeSlider->getHeight() + 4;
 
 	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "SFX volume: ", kTextAlignRight, ws);
-	_sfxVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSfxVolumeChanged);
-	_sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
-	_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
+	_sfxVolumeSlider = addSlider(boss, 105, yoffset, kSfxVolumeChanged, ws);
+	_sfxVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	_sfxVolumeSlider->setMinValue(0);
+	_sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += 16;
+	yoffset += _sfxVolumeSlider->getHeight() + 4;
 
 	new StaticTextWidget(boss, 5, yoffset + 2, 100, kLineHeight, "Speech volume: ", kTextAlignRight, ws);
-	_speechVolumeSlider = new SliderWidget(boss, 105, yoffset, 85, 12, kSpeechVolumeChanged);
-	_speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
-	_speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
+	_speechVolumeSlider = addSlider(boss, 105, yoffset, kSpeechVolumeChanged, ws);
+	_speechVolumeLabel = new StaticTextWidget(boss, 105 + _musicVolumeSlider->getWidth() + 10, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft, ws);
+	_speechVolumeSlider->setMinValue(0);
+	_speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
 	_speechVolumeLabel->setFlags(WIDGET_CLEARBG);
-	yoffset += 16;
+	yoffset += _speechVolumeSlider->getHeight() + 4;
 
 	_enableVolumeSettings = true;
 

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- widget.cpp	18 May 2005 10:30:52 -0000	1.50
+++ widget.cpp	18 May 2005 15:58:39 -0000	1.51
@@ -238,8 +238,7 @@
 
 SliderWidget::SliderWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd)
 	: Widget(boss, x, y, w, h), CommandSender(boss),
-	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false)
-	  {
+	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) {
 	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
 	_type = kSliderWidget;
 }

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- widget.h	18 May 2005 10:30:52 -0000	1.44
+++ widget.h	18 May 2005 15:58:39 -0000	1.45
@@ -74,9 +74,13 @@
 enum {
 	kButtonWidth = 72,
 	kButtonHeight = 16,
-	
+	kSliderWidth = 85,
+	kSliderHeight = 12,
+
 	kBigButtonWidth = 108,
-	kBigButtonHeight = 24
+	kBigButtonHeight = 24,
+	kBigSliderWidth = 128,
+	kBigSliderHeight = 18
 };
 
 





More information about the Scummvm-git-logs mailing list