diff options
Diffstat (limited to 'indra/newview/llfloatermap.cpp')
-rw-r--r-- | indra/newview/llfloatermap.cpp | 82 |
1 files changed, 57 insertions, 25 deletions
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 5677899dd9..a1d291fea6 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -2,31 +2,25 @@ * @file llfloatermap.cpp * @brief The "mini-map" or radar in the upper right part of the screen. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&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$ */ @@ -53,8 +47,14 @@ // // Constants // -const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; +// The minor cardinal direction labels are hidden if their height is more +// than this proportion of the map. +const F32 MAP_MINOR_DIR_THRESHOLD = 0.07f; +const S32 MAP_PADDING_LEFT = 0; +const S32 MAP_PADDING_TOP = 2; +const S32 MAP_PADDING_RIGHT = 2; +const S32 MAP_PADDING_BOTTOM = 0; // // Member functions // @@ -72,7 +72,6 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) mTextBoxSouthWest(NULL), mMap(NULL) { - //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_map.xml", FALSE); } LLFloaterMap::~LLFloaterMap() @@ -106,6 +105,9 @@ BOOL LLFloaterMap::postBuild() mPopupMenu->setItemEnabled ("Stop Tracking", false); } + stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT + ,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM); + updateMinorDirections(); // Get the drag handle all the way in back @@ -122,7 +124,9 @@ BOOL LLFloaterMap::postBuild() BOOL LLFloaterMap::handleDoubleClick( S32 x, S32 y, MASK mask ) { - LLFloaterReg::showInstance("world_map"); + // If floater is minimized, minimap should be shown on doubleclick (STORM-299) + std::string floater_to_show = this->isMinimized() ? "mini_map" : "world_map"; + LLFloaterReg::showInstance(floater_to_show); return TRUE; } @@ -229,9 +233,26 @@ void LLFloaterMap::onFocusLost() LLPanel::onFocusLost(); } +void LLFloaterMap::stretchMiniMap(S32 width,S32 height) +{ + //fix for ext-7112 + //by default ctrl can't overlap caption area + if(mMap) + { + LLRect map_rect; + map_rect.setLeftTopAndSize( MAP_PADDING_LEFT, getRect().getHeight() - MAP_PADDING_TOP, width, height); + mMap->reshape( width, height, 1); + mMap->setRect(map_rect); + } +} + void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent) { LLFloater::reshape(width, height, called_from_parent); + + stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT + ,height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM); + updateMinorDirections(); } @@ -261,4 +282,15 @@ void LLFloaterMap::handleStopTracking (const LLSD& userdata) LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL)); } } - +void LLFloaterMap::setMinimized(BOOL b) +{ + LLFloater::setMinimized(b); + if(b) + { + setTitle(getString("mini_map_caption")); + } + else + { + setTitle(""); + } +} |