aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnetmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llnetmap.cpp')
-rw-r--r--linden/indra/newview/llnetmap.cpp173
1 files changed, 172 insertions, 1 deletions
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 @@
44#include "llcallingcard.h" 44#include "llcallingcard.h"
45#include "llcolorscheme.h" 45#include "llcolorscheme.h"
46#include "llviewercontrol.h" 46#include "llviewercontrol.h"
47#include "llfloateravatarinfo.h"
48#include "llfloaterworldmap.h" 47#include "llfloaterworldmap.h"
49#include "llframetimer.h" 48#include "llframetimer.h"
50#include "llmutelist.h" 49#include "llmutelist.h"
@@ -66,6 +65,14 @@
66#include "llworldmapview.h" // shared draw code 65#include "llworldmapview.h" // shared draw code
67#include "llappviewer.h" // Only for constants! 66#include "llappviewer.h" // Only for constants!
68 67
68// radar
69#include "llfloateravatarinfo.h"
70#include "llfloatergroupinvite.h"
71#include "llfloatergroups.h"
72#include "roles_constants.h"
73#include "llimview.h"
74#include "llscrolllistctrl.h"
75
69#include "llglheaders.h" 76#include "llglheaders.h"
70 77
71const F32 MAP_SCALE_MIN = 32; 78const F32 MAP_SCALE_MIN = 32;
@@ -105,6 +112,8 @@ LLNetMap::LLNetMap(const std::string& name) :
105 (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile"); 112 (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile");
106 113
107 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); 114 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");
115 //TODO: This'll make it toggle
116 //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map_radar.xml");
108 117
109 updateMinorDirections(); 118 updateMinorDirections();
110 119
@@ -117,6 +126,22 @@ LLNetMap::LLNetMap(const std::string& name) :
117 mPopupMenuHandle = menu->getHandle(); 126 mPopupMenuHandle = menu->getHandle();
118} 127}
119 128
129BOOL LLNetMap::postBuild()
130{
131 mRadarList = getChild<LLScrollListCtrl>("RadarList");
132
133 childSetAction("im_btn", onClickIM, this);
134 childSetAction("profile_btn", onClickProfile, this);
135 childSetAction("offer_teleport_btn", onClickOfferTeleport, this);
136 childSetAction("track_btn", onClickTrack, this);
137 childSetAction("invite_btn", onClickInvite, this);
138 childSetAction("add_btn", onClickAddFriend, this);
139
140 setDefaultBtn("im_btn");
141
142 return TRUE;
143}
144
120LLNetMap::~LLNetMap() 145LLNetMap::~LLNetMap()
121{ 146{
122} 147}
@@ -449,6 +474,8 @@ void LLNetMap::draw()
449 setDirectionPos( getChild<LLTextBox>("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2); 474 setDirectionPos( getChild<LLTextBox>("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2);
450 setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); 475 setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
451 476
477 populateRadar();
478
452 LLView::draw(); 479 LLView::draw();
453} 480}
454 481
@@ -948,3 +975,147 @@ bool LLNetMap::LLEnableProfile::handleEvent(LLPointer<LLEvent> event, const LLSD
948 self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor()); 975 self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor());
949 return true; 976 return true;
950} 977}
978
979
980//
981// Radar
982//
983
984void LLNetMap::populateRadar()
985{
986 BOOL all_loaded = TRUE;
987 BOOL empty = TRUE;
988 LLScrollListCtrl* radar_scroller = getChild<LLScrollListCtrl>("RadarList");
989 radar_scroller->deleteAllItems();
990
991 std::vector<LLUUID> avatar_ids;
992 LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
993 for(U32 i=0; i<avatar_ids.size(); i++)
994 {
995 LLUUID& av = avatar_ids[i];
996 if(av == gAgent.getID()) continue;
997 LLSD element;
998 element["id"] = av; // value
999 std::string fullname;
1000 if(!gCacheName->getFullName(av, fullname))
1001 {
1002 element["columns"][0]["value"] = LLCacheName::getDefaultName();
1003 all_loaded = FALSE;
1004 }
1005 else
1006 {
1007 element["columns"][0]["value"] = fullname;
1008 }
1009 radar_scroller->addElement(element);
1010 empty = FALSE;
1011 }
1012
1013 if (empty)
1014 {
1015 childDisable("RadarList");
1016 //radar_scroller->addCommentText(getString("no_one_near"));
1017 }
1018 else
1019 {
1020 childEnable("RadarList");
1021 radar_scroller->selectFirstItem();
1022 //onList(radar_scroller, this);
1023 radar_scroller->setFocus(TRUE);
1024 }
1025
1026 //if (all_loaded)
1027 //{
1028 // mRadarListComplete = TRUE;
1029 //}
1030}
1031
1032// TODO: Since there're no tabs, move this up above
1033//void LLNetMap::onList(LLUICtrl* ctrl, void* userdata)
1034//{
1035// LLNetMap* self = (LLNetMap*)userdata;
1036// if (self)
1037// {
1038// self->childSetEnabled("im_btn", self->visibleItemsSelected());
1039// self->childSetEnabled("profile_btn", self->visibleItemsSelected());
1040// self->childSetEnabled("offer_teleport_btn", self->visibleItemsSelected());
1041// self->childSetEnabled("track_btn", self->visibleItemsSelected());
1042// self->childSetEnabled("invite_btn", self->visibleItemsSelected());
1043// self->childSetEnabled("add_btn", self->visibleItemsSelected());
1044// }
1045//}
1046
1047void LLNetMap::onClickIM(void* user_data)
1048{
1049 LLNetMap* self = (LLNetMap*) user_data;
1050
1051 LLScrollListItem *item = self->mRadarList->getFirstSelected();
1052 LLUUID agent_id = item->getUUID();
1053 std::string fullname;
1054 if(gCacheName->getFullName(agent_id, fullname))
1055 {
1056 gIMMgr->setFloaterOpen(TRUE);
1057 gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id);
1058 }
1059}
1060
1061void LLNetMap::onClickProfile(void* user_data)
1062{
1063 LLNetMap* self = (LLNetMap*) user_data;
1064
1065 LLScrollListItem *item = self->mRadarList->getFirstSelected();
1066 LLUUID agent_id = item->getUUID();
1067 LLFloaterAvatarInfo::show(agent_id);
1068}
1069
1070void LLNetMap::onClickOfferTeleport(void* user_data)
1071{
1072}
1073
1074void LLNetMap::onClickTrack(void* user_data)
1075{
1076 LLNetMap* self = (LLNetMap*) user_data;
1077
1078 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
1079 if (LLTracker::TRACKING_AVATAR == tracking_status)
1080 {
1081 LLTracker::stopTracking(NULL);
1082 }
1083 else
1084 {
1085 LLScrollListItem *item = self->mRadarList->getFirstSelected();
1086 LLUUID agent_id = item->getUUID();
1087 std::string fullname;
1088 gCacheName->getFullName(agent_id, fullname);
1089 LLTracker::trackAvatar(agent_id, fullname);
1090 }
1091}
1092
1093void LLNetMap::onClickInvite(void* user_data)
1094{
1095 LLNetMap* self = (LLNetMap*) user_data;
1096
1097 LLScrollListItem *item = self->mRadarList->getFirstSelected();
1098 LLUUID agent_id = item->getUUID();
1099 {
1100 LLFloaterGroupPicker* widget;
1101 widget = LLFloaterGroupPicker::showInstance(LLSD(gAgent.getID()));
1102 if (widget)
1103 {
1104 widget->center();
1105 widget->setPowersMask(GP_MEMBER_INVITE);
1106 widget->setSelectCallback(callback_invite_to_group, (void *)&agent_id);
1107 }
1108 }
1109}
1110
1111void LLNetMap::callback_invite_to_group(LLUUID group_id, void *user_data)
1112{
1113 std::vector<LLUUID> agent_ids;
1114 agent_ids.push_back(*(LLUUID *)user_data);
1115
1116 LLFloaterGroupInvite::showForGroup(group_id, &agent_ids);
1117}
1118
1119void LLNetMap::onClickAddFriend(void* user_data)
1120{
1121} \ No newline at end of file