aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterworldmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llfloaterworldmap.cpp')
-rw-r--r--linden/indra/newview/llfloaterworldmap.cpp157
1 files changed, 154 insertions, 3 deletions
diff --git a/linden/indra/newview/llfloaterworldmap.cpp b/linden/indra/newview/llfloaterworldmap.cpp
index bc61d8a..b235265 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);
@@ -327,6 +337,8 @@ void LLFloaterWorldMap::show(void*, BOOL center_on_target)
327 337
328 // If nothing is being tracked, set flag so the user position will be found 338 // If nothing is being tracked, set flag so the user position will be found
329 gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING ); 339 gFloaterWorldMap->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
340
341 LLFloaterWorldMap::addServer(gHippoGridManager->getDefaultGridNick());
330 } 342 }
331 343
332 if (center_on_target) 344 if (center_on_target)
@@ -371,6 +383,48 @@ void LLFloaterWorldMap::hide(void*)
371} 383}
372 384
373 385
386// static
387void LLFloaterWorldMap::addServer(const std::string& server)
388{
389 const std::string &defaultGrid = gHippoGridManager->getDefaultGridNick();
390
391 LLCtrlListInterface *grids = gFloaterWorldMap->childGetListInterface("grid_combo");
392 if (!grids) return;
393
394 // Delete all but the "None" entry
395 S32 list_size = grids->getItemCount();
396 while (list_size > 1)
397 {
398 grids->selectNthItem(1);
399 grids->operateOnSelection(LLCtrlListInterface::OP_DELETE);
400 --list_size;
401 }
402
403
404 //LLComboBox *grids = gFloaterWorldMap->getChild<LLComboBox>("grid_combo");
405 S32 selectIndex = -1, i = 0;
406 //grids->removeall();
407 if (defaultGrid != "") {
408 grids->addSimpleElement(defaultGrid);
409 selectIndex = i++;
410 }
411 HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid();
412 for (it = gHippoGridManager->beginGrid(); it != end; ++it) {
413 const std::string &grid = it->second->getGridNick();
414 if (grid != defaultGrid) {
415 grids->addSimpleElement(grid);
416 //if (grid == mCurGrid) selectIndex = i;
417 i++;
418 }
419 }
420 grids->selectFirstItem();
421 //grids->setCurrentByIndex(0);
422
423 //LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
424 //combo->add(server, LLSD(domain_name) );
425 //combo->setCurrentByIndex(0);
426}
427
374// virtual 428// virtual
375void LLFloaterWorldMap::setVisible( BOOL visible ) 429void LLFloaterWorldMap::setVisible( BOOL visible )
376{ 430{
@@ -443,7 +497,10 @@ void LLFloaterWorldMap::draw()
443 childSetEnabled("Go Home", enable_go_home); 497 childSetEnabled("Go Home", enable_go_home);
444 498
445 updateLocation(); 499 updateLocation();
446 500
501 LLComboBox *grid_combo = getChild<LLComboBox>("grid_combo");
502 std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick();
503
447 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); 504 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
448 if (LLTracker::TRACKING_AVATAR == tracking_status) 505 if (LLTracker::TRACKING_AVATAR == tracking_status)
449 { 506 {
@@ -489,7 +546,19 @@ void LLFloaterWorldMap::draw()
489 centerOnTarget(TRUE); 546 centerOnTarget(TRUE);
490 } 547 }
491 548
492 childSetEnabled("Teleport", (BOOL)tracking_status); 549 //GRID MANAGER
550 if (grid_combo->getSelectedValue().asString() != "None")
551 {
552 childSetEnabled("Teleport", TRUE);
553 childSetColor("grid_icon", gTrackColor);
554 }
555 else
556 {
557 childSetEnabled("Teleport", (BOOL)tracking_status);
558 childSetColor("grid_icon", gDisabledTrackColor);
559 }
560 //END GRID MANAGER
561
493// childSetEnabled("Clear", (BOOL)tracking_status); 562// childSetEnabled("Clear", (BOOL)tracking_status);
494 childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation); 563 childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation);
495 childSetEnabled("copy_slurl", (mSLURL.size() > 0) ); 564 childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
@@ -743,7 +812,7 @@ void LLFloaterWorldMap::updateLocation()
743void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord) 812void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S32 y_coord, S32 z_coord)
744{ 813{
745 LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name); 814 LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromName(region_name);
746 z_coord = llclamp(z_coord, 0, 4096); 815 z_coord = llclamp(z_coord, 0, 1000);
747 if (sim_info) 816 if (sim_info)
748 { 817 {
749 LLVector3 local_pos; 818 LLVector3 local_pos;
@@ -953,6 +1022,18 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui)
953} 1022}
954 1023
955 1024
1025void LLFloaterWorldMap::clearGridSelection(BOOL clear_ui)
1026{
1027 if (clear_ui || !childHasKeyboardFocus("grid_combo"))
1028 {
1029 LLCtrlListInterface *list = childGetListInterface("grid_combo");
1030 if (list)
1031 {
1032 list->selectByValue( "None" );
1033 }
1034 }
1035}
1036
956void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui) 1037void LLFloaterWorldMap::clearLandmarkSelection(BOOL clear_ui)
957{ 1038{
958 if (clear_ui || !childHasKeyboardFocus("landmark combo")) 1039 if (clear_ui || !childHasKeyboardFocus("landmark combo"))
@@ -1050,9 +1131,18 @@ void LLFloaterWorldMap::onPanBtn( void* userdata )
1050} 1131}
1051 1132
1052// static 1133// static
1134void LLFloaterWorldMap::onGridManager(void*)
1135{
1136 LoginFloater::newShow(std::string("Test"), false, LoginFloater::testCallback, NULL);
1137 //gAgent.teleportHome();
1138 //gFloaterWorldMap->close();
1139}
1140
1141// static
1053void LLFloaterWorldMap::onGoHome(void*) 1142void LLFloaterWorldMap::onGoHome(void*)
1054{ 1143{
1055 gAgent.teleportHomeConfirm(); 1144 gAgent.teleportHomeConfirm();
1145 gFloaterWorldMap->close();
1056} 1146}
1057 1147
1058 1148
@@ -1135,6 +1225,9 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata )
1135 item_id.setNull(); 1225 item_id.setNull();
1136 } 1226 }
1137 } 1227 }
1228 //GRID MANAGER HAX
1229 self->clearGridSelection(TRUE);
1230 //END GRID MANAGER HAX
1138 1231
1139 self->trackLandmark( item_id); 1232 self->trackLandmark( item_id);
1140 onShowTargetBtn(self); 1233 onShowTargetBtn(self);
@@ -1186,6 +1279,10 @@ void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata )
1186 const LLUUID& new_avatar_id = list->getCurrentID(); 1279 const LLUUID& new_avatar_id = list->getCurrentID();
1187 if (new_avatar_id.notNull()) 1280 if (new_avatar_id.notNull())
1188 { 1281 {
1282 //GRID MANAGER HAX
1283 self->clearGridSelection(TRUE);
1284 //END GRID MANAGER HAX
1285
1189 std::string name; 1286 std::string name;
1190 LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo"); 1287 LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo");
1191 if (combo) name = combo->getSimple(); 1288 if (combo) name = combo->getSimple();
@@ -1267,6 +1364,10 @@ void LLFloaterWorldMap::onClearBtn(void* data)
1267 LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE; 1364 LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
1268 self->mSLURL = ""; // Clear the SLURL since it's invalid 1365 self->mSLURL = ""; // Clear the SLURL since it's invalid
1269 self->mSetToUserPosition = TRUE; // Revert back to the current user position 1366 self->mSetToUserPosition = TRUE; // Revert back to the current user position
1367 //KOW TODO clear grid combo red ring, clear grid combo.
1368 //GRID MANAGER HAX
1369 self->clearGridSelection(TRUE);
1370 //END GRID MANAGER HAX
1270} 1371}
1271 1372
1272// static 1373// static
@@ -1376,6 +1477,39 @@ void LLFloaterWorldMap::fly()
1376// protected 1477// protected
1377void LLFloaterWorldMap::teleport() 1478void LLFloaterWorldMap::teleport()
1378{ 1479{
1480 //BEGIN CROSS GRIP TP//
1481 LLComboBox *grid_combo = getChild<LLComboBox>("grid_combo");
1482 std::string current_grid = gHippoGridManager->getConnectedGrid()->getGridNick();
1483
1484 // BUG: the client crashes if fed an invalid grid through this interface, which shouldn't happen
1485 if(//grid_combo && grid_combo->getSelectedValue().asString() != current_grid || gSavedSettings.getBOOL("CmdLineLoginURI") &&
1486 grid_combo->getSelectedValue().asString() != "None" &&
1487 !grid_combo->getSelectedValue().asString().empty())
1488 {
1489 HippoGridInfo *gridInfo = gHippoGridManager->getGrid(grid_combo->getSelectedValue().asString());
1490 //DEBUG
1491
1492 llwarns << "tp button current grid = " << grid_combo->getSelectedValue().asString() << llendl;
1493 std::string firstName = gridInfo->getFirstName();
1494 std::string lastName = gridInfo->getLastName();
1495 std::string loginPassword = gridInfo->getAvatarPassword();
1496
1497 if(!firstName.empty() && !lastName.empty())
1498 {
1499 gLoginHandler.mFirstName = firstName;
1500 gLoginHandler.mLastName = lastName;
1501 gLoginHandler.mPassword = loginPassword;
1502 }
1503
1504 gHippoGridManager->setCurrentGrid(gridInfo->getGridNick());
1505 gHippoGridManager->setDefaultGrid(gridInfo->getGridNick());
1506 //this doesn't work :( gSavedSettings.setBOOL("CmdLineLoginURI", FALSE);
1507 LLStartUp::setShouldAutoLogin(true);
1508 LLAppViewer::instance()->requestLogout(false);
1509 return;
1510 }
1511 //END CROSS GRID TP//
1512
1379 BOOL teleport_home = FALSE; 1513 BOOL teleport_home = FALSE;
1380 LLVector3d pos_global; 1514 LLVector3d pos_global;
1381 LLAvatarTracker& av_tracker = LLAvatarTracker::instance(); 1515 LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
@@ -1666,3 +1800,20 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata)
1666 1800
1667 onShowTargetBtn(self); 1801 onShowTargetBtn(self);
1668} 1802}
1803
1804// static
1805void LLFloaterWorldMap::onSelectServer(LLUICtrl* ctrl, void* userdata)
1806{
1807 //GRID MANAGER COMBO BOX CLICKED//
1808 llwarns << "onSelectServer called" << llendl;
1809 //snip from onClearBtn (bless this mess)
1810 LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
1811 self->mTrackedStatus = LLTracker::TRACKING_NOTHING;
1812 LLTracker::stopTracking((void *)(intptr_t)TRUE);
1813 //LLTracker::stopTracking(NULL);
1814 LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
1815 self->mSLURL = ""; // Clear the SLURL since it's invalid
1816 self->mSetToUserPosition = TRUE; // Revert back to the current user position
1817
1818 self->setDefaultBtn("Teleport");
1819}