Add Selected Avatars submenu to minimap menu

Minimap refactor, make it an LFIDBearer!

Moves listeners to cpp file, no need for header exposure
Removes duplicate ToggleControl listener just for minimap
Removes excess code from ToggleOverlay, we can use two on_clicks instead
Caches direction labels instead of looking them up each frame
Removes weird userdata look up on camera center menu item, fixing it
Respect RLVa by hiding the submenu, shortcutting lookups per child
This commit is contained in:
Liru Færs
2019-11-16 09:14:19 -05:00
parent 60e71f5724
commit fc649854ff
3 changed files with 233 additions and 338 deletions

View File

@@ -84,6 +84,82 @@
// [/RLVa:KB]
using namespace LLOldEvents;
typedef LLMemberListener<LLView> view_listener_t;
class LLScaleMap : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class LLChatRings : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class LLCheckChatRings : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class LLStopTracking : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class LLIsTracking : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
//moymod - Custom minimap markers :o
class mmsetred : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmsetgreen : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmsetblue : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmsetyellow : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmsetcustom : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmsetunmark : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
class mmenableunmark : public view_listener_t //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
class OverlayToggle : public view_listener_t
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
};
// [/SL:KB]
const F32 LLNetMap::MAP_SCALE_MIN = 32;
const F32 LLNetMap::MAP_SCALE_MID = 256;
@@ -103,7 +179,7 @@ const S32 CIRCLE_STEPS = 100;
const F64 COARSEUPDATE_MAX_Z = 1020.0f;
std::map<LLUUID, LLVector3d> LLNetMap::mClosestAgentsToCursor; // <exodus/>
static std::map<LLUUID, LLVector3d> mClosestAgentsAtLastClick; // <exodus/>
uuid_vec_t LLNetMap::mClosestAgentsAtLastClick; // <exodus/>
LLNetMap::LLNetMap(const std::string& name) :
LLPanel(name),
@@ -144,26 +220,29 @@ LLNetMap::~LLNetMap()
BOOL LLNetMap::postBuild()
{
mELabel = getChild<LLTextBox>("e_label");
mNLabel = getChild<LLTextBox>("n_label");
mWLabel = getChild<LLTextBox>("w_label");
mSLabel = getChild<LLTextBox>("s_label");
mNELabel = getChild<LLTextBox>("ne_label");
mNWLabel = getChild<LLTextBox>("nw_label");
mSWLabel = getChild<LLTextBox>("sw_label");
mSELabel = getChild<LLTextBox>("se_label");
// Register event listeners for popup menu
(new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel");
(new LLCenterMap())->registerListener(this, "MiniMap.Center");
(new LLCheckCenterMap())->registerListener(this, "MiniMap.CheckCenter");
(new LLChatRings())->registerListener(this, "MiniMap.ChatRings");
(new LLCheckChatRings())->registerListener(this, "MiniMap.CheckChatRings");
(new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
(new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
(new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile");
(new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile");
(new LLCamFollow())->registerListener(this, "MiniMap.CamFollow"); //moymod - add cam follow crap thingie
(new mmsetred())->registerListener(this, "MiniMap.setred");
(new mmsetgreen())->registerListener(this, "MiniMap.setgreen");
(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");
(new LLToggleControl())->registerListener(this, "MiniMap.ToggleControl");
(new OverlayToggle())->registerListener(this, "Minimap.ToggleOverlay");
(new LLScaleMap())->registerListener(gMenuHolder, "MiniMap.ZoomLevel");
(new LLChatRings())->registerListener(gMenuHolder, "MiniMap.ChatRings");
(new LLCheckChatRings())->registerListener(gMenuHolder, "MiniMap.CheckChatRings");
(new LLStopTracking())->registerListener(gMenuHolder, "StopTracking");
(new LLIsTracking())->registerListener(gMenuHolder, "IsTracking");
(new mmsetred())->registerListener(gMenuHolder, "MiniMap.setred");
(new mmsetgreen())->registerListener(gMenuHolder, "MiniMap.setgreen");
(new mmsetblue())->registerListener(gMenuHolder, "MiniMap.setblue");
(new mmsetyellow())->registerListener(gMenuHolder, "MiniMap.setyellow");
(new mmsetcustom())->registerListener(gMenuHolder, "MiniMap.setcustom");
(new mmsetunmark())->registerListener(gMenuHolder, "MiniMap.setunmark");
(new mmenableunmark())->registerListener(gMenuHolder, "MiniMap.enableunmark");
(new OverlayToggle())->registerListener(gMenuHolder, "Minimap.ToggleOverlay");
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0)
LLViewerParcelMgr::instance().setCollisionUpdateCallback(boost::bind(&LLNetMap::refreshParcelOverlay, this));
@@ -257,8 +336,8 @@ void LLNetMap::draw()
}
// [/SL:KB]
static LLUICachedControl<S32> center("MiniMapCenter");
if (center != MAP_CENTER_NONE)
static const LLUICachedControl<S32> center("MiniMapCenter");
if (center)
{
mCurPan = lerp(mCurPan, mTargetPan, LLSmoothInterpolation::getInterpolant(0.1f));
}
@@ -558,14 +637,14 @@ void LLNetMap::draw()
gmSelected = LLFloaterAvatarList::instance().getSelectedIDs();
// Draw avatars
for(LLWorld::pos_map_t::const_iterator iter = positions.cbegin(), iter_end = positions.cend(); iter != iter_end; ++iter)
for(const auto& pair : positions)
{
const LLUUID& uuid = iter->first;
const LLUUID& uuid = pair.first;
static const LLCachedControl<LLColor4> standard_color("MapAvatar",LLColor4(0.f,1.f,0.f,1.f));
LLColor4 color = standard_color;
// TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
// just be careful to sort the avatar IDs along with the positions. -MG
const LLVector3d& position = iter->second;
const LLVector3d& position = pair.second;
pos_map = globalPosToView(position);
if (position.mdV[VZ] == 0.f || position.mdV[VZ] == COARSEUPDATE_MAX_Z)
{
@@ -732,15 +811,15 @@ void LLNetMap::draw()
gGL.popUIMatrix();
// Rotation of 0 means that North is up
setDirectionPos( getChild<LLTextBox>("e_label"), rotation);
setDirectionPos( getChild<LLTextBox>("n_label"), rotation + F_PI_BY_TWO);
setDirectionPos( getChild<LLTextBox>("w_label"), rotation + F_PI);
setDirectionPos( getChild<LLTextBox>("s_label"), rotation + F_PI + F_PI_BY_TWO);
setDirectionPos(mELabel, rotation);
setDirectionPos(mNLabel, rotation + F_PI_BY_TWO);
setDirectionPos(mWLabel, rotation + F_PI);
setDirectionPos(mSLabel, rotation + F_PI + F_PI_BY_TWO);
setDirectionPos( getChild<LLTextBox>("ne_label"), rotation + F_PI_BY_TWO / 2);
setDirectionPos( getChild<LLTextBox>("nw_label"), rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
setDirectionPos( getChild<LLTextBox>("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2);
setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
setDirectionPos(mNELabel, rotation + F_PI_BY_TWO / 2);
setDirectionPos(mNWLabel, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
setDirectionPos(mSWLabel, rotation + F_PI + F_PI_BY_TWO / 2);
setDirectionPos(mSELabel, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
LLUICtrl::draw();
}
@@ -858,8 +937,8 @@ BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
setScale(new_scale);
static LLUICachedControl<S32> center("MiniMapCenter");
if (center == MAP_CENTER_NONE)
static const LLUICachedControl<S32> center("MiniMapCenter");
if (!center)
{
// Adjust pan to center the zoom on the mouse pointer
LLVector2 zoom_offset;
@@ -888,7 +967,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* stick
sticky_rect.mRight = sticky_rect.mLeft + 2 * SLOP;
sticky_rect.mTop = sticky_rect.mBottom + 2 * SLOP;
tool_tip.assign("");
tool_tip.clear();
if (region->mMapAvatarIDs.size())
{
@@ -902,10 +981,10 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* stick
std::map<LLUUID, LLVector3d>::iterator current = mClosestAgentsToCursor.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsToCursor.end();
for (; current != end; ++current)
for (const auto& target : mClosestAgentsToCursor)
{
LLUUID targetUUID = (*current).first;
LLVector3d targetPosition = (*current).second;
const auto& targetUUID = target.first;
auto targetPosition = target.second;
std::string fullName;
if (targetUUID.notNull() && LLAvatarNameCache::getNSName(targetUUID, fullName))
@@ -932,7 +1011,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* stick
tool_tip.append(llformat(" (%.02fm)\n", distance));
}
}
tool_tip.append("\n");
tool_tip += '\n';
}
}
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-0.2.0b
@@ -940,9 +1019,9 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* stick
// [/RLVa:KB]
//tool_tip.append("\n\n" + region->getName());
tool_tip.append("\n" + region->getHost().getHostName());
tool_tip.append("\n" + region->getHost().getString());
tool_tip.append("\n" + getToolTip());
tool_tip.append('\n' + region->getHost().getHostName());
tool_tip.append('\n' + region->getHost().getString());
tool_tip.append('\n' + getToolTip());
}
else
{
@@ -971,19 +1050,16 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
void LLNetMap::updateMinorDirections()
{
if (getChild<LLTextBox>("ne_label", TRUE, FALSE) == NULL)
{
return;
}
if (!mNELabel) return;
// Hide minor directions if they cover too much of the map
bool show_minors = getChild<LLTextBox>("ne_label")->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
bool show_minors = mNELabel->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
llmin(getRect().getWidth(), getRect().getHeight());
getChild<LLTextBox>("ne_label")->setVisible(show_minors);
getChild<LLTextBox>("nw_label")->setVisible(show_minors);
getChild<LLTextBox>("sw_label")->setVisible(show_minors);
getChild<LLTextBox>("se_label")->setVisible(show_minors);
mNELabel->setVisible(show_minors);
mNWLabel->setVisible(show_minors);
mSWLabel->setVisible(show_minors);
mSELabel->setVisible(show_minors);
}
void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
@@ -1283,29 +1359,29 @@ BOOL LLNetMap::handleMouseUp( S32 x, S32 y, MASK mask )
}
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
bool LLNetMap::OverlayToggle::handleEvent(LLPointer<LLEvent> event, const LLSD& sdParam)
bool OverlayToggle::handleEvent(LLPointer<LLEvent> event, const LLSD& sdParam)
{
// Toggle the setting
const std::string strControl = sdParam.asString();
BOOL fCurValue = gSavedSettings.getBOOL(strControl);
gSavedSettings.setBOOL(strControl, !fCurValue);
// Force an overlay update
mPtr->mUpdateParcelImage = true;
LFIDBearer::getActive<LLNetMap>()->mUpdateParcelImage = true;
return true;
}
// [/SL:KB]
BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
mClosestAgentsAtLastClick = mClosestAgentsToCursor;
mClosestAgentsAtLastClick.clear();
mClosestAgentsAtLastClick.reserve(mClosestAgentsToCursor.size());
for (const auto& pair : mClosestAgentsToCursor)
mClosestAgentsAtLastClick.push_back(pair.first);
mClosestAgentAtLastRightClick = mClosestAgentToCursor;
if (mPopupMenu)
{
// Singu TODO: It'd be spectacular to address multiple avatars from here.
mPopupMenu->buildDrawLabels();
mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
LLMenuGL::showPopup(this, mPopupMenu, x, y);
showMenu(this, mPopupMenu, x, y);
mPopupMenu->getChildView("avs_menu")->setVisible(!mClosestAgentsAtLastClick.empty() &&
// [RLVa:LF] - 2019
!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)
// [/RLVa:LF]
);
}
return TRUE;
}
@@ -1396,22 +1472,22 @@ BOOL LLNetMap::handleHover( S32 x, S32 y, MASK mask )
}
// static
bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
bool LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
LLNetMap *self = LFIDBearer::getActive<LLNetMap>();
S32 level = userdata.asInteger();
switch(level)
{
case 0:
self->setScale(MAP_SCALE_MIN);
self->setScale(LLNetMap::MAP_SCALE_MIN);
break;
case 1:
self->setScale(MAP_SCALE_MID);
self->setScale(LLNetMap::MAP_SCALE_MID);
break;
case 2:
self->setScale(MAP_SCALE_MAX);
self->setScale(LLNetMap::MAP_SCALE_MAX);
break;
default:
break;
@@ -1423,149 +1499,85 @@ bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& use
//moymod - minimap color shit
void markMassAgents(const LLColor4& color)
{
std::map<LLUUID, LLVector3d>::iterator current = mClosestAgentsAtLastClick.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
for(; current != end; ++current) LLNetMap::mm_setcolor((*current).first, color);
auto self = LFIDBearer::getActive<LLNetMap>();
for (const auto& id : self->getSelectedIDs())
self->mm_setcolor(id, color);
}
bool LLNetMap::mmsetred::handleEvent(LLPointer<LLEvent>, const LLSD&)
bool mmsetred::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::red); return true;
}
bool LLNetMap::mmsetgreen::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::green); return true;
}
bool LLNetMap::mmsetblue::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::blue); return true;
}
bool LLNetMap::mmsetyellow::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::yellow); return true;
}
bool LLNetMap::mmsetcustom::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(gSavedSettings.getColor4("MoyMiniMapCustomColor")); return true;
}
bool LLNetMap::mmsetunmark::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
std::map<LLUUID, LLVector3d>::iterator it = mClosestAgentsAtLastClick.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
for(; it!= end; ++it) mm_MarkerColors.erase((*it).first);
markMassAgents(LLColor4::red);
return true;
}
bool LLNetMap::mmenableunmark::handleEvent(LLPointer<LLEvent>, const LLSD& userdata)
bool mmsetgreen::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::green);
return true;
}
bool mmsetblue::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::blue);
return true;
}
bool mmsetyellow::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(LLColor4::yellow);
return true;
}
bool mmsetcustom::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
markMassAgents(gSavedSettings.getColor4("MoyMiniMapCustomColor"));
return true;
}
bool mmsetunmark::handleEvent(LLPointer<LLEvent>, const LLSD&)
{
for (const auto& id : LFIDBearer::getActiveSelectedIDs())
mm_MarkerColors.erase(id);
return true;
}
bool mmenableunmark::handleEvent(LLPointer<LLEvent>, const LLSD& userdata)
{
bool enabled(false);
std::map<LLUUID, LLVector3d>::iterator it = mClosestAgentsAtLastClick.begin();
std::map<LLUUID, LLVector3d>::iterator end = mClosestAgentsAtLastClick.end();
for(; it != end && !enabled; ++it) enabled = mm_MarkerColors.find((*it).first) != mm_MarkerColors.end();
for (const auto& id : LFIDBearer::getActiveSelectedIDs())
if (enabled = mm_MarkerColors.find(id) != mm_MarkerColors.end())
break;
mPtr->findControl(userdata["control"].asString())->setValue(enabled);
return true;
}
bool LLNetMap::LLCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
bool LLChatRings::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
EMiniMapCenter center = (EMiniMapCenter)userdata.asInteger();
auto whisper = gSavedSettings.getControl("MiniMapWhisperRing");
auto chat = gSavedSettings.getControl("MiniMapChatRing");
auto shout = gSavedSettings.getControl("MiniMapShoutRing");
bool all_enabled = whisper->get() && chat->get() && shout->get();
if (gSavedSettings.getS32("MiniMapCenter") == center)
{
gSavedSettings.setS32("MiniMapCenter", MAP_CENTER_NONE);
}
else
{
gSavedSettings.setS32("MiniMapCenter", userdata.asInteger());
}
whisper->set(!all_enabled);
chat->set(!all_enabled);
shout->set(!all_enabled);
return true;
}
bool LLNetMap::LLCheckCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
bool LLCheckChatRings::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
EMiniMapCenter center = (EMiniMapCenter)userdata["data"].asInteger();
BOOL enabled = (gSavedSettings.getS32("MiniMapCenter") == center);
bool all_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing")
&& gSavedSettings.getBOOL("MiniMapChatRing")
&& gSavedSettings.getBOOL("MiniMapShoutRing");
self->findControl(userdata["control"].asString())->setValue(enabled);
mPtr->findControl(userdata["control"].asString())->setValue(all_enabled);
return true;
}
bool LLNetMap::LLChatRings::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
BOOL whisper_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing");
BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing");
BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing");
BOOL all_enabled = whisper_enabled && chat_enabled && shout_enabled;
gSavedSettings.setBOOL("MiniMapWhisperRing", !all_enabled);
gSavedSettings.setBOOL("MiniMapChatRing", !all_enabled);
gSavedSettings.setBOOL("MiniMapShoutRing", !all_enabled);
return true;
}
bool LLNetMap::LLCheckChatRings::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
BOOL whisper_enabled = gSavedSettings.getBOOL("MiniMapWhisperRing");
BOOL chat_enabled = gSavedSettings.getBOOL("MiniMapChatRing");
BOOL shout_enabled = gSavedSettings.getBOOL("MiniMapShoutRing");
BOOL all_enabled = whisper_enabled && chat_enabled && shout_enabled;
LLNetMap *self = mPtr;
self->findControl(userdata["control"].asString())->setValue(all_enabled);
return true;
}
bool LLNetMap::LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
bool LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLTracker::stopTracking(false);
return true;
}
bool LLNetMap::LLEnableTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
bool LLIsTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
self->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking());
mPtr->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking());
return true;
}
bool LLNetMap::LLCamFollow::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
LLFloaterAvatarList::lookAtAvatar(self->mClosestAgentAtLastRightClick);
return true;
}
bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick);
}
// [/RLVa:KB]
//LLAvatarActions::showProfile(self->mClosestAgentAtLastRightClick);
return true;
}
bool LLNetMap::LLEnableProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLNetMap *self = mPtr;
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b
self->findControl(userdata["control"].asString())->setValue(
(self->isAgentUnderCursor()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) );
// [/RLVa:KB]
//self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor());
return true;
}
bool LLNetMap::LLToggleControl::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
std::string control_name = userdata.asString();
gSavedSettings.setBOOL(control_name, !gSavedSettings.getBOOL(control_name));
return true;
}

