aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatermap.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-09-16 23:22:41 -0700
committerMcCabe Maxsted2009-09-16 23:22:41 -0700
commit34a125d95b422e9faf33ccecdae98ecd331cb068 (patch)
tree609263451354d1dc27dae27de80ea311b0fcdccb /linden/indra/newview/llfloatermap.cpp
parentMoved Rotate Mini-Map option to mini-map menu, added first use dialog (diff)
downloadmeta-impy-34a125d95b422e9faf33ccecdae98ecd331cb068.zip
meta-impy-34a125d95b422e9faf33ccecdae98ecd331cb068.tar.gz
meta-impy-34a125d95b422e9faf33ccecdae98ecd331cb068.tar.bz2
meta-impy-34a125d95b422e9faf33ccecdae98ecd331cb068.tar.xz
Estate and track buttons now disable when they should, tweaked spacing
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloatermap.cpp121
1 files changed, 79 insertions, 42 deletions
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp
index a1ab97e..3be891e 100644
--- a/linden/indra/newview/llfloatermap.cpp
+++ b/linden/indra/newview/llfloatermap.cpp
@@ -51,13 +51,18 @@
51#include "llfloaterreporter.h" 51#include "llfloaterreporter.h"
52#include "llimview.h" 52#include "llimview.h"
53#include "llmutelist.h" 53#include "llmutelist.h"
54#include "llparcel.h"
55#include "llregionposition.h"
54#include "roles_constants.h" 56#include "roles_constants.h"
55#include "llscrolllistctrl.h" 57#include "llscrolllistctrl.h"
56#include "lltracker.h" 58#include "lltracker.h"
57#include "llviewerobjectlist.h" 59#include "llviewerobjectlist.h"
60#include "llviewermenu.h"
58#include "llviewermessage.h" 61#include "llviewermessage.h"
62#include "llviewerparcelmgr.h"
59#include "llviewerregion.h" 63#include "llviewerregion.h"
60#include "llviewerwindow.h" 64#include "llviewerwindow.h"
65#include "llvoavatar.h"
61#include "llworld.h" 66#include "llworld.h"
62 67
63LLFloaterMap::LLFloaterMap(const LLSD& key) 68LLFloaterMap::LLFloaterMap(const LLSD& key)
@@ -233,7 +238,7 @@ void LLFloaterMap::populateRadar()
233 238
234 // Add to list only if we get their name 239 // Add to list only if we get their name
235 std::string fullname = getSelectedName(avatar_ids[i]); 240 std::string fullname = getSelectedName(avatar_ids[i]);
236 if (!fullname.empty() && fullname != " ") 241 if (!fullname.empty())
237 { 242 {
238 std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : ""; 243 std::string mute_text = LLMuteList::getInstance()->isMuted(avatar_ids[i]) ? getString("muted") : "";
239 element["id"] = avatar_ids[i]; 244 element["id"] = avatar_ids[i];
@@ -281,30 +286,69 @@ void LLFloaterMap::populateRadar()
281 286
282void LLFloaterMap::toggleButtons() 287void LLFloaterMap::toggleButtons()
283{ 288{
284 BOOL enabled = FALSE; 289 BOOL enable = FALSE;
285 BOOL unmute_enabled = FALSE; 290 BOOL enable_unmute = FALSE;
291 BOOL enable_track = FALSE;
292 BOOL enable_estate = FALSE;
286 if (childHasFocus("RadarPanel")) 293 if (childHasFocus("RadarPanel"))
287 { 294 {
288 enabled = mSelectedAvatar.notNull() ? visibleItemsSelected() : FALSE; 295 enable = mSelectedAvatar.notNull() ? visibleItemsSelected() : FALSE;
289 unmute_enabled = mSelectedAvatar.notNull() ? LLMuteList::getInstance()->isMuted(mSelectedAvatar) : FALSE; 296 enable_unmute = mSelectedAvatar.notNull() ? LLMuteList::getInstance()->isMuted(mSelectedAvatar) : FALSE;
297 enable_track = gAgent.isGodlike() || is_agent_mappable(mSelectedAvatar);
298 enable_estate = getKickable(mSelectedAvatar);
290 } 299 }
291 else 300 else
292 { 301 {
293 mRadarList->deselect(); 302 mRadarList->deselect();
294 } 303 }
295 304
296 childSetEnabled("im_btn", enabled); 305 childSetEnabled("im_btn", enable);
297 childSetEnabled("profile_btn", enabled); 306 childSetEnabled("profile_btn", enable);
298 childSetEnabled("offer_teleport_btn", enabled); 307 childSetEnabled("offer_teleport_btn", enable);
299 childSetEnabled("track_btn", enabled); 308 childSetEnabled("track_btn", enable_track);
300 childSetEnabled("invite_btn", enabled); 309 childSetEnabled("invite_btn", enable);
301 childSetEnabled("add_btn", enabled); 310 childSetEnabled("add_btn", enable);
302 childSetEnabled("freeze_btn", enabled); 311 childSetEnabled("freeze_btn", enable_estate);
303 childSetEnabled("eject_btn", enabled); 312 childSetEnabled("eject_btn", enable_estate);
304 childSetEnabled("mute_btn", enabled); 313 childSetEnabled("mute_btn", enable);
305 childSetEnabled("unmute_btn", unmute_enabled); 314 childSetEnabled("unmute_btn", enable_unmute);
306 childSetEnabled("ar_btn", enabled); 315 childSetEnabled("ar_btn", enable);
307 childSetEnabled("estate_eject_btn", enabled); 316 childSetEnabled("estate_eject_btn", enable_estate);
317}
318
319BOOL LLFloaterMap::getKickable(const LLUUID &agent_id)
320{
321 if (agent_id.notNull())
322 {
323 LLViewerObject* av_obj = gObjectList.findObject(agent_id);
324 if (av_obj != NULL && av_obj->isAvatar())
325 {
326 LLVOAvatar* avatar = (LLVOAvatar*)av_obj;
327 LLViewerRegion* region = avatar->getRegion();
328 if (region)
329 {
330 const LLVector3& pos = avatar->getPositionRegion();
331 const LLVector3d& pos_global = avatar->getPositionGlobal();
332 if (LLWorld::getInstance()->positionRegionValidGlobal(pos_global))
333 {
334 LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
335
336 BOOL new_value = (region != NULL);
337
338 if (new_value)
339 {
340 new_value = region->isOwnedSelf(pos);
341 if (!new_value || region->isOwnedGroup(pos))
342 {
343 new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN);
344 }
345 }
346 return new_value;
347 }
348 }
349 }
350 }
351 return FALSE;
308} 352}
309 353
310// static 354// static
@@ -354,12 +398,8 @@ void LLFloaterMap::onClickIM(void* user_data)
354 if (item != NULL) 398 if (item != NULL)
355 { 399 {
356 LLUUID agent_id = item->getUUID(); 400 LLUUID agent_id = item->getUUID();
357 std::string fullname; 401 gIMMgr->setFloaterOpen(TRUE);
358 if(gCacheName->getFullName(agent_id, fullname)) 402 gIMMgr->addSession(getSelectedName(agent_id), IM_NOTHING_SPECIAL, agent_id);
359 {
360 gIMMgr->setFloaterOpen(TRUE);
361 gIMMgr->addSession(fullname, IM_NOTHING_SPECIAL, agent_id);
362 }
363 } 403 }
364} 404}
365 405
@@ -392,6 +432,7 @@ void LLFloaterMap::onClickTrack(void* user_data)
392{ 432{
393 LLFloaterMap* self = (LLFloaterMap*) user_data; 433 LLFloaterMap* self = (LLFloaterMap*) user_data;
394 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); 434 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
435
395 if (LLTracker::TRACKING_AVATAR == tracking_status) 436 if (LLTracker::TRACKING_AVATAR == tracking_status)
396 { 437 {
397 LLTracker::stopTracking(NULL); 438 LLTracker::stopTracking(NULL);
@@ -402,9 +443,7 @@ void LLFloaterMap::onClickTrack(void* user_data)
402 if (item != NULL) 443 if (item != NULL)
403 { 444 {
404 LLUUID agent_id = item->getUUID(); 445 LLUUID agent_id = item->getUUID();
405 std::string fullname; 446 LLTracker::trackAvatar(agent_id, getSelectedName(agent_id));
406 gCacheName->getFullName(agent_id, fullname);
407 LLTracker::trackAvatar(agent_id, fullname);
408 } 447 }
409 } 448 }
410} 449}
@@ -445,9 +484,7 @@ void LLFloaterMap::onClickAddFriend(void* user_data)
445 if (item != NULL) 484 if (item != NULL)
446 { 485 {
447 LLUUID agent_id = item->getUUID(); 486 LLUUID agent_id = item->getUUID();
448 std::string fullname; 487 LLPanelFriends::requestFriendshipDialog(agent_id, getSelectedName(agent_id));
449 gCacheName->getFullName(agent_id, fullname);
450 LLPanelFriends::requestFriendshipDialog(agent_id, fullname);
451 } 488 }
452} 489}
453 490
@@ -456,10 +493,10 @@ void LLFloaterMap::onClickAddFriend(void* user_data)
456// 493//
457 494
458//static 495//static
459std::string LLFloaterMap::getSelectedName(LLUUID agent_id) 496std::string LLFloaterMap::getSelectedName(const LLUUID &agent_id)
460{ 497{
461 std::string agent_name; 498 std::string agent_name;
462 if(agent_id.notNull() && gCacheName->getFullName(agent_id, agent_name)) 499 if(gCacheName->getFullName(agent_id, agent_name) && agent_name != " ")
463 { 500 {
464 return agent_name; 501 return agent_name;
465 } 502 }
@@ -516,7 +553,7 @@ void LLFloaterMap::onClickFreeze(void *user_data)
516 LLFloaterMap *self = (LLFloaterMap*)user_data; 553 LLFloaterMap *self = (LLFloaterMap*)user_data;
517 LLStringUtil::format_map_t args; 554 LLStringUtil::format_map_t args;
518 LLSD payload; 555 LLSD payload;
519 args["[AVATAR_NAME]"] = self->getSelectedName(self->mSelectedAvatar); 556 args["[AVATAR_NAME]"] = getSelectedName(self->mSelectedAvatar);
520 gViewerWindow->alertXml("FreezeAvatarFullname", args, callbackFreeze, user_data); 557 gViewerWindow->alertXml("FreezeAvatarFullname", args, callbackFreeze, user_data);
521} 558}
522 559
@@ -526,7 +563,7 @@ void LLFloaterMap::onClickEject(void *user_data)
526 LLFloaterMap *self = (LLFloaterMap*)user_data; 563 LLFloaterMap *self = (LLFloaterMap*)user_data;
527 LLStringUtil::format_map_t args; 564 LLStringUtil::format_map_t args;
528 LLSD payload; 565 LLSD payload;
529 args["AVATAR_NAME"] = self->getSelectedName(self->mSelectedAvatar); 566 args["AVATAR_NAME"] = getSelectedName(self->mSelectedAvatar);
530 gViewerWindow->alertXml("EjectAvatarFullName", args, callbackEject, user_data); 567 gViewerWindow->alertXml("EjectAvatarFullName", args, callbackEject, user_data);
531} 568}
532 569
@@ -534,11 +571,11 @@ void LLFloaterMap::onClickEject(void *user_data)
534void LLFloaterMap::onClickMute(void *user_data) 571void LLFloaterMap::onClickMute(void *user_data)
535{ 572{
536 LLFloaterMap *self = (LLFloaterMap*)user_data; 573 LLFloaterMap *self = (LLFloaterMap*)user_data;
537 574 LLScrollListItem *item = self->mRadarList->getFirstSelected();
538 LLUUID agent_id = self->mSelectedAvatar; 575 if (item != NULL)
539 std::string agent_name = self->getSelectedName(agent_id);
540 if(!agent_name.empty())
541 { 576 {
577 LLUUID agent_id = item->getUUID();
578 std::string agent_name = getSelectedName(agent_id);
542 if (LLMuteList::getInstance()->isMuted(agent_id)) 579 if (LLMuteList::getInstance()->isMuted(agent_id))
543 { 580 {
544 //LLMute mute(agent_id, agent_name, LLMute::AGENT); 581 //LLMute mute(agent_id, agent_name, LLMute::AGENT);
@@ -557,11 +594,11 @@ void LLFloaterMap::onClickMute(void *user_data)
557void LLFloaterMap::onClickUnmute(void *user_data) 594void LLFloaterMap::onClickUnmute(void *user_data)
558{ 595{
559 LLFloaterMap *self = (LLFloaterMap*)user_data; 596 LLFloaterMap *self = (LLFloaterMap*)user_data;
560 597 LLScrollListItem *item = self->mRadarList->getFirstSelected();
561 LLUUID agent_id = self->mSelectedAvatar; 598 if (item != NULL)
562 std::string agent_name = self->getSelectedName(agent_id);
563 if(!agent_name.empty())
564 { 599 {
600 LLUUID agent_id = item->getUUID();
601 std::string agent_name = getSelectedName(agent_id);
565 if (LLMuteList::getInstance()->isMuted(agent_id)) 602 if (LLMuteList::getInstance()->isMuted(agent_id))
566 { 603 {
567 LLMute mute(agent_id, agent_name, LLMute::AGENT); 604 LLMute mute(agent_id, agent_name, LLMute::AGENT);
@@ -582,7 +619,7 @@ void LLFloaterMap::onClickEjectFromEstate(void *user_data)
582 LLFloaterMap *self = (LLFloaterMap*)user_data; 619 LLFloaterMap *self = (LLFloaterMap*)user_data;
583 LLStringUtil::format_map_t args; 620 LLStringUtil::format_map_t args;
584 LLSD payload; 621 LLSD payload;
585 args["EVIL_USER"] = self->getSelectedName(self->mSelectedAvatar); 622 args["EVIL_USER"] = getSelectedName(self->mSelectedAvatar);
586 gViewerWindow->alertXml("EstateKickUser", args, callbackEjectFromEstate, user_data); 623 gViewerWindow->alertXml("EstateKickUser", args, callbackEjectFromEstate, user_data);
587} 624}
588 625