diff options
author | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
commit | 117e22047c5752352342d64e3fb7ce00a4eb8113 (patch) | |
tree | e32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/newview/llfloaterworldmap.cpp | |
parent | Second Life viewer sources 1.18.0.6 (diff) | |
download | meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2 meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz |
Second Life viewer sources 1.18.1.2
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterworldmap.cpp | 75 |
1 files changed, 69 insertions, 6 deletions
diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp index dc42a40..ccd252b 100644 --- a/linden/indra/newview/llfloaterworldmap.cpp +++ b/linden/indra/newview/llfloaterworldmap.cpp | |||
@@ -179,6 +179,8 @@ LLFloaterWorldMap::LLFloaterWorldMap() | |||
179 | mCompletingRegionName(""), | 179 | mCompletingRegionName(""), |
180 | mWaitingForTracker(FALSE), | 180 | mWaitingForTracker(FALSE), |
181 | mExactMatch(FALSE), | 181 | mExactMatch(FALSE), |
182 | mIsClosing(FALSE), | ||
183 | mSetToUserPosition(TRUE), | ||
182 | mTrackedLocation(0,0,0), | 184 | mTrackedLocation(0,0,0), |
183 | mTrackedStatus(LLTracker::TRACKING_NOTHING) | 185 | mTrackedStatus(LLTracker::TRACKING_NOTHING) |
184 | { | 186 | { |
@@ -355,6 +357,9 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) | |||
355 | 357 | ||
356 | gFloaterWorldMap->buildAvatarIDList(); | 358 | gFloaterWorldMap->buildAvatarIDList(); |
357 | gFloaterWorldMap->buildLandmarkIDLists(); | 359 | gFloaterWorldMap->buildLandmarkIDLists(); |
360 | |||
361 | // If nothing is being tracked, set flag so the user position will be found | ||
362 | gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); | ||
358 | } | 363 | } |
359 | 364 | ||
360 | if (center_on_target) | 365 | if (center_on_target) |
@@ -517,7 +522,7 @@ void LLFloaterWorldMap::draw() | |||
517 | childSetEnabled("Teleport", (BOOL)tracking_status); | 522 | childSetEnabled("Teleport", (BOOL)tracking_status); |
518 | // childSetEnabled("Clear", (BOOL)tracking_status); | 523 | // childSetEnabled("Clear", (BOOL)tracking_status); |
519 | childSetEnabled("Show Destination", (BOOL)tracking_status || gWorldMap->mIsTrackingUnknownLocation); | 524 | childSetEnabled("Show Destination", (BOOL)tracking_status || gWorldMap->mIsTrackingUnknownLocation); |
520 | childSetEnabled("copy_slurl", (BOOL)tracking_status); | 525 | childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); |
521 | 526 | ||
522 | setMouseOpaque(TRUE); | 527 | setMouseOpaque(TRUE); |
523 | mDragHandle->setMouseOpaque(TRUE); | 528 | mDragHandle->setMouseOpaque(TRUE); |
@@ -661,7 +666,8 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) | |||
661 | return; | 666 | return; |
662 | } | 667 | } |
663 | 668 | ||
664 | LLString sim_name = gWorldMap->simNameFromPosGlobal( pos_global ); | 669 | LLString sim_name; |
670 | gWorldMap->simNameFromPosGlobal( pos_global, sim_name ); | ||
665 | F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); | 671 | F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS ); |
666 | F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); | 672 | F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS ); |
667 | LLString full_name = llformat("%s (%d, %d, %d)", | 673 | LLString full_name = llformat("%s (%d, %d, %d)", |
@@ -682,15 +688,51 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) | |||
682 | 688 | ||
683 | void LLFloaterWorldMap::updateLocation() | 689 | void LLFloaterWorldMap::updateLocation() |
684 | { | 690 | { |
691 | bool gotSimName; | ||
692 | |||
693 | LLTracker::ETrackingStatus status = LLTracker::getTrackingStatus(); | ||
694 | |||
685 | // These values may get updated by a message, so need to check them every frame | 695 | // These values may get updated by a message, so need to check them every frame |
686 | // The fields may be changed by the user, so only update them if the data changes | 696 | // The fields may be changed by the user, so only update them if the data changes |
687 | LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); | 697 | LLVector3d pos_global = LLTracker::getTrackedPositionGlobal(); |
688 | if (pos_global.isExactlyZero()) | 698 | if (pos_global.isExactlyZero()) |
689 | { | 699 | { |
700 | LLVector3d agentPos = gAgent.getPositionGlobal(); | ||
701 | |||
702 | // Set to avatar's current postion if nothing is selected | ||
703 | if ( status == LLTracker::TRACKING_NOTHING && mSetToUserPosition ) | ||
704 | { | ||
705 | // Make sure we know where we are before setting the current user position | ||
706 | LLString agent_sim_name; | ||
707 | gotSimName = gWorldMap->simNameFromPosGlobal( agentPos, agent_sim_name ); | ||
708 | if ( gotSimName ) | ||
709 | { | ||
710 | mSetToUserPosition = FALSE; | ||
711 | |||
712 | // Fill out the location field | ||
713 | childSetValue("location", agent_sim_name); | ||
714 | |||
715 | // Figure out where user is | ||
716 | LLVector3d agentPos = gAgent.getPositionGlobal(); | ||
717 | |||
718 | S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) ); | ||
719 | S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) ); | ||
720 | S32 agent_z = llround( (F32)agentPos.mdV[VZ] ); | ||
721 | |||
722 | childSetValue("spin x", LLSD(agent_x) ); | ||
723 | childSetValue("spin y", LLSD(agent_y) ); | ||
724 | childSetValue("spin z", LLSD(agent_z) ); | ||
725 | |||
726 | // Set the current SLURL | ||
727 | mSLURL = LLWeb::escapeURL( llformat("http://slurl.com/secondlife/%s/%d/%d/%d", | ||
728 | agent_sim_name.c_str(), agent_x, agent_y, agent_z) ); | ||
729 | } | ||
730 | } | ||
731 | |||
690 | return; // invalid location | 732 | return; // invalid location |
691 | } | 733 | } |
692 | LLTracker::ETrackingStatus status = LLTracker::getTrackingStatus(); | 734 | LLString sim_name; |
693 | LLString sim_name = gWorldMap->simNameFromPosGlobal( pos_global ); | 735 | gotSimName = gWorldMap->simNameFromPosGlobal( pos_global, sim_name ); |
694 | if ((status != LLTracker::TRACKING_NOTHING) && | 736 | if ((status != LLTracker::TRACKING_NOTHING) && |
695 | (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) | 737 | (status != mTrackedStatus || pos_global != mTrackedLocation || sim_name != mTrackedSimName)) |
696 | { | 738 | { |
@@ -717,8 +759,16 @@ void LLFloaterWorldMap::updateLocation() | |||
717 | childSetValue("spin y", LLSD(region_y) ); | 759 | childSetValue("spin y", LLSD(region_y) ); |
718 | childSetValue("spin z", LLSD((F32)pos_global.mdV[VZ]) ); | 760 | childSetValue("spin z", LLSD((F32)pos_global.mdV[VZ]) ); |
719 | 761 | ||
720 | mSLURL = LLWeb::escapeURL(llformat("http://slurl.com/secondlife/%s/%d/%d/%d", | 762 | // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL |
721 | sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]))); | 763 | if ( gotSimName ) |
764 | { | ||
765 | mSLURL = LLWeb::escapeURL(llformat("http://slurl.com/secondlife/%s/%d/%d/%d", | ||
766 | sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]))); | ||
767 | } | ||
768 | else | ||
769 | { // Empty SLURL will disable the "Copy SLURL to clipboard" button | ||
770 | mSLURL = ""; | ||
771 | } | ||
722 | } | 772 | } |
723 | } | 773 | } |
724 | 774 | ||
@@ -1102,6 +1152,9 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) | |||
1102 | 1152 | ||
1103 | self->trackLandmark( item_id); | 1153 | self->trackLandmark( item_id); |
1104 | onShowTargetBtn(self); | 1154 | onShowTargetBtn(self); |
1155 | |||
1156 | // Reset to user postion if nothing is tracked | ||
1157 | self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); | ||
1105 | } | 1158 | } |
1106 | 1159 | ||
1107 | // static | 1160 | // static |
@@ -1153,6 +1206,10 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) | |||
1153 | self->trackAvatar(new_avatar_id, name); | 1206 | self->trackAvatar(new_avatar_id, name); |
1154 | onShowTargetBtn(self); | 1207 | onShowTargetBtn(self); |
1155 | } | 1208 | } |
1209 | else | ||
1210 | { // Reset to user postion if nothing is tracked | ||
1211 | self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); | ||
1212 | } | ||
1156 | } | 1213 | } |
1157 | 1214 | ||
1158 | // static | 1215 | // static |
@@ -1208,6 +1265,8 @@ void LLFloaterWorldMap::onClearBtn(void* data) | |||
1208 | self->mTrackedStatus = LLTracker::TRACKING_NOTHING; | 1265 | self->mTrackedStatus = LLTracker::TRACKING_NOTHING; |
1209 | LLTracker::stopTracking((void *)(intptr_t)TRUE); | 1266 | LLTracker::stopTracking((void *)(intptr_t)TRUE); |
1210 | gWorldMap->mIsTrackingUnknownLocation = FALSE; | 1267 | gWorldMap->mIsTrackingUnknownLocation = FALSE; |
1268 | self->mSLURL = ""; // Clear the SLURL since it's invalid | ||
1269 | self->mSetToUserPosition = TRUE; // Revert back to the current user position | ||
1211 | } | 1270 | } |
1212 | 1271 | ||
1213 | // static | 1272 | // static |
@@ -1226,6 +1285,10 @@ void LLFloaterWorldMap::onShowTargetBtn(void* data) | |||
1226 | void LLFloaterWorldMap::onShowAgentBtn(void* data) | 1285 | void LLFloaterWorldMap::onShowAgentBtn(void* data) |
1227 | { | 1286 | { |
1228 | LLWorldMapView::setPan( 0, 0, FALSE); // FALSE == animate | 1287 | LLWorldMapView::setPan( 0, 0, FALSE); // FALSE == animate |
1288 | |||
1289 | // Set flag so user's location will be displayed if not tracking anything else | ||
1290 | LLFloaterWorldMap* self = (LLFloaterWorldMap*)data; | ||
1291 | self->mSetToUserPosition = TRUE; | ||
1229 | } | 1292 | } |
1230 | 1293 | ||
1231 | // static | 1294 | // static |