diff options
author | James Cook <james@lindenlab.com> | 2009-11-17 12:03:57 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-11-17 12:03:57 -0800 |
commit | 6d6ee6af54cb1c1e1a73ae5697b5d9865e9dac42 (patch) | |
tree | e493dab172ce0ba6321b133fbb2a466e707cf3b4 | |
parent | 91b89383a8e3b3aa5cacf5b8c70b7f195dc84fcf (diff) |
EXT-2226 Add "Rotate Mini Map" toggle to mini-map context menu
Reviewed with Kelly
-rw-r--r-- | indra/newview/llfloatermap.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llnetmap.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llnetmap.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_mini_map.xml | 22 |
4 files changed, 20 insertions, 21 deletions
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 3fe711a166..d18f127f85 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -83,7 +83,6 @@ BOOL LLFloaterMap::postBuild() { mMap = getChild<LLNetMap>("Net Map"); mMap->setScale(gSavedSettings.getF32("MiniMapScale")); - mMap->setRotateMap(gSavedSettings.getBOOL( "MiniMapRotate" )); mMap->setToolTipMsg(getString("ToolTipMsg")); sendChildToBack(mMap); @@ -178,7 +177,8 @@ void LLFloaterMap::draw() { F32 rotation = 0; - if( mMap->getRotateMap() ) + static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); + if( rotate_map ) { // rotate subsequent draws to agent rotation rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 6145588df2..234fe13217 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -92,7 +92,6 @@ LLNetMap::LLNetMap (const Params & p) mObjectImagep(), mClosestAgentToCursor(), mClosestAgentAtLastRightClick(), - mRotateMap(FALSE), mToolTipMsg() { mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS); @@ -175,7 +174,8 @@ void LLNetMap::draw() gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); - if( mRotateMap ) + static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); + if( rotate_map ) { // rotate subsequent draws to agent rotation rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); @@ -408,7 +408,7 @@ void LLNetMap::draw() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if( mRotateMap ) + if( rotate_map ) { gGL.color4fv((map_frustum_color()).mV); @@ -454,7 +454,8 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) pos_local.mV[VY] *= mPixelsPerMeter; // leave Z component in meters - if( mRotateMap ) + static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); + if( rotate_map ) { F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); @@ -502,7 +503,8 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); - if( mRotateMap ) + static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); + if( rotate_map ) { LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 7088ab3e70..3d7f3233ac 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -80,9 +80,7 @@ public: /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); void setScale( F32 scale ); - void setRotateMap( BOOL b ) { mRotateMap = b; } void setToolTipMsg(const std::string& msg) { mToolTipMsg = msg; } - BOOL getRotateMap( ) { return mRotateMap; } void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); private: @@ -122,7 +120,6 @@ private: LLUUID mClosestAgentToCursor; LLUUID mClosestAgentAtLastRightClick; - BOOL mRotateMap; std::string mToolTipMsg; }; diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml index 5cbbd71bfe..8d0edf018d 100644 --- a/indra/newview/skins/default/xui/en/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml @@ -10,7 +10,6 @@ width="128"> <menu_item_call label="Zoom Close" - layout="topleft" name="Zoom Close"> <menu_item_call.on_click function="Minimap.Zoom" @@ -18,7 +17,6 @@ </menu_item_call> <menu_item_call label="Zoom Medium" - layout="topleft" name="Zoom Medium"> <menu_item_call.on_click function="Minimap.Zoom" @@ -26,29 +24,31 @@ </menu_item_call> <menu_item_call label="Zoom Far" - layout="topleft" name="Zoom Far"> <menu_item_call.on_click function="Minimap.Zoom" parameter="far" /> </menu_item_call> - <menu_item_separator - layout="topleft" - name="Tracking Separator" /> + <menu_item_check + label="Rotate Map" + name="Rotate Map"> + <menu_item_check.on_check + control="MiniMapRotate" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="MiniMapRotate" /> + </menu_item_check> + <menu_item_separator /> <menu_item_call label="Stop Tracking" - layout="topleft" name="Stop Tracking"> <menu_item_call.on_click function="Minimap.Tracker" parameter="task_properties" /> </menu_item_call> - <menu_item_separator - layout="topleft" - name="Tracking Separator" /> + <menu_item_separator /> <menu_item_call label="World Map" - layout="topleft" name="World Map"> <menu_item_call.on_click function="ShowFloater" |