[Scummvm-cvs-logs] SF.net SVN: scummvm:[36231] scummvm/branches/branch-0-13-0/gui

tanoku at users.sourceforge.net tanoku at users.sourceforge.net
Sat Feb 7 02:47:54 CET 2009


Revision: 36231
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36231&view=rev
Author:   tanoku
Date:     2009-02-07 01:47:54 +0000 (Sat, 07 Feb 2009)

Log Message:
-----------
Backport of revision 36227 (release critical bug).

Revision Links:
--------------
    http://scummvm.svn.sourceforge.net/scummvm/?rev=36227&view=rev

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp
    scummvm/branches/branch-0-13-0/gui/ThemeEngine.h
    scummvm/branches/branch-0-13-0/gui/launcher.cpp
    scummvm/branches/branch-0-13-0/gui/widget.cpp

Modified: scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp	2009-02-07 01:47:34 UTC (rev 36230)
+++ scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp	2009-02-07 01:47:54 UTC (rev 36231)
@@ -742,7 +742,7 @@
 /**********************************************************
  *	Drawing Queue management
  *********************************************************/
-void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic) {
+void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic, bool restore) {
 	if (_widgets[type] == 0)
 		return;
 
@@ -761,7 +761,7 @@
 			_screenQueue.push_back(q);
 		}
 	} else {
-		q->drawSelf(!_widgets[type]->_buffer, _widgets[type]->_buffer);
+		q->drawSelf(!_widgets[type]->_buffer, restore || _widgets[type]->_buffer);
 		delete q;
 	}
 }
@@ -818,7 +818,7 @@
 	else if (state == kStateDisabled)
 		dd = kDDButtonDisabled;
 
-	queueDD(dd, r);
+	queueDD(dd, r, 0, hints & WIDGET_CLEARBG);
 	queueDDText(getTextData(dd), r, str, false, false, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV);
 }
 

Modified: scummvm/branches/branch-0-13-0/gui/ThemeEngine.h
===================================================================
--- scummvm/branches/branch-0-13-0/gui/ThemeEngine.h	2009-02-07 01:47:34 UTC (rev 36230)
+++ scummvm/branches/branch-0-13-0/gui/ThemeEngine.h	2009-02-07 01:47:54 UTC (rev 36231)
@@ -513,7 +513,7 @@
 	 *
 	 *	This function is called from all the Widget Drawing methods.
 	 */
-	void queueDD(DrawData type,  const Common::Rect &r, uint32 dynamic = 0);
+	void queueDD(DrawData type,  const Common::Rect &r, uint32 dynamic = 0, bool restore = false);
 	void queueDDText(TextData type, const Common::Rect &r, const Common::String &text, bool restoreBg,
 		bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0);
 	void queueBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha);

Modified: scummvm/branches/branch-0-13-0/gui/launcher.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/gui/launcher.cpp	2009-02-07 01:47:34 UTC (rev 36230)
+++ scummvm/branches/branch-0-13-0/gui/launcher.cpp	2009-02-07 01:47:54 UTC (rev 36231)
@@ -912,10 +912,8 @@
 		? "Mass Add"
 		: "Add Game";
 
-	if (_addButton->getLabel() != newAddButtonLabel) {
+	if (_addButton->getLabel() != newAddButtonLabel) 
 		_addButton->setLabel(newAddButtonLabel);
-		_addButton->draw();
-	}
 }
 
 void LauncherDialog::reflowLayout() {

Modified: scummvm/branches/branch-0-13-0/gui/widget.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/gui/widget.cpp	2009-02-07 01:47:34 UTC (rev 36230)
+++ scummvm/branches/branch-0-13-0/gui/widget.cpp	2009-02-07 01:47:54 UTC (rev 36231)
@@ -198,17 +198,16 @@
 }
 
 void StaticTextWidget::setLabel(const Common::String &label) {
-	_label = label;
-	
-	// get parent's size
-	const uint16 w = _boss->getWidth();
-	const uint16 h = _boss->getHeight();
-	const int16 x = _boss->getAbsX();
-	const int16 y = _boss->getAbsY();
-	
-	// restore the parent's background and redraw it again.
-	g_gui.theme()->restoreBackground(Common::Rect(x, y, x + w, y + h));
-	_boss->draw();
+    if (_label != label) {
+        _label = label;
+
+        // when changing the label, add the CLEARBG flag
+        // so the widget is completely redrawn, otherwise
+        // the new text is drawn on top of the old one.
+        setFlags(WIDGET_CLEARBG);
+        draw();
+        clearFlags(WIDGET_CLEARBG);
+    }
 }
 
 void StaticTextWidget::setAlign(Graphics::TextAlign align) {
@@ -225,7 +224,7 @@
 #pragma mark -
 
 ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::String &label, uint32 cmd, uint8 hotkey)
-	: StaticTextWidget(boss, x, y, w, h, label, Graphics::kTextAlignCenter), CommandSender(boss),
+	: StaticTextWidget(boss, x, y, w, h, label, Graphics::kTextAlignCenter), CommandSender(boss), 
 	  _cmd(cmd), _hotkey(hotkey) {
 	setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG);
 	_type = kButtonWidget;
@@ -244,7 +243,7 @@
 }
 
 void ButtonWidget::drawWidget() {
-	g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, 0);
+	g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), _label, _state, getFlags());
 }
 
 #pragma mark -


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