diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-14 17:37:56 +0200 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2011-03-14 17:37:56 +0200 |
commit | 2cddf137e3c785dc9efbe7e12b90d239d8eaa958 (patch) | |
tree | 938dbac491c80e337a6c212b99a5d889ce122e98 /indra | |
parent | b7635b6112b7c7fd448aa4400bba2edbf15a5b0a (diff) |
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).
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatermap.cpp | 37 | ||||
-rw-r--r-- | indra/newview/llfloatermap.h | 5 | ||||
-rw-r--r-- | indra/newview/llnetmap.cpp | 12 | ||||
-rw-r--r-- | indra/newview/lltracker.h | 2 |
4 files changed, 2 insertions, 54 deletions
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 80920c80d6..1e1ea4afef 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -42,7 +42,6 @@ #include "llviewercamera.h" #include "lldraghandle.h" #include "lltextbox.h" -#include "llviewermenu.h" #include "llfloaterworldmap.h" #include "llagent.h" @@ -63,7 +62,6 @@ const S32 MAP_PADDING_BOTTOM = 0; LLFloaterMap::LLFloaterMap(const LLSD& key) : LLFloater(key), - mPopupMenu(NULL), mTextBoxEast(NULL), mTextBoxNorth(NULL), mTextBoxWest(NULL), @@ -96,17 +94,6 @@ BOOL LLFloaterMap::postBuild() 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); @@ -157,17 +144,6 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) 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. @@ -238,11 +214,6 @@ void LLFloaterMap::draw() getDragHandle()->setMouseOpaque(TRUE); } - if (LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", true); - } - LLFloater::draw(); } @@ -309,14 +280,6 @@ void LLFloaterMap::handleZoom(const LLSD& userdata) } } -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); diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 4cbb48fb3e..5cf66a594b 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -29,7 +29,6 @@ #include "llfloater.h" -class LLMenuGL; class LLNetMap; class LLTextBox; @@ -44,7 +43,6 @@ public: /*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(); @@ -54,14 +52,11 @@ public: 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; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 93039d935d..81b3c49906 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -112,10 +112,6 @@ BOOL LLNetMap::postBuild() 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; } @@ -510,13 +506,6 @@ void LLNetMap::draw() gGL.popUIMatrix(); LLUICtrl::draw(); - - if (LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", true); - } - - } void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -886,6 +875,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { mPopupMenu->buildDrawLabels(); mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); LLMenuGL::showPopup(this, mPopupMenu, x, y); } return TRUE; diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index c0c154abe8..8e916af315 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -75,7 +75,7 @@ public: // 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(); |