From c174569f9c34f684e2e057ee57b23a6a118ddfcc Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 9 Aug 2009 11:11:09 -0700 Subject: Basic basic radar that kinda sorta works but not really --- linden/indra/newview/llnetmap.cpp | 173 ++++++++++++++++++++- linden/indra/newview/llnetmap.h | 18 ++- .../skins/default/xui/en-us/panel_mini_map.xml | 46 +++++- 3 files changed, 233 insertions(+), 4 deletions(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp index 6fa6745..765b6e6 100644 --- a/linden/indra/newview/llnetmap.cpp +++ b/linden/indra/newview/llnetmap.cpp @@ -44,7 +44,6 @@ #include "llcallingcard.h" #include "llcolorscheme.h" #include "llviewercontrol.h" -#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" #include "llframetimer.h" #include "llmutelist.h" @@ -66,6 +65,14 @@ #include "llworldmapview.h" // shared draw code #include "llappviewer.h" // Only for constants! +// radar +#include "llfloateravatarinfo.h" +#include "llfloatergroupinvite.h" +#include "llfloatergroups.h" +#include "roles_constants.h" +#include "llimview.h" +#include "llscrolllistctrl.h" + #include "llglheaders.h" const F32 MAP_SCALE_MIN = 32; @@ -105,6 +112,8 @@ LLNetMap::LLNetMap(const std::string& name) : (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile"); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); + //TODO: This'll make it toggle + //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map_radar.xml"); updateMinorDirections(); @@ -117,6 +126,22 @@ LLNetMap::LLNetMap(const std::string& name) : mPopupMenuHandle = menu->getHandle(); } +BOOL LLNetMap::postBuild() +{ + mRadarList = getChild("RadarList"); + + childSetAction("im_btn", onClickIM, this); + childSetAction("profile_btn", onClickProfile, this); + childSetAction("offer_teleport_btn", onClickOfferTeleport, this); + childSetAction("track_btn", onClickTrack, this); + childSetAction("invite_btn", onClickInvite, this); + childSetAction("add_btn", onClickAddFriend, this); + + setDefaultBtn("im_btn"); + + return TRUE; +} + LLNetMap::~LLNetMap() { } @@ -449,6 +474,8 @@ void LLNetMap::draw() setDirectionPos( getChild("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2); setDirectionPos( getChild("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); + populateRadar(); + LLView::draw(); } @@ -948,3 +975,147 @@ bool LLNetMap::LLEnableProfile::handleEvent(LLPointer event, const LLSD self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor()); return true; } + + +// +// Radar +// + +void LLNetMap::populateRadar() +{ + BOOL all_loaded = TRUE; + BOOL empty = TRUE; + LLScrollListCtrl* radar_scroller = getChild("RadarList"); + radar_scroller->deleteAllItems(); + + std::vector avatar_ids; + LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange")); + for(U32 i=0; igetFullName(av, fullname)) + { + element["columns"][0]["value"] = LLCacheName::getDefaultName(); + all_loaded = FALSE; + } + else + { + element["columns"][0]["value"] = fullname; + } + radar_scroller->addElement(element); + empty = FALSE; + } + + if (empty) + { + childDisable("RadarList"); + //radar_scroller->addCommentText(getString("no_one_near")); + } + else + { + childEnable("RadarList"); + radar_scroller->selectFirstItem(); + //onList(radar_scroller, this); + radar_scroller->setFocus(TRUE); + } + + //if (all_loaded) + //{ + // mRadarListComplete = TRUE; + //} +} + +// TODO: Since there're no tabs, move this up above +//void LLNetMap::onList(LLUICtrl* ctrl, void* userdata) +//{ +// LLNetMap* self = (LLNetMap*)userdata; +// if (self) +// { +// self->childSetEnabled("im_btn", self->visibleItemsSelected()); +// self->childSetEnabled("profile_btn", self->visibleItemsSelected()); +// self->childSetEnabled("offer_teleport_btn", self->visibleItemsSelected()); +// self->childSetEnabled("track_btn", self->visibleItemsSelected()); +// self->childSetEnabled("invite_btn", self->visibleItemsSelected()); +// self->childSetEnabled("add_btn", self->visibleItemsSelected()); +// } +//} + +void LLNetMap::onClickIM(void* user_data) +{ + LLNetMap* self = (LLNetMap*) user_data; + + LLScrollListItem *item = self->mRadarList->getFirstSelected(); + LLUUID agent_id = item->getUUID(); + std::string fullname; + if(gCacheName->getFullName(agent_id, fullname)) + { + gIMMgr->setFloaterOpen(TRUE); + gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id); + } +} + +void LLNetMap::onClickProfile(void* user_data) +{ + LLNetMap* self = (LLNetMap*) user_data; + + LLScrollListItem *item = self->mRadarList->getFirstSelected(); + LLUUID agent_id = item->getUUID(); + LLFloaterAvatarInfo::show(agent_id); +} + +void LLNetMap::onClickOfferTeleport(void* user_data) +{ +} + +void LLNetMap::onClickTrack(void* user_data) +{ + LLNetMap* self = (LLNetMap*) user_data; + + LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); + if (LLTracker::TRACKING_AVATAR == tracking_status) + { + LLTracker::stopTracking(NULL); + } + else + { + LLScrollListItem *item = self->mRadarList->getFirstSelected(); + LLUUID agent_id = item->getUUID(); + std::string fullname; + gCacheName->getFullName(agent_id, fullname); + LLTracker::trackAvatar(agent_id, fullname); + } +} + +void LLNetMap::onClickInvite(void* user_data) +{ + LLNetMap* self = (LLNetMap*) user_data; + + LLScrollListItem *item = self->mRadarList->getFirstSelected(); + LLUUID agent_id = item->getUUID(); + { + LLFloaterGroupPicker* widget; + widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID())); + if (widget) + { + widget->center(); + widget->setPowersMask(GP_MEMBER_INVITE); + widget->setSelectCallback(callback_invite_to_group, (void *)&agent_id); + } + } +} + +void LLNetMap::callback_invite_to_group(LLUUID group_id, void *user_data) +{ + std::vector agent_ids; + agent_ids.push_back(*(LLUUID *)user_data); + + LLFloaterGroupInvite::showForGroup(group_id, &agent_ids); +} + +void LLNetMap::onClickAddFriend(void* user_data) +{ +} \ No newline at end of file diff --git a/linden/indra/newview/llnetmap.h b/linden/indra/newview/llnetmap.h index ef046d8..58b2066 100644 --- a/linden/indra/newview/llnetmap.h +++ b/linden/indra/newview/llnetmap.h @@ -34,6 +34,7 @@ #include "llpanel.h" #include "llmemberlistener.h" +#include "llscrolllistctrl.h" #include "v3math.h" #include "v3dmath.h" #include "v4color.h" @@ -52,6 +53,8 @@ class LLNetMap : public LLPanel { public: LLNetMap(const std::string& name); + + virtual BOOL postBuild(); virtual ~LLNetMap(); virtual void draw(); @@ -111,8 +114,9 @@ private: LLPointer mObjectImagep; private: - LLUUID mClosestAgentToCursor; - LLUUID mClosestAgentAtLastRightClick; + LLUUID mClosestAgentToCursor; + LLUUID mClosestAgentAtLastRightClick; + LLScrollListCtrl* mRadarList; static BOOL sRotateMap; static LLNetMap* sInstance; @@ -122,6 +126,16 @@ private: static void showAgentProfile(void*); BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); } + void populateRadar(); + + static void onClickProfile(void* user_data); + static void onClickIM(void* user_data); + static void onClickAddFriend(void* user_data); + static void onClickOfferTeleport(void* user_data); + static void onClickTrack(void* user_data); + static void onClickInvite(void* user_data); + static void callback_invite_to_group(LLUUID group_id, void *user_data); + class LLScaleMap : public LLMemberListener { public: diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml b/linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml index 1a93341..085b576 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_mini_map.xml @@ -1,6 +1,6 @@ Double-Click opens Map + + + Select nearby resident: + + + + Meters + + +