[Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.59,1.60 launcher.cpp,1.124,1.125 message.cpp,1.27,1.28 options.cpp,1.89,1.90

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Fri Jun 3 05:33:55 CEST 2005


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

Modified Files:
	dialog.cpp launcher.cpp message.cpp options.cpp 
Log Message:
Cleanup.


Index: dialog.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/dialog.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- dialog.cpp	2 Jun 2005 12:29:01 -0000	1.59
+++ dialog.cpp	3 Jun 2005 12:33:03 -0000	1.60
@@ -296,18 +296,15 @@
 }
 
 CheckboxWidget *Dialog::addCheckbox(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
-	const Graphics::Font *font;
 	int w, h;
 
 	if (ws == kBigWidgetSize) {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
 		h = kBigButtonHeight;
 	} else {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
 		h = kButtonHeight;
 	}
 
-	w = font->getFontHeight() + 10 + font->getStringWidth(label);
+	w = g_gui.getFontHeight() + 10 + g_gui.getStringWidth(label);
 
 	return new CheckboxWidget(boss, x, y, w, h, label, cmd, hotkey, ws);
 }
@@ -327,15 +324,7 @@
 }
 
 PopUpWidget *Dialog::addPopUp(GuiObject *boss, int x, int y, int w, const Common::String &label, uint labelWidth, WidgetSize ws) {
-	const Graphics::Font *font;
-
-	if (ws == kBigWidgetSize) {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
-	} else {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
-	}
-
-	return new PopUpWidget(boss, x, y, w, font->getFontHeight() + 2, label, labelWidth, ws);
+	return new PopUpWidget(boss, x, y, w, kLineHeight, label, labelWidth, ws);
 }
 
 uint32 GuiObject::getMillis() {

Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- launcher.cpp	20 May 2005 15:03:25 -0000	1.124
+++ launcher.cpp	3 Jun 2005 12:33:03 -0000	1.125
@@ -188,24 +188,14 @@
 	tab->addTab("Game");
 	yoffset = vBorder;
 
-	const Graphics::Font *font;
-
-	if (ws == GUI::kBigWidgetSize) {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
-	} else {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
-	}
-
-	int lineHeight = font->getFontHeight() + 2;
-
 	// GUI:  Label & edit widget for the game ID
-	new StaticTextWidget(tab, x, yoffset + 2, labelWidth, lineHeight, "ID: ", kTextAlignRight, ws);
-	_domainWidget = new DomainEditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, lineHeight, _domain, ws);
+	new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "ID: ", kTextAlignRight, ws);
+	_domainWidget = new DomainEditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, kLineHeight, _domain, ws);
 	yoffset += _domainWidget->getHeight() + 3;
 
 	// GUI:  Label & edit widget for the description
-	new StaticTextWidget(tab, x, yoffset + 2, labelWidth, lineHeight, "Name: ", kTextAlignRight, ws);
-	_descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, lineHeight, description, ws);
+	new StaticTextWidget(tab, x, yoffset + 2, labelWidth, kLineHeight, "Name: ", kTextAlignRight, ws);
+	_descriptionWidget = new EditTextWidget(tab, x + labelWidth, yoffset, _w - labelWidth - 10 - x, kLineHeight, description, ws);
 	yoffset += _descriptionWidget->getHeight() + 3;
 
 	// Language popup
@@ -234,12 +224,12 @@
 
 	// GUI:  Button + Label for the game path
 	addButton(tab, x, yoffset, "Game Path:", kCmdGameBrowser, 0, ws);
-	_gamePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, gamePath, kTextAlignLeft, ws);
+	_gamePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, gamePath, kTextAlignLeft, ws);
 	yoffset += buttonHeight + 4;
 
 	// GUI:  Button + Label for the additional path
 	addButton(tab, x, yoffset, "Extra Path:", kCmdExtraBrowser, 0, ws);
-	_extraPathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, extraPath, kTextAlignLeft, ws);
+	_extraPathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, extraPath, kTextAlignLeft, ws);
 	if (extraPath.isEmpty() || !ConfMan.hasKey("extrapath", _domain)) {
 		_extraPathWidget->setLabel("None");
 	}
@@ -247,7 +237,7 @@
 
 	// GUI:  Button + Label for the save path
 	addButton(tab, x, yoffset, "Save Path:", kCmdSaveBrowser, 0, ws);
-	_savePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, lineHeight, savePath, kTextAlignLeft, ws);
+	_savePathWidget = new StaticTextWidget(tab, x + buttonWidth + 20, yoffset + 3, _w - (x + buttonWidth + 20) - 10, kLineHeight, savePath, kTextAlignLeft, ws);
 	if (savePath.isEmpty() || !ConfMan.hasKey("savepath", _domain)) {
 		_savePathWidget->setLabel("Default");
 	}
