[Scummvm-cvs-logs] CVS: scummvm/gui EditTextWidget.cpp,1.7,1.8 EditTextWidget.h,1.4,1.5 ListWidget.cpp,1.19,1.20 PopUpWidget.cpp,1.6,1.7 ScrollBarWidget.cpp,1.7,1.8 browser.cpp,1.5,1.6 browser.h,1.4,1.5 chooser.cpp,1.2,1.3 chooser.h,1.1,1.2 console.cpp,1.21,1.22 console.h,1.13,1.14 dialog.cpp,1.26,1.27 dialog.h,1.17,1.18 launcher.cpp,1.32,1.33 message.cpp,1.8,1.9 newgui.cpp,1.40,1.41 options.cpp,1.10,1.11 widget.cpp,1.10,1.11 widget.h,1.13,1.14

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Mar 6 11:55:04 CET 2003


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

Modified Files:
	EditTextWidget.cpp EditTextWidget.h ListWidget.cpp 
	PopUpWidget.cpp ScrollBarWidget.cpp browser.cpp browser.h 
	chooser.cpp chooser.h console.cpp console.h dialog.cpp 
	dialog.h launcher.cpp message.cpp newgui.cpp options.cpp 
	widget.cpp widget.h 
Log Message:
and more cleanup ....  Last

Index: EditTextWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/EditTextWidget.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- EditTextWidget.cpp	10 Jan 2003 21:33:42 -0000	1.7
+++ EditTextWidget.cpp	6 Mar 2003 19:52:45 -0000	1.8
@@ -24,8 +24,7 @@
 #include "newgui.h"
 
 EditTextWidget::EditTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text)
-	: StaticTextWidget(boss, x, y-1, w, h+2, text, kTextAlignLeft), _backupString(text)
-{
+	: StaticTextWidget(boss, x, y-1, w, h+2, text, kTextAlignLeft), _backupString(text) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	_type = kEditTextWidget;
 
@@ -35,8 +34,7 @@
 	_pos = _label.size();
 }
 
-void EditTextWidget::handleTickle()
-{
+void EditTextWidget::handleTickle() {
 	uint32 time = _boss->getGui()->get_time();
 	if (_caretTime < time) {
 		_caretTime = time + kCaretBlinkTime;
@@ -48,14 +46,12 @@
 	}
 }
 
-void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount)
-{
+void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	// TODO - once we support "real editing" (i.e. caret can be at any spot),
 	// a mouse click should place the caret.
 }
 
-bool EditTextWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers)
-{
+bool EditTextWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
 	bool handled = true;
 	bool dirty = false;
 
@@ -84,19 +80,19 @@
 			_label.deleteChar(_pos);
 			dirty = true;
 			break;
-		case 256+20:	// left arrow
+		case 256 + 20:	// left arrow
 			if (_pos > 0)
 				_pos--;
 			break;
-		case 256+19:	// right arrow
+		case 256 + 19:	// right arrow
 			if (_pos < _label.size())
 				_pos++;
 			break;
 			break;
-		case 256+22:	// home
+		case 256 + 22:	// home
 			_pos = 0;
 			break;
-		case 256+23:	// end
+		case 256 + 23:	// end
 			_pos = _label.size();
 			break;
 		default:
@@ -111,33 +107,31 @@
 
 	if (dirty)
 		draw();
-	
+
 	return handled;
 }
 
-void EditTextWidget::drawWidget(bool hilite)
-{
-	NewGui			*gui = _boss->getGui();
+void EditTextWidget::drawWidget(bool hilite) {
+	NewGui *gui = _boss->getGui();
 
 	// Draw a thin frame around us.
-	gui->hline(_x, _y, _x+_w-1, gui->_color);
-	gui->hline(_x, _y+_h-1, _x+_w-1, gui->_shadowcolor);
-	gui->vline(_x, _y, _y+_h-1, gui->_color);
-	gui->vline(_x+_w-1, _y, _y+_h-1, gui->_shadowcolor);
+	gui->hline(_x, _y, _x + _w - 1, gui->_color);
+	gui->hline(_x, _y + _h - 1, _x +_w - 1, gui->_shadowcolor);
+	gui->vline(_x, _y, _y + _h - 1, gui->_color);
+	gui->vline(_x + _w - 1, _y, _y + _h - 1, gui->_shadowcolor);
 
 	// Draw the text
-	_align = (gui->getStringWidth(_label) > _w-6) ? kTextAlignRight : kTextAlignLeft;
-	gui->drawString(_label, _x+2, _y+3, _w-6, gui->_textcolor, _align);
+	_align = (gui->getStringWidth(_label) > _w - 6) ? kTextAlignRight : kTextAlignLeft;
+	gui->drawString(_label, _x + 2, _y + 3, _w - 6, gui->_textcolor, _align);
 }
 
-void EditTextWidget::drawCaret(bool erase)
-{
+void EditTextWidget::drawCaret(bool erase) {
 	// Only draw if item is visible
 	if (!isVisible() || !_boss->isVisible())
 		return;
 
 	NewGui *gui = _boss->getGui();
-	
+
 	int16 color = erase ? gui->_bgcolor : gui->_textcolorhi;
 	int x = _x + _boss->getX() + 2;
 	int y = _y + _boss->getY() + 1;
@@ -146,12 +140,12 @@
 	for (int i = 0; i < _pos; i++)
 		width += gui->getCharWidth(_label[i]);
 
-	if (width > _w-6)
-		width = _w-6;
+	if (width > _w - 6)
+		width = _w - 6;
 	x += width;
 
-	gui->vline(x, y, y+kLineHeight, color);
+	gui->vline(x, y, y + kLineHeight, color);
 	gui->addDirtyRect(x, y, 2, kLineHeight);
-	
+
 	_caretVisible = !erase;
 }

Index: EditTextWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/EditTextWidget.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- EditTextWidget.h	10 Jan 2003 21:33:42 -0000	1.4
+++ EditTextWidget.h	6 Mar 2003 19:52:45 -0000	1.5
@@ -30,10 +30,10 @@
 	typedef ScummVM::StringList StringList;
 	typedef ScummVM::String String;
 protected:
-	String			_backupString;
+	String		_backupString;
 	bool			_caretVisible;
-	uint32			_caretTime;
-	int			_pos;
+	uint32		_caretTime;
+	int				_pos;
 public:
 	EditTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text);
 

Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- ListWidget.cpp	23 Nov 2002 00:10:31 -0000	1.19
+++ ListWidget.cpp	6 Mar 2003 19:52:46 -0000	1.20
@@ -26,8 +26,7 @@
 
 
 ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h)
-	: Widget(boss, x, y, w - kScrollBarWidth, h), CommandSender(boss)
-{
+	: Widget(boss, x, y, w - kScrollBarWidth, h), CommandSender(boss) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	_type = kListWidget;
 	_numberingMode = kListNumberingOne;
@@ -47,12 +46,10 @@
 	_editMode = false;
 }
 
