[Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.50,1.51

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Mon May 16 14:19:29 CEST 2005


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

Modified Files:
	ListWidget.cpp 
Log Message:
Use the same offset - string width for the item number - for every line in
the list. There's a slight hack here: I've assumed that all digits have the
same width.


Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- ListWidget.cpp	15 May 2005 18:22:44 -0000	1.50
+++ ListWidget.cpp	16 May 2005 13:28:34 -0000	1.51
@@ -302,7 +302,7 @@
 	NewGui *gui = &g_gui;
 	int i, pos, len = _list.size();
 	Common::String buffer;
-	int offset, deltax;
+	int deltax;
 	Graphics::Surface *surf = &g_gui.getScreen();
 
 	// Draw a thin frame around the list.
@@ -329,9 +329,6 @@
 			sprintf(temp, "%2d. ", (pos + _numberingMode));
 			buffer = temp;
 			_font->drawString(surf, buffer, _x + 2, y, _w - 4, textColor);
-			offset = _font->getStringWidth(buffer);
-		} else {
-			offset = 0;
 		}
 
 		Common::Rect r(getEditRect());
@@ -358,7 +355,8 @@
 
 	if (_numberingMode != kListNumberingOff) {
 		char temp[10];
-		sprintf(temp, "%2d. ", (_selectedItem + _numberingMode));
+		// FIXME: Assumes that all digits have the same width.
+		sprintf(temp, "%2d. ", (_list.size() - 1 + _numberingMode));
 		r.left += _font->getStringWidth(temp);
 	}
 	





More information about the Scummvm-git-logs mailing list