Vadim ProductEngine avatar Vadim ProductEngine committed a287289

STORM-971 FIXED Disable the 'Stop Tracking' menu item in Mini-map floater when tracking gets stopped.
- Removed the menu from LLFloaterMap (the mini-map floater)
that had conflicted with the one in the LLNetMap widget.
- Fixed updating of the "Stop Tracking" menu item; moved that code
out of draw() to avoid excessive updates.
- Preventively fixed LLTracker::isTracking() to return strictly 1 or 0
(BOOL is known to cause hard-to-debug side effects with values > 1
because it's essentially just an int and thus doesn't enforce
any limitations on the value).

Comments (0)

Files changed (4)

indra/newview/llfloatermap.cpp

 #include "llviewercamera.h"
 #include "lldraghandle.h"
 #include "lltextbox.h"
-#include "llviewermenu.h"
 #include "llfloaterworldmap.h"
 #include "llagent.h"
 
 
 LLFloaterMap::LLFloaterMap(const LLSD& key) 
 	: LLFloater(key),
-	  mPopupMenu(NULL),
 	  mTextBoxEast(NULL),
 	  mTextBoxNorth(NULL),
 	  mTextBoxWest(NULL),
 	mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
 	mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
 
-	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-	
-	registrar.add("Minimap.Zoom", boost::bind(&LLFloaterMap::handleZoom, this, _2));
-	registrar.add("Minimap.Tracker", boost::bind(&LLFloaterMap::handleStopTracking, this, _2));
-
-	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	if (mPopupMenu && !LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-	}
-
 	stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT
 		,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
 
 	return TRUE;
 }
 
-BOOL LLFloaterMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
-{
-	if (mPopupMenu)
-	{
-		mPopupMenu->buildDrawLabels();
-		mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
-		LLMenuGL::showPopup(this, mPopupMenu, x, y);
-	}
-	return TRUE;
-}
-
 void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
 {
 	// Rotation is in radians.
 		getDragHandle()->setMouseOpaque(TRUE);
 	}
 	
-	if (LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", true);
-	}
-	
 	LLFloater::draw();
 }
 
 	}
 }
 
-void LLFloaterMap::handleStopTracking (const LLSD& userdata)
-{
-	if (mPopupMenu)
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-		LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL));
-	}
-}
 void	LLFloaterMap::setMinimized(BOOL b)
 {
 	LLFloater::setMinimized(b);

indra/newview/llfloatermap.h

 
 #include "llfloater.h"
 
-class LLMenuGL;
 class LLNetMap;
 class LLTextBox;
 
 	
 	/*virtual*/ BOOL 	postBuild();
 	/*virtual*/ BOOL	handleDoubleClick( S32 x, S32 y, MASK mask );
-	/*virtual*/ BOOL	handleRightMouseDown( S32 x, S32 y, MASK mask );
 	/*virtual*/ void	reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 	/*virtual*/ void	draw();
 	/*virtual*/ void	onFocusLost();
 	
 private:
 	void handleZoom(const LLSD& userdata);
-	void handleStopTracking (const LLSD& userdata);
 	void setDirectionPos( LLTextBox* text_box, F32 rotation );
 	void updateMinorDirections();
 
 	void stretchMiniMap(S32 width,S32 height);
 	
-	LLMenuGL*		mPopupMenu;
-
 	LLTextBox*		mTextBoxEast;
 	LLTextBox*		mTextBoxNorth;
 	LLTextBox*		mTextBoxWest;

indra/newview/llnetmap.cpp

 	registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2));
 
 	mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	if (mPopupMenu && !LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", false);
-	}
 	return TRUE;
 }
 
 	gGL.popUIMatrix();
 
 	LLUICtrl::draw();
-
-	if (LLTracker::isTracking(0))
-	{
-		mPopupMenu->setItemEnabled ("Stop Tracking", true);
-	}
-	
-
 }
 
 void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
 	{
 		mPopupMenu->buildDrawLabels();
 		mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
+		mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0));
 		LLMenuGL::showPopup(this, mPopupMenu, x, y);
 	}
 	return TRUE;

indra/newview/lltracker.h

 	// these are static so that they can be used a callbacks
 	static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; }
 	static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; }
-	static BOOL isTracking(void*) { return (BOOL) instance()->mTrackingStatus; }
+	static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; }
 	static void stopTracking(void*);
 	static void clearFocus();
 	
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.