-ListWidget::~ListWidget()
-{
+ListWidget::~ListWidget() {
 }
 
-void ListWidget::setList(const StringList& list)
-{
+void ListWidget::setList(const StringList &list) {
 	if (_editMode && _caretVisible)
 		drawCaret(true);
 	int size = list.size();
@@ -66,8 +63,7 @@
 	scrollBarRecalc();
 }
 
-void ListWidget::scrollTo(int item)
-{
+void ListWidget::scrollTo(int item) {
 	int size = _list.size();
 	if (item >= size)
 		item = size - 1;
@@ -80,16 +76,14 @@
 	}
 }
 
-void ListWidget::scrollBarRecalc()
-{
+void ListWidget::scrollBarRecalc() {
 	_scrollBar->_numEntries = _list.size();
 	_scrollBar->_entriesPerPage = _entriesPerPage;
 	_scrollBar->_currentPos = _currentPos;
 	_scrollBar->recalc();
 }
 
-void ListWidget::handleTickle()
-{
+void ListWidget::handleTickle() {
 	uint32 time = _boss->getGui()->get_time();
 	if (_editMode && _caretTime < time) {
 		_caretTime = time + kCaretBlinkTime;
@@ -101,8 +95,7 @@
 	}
 }
 
-void ListWidget::handleMouseDown(int x, int y, int button, int clickCount)
-{
+void ListWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	if (isEnabled()) {
 		int oldSelectedItem = _selectedItem;
 		_selectedItem = (y - 1) / kLineHeight + _currentPos;
@@ -122,8 +115,7 @@
 	}
 }
 
-void ListWidget::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void ListWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 	// If this was a double click and the mouse is still over the selected item,
 	// send the double click command
 	if (clickCount > 1 && (_selectedItem == (y - 1) / kLineHeight + _currentPos)) {
@@ -131,13 +123,11 @@
 	}
 }
 
-void ListWidget::handleMouseWheel(int x, int y, int direction)
-{
+void ListWidget::handleMouseWheel(int x, int y, int direction) {
 	_scrollBar->handleMouseWheel(x, y, direction);
 }
 
-bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers)
-{
+bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
 	bool handled = true;
 	bool dirty = false;
 	int oldSelectedItem = _selectedItem;
@@ -237,26 +227,23 @@
 	_currentKeyDown = keycode;
 
 #endif
-	
+
 	return handled;
 }
 
-bool ListWidget::handleKeyUp(uint16 ascii, int keycode, int modifiers)
-{
+bool ListWidget::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
 	if (keycode == _currentKeyDown)
 		_currentKeyDown = 0;
 	return true;
 }
 
-void ListWidget::lostFocusWidget()
-{
+void ListWidget::lostFocusWidget() {
 	_editMode = false;
 	drawCaret(true);
 	draw();
 }
 
-void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void ListWidget::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	switch (cmd) {
 	case kSetPositionCmd:
 		if (_currentPos != (int)data) {
@@ -267,16 +254,15 @@
 	}
 }
 
-void ListWidget::drawWidget(bool hilite)
-{
-	NewGui			*gui = _boss->getGui();
-	int				i, pos, len = _list.size();
-	ScummVM::String	buffer;
+void ListWidget::drawWidget(bool hilite) {
+	NewGui *gui = _boss->getGui();
+	int i, pos, len = _list.size();
+	ScummVM::String buffer;
 
 	// Draw a thin frame around the list.
-	gui->hline(_x, _y, _x+_w-1, gui->_color);
-	gui->hline(_x, _y+_h-1, _x+_w-1, gui->_shadowcolor);
-	gui->vline(_x, _y, _y+_h-1, gui->_color);
+	gui->hline(_x, _y, _x + _w - 1, gui->_color);
+	gui->hline(_x, _y + _h - 1, _x + _w - 1, gui->_shadowcolor);
+	gui->vline(_x, _y, _y + _h - 1, gui->_color);
 
 	// Draw the list items
 	for (i = 0, pos = _currentPos; i < _entriesPerPage && pos < len; i++, pos++) {
@@ -290,17 +276,16 @@
 
 		if (_selectedItem == pos) {
 			if (_hasFocus)
-				gui->fillRect(_x+1, _y+1 + kLineHeight * i, _w - 1, kLineHeight, gui->_textcolorhi);
+				gui->fillRect(_x + 1, _y + 1 + kLineHeight * i, _w - 1, kLineHeight, gui->_textcolorhi);
 			else
-				gui->frameRect(_x+1, _y+1 + kLineHeight * i, _w - 1, kLineHeight, gui->_textcolorhi);
+				gui->frameRect(_x + 1, _y + 1 + kLineHeight * i, _w - 1, kLineHeight, gui->_textcolorhi);
 		}
-		gui->drawString(buffer, _x+2, _y+3 + kLineHeight * i, _w - 4,
+		gui->drawString(buffer, _x + 2, _y + 3 + kLineHeight * i, _w - 4,
 							(_selectedItem == pos && _hasFocus) ? gui->_bgcolor : gui->_textcolor);
 	}
 }
 
-void ListWidget::drawCaret(bool erase)
-{
+void ListWidget::drawCaret(bool erase) {
 	// Only draw if item is visible
 	if (_selectedItem < _currentPos || _selectedItem >= _currentPos + _entriesPerPage)
 		return;
@@ -308,7 +293,7 @@
 		return;
 
 	NewGui *gui = _boss->getGui();
-	
+
 	// The item is selected, thus _bgcolor is used to draw the caret and _textcolorhi to erase it
 	int16 color = erase ? gui->_textcolorhi : gui->_bgcolor;
 	int x = _x + _boss->getX() + 3;
@@ -334,7 +319,6 @@
 }
 
 void ListWidget::scrollToCurrent() {
-
 	// Only do something if the current item is not in our view port
 	if (_selectedItem < _currentPos) {
 		// it's above our view
@@ -351,8 +335,7 @@
 	_scrollBar->recalc();
 }
 
-void ListWidget::startEditMode()
-{
+void ListWidget::startEditMode() {
 	if (_editable && !_editMode && _selectedItem >= 0) {
 		_editMode = true;
 		_backupString = _list[_selectedItem];
@@ -360,8 +343,7 @@
 	}
 }
 
-void ListWidget::abortEditMode()
-{
+void ListWidget::abortEditMode() {
 	if (_editMode) {
 		_editMode = false;
 		_list[_selectedItem] = _backupString;

Index: PopUpWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/PopUpWidget.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- PopUpWidget.cpp	14 Dec 2002 17:59:22 -0000	1.6
+++ PopUpWidget.cpp	6 Mar 2003 19:52:46 -0000	1.7
@@ -77,11 +77,10 @@
 
 PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY)
 	: Dialog(boss->_boss->getGui(), 0, 0, 16, 16),
-	_popUpBoss(boss)
-{
+	_popUpBoss(boss) {
 	// Copy the selection index
 	_selection = _popUpBoss->_selectedItem;
-	
+
 	// Calculate real popup dimensions
 	_x = _popUpBoss->_boss->getX() + _popUpBoss->_x;
 	_y = _popUpBoss->_boss->getY() + _popUpBoss->_y - _popUpBoss->_selectedItem * kLineHeight;
@@ -104,18 +103,17 @@
 	// Remember original mouse position
 	_clickX = clickX - _x;
 	_clickY = clickY - _y;
-	
+
 	// Time the popup was opened
 	_openTime = g_system->get_msecs();
 }
 
-void PopUpDialog::drawDialog()
-{
+void PopUpDialog::drawDialog() {
 	// Draw the menu border
-	_gui->hline(_x, _y, _x+_w-1, _gui->_color);
-	_gui->hline(_x, _y+_h-1, _x+_w-1, _gui->_shadowcolor);
-	_gui->vline(_x, _y, _y+_h-1, _gui->_color);
-	_gui->vline(_x+_w-1, _y, _y+_h-1, _gui->_shadowcolor);
+	_gui->hline(_x, _y, _x+_w - 1, _gui->_color);
+	_gui->hline(_x, _y + _h - 1, _x + _w - 1, _gui->_shadowcolor);
+	_gui->vline(_x, _y, _y+_h - 1, _gui->_color);
+	_gui->vline(_x + _w - 1, _y, _y + _h - 1, _gui->_shadowcolor);
 
 	// Draw the entries
 	int count = _popUpBoss->_entries.size();
@@ -126,12 +124,11 @@
 	_gui->addDirtyRect(_x, _y, _w, _h);
 }
 
-void PopUpDialog::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void PopUpDialog::handleMouseUp(int x, int y, int button, int clickCount) {
 	// Mouse was released. If it wasn't moved much since the original mouse down, 
 	// let the popup stay open. If it did move, assume the user made his selection.
 	int dist = (_clickX - x) * (_clickX - x) + (_clickY - y) * (_clickY - y);
-	if (dist > 3*3 || g_system->get_msecs() - _openTime > 300) {
+	if (dist > 3 * 3 || g_system->get_msecs() - _openTime > 300) {
 		setResult(_selection);
 		close();
 	}
@@ -140,16 +137,14 @@
 	_openTime = (uint32)-1;
 }
 
-void PopUpDialog::handleMouseWheel(int x, int y, int direction)
-{
+void PopUpDialog::handleMouseWheel(int x, int y, int direction) {
 	if (direction < 0)
 		moveUp();
 	else if (direction > 0)
 		moveDown();
 }
 
-void PopUpDialog::handleMouseMoved(int x, int y, int button)
-{
+void PopUpDialog::handleMouseMoved(int x, int y, int button) {
 	// Compute over which item the mouse is...
 	int item = findItem(x, y);
 
@@ -163,8 +158,7 @@
 	setSelection(item);
 }
 
-void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
-{
+void PopUpDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
 	if (keycode == 27) {	// escape
 		close();
 		return;
@@ -194,16 +188,14 @@
 	}
 }
 
-int PopUpDialog::findItem(int x, int y) const
-{
+int PopUpDialog::findItem(int x, int y) const {
 	if (x >= 0 && x < _w && y >= 0 && y < _h) {
 		return (y-2) / kLineHeight;
 	}
 	return -1;
 }
 
-void PopUpDialog::setSelection(int item)
-{
+void PopUpDialog::setSelection(int item) {
 	if (item != _selection) {
 		// Undraw old selection
 		if (_selection >= 0)
@@ -218,8 +210,7 @@
 	}
 }
 
-bool PopUpDialog::isMouseDown()
-{
+bool PopUpDialog::isMouseDown() {
 	// TODO/FIXME - need a way to determine whether any mouse buttons are pressed or not.
 	// Sure, we could just count mouse button up/down events, but that is cumbersome and
 	// error prone. Would be much nicer to add an API to OSystem for this...
@@ -227,8 +218,7 @@
 	return false;
 }
 
-void PopUpDialog::moveUp()
-{
+void PopUpDialog::moveUp() {
 	if (_selection < 0) {
 		setSelection(_popUpBoss->_entries.size() - 1);
 	} else if (_selection > 0) {
@@ -241,8 +231,7 @@
 	}
 }
 
-void PopUpDialog::moveDown()
-{
+void PopUpDialog::moveDown() {
 	int lastItem = _popUpBoss->_entries.size() - 1;
 
 	if (_selection < 0) {
@@ -257,9 +246,7 @@
 	}
 }
 
-
-void PopUpDialog::drawMenuEntry(int entry, bool hilite)
-{
+void PopUpDialog::drawMenuEntry(int entry, bool hilite) {
 	// Draw one entry of the popup menu, including selection
 	assert(entry >= 0);
 	int x = _x + 1;
@@ -270,30 +257,27 @@
 	_gui->fillRect(x, y, w, kLineHeight, hilite ? _gui->_textcolorhi : _gui->_bgcolor);
 	if (name.size() == 0) {
 		// Draw a seperator
-		_gui->hline(x, y+kLineHeight/2, x+w-1, _gui->_color);
-		_gui->hline(x+1, y+1+kLineHeight/2, x+w-1, _gui->_shadowcolor);
+		_gui->hline(x, y + kLineHeight / 2, x + w - 1, _gui->_color);
+		_gui->hline(x + 1, y + 1 + kLineHeight / 2, x + w - 1, _gui->_shadowcolor);
 	} else {
-		_gui->drawString(name, x+1, y+2, w-2, hilite ? _gui->_bgcolor : _gui->_textcolor);
+		_gui->drawString(name, x + 1, y + 2, w - 2, hilite ? _gui->_bgcolor : _gui->_textcolor);
 	}
 	_gui->addDirtyRect(x, y, w, kLineHeight);
 }
 
-
 //
 // PopUpWidget
 //
 
 PopUpWidget::PopUpWidget(Dialog *boss, int x, int y, int w, int h)
-	: Widget(boss, x, y-1, w, h+2), CommandSender(boss)
-{
+	: Widget(boss, x, y - 1, w, h + 2), CommandSender(boss) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
 	_type = 'POPU';
 
 	_selectedItem = -1;
 }
 
-void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount)
-{
+void PopUpWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	PopUpDialog popupDialog(this, x + _x + _boss->getX(), y + _y + _boss->getY());
 	int newSel = popupDialog.runModal();
 	if (newSel != -1 && _selectedItem != newSel) {
@@ -302,22 +286,19 @@
 	}
 }
 
-void PopUpWidget::appendEntry(const String &entry, uint32 tag)
-{
+void PopUpWidget::appendEntry(const String &entry, uint32 tag) {
 	Entry e;
 	e.name = entry;
 	e.tag = tag;
 	_entries.push_back(e);
 }
 
-void PopUpWidget::clearEntries()
-{
+void PopUpWidget::clearEntries() {
 	_entries.clear();
 	_selectedItem = -1;
 }
 
-void PopUpWidget::setSelected(int item)
-{
+void PopUpWidget::setSelected(int item) {
 	// FIXME
 	if (item != _selectedItem) {
 		if (item >= 0 && item < _entries.size()) {
@@ -328,20 +309,19 @@
 	}
 }
 
-void PopUpWidget::drawWidget(bool hilite)
-{
+void PopUpWidget::drawWidget(bool hilite) {
 	NewGui	*gui = _boss->getGui();
 
 	// Draw a thin frame around us.
 	// TODO - should look different than the EditTextWidget fram
-	gui->hline(_x, _y, _x+_w-1, gui->_color);
-	gui->hline(_x, _y+_h-1, _x+_w-1, gui->_shadowcolor);
+	gui->hline(_x, _y, _x + _w - 1, gui->_color);
+	gui->hline(_x, _y +_h-1, _x + _w - 1, gui->_shadowcolor);
 	gui->vline(_x, _y, _y+_h-1, gui->_color);
-	gui->vline(_x+_w-1, _y, _y+_h-1, gui->_shadowcolor);
-	
+	gui->vline(_x + _w - 1, _y, _y +_h - 1, gui->_shadowcolor);
+
 	// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
 	gui->drawBitmap(up_down_arrows, _x+_w - 10, _y+2, hilite ? gui->_textcolorhi : gui->_textcolor);
-	
+
 	// Draw the selected entry, if any
 	if (_selectedItem >= 0) {
 		int align = (gui->getStringWidth(_entries[_selectedItem].name) > _w-6) ? kTextAlignRight : kTextAlignLeft;

Index: ScrollBarWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ScrollBarWidget.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ScrollBarWidget.cpp	12 Dec 2002 12:07:46 -0000	1.7
+++ ScrollBarWidget.cpp	6 Mar 2003 19:52:46 -0000	1.8
@@ -61,8 +61,7 @@
 };
 
 ScrollBarWidget::ScrollBarWidget(Dialog *boss, int x, int y, int w, int h)
-	: Widget (boss, x, y, w, h), CommandSender(boss)
-{
+	: Widget (boss, x, y, w, h), CommandSender(boss) {
 	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG | WIDGET_WANT_TICKLE;
 	_type = kScrollBarWidget;
 
@@ -78,8 +77,7 @@
 	_currentPos = 0;
 }
 
-void ScrollBarWidget::handleMouseDown(int x, int y, int button, int clickCount)
-{
+void ScrollBarWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	int old_pos = _currentPos;
 
 	// Do nothing if there are less items than fit on one page
@@ -107,13 +105,11 @@
 	checkBounds(old_pos);
 }
 
-void ScrollBarWidget::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void ScrollBarWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 	_draggingPart = kNoPart;
 }
 
-void ScrollBarWidget::handleMouseWheel(int x, int y, int direction)
-{
+void ScrollBarWidget::handleMouseWheel(int x, int y, int direction) {
 	int old_pos = _currentPos;
 
 	if (_numEntries < _entriesPerPage)
@@ -129,8 +125,7 @@
 	checkBounds(old_pos);
 }
 
-void ScrollBarWidget::handleMouseMoved(int x, int y, int button)
-{
+void ScrollBarWidget::handleMouseMoved(int x, int y, int button) {
 	// Do nothing if there are less items than fit on one page
 	if (_numEntries <= _entriesPerPage)
 		return;
@@ -167,8 +162,7 @@
 	}
 }
 
-void ScrollBarWidget::handleTickle()
-{
+void ScrollBarWidget::handleTickle() {
 /*
 	// FIXME - this code is supposed to allow for "click-repeat" (like key repeat),
 	// i.e. if you click on one of the arrows and keep clicked, it will scroll
@@ -188,8 +182,7 @@
 */
 }
 
-void ScrollBarWidget::checkBounds(int old_pos)
-{
+void ScrollBarWidget::checkBounds(int old_pos) {
 	if (_numEntries <= _entriesPerPage || _currentPos < 0)
 		_currentPos = 0;
 	else if (_currentPos > _numEntries - _entriesPerPage)
@@ -202,8 +195,7 @@
 	}
 }
 
-void ScrollBarWidget::recalc()
-{
+void ScrollBarWidget::recalc() {
 	if (_numEntries > _entriesPerPage) {
 		_sliderHeight = (_h - 2 * UP_DOWN_BOX_HEIGHT) * _entriesPerPage / _numEntries;
 		if (_sliderHeight < UP_DOWN_BOX_HEIGHT)
@@ -219,9 +211,7 @@
 	}
 }
 
-
-void ScrollBarWidget::drawWidget(bool hilite)
-{
+void ScrollBarWidget::drawWidget(bool hilite) {
 	NewGui *gui = _boss->getGui();
 	int bottomY = _y + _h;
 	bool isSinglePage = (_numEntries <= _entriesPerPage);
@@ -234,19 +224,19 @@
 	// Up arrow
 	gui->frameRect(_x, _y, _w, UP_DOWN_BOX_HEIGHT, gui->_color);
 	gui->drawBitmap(up_arrow, _x, _y,
-	                isSinglePage ? gui->_color :
-	                (hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor);
+									isSinglePage ? gui->_color :
+									(hilite && _part == kUpArrowPart) ? gui->_textcolorhi : gui->_textcolor);
 
 	// Down arrow
 	gui->frameRect(_x, bottomY - UP_DOWN_BOX_HEIGHT, _w, UP_DOWN_BOX_HEIGHT, gui->_color);
 	gui->drawBitmap(down_arrow, _x, bottomY - UP_DOWN_BOX_HEIGHT,
-	                isSinglePage ? gui->_color :
-	                (hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor);
+									isSinglePage ? gui->_color :
+									(hilite && _part == kDownArrowPart) ? gui->_textcolorhi : gui->_textcolor);
 
 	// Slider
 	if (!isSinglePage) {
 		gui->checkerRect(_x, _y + _sliderPos, _w, _sliderHeight,
-		                 (hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor);
+										(hilite && _part == kSliderPart) ? gui->_textcolorhi : gui->_textcolor);
 		gui->frameRect(_x, _y + _sliderPos, _w, _sliderHeight, gui->_color);
 	}
 }

Index: browser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- browser.cpp	21 Nov 2002 02:51:17 -0000	1.5
+++ browser.cpp	6 Mar 2003 19:52:46 -0000	1.6
@@ -36,37 +36,33 @@
 };
 
 BrowserDialog::BrowserDialog(NewGui *gui)
-	: Dialog(gui, 40, 10, 320-2*40, 200-2*10),
-	  _node(0), _nodeContent(0)
-{
+	: Dialog(gui, 40, 10, 320 -2 * 40, 200 - 2 * 10),
+	  _node(0), _nodeContent(0) {
 	// Headline - TODO: should be customizable during creation time
-	new StaticTextWidget(this, 10, 8, _w-2*10, kLineHeight,
+	new StaticTextWidget(this, 10, 8, _w-2 * 10, kLineHeight,
 		"Select directory with game data", kTextAlignCenter);
-	
+
 	// Current path - TODO: handle long paths ?
-	_currentPath =
-	new StaticTextWidget(this, 10, 20, _w-2*10, kLineHeight,
-		"DUMMY", kTextAlignLeft);
+	_currentPath = new StaticTextWidget(this, 10, 20, _w - 2 * 10, kLineHeight,
+								"DUMMY", kTextAlignLeft);
 
 	// Add file list
-	_fileList = new ListWidget(this, 10, 34, _w-2*10, _h-34-24-10);
+	_fileList = new ListWidget(this, 10, 34, _w - 2 * 10, _h - 34 - 24 - 10);
 	_fileList->setNumberingMode(kListNumberingOff);
-	
+
 	// Buttons
-	addButton(10, _h-24, "Go up", kGoUpCmd, 0);
-	addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
+	addButton(10, _h - 24, "Go up", kGoUpCmd, 0);
+	addButton(_w-2 * (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0);
 	addButton(_w-(kButtonWidth+10), _h-24, "Choose", kChooseCmd, 0);
 }
 
-BrowserDialog::~BrowserDialog()
-{
+BrowserDialog::~BrowserDialog() {
 	delete _node;
 	delete _nodeContent;
 	delete _choice;
 }
 
-void BrowserDialog::open()
-{
+void BrowserDialog::open() {
 	// If no node has been set, or the last used one is now invalid,
 	// go back to the root/default dir.
 	if (_node == NULL || !_node->isValid()) {
@@ -86,8 +82,7 @@
 	Dialog::open();
 }
 
-void BrowserDialog::close()
-{
+void BrowserDialog::close() {
 	delete _nodeContent;
 	_nodeContent = 0;
 
@@ -95,8 +90,7 @@
 	Dialog::close();
 }
 
-void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void BrowserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	FilesystemNode *tmp;
 	
 	switch (cmd) {
@@ -130,8 +124,7 @@
 	}
 }
 
-void BrowserDialog::updateListing()
-{
+void BrowserDialog::updateListing() {
 	assert(_node != NULL);
 
 	// Update the path display

Index: browser.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- browser.h	19 Nov 2002 01:36:47 -0000	1.4
+++ browser.h	6 Mar 2003 19:52:47 -0000	1.5
@@ -41,8 +41,8 @@
 	virtual void open();
 	virtual void close();
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
-	
-	FilesystemNode	*getResult()	{ return _choice; };
+
+	FilesystemNode	*getResult() { return _choice; };
 
 protected:
 	ListWidget		*_fileList;
@@ -50,7 +50,7 @@
 	FilesystemNode	*_node;
 	FSList			*_nodeContent;
 	FilesystemNode	*_choice;
-	
+
 	void updateListing();
 };
 

Index: chooser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/chooser.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- chooser.cpp	20 Dec 2002 22:45:36 -0000	1.2
+++ chooser.cpp	6 Mar 2003 19:52:47 -0000	1.3
@@ -27,27 +27,25 @@
 };
 
 ChooserDialog::ChooserDialog(NewGui *gui, const String title, const StringList& list)
-	: Dialog(gui, 8, 24, 320-2*8, 141)
-{
+	: Dialog(gui, 8, 24, 320 -2 * 8, 141) {
 	// Headline
-	new StaticTextWidget(this, 10, 8, _w-2*10, kLineHeight, title, kTextAlignCenter);
-	
+	new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);
+
 	// Add choice list
-	_list = new ListWidget(this, 10, 22, _w-2*10, _h-22-24-10);
+	_list = new ListWidget(this, 10, 22, _w - 2 * 10, _h - 22 - 24 - 10);
 	_list->setNumberingMode(kListNumberingOff);
 	_list->setList(list);
 	
 	// Buttons
-	addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
-	_chooseButton = addButton(_w-(kButtonWidth+10), _h-24, "Choose", kChooseCmd, 0);
+	addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
+	_chooseButton = addButton(_w-(kButtonWidth + 10), _h - 24, "Choose", kChooseCmd, 0);
 	_chooseButton->setEnabled(false);
-	
+
 	// Result = -1 -> no choice was made
 	setResult(-1);
 }
 
-void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	int item = _list->getSelected();
 	switch (cmd) {
 	case kChooseCmd:

Index: chooser.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/chooser.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- chooser.h	21 Nov 2002 12:48:50 -0000	1.1
+++ chooser.h	6 Mar 2003 19:52:47 -0000	1.2
@@ -36,7 +36,7 @@
 	typedef ScummVM::String String;
 	typedef ScummVM::StringList StringList;
 public:
-	ChooserDialog(NewGui *gui, const String title, const StringList& list);
+	ChooserDialog(NewGui *gui, const String title, const StringList &list);
 
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- console.cpp	28 Dec 2002 04:51:34 -0000	1.21
+++ console.cpp	6 Mar 2003 19:52:47 -0000	1.22
@@ -48,20 +48,19 @@
  * - a *lot* of others things, this code is in no way complete and heavily under progress
  */
 ConsoleDialog::ConsoleDialog(NewGui *gui, int _realWidth)
-	: Dialog(gui, 0, 0, _realWidth, 12*kLineHeight+2)
-{
+	: Dialog(gui, 0, 0, _realWidth, 12 * kLineHeight + 2) {
 	_lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth;
 	_linesPerPage = (_h - 2) / kLineHeight;
 
 	memset(_buffer, ' ', kBufferSize);
 	_linesInBuffer = kBufferSize / _lineWidth;
-	
+
 	_currentPos = 0;
 	_scrollLine = _linesPerPage - 1;
-	
+
 	_caretVisible = false;
 	_caretTime = 0;
-	
+
 	// Add scrollbar
 	_scrollBar = new ScrollBarWidget(this, _w - kScrollBarWidth - 1, 0, kScrollBarWidth, _h);
 	_scrollBar->setTarget(this);
@@ -69,23 +68,22 @@
 	// Display greetings & prompt
 	print("ScummVM "SCUMMVM_VERSION" (" SCUMMVM_CVS ")\n");
 	print("Console is ready\n");
-	
+
 	_promptStartPos = _promptEndPos = -1;
-	
+
 	// Init callback
 	_callbackProc = 0;
 	_callbackRefCon = 0;
- 
- 	// Init History
- 	_historyIndex = 0;
- 	_historyLine = 0;
- 	_historySize = 0;
- 	for (int i = 0; i < kHistorySize; i++)
- 		_history[i][0] = '\0';
+
+	// Init History
+	_historyIndex = 0;
+	_historyLine = 0;
+	_historySize = 0;
+	for (int i = 0; i < kHistorySize; i++)
+		_history[i][0] = '\0';
 }
 
-void ConsoleDialog::open()
-{
+void ConsoleDialog::open() {
 	Dialog::open();
 	if (_promptStartPos == -1) {
 		print(PROMPT);
@@ -93,13 +91,12 @@
 	}
 }
 
-void ConsoleDialog::drawDialog()
-{
+void ConsoleDialog::drawDialog() {
 	// Blend over the background
 	_gui->blendRect(_x, _y, _w, _h, _gui->_bgcolor, 2);
-	
+
 	// Draw a border
-	_gui->hline(_x, _y+_h-1, _x+_w-1, _gui->_color);
+	_gui->hline(_x, _y + _h - 1, _x + _w - 1, _gui->_color);
 
 	// Draw text
 	int start = _scrollLine - _linesPerPage + 1;
@@ -107,7 +104,7 @@
 	for (int line = 0; line < _linesPerPage; line++) {
 		int x = _x + 1;
 		for (int column = 0; column < _lineWidth; column++) {
-			int l = (start+line) % _linesInBuffer;
+			int l = (start + line) % _linesInBuffer;
 			byte c = _buffer[l * _lineWidth + column];
 			_gui->drawChar(c, x, y, _gui->_textcolor);
 			x += kCharWidth;
@@ -122,8 +119,7 @@
 	_gui->addDirtyRect(_x, _y, _w, _h);
 }
 
-void ConsoleDialog::handleTickle()
-{
+void ConsoleDialog::handleTickle() {
 	uint32 time = _gui->get_time();
 	if (_caretTime < time) {
 		_caretTime = time + kCaretBlinkTime;
@@ -135,15 +131,13 @@
 	}
 }
 
-void ConsoleDialog::handleMouseWheel(int x, int y, int direction)
-{
+void ConsoleDialog::handleMouseWheel(int x, int y, int direction) {
 	_scrollBar->handleMouseWheel(x, y, direction);
 }
 
-void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
-{
+void ConsoleDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
 	int i;
-	
+
 	switch (keycode) {
 		case '\n':	// enter/return
 		case '\r': {
@@ -158,7 +152,7 @@
 			// FIXME - len should NEVER be negative. If anything makes it negative,
 			// then the code doing that is buggy and needs to be fixed.
 			assert(len >= 0);
-			
+
 			if (len > 0) {
 
 				// We have to allocate the string buffer with new, since VC++ sadly does not
@@ -169,21 +163,21 @@
 				for (i = 0; i < len; i++)
 					str[i] = _buffer[(_promptStartPos + i) % kBufferSize];
 				str[len] = '\0';
-				
+
 				// Add the input to the history
 				addToHistory(str);
-				
+
 				// Pass it to the input callback, if any
 				if (_callbackProc)
 					keepRunning = (*_callbackProc)(this, str, _callbackRefCon);
-	
+
 					// Get rid of the string buffer
 				delete [] str;
 			}
-			
+
 			print(PROMPT);
 			_promptStartPos = _promptEndPos = _currentPos;
-			
+
 			draw();
 			if (!keepRunning)
 				close();
@@ -195,7 +189,7 @@
 		case 8:		// backspace
 			if (_caretVisible)
 				drawCaret(true);
-		
+
 			if (_currentPos > _promptStartPos) {
 				_currentPos--;
 				killChar();
@@ -208,23 +202,23 @@
 			draw();
 			break;
 /*
-		case 256+24:	// pageup
+		case 256 + 24:	// pageup
 			_selectedItem -= _entriesPerPage - 1;
 			if (_selectedItem < 0)
 				_selectedItem = 0;
 			break;
-		case 256+25:	// pagedown
+		case 256 + 25:	// pagedown
 			_selectedItem += _entriesPerPage - 1;
 			if (_selectedItem >= _list.size() )
 				_selectedItem = _list.size() - 1;
 			break;
 */
-		case 256+22:	// home
+		case 256 + 22:	// home
 			_scrollLine = _linesPerPage - 1;	// FIXME - this is not correct after a wrap around
 			updateScrollBar();
 			draw();
 			break;
-		case 256+23:	// end
+		case 256 + 23:	// end
 			_scrollLine = _currentPos / _lineWidth;
 			updateScrollBar();
 			draw();
@@ -253,7 +247,7 @@
 				specialKeys(keycode);
 			} else if (isprint((char)ascii)) {
 				for (i = _promptEndPos-1; i >= _currentPos; i--)
-					_buffer[(i+1) % kBufferSize] = _buffer[i % kBufferSize];
+					_buffer[(i + 1) % kBufferSize] = _buffer[i % kBufferSize];
 				_promptEndPos++;
 				putchar((char)ascii);
 				scrollToCurrent();
@@ -261,8 +255,7 @@
 	}
 }
 
-void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void ConsoleDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	switch (cmd) {
 	case kSetPositionCmd:
 		int newPos = (int)data + _linesPerPage - 1;
@@ -274,8 +267,7 @@
 	}
 }
 
-void ConsoleDialog::specialKeys(int keycode)
-{
+void ConsoleDialog::specialKeys(int keycode) {
 	switch (keycode) {
 		case 'a':
 			_currentPos = _promptStartPos;
@@ -302,23 +294,20 @@
 	}
 }
 
-void ConsoleDialog::killChar()
-{
+void ConsoleDialog::killChar() {
 	for (int i = _currentPos; i < _promptEndPos; i++)
 		_buffer[i % kBufferSize] = _buffer[(i+1) % kBufferSize];
 	_buffer[_promptEndPos % kBufferSize] = ' ';
 	_promptEndPos--;
 }
 
-void ConsoleDialog::killLine()
-{
+void ConsoleDialog::killLine() {
 	for (int i = _currentPos; i < _promptEndPos; i++)
 		_buffer[i % kBufferSize] = ' ';
 	_promptEndPos = _currentPos;
 }
 
-void ConsoleDialog::killLastWord()
-{
+void ConsoleDialog::killLastWord() {
 	int pos;
 	int cnt = 0;
 	while (_currentPos > _promptStartPos) {
@@ -336,8 +325,7 @@
 	_promptEndPos -= cnt + 1;
 }
 
-void ConsoleDialog::addToHistory(const char *str)
-{
+void ConsoleDialog::addToHistory(const char *str) {
 	strcpy(_history[_historyIndex], str);
 	_historyIndex = (_historyIndex + 1) % kHistorySize;
 	_historyLine = 0;
@@ -345,8 +333,7 @@
 		_historySize++;
 }
 
-void ConsoleDialog::historyScroll(int direction)
-{
+void ConsoleDialog::historyScroll(int direction) {
 	if (_historySize == 0)
 		return;
 
@@ -383,26 +370,23 @@
 	for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++)
 		putcharIntern(_history[idx][i]);
 	_promptEndPos = _currentPos;
-	
+
 	// Ensure once more the caret is visible (in case of very long history entries)
 	scrollToCurrent();
-	
+
 	draw();
 }
 
-
-void ConsoleDialog::nextLine()
-{
+void ConsoleDialog::nextLine() {
 	int line = _currentPos / _lineWidth;
 	if (line == _scrollLine)
 		_scrollLine++;
 	_currentPos = (line + 1) * _lineWidth;
-	
+
 	updateScrollBar();
 }
 
-void ConsoleDialog::updateScrollBar()
-{
+void ConsoleDialog::updateScrollBar() {
 	int line = _currentPos / _lineWidth;
 	_scrollBar->_numEntries = (line < _linesInBuffer) ? line + 1 : _linesInBuffer;
 	_scrollBar->_currentPos = _scrollBar->_numEntries - (line - _scrollLine + _linesPerPage);
@@ -410,8 +394,7 @@
 	_scrollBar->recalc();
 }
 
-int ConsoleDialog::printf(const char *format, ...)
-{
+int ConsoleDialog::printf(const char *format, ...) {
 	va_list	argptr;
 
 	va_start(argptr, format);
@@ -420,8 +403,7 @@
 	return count;
 }
 
-int ConsoleDialog::vprintf(const char *format, va_list argptr)
-{
+int ConsoleDialog::vprintf(const char *format, va_list argptr) {
 	char	buf[2048];
 
 #if defined(WIN32)
@@ -433,18 +415,15 @@
 	return count;
 }
 
-void ConsoleDialog::putchar(int c)
-{
+void ConsoleDialog::putchar(int c) {
 	if (_caretVisible)
 		drawCaret(true);
 
 	putcharIntern(c);
-
 	draw();	// FIXME - not nice to redraw the full console just for one char!
 }
 
-void ConsoleDialog::putcharIntern(int c)
-{
+void ConsoleDialog::putcharIntern(int c) {
 	if (c == '\n')
 		nextLine();
 	else {
@@ -457,8 +436,7 @@
 	}
 }
 
-void ConsoleDialog::print(const char *str)
-{
+void ConsoleDialog::print(const char *str) {
 	if (_caretVisible)
 		drawCaret(true);
 
@@ -468,8 +446,7 @@
 	draw();
 }
 
-void ConsoleDialog::drawCaret(bool erase)
-{
+void ConsoleDialog::drawCaret(bool erase) {
 	int line = _currentPos / _lineWidth;
 	int displayLine = line - _scrollLine + _linesPerPage - 1;
 
@@ -485,21 +462,20 @@
 	char c = _buffer[getBufferPos()];
 	if (erase) {
 		_gui->fillRect(x, y, kCharWidth, kLineHeight, _gui->_bgcolor);
-		_gui->drawChar(c, x, y+2, _gui->_textcolor);
+		_gui->drawChar(c, x, y + 2, _gui->_textcolor);
 	} else {
 		_gui->fillRect(x, y, kCharWidth, kLineHeight, _gui->_textcolor);
-		_gui->drawChar(c, x, y+2, _gui->_bgcolor);
+		_gui->drawChar(c, x, y + 2, _gui->_bgcolor);
 	}
 	_gui->addDirtyRect(x, y, kCharWidth, kLineHeight);
-	
+
 	_caretVisible = !erase;
 }
 
-void ConsoleDialog::scrollToCurrent()
-{
+void ConsoleDialog::scrollToCurrent() {
 	int line = _currentPos / _lineWidth;
 	int displayLine = line - _scrollLine + _linesPerPage - 1;
-	
+
 	if (displayLine < 0) {
 		// TODO - this should only occur for loong edit lines, though
 	} else if (displayLine >= _linesPerPage) {

Index: console.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- console.h	28 Dec 2002 04:51:34 -0000	1.13
+++ console.h	6 Mar 2003 19:52:47 -0000	1.14
@@ -46,7 +46,7 @@
 
 	int		_lineWidth;
 	int		_linesPerPage;
-	
+
 	int		_currentPos;
 	int		_scrollLine;
 	
@@ -55,13 +55,13 @@
 
 	bool	_caretVisible;
 	uint32	_caretTime;
-	
-	ScrollBarWidget	*_scrollBar;
-	
+
+	ScrollBarWidget *_scrollBar;
+
 	// The _callbackProc is called whenver a data line is entered
 	// 
 	InputCallbackProc _callbackProc;
-	void	*_callbackRefCon;
+	void *_callbackRefCon;
 
 	char _history[kHistorySize][kLineBufferSize];
 	int _historySize;
@@ -84,8 +84,7 @@
 #undef putchar
 	void putchar(int c);
 	
-	void setInputeCallback(InputCallbackProc proc, void *refCon)
-	{
+	void setInputeCallback(InputCallbackProc proc, void *refCon) {
 		_callbackProc = proc;
 		_callbackRefCon = refCon;
 	}

Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dialog.cpp	22 Nov 2002 14:02:31 -0000	1.26
+++ dialog.cpp	6 Mar 2003 19:52:48 -0000	1.27
@@ -38,8 +38,7 @@
  * ...
  */
 
-Dialog::~Dialog()
-{
+Dialog::~Dialog() {
 	Widget *w = _firstWidget, *next;
 	while (w) {
 		next = w->_next;
@@ -50,22 +49,20 @@
 	_firstWidget = 0;
 }
 
-int Dialog::runModal()
-{
+int Dialog::runModal() {
 	// Open up
 	open();
-	
+
 	// Start processing events
 	_gui->runLoop();
-	
+
 	// Return the result code
 	return _result;
 }
 
-void Dialog::open()
-{
+void Dialog::open() {
 	Widget *w = _firstWidget;
-	
+
 	_result = 0;
 	_visible = true;
 	_gui->openDialog(this);
@@ -74,15 +71,14 @@
 	while (w && !w->wantsFocus()) {
 		w = w->_next;
 	}
-	
+
 	if (w) {
 		w->receivedFocus();
 		_focusedWidget = w;
 	}
 }
 
-void Dialog::close()
-{
+void Dialog::close() {
 	_visible = false;
 	_gui->closeTopDialog();
 
@@ -93,22 +89,18 @@
 	releaseFocus();
 }
 
-void Dialog::releaseFocus()
-{
+void Dialog::releaseFocus() {
 	if (_focusedWidget) {
 		_focusedWidget->lostFocus();
 		_focusedWidget = 0;
 	}
 }
 
-
-void Dialog::draw()
-{
+void Dialog::draw() {
 	_gui->_needRedraw = true;
 }
 
-void Dialog::drawDialog()
-{
+void Dialog::drawDialog() {
 	Widget *w = _firstWidget;
 	
 	if (!isVisible())
@@ -125,8 +117,7 @@
 	_gui->addDirtyRect(_x, _y, _w, _h);
 }
 
-void Dialog::handleMouseDown(int x, int y, int button, int clickCount)
-{
+void Dialog::handleMouseDown(int x, int y, int button, int clickCount) {
 	Widget *w;
 	w = findWidget(x, y);
 
@@ -141,11 +132,11 @@
 		// The focus will change. Tell the old focused widget (if any)
 		// that it lost the focus.
 		releaseFocus();
-	
+
 		// Tell the new focused widget (if any) that it just gained the focus.
 		if (w)
 			w->receivedFocus();
-	
+
 		_focusedWidget = w;
 	}
 
@@ -153,10 +144,9 @@
 		_focusedWidget->handleMouseDown(x - _focusedWidget->_x, y - _focusedWidget->_y, button, clickCount);
 }
 
-void Dialog::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void Dialog::handleMouseUp(int x, int y, int button, int clickCount) {
 	Widget *w;
-	
+
 	if (_focusedWidget) {
 		w = _focusedWidget;
 		
@@ -173,8 +163,7 @@
 		w->handleMouseUp(x - w->_x, y - w->_y, button, clickCount);
 }
 
-void Dialog::handleMouseWheel(int x, int y, int direction)
-{
+void Dialog::handleMouseWheel(int x, int y, int direction) {
 	Widget *w;
 
 	// This may look a bit backwards, but I think it makes more sense for
@@ -188,8 +177,7 @@
 		w->handleMouseWheel(x, y, direction);
 }
 
-void Dialog::handleKeyDown(uint16 ascii, int keycode, int modifiers)
-{
+void Dialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) {
 	if (_focusedWidget) {
 		if (_focusedWidget->handleKeyDown(ascii, keycode, modifiers))
 			return;
@@ -212,19 +200,17 @@
 	// ESC closes all dialogs by default
 	if (keycode == 27)
 		close();
-	
+
 	// TODO: tab/shift-tab should focus the next/previous focusable widget
 }
 
-void Dialog::handleKeyUp(uint16 ascii, int keycode, int modifiers)
-{
+void Dialog::handleKeyUp(uint16 ascii, int keycode, int modifiers) {
 	// Focused widget recieves keyup events
 	if (_focusedWidget)
 		_focusedWidget->handleKeyUp(ascii, keycode, modifiers);
 }
 
-void Dialog::handleMouseMoved(int x, int y, int button)
-{
+void Dialog::handleMouseMoved(int x, int y, int button) {
 	Widget *w;
 	
 	if (_focusedWidget) {
@@ -261,16 +247,14 @@
 	w->handleMouseMoved(x - w->_x, y - w->_y, button);
 }
 
-void Dialog::handleTickle()
-{
+void Dialog::handleTickle() {
 	// Focused widget recieves tickle notifications
 	if (_focusedWidget && _focusedWidget->getFlags() & WIDGET_WANT_TICKLE) {
 		_focusedWidget->handleTickle();
 	}
 }
 
-void Dialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void Dialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	switch (cmd) {
 	case kCloseCmd:
 		close();
@@ -282,8 +266,7 @@
  * Determine the widget at location (x,y) if any. Assumes the coordinates are
  * in the local coordinate system, i.e. relative to the top left of the dialog.
  */
-Widget *Dialog::findWidget(int x, int y)
-{
+Widget *Dialog::findWidget(int x, int y) {
 	Widget *w = _firstWidget;
 	while (w) {
 		// Stop as soon as we find a widget that contains the point (x,y)
@@ -294,13 +277,11 @@
 	return w;
 }
 
-ButtonWidget *Dialog::addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey)
-{
+ButtonWidget *Dialog::addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey) {
 	return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
 }
 
-PushButtonWidget *Dialog::addPushButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey)
-{
+PushButtonWidget *Dialog::addPushButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey) {
 	return new PushButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey);
 }
 

Index: dialog.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- dialog.h	22 Nov 2002 14:02:32 -0000	1.17
+++ dialog.h	6 Mar 2003 19:52:51 -0000	1.18
@@ -47,14 +47,14 @@
 
 private:
 	int		_result;
-	
+
 public:
 	Dialog(NewGui *gui, int x, int y, int w, int h)
 		: _gui(gui), _x(x), _y(y), _w(w), _h(h), _firstWidget(0),
-		  _mouseWidget(0), _focusedWidget(0), _visible(false)
-		{}
+		  _mouseWidget(0), _focusedWidget(0), _visible(false) {
+	}
 	virtual ~Dialog();
-	
+
 	virtual int runModal();
 
 	NewGui	*getGui()			{ return _gui; }
@@ -80,10 +80,10 @@
 	virtual void handleMouseMoved(int x, int y, int button);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 	
-	Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
+	Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
 
-	ButtonWidget* addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey);
-	PushButtonWidget* addPushButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey);
+	ButtonWidget *addButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey);
+	PushButtonWidget *addPushButton(int x, int y, const ScummVM::String &label, uint32 cmd, char hotkey);
 
 	void setResult(int result) { _result = result; }
 };

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- launcher.cpp	20 Dec 2002 22:41:03 -0000	1.32
+++ launcher.cpp	6 Mar 2003 19:52:52 -0000	1.33
@@ -44,7 +44,6 @@
 
 typedef ScummVM::List<const VersionSettings *> GameList;
 
-
 /*
  * A dialog that allows the user to edit a config game entry.
  * TODO: add widgets for some/all of the following
@@ -78,17 +77,16 @@
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
 protected:
-	Config			&_config;
-	const String	&_domain;
-	EditTextWidget	*_descriptionWidget;
-	EditTextWidget	*_domainWidget;
-	CheckboxWidget  *_fullscreenCheckbox;
-	CheckboxWidget  *_amigaPalCheckbox;
+	Config &_config;
+	const String &_domain;
+	EditTextWidget *_descriptionWidget;
+	EditTextWidget *_domainWidget;
+	CheckboxWidget *_fullscreenCheckbox;
+	CheckboxWidget *_amigaPalCheckbox;
 };
 
 EditGameDialog::EditGameDialog(NewGui *gui, Config &config, const String &domain)
-	: Dialog(gui, 8, 50, 320-2*8, 200-2*40), _config(config), _domain(domain)
-{
+	: Dialog(gui, 8, 50, 320 - 2 * 8, 200 - 2 * 40), _config(config), _domain(domain) {
 	// Determine the description string
 	String gameid(_config.get("gameid", _domain));
 	String description(_config.get("description", _domain));
@@ -111,18 +109,18 @@
 	// Label & edit widget for the game ID
 	new StaticTextWidget(this, 10, 10, 40, kLineHeight, "ID: ", kTextAlignRight);
 	_domainWidget =
-		new EditTextWidget(this, 50, 10, _w-50-10, kLineHeight, _domain);
-	
+		new EditTextWidget(this, 50, 10, _w - 50 - 10, kLineHeight, _domain);
+
 	// Label & edit widget for the description
 	new StaticTextWidget(this, 10, 26, 40, kLineHeight, "Name: ", kTextAlignRight);
 	_descriptionWidget =
-		new EditTextWidget(this, 50, 26, _w-50-10, kLineHeight, description);
+		new EditTextWidget(this, 50, 26, _w - 50 - 10, kLineHeight, description);
 
 	// Path to game data (view only)
 	String path(_config.get("path", _domain));
 	new StaticTextWidget(this, 10, 42, 40, kLineHeight, "Path: ", kTextAlignRight);
-	new StaticTextWidget(this, 50, 42, _w-50-10, kLineHeight, path, kTextAlignLeft);
-	
+	new StaticTextWidget(this, 50, 42, _w - 50 - 10, kLineHeight, path, kTextAlignLeft);
+
 	// Full screen checkbox
 	_fullscreenCheckbox = new CheckboxWidget(this, 15, 62, 200, 16, "Use Fullscreen Mode", 0, 'F');
 	_fullscreenCheckbox->setState(_config.getBool("fullscreen", false, _domain));
@@ -136,12 +134,11 @@
 	}
 
 	// Add OK & Cancel buttons
-	addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
-	addButton(_w-(kButtonWidth+10), _h-24, "OK", kOKCmd, 0);
+	addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
+	addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
 }
 
-void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	if (cmd == kOKCmd) {
 		// Write back changes made to config object
 		String newDomain(_domainWidget->getLabel());
@@ -164,7 +161,6 @@
 	}
 }
 
-
 /*
  * TODO list
  * - add an text entry widget
@@ -177,29 +173,28 @@
  */
 
 LauncherDialog::LauncherDialog(NewGui *gui, GameDetector &detector)
-	: Dialog(gui, 0, 0, 320, 200), _detector(detector)
-{
+	: Dialog(gui, 0, 0, 320, 200), _detector(detector) {
 	// Show game name
 	new StaticTextWidget(this, 10, 8, 300, kLineHeight,
 								"ScummVM "SCUMMVM_VERSION " (" SCUMMVM_CVS ")", 
 								kTextAlignCenter);
 
 	// Add three buttons at the bottom
-	addButton(1*(_w - kButtonWidth)/6, _h - 24, "Quit", kQuitCmd, 'Q');
-	addButton(3*(_w - kButtonWidth)/6, _h - 24, "Options", kOptionsCmd, 'O');
-	_startButton = addButton(5*(_w - kButtonWidth)/6, _h - 24, "Start", kStartCmd, 'S');
+	addButton(1 * (_w - kButtonWidth) / 6, _h - 24, "Quit", kQuitCmd, 'Q');
+	addButton(3 * (_w - kButtonWidth) / 6, _h - 24, "Options", kOptionsCmd, 'O');
+	_startButton = addButton(5 * (_w - kButtonWidth)/6, _h - 24, "Start", kStartCmd, 'S');
 
 	// Add list with game titles
 	_list = new ListWidget(this, 10, 28, 300, 112);
 	_list->setEditable(false);
 	_list->setNumberingMode(kListNumberingOff);
-	
+
 	// Two more buttons directly below the list box
 	const int kBigButtonWidth = 90;
 	new ButtonWidget(this, 10, 144, kBigButtonWidth, 16, "Add Game...", kAddGameCmd, 'A');
-	_editButton = new ButtonWidget(this, (320-kBigButtonWidth)/2, 144, kBigButtonWidth, 16, "Edit Game...", kEditGameCmd, 'E');
-	_removeButton = new ButtonWidget(this, 320-kBigButtonWidth-10, 144, kBigButtonWidth, 16, "Remove Game", kRemoveGameCmd, 'R');
-	
+	_editButton = new ButtonWidget(this, (320-kBigButtonWidth) / 2, 144, kBigButtonWidth, 16, "Edit Game...", kEditGameCmd, 'E');
+	_removeButton = new ButtonWidget(this, 320-kBigButtonWidth - 10, 144, kBigButtonWidth, 16, "Remove Game", kRemoveGameCmd, 'R');
+
 	// Populate the list
 	updateListing();
 
@@ -211,29 +206,24 @@
 
 	// Create file browser dialog
 	_browser = new BrowserDialog(_gui);
-
 }
 
-LauncherDialog::~LauncherDialog()
-{
+LauncherDialog::~LauncherDialog() {
 	delete _browser;
 }
 
-void LauncherDialog::open()
-{
+void LauncherDialog::open() {
 	Dialog::open();
 	g_config->set_writing(true);
 }
 
-void LauncherDialog::close()
-{
+void LauncherDialog::close() {
 	g_config->flush();
 	g_config->set_writing(false);
 	Dialog::close();
 }
 
-void LauncherDialog::updateListing()
-{
+void LauncherDialog::updateListing() {
 	int i;
 	const VersionSettings *v = version_settings;
 	ScummVM::StringList l;
@@ -244,7 +234,7 @@
 	for (i = 0; i < domains.size(); i++) {
 		String name(g_config->get("gameid", domains[i]));
 		String description(g_config->get("description", domains[i]));
-		
+
 		if (name.isEmpty())
 			name = domains[i];
 		if (description.isEmpty()) {
@@ -276,8 +266,7 @@
 /*
  * Return a list of all games which might be the game in the specified directory.
  */
-GameList findGame(FilesystemNode *dir)
-{
+GameList findGame(FilesystemNode *dir) {
 	GameList list;
 
 	FSList *files = dir->listDir(FilesystemNode::kListFilesOnly);
@@ -322,8 +311,7 @@
 	return list;
 }
 
-void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	int item =  _list->getSelected();
 
 	switch (cmd) {
@@ -342,12 +330,12 @@
 		if (_browser->runModal()) {
 			// User did make a choice...
 			FilesystemNode *dir = _browser->getResult();
-			
+
 			// ...so let's determine a list of candidates, games that
 			// could be contained in the specified directory.
 			GameList candidates = findGame(dir);
 			const VersionSettings *v = 0;
-			
+
 			if (candidates.isEmpty()) {
 				// No game was found in the specified directory
 				MessageDialog alert(_gui, "ScummVM could not find any game in the specified directory!");
@@ -367,7 +355,7 @@
 				if (0 <= i && i < candidates.size())
 					v = candidates[i];
 			}
-			
+
 			if (v != 0) {
 				// The auto detector or the user made a choice.
 				// Pick a domain name which does not yet exist (after all, we

Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- message.cpp	2 Jan 2003 10:36:16 -0000	1.8
+++ message.cpp	6 Mar 2003 19:52:53 -0000	1.9
@@ -23,14 +23,12 @@
 #include "newgui.h"
 
 enum {
-        kOkCmd = 'OK  ',
-        kCancelCmd = 'CNCL'
+	kOkCmd = 'OK  ',
+	kCancelCmd = 'CNCL'
 };
 
-
 MessageDialog::MessageDialog(NewGui *gui, const String &message, uint32 timer, bool showOkButton, bool showCancelButton)
-	: Dialog(gui, 30, 20, 260, 124)
-{
+	: Dialog(gui, 30, 20, 260, 124) {
 	// First, determine the size the dialog needs. For this we have to break
 	// down the string into lines, and taking the maximum of their widths.
 	// Using this, and accounting for the space the button(s) need, we can set
@@ -96,15 +94,13 @@
 		_timer = 0;
 }
 
-void MessageDialog::handleTickle()
-{
+void MessageDialog::handleTickle() {
 	Dialog::handleTickle();
 	if (_timer && _gui->get_time() > _timer)
 		close();
 }
 
-int MessageDialog::addLine(StringList &lines, const char *line, int size)
-{
+int MessageDialog::addLine(StringList &lines, const char *line, int size) {
 	int width = 0, maxWidth = 0;
 	const char *start = line, *pos = line, *end = start + size;
 	String tmp;
@@ -149,8 +145,7 @@
 	return maxWidth;
 }
 
-void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	if (cmd == kOkCmd) {
 		setResult(1);
 		close();

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- newgui.cpp	28 Dec 2002 04:51:34 -0000	1.40
+++ newgui.cpp	6 Mar 2003 19:52:53 -0000	1.41
@@ -43,9 +43,8 @@
  */
 
 enum {
-	kDoubleClickDelay = 500,    // milliseconds
+	kDoubleClickDelay = 500, // milliseconds
 	kCursorAnimateDelay = 500,
-	
 	kKeyRepeatInitialDelay = 400,
 	kKeyRepeatSustainDelay = 100
 };
@@ -82,17 +81,15 @@
 
 // Constructor
 NewGui::NewGui(OSystem *system) : _system(system), _screen(0), _needRedraw(false),
-	_stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0)
-{
+	_stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) {
 	// Clear the cursor
 	memset(_cursor, 0xFF, sizeof(_cursor));
-	
+
 	// Reset key repeat
 	_currentKeyDown.keycode = 0;
 }
 
-void NewGui::runLoop()
-{
+void NewGui::runLoop() {
 	Dialog *activeDialog = _dialogStack.top();
 	bool didSaveState = false;
 
@@ -110,7 +107,7 @@
 	_shadowcolor = _system->RBGToColor(64, 64, 64);
 	_textcolor = _system->RBGToColor(32, 160, 32);
 	_textcolorhi = _system->RBGToColor(0, 255, 0);
-	
+
 	if (!_stateIsSaved) {
 		saveState();
 		didSaveState = true;
@@ -119,7 +116,7 @@
 	while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
 
 		activeDialog->handleTickle();
-	
+
 		if (_needRedraw) {
 			// Restore the overlay to its initial state, then draw all dialogs.
 			// This is necessary to get the blending right.
@@ -129,7 +126,7 @@
 				_dialogStack[i]->drawDialog();
 			_needRedraw = false;
 		}
-		
+
 		animateCursor();
 		_system->update_screen();		
 
@@ -165,8 +162,8 @@
 				case OSystem::EVENT_LBUTTONDOWN:
 				case OSystem::EVENT_RBUTTONDOWN: {
 					if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay)
-					      && ABS(_lastClick.x - event.mouse.x) < 3
-					      && ABS(_lastClick.y - event.mouse.y) < 3) {
+								&& ABS(_lastClick.x - event.mouse.x) < 3
+								&& ABS(_lastClick.y - event.mouse.y) < 3) {
 						_lastClick.count++;
 					} else {
 						_lastClick.x = event.mouse.x;
@@ -191,10 +188,8 @@
 		}
 
 		// check if event should be sent again (keydown)
-		if (_currentKeyDown.keycode != 0)
-		{
-			if (_keyRepeatTime < time)
-			{
+		if (_currentKeyDown.keycode != 0) {
+			if (_keyRepeatTime < time) {
 				// fire event
 				activeDialog->handleKeyDown(_currentKeyDown.ascii, _currentKeyDown.keycode, _currentKeyDown.flags);
 				_keyRepeatTime = time + kKeyRepeatSustainDelay;
@@ -211,14 +206,13 @@
 
 #pragma mark -
 
-void NewGui::saveState()
-{
+void NewGui::saveState() {
 	int sys_height = _system->get_height();
 	int sys_width = _system->get_width();
 
 	// Backup old cursor
 	_oldCursorMode = _system->show_mouse(true);
-	
+
 	_system->show_overlay();
 	// TODO - add getHeight & getWidth methods to OSystem.
 	_screen = new int16[sys_width * sys_height];
@@ -233,8 +227,7 @@
 	_stateIsSaved = true;
 }
 
-void NewGui::restoreState()
-{
+void NewGui::restoreState() {
 	_system->show_mouse(_oldCursorMode);
 
 	_system->hide_overlay();
@@ -242,40 +235,34 @@
 		delete [] _screen;
 		_screen = 0;
 	}
-	
+
 	_system->update_screen();
 	
 	_stateIsSaved = false;
 }
 
-void NewGui::openDialog(Dialog *dialog)
-{
+void NewGui::openDialog(Dialog *dialog) {
 	_dialogStack.push(dialog);
 	_needRedraw = true;
 }
 
-void NewGui::closeTopDialog()
-{
+void NewGui::closeTopDialog() {
 	// Don't do anything if no dialog is open
 	if (_dialogStack.empty())
 		return;
-	
+
 	// Remove the dialog from the stack
 	_dialogStack.pop();
 	_needRedraw = true;
 }
 
-
 #pragma mark -
 
-
-int16 *NewGui::getBasePtr(int x, int y)
-{
+int16 *NewGui::getBasePtr(int x, int y) {
 	return _screen + x + y * _screenPitch;
 }
 
-void NewGui::box(int x, int y, int width, int height, bool inverted)
-{
+void NewGui::box(int x, int y, int width, int height, bool inverted) {
 	int16 colorA = inverted ? _shadowcolor : _color;
 	int16 colorB = inverted ? _color : _shadowcolor;
 
@@ -290,8 +277,7 @@
 	vline(x + width - 2, y + 1, y + height - 1, colorB);
 }
 
-void NewGui::line(int x, int y, int x2, int y2, int16 color)
-{
+void NewGui::line(int x, int y, int x2, int y2, int16 color) {
 	int16 *ptr;
 
 	if (x2 < x)
@@ -316,8 +302,7 @@
 	}
 }
 
-void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level)
-{
+void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level) {
 	int r, g, b;
 	uint8 ar, ag, ab;
 	_system->colorToRBG(color, ar, ag, ab);
@@ -338,8 +323,7 @@
 	}
 }
 
-void NewGui::fillRect(int x, int y, int w, int h, int16 color)
-{
+void NewGui::fillRect(int x, int y, int w, int h, int16 color) {
 	int i;
 	int16 *ptr = getBasePtr(x, y);
 
@@ -351,8 +335,7 @@
 	}
 }
 
-void NewGui::checkerRect(int x, int y, int w, int h, int16 color)
-{
+void NewGui::checkerRect(int x, int y, int w, int h, int16 color) {
 	int i;
 	int16 *ptr = getBasePtr(x, y);
 
@@ -365,8 +348,7 @@
 	}
 }
 
-void NewGui::frameRect(int x, int y, int w, int h, int16 color)
-{
+void NewGui::frameRect(int x, int y, int w, int h, int16 color) {
 	int i;
 	int16 *ptr, *basePtr = getBasePtr(x, y);
 	if (basePtr == NULL)
@@ -386,8 +368,7 @@
 		*ptr = color;
 }
 
-void NewGui::addDirtyRect(int x, int y, int w, int h)
-{
+void NewGui::addDirtyRect(int x, int y, int w, int h) {
 	// For now we don't keep yet another list of dirty rects but simply
 	// blit the affected area directly to the overlay. At least for our current
 	// GUI/widget/dialog code that is just fine.
@@ -395,8 +376,7 @@
 	_system->copy_rect_overlay(buf, _screenPitch, x, y, w, h);
 }
 
-void NewGui::drawChar(const byte chr, int xx, int yy, int16 color)
-{
+void NewGui::drawChar(const byte chr, int xx, int yy, int16 color) {
 	unsigned int buffer = 0, mask = 0, x, y;
 	byte *tmp;
 
@@ -419,8 +399,7 @@
 	}
 }
 
-int NewGui::getStringWidth(const String &str)
-{
+int NewGui::getStringWidth(const String &str) {
 	int space = 0;
 
 	for (int i = 0; i < str.size(); ++i)
@@ -428,13 +407,11 @@
 	return space;
 }
 
-int NewGui::getCharWidth(byte c)
-{
+int NewGui::getCharWidth(byte c) {
 	return guifont[c+6];
 }
 
-void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align)
-{
+void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align) {
 	const int leftX = x, rightX = x + w;
 	int width = getStringWidth(str);
 	if (align == kTextAlignCenter)
@@ -455,8 +432,7 @@
 //
 // Blit from a buffer to the display
 //
-void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch)
-{
+void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch) {
 	int16 *ptr = getBasePtr(x, y);
 
 	assert(buf);
@@ -467,12 +443,10 @@
 	}
 }
 
-
 //
 // Blit from the display to a buffer
 //
-void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch)
-{
+void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) {
 	int16 *ptr = getBasePtr(x, y);
 
 	assert(buf);
@@ -483,12 +457,10 @@
 	}
 }
 
-
 //
 // Draw an 8x8 bitmap at location (x,y)
 //
-void NewGui::drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h)
-{
+void NewGui::drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h) {
 	int16 *ptr = getBasePtr(x, y);
 
 	for (y = 0; y < h; y++) {
@@ -506,8 +478,7 @@
 // Draw the mouse cursor (animated). This is mostly ripped from the cursor code in gfx.cpp
 // We could plug in a different cursor here if we like to.
 //
-void NewGui::animateCursor()
-{
+void NewGui::animateCursor() {
 	int time = get_time(); 
 	if (time > _cursorAnimateTimer + kCursorAnimateDelay) {
 		const byte colors[4] = { 15, 15, 7, 8 };

Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- options.cpp	2 Mar 2003 16:36:52 -0000	1.10
+++ options.cpp	6 Mar 2003 19:52:54 -0000	1.11
@@ -53,8 +53,7 @@
 };
 
 GlobalOptionsDialog::GlobalOptionsDialog(NewGui *gui)
-	: Dialog(gui, 10, 15, 320-2*10, 200-2*15)
-{
+	: Dialog(gui, 10, 15, 320 - 2 * 10, 200 - 2 * 15) {
 	// 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(this, 5, 10+1, 100, kLineHeight, "Graphics mode: ", kTextAlignRight);
@@ -87,7 +86,6 @@
 	}
 	midiPopUp->setSelected(0);
 
-
 	//
 	// Sound controllers
 	//
@@ -107,7 +105,7 @@
 	sfxVolumeSlider->setMinValue(0);	sfxVolumeSlider->setMaxValue(255);
 
 	Widget *masterVolumeLabel, *musicVolumeLabel, *sfxVolumeLabel;
-	
+
 	masterVolumeLabel = new StaticTextWidget(this, 200, yoffset+10, 24, 16, "100%", kTextAlignLeft);
 	musicVolumeLabel  = new StaticTextWidget(this, 200, yoffset+26, 24, 16, "100%", kTextAlignLeft);
 	sfxVolumeLabel    = new StaticTextWidget(this, 200, yoffset+42, 24, 16, "100%", kTextAlignLeft);
@@ -128,16 +126,14 @@
 	//
 	// Add OK & Cancel buttons
 	//
-	addButton(_w-2*(kButtonWidth+10), _h-24, "Cancel", kCloseCmd, 0);
-	addButton(_w-(kButtonWidth+10), _h-24, "OK", kOKCmd, 0);
+	addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
+	addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
 }
 
-GlobalOptionsDialog::~GlobalOptionsDialog()
-{
+GlobalOptionsDialog::~GlobalOptionsDialog() {
 }
 
-void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data)
-{
+void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
 	if (cmd == kOKCmd) {
 		// TODO Write back changes made to config object
 		setResult(1);

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	12 Dec 2002 23:21:29 -0000	1.10
+++ widget.cpp	6 Mar 2003 19:52:54 -0000	1.11
@@ -24,26 +24,22 @@
 #include "newgui.h"
 
 
-
 #ifdef _MSC_VER
 #	pragma warning( disable : 4068 ) // unknown pragma
 #endif
 
 
-
 Widget::Widget (Dialog *boss, int x, int y, int w, int h)
 	: _type(0), _boss(boss), _x(x), _y(y), _w(w), _h(h),
-	  _id(0), _flags(0), _hasFocus(false)
-{
+	  _id(0), _flags(0), _hasFocus(false) {
 	// Insert into the widget list of the boss
 	_next = _boss->_firstWidget;
 	_boss->_firstWidget = this;
 }
 
-void Widget::draw()
-{
+void Widget::draw() {
 	NewGui *gui = _boss->getGui();
-	
+
 	if (!isVisible() || !_boss->isVisible())
 		return;
 
@@ -62,7 +58,7 @@
 		_y += 4;
 		_w -= 8;
 	}
-	
+
 	// Now perform the actual widget draw
 	drawWidget((_flags & WIDGET_HILITED) ? true : false);
 
@@ -72,7 +68,7 @@
 		_y -= 4;
 		_w += 8;
 	}
-	
+
 	// Flag the draw area as dirty
 	gui->addDirtyRect(_x, _y, _w, _h);
 
@@ -80,69 +76,55 @@
 	_y -= _boss->_y;
 }
 
-
 #pragma mark -
 
-
 StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text, int align)
-	: Widget (boss, x, y, w, h), _align(align)
-{
+	: Widget (boss, x, y, w, h), _align(align) {
 	_type = kStaticTextWidget;
 	setLabel(text);
 }
 
-void StaticTextWidget::setValue(int value)
-{
+void StaticTextWidget::setValue(int value) {
 	char buf[256];
 	sprintf(buf, "%d", value);
 	_label = buf;
 }
 
-void StaticTextWidget::drawWidget(bool hilite)
-{
+void StaticTextWidget::drawWidget(bool hilite) {
 	NewGui *gui = _boss->getGui();
 	gui->drawString(_label, _x, _y, _w, gui->_textcolor, _align);
 }
 
-
 #pragma mark -
 
-
 ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
 	: StaticTextWidget(boss, x, y, w, h, label, kTextAlignCenter), CommandSender(boss),
-	  _cmd(cmd), _hotkey(hotkey)
-{
+	  _cmd(cmd), _hotkey(hotkey) {
 	_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
 	_type = kButtonWidget;
 }
 
-void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
 		sendCommand(_cmd, 0);
 }
 
-void ButtonWidget::drawWidget(bool hilite)
-{
+void ButtonWidget::drawWidget(bool hilite) {
 	NewGui *gui = _boss->getGui();
 	gui->drawString(_label, _x, _y, _w,
-	                !isEnabled() ? gui->_color :
-	                hilite ? gui->_textcolorhi : gui->_textcolor, _align);
+									!isEnabled() ? gui->_color :
+									hilite ? gui->_textcolorhi : gui->_textcolor, _align);
 }
 
-
 #pragma mark -
 
-
 PushButtonWidget::PushButtonWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
-	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false)
-{
+	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey), _state(false) {
 	_flags = WIDGET_ENABLED | WIDGET_BORDER | WIDGET_CLEARBG;
 	_type = kButtonWidget;
 }
 
-void PushButtonWidget::setState(bool state)
-{
+void PushButtonWidget::setState(bool state) {
 	if (_state != state) {
 		_state = state;
 		_flags ^= WIDGET_INV_BORDER;
@@ -150,10 +132,8 @@
 	}
 }
 
-
 #pragma mark -
 
-
 /* 8x8 checkbox bitmap */
 static uint32 checked_img[8] = {
 	0x00000000,
@@ -167,33 +147,30 @@
 };
 
 CheckboxWidget::CheckboxWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
-	: PushButtonWidget(boss, x, y, w, h, label, cmd, hotkey)
-{
+	: PushButtonWidget(boss, x, y, w, h, label, cmd, hotkey) {
 	_flags = WIDGET_ENABLED;
 	_type = kCheckboxWidget;
 }
 
-void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount)
-{
+void CheckboxWidget::handleMouseUp(int x, int y, int button, int clickCount) {
 	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) {
 		toggleState();
 		sendCommand(_cmd, 0);
 	}
 }
 
-void CheckboxWidget::drawWidget(bool hilite)
-{
+void CheckboxWidget::drawWidget(bool hilite) {
 	NewGui *gui = _boss->getGui();
-	
+
 	// Draw the box
 	gui->box(_x, _y, 14, 14);
-	
+
 	// If checked, draw cross inside the box
 	if (_state)
 		gui->drawBitmap(checked_img, _x + 3, _y + 3, gui->_textcolor);
 	else
 		gui->fillRect(_x + 2, _y + 2, 10, 10, gui->_bgcolor);
-	
+
 	// Finally draw the label
 	gui->drawString(_label, _x + 20, _y + 3, _w, gui->_textcolor);
 }
@@ -202,8 +179,7 @@
 
 SliderWidget::SliderWidget(Dialog *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey)
 	: ButtonWidget(boss, x, y, w, h, label, cmd, hotkey),
-	  _value(0), _valueMin(0), _valueMax(100)
-{
+	  _value(0), _valueMin(0), _valueMax(100) {
 	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
 	_type = kSliderWidget;
 }
@@ -227,7 +203,6 @@
 }
 
 void SliderWidget::handleMouseDown(int x, int y, int button, int clickCount) {
-	
 	if (isEnabled()) {
 		_isDragging = true;
 		handleMouseMoved(x, y, button);
@@ -235,31 +210,26 @@
 }
 
 void SliderWidget::handleMouseUp(int x, int y, int button, int clickCount) {
-
 	if (isEnabled() && _isDragging) {
 		sendCommand(_cmd, _value);
 	}
-
 	_isDragging = false;
 }
 
-void SliderWidget::drawWidget(bool hilite)
-{
+void SliderWidget::drawWidget(bool hilite) {
 	NewGui *gui = _boss->getGui();
-	
+
 	// Draw the box
 	gui->box(_x, _y, _w, _h);
-	
+
 	// Draw the 'bar'
 	gui->fillRect(_x + 2, _y + 2, valueToPos(_value), _h - 4, hilite ? gui->_textcolorhi : gui->_textcolor);
 }
 
-int SliderWidget::valueToPos(int value)
-{
+int SliderWidget::valueToPos(int value) {
 	return ((_w - 4) * (value - _valueMin) / (_valueMax - _valueMin));
 }
 
-int SliderWidget::posToValue(int pos)
-{
+int SliderWidget::posToValue(int pos) {
 	return (pos) * (_valueMax - _valueMin) / (_w - 4) + _valueMin;
 }

Index: widget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/widget.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- widget.h	25 Dec 2002 00:38:34 -0000	1.13
+++ widget.h	6 Mar 2003 19:52:54 -0000	1.14
@@ -79,8 +79,7 @@
 	void setTarget(CommandReceiver *target)	{ _target = target; }
 	CommandReceiver *getTarget() const		{ return _target; }
 
-	virtual void sendCommand(uint32 cmd, uint32 data)
-	{
+	virtual void sendCommand(uint32 cmd, uint32 data) {
 		if (_target && cmd)
 			_target->handleCommand(this, cmd, data);
 	}
@@ -120,7 +119,7 @@
 	void setFlags(int flags)	{ _flags |= flags; }
 	void clearFlags(int flags)	{ _flags &= ~flags; }
 	int getFlags() const		{ return _flags; }
-	
+
 	void setEnabled(bool e)		{ if (e) setFlags(WIDGET_ENABLED); else clearFlags(WIDGET_ENABLED); }
 	bool isEnabled() const		{ return _flags & WIDGET_ENABLED; }
 	bool isVisible() const		{ return !(_flags & WIDGET_INVISIBLE); }
@@ -132,7 +131,6 @@
 	virtual void lostFocusWidget() {}
 };
 
-
 /* StaticTextWidget */
 class StaticTextWidget : public Widget {
 protected:
@@ -143,16 +141,15 @@
 public:
 	StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const String &text, int align);
 	void setValue(int value);
-	void setLabel(const String &label) { _label = label; }
-	const String &getLabel() const     { return _label; }
-	void setAlign(int align)           { _align = align; }
-	int getAlign() const               { return _align; }
+	void setLabel(const String &label)	{ _label = label; }
+	const String &getLabel() const			{ return _label; }
+	void setAlign(int align)						{ _align = align; }
+	int getAlign() const								{ return _align; }
 
 protected:
 	void drawWidget(bool hilite);
 };
 
-
 /* ButtonWidget */
 class ButtonWidget : public StaticTextWidget, public CommandSender {
 	friend class Dialog;	// Needed for the hotkey handling
@@ -221,7 +218,7 @@
 
 protected:
 	void drawWidget(bool hilite);
-	
+
 	int valueToPos(int value);
 	int posToValue(int pos);
 };





More information about the Scummvm-git-logs mailing list