summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterworldmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterworldmap.cpp')
-rw-r--r--indra/newview/llfloaterworldmap.cpp806
1 files changed, 365 insertions, 441 deletions
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 251539088b..3afa31b873 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -3,31 +3,25 @@
* @author James Cook, Tom Yedwab
* @brief LLFloaterWorldMap class implementation
*
- * $LicenseInfo:firstyear=2003&license=viewergpl$
- *
- * Copyright (c) 2003-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,33 +35,44 @@
#include "llfloaterworldmap.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "llbutton.h"
#include "llcallingcard.h"
#include "llcombobox.h"
#include "llviewercontrol.h"
+#include "llcommandhandler.h"
#include "lldraghandle.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
#include "llfloaterreg.h" // getTypedInstance()
#include "llfocusmgr.h"
+#include "llinventoryfunctions.h"
+#include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
+#include "llinventoryobserver.h"
#include "lllandmarklist.h"
-#include "lllineeditor.h"
-#include "llpreviewlandmark.h"
+#include "llsearcheditor.h"
+#include "llnotificationsutil.h"
#include "llregionhandle.h"
#include "llscrolllistctrl.h"
#include "llslurl.h"
#include "lltextbox.h"
#include "lltracker.h"
+#include "lltrans.h"
+#include "llviewerinventory.h" // LLViewerInventoryItem
#include "llviewermenu.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
+#include "llviewertexture.h"
#include "llworldmap.h"
+#include "llworldmapmessage.h"
#include "llworldmapview.h"
#include "lluictrlfactory.h"
#include "llappviewer.h"
#include "llmapimagetype.h"
#include "llweb.h"
+#include "llslider.h"
+#include "message.h"
-#include "llglheaders.h"
#include "llwindow.h" // copyTextToClipboard()
//---------------------------------------------------------------------------
@@ -75,6 +80,12 @@
//---------------------------------------------------------------------------
static const F32 MAP_ZOOM_TIME = 0.2f;
+// Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
+// width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
+// sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
+// Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
+static const S32 MAX_VISIBLE_REGIONS = 512;
+
enum EPanDirection
{
PAN_UP,
@@ -86,12 +97,42 @@ enum EPanDirection
// Values in pixels per region
static const F32 ZOOM_MAX = 128.f;
-static const F32 SIM_COORD_DEFAULT = 128.f;
-
//---------------------------------------------------------------------------
// Globals
//---------------------------------------------------------------------------
+// handle secondlife:///app/worldmap/{NAME}/{COORDS} URLs
+class LLWorldMapHandler : public LLCommandHandler
+{
+public:
+ // requires trusted browser to trigger
+ LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_THROTTLE) { }
+
+ bool handle(const LLSD& params, const LLSD& query_map,
+ LLMediaCtrl* web)
+ {
+ if (params.size() == 0)
+ {
+ // support the secondlife:///app/worldmap SLapp
+ LLFloaterReg::showInstance("world_map", "center");
+ return true;
+ }
+
+ // support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
+ const std::string region_name = LLURI::unescape(params[0].asString());
+ S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
+ S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
+ S32 z = (params.size() > 3) ? params[3].asInteger() : 0;
+
+ LLFloaterWorldMap::getInstance()->trackURL(region_name, x, y, z);
+ LLFloaterReg::showInstance("world_map", "center");
+
+ return true;
+ }
+};
+LLWorldMapHandler gWorldMapHandler;
+
+
LLFloaterWorldMap* gFloaterWorldMap = NULL;
class LLMapInventoryObserver : public LLInventoryObserver
@@ -146,9 +187,9 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
mInventory(NULL),
mInventoryObserver(NULL),
mFriendObserver(NULL),
- mCompletingRegionName(""),
+ mCompletingRegionName(),
+ mCompletingRegionPos(),
mWaitingForTracker(FALSE),
- mExactMatch(FALSE),
mIsClosing(FALSE),
mSetToUserPosition(TRUE),
mTrackedLocation(0,0,0),
@@ -157,9 +198,21 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
gFloaterWorldMap = this;
mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL);
- mFactoryMap["terrain_mapview"] = LLCallbackMap(createWorldMapView, NULL);
//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", FALSE);
+ mCommitCallbackRegistrar.add("WMap.Coordinates", boost::bind(&LLFloaterWorldMap::onCoordinatesCommit, this));
+ mCommitCallbackRegistrar.add("WMap.Location", boost::bind(&LLFloaterWorldMap::onLocationCommit, this));
+ mCommitCallbackRegistrar.add("WMap.AvatarCombo", boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this));
+ mCommitCallbackRegistrar.add("WMap.Landmark", boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this));
+ mCommitCallbackRegistrar.add("WMap.SearchResult", boost::bind(&LLFloaterWorldMap::onCommitSearchResult, this));
+ mCommitCallbackRegistrar.add("WMap.GoHome", boost::bind(&LLFloaterWorldMap::onGoHome, this));
+ mCommitCallbackRegistrar.add("WMap.Teleport", boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
+ mCommitCallbackRegistrar.add("WMap.ShowTarget", boost::bind(&LLFloaterWorldMap::onShowTargetBtn, this));
+ mCommitCallbackRegistrar.add("WMap.ShowAgent", boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this));
+ mCommitCallbackRegistrar.add("WMap.Clear", boost::bind(&LLFloaterWorldMap::onClearBtn, this));
+ mCommitCallbackRegistrar.add("WMap.CopySLURL", boost::bind(&LLFloaterWorldMap::onCopySLURL, this));
+
+ gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this));
}
// static
@@ -170,70 +223,33 @@ void* LLFloaterWorldMap::createWorldMapView(void* data)
BOOL LLFloaterWorldMap::postBuild()
{
- mTabs = getChild<LLTabContainer>("maptab");
- if (!mTabs) return FALSE;
-
- mTabs->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCommitBackground, this));
-
- // The following callback syncs the worlmap tabs with the images.
- // Commented out since it was crashing when LLWorldMap became a singleton.
- // We should be fine without it but override the onOpen method and put it
- // there if it turns out to be needed. -MG
- //
- //onCommitBackground();
-
- childSetCommitCallback("friend combo", onAvatarComboCommit, this);
+ mPanel = getChild<LLPanel>("objects_mapview");
LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
- if (avatar_combo)
- {
- avatar_combo->selectFirstItem();
- avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
- avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- }
-
- childSetAction("DoSearch", onLocationCommit, this);
-
- getChild<LLScrollListCtrl>("location")->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
+ avatar_combo->selectFirstItem();
+ avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
+ avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- LLLineEditor *location_editor = getChild<LLLineEditor>("location");
- if (location_editor)
- {
- location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this, _1), NULL );
- }
+ LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
+ location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
+ location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
- childSetCommitCallback("search_results", onCommitSearchResult, this);
- getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback(onClickTeleportBtn, this);
- childSetCommitCallback("spin x", onCommitLocation, this);
- childSetCommitCallback("spin y", onCommitLocation, this);
- childSetCommitCallback("spin z", onCommitLocation, this);
-
- childSetCommitCallback("landmark combo", onLandmarkComboCommit, this);
+ getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
- if (landmark_combo)
- {
- landmark_combo->selectFirstItem();
- landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
- landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- }
-
- childSetAction("Go Home", onGoHome, this);
-
- childSetAction("Teleport", onClickTeleportBtn, this);
-
- childSetAction("Show Destination", onShowTargetBtn, this);
- childSetAction("Show My Location", onShowAgentBtn, this);
- childSetAction("Clear", onClearBtn, this);
- childSetAction("copy_slurl", onCopySLURL, this);
+ landmark_combo->selectFirstItem();
+ landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
+ landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
- mCurZoomVal = log(gMapScale)/log(2.f);
- childSetValue("zoom slider", gMapScale);
+ mCurZoomVal = log(LLWorldMapView::sMapScale)/log(2.f);
+ getChild<LLUICtrl>("zoom slider")->setValue(LLWorldMapView::sMapScale);
setDefaultBtn(NULL);
mZoomTimer.stop();
+ onChangeMaturity();
+
return TRUE;
}
@@ -241,7 +257,7 @@ BOOL LLFloaterWorldMap::postBuild()
LLFloaterWorldMap::~LLFloaterWorldMap()
{
// All cleaned up by LLView destructor
- mTabs = NULL;
+ mPanel = NULL;
// Inventory deletes all observers on shutdown
mInventory = NULL;
@@ -264,16 +280,6 @@ void LLFloaterWorldMap::onClose(bool app_quitting)
{
// While we're not visible, discard the overlay images we're using
LLWorldMap::getInstance()->clearImageRefs();
-
-#if RELEASE_FOR_DOWNLOAD
- setVisible(FALSE);
-#else
- // Don't call destroy(), we need to delete this immediately
- delete this; // sets gFloaterWorldMap = NULL;
- // need to reconstruct gFloaterWorldMap so that code that assumes it exists doesn't crash
- LLFloaterReg::getInstance("world_map"); // constructs a LLFloaterWorldMap and sets gFloaterWorldMap
- gFloaterWorldMap->setVisible(FALSE); // hide it
-#endif
}
// virtual
@@ -284,7 +290,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
mIsClosing = FALSE;
LLWorldMapView* map_panel;
- map_panel = (LLWorldMapView*)mTabs->getCurrentPanel();
+ map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
map_panel->clearLastClick();
{
@@ -295,28 +301,21 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
}
map_panel->updateVisibleBlocks();
- // Reload the agent positions when we show the window
- LLWorldMap::getInstance()->eraseItems();
-
- // Reload any maps that may have changed
- LLWorldMap::getInstance()->clearSimFlags();
-
- const S32 panel_num = mTabs->getCurrentPanelIndex();
- const bool request_from_sim = true;
- LLWorldMap::getInstance()->setCurrentLayer(panel_num, request_from_sim);
+ // Reload items as they may have changed
+ LLWorldMap::getInstance()->reloadItems();
// We may already have a bounding box for the regions of the world,
// so use that to adjust the view.
adjustZoomSliderBounds();
// Could be first show
- LLFirstUse::useMap();
+ //LLFirstUse::useMap();
// Start speculative download of landmarks
- LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK);
- gInventory.startBackgroundFetch(landmark_folder_id);
+ const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
- childSetFocus("location", TRUE);
+ getChild<LLUICtrl>("location")->setFocus( TRUE);
gFocusMgr.triggerFocusFlash();
buildAvatarIDList();
@@ -332,17 +331,12 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
}
}
-
-
// static
void LLFloaterWorldMap::reloadIcons(void*)
{
- LLWorldMap::getInstance()->eraseItems();
-
- LLWorldMap::getInstance()->sendMapLayerRequest();
+ LLWorldMap::getInstance()->reloadItems();
}
-
// virtual
BOOL LLFloaterWorldMap::handleHover(S32 x, S32 y, MASK mask)
{
@@ -355,13 +349,11 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
{
if (!isMinimized() && isFrontmost())
{
- LLRect area;
- childGetRect("search_results", area);
- if(!area.pointInRect(x, y))
+ if(mPanel->pointInView(x, y))
{
- F32 slider_value = (F32)childGetValue("zoom slider").asReal();
+ F32 slider_value = (F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal();
slider_value += ((F32)clicks * -0.3333f);
- childSetValue("zoom slider", LLSD(slider_value));
+ getChild<LLUICtrl>("zoom slider")->setValue(LLSD(slider_value));
return TRUE;
}
}
@@ -374,68 +366,47 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
void LLFloaterWorldMap::reshape( S32 width, S32 height, BOOL called_from_parent )
{
LLFloater::reshape( width, height, called_from_parent );
-
- // Might have changed size of world display area
- // JC: Technically, this is correct, but it makes the slider "pop"
- // if you resize the window, then draw the slider. Just leaving it
- // the way it was when you opened the window seems better.
- // adjustZoomSliderBounds();
}
// virtual
void LLFloaterWorldMap::draw()
{
- static LLCachedControl<LLColor4> map_track_color(gSavedSkinSettings, "MapTrackColor", LLColor4::white);
- static LLCachedControl<LLColor4> map_track_disabled_color(gSavedSkinSettings, "MapTrackDisabledColor", LLColor4::white);
+ static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white);
+ static LLUIColor map_track_disabled_color = LLUIColorTable::instance().getColor("MapTrackDisabledColor", LLColor4::white);
- // Hide/Show Mature Events controls
- childSetVisible("events_mature_icon", gAgent.canAccessMature());
- childSetVisible("events_mature_label", gAgent.canAccessMature());
- childSetVisible("event_mature_chk", gAgent.canAccessMature());
-
- childSetVisible("events_adult_icon", gAgent.canAccessMature());
- childSetVisible("events_adult_label", gAgent.canAccessMature());
- childSetVisible("event_adult_chk", gAgent.canAccessMature());
- bool adult_enabled = gAgent.canAccessAdult();
- if (!adult_enabled)
- {
- childSetValue("event_adult_chk", FALSE);
- }
- childSetEnabled("event_adult_chk", adult_enabled);
-
// On orientation island, users don't have a home location yet, so don't
// let them teleport "home". It dumps them in an often-crowed welcome
// area (infohub) and they get confused. JC
LLViewerRegion* regionp = gAgent.getRegion();
bool agent_on_prelude = (regionp && regionp->isPrelude());
bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude;
- childSetEnabled("Go Home", enable_go_home);
+ getChildView("Go Home")->setEnabled(enable_go_home);
updateLocation();
LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
if (LLTracker::TRACKING_AVATAR == tracking_status)
{
- childSetColor("avatar_icon", map_track_color);
+ getChild<LLUICtrl>("avatar_icon")->setColor( map_track_color);
}
else
{
- childSetColor("avatar_icon", map_track_disabled_color);
+ getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color);
}
if (LLTracker::TRACKING_LANDMARK == tracking_status)
{
- childSetColor("landmark_icon", map_track_color);
+ getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color);
}
else
{
- childSetColor("landmark_icon", map_track_disabled_color);
+ getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color);
}
if (LLTracker::TRACKING_LOCATION == tracking_status)
{
- childSetColor("location_icon", map_track_color);
+ getChild<LLUICtrl>("location_icon")->setColor( map_track_color);
}
else
{
@@ -443,13 +414,13 @@ void LLFloaterWorldMap::draw()
{
F64 seconds = LLTimer::getElapsedSeconds();
double value = fmod(seconds, 2);
- value = 0.5 + 0.5*cos(value * 3.14159f);
+ value = 0.5 + 0.5*cos(value * F_PI);
LLColor4 loading_color(0.0, F32(value/2), F32(value), 1.0);
- childSetColor("location_icon", loading_color);
+ getChild<LLUICtrl>("location_icon")->setColor( loading_color);
}
else
{
- childSetColor("location_icon", map_track_disabled_color);
+ getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color);
}
}
@@ -459,16 +430,16 @@ void LLFloaterWorldMap::draw()
centerOnTarget(TRUE);
}
- childSetEnabled("Teleport", (BOOL)tracking_status);
-// childSetEnabled("Clear", (BOOL)tracking_status);
- childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->mIsTrackingUnknownLocation);
- childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
+ getChildView("Teleport")->setEnabled((BOOL)tracking_status);
+// getChildView("Clear")->setEnabled((BOOL)tracking_status);
+ getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
+ getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) );
setMouseOpaque(TRUE);
getDragHandle()->setMouseOpaque(TRUE);
//RN: snaps to zoom value because interpolation caused jitter in the text rendering
- if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)childGetValue("zoom slider").asReal())
+ if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal())
{
mZoomTimer.start();
}
@@ -478,9 +449,21 @@ void LLFloaterWorldMap::draw()
interp = 1.f;
mZoomTimer.stop();
}
- mCurZoomVal = lerp(mCurZoomVal, (F32)childGetValue("zoom slider").asReal(), interp);
+ mCurZoomVal = lerp(mCurZoomVal, (F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal(), interp);
F32 map_scale = 256.f*pow(2.f, mCurZoomVal);
LLWorldMapView::setScale( map_scale );
+
+ // Enable/disable checkboxes depending on the zoom level
+ // If above threshold level (i.e. low res) -> Disable all checkboxes
+ // If under threshold level (i.e. high res) -> Enable all checkboxes
+ bool enable = LLWorldMapView::showRegionInfo();
+ getChildView("people_chk")->setEnabled(enable);
+ getChildView("infohub_chk")->setEnabled(enable);
+ getChildView("telehub_chk")->setEnabled(enable);
+ getChildView("land_for_sale_chk")->setEnabled(enable);
+ getChildView("event_chk")->setEnabled(enable);
+ getChildView("events_mature_chk")->setEnabled(enable);
+ getChildView("events_adult_chk")->setEnabled(enable);
LLFloater::draw();
}
@@ -504,7 +487,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string&
// convenience.
if(gAgent.isGodlike())
{
- childSetValue("spin z", LLSD(200.f));
+ getChild<LLUICtrl>("spin z")->setValue(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)
@@ -569,14 +552,14 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info)
{
mTrackedStatus = LLTracker::TRACKING_LOCATION;
- LLTracker::trackLocation(event_info.mPosGlobal, event_info.mName, event_info.mToolTip, LLTracker::LOCATION_EVENT);
+ LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT);
setDefaultBtn("Teleport");
}
void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item)
{
mTrackedStatus = LLTracker::TRACKING_LOCATION;
- LLTracker::trackLocation(item.mPosGlobal, item.mName, item.mToolTip, LLTracker::LOCATION_ITEM);
+ LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM);
setDefaultBtn("Teleport");
}
@@ -585,29 +568,35 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
if (!sim_info)
{
- LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
- LLWorldMap::getInstance()->mInvalidLocation = FALSE;
- LLWorldMap::getInstance()->mUnknownLocation = pos_global;
+ // We haven't found a region for that point yet, leave the tracking to the world map
+ LLWorldMap::getInstance()->setTracking(pos_global);
LLTracker::stopTracking(NULL);
S32 world_x = S32(pos_global.mdV[0] / 256);
S32 world_y = S32(pos_global.mdV[1] / 256);
- LLWorldMap::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
+ LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
setDefaultBtn("");
+
+ // clicked on a non-region - turn off coord display
+ enableTeleportCoordsDisplay( false );
+
return;
}
- if (sim_info->mAccess == SIM_ACCESS_DOWN)
+ if (sim_info->isDown())
{
- // Down sim. Show the blue circle of death!
- LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE;
- LLWorldMap::getInstance()->mUnknownLocation = pos_global;
- LLWorldMap::getInstance()->mInvalidLocation = TRUE;
+ // Down region. Show the blue circle of death!
+ // i.e. let the world map that this and tell it it's invalid
+ LLWorldMap::getInstance()->setTracking(pos_global);
+ LLWorldMap::getInstance()->setTrackingInvalid();
LLTracker::stopTracking(NULL);
setDefaultBtn("");
+
+ // clicked on a down region - turn off coord display
+ enableTeleportCoordsDisplay( false );
+
return;
}
- std::string sim_name;
- LLWorldMap::getInstance()->simNameFromPosGlobal( pos_global, sim_name );
+ std::string sim_name = sim_info->getName();
F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
std::string full_name = llformat("%s (%d, %d, %d)",
@@ -619,13 +608,42 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
std::string tooltip("");
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLTracker::trackLocation(pos_global, full_name, tooltip);
- LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
- LLWorldMap::getInstance()->mIsTrackingDoubleClick = FALSE;
- LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
+ LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
+
+ LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
+ updateTeleportCoordsDisplay( coord_pos );
+
+ // we have a valid region - turn on coord display
+ enableTeleportCoordsDisplay( true );
setDefaultBtn("Teleport");
}
+// enable/disable teleport destination coordinates
+void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled )
+{
+ childSetEnabled("teleport_coordinate_x", enabled );
+ childSetEnabled("teleport_coordinate_y", enabled );
+ childSetEnabled("teleport_coordinate_z", enabled );
+}
+
+// update display of teleport destination coordinates - pos is in global coordinates
+void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
+{
+ // if we're going to update their value, we should also enable them
+ enableTeleportCoordsDisplay( true );
+
+ // convert global specified position to a local one
+ F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
+ F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
+ F32 region_local_z = (F32)fmod( pos.mdV[VZ], (F64)REGION_WIDTH_METERS );
+
+ // write in the values
+ childSetValue("teleport_coordinate_x", region_local_x );
+ childSetValue("teleport_coordinate_y", region_local_y );
+ childSetValue("teleport_coordinate_z", region_local_z );
+}
+
void LLFloaterWorldMap::updateLocation()
{
bool gotSimName;
@@ -650,21 +668,14 @@ void LLFloaterWorldMap::updateLocation()
mSetToUserPosition = FALSE;
// Fill out the location field
- childSetValue("location", agent_sim_name);
-
- // Figure out where user is
- LLVector3d agentPos = gAgent.getPositionGlobal();
-
- S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
- S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
- S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
+ getChild<LLUICtrl>("location")->setValue(agent_sim_name);
- childSetValue("spin x", LLSD(agent_x) );
- childSetValue("spin y", LLSD(agent_y) );
- childSetValue("spin z", LLSD(agent_z) );
+ // update the coordinate display with location of avatar in region
+ updateTeleportCoordsDisplay( agentPos );
+ // Figure out where user is
// Set the current SLURL
- mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
+ mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
}
}
@@ -690,22 +701,20 @@ void LLFloaterWorldMap::updateLocation()
}
}
- childSetValue("location", sim_name);
-
- F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
- F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
- childSetValue("spin x", LLSD(region_x) );
- childSetValue("spin y", LLSD(region_y) );
- childSetValue("spin z", LLSD((F32)pos_global.mdV[VZ]) );
+ getChild<LLUICtrl>("location")->setValue(sim_name);
+
+ // refresh coordinate display to reflect where user clicked.
+ LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
+ updateTeleportCoordsDisplay( coord_pos );
// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
if ( gotSimName )
{
- mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
+ mSLURL = LLSLURL(sim_name, pos_global);
}
else
{ // Empty SLURL will disable the "Copy SLURL to clipboard" button
- mSLURL = "";
+ mSLURL = LLSLURL();
}
}
}
@@ -727,16 +736,18 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3
else
{
// fill in UI based on URL
- gFloaterWorldMap->childSetValue("location", region_name);
- childSetValue("spin x", LLSD((F32)x_coord));
- childSetValue("spin y", LLSD((F32)y_coord));
- childSetValue("spin z", LLSD((F32)z_coord));
+ gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name);
+
+ // Save local coords to highlight position after region global
+ // position is returned.
+ gFloaterWorldMap->mCompletingRegionPos.set(
+ (F32)x_coord, (F32)y_coord, (F32)z_coord);
// pass sim name to combo box
gFloaterWorldMap->mCompletingRegionName = region_name;
- LLWorldMap::getInstance()->sendNamedRegionRequest(region_name);
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name);
LLStringUtil::toLower(gFloaterWorldMap->mCompletingRegionName);
- LLWorldMap::getInstance()->mIsTrackingCommit = TRUE;
+ LLWorldMap::getInstance()->setTrackingCommit();
}
}
@@ -787,8 +798,11 @@ void LLFloaterWorldMap::friendsChanged()
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())
+ const LLRelationship* buddy_info = t.getBuddyInfo(avatar_id);
+ if(!iface ||
+ !iface->setCurrentByID(avatar_id) ||
+ (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) ||
+ gAgent.isGodlike())
{
LLTracker::stopTracking(NULL);
}
@@ -803,19 +817,12 @@ void LLFloaterWorldMap::buildAvatarIDList()
// Delete all but the "None" entry
S32 list_size = list->getItemCount();
- while (list_size > 1)
+ if (list_size > 1)
{
- list->selectNthItem(1);
+ list->selectItemRange(1, -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);
@@ -836,10 +843,7 @@ void LLFloaterWorldMap::buildAvatarIDList()
void LLFloaterWorldMap::buildLandmarkIDLists()
{
LLCtrlListInterface *list = childGetListInterface("landmark combo");
- if (!list)
- {
- return;
- }
+ if (!list) return;
// Delete all but the "None" entry
S32 list_size = list->getItemCount();
@@ -862,7 +866,7 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
LLIsType is_landmark(LLAssetType::AT_LANDMARK);
- gInventory.collectDescendentsIf(gAgent.getInventoryRootID(),
+ gInventory.collectDescendentsIf(gInventory.getRootFolderID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
@@ -880,7 +884,6 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
mLandmarkAssetIDList.put( item->getAssetUUID() );
mLandmarkItemIDList.put( item->getUUID() );
}
- list->sortByColumn(std::string("landmark name"), TRUE);
list->selectFirstItem();
}
@@ -905,21 +908,8 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui)
{
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
}
- if (!childHasKeyboardFocus("spin x"))
- {
- childSetValue("spin x", SIM_COORD_DEFAULT);
- }
- if (!childHasKeyboardFocus("spin y"))
- {
- childSetValue("spin y", SIM_COORD_DEFAULT);
- }
- if (!childHasKeyboardFocus("spin z"))
- {
- childSetValue("spin z", 0);
- }
- LLWorldMap::getInstance()->mIsTrackingCommit = FALSE;
+ LLWorldMap::getInstance()->cancelTracking();
mCompletingRegionName = "";
- mExactMatch = FALSE;
}
@@ -954,18 +944,16 @@ void LLFloaterWorldMap::clearAvatarSelection(BOOL clear_ui)
// can see the whole world, plus a little.
void LLFloaterWorldMap::adjustZoomSliderBounds()
{
- // World size in regions
- S32 world_width_regions = LLWorldMap::getInstance()->getWorldWidth() / REGION_WIDTH_UNITS;
- S32 world_height_regions = LLWorldMap::getInstance()->getWorldHeight() / REGION_WIDTH_UNITS;
-
- // Pad the world size a little bit, so we have a nice border on
- // the edge
- world_width_regions++;
- world_height_regions++;
+ // Merov: we switched from using the "world size" (which varies depending where the user went) to a fixed
+ // width of 512 regions max visible at a time. This makes the zoom slider works in a consistent way across
+ // sessions and doesn't prevent the user to pan the world if it was to grow a lot beyond that limit.
+ // Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
+ S32 world_width_regions = MAX_VISIBLE_REGIONS;
+ S32 world_height_regions = MAX_VISIBLE_REGIONS;
// Find how much space we have to display the world
LLWorldMapView* map_panel;
- map_panel = (LLWorldMapView*)mTabs->getCurrentPanel();
+ map_panel = (LLWorldMapView*)mPanel;
LLRect view_rect = map_panel->getRect();
// View size in pixels
@@ -988,7 +976,8 @@ void LLFloaterWorldMap::adjustZoomSliderBounds()
pixels_per_region = llclamp(pixels_per_region, 1.f, ZOOM_MAX);
F32 min_power = log(pixels_per_region/256.f)/log(2.f);
- childSetMinValue("zoom slider", min_power);
+
+ getChild<LLSlider>("zoom slider")->setMinValue(min_power);
}
@@ -996,34 +985,10 @@ void LLFloaterWorldMap::adjustZoomSliderBounds()
// User interface widget callbacks
//-------------------------------------------------------------------------
-// static
-void LLFloaterWorldMap::onPanBtn( void* userdata )
-{
- if( !gFloaterWorldMap ) return;
-
- EPanDirection direction = (EPanDirection)(intptr_t)userdata;
-
- S32 pan_x = 0;
- S32 pan_y = 0;
- switch( direction )
- {
- case PAN_UP: pan_y = -1; break;
- case PAN_DOWN: pan_y = 1; break;
- case PAN_LEFT: pan_x = 1; break;
- case PAN_RIGHT: pan_x = -1; break;
- default: llassert(0); return;
- }
-
- LLWorldMapView* map_panel;
- map_panel = (LLWorldMapView*)gFloaterWorldMap->mTabs->getCurrentPanel();
- map_panel->translatePan( pan_x, pan_y );
-}
-
-// static
-void LLFloaterWorldMap::onGoHome(void*)
+void LLFloaterWorldMap::onGoHome()
{
gAgent.teleportHome();
- gFloaterWorldMap->closeFloater();
+ closeFloater();
}
@@ -1039,7 +1004,7 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( )
LLUUID current_choice = list->getCurrentID();
- gFloaterWorldMap->buildLandmarkIDLists();
+ buildLandmarkIDLists();
if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
{
@@ -1056,23 +1021,21 @@ void LLFloaterWorldMap::onComboTextEntry()
LLTracker::clearFocus();
}
-void LLFloaterWorldMap::onSearchTextEntry( LLLineEditor* ctrl )
+void LLFloaterWorldMap::onSearchTextEntry( )
{
onComboTextEntry();
updateSearchEnabled();
}
-// static
-void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata )
-{
- LLFloaterWorldMap* self = gFloaterWorldMap;
- if( !self || self->mIsClosing )
+void LLFloaterWorldMap::onLandmarkComboCommit()
+{
+ if( mIsClosing )
{
return;
}
- LLCtrlListInterface *list = gFloaterWorldMap->childGetListInterface("landmark combo");
+ LLCtrlListInterface *list = childGetListInterface("landmark combo");
if (!list) return;
LLUUID asset_id;
@@ -1104,11 +1067,11 @@ void LLFloaterWorldMap::onLandmarkComboCommit( LLUICtrl* ctrl, void* userdata )
}
}
- self->trackLandmark( item_id);
- onShowTargetBtn(self);
+ trackLandmark( item_id);
+ onShowTargetBtn();
// Reset to user postion if nothing is tracked
- self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
+ mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
}
// static
@@ -1137,31 +1100,28 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( )
}
}
-
-// static
-void LLFloaterWorldMap::onAvatarComboCommit( LLUICtrl* ctrl, void* userdata )
+void LLFloaterWorldMap::onAvatarComboCommit()
{
- LLFloaterWorldMap* self = gFloaterWorldMap;
- if( !self || self->mIsClosing )
+ if( mIsClosing )
{
return;
}
- LLCtrlListInterface *list = gFloaterWorldMap->childGetListInterface("friend combo");
+ LLCtrlListInterface *list = childGetListInterface("friend combo");
if (!list) return;
const LLUUID& new_avatar_id = list->getCurrentID();
if (new_avatar_id.notNull())
{
std::string name;
- LLComboBox* combo = gFloaterWorldMap->getChild<LLComboBox>("friend combo");
+ LLComboBox* combo = getChild<LLComboBox>("friend combo");
if (combo) name = combo->getSimple();
- self->trackAvatar(new_avatar_id, name);
- onShowTargetBtn(self);
+ trackAvatar(new_avatar_id, name);
+ onShowTargetBtn();
}
else
{ // Reset to user postion if nothing is tracked
- self->mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
+ mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
}
}
@@ -1173,7 +1133,7 @@ void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus )
void LLFloaterWorldMap::updateSearchEnabled()
{
if (childHasKeyboardFocus("location") &&
- childGetValue("location").asString().length() > 0)
+ getChild<LLUICtrl>("location")->getValue().asString().length() > 0)
{
setDefaultBtn("DoSearch");
}
@@ -1183,103 +1143,91 @@ void LLFloaterWorldMap::updateSearchEnabled()
}
}
-// static
-void LLFloaterWorldMap::onLocationCommit( void* userdata )
+void LLFloaterWorldMap::onLocationCommit()
{
- LLFloaterWorldMap *self = gFloaterWorldMap;
- if( !self || self->mIsClosing )
+ if( mIsClosing )
{
return;
}
- self->clearLocationSelection(FALSE);
- self->mCompletingRegionName = "";
- self->mLastRegionName = "";
+ clearLocationSelection(FALSE);
+ mCompletingRegionName = "";
+ mLastRegionName = "";
- std::string str = self->childGetValue("location").asString();
+ std::string str = getChild<LLUICtrl>("location")->getValue().asString();
// Trim any leading and trailing spaces in the search target
std::string saved_str = str;
LLStringUtil::trim( str );
if ( str != saved_str )
{ // Set the value in the UI if any spaces were removed
- self->childSetValue("location", str);
+ getChild<LLUICtrl>("location")->setValue(str);
}
LLStringUtil::toLower(str);
- gFloaterWorldMap->mCompletingRegionName = str;
- LLWorldMap::getInstance()->mIsTrackingCommit = TRUE;
- self->mExactMatch = FALSE;
+ mCompletingRegionName = str;
+ LLWorldMap::getInstance()->setTrackingCommit();
if (str.length() >= 3)
{
- LLWorldMap::getInstance()->sendNamedRegionRequest(str);
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
}
else
{
str += "#";
- LLWorldMap::getInstance()->sendNamedRegionRequest(str);
+ LLWorldMapMessage::getInstance()->sendNamedRegionRequest(str);
}
}
-
-// static
-void LLFloaterWorldMap::onClearBtn(void* data)
+void LLFloaterWorldMap::onCoordinatesCommit()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->mTrackedStatus = LLTracker::TRACKING_NOTHING;
- LLTracker::stopTracking((void *)(intptr_t)TRUE);
- LLWorldMap::getInstance()->mIsTrackingUnknownLocation = FALSE;
- self->mSLURL = ""; // Clear the SLURL since it's invalid
- self->mSetToUserPosition = TRUE; // Revert back to the current user position
+ if( mIsClosing )
+ {
+ return;
+ }
+
+ S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal();
+ S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal();
+ S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal();
+
+ const std::string region_name = childGetValue("location").asString();
+
+ trackURL( region_name, x_coord, y_coord, z_coord );
}
-// static
-void LLFloaterWorldMap::onFlyBtn(void* data)
+void LLFloaterWorldMap::onClearBtn()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->fly();
+ mTrackedStatus = LLTracker::TRACKING_NOTHING;
+ LLTracker::stopTracking((void *)(intptr_t)TRUE);
+ LLWorldMap::getInstance()->cancelTracking();
+ mSLURL = LLSLURL(); // Clear the SLURL since it's invalid
+ mSetToUserPosition = TRUE; // Revert back to the current user position
}
-void LLFloaterWorldMap::onShowTargetBtn(void* data)
+void LLFloaterWorldMap::onShowTargetBtn()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->centerOnTarget(TRUE);
+ centerOnTarget(TRUE);
}
-void LLFloaterWorldMap::onShowAgentBtn(void* data)
+void LLFloaterWorldMap::onShowAgentBtn()
{
LLWorldMapView::setPan( 0, 0, FALSE); // FALSE == animate
-
// Set flag so user's location will be displayed if not tracking anything else
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->mSetToUserPosition = TRUE;
+ mSetToUserPosition = TRUE;
}
-// static
-void LLFloaterWorldMap::onClickTeleportBtn(void* data)
+void LLFloaterWorldMap::onClickTeleportBtn()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->teleport();
+ teleport();
}
-// static
-void LLFloaterWorldMap::onCopySLURL(void* data)
+void LLFloaterWorldMap::onCopySLURL()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- self->getWindow()->copyTextToClipboard(utf8str_to_wstring(self->mSLURL));
+ getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
LLSD args;
- args["SLURL"] = self->mSLURL;
+ args["SLURL"] = mSLURL.getSLURLString();
- LLNotifications::instance().add("CopySLURL", args);
-}
-
-void LLFloaterWorldMap::onCheckEvents(LLUICtrl*, void* data)
-{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*)data;
- if(!self) return;
- self->childSetEnabled("event_mature_chk", self->childGetValue("event_chk"));
- self->childSetEnabled("event_adult_chk", self->childGetValue("event_chk"));
+ LLNotificationsUtil::add("CopySLURL", args);
}
// protected
@@ -1300,12 +1248,15 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
{
// We've got the position finally, so we're no longer busy. JC
// getWindow()->decBusyCount();
- pos_global = LLTracker::getTrackedPositionGlobal() - gAgent.getCameraPositionGlobal();
+ pos_global = LLTracker::getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
}
}
- else if(LLWorldMap::getInstance()->mIsTrackingUnknownLocation)
+ else if(LLWorldMap::getInstance()->isTracking())
{
- pos_global = LLWorldMap::getInstance()->mUnknownLocation - gAgent.getCameraPositionGlobal();;
+ pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();;
+
+
+
}
else
{
@@ -1313,8 +1264,8 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
pos_global.clearVec();
}
- LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sPixelsPerMeter)),
- -llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sPixelsPerMeter)),
+ LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
+ -llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
!animate);
mWaitingForTracker = FALSE;
}
@@ -1350,7 +1301,7 @@ void LLFloaterWorldMap::teleport()
&& av_tracker.haveTrackingInfo() )
{
pos_global = av_tracker.getGlobalPos();
- pos_global.mdV[VZ] = childGetValue("spin z");
+ pos_global.mdV[VZ] = getChild<LLUICtrl>("spin z")->getValue();
}
else if ( LLTracker::TRACKING_LANDMARK == tracking_status)
{
@@ -1401,24 +1352,6 @@ void LLFloaterWorldMap::teleport()
}
}
-// static
-void LLFloaterWorldMap::onGoToLandmarkDialog( S32 option, void* userdata )
-{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
- switch( option )
- {
- case 0:
- self->teleportToLandmark();
- break;
- case 1:
- self->flyToLandmark();
- break;
- default:
- // nothing
- break;
- }
-}
-
void LLFloaterWorldMap::flyToLandmark()
{
LLVector3d destination_pos_global;
@@ -1490,13 +1423,6 @@ void LLFloaterWorldMap::flyToAvatar()
}
}
-void LLFloaterWorldMap::onCommitBackground()
-{
- // Find my index
- S32 index = mTabs->getCurrentPanelIndex();
- LLWorldMap::getInstance()->setCurrentLayer(index);
-}
-
void LLFloaterWorldMap::updateSims(bool found_null_sim)
{
if (mCompletingRegionName == "")
@@ -1507,90 +1433,59 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results");
list->operateOnAll(LLCtrlListInterface::OP_DELETE);
- LLSD selected_value = list->getSelectedValue();
-
S32 name_length = mCompletingRegionName.length();
- BOOL match_found = FALSE;
+ LLSD match;
+
S32 num_results = 0;
std::map<U64, LLSimInfo*>::const_iterator it;
- for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
+ for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
{
- LLSimInfo* info = (*it).second;
- std::string sim_name = info->mName;
- std::string sim_name_lower = sim_name;
+ LLSimInfo* info = it->second;
+ std::string sim_name_lower = info->getName();
LLStringUtil::toLower(sim_name_lower);
if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
{
- if (LLWorldMap::getInstance()->mIsTrackingCommit)
+ if (sim_name_lower == mCompletingRegionName)
{
- if (sim_name_lower == mCompletingRegionName)
- {
- selected_value = sim_name;
- match_found = TRUE;
- }
+ match = info->getName();
}
-
+
LLSD value;
- value["id"] = sim_name;
+ value["id"] = info->getName();
value["columns"][0]["column"] = "sim_name";
- value["columns"][0]["value"] = sim_name;
+ value["columns"][0]["value"] = info->getName();
list->addElement(value);
num_results++;
}
}
-
- list->selectByValue(selected_value);
if (found_null_sim)
{
mCompletingRegionName = "";
}
- if (match_found)
- {
- mExactMatch = TRUE;
- childSetFocus("search_results");
- onCommitSearchResult(NULL, this);
- }
- else if (!mExactMatch && num_results > 0)
+ // if match found, highlight it and go
+ if (!match.isUndefined())
{
- list->selectFirstItem(); // select first item by default
- childSetFocus("search_results");
- onCommitSearchResult(NULL, this);
+ list->selectByValue(match);
+ getChild<LLUICtrl>("search_results")->setFocus(TRUE);
+ onCommitSearchResult();
}
- else if (num_results == 0)
+
+ // if we found nothing, say "none"
+ if (num_results == 0)
{
- list->setCommentText(std::string("None found."));
+ list->setCommentText(LLTrans::getString("worldmap_results_none_found"));
list->operateOnAll(LLCtrlListInterface::OP_DESELECT);
}
}
-// static
-void LLFloaterWorldMap::onCommitLocation(LLUICtrl* ctrl, void* userdata)
-{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
- LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
- if ( LLTracker::TRACKING_LOCATION == tracking_status)
- {
- LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
- F64 local_x = self->childGetValue("spin x");
- F64 local_y = self->childGetValue("spin y");
- F64 local_z = self->childGetValue("spin z");
- pos_global.mdV[VX] += -fmod(pos_global.mdV[VX], 256.0) + local_x;
- pos_global.mdV[VY] += -fmod(pos_global.mdV[VY], 256.0) + local_y;
- pos_global.mdV[VZ] = local_z;
- self->trackLocation(pos_global);
- }
-}
-// static
-void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata)
+void LLFloaterWorldMap::onCommitSearchResult()
{
- LLFloaterWorldMap* self = (LLFloaterWorldMap*) userdata;
-
- LLCtrlListInterface *list = self->childGetListInterface("search_results");
+ LLCtrlListInterface *list = childGetListInterface("search_results");
if (!list) return;
LLSD selected_value = list->getSelectedValue();
@@ -1602,28 +1497,57 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata)
LLStringUtil::toLower(sim_name);
std::map<U64, LLSimInfo*>::const_iterator it;
- for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it)
+ for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
{
- LLSimInfo* info = (*it).second;
- std::string info_sim_name = info->mName;
- LLStringUtil::toLower(info_sim_name);
+ LLSimInfo* info = it->second;
- if (sim_name == info_sim_name)
+ if (info->isName(sim_name))
{
- LLVector3d pos_global = from_region_handle( info->mHandle );
- F64 local_x = self->childGetValue("spin x");
- F64 local_y = self->childGetValue("spin y");
- F64 local_z = self->childGetValue("spin z");
- pos_global.mdV[VX] += local_x;
- pos_global.mdV[VY] += local_y;
- pos_global.mdV[VZ] = local_z;
-
- self->childSetValue("location", sim_name);
- self->trackLocation(pos_global);
- self->setDefaultBtn("Teleport");
+ LLVector3d pos_global = info->getGlobalOrigin();
+
+ const F64 SIM_COORD_DEFAULT = 128.0;
+ LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f);
+
+ // Did this value come from a trackURL() request?
+ if (!mCompletingRegionPos.isExactlyZero())
+ {
+ pos_local = mCompletingRegionPos;
+ mCompletingRegionPos.clear();
+ }
+ pos_global.mdV[VX] += (F64)pos_local.mV[VX];
+ pos_global.mdV[VY] += (F64)pos_local.mV[VY];
+ pos_global.mdV[VZ] = (F64)pos_local.mV[VZ];
+
+ getChild<LLUICtrl>("location")->setValue(sim_name);
+ trackLocation(pos_global);
+ setDefaultBtn("Teleport");
break;
}
}
- onShowTargetBtn(self);
+ onShowTargetBtn();
+}
+
+void LLFloaterWorldMap::onChangeMaturity()
+{
+ bool can_access_mature = gAgent.canAccessMature();
+ bool can_access_adult = gAgent.canAccessAdult();
+
+ getChildView("events_mature_icon")->setVisible( can_access_mature);
+ getChildView("events_mature_label")->setVisible( can_access_mature);
+ getChildView("events_mature_chk")->setVisible( can_access_mature);
+
+ getChildView("events_adult_icon")->setVisible( can_access_adult);
+ getChildView("events_adult_label")->setVisible( can_access_adult);
+ getChildView("events_adult_chk")->setVisible( can_access_adult);
+
+ // disable mature / adult events.
+ if (!can_access_mature)
+ {
+ gSavedSettings.setBOOL("ShowMatureEvents", FALSE);
+ }
+ if (!can_access_adult)
+ {
+ gSavedSettings.setBOOL("ShowAdultEvents", FALSE);
+ }
}