Added contextual 'unmark' selection to minimap rightclick menu

This commit is contained in:
Shyotl
2011-06-25 04:53:01 -05:00
parent 378053bd48
commit d476daba71
3 changed files with 41 additions and 20 deletions

View File

@@ -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<const LLUUID,LLColor4> 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<LLUUID> avatar_ids;
std::vector<LLVector3d> positions;
LLWorld::getInstance()->getAvatars(&avatar_ids, &positions);
U32 a;
for(U32 i=0; i<avatar_ids.size(); i++)
{
LLColor4 avColor = standard_color;
@@ -416,12 +414,10 @@ void LLNetMap::draw()
else
{
// MOYMOD Minimap custom av colors.
for(a=0;a<mm_netmapnum;a+=1)
boost::unordered_map<const LLUUID,LLColor4>::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<LLEvent> event, const LLSD& us
//}
return true;
}
bool LLNetMap::mmsetunmark::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
mm_MarkerColors.erase(mPtr->mClosestAgentAtLastRightClick);
return true;
}
bool LLNetMap::mmenableunmark::handleEvent(LLPointer<LLEvent> 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<LLEvent> event, const LLSD& userdata)
{
EMiniMapCenter center = (EMiniMapCenter)userdata.asInteger();