From d476daba7160f069475138d4313a6fccdce86111 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 25 Jun 2011 04:53:01 -0500 Subject: [PATCH] Added contextual 'unmark' selection to minimap rightclick menu --- indra/newview/llnetmap.cpp | 42 +++++++++++-------- indra/newview/llnetmap.h | 11 ++++- .../skins/default/xui/en-us/menu_mini_map.xml | 8 +++- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 164d3a950..3564db2f5 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -123,6 +123,8 @@ LLNetMap::LLNetMap(const std::string& name) : (new mmsetblue())->registerListener(this, "MiniMap.setblue"); (new mmsetyellow())->registerListener(this, "MiniMap.setyellow"); (new mmsetcustom())->registerListener(this, "MiniMap.setcustom"); + (new mmsetunmark())->registerListener(this, "MiniMap.setunmark"); + (new mmenableunmark())->registerListener(this, "MiniMap.enableunmark"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); @@ -176,18 +178,15 @@ void LLNetMap::translatePan( F32 delta_x, F32 delta_y ) /////////////////////////////////////////////////////////////////////////////////// -LLColor4 mm_mapcols[1024]; -LLUUID mm_mapkeys[1024]; -U32 mm_netmapnum; +std::size_t hash_value(const LLUUID& uuid) +{ + return (std::size_t)uuid.getCRC32(); +} +boost::unordered_map mm_MarkerColors; -void LLNetMap::mm_setcolor(LLUUID key,LLColor4 col){ - if(mm_netmapnum>1023){ - llinfos << "Minimap color buffer filled, relog or something to clear it" << llendl; - return; - } - mm_mapcols[mm_netmapnum]=col; - mm_mapkeys[mm_netmapnum]=key; - mm_netmapnum+=1; +void LLNetMap::mm_setcolor(LLUUID key,LLColor4 col) +{ + mm_MarkerColors[key] = col; } void LLNetMap::draw() { @@ -376,7 +375,6 @@ void LLNetMap::draw() std::vector avatar_ids; std::vector positions; LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); - U32 a; for(U32 i=0; i::const_iterator it = mm_MarkerColors.find(avatar_ids[i]); + if(it != mm_MarkerColors.end()) { - if(avatar_ids[i]==mm_mapkeys[a]) - { - avColor = mm_mapcols[a]; - } + avColor = it->second; } } @@ -1090,6 +1086,18 @@ bool LLNetMap::mmsetcustom::handleEvent(LLPointer event, const LLSD& us //} return true; } +bool LLNetMap::mmsetunmark::handleEvent(LLPointer event, const LLSD& userdata) +{ + mm_MarkerColors.erase(mPtr->mClosestAgentAtLastRightClick); + return true; +} +bool LLNetMap::mmenableunmark::handleEvent(LLPointer event, const LLSD& userdata) +{ + LLNetMap *self = mPtr; + BOOL enabled = mPtr->mClosestAgentAtLastRightClick.notNull() && mm_MarkerColors.find(mPtr->mClosestAgentAtLastRightClick) != mm_MarkerColors.end(); + self->findControl(userdata["control"].asString())->setValue(enabled); + return true; +} bool LLNetMap::LLCenterMap::handleEvent(LLPointer event, const LLSD& userdata) { EMiniMapCenter center = (EMiniMapCenter)userdata.asInteger(); diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h index 308ec11b4..2efae83dd 100644 --- a/indra/newview/llnetmap.h +++ b/indra/newview/llnetmap.h @@ -210,7 +210,16 @@ private: public: /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); }; - + class mmsetunmark : public LLMemberListener //moymod + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; + class mmenableunmark : public LLMemberListener //moymod + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; diff --git a/indra/newview/skins/default/xui/en-us/menu_mini_map.xml b/indra/newview/skins/default/xui/en-us/menu_mini_map.xml index 185c9f489..c870268ce 100644 --- a/indra/newview/skins/default/xui/en-us/menu_mini_map.xml +++ b/indra/newview/skins/default/xui/en-us/menu_mini_map.xml @@ -64,6 +64,10 @@ left="0" mouse_opaque="true" name="Custom" width="128"> - - + + + + +