diff options
Diffstat (limited to 'indra/newview/llfloaterworldmap.cpp')
-rw-r--r-- | indra/newview/llfloaterworldmap.cpp | 351 |
1 files changed, 181 insertions, 170 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 3a4a3f3e1b..848d01d5ac 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -128,14 +128,14 @@ public: virtual void changed(U32 mask); }; -//void LLMapFriendObserver::changed(U32 mask) -//{ -// // if there's a change we're interested in. -// if((mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE | LLFriendObserver::POWERS)) != 0) -// { -// gFloaterWorldMap->friendsChanged(); -// } -//} +void LLMapFriendObserver::changed(U32 mask) +{ + // if there's a change we're interested in. + if((mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE | LLFriendObserver::POWERS)) != 0) + { + gFloaterWorldMap->friendsChanged(); + } +} //--------------------------------------------------------------------------- // Statics @@ -201,15 +201,15 @@ BOOL LLFloaterWorldMap::postBuild() // //onCommitBackground((void*)this, false); - //childSetCommitCallback("friend combo", onAvatarComboCommit, this); + childSetCommitCallback("friend combo", onAvatarComboCommit, this); - //LLComboBox *avatar_combo = getChild<LLComboBox>( "friend combo"); - //if (avatar_combo) - //{ - // avatar_combo->selectFirstItem(); - // avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); - // avatar_combo->setTextEntryCallback( onComboTextEntry ); - //} + LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo"); + if (avatar_combo) + { + avatar_combo->selectFirstItem(); + avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); + avatar_combo->setTextEntryCallback( onComboTextEntry ); + } childSetAction("DoSearch", onLocationCommit, this); @@ -322,7 +322,7 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) gFloaterWorldMap->childSetFocus("location", TRUE); gFocusMgr.triggerFocusFlash(); -// gFloaterWorldMap->buildAvatarIDList(); + gFloaterWorldMap->buildAvatarIDList(); gFloaterWorldMap->buildLandmarkIDLists(); // If nothing is being tracked, set flag so the user position will be found @@ -439,14 +439,14 @@ void LLFloaterWorldMap::draw() updateLocation(); LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); - //if (LLTracker::TRACKING_AVATAR == tracking_status) - //{ - // childSetColor("avatar_icon", gTrackColor); - //} - //else - //{ - // childSetColor("avatar_icon", gDisabledTrackColor); - //} + if (LLTracker::TRACKING_AVATAR == tracking_status) + { + childSetColor("avatar_icon", gTrackColor); + } + else + { + childSetColor("avatar_icon", gDisabledTrackColor); + } if (LLTracker::TRACKING_LANDMARK == tracking_status) { @@ -509,27 +509,38 @@ void LLFloaterWorldMap::draw() LLFloater::draw(); } -// -////------------------------------------------------------------------------- -//// Internal utility functions -////------------------------------------------------------------------------- -// -// + +//------------------------------------------------------------------------- +// Internal utility functions +//------------------------------------------------------------------------- + + void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const LLString& name ) { - // *HACK: Adjust Z values automatically for liaisons & gods so - // they swoop down when they click on the map. Requested - // convenience. - if(gAgent.isGodlike()) + LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); + if (!iface) return; + + buildAvatarIDList(); + if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike()) { - childSetValue("spin z", LLSD(200.f)); + // *HACK: Adjust Z values automatically for liaisons & gods so + // they swoop down when they click on the map. Requested + // convenience. + if(gAgent.isGodlike()) + { + childSetValue("spin z", LLSD(200.f)); + } + // Don't re-request info if we already have it or we won't have it in time to teleport + if (mTrackedStatus != LLTracker::TRACKING_AVATAR || name != mTrackedAvatarName) + { + mTrackedStatus = LLTracker::TRACKING_AVATAR; + mTrackedAvatarName = name; + LLTracker::trackAvatar(avatar_id, name); + } } - // Don't re-request info if we already have it or we won't have it in time to teleport - if (mTrackedStatus != LLTracker::TRACKING_AVATAR || name != mTrackedAvatarName) + else { - mTrackedStatus = LLTracker::TRACKING_AVATAR; - mTrackedAvatarName = name; - LLTracker::trackAvatar(avatar_id, name); + LLTracker::stopTracking(NULL); } setDefaultBtn("Teleport"); } @@ -782,68 +793,68 @@ void LLFloaterWorldMap::inventoryChanged() } } -//void LLFloaterWorldMap::observeFriends() -//{ -// if(!mFriendObserver) -// { -// mFriendObserver = new LLMapFriendObserver; -// LLAvatarTracker::instance().addObserver(mFriendObserver); -// friendsChanged(); -// } -//} - -//void LLFloaterWorldMap::friendsChanged() -//{ -// LLAvatarTracker& t = LLAvatarTracker::instance(); -// const LLUUID& avatar_id = t.getAvatarID(); -// buildAvatarIDList(); -// if(avatar_id.notNull()) -// { -// LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); -// if(!iface || !iface->setCurrentByID(avatar_id) || -// !t.getBuddyInfo(avatar_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) || gAgent.isGodlike()) -// { -// LLTracker::stopTracking(NULL); -// } -// } -//} -// -//// No longer really builds a list. Instead, just updates mAvatarCombo. -//void LLFloaterWorldMap::buildAvatarIDList() -//{ -// LLCtrlListInterface *list = childGetListInterface("friend combo"); -// if (!list) return; -// -// // Delete all but the "None" entry -// S32 list_size = list->getItemCount(); -// while (list_size > 1) -// { -// list->selectNthItem(1); -// list->operateOnSelection(LLCtrlListInterface::OP_DELETE); -// --list_size; -// } -// -// LLSD default_column; -// default_column["name"] = "friend name"; -// default_column["label"] = "Friend Name"; -// default_column["width"] = 500; -// list->addColumn(default_column); -// -// // Get all of the calling cards for avatar that are currently online -// LLCollectMappableBuddies collector; -// LLAvatarTracker::instance().applyFunctor(collector); -// LLCollectMappableBuddies::buddy_map_t::iterator it; -// LLCollectMappableBuddies::buddy_map_t::iterator end; -// it = collector.mMappable.begin(); -// end = collector.mMappable.end(); -// for( ; it != end; ++it) -// { -// list->addSimpleElement((*it).first, ADD_BOTTOM, (*it).second); -// } -// -// list->setCurrentByID( LLAvatarTracker::instance().getAvatarID() ); -// list->selectFirstItem(); -//} +void LLFloaterWorldMap::observeFriends() +{ + if(!mFriendObserver) + { + mFriendObserver = new LLMapFriendObserver; + LLAvatarTracker::instance().addObserver(mFriendObserver); + friendsChanged(); + } +} + +void LLFloaterWorldMap::friendsChanged() +{ + LLAvatarTracker& t = LLAvatarTracker::instance(); + const LLUUID& avatar_id = t.getAvatarID(); + buildAvatarIDList(); + if(avatar_id.notNull()) + { + LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); + if(!iface || !iface->setCurrentByID(avatar_id) || + !t.getBuddyInfo(avatar_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) || gAgent.isGodlike()) + { + LLTracker::stopTracking(NULL); + } + } +} + +// No longer really builds a list. Instead, just updates mAvatarCombo. +void LLFloaterWorldMap::buildAvatarIDList() +{ + LLCtrlListInterface *list = childGetListInterface("friend combo"); + if (!list) return; + + // Delete all but the "None" entry + S32 list_size = list->getItemCount(); + while (list_size > 1) + { + list->selectNthItem(1); + list->operateOnSelection(LLCtrlListInterface::OP_DELETE); + --list_size; + } + + LLSD default_column; + default_column["name"] = "friend name"; + default_column["label"] = "Friend Name"; + default_column["width"] = 500; + list->addColumn(default_column); + + // Get all of the calling cards for avatar that are currently online + LLCollectMappableBuddies collector; + LLAvatarTracker::instance().applyFunctor(collector); + LLCollectMappableBuddies::buddy_map_t::iterator it; + LLCollectMappableBuddies::buddy_map_t::iterator end; + it = collector.mMappable.begin(); + end = collector.mMappable.end(); + for( ; it != end; ++it) + { + list->addSimpleElement((*it).first, ADD_BOTTOM, (*it).second); + } + + list->setCurrentByID( LLAvatarTracker::instance().getAvatarID() ); + list->selectFirstItem(); +} void LLFloaterWorldMap::buildLandmarkIDLists() @@ -949,19 +960,19 @@ void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) } } -// -//void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui) -//{ -// if (clear_ui || !childHasKeyboardFocus("friend combo")) -// { -// mTrackedStatus = LLTracker::TRACKING_NOTHING; -// LLCtrlListInterface *list = childGetListInterface("friend combo"); -// if (list) -// { -// list->selectByValue( "None" ); -// } -// } -//} + +void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui) +{ + if (clear_ui || !childHasKeyboardFocus("friend combo")) + { + mTrackedStatus = LLTracker::TRACKING_NOTHING; + LLCtrlListInterface *list = childGetListInterface("friend combo"); + if (list) + { + list->selectByValue( "None" ); + } + } +} // Adjust the maximally zoomed out limit of the zoom slider so you @@ -1128,60 +1139,60 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); } -//// static -//void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) -//{ -// LLFloaterWorldMap* self = gFloaterWorldMap; -// if( !self || self->mIsClosing ) -// { -// return; -// } -// -// LLCtrlListInterface *list = self->childGetListInterface("friend combo"); -// if (!list) return; -// -// LLUUID current_choice; -// -// if( LLAvatarTracker::instance().haveTrackingInfo() ) -// { -// current_choice = LLAvatarTracker::instance().getAvatarID(); -// } -// -// self->buildAvatarIDList(); -// -// if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) -// { -// LLTracker::stopTracking(NULL); -// } -//} -// -// -//// static -//void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) -//{ -// LLFloaterWorldMap* self = gFloaterWorldMap; -// if( !self || self->mIsClosing ) -// { -// return; -// } -// -// LLCtrlListInterface *list = gFloaterWorldMap->childGetListInterface("friend combo"); -// if (!list) return; -// -// const LLUUID& new_avatar_id = list->getCurrentID(); -// if (new_avatar_id.notNull()) -// { -// LLString name; -// LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); -// if (combo) name = combo->getSimple(); -// self->trackAvatar(new_avatar_id, name); -// onShowTargetBtn(self); -// } -// else -// { // Reset to user postion if nothing is tracked -// self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); -// } -//} +// static +void LLFloaterWorldMap::onAvatarComboPrearrange( LLUICtrl* ctrl, void* userdata ) +{ + LLFloaterWorldMap* self = gFloaterWorldMap; + if( !self || self->mIsClosing ) + { + return; + } + + LLCtrlListInterface *list = self->childGetListInterface("friend combo"); + if (!list) return; + + LLUUID current_choice; + + if( LLAvatarTracker::instance().haveTrackingInfo() ) + { + current_choice = LLAvatarTracker::instance().getAvatarID(); + } + + self->buildAvatarIDList(); + + if( !list->setCurrentByID( current_choice ) || current_choice.isNull() ) + { + LLTracker::stopTracking(NULL); + } +} + + +// static +void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) +{ + LLFloaterWorldMap* self = gFloaterWorldMap; + if( !self || self->mIsClosing ) + { + return; + } + + LLCtrlListInterface *list = gFloaterWorldMap->childGetListInterface("friend combo"); + if (!list) return; + + const LLUUID& new_avatar_id = list->getCurrentID(); + if (new_avatar_id.notNull()) + { + LLString name; + LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); + if (combo) name = combo->getSimple(); + self->trackAvatar(new_avatar_id, name); + onShowTargetBtn(self); + } + else + { // Reset to user postion if nothing is tracked + self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); + } +} //static void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus, void* userdata ) |