@@ -507,25 +497,19 @@
 	_h = screenH;
 
 	GUI::WidgetSize ws;
-	int lineHeight;
 	int buttonHeight;
-	const Graphics::Font *font;
 	int top;
 
 	if (screenW >= 400 && screenH >= 300) {
 		ws = GUI::kBigWidgetSize;
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
-		lineHeight = font->getFontHeight() + 2;
 		buttonHeight = kBigButtonHeight;
 	} else {
 		ws = GUI::kNormalWidgetSize;
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
-		lineHeight = font->getFontHeight() + 2;
 		buttonHeight = kButtonHeight;
 	}
 
 	// Show ScummVM version
-	new StaticTextWidget(this, hBorder, 8, _w - 2*hBorder, lineHeight, gScummVMFullVersion, kTextAlignCenter, ws);
+	new StaticTextWidget(this, hBorder, 8, _w - 2*hBorder, kLineHeight, gScummVMFullVersion, kTextAlignCenter, ws);
 
 	// Add some buttons at the bottom
 	// TODO: Rearrange them a bit? In particular, we could put a slightly smaller space
@@ -551,7 +535,7 @@
 
 
 	// Add list with game titles
-	_list = new ListWidget(this, hBorder, lineHeight + 16, _w - 2 * hBorder, top - lineHeight - 20, ws);
+	_list = new ListWidget(this, hBorder, kLineHeight + 16, _w - 2 * hBorder, top - kLineHeight - 20, ws);
 	_list->setEditable(false);
 	_list->setNumberingMode(kListNumberingOff);
 

Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- message.cpp	20 May 2005 15:03:25 -0000	1.27
+++ message.cpp	3 Jun 2005 12:33:03 -0000	1.28
@@ -41,19 +41,14 @@
 	const int screenH = g_system->getOverlayHeight();
 
 	GUI::WidgetSize ws;
-	int lineHeight;
 	int buttonWidth, buttonHeight;
-	const Graphics::Font *font;
+
 	if (screenW >= 400 && screenH >= 300) {
 		ws = GUI::kBigWidgetSize;
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
-		lineHeight = font->getFontHeight() + 2;
 		buttonWidth = kBigButtonWidth;
 		buttonHeight = kBigButtonHeight;
 	} else {
 		ws = GUI::kNormalWidgetSize;
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
-		lineHeight = font->getFontHeight() + 2;
 		buttonWidth = kButtonWidth;
 		buttonHeight = kButtonHeight;
 	}
@@ -64,7 +59,7 @@
 	// the real size of the dialog
 	Common::StringList lines;
 	int lineCount, okButtonPos, cancelButtonPos;
-	int maxlineWidth = font->wordWrapText(message, screenW - 2 * 20, lines);
+	int maxlineWidth = g_gui.getFont().wordWrapText(message, screenW - 2 * 20, lines);
 
 	// Calculate the desired dialog size (maxing out at 300*180 for now)
 	_w = maxlineWidth + 20;
@@ -75,10 +70,10 @@
 		_h += buttonHeight + 8;
 
 	// Limit the number of lines so that the dialog still fits on the screen.
-	if (lineCount > (screenH - 20 - _h) / lineHeight) {
-		lineCount = (screenH - 20 - _h) / lineHeight;
+	if (lineCount > (screenH - 20 - _h) / kLineHeight) {
+		lineCount = (screenH - 20 - _h) / kLineHeight;
 	}
-	_h += lineCount * lineHeight;
+	_h += lineCount * kLineHeight;
 
 	// Center the dialog
 	_x = (screenW - _w) / 2;
@@ -86,7 +81,7 @@
 
 	// Each line is represented by one static text item.
 	for (int i = 0; i < lineCount; i++) {
-		new StaticTextWidget(this, 10, 10 + i * lineHeight, maxlineWidth, lineHeight,
+		new StaticTextWidget(this, 10, 10 + i * kLineHeight, maxlineWidth, kLineHeight,
 								lines[i], kTextAlignCenter, ws);
 	}
 

Index: options.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/options.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- options.cpp	20 May 2005 15:03:26 -0000	1.89
+++ options.cpp	3 Jun 2005 12:33:03 -0000	1.90
@@ -439,18 +439,10 @@
 		"Speech volume:"
 	};
 
-	const Graphics::Font *font;
-
-	if (ws == kBigWidgetSize) {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
-	} else {
-		font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
-	}
-
 	int textwidth = 0;
 
 	for (int i = 0; i < ARRAYSIZE(slider_labels); i++) {
-		int width = font->getStringWidth(slider_labels[i]);
+		int width = g_gui.getStringWidth(slider_labels[i]);
 
 		if (width > textwidth)
 			textwidth = width;





More information about the Scummvm-git-logs mailing list