diff options
Diffstat (limited to 'indra/newview/llfloatermap.cpp')
| -rwxr-xr-x | indra/newview/llfloatermap.cpp | 182 | 
1 files changed, 91 insertions, 91 deletions
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 900816675d..83abbb0357 100755 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -1,25 +1,25 @@ -/**  +/**   * @file llfloatermap.cpp   * @brief The "mini-map" or radar in the upper right part of the screen.   *   * $LicenseInfo:firstyear=2001&license=viewerlgpl$   * Second Life Viewer Source Code   * 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. - *  + *   * 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. - *  + *   * 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 - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ @@ -57,17 +57,17 @@ const F32 MAP_MINOR_DIR_THRESHOLD = 0.035f;  // Member functions  // -LLFloaterMap::LLFloaterMap(const LLSD& key)  -	: LLFloater(key), -	  mTextBoxEast(NULL), -	  mTextBoxNorth(NULL), -	  mTextBoxWest(NULL), -	  mTextBoxSouth(NULL), -	  mTextBoxSouthEast(NULL), -	  mTextBoxNorthEast(NULL), -	  mTextBoxNorthWest(NULL), -	  mTextBoxSouthWest(NULL), -	  mMap(NULL) +LLFloaterMap::LLFloaterMap(const LLSD& key) +    : LLFloater(key), +      mTextBoxEast(NULL), +      mTextBoxNorth(NULL), +      mTextBoxWest(NULL), +      mTextBoxSouth(NULL), +      mTextBoxSouthEast(NULL), +      mTextBoxNorthEast(NULL), +      mTextBoxNorthWest(NULL), +      mTextBoxSouthWest(NULL), +      mMap(NULL)  {  } @@ -119,32 +119,32 @@ bool LLFloaterMap::postBuild()  bool LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)  { -	// If floater is minimized, minimap should be shown on doubleclick (STORM-299) -	if (isMinimized()) -	{ -		setMinimized(false); -		return true; -	} - -	LLVector3d pos_global = mMap->viewPosToGlobal(x, y); -	 -	LLTracker::stopTracking(false); -	LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance(); -	if (world_map) -	{ -		world_map->trackLocation(pos_global); -	} - -	if (gSavedSettings.getBOOL("DoubleClickTeleport")) -	{ -		// If DoubleClickTeleport is on, double clicking the minimap will teleport there -		gAgent.teleportViaLocationLookAt(pos_global); -	} -	else if (gSavedSettings.getBOOL("DoubleClickShowWorldMap")) -	{ -		LLFloaterReg::showInstance("world_map"); -	} -	return true; +    // If floater is minimized, minimap should be shown on doubleclick (STORM-299) +    if (isMinimized()) +    { +        setMinimized(false); +        return true; +    } + +    LLVector3d pos_global = mMap->viewPosToGlobal(x, y); + +    LLTracker::stopTracking(false); +    LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance(); +    if (world_map) +    { +        world_map->trackLocation(pos_global); +    } + +    if (gSavedSettings.getBOOL("DoubleClickTeleport")) +    { +        // If DoubleClickTeleport is on, double clicking the minimap will teleport there +        gAgent.teleportViaLocationLookAt(pos_global); +    } +    else if (gSavedSettings.getBOOL("DoubleClickShowWorldMap")) +    { +        LLFloaterReg::showInstance("world_map"); +    } +    return true;  }  void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation) @@ -189,66 +189,66 @@ void LLFloaterMap::setDirectionPos(LLTextBox *text_box, F32 rotation)  void LLFloaterMap::updateMinorDirections()  { -	if (mTextBoxNorthEast == NULL) -	{ -		return; -	} - -	// Hide minor directions if they cover too much of the map -	bool show_minors = mTextBoxNorthEast->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD * -		llmin(getRect().getWidth(), getRect().getHeight()); - -	mTextBoxNorthEast->setVisible(show_minors); -	mTextBoxNorthWest->setVisible(show_minors); -	mTextBoxSouthWest->setVisible(show_minors); -	mTextBoxSouthEast->setVisible(show_minors); +    if (mTextBoxNorthEast == NULL) +    { +        return; +    } + +    // Hide minor directions if they cover too much of the map +    bool show_minors = mTextBoxNorthEast->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD * +        llmin(getRect().getWidth(), getRect().getHeight()); + +    mTextBoxNorthEast->setVisible(show_minors); +    mTextBoxNorthWest->setVisible(show_minors); +    mTextBoxSouthWest->setVisible(show_minors); +    mTextBoxSouthEast->setVisible(show_minors);  }  // virtual  void LLFloaterMap::draw()  { -	F32 rotation = 0; - -	static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); -	if( rotate_map ) -	{ -		// rotate subsequent draws to agent rotation -		rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); -	} - -	setDirectionPos( mTextBoxEast,  rotation ); -	setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO ); -	setDirectionPos( mTextBoxWest,  rotation + F_PI ); -	setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO ); - -	setDirectionPos( mTextBoxNorthEast, rotation +						F_PI_BY_TWO / 2); -	setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO +		F_PI_BY_TWO / 2); -	setDirectionPos( mTextBoxSouthWest, rotation + F_PI +				F_PI_BY_TWO / 2); -	setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); - -	// Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. -	if(gAgentCamera.cameraMouselook()) -	{ -		setMouseOpaque(false); -		getDragHandle()->setMouseOpaque(false); -	} -	else -	{ -		setMouseOpaque(true); -		getDragHandle()->setMouseOpaque(true); -	} -	 -	LLFloater::draw(); +    F32 rotation = 0; + +    static LLUICachedControl<bool> rotate_map("MiniMapRotate", true); +    if( rotate_map ) +    { +        // rotate subsequent draws to agent rotation +        rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); +    } + +    setDirectionPos( mTextBoxEast,  rotation ); +    setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO ); +    setDirectionPos( mTextBoxWest,  rotation + F_PI ); +    setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO ); + +    setDirectionPos( mTextBoxNorthEast, rotation +                      F_PI_BY_TWO / 2); +    setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO +        F_PI_BY_TWO / 2); +    setDirectionPos( mTextBoxSouthWest, rotation + F_PI +               F_PI_BY_TWO / 2); +    setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); + +    // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong. +    if(gAgentCamera.cameraMouselook()) +    { +        setMouseOpaque(false); +        getDragHandle()->setMouseOpaque(false); +    } +    else +    { +        setMouseOpaque(true); +        getDragHandle()->setMouseOpaque(true); +    } + +    LLFloater::draw();  }  void LLFloaterMap::reshape(S32 width, S32 height, bool called_from_parent)  { -	LLFloater::reshape(width, height, called_from_parent); -	 -	updateMinorDirections(); +    LLFloater::reshape(width, height, called_from_parent); + +    updateMinorDirections();  }  LLFloaterMap* LLFloaterMap::getInstance()  { -	return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map"); +    return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");  }  | 
