aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloatermap.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloatermap.cpp
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llfloatermap.cpp')
-rw-r--r--linden/indra/newview/llfloatermap.cpp218
1 files changed, 218 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp
new file mode 100644
index 0000000..29c4f08
--- /dev/null
+++ b/linden/indra/newview/llfloatermap.cpp
@@ -0,0 +1,218 @@
1/**
2 * @file llfloatermap.cpp
3 * @brief The "mini-map" or radar in the upper right part of the screen.
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#include "llviewerprecompiledheaders.h"
29
30// self include
31#include "llfloatermap.h"
32
33// Library includes
34#include "llfontgl.h"
35#include "llinventory.h"
36#include "message.h"
37
38// Viewer includes
39#include "llagent.h"
40#include "llcolorscheme.h"
41#include "llviewercontrol.h"
42#include "lldraghandle.h"
43#include "lleconomy.h"
44#include "llfloaterworldmap.h"
45#include "llfocusmgr.h"
46#include "llnetmap.h"
47#include "llregionhandle.h"
48#include "llresizebar.h"
49#include "llresizehandle.h"
50#include "llresmgr.h"
51#include "llsky.h"
52#include "llsliderctrl.h"
53#include "llspinctrl.h"
54#include "llstatgraph.h"
55#include "llstatusbar.h"
56#include "lltextbox.h"
57#include "llui.h"
58#include "llviewermenu.h"
59#include "llviewerparceloverlay.h"
60#include "llviewerregion.h"
61#include "llviewerstats.h"
62#include "viewer.h"
63
64#include "llglheaders.h"
65
66//
67// Constants
68//
69const S32 LEGEND_SIZE = 16;
70
71const S32 HPAD = 4;
72
73const S32 MAP_COMBOBOX_WIDTH = 128;
74const S32 MAP_COMBOBOX_HEIGHT = 20;
75const S32 GO_BTN_WIDTH = 20;
76const S32 SLIDER_WIDTH = LEGEND_SIZE + MAP_COMBOBOX_WIDTH + HPAD + GO_BTN_WIDTH - HPAD;
77const S32 SLIDER_HEIGHT = 16;
78
79const S32 SIM_STAT_WIDTH = 8;
80
81const S32 MAP_SCALE_MIN = 35; // in pixels per sim
82const S32 MAP_SCALE_MAX = 180; // in pixels per sim
83const S32 MAP_SCALE_INCREMENT = 5;
84
85const char MAP_TITLE[] = "";
86
87const S32 NETMAP_MIN_WIDTH = 128;
88const S32 NETMAP_MIN_HEIGHT = 128;
89
90const S32 FLOATERMAP_MIN_WIDTH =
91 SLIDER_WIDTH +
92 2 * (HPAD + LLPANEL_BORDER_WIDTH);
93
94const S32 MORE_BTN_VPAD = 2;
95
96const S32 SPIN_VPAD = 4;
97
98const S32 TRACKING_LABEL_HEIGHT = 16;
99
100const S32 FLOATERMAP_MIN_HEIGHT_LARGE = 60;
101
102//
103// Globals
104//
105LLFloaterMap *gFloaterMap = NULL;
106
107
108
109
110//
111// Member functions
112//
113
114LLFloaterMap::LLFloaterMap(const std::string& name)
115 :
116 LLFloater(name,
117 "FloaterMapRect",
118 MAP_TITLE,
119 TRUE,
120 FLOATERMAP_MIN_WIDTH,
121 FLOATERMAP_MIN_HEIGHT_LARGE,
122 FALSE,
123 FALSE,
124 TRUE) // close button
125{
126 const S32 LEFT = LLPANEL_BORDER_WIDTH;
127 const S32 TOP = mRect.getHeight();
128
129 S32 y = 0;
130
131 // Map itself
132 LLRect map_rect(
133 LEFT,
134 TOP - LLPANEL_BORDER_WIDTH,
135 mRect.getWidth() - LLPANEL_BORDER_WIDTH,
136 y );
137 LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" );
138 mMap = new LLNetMap("Net Map", map_rect, bg_color);
139 mMap->setFollowsAll();
140 addChildAtEnd(mMap);
141
142 // Get the drag handle all the way in back
143 removeChild(mDragHandle);
144 addChildAtEnd(mDragHandle);
145
146 setIsChrome(TRUE);
147}
148
149
150LLFloaterMap::~LLFloaterMap()
151{
152}
153
154
155// virtual
156void LLFloaterMap::setVisible(BOOL visible)
157{
158 LLFloater::setVisible(visible);
159
160 gSavedSettings.setBOOL("ShowMiniMap", visible);
161}
162
163
164// virtual
165void LLFloaterMap::onClose(bool app_quitting)
166{
167 LLFloater::setVisible(FALSE);
168
169 if (!app_quitting)
170 {
171 gSavedSettings.setBOOL("ShowMiniMap", FALSE);
172 }
173}
174
175BOOL LLFloaterMap::canClose()
176{
177 return !gQuit;
178}
179
180
181// virtual
182void LLFloaterMap::draw()
183{
184 if( getVisible() )
185 {
186 // Note: we can't just gAgent.check cameraMouselook() because the transition states are wrong.
187 if( gAgent.cameraMouselook())
188 {
189 setMouseOpaque(FALSE);
190 mDragHandle->setMouseOpaque(FALSE);
191
192 drawChild(mMap);
193 }
194 else
195 {
196 setMouseOpaque(TRUE);
197 mDragHandle->setMouseOpaque(TRUE);
198
199 LLFloater::draw();
200 }
201 }
202}
203
204// static
205void LLFloaterMap::toggle(void*)
206{
207 if( gFloaterMap )
208 {
209 if (gFloaterMap->getVisible())
210 {
211 gFloaterMap->close();
212 }
213 else
214 {
215 gFloaterMap->open();
216 }
217 }
218}