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

sev at users.sourceforge.net sev at users.sourceforge.net
Mon Apr 17 17:38:11 CEST 2006


Revision: 21998
Author:   sev
Date:     2006-04-17 17:37:04 -0700 (Mon, 17 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21998&view=rev

Log Message:
-----------
- PopUpWidget (drop down list) does not shadow underlying dialog anymore
- Remove reduntant code in drawing pipeline. Topmost dialog was drawn
  up to 4 times

Modified Paths:
--------------
    scummvm/trunk/gui/PopUpWidget.cpp
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/dialog.h
    scummvm/trunk/gui/newgui.cpp
Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2006-04-18 00:34:57 UTC (rev 21997)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2006-04-18 00:37:04 UTC (rev 21998)
@@ -68,7 +68,7 @@
 };
 
 PopUpDialog::PopUpDialog(PopUpWidget *boss, int clickX, int clickY, WidgetSize ws)
-	: Dialog(0, 0, 16, 16),
+	: Dialog(0, 0, 16, 16, false),
 	_popUpBoss(boss) {
 
 	// Copy the selection index

Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2006-04-18 00:34:57 UTC (rev 21997)
+++ scummvm/trunk/gui/dialog.cpp	2006-04-18 00:37:04 UTC (rev 21998)
@@ -39,15 +39,17 @@
  * ...
  */
 
-Dialog::Dialog(int x, int y, int w, int h)
+Dialog::Dialog(int x, int y, int w, int h, bool dimsInactive_)
 	: GuiObject(x, y, w, h),
-	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) {
+	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0),
+	  _dimsInactive(dimsInactive_) {
 	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 }
 
-Dialog::Dialog(Common::String name)
+Dialog::Dialog(Common::String name, bool dimsInactive_)
 	: GuiObject(name),
-	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0) {
+	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0),
+	  _dimsInactive(dimsInactive_) {
 	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 }
 

Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h	2006-04-18 00:34:57 UTC (rev 21997)
+++ scummvm/trunk/gui/dialog.h	2006-04-18 00:37:04 UTC (rev 21998)
@@ -49,10 +49,11 @@
 
 private:
 	int		_result;
+	bool	_dimsInactive;
 
 public:
-	Dialog(int x, int y, int w, int h);
-	Dialog(Common::String name);
+	Dialog(int x, int y, int w, int h, bool dimsInactive = true);
+	Dialog(Common::String name, bool dimsInactive = true);
 	virtual ~Dialog();
 
 	virtual int runModal();
@@ -84,6 +85,9 @@
 
 	void setResult(int result) { _result = result; }
 	int getResult() const { return _result; }
+
+	// Whether dialog dims all underneath dialogs or not when active
+	bool dimsInactive() { return _dimsInactive; }
 };
 
 } // End of namespace GUI

Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp	2006-04-18 00:34:57 UTC (rev 21997)
+++ scummvm/trunk/gui/newgui.cpp	2006-04-18 00:37:04 UTC (rev 21998)
@@ -139,19 +139,8 @@
 		didSaveState = true;
 	}
 
-	// small 'HACK': complete gui redraw (needed for new theme inactive dialog color change possibilities)
-	_theme->clearAll();
-
 	int i;
 
-	for (i = 0; i < _dialogStack.size() - 1; ++i) {
-		_theme->closeDialog();
-	}
-	for (i = 0; i < _dialogStack.size() - 1; i++) {
-		_theme->openDialog(false);
-	}
-	_theme->openDialog(true);
-
 	while (!_dialogStack.empty() && activeDialog == _dialogStack.top()) {
 		activeDialog->handleTickle();
 
@@ -164,7 +153,16 @@
 				_theme->closeDialog();
 			}
 			for (i = 0; i < _dialogStack.size(); i++) {
-				_theme->openDialog(i == (_dialogStack.size() - 1));
+				// Special treatment when topmost dialog has dimsInactive() set to false
+				// This is the case for PopUpWidget which should not dim a dialog
+				// which it belongs to
+				if ((i == _dialogStack.size() - 2) && !_dialogStack[i + 1]->dimsInactive())
+					_theme->openDialog(true);
+				else if ((i != (_dialogStack.size() - 1)) || !_dialogStack[i]->dimsInactive())
+					_theme->openDialog(false);
+				else
+					_theme->openDialog(true);
+
 				_dialogStack[i]->drawDialog();
 			}
 			_needRedraw = false;


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