From 609dba3926ac01cb2380baba354441a76e95811d Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sun, 30 Jun 2013 15:38:27 -0400 Subject: [PATCH] Update Floater World Map, add support for worldmap and maptrackavatar slurls (Find on map and show pick on map in web profiles) Cleaned up includes, switched callbacks over to mCommitCallbackRegistrar, updated RLVa portions to RLVa 1.4.5, changed mSLURL from a string to a real SLURL --- indra/newview/llfloaterworldmap.cpp | 331 +++++++++++------- indra/newview/llfloaterworldmap.h | 12 +- indra/newview/llworldmapview.cpp | 8 +- indra/newview/llworldmapview.h | 2 + .../default/xui/en-us/floater_world_map.xml | 61 +++- 5 files changed, 273 insertions(+), 141 deletions(-) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 0f6eb2cdf..7537e9e56 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -4,10 +4,9 @@ * @brief LLFloaterWorldMap class implementation * * $LicenseInfo:firstyear=2003&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2003-2009, Linden Research, Inc. * - * 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 @@ -47,6 +46,7 @@ #include "llcolorscheme.h" #include "llcombobox.h" #include "llviewercontrol.h" +#include "llcommandhandler.h" #include "lldraghandle.h" #include "llfirstuse.h" #include "llfocusmgr.h" @@ -55,15 +55,13 @@ #include "llinventorymodelbackgroundfetch.h" #include "llinventoryobserver.h" #include "lllandmarklist.h" -#include "lllineeditor.h" +#include "llsearcheditor.h" #include "llnotificationsutil.h" #include "llregionhandle.h" #include "llscrolllistctrl.h" -#include "llsearcheditor.h" #include "lltextbox.h" #include "lltracker.h" #include "lltrans.h" -#include "llurldispatcher.h" #include "llviewermenu.h" #include "llviewerregion.h" #include "llviewerstats.h" @@ -74,11 +72,10 @@ #include "llappviewer.h" #include "llmapimagetype.h" #include "llweb.h" +#include "llsliderctrl.h" #include "llwindow.h" // copyTextToClipboard() -#include "llslurl.h" - -// [RLVa:KB] +// [RLVa:KB] - Checked: 2010-08-22 (RLVa-1.2.1a) #include "rlvhandler.h" // [/RLVa:KB] @@ -114,12 +111,85 @@ 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 (!LLUI::sSettingGroups["config"]->getBOOL("EnableWorldMap")) + { + LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); + return true; + }*/ + + if (params.size() == 0) + { + // support the secondlife:///app/worldmap SLapp + LLFloaterWorldMap::show(true); + 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; + + gFloaterWorldMap->trackURL(region_name, x, y, z); + LLFloaterWorldMap::show(true); + + return true; + } +}; +LLWorldMapHandler gWorldMapHandler; + +// SocialMap handler secondlife:///app/maptrackavatar/id +class LLMapTrackAvatarHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_THROTTLE) + { + } + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + /*if (!LLUI::sSettingGroups["config"]->getBOOL("EnableWorldMap")) + { + LLNotificationsUtil::add("NoWorldMap", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit")); + return true; + }*/ + + //Make sure we have some parameters + if (params.size() == 0) + { + return false; + } + + //Get the ID + LLUUID id; + if (!id.set( params[0], FALSE )) + { + return false; + } + + gFloaterWorldMap->avatarTrackFromSlapp( id ); + LLFloaterWorldMap::show(true); + + return true; + } +}; +LLMapTrackAvatarHandler gMapTrackAvatar; + LLFloaterWorldMap* gFloaterWorldMap = NULL; class LLMapInventoryObserver : public LLInventoryObserver @@ -185,9 +255,22 @@ LLFloaterWorldMap::LLFloaterWorldMap() mListLandmarkCombo(NULL), mListSearchResults(NULL) { - LLCallbackMap::map_t factory_map; - factory_map["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &factory_map); + mFactoryMap["objects_mapview"] = LLCallbackMap(createWorldMapView, NULL); + + 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)); + + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &getFactoryMap()); + gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this)); } // static @@ -198,14 +281,6 @@ void* LLFloaterWorldMap::createWorldMapView(void* data) BOOL LLFloaterWorldMap::postBuild() { - - // 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((void*)this, false); - mPanel = getChild("objects_mapview"); LLComboBox *avatar_combo = getChild("friend combo"); @@ -218,9 +293,8 @@ BOOL LLFloaterWorldMap::postBuild() location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1)); location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this)); - LLScrollListCtrl* search_results = getChild("search_results"); - search_results->setDoubleClickCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this)); - mListSearchResults = dynamic_cast(search_results); + getChild("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this)); + mListSearchResults = childGetListInterface("search_results"); LLComboBox *landmark_combo = getChild( "landmark combo"); landmark_combo->selectFirstItem(); @@ -228,26 +302,8 @@ BOOL LLFloaterWorldMap::postBuild() landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) ); mListLandmarkCombo = dynamic_cast(landmark_combo); - avatar_combo->setCommitCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboCommit,this) ); - - search_results->setCommitCallback( boost::bind(&LLFloaterWorldMap::onCommitSearchResult,this) ); - - landmark_combo->setCommitCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit,this) ); - - getChild("spin x")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) ); - getChild("spin y")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) ); - getChild("spin z")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) ); - - getChild("DoSearch")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onLocationCommit,this) ); - getChild("Go Home")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onGoHome,this) ); - getChild("Teleport")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this) ); - getChild("Show Destination")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onShowTargetBtn,this) ); - getChild("Show My Location")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onShowAgentBtn,this) ); - getChild("Clear")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onClearBtn,this) ); - getChild("copy_slurl")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCopySLURL,this) ); - mCurZoomVal = log(LLWorldMapView::sMapScale/256.f)/log(2.f); - childSetValue("zoom slider", mCurZoomVal); + getChild("zoom slider")->setValue(mCurZoomVal); setDefaultBtn(NULL); @@ -323,7 +379,7 @@ void LLFloaterWorldMap::show(bool center_on_target) LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id); - gFloaterWorldMap->childSetFocus("location", TRUE); + gFloaterWorldMap->getChild("location")->setFocus( TRUE); gFocusMgr.triggerFocusFlash(); gFloaterWorldMap->buildAvatarIDList(); @@ -339,8 +395,6 @@ void LLFloaterWorldMap::show(bool center_on_target) } } - - // static void LLFloaterWorldMap::reloadIcons(void*) { @@ -402,9 +456,9 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { if(mPanel->pointInView(x, y)) { - F32 slider_value = (F32)childGetValue("zoom slider").asReal(); + F32 slider_value = (F32)getChild("zoom slider")->getValue().asReal(); slider_value += ((F32)clicks * -0.3333f); - childSetValue("zoom slider", LLSD(slider_value)); + getChild("zoom slider")->setValue(LLSD(slider_value)); return TRUE; } } @@ -417,12 +471,6 @@ 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(); } @@ -436,32 +484,32 @@ void LLFloaterWorldMap::draw() 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", gTrackColor); + getChild("avatar_icon")->setColor( gTrackColor); } else { - childSetColor("avatar_icon", gDisabledTrackColor); + getChild("avatar_icon")->setColor( gDisabledTrackColor); } if (LLTracker::TRACKING_LANDMARK == tracking_status) { - childSetColor("landmark_icon", gTrackColor); + getChild("landmark_icon")->setColor( gTrackColor); } else { - childSetColor("landmark_icon", gDisabledTrackColor); + getChild("landmark_icon")->setColor( gDisabledTrackColor); } if (LLTracker::TRACKING_LOCATION == tracking_status) { - childSetColor("location_icon", gTrackColor); + getChild("location_icon")->setColor( gTrackColor); } else { @@ -471,11 +519,11 @@ void LLFloaterWorldMap::draw() double value = fmod(seconds, 2); 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("location_icon")->setColor( loading_color); } else { - childSetColor("location_icon", gDisabledTrackColor); + getChild("location_icon")->setColor( gDisabledTrackColor); } } @@ -485,10 +533,10 @@ void LLFloaterWorldMap::draw() centerOnTarget(TRUE); } - childSetEnabled("Teleport", (BOOL)tracking_status); -// childSetEnabled("Clear", (BOOL)tracking_status); - childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking()); - 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); @@ -508,8 +556,17 @@ void LLFloaterWorldMap::draw() F32 map_scale = 256.f*pow(2.f, mCurZoomVal); LLWorldMapView::setScale( map_scale ); - onChangeMaturity(); - + // 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("telehubchk")->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(); } @@ -533,7 +590,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string& // convenience. if(gAgent.isGodlike()) { - childSetValue("spin z", LLSD(200.f)); + getChild("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) @@ -646,17 +703,17 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) 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)", -// sim_name.c_str(), -// [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-04 (RLVa-1.0.0a) - (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? sim_name.c_str() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(), -// [/RLVa:KB] + sim_name.c_str(), llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ])); std::string tooltip(""); mTrackedStatus = LLTracker::TRACKING_LOCATION; - LLTracker::trackLocation(pos_global, full_name, tooltip); +// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5 + LLTracker::trackLocation(pos_global, (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? full_name : RlvStrings::getString(RLV_STRING_HIDDEN).c_str(), tooltip); +// [/RLVa:KB] +// LLTracker::trackLocation(pos_global, full_name, tooltip); LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal(); @@ -668,13 +725,28 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) setDefaultBtn("Teleport"); } - // enable/disable teleport destination coordinates void LLFloaterWorldMap::enableTeleportCoordsDisplay( bool enabled ) { - childSetEnabled("spin x", enabled ); - childSetEnabled("spin y", enabled ); - childSetEnabled("spin z", enabled ); +// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5 + LLUICtrl* pCtrl = getChild("events_label"); + pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + + pCtrl = getChild("spin x"); + pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + pCtrl->setEnabled(enabled); + + pCtrl = getChild("spin y"); + pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + pCtrl->setEnabled(enabled); + + pCtrl = getChild("spin z"); + pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + pCtrl->setEnabled(enabled); +// [/RLVa:KB] +// childSetEnabled("spin x", enabled ); +// childSetEnabled("spin y", enabled ); +// childSetEnabled("spin z", enabled ); } // update display of teleport destination coordinates - pos is in global coordinates @@ -713,31 +785,34 @@ void LLFloaterWorldMap::updateLocation() // Make sure we know where we are before setting the current user position std::string agent_sim_name; gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal( agentPos, agent_sim_name ); - if ( gotSimName ) +// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5 + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) { mSetToUserPosition = FALSE; // Fill out the location field - childSetValue("location", agent_sim_name); + getChild("location")->setValue(RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); + + // update the coordinate display with location of avatar in region + updateTeleportCoordsDisplay( agentPos ); + + mSLURL = LLSLURL(); + } + else if (gotSimName) +// [/RLVa:KB] +// if ( gotSimName ) + { + mSetToUserPosition = FALSE; + + // Fill out the location field + getChild("location")->setValue(agent_sim_name); // update the coordinate display with location of avatar in region updateTeleportCoordsDisplay( agentPos ); - S32 x = llround( (F32)fmod( (F32)agentPos[VX], (F32)REGION_WIDTH_METERS ) ); - S32 y = llround( (F32)fmod( (F32)agentPos[VY], (F32)REGION_WIDTH_METERS ) ); - S32 z = llround( (F32)agentPos[VZ] ); - // Figure out where user is // Set the current SLURL - mSLURL = LLSLURL(agent_sim_name, LLVector3(x, y, z)).getSLURLString(); - -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { - childSetValue("location", RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); - mSLURL.clear(); - } -// [/RLVa:KB] + mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal()); } } @@ -763,32 +838,30 @@ void LLFloaterWorldMap::updateLocation() } } - childSetValue("location", sim_name); + getChild("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 ) +// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5 + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) { - S32 x = llround( (F32)fmod( (F32)coord_pos[VX], (F32)REGION_WIDTH_METERS ) ); - S32 y = llround( (F32)fmod( (F32)coord_pos[VY], (F32)REGION_WIDTH_METERS ) ); - S32 z = llround( (F32)coord_pos[VZ] ); - mSLURL = LLSLURL(sim_name, LLVector3(x, y, z)).getSLURLString(); + mSLURL = LLSLURL(); + + childSetValue("location", RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); + } + else if (gotSimName) +// [/RLVa:KB] +// if ( gotSimName ) + { + mSLURL = LLSLURL(sim_name, pos_global); } else { // Empty SLURL will disable the "Copy SLURL to clipboard" button - mSLURL = ""; + mSLURL = LLSLURL(); } - -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { - childSetValue("location", RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); - mSLURL.clear(); - } -// [/RLVa:KB] } } @@ -809,7 +882,7 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3 else { // fill in UI based on URL - gFloaterWorldMap->childSetValue("location", region_name); + gFloaterWorldMap->getChild("location")->setValue(region_name); // Save local coords to highlight position after region global // position is returned. @@ -982,6 +1055,7 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui) { list->operateOnAll(LLCtrlListInterface::OP_DELETE); } + const F32 SIM_COORD_DEFAULT = 128.f; if (!childHasKeyboardFocus("spin x")) { childSetValue("spin x", SIM_COORD_DEFAULT); @@ -1064,7 +1138,7 @@ void LLFloaterWorldMap::adjustZoomSliderBounds() F32 min_power = log(pixels_per_region/256.f)/log(2.f); - childSetMinValue("zoom slider", min_power); + getChild("zoom slider")->setMinValue(min_power); } @@ -1114,7 +1188,7 @@ void LLFloaterWorldMap::onSearchTextEntry( ) updateSearchEnabled(); } -// static + void LLFloaterWorldMap::onLandmarkComboCommit() { if( mIsClosing ) @@ -1212,6 +1286,13 @@ void LLFloaterWorldMap::onAvatarComboCommit() } } +void LLFloaterWorldMap::avatarTrackFromSlapp( const LLUUID& id ) +{ + std::string name; + trackAvatar( id, gCacheName->getFullName(id, name) ? name : "av" ); // Singu Note: Anything is better than "av" + onShowTargetBtn(); +} + void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus ) { updateSearchEnabled(); @@ -1220,7 +1301,7 @@ void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus ) void LLFloaterWorldMap::updateSearchEnabled() { if (childHasKeyboardFocus("location") && - childGetValue("location").asString().length() > 0) + getChild("location")->getValue().asString().length() > 0) { setDefaultBtn("DoSearch"); } @@ -1241,14 +1322,14 @@ void LLFloaterWorldMap::onLocationCommit() mCompletingRegionName = ""; mLastRegionName = ""; - std::string str = childGetValue("location").asString(); + std::string str = getChild("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 - childSetValue("location", str); + getChild("location")->setValue(str); } // Don't try completing empty name (STORM-1427). @@ -1292,7 +1373,7 @@ void LLFloaterWorldMap::onClearBtn() mTrackedStatus = LLTracker::TRACKING_NOTHING; LLTracker::stopTracking(true); LLWorldMap::getInstance()->cancelTracking(); - mSLURL = ""; // Clear the SLURL since it's invalid + mSLURL = LLSLURL(); // Clear the SLURL since it's invalid mSetToUserPosition = TRUE; // Revert back to the current user position } @@ -1315,10 +1396,10 @@ void LLFloaterWorldMap::onClickTeleportBtn() void LLFloaterWorldMap::onCopySLURL() { - getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL)); + getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString())); LLSD args; - args["SLURL"] = mSLURL; + args["SLURL"] = mSLURL.getSLURLString(); LLNotificationsUtil::add("CopySLURL", args); } @@ -1394,7 +1475,7 @@ void LLFloaterWorldMap::teleport() && av_tracker.haveTrackingInfo() ) { pos_global = av_tracker.getGlobalPos(); - pos_global.mdV[VZ] = childGetValue("spin z"); + pos_global.mdV[VZ] = getChild("spin z")->getValue(); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status) { @@ -1574,7 +1655,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) { list->selectFirstItem(); } - childSetFocus("search_results"); + getChild("search_results")->setFocus(TRUE); onCommitSearchResult(); } else @@ -1621,7 +1702,7 @@ void LLFloaterWorldMap::onCommitSearchResult() pos_global.mdV[VY] += (F64)pos_local.mV[VY]; pos_global.mdV[VZ] = (F64)pos_local.mV[VZ]; - childSetValue("location", sim_name); + getChild("location")->setValue(sim_name); trackLocation(pos_global); setDefaultBtn("Teleport"); break; @@ -1636,11 +1717,13 @@ void LLFloaterWorldMap::onChangeMaturity() bool can_access_mature = gAgent.canAccessMature(); bool can_access_adult = gAgent.canAccessAdult(); - childSetVisible("events_mature_icon", can_access_mature); - childSetVisible("event_mature_chk", can_access_mature); + getChildView("events_mature_icon")->setVisible( can_access_mature); + getChildView("event_mature_label")->setVisible( can_access_mature); + getChildView("event_mature_chk")->setVisible( can_access_mature); - childSetVisible("events_adult_icon", can_access_adult); - childSetVisible("event_adult_chk", can_access_adult); + getChildView("events_adult_icon")->setVisible( can_access_adult); + getChildView("event_adult_label")->setVisible( can_access_adult); + getChildView("event_adult_chk")->setVisible( can_access_adult); // disable mature / adult events. if (!can_access_mature) diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 40ac1dcb2..499e9c79a 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -3,10 +3,9 @@ * @brief LLFloaterWorldMap class definition * * $LicenseInfo:firstyear=2003&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2003-2009, Linden Research, Inc. * - * 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 @@ -43,14 +42,13 @@ #include "llhudtext.h" #include "llmapimagetype.h" #include "lltracker.h" +#include "llslurl.h" -class LLEventInfo; class LLFriendObserver; class LLInventoryModel; class LLInventoryObserver; class LLItemInfo; class LLTabContainer; -class LLWorldMapView; class LLFloaterWorldMap : public LLFloater { @@ -113,6 +111,10 @@ public: void teleport(); void onChangeMaturity(); + + //Slapp instigated avatar tracking + void avatarTrackFromSlapp( const LLUUID& id ); + protected: void onGoHome(); @@ -191,7 +193,7 @@ private: LLTracker::ETrackingStatus mTrackedStatus; std::string mTrackedSimName; std::string mTrackedAvatarName; - std::string mSLURL; + LLSLURL mSLURL; LLCtrlListInterface * mListFriendCombo; LLCtrlListInterface * mListLandmarkCombo; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 806cff3b8..3492d44ed 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -122,7 +122,9 @@ F32 CONE_SIZE = 0.6f; std::map LLWorldMapView::sStringsMap; -F32 DRAW_TEXT_THRESHOLD = 96.f; +// Fetch and draw info thresholds +const F32 DRAW_TEXT_THRESHOLD = 96.f; // Don't draw text under that resolution value (res = width region in meters) +const S32 DRAW_SIMINFO_THRESHOLD = 3; // Max level for which we load or display sim level information (level in LLWorldMipmap sense) const int SIM_MAP_AGENT_SCALE=32; // width in pixels, where we start drawing agents const int SIM_DATA_SCALE=32; // width in pixels where we start requesting sim info @@ -310,6 +312,10 @@ void LLWorldMapView::setPan( S32 x, S32 y, BOOL snap ) sVisibleTilesLoaded = false; } +bool LLWorldMapView::showRegionInfo() +{ + return (LLWorldMipmap::scaleToLevel(sMapScale) <= DRAW_SIMINFO_THRESHOLD ? true : false); +} /////////////////////////////////////////////////////////////////////////////////// // HELPERS diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index 1df0bfba2..e687cf9a5 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -81,6 +81,8 @@ public: static void setScale( F32 scale ); static void translatePan( S32 delta_x, S32 delta_y ); static void setPan( S32 x, S32 y, BOOL snap = TRUE ); + // Return true if the current scale level is above the threshold for accessing region info + static bool showRegionInfo(); LLVector3 globalPosToView(const LLVector3d& global_pos); LLVector3d viewPosToGlobal(S32 x,S32 y); diff --git a/indra/newview/skins/default/xui/en-us/floater_world_map.xml b/indra/newview/skins/default/xui/en-us/floater_world_map.xml index ad9fab124..cf9af6d67 100644 --- a/indra/newview/skins/default/xui/en-us/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en-us/floater_world_map.xml @@ -43,7 +43,10 @@ @@ -101,6 +104,8 @@ Online Friends + Landmarks + + tool_tip="Type the name of a region" width="140"> + + + + tool_tip="X coordinate of location to show on map" width="48" > + + + tool_tip="Y coordinate of location to show on map" width="48" > + + + tool_tip="Z coordinate of location to show on map" width="48" > + +