Clean up LLNetMap

Ansariel 2014-02-06 15:10:06 +01:00
parent b3ca9b43ac
commit 99b4613dc0
2 changed files with 19 additions and 50 deletions

View File

@ -1487,7 +1487,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
pProfilesMenu->getBranch()->addChild(pMenuItem);
}
}
mPopupMenu->setItemVisible("Cam", isZoomable());
mPopupMenu->setItemVisible("Cam", LLAvatarActions::canZoomIn(mClosestAgentToCursor));
mPopupMenu->setItemVisible("MarkAvatar", mClosestAgentToCursor.notNull());
mPopupMenu->setItemVisible("Start Tracking", mClosestAgentToCursor.notNull());
mPopupMenu->setItemVisible("Profile Separator", (mClosestAgentsToCursor.size() >= 1
@ -1636,46 +1636,27 @@ void LLNetMap::handleZoom(const LLSD& userdata)
}
}
void LLNetMap::handleStopTracking (const LLSD& userdata)
{
if (mPopupMenu)
{
mPopupMenu->setItemEnabled ("Stop Tracking", false);
LLTracker::stopTracking ((void*)(ptrdiff_t)LLTracker::isTracking(NULL));
}
}
// <FS:Ansariel> additional functions
// <FS:Ansariel> Mark avatar feature
void LLNetMap::handleMark(const LLSD& userdata)
{
setAvatarMark(userdata);
}
void LLNetMap::handleClearMarks()
{
clearAvatarMarks();
}
void LLNetMap::setAvatarMark(const LLSD& userdata)
{
if (mClosestAgentRightClick.notNull())
{
// Use the name as color definition name from colors.xml
LLColor4 color = LLUIColorTable::instance().getColor(userdata.asString(), LLColor4::green);
LLNetMap::sAvatarMarksMap[mClosestAgentRightClick] = color;
llinfos << "Minimap: Marking " << mClosestAgentRightClick.asString() << " in " << userdata.asString() << llendl;
LL_INFOS("NetMap") << "Minimap: Marking " << mClosestAgentRightClick.asString() << " in " << userdata.asString() << LL_ENDL;
}
}
void LLNetMap::clearAvatarMarks()
void LLNetMap::handleClearMarks()
{
LLNetMap::sAvatarMarksMap.clear();
}
//</FS:Ansariel>
void LLNetMap::camAvatar()
void LLNetMap::handleCam()
{
if (isZoomable())
if (LLAvatarActions::canZoomIn(mClosestAgentRightClick))
{
LLAvatarActions::zoomIn(mClosestAgentRightClick);
}
@ -1685,25 +1666,8 @@ void LLNetMap::camAvatar()
}
}
void LLNetMap::handleCam()
{
camAvatar();
}
bool LLNetMap::isZoomable()
{
F32 range = dist_vec(gAgent.getPositionGlobal(), mClosestAgentPosition);
bool is_zoomable = (range < gSavedSettings.getF32("RenderFarClip") || gObjectList.findObject(mClosestAgentRightClick) != NULL);
return is_zoomable;
}
// <FS:Ansariel> Avatar tracking feature
void LLNetMap::handleStartTracking()
{
startTracking();
}
void LLNetMap::startTracking()
{
if (mClosestAgentRightClick.notNull())
{
@ -1716,6 +1680,15 @@ void LLNetMap::startTracking()
}
// </FS:Ansariel> Avatar tracking feature
void LLNetMap::handleStopTracking (const LLSD& userdata)
{
if (mPopupMenu)
{
mPopupMenu->setItemEnabled ("Stop Tracking", false);
LLTracker::stopTracking ((void*)(ptrdiff_t)LLTracker::isTracking(NULL));
}
}
// <FS:Ansariel> Synchronize tooltips throughout instances
// static
void LLNetMap::updateToolTipMsg()

View File

@ -96,7 +96,6 @@ public:
LLVector3d viewPosToGlobal(S32 x,S32 y);
LLUUID getClosestAgentToCursor() const { return mClosestAgentToCursor; }
LLVector3d getClosestAgentPosition() const { return mClosestAgentPosition; }
bool isZoomable();
// <FS:Ansariel> Synchronize double click handling throughout instances
void performDoubleClickAction(LLVector3d pos_global);
@ -135,7 +134,7 @@ private:
LLUIColor mBackgroundColor;
F32 mScale; // Size of a region in pixels
static F32 sScale; // <FS:Ansariel> Used to synchronize netmaps throughout instances
static F32 sScale; // <FS:Ansariel> Used to synchronize netmaps throughout instances
F32 mPixelsPerMeter; // world meters to map pixels
F32 mObjectMapTPM; // texels per meter on map
@ -166,28 +165,25 @@ private:
static std::string sToolTipMsg;
// </FS:Ansariel> Synchronize tooltips throughout instances
// <FS:Ansariel> Mark avatar feature
static std::map<LLUUID, LLColor4> sAvatarMarksMap;
public:
void setSelected(uuid_vec_t uuids) { gmSelected=uuids; };
void setAvatarMark(const LLSD& userdata);
void clearAvatarMarks();
void camAvatar();
// <FS:CR> Minimap improvements
void handleShowProfile(const LLSD& sdParam) const;
uuid_vec_t mClosestAgentsToCursor;
LLVector3d mPosGlobalRightClick;
LLUUID mClosestAgentRightClick;
// </FS:CR>
void startTracking();
private:
void handleZoom(const LLSD& userdata);
void handleStopTracking(const LLSD& userdata);
void handleStopTracking (const LLSD& userdata);
void handleStartTracking();
void handleMark(const LLSD& userdata);
void handleClearMarks();
void handleCam();
void handleStartTracking();
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
void handleOverlayToggle(const LLSD& sdParam);
bool checkTextureType(const LLSD& sdParam) const;