View File

@@ -33,33 +33,20 @@
#ifndef LL_LLNETMAP_H
#define LL_LLNETMAP_H
#include "llmath.h"
#include "lfidbearer.h"
#include "llpanel.h"
#include "llmemberlistener.h"
#include "v3math.h"
#include "v3dmath.h"
#include "v4color.h"
#include "llpointer.h"
#include "llcoord.h"
class LLTextBox;
class LLImageRaw;
class LLViewerTexture;
class LLFloaterMap;
class LLMenuGL;
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0)
class LLViewerRegion;
class LLAvatarName;
// [/SL:KB]
enum EMiniMapCenter
{
MAP_CENTER_NONE = 0,
MAP_CENTER_CAMERA = 1
};
class LLNetMap : public LLPanel
class LLNetMap : public LLPanel, public LFIDBearer
{
public:
LLNetMap(const std::string& name);
@@ -81,6 +68,10 @@ public:
/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
/*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
LLUUID getStringUUIDSelectedItem() const override { return mClosestAgentAtLastRightClick; }
uuid_vec_t getSelectedIDs() const override { return mClosestAgentsAtLastClick; }
S32 getNumSelected() const override { return mClosestAgentsAtLastClick.size(); }
static void mm_setcolor(LLUUID key,LLColor4 col); //moymod
@@ -127,6 +118,15 @@ protected:
private:
// [/SL:KB]
LLTextBox *mELabel = nullptr,
*mNLabel = nullptr,
*mWLabel = nullptr,
*mSLabel = nullptr,
*mNELabel = nullptr,
*mNWLabel = nullptr,
*mSWLabel = nullptr,
*mSELabel = nullptr;
F32 mScale; // Size of a region in pixels
F32 mPixelsPerMeter; // world meters to map pixels
F32 mObjectMapTPM; // texels per meter on map
@@ -152,125 +152,12 @@ private:
// [/SL:KB]
static std::map<LLUUID, LLVector3d> mClosestAgentsToCursor; // <exodus/>
static uuid_vec_t mClosestAgentsAtLastClick; // <exodus/>
LLUUID mClosestAgentToCursor;
LLUUID mClosestAgentAtLastRightClick;
static void showAgentProfile(void*);
BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); }
class LLScaleMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCenterMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCheckCenterMap : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLChatRings : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCheckChatRings : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLStopTracking : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLEnableTracking : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLShowAgentProfile : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLCamFollow : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
//moymod - Custom minimap markers :o
class mmsetred : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetgreen : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetblue : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetyellow : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetcustom : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmsetunmark : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class mmenableunmark : public LLMemberListener<LLNetMap> //moymod
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLEnableProfile : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
class LLToggleControl : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
class OverlayToggle : public LLMemberListener<LLNetMap>
{
public:
/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
};
// [/SL:KB]
LLMenuGL* mPopupMenu;
};

View File

@@ -12,11 +12,11 @@
</menu_item_call>
<menu_item_separator />
<menu_item_check label="Center on Camera" name="Center on Camera">
<on_click function="MiniMap.Center" userdata="1" />
<on_check function="MiniMap.CheckCenter" userdata="1" />
<on_click function="ToggleControl" userdata="MiniMapCenter" />
<on_check control="MiniMapCenter" />
</menu_item_check>
<menu_item_check label="Rotate Mini-Map" name="Rotate Mini-Map">
<on_click function="MiniMap.ToggleControl" userdata="MiniMapRotate" />
<on_click function="ToggleControl" userdata="MiniMapRotate" />
<on_check control="MiniMapRotate" />
</menu_item_check>
<menu
@@ -26,7 +26,7 @@
label="Objects"
name="Objects">
<menu_item_check.on_click
function="MiniMap.ToggleControl"
function="ToggleControl"
userdata="ShowMiniMapObjects" />
<menu_item_check.on_check
control="ShowMiniMapObjects" />
@@ -35,8 +35,9 @@
label="Property Lines"
name="Property Lines">
<menu_item_check.on_click
function="Minimap.ToggleOverlay"
function="ToggleControl"
userdata="MiniMapPropertyLines" />
<menu_item_check.on_click function="Minimap.ToggleOverlay"/>
<menu_item_check.on_check
control="MiniMapPropertyLines" />
</menu_item_check>
@@ -44,8 +45,9 @@
label="Parcels for Sale"
name="Parcels for Sale">
<menu_item_check.on_click
function="Minimap.ToggleOverlay"
function="ToggleControl"
userdata="MiniMapForSaleParcels" />
<menu_item_check.on_click function="Minimap.ToggleOverlay"/>
<menu_item_check.on_check
control="MiniMapForSaleParcels" />
<menu_item_check.on_enable
@@ -57,7 +59,7 @@
<menu_item_check.on_check
control="MiniMapRadarTrackingCircles"/>
<menu_item_check.on_click
function="MiniMap.ToggleControl"
function="ToggleControl"
userdata="MiniMapRadarTrackingCircles"/>
</menu_item_check>
</menu>
@@ -69,30 +71,23 @@
<menu_item_separator />
<menu_item_check label="Show Whisper Ring" name="Show Whisper Ring">
<on_check control="MiniMapWhisperRing" />
<on_click function="MiniMap.ToggleControl" userdata="MiniMapWhisperRing" />
<on_click function="ToggleControl" userdata="MiniMapWhisperRing" />
</menu_item_check>
<menu_item_check label="Show Chat Ring" name="Show Chat Ring">
<on_check control="MiniMapChatRing" />
<on_click function="MiniMap.ToggleControl" userdata="MiniMapChatRing" />
<on_click function="ToggleControl" userdata="MiniMapChatRing" />
</menu_item_check>
<menu_item_check label="Show Shout Ring" name="Show Shout Ring">
<on_check control="MiniMapShoutRing" />
<on_click function="MiniMap.ToggleControl" userdata="MiniMapShoutRing" />
<on_click function="ToggleControl" userdata="MiniMapShoutRing" />
</menu_item_check>
</menu>
<menu_item_separator />
<menu_item_call label="Stop Tracking" name="Stop Tracking">
<on_click function="MiniMap.StopTracking" />
<on_enable function="MiniMap.EnableTracking" />
</menu_item_call>
<menu_item_call label="Profile..." name="Profile">
<on_click function="MiniMap.ShowProfile" />
<on_enable function="MiniMap.EnableProfile" />
</menu_item_call>
<menu_item_call label="Cam..." name="Camfollow">
<on_click function="MiniMap.CamFollow" />
<on_enable function="MiniMap.EnableProfile" />
<on_click function="StopTracking" />
<on_visible function="IsTracking" />
</menu_item_call>
<menu name="avs_menu" label="Selected Avatars" filename="menu_local_avs.xml">
<menu name="Mark" label="Mark">
<menu_item_call label="Red" name="Red">
<on_click function="MiniMap.setred" />
@@ -109,13 +104,14 @@
<menu_item_call label="Custom..." name="Custom">
<on_click function="MiniMap.setcustom" />
</menu_item_call>
</menu>
<menu_item_call label="Unmark" name="Unmark">
<on_click function="MiniMap.setunmark" />
<on_enable function="MiniMap.enableunmark" />
</menu_item_call>
</menu>
<menu_item_call label="Unmark" name="Unmark">
<on_click function="MiniMap.setunmark" />
<on_enable function="MiniMap.enableunmark" />
</menu_item_call>
<menu_item_check label="World Map Textures" name="World Map Textures">
<on_check control="MiniMapWorldMapTextures" />
<on_click function="MiniMap.ToggleControl" userdata="MiniMapWorldMapTextures" />
<on_click function="ToggleControl" userdata="MiniMapWorldMapTextures" />
</menu_item_check>
</menu>