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
This commit is contained in:
Lirusaito
2013-06-30 15:38:27 -04:00
parent cf189beb86
commit 609dba3926
5 changed files with 273 additions and 141 deletions

View File

@@ -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<LLPanel>("objects_mapview");
LLComboBox *avatar_combo = getChild<LLComboBox>("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<LLScrollListCtrl>("search_results");
search_results->setDoubleClickCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this));
mListSearchResults = dynamic_cast<LLCtrlListInterface *>(search_results);
getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
mListSearchResults = childGetListInterface("search_results");
LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
landmark_combo->selectFirstItem();
@@ -228,26 +302,8 @@ BOOL LLFloaterWorldMap::postBuild()
landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
mListLandmarkCombo = dynamic_cast<LLCtrlListInterface *>(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<LLUICtrl>("spin x")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) );
getChild<LLUICtrl>("spin y")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) );
getChild<LLUICtrl>("spin z")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCoordinatesCommit,this) );
getChild<LLButton>("DoSearch")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onLocationCommit,this) );
getChild<LLButton>("Go Home")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onGoHome,this) );
getChild<LLButton>("Teleport")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onClickTeleportBtn,this) );
getChild<LLButton>("Show Destination")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onShowTargetBtn,this) );
getChild<LLButton>("Show My Location")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onShowAgentBtn,this) );
getChild<LLButton>("Clear")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onClearBtn,this) );
getChild<LLButton>("copy_slurl")->setCommitCallback(boost::bind(&LLFloaterWorldMap::onCopySLURL,this) );
mCurZoomVal = log(LLWorldMapView::sMapScale/256.f)/log(2.f);
childSetValue("zoom slider", mCurZoomVal);
getChild<LLUICtrl>("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<LLUICtrl>("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<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;
}
}
@@ -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<LLUICtrl>("avatar_icon")->setColor( gTrackColor);
}
else
{
childSetColor("avatar_icon", gDisabledTrackColor);
getChild<LLUICtrl>("avatar_icon")->setColor( gDisabledTrackColor);
}
if (LLTracker::TRACKING_LANDMARK == tracking_status)
{
childSetColor("landmark_icon", gTrackColor);
getChild<LLUICtrl>("landmark_icon")->setColor( gTrackColor);
}
else
{
childSetColor("landmark_icon", gDisabledTrackColor);
getChild<LLUICtrl>("landmark_icon")->setColor( gDisabledTrackColor);
}
if (LLTracker::TRACKING_LOCATION == tracking_status)
{
childSetColor("location_icon", gTrackColor);
getChild<LLUICtrl>("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<LLUICtrl>("location_icon")->setColor( loading_color);
}
else
{
childSetColor("location_icon", gDisabledTrackColor);
getChild<LLUICtrl>("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<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)
@@ -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<LLUICtrl>("events_label");
pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC));
pCtrl = getChild<LLUICtrl>("spin x");
pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC));
pCtrl->setEnabled(enabled);
pCtrl = getChild<LLUICtrl>("spin y");
pCtrl->setVisible(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC));
pCtrl->setEnabled(enabled);
pCtrl = getChild<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("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<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 )
// [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<LLUICtrl>("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<LLSliderCtrl>("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<LLUICtrl>("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<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
childSetValue("location", str);
getChild<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("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)

View File

@@ -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;

View File

@@ -122,7 +122,9 @@ F32 CONE_SIZE = 0.6f;
std::map<std::string,std::string> 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

View File

@@ -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);

View File

@@ -43,7 +43,10 @@
<button bottom="-50" follows="top|right" font="SansSerifSmall" halign="center"
height="16" label="Go Home" label_selected="Go Home" left="1150"
mouse_opaque="true" name="Go Home" tool_tip="Teleport to your home"
width="88" />
width="88" >
<button.commit_callback
function="WMap.GoHome" />
</button>
<icon bottom="-92" color="0, 1, 0, 1" follows="top|right" height="8"
image_name="map_avatar_8.tga" left="1017" mouse_opaque="true" name="person"
width="8" />
@@ -101,6 +104,8 @@
<combo_item name="none_selected" value="None">
Online Friends
</combo_item>
<combo_box.commit_callback
function="WMap.AvatarCombo"/>
</combo_box>
<icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16"
image_name="map_track_16.tga" left="1013" mouse_opaque="true"
@@ -111,16 +116,24 @@
<combo_item name="none_selected" value="None">
Landmarks
</combo_item>
<combo_box.commit_callback
function="WMap.Landmark"/>
</combo_box>
<icon bottom_delta="-25" color="0.5, 0, 0, 1" follows="top|right" height="16"
image_name="map_track_16.tga" left="1013" mouse_opaque="true"
name="location_icon" width="16" />
<search_editor bottom_delta="0" follows="top|right" height="20" label="Search by Region Name"
left_delta="20" name="location" select_on_focus="true"
tool_tip="Type the name of a region" width="140" />
tool_tip="Type the name of a region" width="140">
<search_editor.commit_callback
function="WMap.Location" />
</search_editor>
<button bottom_delta="0" follows="top|right" font="SansSerif" halign="center"
height="20" label="Search" left_delta="145" mouse_opaque="true"
name="DoSearch" tool_tip="Search for region" width="60" />
name="DoSearch" tool_tip="Search for region" width="60">
<button.commit_callback
function="WMap.Location" />
</button>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-20" drop_shadow_visible="true" follows="top|right"
font="SansSerif" h_pad="0" halign="left" height="16" left="1013"
@@ -133,6 +146,8 @@
name="search_results" width="222">
<column label="" name="icon" width="16" />
<column label="" name="sim_name" width="206" />
<scroll_list.commit_callback
function="WMap.SearchResult" />
</scroll_list>
<text bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
bottom_delta="-20" drop_shadow_visible="true" follows="bottom|right"
@@ -143,34 +158,58 @@
<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
increment="1" initial_val="128" left="1090" max_val="255" min_val="0"
mouse_opaque="true" name="spin x"
tool_tip="X coordinate of location to show on map" width="48" />
tool_tip="X coordinate of location to show on map" width="48" >
<spinner.commit_callback
function="WMap.Coordinates" />
</spinner>
<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
increment="1" initial_val="128" left_delta="50" max_val="255" min_val="0"
mouse_opaque="true" name="spin y"
tool_tip="Y coordinate of location to show on map" width="48" />
tool_tip="Y coordinate of location to show on map" width="48" >
<spinner.commit_callback
function="WMap.Coordinates" />
</spinner>
<spinner bottom_delta="0" decimal_digits="0" follows="bottom|right" height="16"
increment="1" initial_val="0" left_delta="50" max_val="4096" min_val="0"
mouse_opaque="true" name="spin z"
tool_tip="Z coordinate of location to show on map" width="48" />
tool_tip="Z coordinate of location to show on map" width="48" >
<spinner.commit_callback
function="WMap.Coordinates" />
</spinner>
<button bottom="-625" follows="right|bottom" font="SansSerif" halign="center"
height="20" label="Teleport" label_selected="Teleport" left="-230"
mouse_opaque="true" name="Teleport"
tool_tip="Teleport to selected location" width="90" />
tool_tip="Teleport to selected location" width="90">
<button.commit_callback
function="WMap.Teleport" />
</button>
<button bottom_delta="0" follows="right|bottom" font="SansSerif" halign="center"
height="20" label="Show Destination" label_selected="Show Destination"
left_delta="100" mouse_opaque="true" name="Show Destination"
tool_tip="Center map on selected location" width="125" />
tool_tip="Center map on selected location" width="125" >
<button.commit_callback
function="WMap.ShowTarget" />
</button>
<button bottom_delta="-24" follows="right|bottom" font="SansSerif" halign="center"
height="20" label="Clear" label_selected="Clear" left="-230"
mouse_opaque="true" name="Clear" tool_tip="Stop tracking" width="90" />
mouse_opaque="true" name="Clear" tool_tip="Stop tracking" width="90" >
<button.commit_callback
function="WMap.Clear" />
</button>
<button bottom_delta="0" follows="right|bottom" font="SansSerif" halign="center"
height="20" label="Show My Location" label_selected="Show My Location"
left_delta="100" mouse_opaque="true" name="Show My Location"
tool_tip="Center map on your avatar&apos;s location" width="125" />
tool_tip="Center map on your avatar&apos;s location" width="125" >
<button.commit_callback
function="WMap.ShowAgent" />
</button>
<button bottom_delta="-24" enabled="false" follows="bottom|right" font="SansSerif"
height="20" label="Copy SLURL to clipboard" left="-230" name="copy_slurl"
tool_tip="Copies current location as SLURL to be used on the web."
width="222" />
width="222">
<button.commit_callback
function="WMap.CopySLURL" />
</button>
<slider bottom="-697" can_edit_text="false" decimal_digits="3" follows="right|bottom"
height="16" increment="0.2" initial_val="-2" label="Zoom" left="-230"
max_val="0" min_val="-8" mouse_opaque="true" name="zoom slider"