[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.12,1.13 dialog.h,1.5,1.6 widget.cpp,1.10,1.11 widget.h,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Mon Jul 8 15:12:03 CEST 2002


Update of /cvsroot/scummvm/scummvm/gui
In directory usw-pr-cvs1:/tmp/cvs-serv12840a/gui

Modified Files:
	dialog.cpp dialog.h widget.cpp widget.h 
Log Message:
replaced clearArea with the more general fillArea; added get/setValue methods to SliderWidget; changed look of SliderWidget a little bit; optimized drawing of SliderWidget

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dialog.cpp	8 Jul 2002 13:54:11 -0000	1.12
+++ dialog.cpp	8 Jul 2002 22:11:45 -0000	1.13
@@ -29,7 +29,7 @@
 {
 	Widget *w = _firstWidget;
 
-	_gui->clearArea(_x, _y, _w, _h);
+	_gui->fillArea(_x, _y, _w, _h, _gui->_bgcolor);
 	_gui->box(_x, _y, _w, _h);
 	_gui->setAreaDirty(_x, _y, _w, _h);
 

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- dialog.h	8 Jul 2002 00:29:47 -0000	1.5
+++ dialog.h	8 Jul 2002 22:11:46 -0000	1.6
@@ -43,6 +43,7 @@
 	int16	_x, _y;
 	uint16	_w, _h;
 	Widget	*_mouseWidget;
+
 public:
 	Dialog(NewGui *gui, int x, int y, int w, int h)
 		: _gui(gui), _firstWidget(0), _x(x), _y(y), _w(w), _h(h), _mouseWidget(0)
@@ -66,6 +67,7 @@
 	void addButton(int x, int y, int w, int h, const char *label, uint32 cmd, char hotkey);
 };
 
+
 class SaveLoadDialog : public Dialog {
 public:
 	SaveLoadDialog(NewGui *gui);
@@ -73,7 +75,17 @@
 	virtual void handleCommand(uint32 cmd);
 };
 
+
+class SoundDialog;
+class KeysDialog;
+class MiscDialog;
+
 class OptionsDialog : public Dialog {
+protected:
+	SoundDialog		*_soundDialog;
+	KeysDialog		*_keysDialog;
+	MiscDialog		*_miscDialog;
+
 public:
 	OptionsDialog(NewGui *gui);
 

Index: widget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- widget.cpp	8 Jul 2002 13:52:50 -0000	1.10
+++ widget.cpp	8 Jul 2002 22:11:47 -0000	1.11
@@ -45,7 +45,7 @@
 
 	// Clear background
 	if (_flags & WIDGET_CLEARBG)
-		gui->clearArea(_x, _y, _w, _h);
+		gui->fillArea(_x, _y, _w, _h, gui->_bgcolor);
 
 	// Draw border
 	if (_flags & WIDGET_BORDER) {
@@ -148,15 +148,16 @@
 	if (_state)
 		gui->drawBitmap(checked_img, _x + 3, _y + 3, gui->_textcolor);
 	else
-		gui->clearArea(_x + 3, _y + 3, 8, 8);
+		gui->fillArea(_x + 3, _y + 3, 8, 8, gui->_bgcolor);
 	
 	// Finally draw the label
 	gui->drawString(_text, _x + 20, _y + 3, _w, gui->_textcolor);
 }
 
 #pragma mark -
+
 SliderWidget::SliderWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd, uint8 hotkey)
-	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey)
+	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _value(0), _old_value(1)
 {
 	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE;
 	_type = kSliderWidget;
@@ -168,9 +169,15 @@
 	
 	// Draw the box
 	gui->box(_x, _y, _w, _h);
+	
+	// Remove old 'bar' if necessary
+	if (_value != _old_value) {
+		gui->fillArea(_x + 2 + ((_w - 5) * _old_value / 100), _y + 2, 2, _h - 4, gui->_bgcolor);
+		_old_value = _value;
+	}
 
 	// Draw the 'bar'
-	gui->line(_x + 2 + ((_w - 5)* _value / 100), _y + 2, _x + 2 + ((_w - 5)* _value / 100), _y + _h - 3, hilite ? gui->_textcolorhi : gui->_textcolor);
+	gui->fillArea(_x + 2 + ((_w - 5) * _value / 100), _y + 2, 2, _h - 4, hilite ? gui->_textcolorhi : gui->_textcolor);
 }
 
 void SliderWidget::handleMouseMoved(int x, int y, int state) { 
@@ -179,7 +186,7 @@
 
 		if (newvalue != _value) {
 			_value = newvalue; 
-			setFlags(WIDGET_CLEARBG); draw(); clearFlags(WIDGET_CLEARBG);
+			draw();
 		}
 	}
-}
\ No newline at end of file
+}

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- widget.h	8 Jul 2002 13:58:13 -0000	1.8
+++ widget.h	8 Jul 2002 22:11:47 -0000	1.9
@@ -122,9 +122,12 @@
 /* SliderWidget */
 class SliderWidget : public ButtonWidget {
 protected:
-	int	_value;
+	uint8	_value, _old_value;
 public:
 	SliderWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd = 0, uint8 hotkey = 0);
+	void setValue(uint8 value)	{ _value = value; }
+	uint8 getValue()			{ return _value; }
+
 	void handleMouseMoved(int x, int y, int button);
 
 protected:





More information about the Scummvm-git-logs mailing list