[Scummvm-cvs-logs] SF.net SVN: scummvm: [22522] scummvm/trunk/gui

sev at users.sourceforge.net sev at users.sourceforge.net
Thu May 18 09:46:01 CEST 2006


Revision: 22522
Author:   sev
Date:     2006-05-18 09:44:44 -0700 (Thu, 18 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22522&view=rev

Log Message:
-----------
Fix bug #1483272: "GUI: SCUMM pause dialog breaks upon scaler switch". Also
fix same problem in scumm help dialog.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/dialogs.cpp
    scummvm/trunk/engines/scumm/dialogs.h
    scummvm/trunk/gui/widget.h
Modified: scummvm/trunk/engines/scumm/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.cpp	2006-05-18 15:40:44 UTC (rev 22521)
+++ scummvm/trunk/engines/scumm/dialogs.cpp	2006-05-18 16:44:44 UTC (rev 22522)
@@ -712,11 +712,32 @@
 
 HelpDialog::HelpDialog(const GameSettings &game)
 	: ScummDialog("scummhelp"), _game(game) {
+	_title = new StaticTextWidget(this, "scummhelp_title", "");
+
+	_page = 1;
+
+	_numPages = ScummHelp::numPages(_game.id);
+
+	_prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
+	_nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
+	new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
+	_prevButton->clearFlags(WIDGET_ENABLED);
+
+	// Dummy entries
+	for (int i = 0; i < HELP_NUM_LINES; i++) {
+		_key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
+		_dsc[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
+	}
+
+}
+
+void HelpDialog::handleScreenChanged() {
+	ScummDialog::handleScreenChanged();
+
 	_drawingHints &= ~GUI::THEME_HINT_SPECIAL_COLOR;
 
 	int lineHeight = g_gui.getFontHeight();
 
-	_title = new StaticTextWidget(this, "scummhelp_title", "");
 	int keyX = g_gui.evaluator()->getVar("scummhelp_key.x");
 	int keyYoff = g_gui.evaluator()->getVar("scummhelp_key.yoffset");
 	int keyW = g_gui.evaluator()->getVar("scummhelp_key.w");
@@ -727,18 +748,12 @@
 	int dscH = g_gui.evaluator()->getVar("scummhelp_dsc.h");
 
 	for (int i = 0; i < HELP_NUM_LINES; i++) {
-		_key[i] = new StaticTextWidget(this, keyX, keyYoff + lineHeight * (i + 2), keyW, keyH, "", kTextAlignLeft);
-		_dsc[i] = new StaticTextWidget(this, dscX, dscYoff + lineHeight * (i + 2), dscW, dscH, "", kTextAlignLeft);
+		_key[i]->setPos(keyX, keyYoff + lineHeight * (i + 2));
+		_key[i]->setSize(keyW, keyH);
+		_dsc[i]->setPos(dscX, dscYoff + lineHeight * (i + 2));
+		_dsc[i]->setSize(dscW, dscH);
 	}
 
-	_page = 1;
-	_numPages = ScummHelp::numPages(game.id);
-
-	_prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
-	_nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
-	new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
-	_prevButton->clearFlags(WIDGET_ENABLED);
-
 	displayKeyBindings();
 }
 
@@ -803,10 +818,16 @@
 }
 
 void InfoDialog::setInfoText(const String& message) {
+	_message = message;
+
+	handleScreenChanged();
+}
+
+void InfoDialog::handleScreenChanged() {
 	const int screenW = g_system->getOverlayWidth();
 	const int screenH = g_system->getOverlayHeight();
 
-	int width = g_gui.getStringWidth(message) + 16;
+	int width = g_gui.getStringWidth(_message) + 16;
 	int height = g_gui.getFontHeight() + 8;
 
 	_w = width;
@@ -814,7 +835,7 @@
 	_x = (screenW - width) / 2;
 	_y = (screenH - height) / 2;
 
-	new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
+	new StaticTextWidget(this, 4, 4, _w - 8, _h, _message, kTextAlignCenter);
 }
 
 const Common::String InfoDialog::queryResString(int stringno) {

Modified: scummvm/trunk/engines/scumm/dialogs.h
===================================================================
--- scummvm/trunk/engines/scumm/dialogs.h	2006-05-18 15:40:44 UTC (rev 22521)
+++ scummvm/trunk/engines/scumm/dialogs.h	2006-05-18 16:44:44 UTC (rev 22522)
@@ -107,6 +107,8 @@
 	HelpDialog(const GameSettings &game);
 	virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
 
+	virtual void handleScreenChanged();
+
 protected:
 	typedef Common::String String;
 
@@ -151,6 +153,7 @@
 class InfoDialog : public ScummDialog {
 protected:
 	ScummEngine		*_vm;
+	String _message;
 
 public:
 	// arbitrary message
@@ -167,6 +170,8 @@
 		close();
 	}
 
+	virtual void handleScreenChanged();
+
 protected:
 	void setInfoText (const String& message);
 

Modified: scummvm/trunk/gui/widget.h
===================================================================
--- scummvm/trunk/gui/widget.h	2006-05-18 15:40:44 UTC (rev 22521)
+++ scummvm/trunk/gui/widget.h	2006-05-18 16:44:44 UTC (rev 22522)
@@ -114,8 +114,8 @@
 	virtual int16	getAbsX() const	{ return _x + _boss->getChildX(); }
 	virtual int16	getAbsY() const	{ return _y + _boss->getChildY(); }
 
-//	virtual void setPos(int x, int y);
-//	virtual void setSize(int w, int h);
+	virtual void setPos(int x, int y) { _x = x; _y = y; }
+	virtual void setSize(int w, int h) { _w = w; _h = h; }
 
 	virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
 	virtual void handleMouseUp(int x, int y, int button, int clickCount) {}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list