[Scummvm-cvs-logs] SF.net SVN: scummvm:[45242] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Oct 19 11:56:11 CEST 2009


Revision: 45242
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45242&view=rev
Author:   thebluegr
Date:     2009-10-19 09:56:11 +0000 (Mon, 19 Oct 2009)

Log Message:
-----------
Changed mapPointer() to accept a Common::Rect, thus removing the reference to gfx_widgets.h

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/gfx/menubar.cpp
    scummvm/trunk/engines/sci/gfx/menubar.h

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-19 04:19:11 UTC (rev 45241)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-19 09:56:11 UTC (rev 45242)
@@ -187,7 +187,7 @@
 
 		/* Default to menu 0, unless the mouse was used to generate this effect */
 		if (mouse_down)
-			s->_menubar->mapPointer(cursorPos, menu_nr, item_nr, port);
+			s->_menubar->mapPointer(cursorPos, menu_nr, item_nr, toCommonRect(port->_bounds));
 		else
 			menu_nr = 0;
 
@@ -263,7 +263,7 @@
 				{
 				Common::Point curMousePos = s->_cursor->getPosition();
 				menu_mode = (curMousePos.y < 10);
-				claimed = !menu_mode && !s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, port);
+				claimed = !menu_mode && !s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, toCommonRect(port->_bounds));
 				mouse_down = 0;
 				}
 				break;
@@ -278,7 +278,7 @@
 			}
 
 			if (mouse_down)
-				s->_menubar->mapPointer(s->_cursor->getPosition(), menu_nr, item_nr, port);
+				s->_menubar->mapPointer(s->_cursor->getPosition(), menu_nr, item_nr, toCommonRect(port->_bounds));
 
 			if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */
 

Modified: scummvm/trunk/engines/sci/gfx/menubar.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-10-19 04:19:11 UTC (rev 45241)
+++ scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-10-19 09:56:11 UTC (rev 45242)
@@ -32,7 +32,6 @@
 #include "sci/engine/state.h"
 #include "sci/gfx/menubar.h"
 #include "sci/engine/kernel.h"
-#include "sci/gfx/gfx_state_internal.h"	// required for GfxPort
 
 namespace Sci {
 
@@ -389,7 +388,7 @@
 	return false; // May not be selected
 }
 
-bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, GfxPort *port) const {
+bool Menubar::mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, Common::Rect portBounds) const {
 
 	if (pointerPos.y <= 10) { // Re-evaulate menu
 		int x = MENU_LEFT_BORDER;
@@ -418,7 +417,7 @@
 		if ((int)menu._items.size() <= row)
 			return true;
 
-		if ((pointerPos.x < port->_bounds.x) || (pointerPos.x > port->_bounds.x + port->_bounds.width))
+		if ((pointerPos.x < portBounds.left) || (pointerPos.x > portBounds.right))
 			return true;
 
 		if (itemValid(menu_nr, row))

Modified: scummvm/trunk/engines/sci/gfx/menubar.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.h	2009-10-19 04:19:11 UTC (rev 45241)
+++ scummvm/trunk/engines/sci/gfx/menubar.h	2009-10-19 09:56:11 UTC (rev 45242)
@@ -30,9 +30,9 @@
 
 #include "sci/engine/vm_types.h"
 #include "sci/gfx/operations.h"
-#include "sci/gfx/gfx_widgets.h"
 
 #include "common/array.h"
+#include "common/rect.h"
 
 namespace Sci {
 
@@ -214,11 +214,11 @@
 	 * 							necessary)
 	 * @param[in] item_nr		the current menu item (updated by this function
 	 * 							if necessary)
-	 * @param[in] port			the port of the currently active menu (if any)
+	 * @param[in] portBounds	the port bounds of the currently active menu (if any)
 	 * @return 					true if the pointer is outside a valid port,
 	 * 							false otherwise.
 	 */
-	bool mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, GfxPort *port) const;
+	bool mapPointer(const Common::Point &pointerPos, int &menu_nr, int &item_nr, Common::Rect portBounds) const;
 
 };
 


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