diff options
Diffstat (limited to 'linden/indra/newview/llfloaterworldmap.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterworldmap.cpp | 157 |
1 files changed, 154 insertions, 3 deletions
diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp index a31dde5..5399867 100644 --- a/linden/indra/newview/llfloaterworldmap.cpp +++ b/linden/indra/newview/llfloaterworldmap.cpp | |||
@@ -68,6 +68,12 @@ | |||
68 | #include "llappviewer.h" | 68 | #include "llappviewer.h" |
69 | #include "llmapimagetype.h" | 69 | #include "llmapimagetype.h" |
70 | #include "llweb.h" | 70 | #include "llweb.h" |
71 | #include "floaterlogin.h" | ||
72 | #include "llstartup.h" | ||
73 | #include "hippoGridManager.h" | ||
74 | #include "floaterlogin.h" | ||
75 | #include "llpanellogin.h" | ||
76 | |||
71 | 77 | ||
72 | #include "llglheaders.h" | 78 | #include "llglheaders.h" |
73 | 79 | ||
@@ -237,6 +243,10 @@ BOOL LLFloaterWorldMap::postBuild() | |||
237 | landmark_combo->setTextEntryCallback( onComboTextEntry ); | 243 | landmark_combo->setTextEntryCallback( onComboTextEntry ); |
238 | } | 244 | } |
239 | 245 | ||
246 | childSetCommitCallback("grid_combo", onSelectServer, this); | ||
247 | |||
248 | childSetAction("Grid Manager", onGridManager, this); | ||
249 | |||
240 | childSetAction("Go Home", onGoHome, this); | 250 | childSetAction("Go Home", onGoHome, this); |
241 | 251 | ||
242 | childSetAction("Teleport", onClickTeleportBtn, this); | 252 | childSetAction("Teleport", onClickTeleportBtn, this); |
@@ -334,6 +344,8 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target) | |||
334 | 344 | ||
335 | // If nothing is being tracked, set flag so the user position will be found | 345 | // If nothing is being tracked, set flag so the user position will be found |
336 | gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); | 346 | gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); |
347 | |||
348 | LLFloaterWorldMap::addServer(gHippoGridManager->getDefaultGridNick()); | ||
337 | } | 349 | } |
338 | 350 | ||
339 | if (center_on_target) | 351 | if (center_on_target) |
@@ -378,6 +390,48 @@ void LLFloaterWorldMap::hide(void*) | |||
378 | } | 390 | } |
379 | 391 | ||
380 | 392 | ||
393 | // static | ||
394 | void LLFloaterWorldMap::addServer(const std::string& server) | ||
395 | { | ||
396 | const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick(); | ||
397 | |||
398 | LLCtrlListInterface *grids = gFloaterWorldMap->childGetListInterface("grid_combo"); | ||
399 | if (!grids) return; | ||
400 | |||
401 | // Delete all but the "None" entry | ||
402 | S32 list_size = grids->getItemCount(); | ||
403 | while (list_size > 1) | ||
404 | { | ||
405 | grids->selectNthItem(1); | ||
406 | grids->operateOnSelection(LLCtrlListInterface::OP_DELETE); | ||
407 | --list_size; | ||
408 | } | ||
409 | |||
410 | |||
411 | //LLComboBox *grids = gFloaterWorldMap->getChild<LLComboBox>("grid_combo"); | ||
412 | S32 selectIndex = -1, i = 0; | ||
413 | //grids->removeall(); | ||
414 | if (defaultGrid != "") { | ||
415 | grids->addSimpleElement(defaultGrid); | ||
416 | selectIndex = i++; | ||
417 | } | ||
418 | HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); | ||
419 | for (it = gHippoGridManager->beginGrid(); it != end; ++it) { | ||
420 | const std::string &grid = it->second->getGridNick(); | ||
421 | if (grid != defaultGrid) { | ||
422 | grids->addSimpleElement(grid); | ||
423 | //if (grid == mCurGrid) selectIndex = i; | ||
424 | i++; | ||
425 | } | ||
426 | } | ||
427 | grids->selectFirstItem(); | ||
428 | //grids->setCurrentByIndex(0); | ||
429 | |||
430 | //LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); | ||
431 | //combo->add(server, LLSD(domain_name) ); | ||
432 | //combo->setCurrentByIndex(0); | ||
433 | } | ||
434 | |||
381 | // virtual | 435 | // virtual |
382 | void LLFloaterWorldMap::setVisible( BOOL visible ) | 436 | void LLFloaterWorldMap::setVisible( BOOL visible ) |
383 | { | 437 | { |
@@ -450,7 +504,10 @@ void LLFloaterWorldMap::draw() | |||
450 | childSetEnabled("Go Home", enable_go_home); | 504 | childSetEnabled("Go Home", enable_go_home); |
451 | 505 | ||
452 | updateLocation(); | 506 | updateLocation(); |
453 | 507 | ||
508 | LLComboBox *grid_combo = getChild<LLComboBox>("grid_combo"); | ||
509 | std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick(); | ||
510 | |||
454 | LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); | 511 | LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); |
455 | if (LLTracker::TRACKING_AVATAR == tracking_status) | 512 | if (LLTracker::TRACKING_AVATAR == tracking_status) |
456 | { | 513 | { |
@@ -496,7 +553,19 @@ void LLFloaterWorldMap::draw() | |||
496 | centerOnTarget(TRUE); | 553 | centerOnTarget(TRUE); |
497 | } | 554 | } |
498 | 555 | ||
499 | childSetEnabled("Teleport", (BOOL)tracking_status); | 556 | //GRID MANAGER |
557 | if (grid_combo->getSelectedValue().asString() != "None") | ||
558 | { | ||
559 | childSetEnabled("Teleport", TRUE); | ||
560 | childSetColor("grid_icon", gTrackColor); | ||
561 | } | ||
562 | else | ||
563 | { | ||
564 | childSetEnabled("Teleport", (BOOL)tracking_status); | ||
565 | childSetColor("grid_icon", gDisabledTrackColor); | ||
566 | } | ||
567 | //END GRID MANAGER | ||
568 | |||
500 | // childSetEnabled("Clear", (BOOL)tracking_status); | 569 | // childSetEnabled("Clear", (BOOL)tracking_status); |
501 | childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation); | 570 | childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation); |
502 | childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); | 571 | childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); |
@@ -769,7 +838,7 @@ void LLFloaterWorldMap::updateLocation() | |||
769 | void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord) | 838 | void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord) |
770 | { | 839 | { |
771 | LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name); | 840 | LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name); |
772 | z_coord = llclamp(z_coord, 0, 4096); | 841 | z_coord = llclamp(z_coord, 0, 1000); |
773 | if (sim_info) | 842 | if (sim_info) |
774 | { | 843 | { |
775 | LLVector3 local_pos; | 844 | LLVector3 local_pos; |
@@ -979,6 +1048,18 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui) | |||
979 | } | 1048 | } |
980 | 1049 | ||
981 | 1050 | ||
1051 | void LLFloaterWorldMap::clearGridSelection(BOOL clear_ui) | ||
1052 | { | ||
1053 | if (clear_ui || !childHasKeyboardFocus("grid_combo")) | ||
1054 | { | ||
1055 | LLCtrlListInterface *list = childGetListInterface("grid_combo"); | ||
1056 | if (list) | ||
1057 | { | ||
1058 | list->selectByValue( "None" ); | ||
1059 | } | ||
1060 | } | ||
1061 | } | ||
1062 | |||
982 | void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) | 1063 | void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) |
983 | { | 1064 | { |
984 | if (clear_ui || !childHasKeyboardFocus("landmark combo")) | 1065 | if (clear_ui || !childHasKeyboardFocus("landmark combo")) |
@@ -1076,9 +1157,18 @@ void LLFloaterWorldMap::onPanBtn( void* userdata ) | |||
1076 | } | 1157 | } |
1077 | 1158 | ||
1078 | // static | 1159 | // static |
1160 | void LLFloaterWorldMap::onGridManager(void*) | ||
1161 | { | ||
1162 | LoginFloater::newShow(std::string("Test"), false); | ||
1163 | //gAgent.teleportHome(); | ||
1164 | //gFloaterWorldMap->close(); | ||
1165 | } | ||
1166 | |||
1167 | // static | ||
1079 | void LLFloaterWorldMap::onGoHome(void*) | 1168 | void LLFloaterWorldMap::onGoHome(void*) |
1080 | { | 1169 | { |
1081 | gAgent.teleportHomeConfirm(); | 1170 | gAgent.teleportHomeConfirm(); |
1171 | gFloaterWorldMap->close(); | ||
1082 | } | 1172 | } |
1083 | 1173 | ||
1084 | 1174 | ||
@@ -1161,6 +1251,9 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata ) | |||
1161 | item_id.setNull(); | 1251 | item_id.setNull(); |
1162 | } | 1252 | } |
1163 | } | 1253 | } |
1254 | //GRID MANAGER HAX | ||
1255 | self->clearGridSelection(TRUE); | ||
1256 | //END GRID MANAGER HAX | ||
1164 | 1257 | ||
1165 | self->trackLandmark( item_id); | 1258 | self->trackLandmark( item_id); |
1166 | onShowTargetBtn(self); | 1259 | onShowTargetBtn(self); |
@@ -1212,6 +1305,10 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata ) | |||
1212 | const LLUUID& new_avatar_id = list->getCurrentID(); | 1305 | const LLUUID& new_avatar_id = list->getCurrentID(); |
1213 | if (new_avatar_id.notNull()) | 1306 | if (new_avatar_id.notNull()) |
1214 | { | 1307 | { |
1308 | //GRID MANAGER HAX | ||
1309 | self->clearGridSelection(TRUE); | ||
1310 | //END GRID MANAGER HAX | ||
1311 | |||
1215 | std::string name; | 1312 | std::string name; |
1216 | LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); | 1313 | LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); |
1217 | if (combo) name = combo->getSimple(); | 1314 | if (combo) name = combo->getSimple(); |
@@ -1293,6 +1390,10 @@ void LLFloaterWorldMap::onClearBtn(void* data) | |||
1293 | LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; | 1390 | LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; |
1294 | self->mSLURL = ""; // Clear the SLURL since it's invalid | 1391 | self->mSLURL = ""; // Clear the SLURL since it's invalid |
1295 | self->mSetToUserPosition = TRUE; // Revert back to the current user position | 1392 | self->mSetToUserPosition = TRUE; // Revert back to the current user position |
1393 | //KOW TODO clear grid combo red ring, clear grid combo. | ||
1394 | //GRID MANAGER HAX | ||
1395 | self->clearGridSelection(TRUE); | ||
1396 | //END GRID MANAGER HAX | ||
1296 | } | 1397 | } |
1297 | 1398 | ||
1298 | // static | 1399 | // static |
@@ -1402,6 +1503,39 @@ void LLFloaterWorldMap::fly() | |||
1402 | // protected | 1503 | // protected |
1403 | void LLFloaterWorldMap::teleport() | 1504 | void LLFloaterWorldMap::teleport() |
1404 | { | 1505 | { |
1506 | //BEGIN CROSS GRIP TP// | ||
1507 | LLComboBox *grid_combo = getChild<LLComboBox>("grid_combo"); | ||
1508 | std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick(); | ||
1509 | |||
1510 | // BUG: the client crashes if fed an invalid grid through this interface, which shouldn't happen | ||
1511 | if(//grid_combo && grid_combo->getSelectedValue().asString() != current_grid || gSavedSettings.getBOOL("CmdLineLoginURI") && | ||
1512 | grid_combo->getSelectedValue().asString() != "None" && | ||
1513 | !grid_combo->getSelectedValue().asString().empty()) | ||
1514 | { | ||
1515 | HippoGridInfo *gridInfo = gHippoGridManager->getGrid(grid_combo->getSelectedValue().asString()); | ||
1516 | //DEBUG | ||
1517 | |||
1518 | llwarns << "tp button current grid = " << grid_combo->getSelectedValue().asString() << llendl; | ||
1519 | std::string firstName = gridInfo->getFirstName(); | ||
1520 | std::string lastName = gridInfo->getLastName(); | ||
1521 | std::string loginPassword = gridInfo->getAvatarPassword(); | ||
1522 | |||
1523 | if(!firstName.empty() && !lastName.empty()) | ||
1524 | { | ||
1525 | gLoginHandler.mFirstName = firstName; | ||
1526 | gLoginHandler.mLastName = lastName; | ||
1527 | gLoginHandler.mPassword = loginPassword; | ||
1528 | } | ||
1529 | |||
1530 | gHippoGridManager->setCurrentGrid(gridInfo->getGridNick()); | ||
1531 | //gHippoGridManager->setDefaultGrid(gridInfo->getGridNick()); | ||
1532 | //this doesn't work :( gSavedSettings.setBOOL("CmdLineLoginURI", FALSE); | ||
1533 | LLStartUp::setShouldAutoLogin(true); | ||
1534 | LLAppViewer::instance()->requestLogout(false); | ||
1535 | return; | ||
1536 | } | ||
1537 | //END CROSS GRID TP// | ||
1538 | |||
1405 | BOOL teleport_home = FALSE; | 1539 | BOOL teleport_home = FALSE; |
1406 | LLVector3d pos_global; | 1540 | LLVector3d pos_global; |
1407 | LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); | 1541 | LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); |
@@ -1692,3 +1826,20 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) | |||
1692 | 1826 | ||
1693 | onShowTargetBtn(self); | 1827 | onShowTargetBtn(self); |
1694 | } | 1828 | } |
1829 | |||
1830 | // static | ||
1831 | void LLFloaterWorldMap::onSelectServer(LLUICtrl* ctrl, void* userdata) | ||
1832 | { | ||
1833 | //GRID MANAGER COMBO BOX CLICKED// | ||
1834 | llwarns << "onSelectServer called" << llendl; | ||
1835 | //snip from onClearBtn (bless this mess) | ||
1836 | LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata; | ||
1837 | self->mTrackedStatus = LLTracker::TRACKING_NOTHING; | ||
1838 | LLTracker::stopTracking((void *)(intptr_t)TRUE); | ||
1839 | //LLTracker::stopTracking(NULL); | ||
1840 | LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; | ||
1841 | self->mSLURL = ""; // Clear the SLURL since it's invalid | ||
1842 | self->mSetToUserPosition = TRUE; // Revert back to the current user position | ||
1843 | |||
1844 | self->setDefaultBtn("Teleport"); | ||
1845 | } | ||