diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterworldmap.cpp | 106 |
1 files changed, 65 insertions, 41 deletions
diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp index 9da9a5b..ee84537 100644 --- a/linden/indra/newview/llfloaterworldmap.cpp +++ b/linden/indra/newview/llfloaterworldmap.cpp | |||
@@ -13,12 +13,12 @@ | |||
13 | * ("GPL"), unless you have obtained a separate licensing agreement | 13 | * ("GPL"), unless you have obtained a separate licensing agreement |
14 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 14 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 15 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
16 | * online at http://secondlife.com/developers/opensource/gplv2 | 16 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
17 | * | 17 | * |
18 | * There are special exceptions to the terms and conditions of the GPL as | 18 | * There are special exceptions to the terms and conditions of the GPL as |
19 | * it is applied to this Source Code. View the full text of the exception | 19 | * it is applied to this Source Code. View the full text of the exception |
20 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 20 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
21 | * online at http://secondlife.com/developers/opensource/flossexception | 21 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
22 | * | 22 | * |
23 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
24 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -76,6 +76,7 @@ | |||
76 | #include "lltracker.h" | 76 | #include "lltracker.h" |
77 | #include "llui.h" | 77 | #include "llui.h" |
78 | #include "lluiconstants.h" | 78 | #include "lluiconstants.h" |
79 | #include "llurldispatcher.h" | ||
79 | #include "llviewercamera.h" | 80 | #include "llviewercamera.h" |
80 | #include "llviewermenu.h" | 81 | #include "llviewermenu.h" |
81 | #include "llviewerregion.h" | 82 | #include "llviewerregion.h" |
@@ -125,18 +126,18 @@ class LLMapInventoryObserver : public LLInventoryObserver | |||
125 | { | 126 | { |
126 | public: | 127 | public: |
127 | LLMapInventoryObserver() {} | 128 | LLMapInventoryObserver() {} |
128 | virtual ~LLMapInventoryObserver() {} | 129 | virtual ~LLMapInventoryObserver() {} |
129 | virtual void changed(U32 mask); | 130 | virtual void changed(U32 mask); |
130 | }; | 131 | }; |
131 | 132 | ||
132 | void LLMapInventoryObserver::changed(U32 mask) | 133 | void LLMapInventoryObserver::changed(U32 mask) |
133 | { | 134 | { |
134 | // if there's a change we're interested in. | 135 | // if there's a change we're interested in. |
135 | if((mask & (LLInventoryObserver::CALLING_CARD | LLInventoryObserver::ADD | | 136 | if((mask & (LLInventoryObserver::CALLING_CARD | LLInventoryObserver::ADD | |
136 | LLInventoryObserver::REMOVE)) != 0) | 137 | LLInventoryObserver::REMOVE)) != 0) |
137 | { | 138 | { |
138 | gFloaterWorldMap->inventoryChanged(); | 139 | gFloaterWorldMap->inventoryChanged(); |
139 | } | 140 | } |
140 | } | 141 | } |
141 | 142 | ||
142 | class LLMapFriendObserver : public LLFriendObserver | 143 | class LLMapFriendObserver : public LLFriendObserver |
@@ -176,8 +177,8 @@ LLFloaterWorldMap::LLFloaterWorldMap() | |||
176 | FALSE, // drag on left | 177 | FALSE, // drag on left |
177 | TRUE, // minimize | 178 | TRUE, // minimize |
178 | TRUE), // close | 179 | TRUE), // close |
179 | mInventory(NULL), | 180 | mInventory(NULL), |
180 | mInventoryObserver(NULL), | 181 | mInventoryObserver(NULL), |
181 | mFriendObserver(NULL), | 182 | mFriendObserver(NULL), |
182 | mCompletingRegionName(""), | 183 | mCompletingRegionName(""), |
183 | mWaitingForTracker(FALSE), | 184 | mWaitingForTracker(FALSE), |
@@ -228,12 +229,18 @@ BOOL LLFloaterWorldMap::postBuild() | |||
228 | { | 229 | { |
229 | avatar_combo->selectFirstItem(); | 230 | avatar_combo->selectFirstItem(); |
230 | avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); | 231 | avatar_combo->setPrearrangeCallback( onAvatarComboPrearrange ); |
232 | avatar_combo->setTextEntryCallback( onComboTextEntry ); | ||
231 | } | 233 | } |
232 | 234 | ||
233 | childSetAction("DoSearch", onLocationCommit, this); | 235 | childSetAction("DoSearch", onLocationCommit, this); |
234 | 236 | ||
235 | childSetFocusChangedCallback("location", updateSearchEnabled); | 237 | childSetFocusChangedCallback("location", onLocationFocusChanged, this); |
236 | childSetKeystrokeCallback("location", (void (*)(LLLineEditor*,void*))updateSearchEnabled, NULL); | 238 | |
239 | LLLineEditor *location_editor = LLUICtrlFactory::getLineEditorByName(this, "location"); | ||
240 | if (location_editor) | ||
241 | { | ||
242 | location_editor->setKeystrokeCallback( onSearchTextEntry ); | ||
243 | } | ||
237 | 244 | ||
238 | childSetCommitCallback("search_results", onCommitSearchResult, this); | 245 | childSetCommitCallback("search_results", onCommitSearchResult, this); |
239 | childSetDoubleClickCallback("search_results", onClickTeleportBtn); | 246 | childSetDoubleClickCallback("search_results", onClickTeleportBtn); |
@@ -248,6 +255,7 @@ BOOL LLFloaterWorldMap::postBuild() | |||
248 | { | 255 | { |
249 | landmark_combo->selectFirstItem(); | 256 | landmark_combo->selectFirstItem(); |
250 | landmark_combo->setPrearrangeCallback( onLandmarkComboPrearrange ); | 257 | landmark_combo->setPrearrangeCallback( onLandmarkComboPrearrange ); |
258 | landmark_combo->setTextEntryCallback( onComboTextEntry ); | ||
251 | } | 259 | } |
252 | 260 | ||
253 | childSetAction("Go Home", onGoHome, this); | 261 | childSetAction("Go Home", onGoHome, this); |
@@ -264,14 +272,6 @@ BOOL LLFloaterWorldMap::postBuild() | |||
264 | 272 | ||
265 | setDefaultBtn(NULL); | 273 | setDefaultBtn(NULL); |
266 | 274 | ||
267 | if ( gAgent.isTeen() ) | ||
268 | { | ||
269 | // Hide Mature Events controls | ||
270 | childHide("events_mature_icon"); | ||
271 | childHide("events_mature_label"); | ||
272 | childHide("event_mature_chk"); | ||
273 | } | ||
274 | |||
275 | mZoomTimer.stop(); | 275 | mZoomTimer.stop(); |
276 | 276 | ||
277 | return TRUE; | 277 | return TRUE; |
@@ -283,9 +283,9 @@ LLFloaterWorldMap::~LLFloaterWorldMap() | |||
283 | // All cleaned up by LLView destructor | 283 | // All cleaned up by LLView destructor |
284 | mTabs = NULL; | 284 | mTabs = NULL; |
285 | 285 | ||
286 | // Inventory deletes all observers on shutdown | 286 | // Inventory deletes all observers on shutdown |
287 | mInventory = NULL; | 287 | mInventory = NULL; |
288 | mInventoryObserver = NULL; | 288 | mInventoryObserver = NULL; |
289 | 289 | ||
290 | // avatar tracker will delete this for us. | 290 | // avatar tracker will delete this for us. |
291 | mFriendObserver = NULL; | 291 | mFriendObserver = NULL; |
@@ -452,6 +452,11 @@ void LLFloaterWorldMap::draw() | |||
452 | return; | 452 | return; |
453 | } | 453 | } |
454 | 454 | ||
455 | // Hide/Show Mature Events controls | ||
456 | childSetVisible("events_mature_icon", !gAgent.isTeen()); | ||
457 | childSetVisible("events_mature_label", !gAgent.isTeen()); | ||
458 | childSetVisible("event_mature_chk", !gAgent.isTeen()); | ||
459 | |||
455 | // On orientation island, users don't have a home location yet, so don't | 460 | // On orientation island, users don't have a home location yet, so don't |
456 | // let them teleport "home". It dumps them in an often-crowed welcome | 461 | // let them teleport "home". It dumps them in an often-crowed welcome |
457 | // area (infohub) and they get confused. JC | 462 | // area (infohub) and they get confused. JC |
@@ -508,7 +513,7 @@ void LLFloaterWorldMap::draw() | |||
508 | } | 513 | } |
509 | 514 | ||
510 | childSetEnabled("Teleport", (BOOL)tracking_status); | 515 | childSetEnabled("Teleport", (BOOL)tracking_status); |
511 | // childSetEnabled("Clear", (BOOL)tracking_status); | 516 | // childSetEnabled("Clear", (BOOL)tracking_status); |
512 | childSetEnabled("Show Destination", (BOOL)tracking_status || gWorldMap->mIsTrackingUnknownLocation); | 517 | childSetEnabled("Show Destination", (BOOL)tracking_status || gWorldMap->mIsTrackingUnknownLocation); |
513 | childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); | 518 | childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); |
514 | 519 | ||
@@ -594,7 +599,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) | |||
594 | if (combo) name = combo->getSimple(); | 599 | if (combo) name = combo->getSimple(); |
595 | mTrackedStatus = LLTracker::TRACKING_LANDMARK; | 600 | mTrackedStatus = LLTracker::TRACKING_LANDMARK; |
596 | LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID | 601 | LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ), // assetID |
597 | mLandmarkItemIDList.get( idx ), // itemID | 602 | mLandmarkItemIDList.get( idx ), // itemID |
598 | name); // name | 603 | name); // name |
599 | 604 | ||
600 | if( asset_id != sHomeID ) | 605 | if( asset_id != sHomeID ) |
@@ -604,7 +609,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) | |||
604 | } | 609 | } |
605 | 610 | ||
606 | // We have to download both region info and landmark data, so set busy. JC | 611 | // We have to download both region info and landmark data, so set busy. JC |
607 | // getWindow()->incBusyCount(); | 612 | // getWindow()->incBusyCount(); |
608 | } | 613 | } |
609 | else | 614 | else |
610 | { | 615 | { |
@@ -712,8 +717,7 @@ void LLFloaterWorldMap::updateLocation() | |||
712 | childSetValue("spin z", LLSD(agent_z) ); | 717 | childSetValue("spin z", LLSD(agent_z) ); |
713 | 718 | ||
714 | // Set the current SLURL | 719 | // Set the current SLURL |
715 | mSLURL = LLWeb::escapeURL( llformat("http://slurl.com/secondlife/%s/%d/%d/%d", | 720 | mSLURL = LLURLDispatcher::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z); |
716 | agent_sim_name.c_str(), agent_x, agent_y, agent_z) ); | ||
717 | } | 721 | } |
718 | } | 722 | } |
719 | 723 | ||
@@ -750,8 +754,7 @@ void LLFloaterWorldMap::updateLocation() | |||
750 | // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL | 754 | // simNameFromPosGlobal can fail, so don't give the user an invalid SLURL |
751 | if ( gotSimName ) | 755 | if ( gotSimName ) |
752 | { | 756 | { |
753 | mSLURL = LLWeb::escapeURL(llformat("http://slurl.com/secondlife/%s/%d/%d/%d", | 757 | mSLURL = LLURLDispatcher::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); |
754 | sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]))); | ||
755 | } | 758 | } |
756 | else | 759 | else |
757 | { // Empty SLURL will disable the "Copy SLURL to clipboard" button | 760 | { // Empty SLURL will disable the "Copy SLURL to clipboard" button |
@@ -1001,7 +1004,7 @@ void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui) | |||
1001 | void LLFloaterWorldMap::adjustZoomSliderBounds() | 1004 | void LLFloaterWorldMap::adjustZoomSliderBounds() |
1002 | { | 1005 | { |
1003 | // World size in regions | 1006 | // World size in regions |
1004 | S32 world_width_regions = gWorldMap->getWorldWidth() / REGION_WIDTH_UNITS; | 1007 | S32 world_width_regions = gWorldMap->getWorldWidth() / REGION_WIDTH_UNITS; |
1005 | S32 world_height_regions = gWorldMap->getWorldHeight() / REGION_WIDTH_UNITS; | 1008 | S32 world_height_regions = gWorldMap->getWorldHeight() / REGION_WIDTH_UNITS; |
1006 | 1009 | ||
1007 | // Pad the world size a little bit, so we have a nice border on | 1010 | // Pad the world size a little bit, so we have a nice border on |
@@ -1045,7 +1048,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() | |||
1045 | // static | 1048 | // static |
1046 | void LLFloaterWorldMap::onPanBtn( void* userdata ) | 1049 | void LLFloaterWorldMap::onPanBtn( void* userdata ) |
1047 | { | 1050 | { |
1048 | if( !gFloaterWorldMap ) return; | 1051 | if( !gFloaterWorldMap ) return; |
1049 | 1052 | ||
1050 | EPanDirection direction = (EPanDirection)(intptr_t)userdata; | 1053 | EPanDirection direction = (EPanDirection)(intptr_t)userdata; |
1051 | 1054 | ||
@@ -1056,7 +1059,7 @@ void LLFloaterWorldMap::onPanBtn( void* userdata ) | |||
1056 | case PAN_UP: pan_y = -1; break; | 1059 | case PAN_UP: pan_y = -1; break; |
1057 | case PAN_DOWN: pan_y = 1; break; | 1060 | case PAN_DOWN: pan_y = 1; break; |
1058 | case PAN_LEFT: pan_x = 1; break; | 1061 | case PAN_LEFT: pan_x = 1; break; |
1059 | case PAN_RIGHT: pan_x = -1; break; | 1062 | case PAN_RIGHT: pan_x = -1; break; |
1060 | default: llassert(0); return; | 1063 | default: llassert(0); return; |
1061 | } | 1064 | } |
1062 | 1065 | ||
@@ -1096,6 +1099,21 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( LLUICtrl* ctrl, void* userdat | |||
1096 | 1099 | ||
1097 | } | 1100 | } |
1098 | 1101 | ||
1102 | void LLFloaterWorldMap::onComboTextEntry( LLLineEditor* ctrl, void* userdata ) | ||
1103 | { | ||
1104 | // Reset the tracking whenever we start typing into any of the search fields, | ||
1105 | // so that hitting <enter> does an auto-complete versus teleporting us to the | ||
1106 | // previously selected landmark/friend. | ||
1107 | LLTracker::clearFocus(); | ||
1108 | } | ||
1109 | |||
1110 | // static | ||
1111 | void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl, void* userdata ) | ||
1112 | { | ||
1113 | onComboTextEntry(ctrl, userdata); | ||
1114 | updateSearchEnabled(ctrl, userdata); | ||
1115 | } | ||
1116 | |||
1099 | // static | 1117 | // static |
1100 | void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) | 1118 | void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) |
1101 | { | 1119 | { |
@@ -1200,6 +1218,12 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) | |||
1200 | } | 1218 | } |
1201 | } | 1219 | } |
1202 | 1220 | ||
1221 | //static | ||
1222 | void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus, void* userdata ) | ||
1223 | { | ||
1224 | updateSearchEnabled((LLUICtrl*)focus, userdata); | ||
1225 | } | ||
1226 | |||
1203 | // static | 1227 | // static |
1204 | void LLFloaterWorldMap::updateSearchEnabled( LLUICtrl* ctrl, void* userdata ) | 1228 | void LLFloaterWorldMap::updateSearchEnabled( LLUICtrl* ctrl, void* userdata ) |
1205 | { | 1229 | { |
@@ -1261,7 +1285,7 @@ void LLFloaterWorldMap::onClearBtn(void* data) | |||
1261 | self->mTrackedStatus = LLTracker::TRACKING_NOTHING; | 1285 | self->mTrackedStatus = LLTracker::TRACKING_NOTHING; |
1262 | LLTracker::stopTracking((void *)(intptr_t)TRUE); | 1286 | LLTracker::stopTracking((void *)(intptr_t)TRUE); |
1263 | gWorldMap->mIsTrackingUnknownLocation = FALSE; | 1287 | gWorldMap->mIsTrackingUnknownLocation = FALSE; |
1264 | self->mSLURL = ""; // Clear the SLURL since it's invalid | 1288 | self->mSLURL = ""; // Clear the SLURL since it's invalid |
1265 | self->mSetToUserPosition = TRUE; // Revert back to the current user position | 1289 | self->mSetToUserPosition = TRUE; // Revert back to the current user position |
1266 | } | 1290 | } |
1267 | 1291 | ||
@@ -1330,7 +1354,7 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate) | |||
1330 | else | 1354 | else |
1331 | { | 1355 | { |
1332 | // We've got the position finally, so we're no longer busy. JC | 1356 | // We've got the position finally, so we're no longer busy. JC |
1333 | // getWindow()->decBusyCount(); | 1357 | // getWindow()->decBusyCount(); |
1334 | pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal(); | 1358 | pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal(); |
1335 | } | 1359 | } |
1336 | } | 1360 | } |
@@ -1542,11 +1566,11 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) | |||
1542 | return; | 1566 | return; |
1543 | } | 1567 | } |
1544 | 1568 | ||
1545 | LLCtrlListInterface *list = childGetListInterface("search_results"); | 1569 | LLScrollListCtrl *list = gUICtrlFactory->getScrollListByName(this, "search_results"); |
1546 | if (!list) return; | 1570 | if (!list) return; |
1547 | list->operateOnAll(LLCtrlListInterface::OP_DELETE); | 1571 | list->operateOnAll(LLCtrlListInterface::OP_DELETE); |
1548 | 1572 | ||
1549 | LLSD selected_value = list->getSimpleSelectedValue(); | 1573 | LLSD selected_value = list->getSelectedValue(); |
1550 | 1574 | ||
1551 | S32 name_length = mCompletingRegionName.length(); | 1575 | S32 name_length = mCompletingRegionName.length(); |
1552 | 1576 | ||
@@ -1601,7 +1625,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) | |||
1601 | } | 1625 | } |
1602 | else | 1626 | else |
1603 | { | 1627 | { |
1604 | list->addSimpleElement("None found."); | 1628 | list->addCommentText("None found."); |
1605 | list->operateOnAll(LLCtrlListInterface::OP_DESELECT); | 1629 | list->operateOnAll(LLCtrlListInterface::OP_DESELECT); |
1606 | } | 1630 | } |
1607 | } | 1631 | } |
@@ -1632,7 +1656,7 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) | |||
1632 | LLCtrlListInterface *list = self->childGetListInterface("search_results"); | 1656 | LLCtrlListInterface *list = self->childGetListInterface("search_results"); |
1633 | if (!list) return; | 1657 | if (!list) return; |
1634 | 1658 | ||
1635 | LLSD selected_value = list->getSimpleSelectedValue(); | 1659 | LLSD selected_value = list->getSelectedValue(); |
1636 | LLString sim_name = selected_value.asString(); | 1660 | LLString sim_name = selected_value.asString(); |
1637 | if (sim_name.empty()) | 1661 | if (sim_name.empty()) |
1638 | { | 1662 | { |