aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-06-09 09:41:04 -0700
committerMcCabe Maxsted2009-06-09 09:41:04 -0700
commite5dbb8e4dc05e664102362685ddca94f37cdf575 (patch)
tree93e695263553adadc423cf7e7d2e4b046adb8a7a
parentFixed the Resident Chooser showing hair instead of calling cards (diff)
downloadmeta-impy-e5dbb8e4dc05e664102362685ddca94f37cdf575.zip
meta-impy-e5dbb8e4dc05e664102362685ddca94f37cdf575.tar.gz
meta-impy-e5dbb8e4dc05e664102362685ddca94f37cdf575.tar.bz2
meta-impy-e5dbb8e4dc05e664102362685ddca94f37cdf575.tar.xz
Backported 1.23's minimap conversion to XUI
-rw-r--r--ChangeLog.txt26
-rw-r--r--linden/indra/llui/llui.cpp12
-rw-r--r--linden/indra/llui/llui.h1
-rw-r--r--linden/indra/newview/CMakeLists.txt3
-rw-r--r--linden/indra/newview/llagent.cpp6
-rw-r--r--linden/indra/newview/llcolorscheme.cpp11
-rw-r--r--linden/indra/newview/llcolorscheme.h3
-rw-r--r--linden/indra/newview/llfloatermap.cpp142
-rw-r--r--linden/indra/newview/llfloatermap.h28
-rw-r--r--linden/indra/newview/llmenucommands.cpp2
-rw-r--r--linden/indra/newview/llnetmap.cpp399
-rw-r--r--linden/indra/newview/llnetmap.h89
-rw-r--r--linden/indra/newview/llstartup.cpp10
-rw-r--r--linden/indra/newview/llviewercontrol.cpp8
-rw-r--r--linden/indra/newview/llviewermenu.cpp19
-rw-r--r--linden/indra/newview/llviewerobject.cpp1
-rw-r--r--linden/indra/newview/llviewerregion.cpp1
-rw-r--r--linden/indra/newview/llviewerwindow.cpp12
-rw-r--r--linden/indra/newview/llworldmapview.cpp9
-rw-r--r--linden/indra/newview/skins/default/colors_base.xml19
-rw-r--r--linden/indra/newview/skins/silver/colors_base.xml15
21 files changed, 366 insertions, 450 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index cc2de88..8566125 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,29 @@
12009-06-09 McCabe Maxsted <hakushakukun@gmail.com>
2
3 * Backported 1.23's minimap conversion to XUI.
4
5 modified: indra/llui/llui.cpp
6 modified: indra/llui/llui.h
7 modified: indra/newview/CMakeLists.txt
8 modified: indra/newview/llagent.cpp
9 modified: indra/newview/llcolorscheme.cpp
10 modified: indra/newview/llcolorscheme.h
11 modified: indra/newview/llfloatermap.cpp
12 modified: indra/newview/llfloatermap.h
13 modified: indra/newview/llmenucommands.cpp
14 modified: indra/newview/llnetmap.cpp
15 modified: indra/newview/llnetmap.h
16 modified: indra/newview/llstartup.cpp
17 modified: indra/newview/llviewercontrol.cpp
18 modified: indra/newview/llviewermenu.cpp
19 modified: indra/newview/llviewerobject.cpp
20 modified: indra/newview/llviewerregion.cpp
21 modified: indra/newview/llviewerwindow.cpp
22 modified: indra/newview/llworldmapview.cpp
23 modified: indra/newview/skins/default/colors_base.xml
24 modified: indra/newview/skins/silver/colors_base.xml
25
26
12009-06-08 McCabe Maxsted <hakushakukun@gmail.com> 272009-06-08 McCabe Maxsted <hakushakukun@gmail.com>
2 28
3 * Changed 'IM Received' button to '__ New IMs'. 29 * Changed 'IM Received' button to '__ New IMs'.
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp
index f3e73fd..8a7b80e 100644
--- a/linden/indra/llui/llui.cpp
+++ b/linden/indra/llui/llui.cpp
@@ -1645,6 +1645,18 @@ void LLUI::setCursorPositionLocal(const LLView* viewp, S32 x, S32 y)
1645 setCursorPositionScreen(screen_x, screen_y); 1645 setCursorPositionScreen(screen_x, screen_y);
1646} 1646}
1647 1647
1648//static
1649void LLUI::getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y)
1650{
1651 LLCoordWindow cursor_pos_window;
1652 LLView::getWindow()->getCursorPosition(&cursor_pos_window);
1653 LLCoordGL cursor_pos_gl;
1654 LLView::getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl);
1655 cursor_pos_gl.mX = llround((F32)cursor_pos_gl.mX / LLUI::sGLScaleFactor.mV[VX]);
1656 cursor_pos_gl.mY = llround((F32)cursor_pos_gl.mY / LLUI::sGLScaleFactor.mV[VY]);
1657 viewp->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, x, y);
1658}
1659
1648// On Windows, the user typically sets the language when they install the 1660// On Windows, the user typically sets the language when they install the
1649// app (by running it with a shortcut that sets InstallLanguage). On Mac, 1661// app (by running it with a shortcut that sets InstallLanguage). On Mac,
1650// or on Windows if the SecondLife.exe executable is run directly, the 1662// or on Windows if the SecondLife.exe executable is run directly, the
diff --git a/linden/indra/llui/llui.h b/linden/indra/llui/llui.h
index 1e731f1..b51b132 100644
--- a/linden/indra/llui/llui.h
+++ b/linden/indra/llui/llui.h
@@ -175,6 +175,7 @@ public:
175 static std::string locateSkin(const std::string& filename); 175 static std::string locateSkin(const std::string& filename);
176 static void setCursorPositionScreen(S32 x, S32 y); 176 static void setCursorPositionScreen(S32 x, S32 y);
177 static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y); 177 static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y);
178 static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y);
178 static void setScaleFactor(const LLVector2& scale_factor); 179 static void setScaleFactor(const LLVector2& scale_factor);
179 static void setLineWidth(F32 width); 180 static void setLineWidth(F32 width);
180 static LLUIImage* getUIImage(const std::string& name); 181 static LLUIImage* getUIImage(const std::string& name);
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index 93c6e5f..34aa29f 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -1070,6 +1070,7 @@ set(viewer_XUI_FILES
1070 skins/default/xui/en-us/floater_live_lsleditor.xml 1070 skins/default/xui/en-us/floater_live_lsleditor.xml
1071 skins/default/xui/en-us/floater_lsl_guide.xml 1071 skins/default/xui/en-us/floater_lsl_guide.xml
1072 skins/default/xui/en-us/floater_media_browser.xml 1072 skins/default/xui/en-us/floater_media_browser.xml
1073 skins/default/xui/en-us/floater_mini_map.xml
1073 skins/default/xui/en-us/floater_moveview.xml 1074 skins/default/xui/en-us/floater_moveview.xml
1074 skins/default/xui/en-us/floater_mute_object.xml 1075 skins/default/xui/en-us/floater_mute_object.xml
1075 skins/default/xui/en-us/floater_mute.xml 1076 skins/default/xui/en-us/floater_mute.xml
@@ -1125,6 +1126,7 @@ set(viewer_XUI_FILES
1125 skins/default/xui/en-us/floater_world_map.xml 1126 skins/default/xui/en-us/floater_world_map.xml
1126 skins/default/xui/en-us/menu_inventory.xml 1127 skins/default/xui/en-us/menu_inventory.xml
1127 skins/default/xui/en-us/menu_login.xml 1128 skins/default/xui/en-us/menu_login.xml
1129 skins/default/xui/en-us/menu_mini_map.xml
1128 skins/default/xui/en-us/menu_pie_attachment.xml 1130 skins/default/xui/en-us/menu_pie_attachment.xml
1129 skins/default/xui/en-us/menu_pie_avatar.xml 1131 skins/default/xui/en-us/menu_pie_avatar.xml
1130 skins/default/xui/en-us/menu_pie_hud.xml 1132 skins/default/xui/en-us/menu_pie_hud.xml
@@ -1162,6 +1164,7 @@ set(viewer_XUI_FILES
1162 skins/default/xui/en-us/panel_media_controls.xml 1164 skins/default/xui/en-us/panel_media_controls.xml
1163 skins/default/xui/en-us/panel_media_remote_expanded.xml 1165 skins/default/xui/en-us/panel_media_remote_expanded.xml
1164 skins/default/xui/en-us/panel_media_remote.xml 1166 skins/default/xui/en-us/panel_media_remote.xml
1167 skins/default/xui/en-us/panel_mini_map.xml
1165 skins/default/xui/en-us/panel_overlaybar.xml 1168 skins/default/xui/en-us/panel_overlaybar.xml
1166 skins/default/xui/en-us/panel_place_small.xml 1169 skins/default/xui/en-us/panel_place_small.xml
1167 skins/default/xui/en-us/panel_place.xml 1170 skins/default/xui/en-us/panel_place.xml
diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 89ba09c..5f0a875 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -2816,7 +2816,7 @@ U8 LLAgent::getRenderState()
2816static const LLFloaterView::skip_list_t& get_skip_list() 2816static const LLFloaterView::skip_list_t& get_skip_list()
2817{ 2817{
2818 static LLFloaterView::skip_list_t skip_list; 2818 static LLFloaterView::skip_list_t skip_list;
2819 skip_list.insert(gFloaterMap); 2819 skip_list.insert(LLFloaterMap::getInstance());
2820 return skip_list; 2820 return skip_list;
2821} 2821}
2822 2822
@@ -2894,7 +2894,7 @@ void LLAgent::endAnimationUpdateUI()
2894 // let the mini-map go visible again. JC 2894 // let the mini-map go visible again. JC
2895 if (!LLAppViewer::instance()->quitRequested()) 2895 if (!LLAppViewer::instance()->quitRequested())
2896 { 2896 {
2897 gFloaterMap->popVisible(); 2897 LLFloaterMap::getInstance()->popVisible();
2898 } 2898 }
2899 2899
2900 if( gMorphView ) 2900 if( gMorphView )
@@ -2991,7 +2991,7 @@ void LLAgent::endAnimationUpdateUI()
2991 { 2991 {
2992 LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); 2992 LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
2993 2993
2994 gFloaterMap->pushVisible(FALSE); 2994 LLFloaterMap::getInstance()->pushVisible(FALSE);
2995 /* 2995 /*
2996 LLView *view; 2996 LLView *view;
2997 for (view = gFloaterView->getFirstChild(); view; view = gFloaterView->getNextChild()) 2997 for (view = gFloaterView->getFirstChild(); view; view = gFloaterView->getNextChild())
diff --git a/linden/indra/newview/llcolorscheme.cpp b/linden/indra/newview/llcolorscheme.cpp
index 3b12acf..07c3e75 100644
--- a/linden/indra/newview/llcolorscheme.cpp
+++ b/linden/indra/newview/llcolorscheme.cpp
@@ -36,12 +36,9 @@
36#include "llviewercontrol.h" 36#include "llviewercontrol.h"
37 37
38LLColor4 gTrackColor; 38LLColor4 gTrackColor;
39LLColor4 gSelfMapColor;
40LLColor4 gLandmarkMapColor; 39LLColor4 gLandmarkMapColor;
41LLColor4 gLocationMapColor; 40LLColor4 gLocationMapColor;
42LLColor4 gTelehubMapColor; 41LLColor4 gTelehubMapColor;
43LLColor4 gFrustumMapColor;
44LLColor4 gRotatingFrustumMapColor;
45LLColor4 gEventColor; 42LLColor4 gEventColor;
46LLColor4 gPopularColor; 43LLColor4 gPopularColor;
47LLColor4 gPickColor; 44LLColor4 gPickColor;
@@ -52,17 +49,9 @@ void init_colors()
52{ 49{
53 gTrackColor = LLColor4::red; 50 gTrackColor = LLColor4::red;
54 gDisabledTrackColor.setVec( 0.5f, 0.f, 0.f, 1.f ); 51 gDisabledTrackColor.setVec( 0.5f, 0.f, 0.f, 1.f );
55
56 gSelfMapColor = LLColor4::white;
57
58 // fleshy color
59 //gAvatarMapColor.setVec( 255.f/255.f, 223.f/255.f, 170.f/255.f, 1.f);
60
61 gLandmarkMapColor = LLColor4::red; 52 gLandmarkMapColor = LLColor4::red;
62 gLocationMapColor.setVec( 0.f, 0.72f, 1.f, 1.f); 53 gLocationMapColor.setVec( 0.f, 0.72f, 1.f, 1.f);
63 gTelehubMapColor.setVec( 0.9f, 0.9f, 0.f, 1.f); // dk yellow 54 gTelehubMapColor.setVec( 0.9f, 0.9f, 0.f, 1.f); // dk yellow
64 gFrustumMapColor.setVec( 1.f, 1.f, 1.f, 0.08f);
65 gRotatingFrustumMapColor.setVec(1.f, 1.f, 1.f, 0.2f);
66 gEventColor.setVec( 1.f, 0.5f, 1.f, 1.f ); 55 gEventColor.setVec( 1.f, 0.5f, 1.f, 1.f );
67 gPopularColor.setVec( 1.f, 0.0f, 0.f, 1.f ); 56 gPopularColor.setVec( 1.f, 0.0f, 0.f, 1.f );
68 gPickColor.setVec( 1.f, 0.0f, 0.f, 1.f ); 57 gPickColor.setVec( 1.f, 0.0f, 0.f, 1.f );
diff --git a/linden/indra/newview/llcolorscheme.h b/linden/indra/newview/llcolorscheme.h
index 9660042..aef3880 100644
--- a/linden/indra/newview/llcolorscheme.h
+++ b/linden/indra/newview/llcolorscheme.h
@@ -35,12 +35,9 @@
35#include "v4color.h" 35#include "v4color.h"
36 36
37extern LLColor4 gTrackColor; 37extern LLColor4 gTrackColor;
38extern LLColor4 gSelfMapColor;
39extern LLColor4 gLandmarkMapColor; 38extern LLColor4 gLandmarkMapColor;
40extern LLColor4 gLocationMapColor; 39extern LLColor4 gLocationMapColor;
41extern LLColor4 gTelehubMapColor; 40extern LLColor4 gTelehubMapColor;
42extern LLColor4 gFrustumMapColor;
43extern LLColor4 gRotatingFrustumMapColor;
44extern LLColor4 gEventColor; 41extern LLColor4 gEventColor;
45extern LLColor4 gPopularColor; 42extern LLColor4 gPopularColor;
46extern LLColor4 gPickColor; 43extern LLColor4 gPickColor;
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp
index b1aa6c7..6115404 100644
--- a/linden/indra/newview/llfloatermap.cpp
+++ b/linden/indra/newview/llfloatermap.cpp
@@ -31,120 +31,43 @@
31 31
32#include "llviewerprecompiledheaders.h" 32#include "llviewerprecompiledheaders.h"
33 33
34// self include
35#include "llfloatermap.h" 34#include "llfloatermap.h"
36 35
37// Library includes
38#include "llfontgl.h"
39#include "llinventory.h"
40#include "message.h"
41
42// Viewer includes
43#include "llagent.h" 36#include "llagent.h"
44#include "llcolorscheme.h" 37#include "llcolorscheme.h"
45#include "llviewercontrol.h" 38#include "llviewercontrol.h"
46#include "lldraghandle.h" 39#include "lldraghandle.h"
47#include "lleconomy.h"
48#include "llfloaterworldmap.h"
49#include "llfocusmgr.h"
50#include "llnetmap.h" 40#include "llnetmap.h"
51#include "llregionhandle.h" 41#include "llregionhandle.h"
52#include "llresizebar.h" 42#include "llresizebar.h"
53#include "llresizehandle.h" 43#include "lluictrlfactory.h"
54#include "llresmgr.h"
55#include "llsky.h"
56#include "llsliderctrl.h"
57#include "llspinctrl.h"
58#include "llstatgraph.h"
59#include "llstatusbar.h"
60//#include "lltextbox.h"
61#include "llui.h"
62#include "llviewermenu.h"
63#include "llviewerparceloverlay.h"
64#include "llviewerregion.h"
65#include "llviewerstats.h"
66#include "llurlsimstring.h"
67
68#include "llglheaders.h"
69
70//
71// Constants
72//
73const S32 LEGEND_SIZE = 16;
74
75const S32 HPAD = 4;
76
77const S32 MAP_COMBOBOX_WIDTH = 128;
78const S32 MAP_COMBOBOX_HEIGHT = 20;
79const S32 GO_BTN_WIDTH = 20;
80const S32 SLIDER_WIDTH = LEGEND_SIZE + MAP_COMBOBOX_WIDTH + HPAD + GO_BTN_WIDTH - HPAD;
81const S32 SLIDER_HEIGHT = 16;
82
83const S32 SIM_STAT_WIDTH = 8;
84
85const S32 MAP_SCALE_MIN = 35; // in pixels per sim
86const S32 MAP_SCALE_MAX = 180; // in pixels per sim
87const S32 MAP_SCALE_INCREMENT = 5;
88
89const S32 NETMAP_MIN_WIDTH = 128;
90const S32 NETMAP_MIN_HEIGHT = 128;
91
92const S32 FLOATERMAP_MIN_WIDTH =
93 SLIDER_WIDTH +
94 2 * (HPAD + LLPANEL_BORDER_WIDTH);
95
96const S32 MORE_BTN_VPAD = 2;
97
98const S32 SPIN_VPAD = 4;
99
100const S32 TRACKING_LABEL_HEIGHT = 16;
101
102const S32 FLOATERMAP_MIN_HEIGHT_LARGE = 60;
103
104//
105// Globals
106//
107LLFloaterMap *gFloaterMap = NULL;
108
109 44
45LLFloaterMap::LLFloaterMap(const LLSD& key)
46 :
47 LLFloater(std::string("minimap")),
48 mPanelMap(NULL)
49{
50 LLCallbackMap::map_t factory_map;
51 factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this);
52 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE);
53}
110 54
111 55
112// 56// static
113// Member functions 57void* LLFloaterMap::createPanelMiniMap(void* data)
114// 58{
59 LLFloaterMap* self = (LLFloaterMap*)data;
60 self->mPanelMap = new LLNetMap("Mapview");
61 return self->mPanelMap;
62}
115 63
116LLFloaterMap::LLFloaterMap(const std::string& name) 64BOOL LLFloaterMap::postBuild()
117 :
118 LLFloater(name,
119 std::string("FloaterMiniMapRect"),
120 LLStringUtil::null,
121 TRUE,
122 FLOATERMAP_MIN_WIDTH,
123 FLOATERMAP_MIN_HEIGHT_LARGE,
124 FALSE,
125 FALSE,
126 TRUE) // close button
127{ 65{
128 const S32 LEFT = LLPANEL_BORDER_WIDTH; 66 // Send the drag handle to the back, but make sure close stays on top
129 const S32 TOP = getRect().getHeight();
130
131 S32 y = 0;
132
133 // Map itself
134 LLRect map_rect(
135 LEFT,
136 TOP - LLPANEL_BORDER_WIDTH,
137 getRect().getWidth() - LLPANEL_BORDER_WIDTH,
138 y );
139 LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" );
140 mMap = new LLNetMap("Net Map", map_rect, bg_color);
141 mMap->setFollowsAll();
142 addChildAtEnd(mMap);
143
144 // Get the drag handle all the way in back
145 sendChildToBack(getDragHandle()); 67 sendChildToBack(getDragHandle());
146 68 sendChildToFront(getChild<LLButton>("llfloater_close_btn"));
147 setIsChrome(TRUE); 69 setIsChrome(TRUE);
70 return TRUE;
148} 71}
149 72
150 73
@@ -154,11 +77,11 @@ LLFloaterMap::~LLFloaterMap()
154 77
155 78
156// virtual 79// virtual
157void LLFloaterMap::setVisible(BOOL visible) 80void LLFloaterMap::onOpen()
158{ 81{
159 LLFloater::setVisible(visible); 82 gFloaterView->adjustToFitScreen(this, FALSE);
160 83
161 gSavedSettings.setBOOL("ShowMiniMap", visible); 84 gSavedSettings.setBOOL("ShowMiniMap", TRUE);
162} 85}
163 86
164 87
@@ -188,7 +111,7 @@ void LLFloaterMap::draw()
188 setMouseOpaque(FALSE); 111 setMouseOpaque(FALSE);
189 getDragHandle()->setMouseOpaque(FALSE); 112 getDragHandle()->setMouseOpaque(FALSE);
190 113
191 drawChild(mMap); 114 drawChild(mPanelMap);
192 } 115 }
193 else 116 else
194 { 117 {
@@ -199,18 +122,3 @@ void LLFloaterMap::draw()
199 } 122 }
200} 123}
201 124
202// static
203void LLFloaterMap::toggle(void*)
204{
205 if( gFloaterMap )
206 {
207 if (gFloaterMap->getVisible())
208 {
209 gFloaterMap->close();
210 }
211 else
212 {
213 gFloaterMap->open(); /* Flawfinder: ignore */
214 }
215 }
216}
diff --git a/linden/indra/newview/llfloatermap.h b/linden/indra/newview/llfloatermap.h
index 91226dd..dd1cba8 100644
--- a/linden/indra/newview/llfloatermap.h
+++ b/linden/indra/newview/llfloatermap.h
@@ -36,32 +36,26 @@
36 36
37class LLNetMap; 37class LLNetMap;
38 38
39// 39class LLFloaterMap :
40// Classes 40 public LLFloater,
41// 41 public LLFloaterSingleton<LLFloaterMap>
42class LLFloaterMap
43: public LLFloater
44{ 42{
43 friend class LLUISingleton<LLFloaterMap, VisibilityPolicy<LLFloater> >;
45public: 44public:
46 LLFloaterMap(const std::string& name);
47 virtual ~LLFloaterMap(); 45 virtual ~LLFloaterMap();
48 46
49 static void toggle(void*); 47 static void* createPanelMiniMap(void* data);
48
49 BOOL postBuild();
50 50
51 /*virtual*/ void setVisible(BOOL visible);
52 /*virtual*/ void draw(); 51 /*virtual*/ void draw();
52 /*virtual*/ void onOpen();
53 /*virtual*/ void onClose(bool app_quitting); 53 /*virtual*/ void onClose(bool app_quitting);
54 /*virtual*/ BOOL canClose(); 54 /*virtual*/ BOOL canClose();
55 55
56protected: 56private:
57 LLNetMap* mMap; 57 LLFloaterMap(const LLSD& key = LLSD());
58 LLNetMap* mPanelMap;
58}; 59};
59 60
60
61//
62// Globals
63//
64
65extern LLFloaterMap *gFloaterMap;
66
67#endif // LL_LLFLOATERMAP_H 61#endif // LL_LLFLOATERMAP_H
diff --git a/linden/indra/newview/llmenucommands.cpp b/linden/indra/newview/llmenucommands.cpp
index 2275047..8c4a3b1 100644
--- a/linden/indra/newview/llmenucommands.cpp
+++ b/linden/indra/newview/llmenucommands.cpp
@@ -95,7 +95,7 @@ void handle_map(void*)
95 95
96void handle_mini_map(void*) 96void handle_mini_map(void*)
97{ 97{
98 LLFloaterMap::toggle(NULL); 98 LLFloaterMap::toggleInstance();
99} 99}
100 100
101 101
diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp
index cedabf7..71eb35b 100644
--- a/linden/indra/newview/llnetmap.cpp
+++ b/linden/indra/newview/llnetmap.cpp
@@ -44,22 +44,20 @@
44#include "llcallingcard.h" 44#include "llcallingcard.h"
45#include "llcolorscheme.h" 45#include "llcolorscheme.h"
46#include "llviewercontrol.h" 46#include "llviewercontrol.h"
47#include "llfloateravatarinfo.h"
47#include "llfloaterworldmap.h" 48#include "llfloaterworldmap.h"
48#include "llfloatermap.h"
49#include "llframetimer.h" 49#include "llframetimer.h"
50#include "lltracker.h" 50#include "lltracker.h"
51#include "llmenugl.h" 51#include "llmenugl.h"
52#include "llstatgraph.h"
53#include "llsurface.h" 52#include "llsurface.h"
54#include "lltextbox.h" 53#include "lltextbox.h"
54#include "lluictrlfactory.h"
55#include "lluuid.h" 55#include "lluuid.h"
56#include "llviewercamera.h" 56#include "llviewercamera.h"
57#include "llviewerimage.h" 57#include "llviewerimage.h"
58#include "llviewerimagelist.h" 58#include "llviewerimagelist.h"
59#include "llviewermenu.h" 59#include "llviewermenu.h"
60#include "llviewerobjectlist.h" 60#include "llviewerobjectlist.h"
61#include "llviewermenu.h"
62#include "llviewerparceloverlay.h"
63#include "llviewerregion.h" 61#include "llviewerregion.h"
64#include "llviewerwindow.h" 62#include "llviewerwindow.h"
65#include "llvoavatar.h" 63#include "llvoavatar.h"
@@ -73,19 +71,14 @@ const F32 MAP_SCALE_MIN = 32;
73const F32 MAP_SCALE_MID = 172; 71const F32 MAP_SCALE_MID = 172;
74const F32 MAP_SCALE_MAX = 512; 72const F32 MAP_SCALE_MAX = 512;
75const F32 MAP_SCALE_INCREMENT = 16; 73const F32 MAP_SCALE_INCREMENT = 16;
74const F32 MAP_MIN_PICK_DIST = 4;
75const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
76 76
77const S32 TRACKING_RADIUS = 3; 77const S32 TRACKING_RADIUS = 3;
78 78
79//static 79LLNetMap::LLNetMap(const std::string& name) :
80BOOL LLNetMap::sRotateMap = FALSE; 80 LLPanel(name),
81LLNetMap* LLNetMap::sInstance = NULL; 81 mScale(128.f),
82
83LLNetMap::LLNetMap(
84 const std::string& name,
85 const LLRect& rect,
86 const LLColor4& bg_color )
87 :
88 LLUICtrl(name, rect, FALSE, NULL, NULL), mBackgroundColor( bg_color ),
89 mObjectMapTPM(1.f), 82 mObjectMapTPM(1.f),
90 mObjectMapPixels(255.f), 83 mObjectMapPixels(255.f),
91 mTargetPanX( 0.f ), 84 mTargetPanX( 0.f ),
@@ -94,109 +87,57 @@ LLNetMap::LLNetMap(
94 mCurPanY( 0.f ), 87 mCurPanY( 0.f ),
95 mUpdateNow( FALSE ) 88 mUpdateNow( FALSE )
96{ 89{
97 mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS; 90 mScale = gSavedSettings.getF32("MiniMapScale");
98 91 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
99 LLNetMap::sRotateMap = gSavedSettings.getBOOL( "MiniMapRotate" );
100
101 glyph_color_avatar = gColors.getColor("NetMapGlyphColorAvatar");
102 glyph_color_friend = gColors.getColor("NetMapGlyphColorFriend");
103
104 // Surface texture is dynamically generated/updated.
105// createObjectImage();
106 92
107 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); 93 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
108 94
109 // TODO: exteralize hardcoded constants. 95 // Register event listeners for popup menu
110 const S32 DIR_WIDTH = 10; 96 (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel");
111 const S32 DIR_HEIGHT = 10; 97 (new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
112 LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); 98 (new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
113 const LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); 99 (new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile");
114 const LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); 100 (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile");
115 101
116 // Note: removing special treatment for north compass point (DEV-10559). -MG 102 LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml");
117 //mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); 103
118 //mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); 104 updateMinorDirections();
119 //addChild( mTextBoxNorth ); 105
120 mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); 106 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this);
121 mTextBoxNorth->setColor( minor_color ); 107 if (!menu)
122 addChild( mTextBoxNorth ); 108 {
123 109 menu = new LLMenuGL(LLStringUtil::null);
124 mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); 110 }
125 mTextBoxEast->setColor( minor_color );
126 addChild( mTextBoxEast );
127
128 major_dir_rect.mRight += 1 ;
129 mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect );
130 mTextBoxWest->setColor( minor_color );
131 addChild( mTextBoxWest );
132 major_dir_rect.mRight -= 1 ;
133
134 mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect );
135 mTextBoxSouth->setColor( minor_color );
136 addChild( mTextBoxSouth );
137
138 mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect );
139 mTextBoxSouthEast->setColor( minor_color );
140 addChild( mTextBoxSouthEast );
141
142 mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect );
143 mTextBoxNorthEast->setColor( minor_color );
144 addChild( mTextBoxNorthEast );
145
146 mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect );
147 mTextBoxSouthWest->setColor( minor_color );
148 addChild( mTextBoxSouthWest );
149
150 mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect );
151 mTextBoxNorthWest->setColor( minor_color );
152 addChild( mTextBoxNorthWest );
153
154 // Right-click menu
155 LLMenuGL* menu;
156 menu = new LLMenuGL(std::string("popup"));
157 menu->setCanTearOff(FALSE);
158 menu->append(new LLMenuItemCallGL(std::string("Zoom Close"), handleZoomLevel,
159 NULL, (void*)2) );
160 menu->append(new LLMenuItemCallGL(std::string("Zoom Medium"), handleZoomLevel,
161 NULL, (void*)1) );
162 menu->append(new LLMenuItemCallGL(std::string("Zoom Far"), handleZoomLevel,
163 NULL, (void*)0) );
164 menu->appendSeparator();
165 menu->append(new LLMenuItemCallGL(std::string("Stop Tracking"), &LLTracker::stopTracking,
166 &LLTracker::isTracking, NULL) );
167 menu->setVisible(FALSE); 111 menu->setVisible(FALSE);
168 addChild(menu);
169 mPopupMenuHandle = menu->getHandle(); 112 mPopupMenuHandle = menu->getHandle();
170
171 sInstance = this;
172} 113}
173 114
174LLNetMap::~LLNetMap() 115LLNetMap::~LLNetMap()
175{ 116{
176 sInstance = NULL;
177} 117}
178 118
179void LLNetMap::setScale( F32 scale ) 119void LLNetMap::setScale( F32 scale )
180{ 120{
181 gMiniMapScale = scale; 121 mScale = scale;
182 if (gMiniMapScale == 0.f) 122 if (mScale == 0.f)
183 { 123 {
184 gMiniMapScale = 0.1f; 124 mScale = 0.1f;
185 } 125 }
126 gSavedSettings.setF32("MiniMapScale", mScale);
186 127
187 if (mObjectImagep.notNull()) 128 if (mObjectImagep.notNull())
188 { 129 {
189 F32 half_width = (F32)(getRect().getWidth() / 2); 130 F32 width = (F32)(getRect().getWidth());
190 F32 half_height = (F32)(getRect().getHeight() / 2); 131 F32 height = (F32)(getRect().getHeight());
191 F32 radius = sqrt( half_width * half_width + half_height * half_height ); 132 F32 diameter = sqrt(width * width + height * height);
192 F32 region_widths = (2.f*radius)/gMiniMapScale; 133 F32 region_widths = diameter / mScale;
193 F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); 134 F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters();
194 F32 num_pixels = (F32)mObjectImagep->getWidth(); 135 F32 num_pixels = (F32)mObjectImagep->getWidth();
195 mObjectMapTPM = num_pixels/meters; 136 mObjectMapTPM = num_pixels / meters;
196 mObjectMapPixels = 2.f*radius; 137 mObjectMapPixels = diameter;
197 } 138 }
198 139
199 mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS; 140 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
200 141
201 mUpdateNow = TRUE; 142 mUpdateNow = TRUE;
202} 143}
@@ -218,16 +159,16 @@ void LLNetMap::draw()
218 { 159 {
219 createObjectImage(); 160 createObjectImage();
220 } 161 }
221 162
222 mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); 163 mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f));
223 mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); 164 mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f));
224 165
225 // Prepare a scissor region
226 F32 rotation = 0; 166 F32 rotation = 0;
227 167
168 // Prepare a scissor region
228 { 169 {
229 LLGLEnable scissor(GL_SCISSOR_TEST); 170 LLGLEnable scissor(GL_SCISSOR_TEST);
230 171
231 { 172 {
232 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); 173 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
233 LLLocalClipRect clip(getLocalRect()); 174 LLLocalClipRect clip(getLocalRect());
@@ -235,8 +176,11 @@ void LLNetMap::draw()
235 glMatrixMode(GL_MODELVIEW); 176 glMatrixMode(GL_MODELVIEW);
236 177
237 // Draw background rectangle 178 // Draw background rectangle
238 gGL.color4fv( mBackgroundColor.mV ); 179 if(isBackgroundVisible())
239 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); 180 {
181 gGL.color4fv(isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV);
182 gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0);
183 }
240 } 184 }
241 185
242 // region 0,0 is in the middle 186 // region 0,0 is in the middle
@@ -247,7 +191,8 @@ void LLNetMap::draw()
247 191
248 gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); 192 gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f);
249 193
250 if( LLNetMap::sRotateMap ) 194 BOOL rotate_map = gSavedSettings.getBOOL( "MiniMapRotate" );
195 if( rotate_map )
251 { 196 {
252 // rotate subsequent draws to agent rotation 197 // rotate subsequent draws to agent rotation
253 rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); 198 rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
@@ -256,35 +201,30 @@ void LLNetMap::draw()
256 201
257 // figure out where agent is 202 // figure out where agent is
258 S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); 203 S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters());
204 LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" );
205 LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" );
206 LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" );
259 207
260 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 208 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
261 iter != LLWorld::getInstance()->getRegionList().end(); ++iter) 209 iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
262 { 210 {
263 LLViewerRegion* regionp = *iter; 211 LLViewerRegion* regionp = *iter;
264 // Find x and y position relative to camera's center. 212 // Find x and y position relative to camera's center.
265 LLVector3 origin_agent = regionp->getOriginAgent(); 213 LLVector3 origin_agent = regionp->getOriginAgent();
266 LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent(); 214 LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent();
267 F32 relative_x = (rel_region_pos.mV[0] / region_width) * gMiniMapScale; 215 F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale;
268 F32 relative_y = (rel_region_pos.mV[1] / region_width) * gMiniMapScale; 216 F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale;
269 217
270 // background region rectangle 218 // background region rectangle
271 F32 bottom = relative_y; 219 F32 bottom = relative_y;
272 F32 left = relative_x; 220 F32 left = relative_x;
273 F32 top = bottom + gMiniMapScale ; 221 F32 top = bottom + mScale ;
274 F32 right = left + gMiniMapScale ; 222 F32 right = left + mScale ;
275
276 if (regionp == gAgent.getRegion())
277 {
278 gGL.color4f(1.f, 1.f, 1.f, 1.f);
279 }
280 else
281 {
282 gGL.color4f(0.8f, 0.8f, 0.8f, 1.f);
283 }
284 223
224 gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV);
285 if (!regionp->isAlive()) 225 if (!regionp->isAlive())
286 { 226 {
287 gGL.color4f(1.f, 0.5f, 0.5f, 1.f); 227 gGL.color4fv(dead_region_color.mV);
288 } 228 }
289 229
290 230
@@ -350,8 +290,8 @@ void LLNetMap::draw()
350 290
351 LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); 291 LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal);
352 map_center_agent -= gAgent.getCameraPositionAgent(); 292 map_center_agent -= gAgent.getCameraPositionAgent();
353 map_center_agent.mV[VX] *= gMiniMapScale/region_width; 293 map_center_agent.mV[VX] *= mScale/region_width;
354 map_center_agent.mV[VY] *= gMiniMapScale/region_width; 294 map_center_agent.mV[VY] *= mScale/region_width;
355 295
356 gGL.getTexUnit(0)->bind(mObjectImagep); 296 gGL.getTexUnit(0)->bind(mObjectImagep);
357 F32 image_half_width = 0.5f*mObjectMapPixels; 297 F32 image_half_width = 0.5f*mObjectMapPixels;
@@ -373,81 +313,67 @@ void LLNetMap::draw()
373 LLVector3d pos_global; 313 LLVector3d pos_global;
374 LLVector3 pos_map; 314 LLVector3 pos_map;
375 315
316 // Mouse pointer in local coordinates
317 S32 local_mouse_x;
318 S32 local_mouse_y;
319 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
320 mClosestAgentToCursor.setNull();
321 F32 closest_dist = F32_MAX;
322
376 // Draw avatars 323 // Draw avatars
377 for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 324 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
378 iter != LLWorld::getInstance()->getRegionList().end(); ++iter) 325 LLColor4 friend_color = gColors.getColor( "MapFriend" );
326 std::vector<LLUUID> avatar_ids;
327 std::vector<LLVector3d> positions;
328 LLWorld::getInstance()->getAvatars(&avatar_ids, &positions);
329 for(U32 i=0; i<avatar_ids.size(); i++)
379 { 330 {
380 LLViewerRegion* regionp = *iter;
381 const LLVector3d& origin_global = regionp->getOriginGlobal();
382
383 S32 count = regionp->mMapAvatars.count();
384 S32 i;
385 LLVector3 pos_local;
386 U32 compact_local;
387 U8 bits;
388 // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. 331 // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
389 // just be careful to sort the avatar IDs along with the positions. -MG 332 // just be careful to sort the avatar IDs along with the positions. -MG
390 for (i = 0; i < count; i++) 333 pos_map = globalPosToView(positions[i], rotate_map);
391 {
392 compact_local = regionp->mMapAvatars.get(i);
393
394 bits = compact_local & 0xFF;
395 pos_local.mV[VZ] = F32(bits) * 4.f;
396 compact_local >>= 8;
397
398 bits = compact_local & 0xFF;
399 pos_local.mV[VY] = (F32)bits;
400 compact_local >>= 8;
401 334
402 bits = compact_local & 0xFF; 335 LLWorldMapView::drawAvatar(
403 pos_local.mV[VX] = (F32)bits; 336 pos_map.mV[VX], pos_map.mV[VY],
337 is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color,
338 pos_map.mV[VZ]);
404 339
405 pos_global.setVec( pos_local ); 340 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
406 pos_global += origin_global; 341 if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist)
407 342 {
408 pos_map = globalPosToView(pos_global); 343 closest_dist = dist_to_cursor;
409 344 mClosestAgentToCursor = avatar_ids[i];
410 BOOL show_as_friend = FALSE;
411 if( i < regionp->mMapAvatarIDs.count())
412 {
413 show_as_friend = is_agent_friend(regionp->mMapAvatarIDs.get(i));
414 }
415 LLWorldMapView::drawAvatar(
416 pos_map.mV[VX], pos_map.mV[VY],
417 show_as_friend ? glyph_color_friend : glyph_color_avatar,
418 pos_map.mV[VZ]);
419 } 345 }
420 } 346 }
421 347
422 // Draw dot for autopilot target 348 // Draw dot for autopilot target
423 if (gAgent.getAutoPilot()) 349 if (gAgent.getAutoPilot())
424 { 350 {
425 drawTracking( gAgent.getAutoPilotTargetGlobal(), gTrackColor ); 351 drawTracking( gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor );
426 } 352 }
427 else 353 else
428 { 354 {
429 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); 355 LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
430 if ( LLTracker::TRACKING_AVATAR == tracking_status ) 356 if ( LLTracker::TRACKING_AVATAR == tracking_status )
431 { 357 {
432 drawTracking( LLAvatarTracker::instance().getGlobalPos(), gTrackColor ); 358 drawTracking( LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor );
433 } 359 }
434 else if ( LLTracker::TRACKING_LANDMARK == tracking_status 360 else if ( LLTracker::TRACKING_LANDMARK == tracking_status
435 || LLTracker::TRACKING_LOCATION == tracking_status ) 361 || LLTracker::TRACKING_LOCATION == tracking_status )
436 { 362 {
437 drawTracking( LLTracker::getTrackedPositionGlobal(), gTrackColor ); 363 drawTracking( LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor );
438 } 364 }
439 } 365 }
440 366
441 // Draw dot for self avatar position 367 // Draw dot for self avatar position
442 pos_global = gAgent.getPositionGlobal(); 368 pos_global = gAgent.getPositionGlobal();
443 pos_map = globalPosToView(pos_global); 369 pos_map = globalPosToView(pos_global, rotate_map);
444 LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; 370 LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage;
445 you->draw( 371 you->draw(
446 llround(pos_map.mV[VX]) - you->getWidth()/2, 372 llround(pos_map.mV[VX]) - you->getWidth()/2,
447 llround(pos_map.mV[VY]) - you->getHeight()/2); 373 llround(pos_map.mV[VY]) - you->getHeight()/2);
448 374
449 // Draw frustum 375 // Draw frustum
450 F32 meters_to_pixels = gMiniMapScale/ LLWorld::getInstance()->getRegionWidthInMeters(); 376 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
451 377
452 F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); 378 F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect();
453 F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); 379 F32 far_clip_meters = LLViewerCamera::getInstance()->getFar();
@@ -462,9 +388,9 @@ void LLNetMap::draw()
462 388
463 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); 389 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
464 390
465 if( LLNetMap::sRotateMap ) 391 if( rotate_map )
466 { 392 {
467 gGL.color4fv(gFrustumMapColor.mV); 393 gGL.color4fv(gColors.getColor("NetMapFrustum").mV);
468 394
469 gGL.begin( LLRender::TRIANGLES ); 395 gGL.begin( LLRender::TRIANGLES );
470 gGL.vertex2f( ctr_x, ctr_y ); 396 gGL.vertex2f( ctr_x, ctr_y );
@@ -474,7 +400,7 @@ void LLNetMap::draw()
474 } 400 }
475 else 401 else
476 { 402 {
477 gGL.color4fv(gRotatingFrustumMapColor.mV); 403 gGL.color4fv(gColors.getColor("NetMapFrustumRotating").mV);
478 404
479 // If we don't rotate the map, we have to rotate the frustum. 405 // If we don't rotate the map, we have to rotate the frustum.
480 gGL.pushMatrix(); 406 gGL.pushMatrix();
@@ -490,21 +416,26 @@ void LLNetMap::draw()
490 } 416 }
491 417
492 // Rotation of 0 means that North is up 418 // Rotation of 0 means that North is up
493 setDirectionPos( mTextBoxEast, rotation ); 419 setDirectionPos( getChild<LLTextBox>("e_label"), rotation);
494 setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO ); 420 setDirectionPos( getChild<LLTextBox>("n_label"), rotation + F_PI_BY_TWO);
495 setDirectionPos( mTextBoxWest, rotation + F_PI ); 421 setDirectionPos( getChild<LLTextBox>("w_label"), rotation + F_PI);
496 setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO ); 422 setDirectionPos( getChild<LLTextBox>("s_label"), rotation + F_PI + F_PI_BY_TWO);
497 423
498 setDirectionPos( mTextBoxNorthEast, rotation + F_PI_BY_TWO / 2); 424 setDirectionPos( getChild<LLTextBox>("ne_label"), rotation + F_PI_BY_TWO / 2);
499 setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2); 425 setDirectionPos( getChild<LLTextBox>("nw_label"), rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2);
500 setDirectionPos( mTextBoxSouthWest, rotation + F_PI + F_PI_BY_TWO / 2); 426 setDirectionPos( getChild<LLTextBox>("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2);
501 setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); 427 setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
502 428
503 LLUICtrl::draw(); 429 LLView::draw();
504} 430}
505 431
506LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) 432void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
507{ 433{
434 LLPanel::reshape(width, height, called_from_parent);
435 updateMinorDirections();
436}
437
438LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated ){
508 LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal(); 439 LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal();
509 LLVector3 pos_local; 440 LLVector3 pos_local;
510 pos_local.setVec(relative_pos_global); // convert to floats from doubles 441 pos_local.setVec(relative_pos_global); // convert to floats from doubles
@@ -513,7 +444,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
513 pos_local.mV[VY] *= mPixelsPerMeter; 444 pos_local.mV[VY] *= mPixelsPerMeter;
514 // leave Z component in meters 445 // leave Z component in meters
515 446
516 if( LLNetMap::sRotateMap ) 447 if( rotated )
517 { 448 {
518 F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); 449 F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
519 LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); 450 LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
@@ -526,10 +457,10 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos )
526 return pos_local; 457 return pos_local;
527} 458}
528 459
529void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, 460void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated,
530 BOOL draw_arrow ) 461 const LLColor4& color, BOOL draw_arrow )
531{ 462{
532 LLVector3 pos_local = globalPosToView( pos_global ); 463 LLVector3 pos_local = globalPosToView( pos_global, rotated );
533 if( (pos_local.mV[VX] < 0) || 464 if( (pos_local.mV[VX] < 0) ||
534 (pos_local.mV[VY] < 0) || 465 (pos_local.mV[VY] < 0) ||
535 (pos_local.mV[VX] >= getRect().getWidth()) || 466 (pos_local.mV[VX] >= getRect().getWidth()) ||
@@ -552,22 +483,22 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color,
552 } 483 }
553} 484}
554 485
555LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) 486LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated )
556{ 487{
557 x -= llround(getRect().getWidth() / 2 + mCurPanX); 488 x -= llround(getRect().getWidth() / 2 + mCurPanX);
558 y -= llround(getRect().getHeight() / 2 + mCurPanY); 489 y -= llround(getRect().getHeight() / 2 + mCurPanY);
559 490
560 LLVector3 pos_local( (F32)x, (F32)y, 0 ); 491 LLVector3 pos_local( (F32)x, (F32)y, 0.f );
561 492
562 F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); 493 F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] );
563 494
564 if( LLNetMap::sRotateMap ) 495 if( rotated )
565 { 496 {
566 LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); 497 LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f));
567 pos_local.rotVec( rot ); 498 pos_local.rotVec( rot );
568 } 499 }
569 500
570 pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / gMiniMapScale ); 501 pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale );
571 502
572 LLVector3d pos_global; 503 LLVector3d pos_global;
573 pos_global.setVec( pos_local ); 504 pos_global.setVec( pos_local );
@@ -579,7 +510,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y )
579BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) 510BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
580{ 511{
581 // note that clicks are reversed from what you'd think 512 // note that clicks are reversed from what you'd think
582 setScale(llclamp(gMiniMapScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); 513 setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX));
583 return TRUE; 514 return TRUE;
584} 515}
585 516
@@ -590,10 +521,17 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
590 { 521 {
591 return FALSE; 522 return FALSE;
592 } 523 }
593 LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); 524 LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) );
594 if( region ) 525 if( region )
595 { 526 {
596 msg.assign( region->getName() ); 527 msg.assign("");
528 std::string fullname;
529 if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname))
530 {
531 msg.append(fullname);
532 msg.append("\n");
533 }
534 msg.append( region->getName() );
597 535
598#ifndef LL_RELEASE_FOR_DOWNLOAD 536#ifndef LL_RELEASE_FOR_DOWNLOAD
599 std::string buffer; 537 std::string buffer;
@@ -618,8 +556,12 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
618 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); 556 &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) );
619 sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; 557 sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP;
620 sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; 558 sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP;
559 handled = TRUE;
560 }
561 if(!handled)
562 {
563 return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen);
621 } 564 }
622 handled = TRUE;
623 return handled; 565 return handled;
624} 566}
625 567
@@ -629,19 +571,32 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
629 // Rotation is in radians. 571 // Rotation is in radians.
630 // Rotation of 0 means x = 1, y = 0 on the unit circle. 572 // Rotation of 0 means x = 1, y = 0 on the unit circle.
631 573
632 574 F32 half_height = (F32)( (getRect().getHeight() - text_box->getRect().getHeight()) / 2);
633 F32 map_half_height = (F32)(getRect().getHeight() / 2); 575 F32 half_width = (F32)( (getRect().getWidth() - text_box->getRect().getWidth()) / 2);
634 F32 map_half_width = (F32)(getRect().getWidth() / 2); 576 F32 radius = llmin( half_height, half_width );
635 F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2);
636 F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2);
637 F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width );
638 577
639 // Inset by a little to account for position display. 578 // Inset by a little to account for position display.
640 radius -= 8.f; 579 radius -= 8.f;
641 580
642 text_box->setOrigin( 581 text_box->setOrigin(llround(half_width + radius * cos( rotation )),
643 llround(map_half_width - text_half_width + radius * cos( rotation )), 582 llround(half_height + radius * sin( rotation )));
644 llround(map_half_height - text_half_height + radius * sin( rotation )) ); 583}
584
585void LLNetMap::updateMinorDirections()
586{
587 if (getChild<LLTextBox>("ne_label") == NULL)
588 {
589 return;
590 }
591
592 // Hide minor directions if they cover too much of the map
593 bool show_minors = getChild<LLTextBox>("ne_label")->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD *
594 llmin(getRect().getWidth(), getRect().getHeight());
595
596 getChild<LLTextBox>("ne_label")->setVisible(show_minors);
597 getChild<LLTextBox>("nw_label")->setVisible(show_minors);
598 getChild<LLTextBox>("sw_label")->setVisible(show_minors);
599 getChild<LLTextBox>("se_label")->setVisible(show_minors);
645} 600}
646 601
647void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters ) 602void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius_meters )
@@ -746,10 +701,10 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color,
746void LLNetMap::createObjectImage() 701void LLNetMap::createObjectImage()
747{ 702{
748 // Find the size of the side of a square that surrounds the circle that surrounds getRect(). 703 // Find the size of the side of a square that surrounds the circle that surrounds getRect().
749 F32 half_width = (F32)(getRect().getWidth() / 2); 704 // ... which is, the diagonal of the rect.
750 F32 half_height = (F32)(getRect().getHeight() / 2); 705 F32 width = getRect().getWidth();
751 F32 radius = sqrt( half_width * half_width + half_height * half_height ); 706 F32 height = getRect().getHeight();
752 S32 square_size = S32( 2 * radius ); 707 S32 square_size = llround( sqrt(width*width + height*height) );
753 708
754 // Find the least power of two >= the minimum size. 709 // Find the least power of two >= the minimum size.
755 const S32 MIN_SIZE = 32; 710 const S32 MIN_SIZE = 32;
@@ -768,7 +723,7 @@ void LLNetMap::createObjectImage()
768 U8* data = mObjectRawImagep->getData(); 723 U8* data = mObjectRawImagep->getData();
769 memset( data, 0, img_size * img_size * 4 ); 724 memset( data, 0, img_size * img_size * 4 );
770 mObjectImagep = new LLImageGL( mObjectRawImagep, FALSE); 725 mObjectImagep = new LLImageGL( mObjectRawImagep, FALSE);
771 setScale(gMiniMapScale); 726 setScale(mScale);
772 } 727 }
773 mUpdateNow = TRUE; 728 mUpdateNow = TRUE;
774} 729}
@@ -778,7 +733,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask )
778 if (gSavedSettings.getBOOL( "MiniMapTeleport" )) 733 if (gSavedSettings.getBOOL( "MiniMapTeleport" ))
779 { 734 {
780 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); 735 gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);
781 gAgent.teleportViaLocation( viewPosToGlobal(x,y) ); 736 gAgent.teleportViaLocation( viewPosToGlobal(x,y,gSavedSettings.getBOOL("MiniMapRotate")) );
782 } 737 }
783 else 738 else
784 LLFloaterWorldMap::show(NULL, FALSE); 739 LLFloaterWorldMap::show(NULL, FALSE);
@@ -788,6 +743,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask )
788 743
789BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) 744BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
790{ 745{
746 mClosestAgentAtLastRightClick = mClosestAgentToCursor;
791 LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); 747 LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
792 if (menu) 748 if (menu)
793 { 749 {
@@ -800,22 +756,53 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
800 756
801 757
802// static 758// static
803void LLNetMap::handleZoomLevel(void* which) 759bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
804{ 760{
805 intptr_t level = (intptr_t)which; 761 LLNetMap *self = mPtr;
762
763 S32 level = userdata.asInteger();
806 764
807 switch(level) 765 switch(level)
808 { 766 {
809 case 0: 767 case 0:
810 LLNetMap::sInstance->setScale(MAP_SCALE_MIN); 768 self->setScale(MAP_SCALE_MIN);
811 break; 769 break;
812 case 1: 770 case 1:
813 LLNetMap::sInstance->setScale(MAP_SCALE_MID); 771 self->setScale(MAP_SCALE_MID);
814 break; 772 break;
815 case 2: 773 case 2:
816 LLNetMap::sInstance->setScale(MAP_SCALE_MAX); 774 self->setScale(MAP_SCALE_MAX);
817 break; 775 break;
818 default: 776 default:
819 break; 777 break;
820 } 778 }
779
780 return true;
781}
782
783bool LLNetMap::LLStopTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
784{
785 LLTracker::stopTracking(NULL);
786 return true;
787}
788
789bool LLNetMap::LLEnableTracking::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
790{
791 LLNetMap *self = mPtr;
792 self->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking(NULL));
793 return true;
794}
795
796bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
797{
798 LLNetMap *self = mPtr;
799 LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick);
800 return true;
801}
802
803bool LLNetMap::LLEnableProfile::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
804{
805 LLNetMap *self = mPtr;
806 self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor());
807 return true;
821} 808}
diff --git a/linden/indra/newview/llnetmap.h b/linden/indra/newview/llnetmap.h
index 65d4a4c..be5593d 100644
--- a/linden/indra/newview/llnetmap.h
+++ b/linden/indra/newview/llnetmap.h
@@ -32,63 +32,56 @@
32#ifndef LL_LLNETMAP_H 32#ifndef LL_LLNETMAP_H
33#define LL_LLNETMAP_H 33#define LL_LLNETMAP_H
34 34
35#include "llmath.h" 35#include "llpanel.h"
36#include "lluictrl.h" 36#include "llmemberlistener.h"
37#include "v3math.h" 37#include "v3math.h"
38#include "v3dmath.h" 38#include "v3dmath.h"
39#include "v4color.h" 39#include "v4color.h"
40#include "llimage.h" 40#include "llimage.h"
41#include "llimagegl.h" 41#include "llimagegl.h"
42 42
43class LLColor4U; 43
44class LLCoordGL;
45class LLTextBox; 44class LLTextBox;
46class LLMenuGL;
47 45
48class LLNetMap : public LLUICtrl 46class LLNetMap : public LLPanel
49{ 47{
50public: 48public:
51 LLNetMap(const std::string& name, const LLRect& rect, const LLColor4& bg_color ); 49 LLNetMap(const std::string& name);
52 virtual ~LLNetMap(); 50 virtual ~LLNetMap();
53 51
54 virtual void draw(); 52 virtual void draw();
53 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
55 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); 54 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
56 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); 55 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
57 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 56 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
58 virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); 57 virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen );
59 58
59 void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
60
61private:
62
60 void setScale( F32 scale ); 63 void setScale( F32 scale );
64
65 // *TODO: Enable panning of the mini-map
61 void translatePan( F32 delta_x, F32 delta_y ); 66 void translatePan( F32 delta_x, F32 delta_y );
62 void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; } 67 void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; }
63 68
64 const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; }
65 void renderPoint(const LLVector3 &pos, const LLColor4U &color, 69 void renderPoint(const LLVector3 &pos, const LLColor4U &color,
66 S32 diameter, S32 relative_height = 0); 70 S32 diameter, S32 relative_height = 0);
67 void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); 71 LLVector3 globalPosToView(const LLVector3d& global_pos, BOOL rotated);
68 72 LLVector3d viewPosToGlobal(S32 x,S32 y, BOOL rotated);
69 LLVector3 globalPosToView(const LLVector3d& global_pos);
70 LLVector3d viewPosToGlobal(S32 x,S32 y);
71
72 static void setRotateMap( BOOL b ) { LLNetMap::sRotateMap = b; }
73 static void handleZoomLevel(void* which);
74 73
75 void drawTracking( const LLVector3d& pos_global, 74 void drawTracking( const LLVector3d& pos_global,
76 const LLColor4& color, 75 BOOL rotated,
77 BOOL draw_arrow = TRUE); 76 const LLColor4& color,
77 BOOL draw_arrow = TRUE);
78 78
79protected:
80 void setDirectionPos( LLTextBox* text_box, F32 rotation ); 79 void setDirectionPos( LLTextBox* text_box, F32 rotation );
80 void updateMinorDirections();
81 void createObjectImage(); 81 void createObjectImage();
82 static void teleport( const LLVector3d& destination );
83 static void fly( const LLVector3d& destination );
84 82
85public:
86 LLHandle<LLView> mPopupMenuHandle; 83 LLHandle<LLView> mPopupMenuHandle;
87 84
88 LLColor4 mBackgroundColor;
89 LLColor4 glyph_color_avatar;
90 LLColor4 glyph_color_friend;
91
92 F32 mScale; // Size of a region in pixels 85 F32 mScale; // Size of a region in pixels
93 F32 mPixelsPerMeter; // world meters to map pixels 86 F32 mPixelsPerMeter; // world meters to map pixels
94 F32 mObjectMapTPM; // texels per meter on map 87 F32 mObjectMapTPM; // texels per meter on map
@@ -101,18 +94,46 @@ public:
101 LLVector3d mObjectImageCenterGlobal; 94 LLVector3d mObjectImageCenterGlobal;
102 LLPointer<LLImageRaw> mObjectRawImagep; 95 LLPointer<LLImageRaw> mObjectRawImagep;
103 LLPointer<LLImageGL> mObjectImagep; 96 LLPointer<LLImageGL> mObjectImagep;
104 LLTextBox* mTextBoxEast;
105 LLTextBox* mTextBoxNorth;
106 LLTextBox* mTextBoxWest;
107 LLTextBox* mTextBoxSouth;
108 97
109 LLTextBox* mTextBoxSouthEast; 98private:
110 LLTextBox* mTextBoxNorthEast; 99 LLUUID mClosestAgentToCursor;
111 LLTextBox* mTextBoxNorthWest; 100 LLUUID mClosestAgentAtLastRightClick;
112 LLTextBox* mTextBoxSouthWest;
113 101
114 static BOOL sRotateMap; 102 static BOOL sRotateMap;
115 static LLNetMap* sInstance; 103 static LLNetMap* sInstance;
104 static BOOL isAgentUnderCursor(void*) { return sInstance && sInstance->mClosestAgentToCursor.notNull(); }
105 static void showAgentProfile(void*);
106 BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); }
107
108 class LLScaleMap : public LLMemberListener<LLNetMap>
109 {
110 public:
111 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
112 };
113
114 class LLStopTracking : public LLMemberListener<LLNetMap>
115 {
116 public:
117 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
118 };
119
120 class LLEnableTracking : public LLMemberListener<LLNetMap>
121 {
122 public:
123 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
124 };
125
126 class LLShowAgentProfile : public LLMemberListener<LLNetMap>
127 {
128 public:
129 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
130 };
131
132 class LLEnableProfile : public LLMemberListener<LLNetMap>
133 {
134 public:
135 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
136 };
116}; 137};
117 138
118 139
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp
index df7c084..aca3cac 100644
--- a/linden/indra/newview/llstartup.cpp
+++ b/linden/indra/newview/llstartup.cpp
@@ -1670,11 +1670,14 @@ bool idle_startup()
1670 gLoginMenuBarView->setVisible( FALSE ); 1670 gLoginMenuBarView->setVisible( FALSE );
1671 gLoginMenuBarView->setEnabled( FALSE ); 1671 gLoginMenuBarView->setEnabled( FALSE );
1672 1672
1673 gFloaterMap->setVisible( gSavedSettings.getBOOL("ShowMiniMap") );
1674
1675 LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0); 1673 LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0);
1676 gViewerWindow->adjustControlRectanglesForFirstUse(window); 1674 gViewerWindow->adjustControlRectanglesForFirstUse(window);
1677 1675
1676 if(gSavedSettings.getBOOL("ShowMiniMap"))
1677 {
1678 LLFloaterMap::showInstance();
1679 }
1680
1678 if (gSavedSettings.getBOOL("ShowCameraControls")) 1681 if (gSavedSettings.getBOOL("ShowCameraControls"))
1679 { 1682 {
1680 LLFloaterCamera::showInstance(); 1683 LLFloaterCamera::showInstance();
@@ -3911,8 +3914,7 @@ void reset_login()
3911 } 3914 }
3912 3915
3913 // Hide any other stuff 3916 // Hide any other stuff
3914 if ( gFloaterMap ) 3917 LLFloaterMap::hideInstance();
3915 gFloaterMap->setVisible( FALSE );
3916} 3918}
3917 3919
3918//--------------------------------------------------------------------------- 3920//---------------------------------------------------------------------------
diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp
index aa092c7..89ae973 100644
--- a/linden/indra/newview/llviewercontrol.cpp
+++ b/linden/indra/newview/llviewercontrol.cpp
@@ -44,7 +44,6 @@
44#include "llflexibleobject.h" 44#include "llflexibleobject.h"
45#include "llfeaturemanager.h" 45#include "llfeaturemanager.h"
46#include "llviewershadermgr.h" 46#include "llviewershadermgr.h"
47#include "llnetmap.h"
48#include "llpanelgeneral.h" 47#include "llpanelgeneral.h"
49#include "llpanelinput.h" 48#include "llpanelinput.h"
50#include "llsky.h" 49#include "llsky.h"
@@ -409,12 +408,6 @@ bool handleEffectColorChanged(const LLSD& newvalue)
409 return true; 408 return true;
410} 409}
411 410
412bool handleRotateNetMapChanged(const LLSD& newvalue)
413{
414 LLNetMap::setRotateMap(newvalue.asBoolean());
415 return true;
416}
417
418bool handleVectorizeChanged(const LLSD& newvalue) 411bool handleVectorizeChanged(const LLSD& newvalue)
419{ 412{
420 LLViewerJointMesh::updateVectorize(); 413 LLViewerJointMesh::updateVectorize();
@@ -559,7 +552,6 @@ void settings_setup_listeners()
559 gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1)); 552 gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1));
560 gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1)); 553 gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1));
561 gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1)); 554 gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1));
562 gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(handleRotateNetMapChanged, _1));
563 gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); 555 gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
564 gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); 556 gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
565 gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); 557 gSavedSettings.getControl("VectorizeProcessor")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1));
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index aa5e791..847336d 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -416,7 +416,6 @@ void handle_force_delete(void*);
416void print_object_info(void*); 416void print_object_info(void*);
417void print_agent_nvpairs(void*); 417void print_agent_nvpairs(void*);
418void toggle_debug_menus(void*); 418void toggle_debug_menus(void*);
419void toggle_map( void* user_data );
420void export_info_callback(LLAssetInfo *info, void **user_data, S32 result); 419void export_info_callback(LLAssetInfo *info, void **user_data, S32 result);
421void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result); 420void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result);
422void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); 421void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
@@ -4578,22 +4577,6 @@ void toggle_debug_menus(void*)
4578} 4577}
4579 4578
4580 4579
4581void toggle_map( void* user_data )
4582{
4583 // Toggle the item
4584 BOOL checked = gSavedSettings.getBOOL( static_cast<char*>(user_data) );
4585 gSavedSettings.setBOOL( static_cast<char*>(user_data), !checked );
4586 if (checked)
4587 {
4588 gFloaterMap->close();
4589 }
4590 else
4591 {
4592 gFloaterMap->open(); /* Flawfinder: ignore */
4593 }
4594}
4595
4596
4597// LLUUID gExporterRequestID; 4580// LLUUID gExporterRequestID;
4598// std::string gExportDirectory; 4581// std::string gExportDirectory;
4599 4582
@@ -5116,7 +5099,7 @@ class LLShowFloater : public view_listener_t
5116 } 5099 }
5117 else if (floater_name == "mini map") 5100 else if (floater_name == "mini map")
5118 { 5101 {
5119 LLFloaterMap::toggle(NULL); 5102 LLFloaterMap::toggleInstance();
5120 } 5103 }
5121 else if (floater_name == "stat bar") 5104 else if (floater_name == "stat bar")
5122 { 5105 {
diff --git a/linden/indra/newview/llviewerobject.cpp b/linden/indra/newview/llviewerobject.cpp
index b33b2bb..ca7055a 100644
--- a/linden/indra/newview/llviewerobject.cpp
+++ b/linden/indra/newview/llviewerobject.cpp
@@ -65,7 +65,6 @@
65#include "llface.h" 65#include "llface.h"
66#include "llfloaterproperties.h" 66#include "llfloaterproperties.h"
67#include "llfollowcam.h" 67#include "llfollowcam.h"
68#include "llnetmap.h"
69#include "llselectmgr.h" 68#include "llselectmgr.h"
70#include "llrendersphere.h" 69#include "llrendersphere.h"
71#include "lltooldraganddrop.h" 70#include "lltooldraganddrop.h"
diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp
index 0018323..1c527e0 100644
--- a/linden/indra/newview/llviewerregion.cpp
+++ b/linden/indra/newview/llviewerregion.cpp
@@ -53,7 +53,6 @@
53#include "llfloaterreporter.h" 53#include "llfloaterreporter.h"
54#include "llfloaterregioninfo.h" 54#include "llfloaterregioninfo.h"
55#include "llhttpnode.h" 55#include "llhttpnode.h"
56#include "llnetmap.h"
57#include "llsdutil.h" 56#include "llsdutil.h"
58#include "llstartup.h" 57#include "llstartup.h"
59#include "llviewerobjectlist.h" 58#include "llviewerobjectlist.h"
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index 443bbd5..9b2c566 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -100,7 +100,6 @@
100#include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor 100#include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor
101#include "llfloaterland.h" 101#include "llfloaterland.h"
102#include "llfloaterinspect.h" 102#include "llfloaterinspect.h"
103#include "llfloatermap.h"
104#include "llfloaternamedesc.h" 103#include "llfloaternamedesc.h"
105#include "llfloaterpreference.h" 104#include "llfloaterpreference.h"
106#include "llfloatersnapshot.h" 105#include "llfloatersnapshot.h"
@@ -1840,16 +1839,6 @@ void LLViewerWindow::initWorldUI()
1840 gHoverView = new LLHoverView(std::string("gHoverView"), full_window); 1839 gHoverView = new LLHoverView(std::string("gHoverView"), full_window);
1841 gHoverView->setVisible(TRUE); 1840 gHoverView->setVisible(TRUE);
1842 mRootView->addChild(gHoverView); 1841 mRootView->addChild(gHoverView);
1843
1844 //
1845 // Map
1846 //
1847 // TODO: Move instance management into class
1848 gFloaterMap = new LLFloaterMap(std::string("Map"));
1849 gFloaterMap->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
1850
1851 // keep onscreen
1852 gFloaterView->adjustToFitScreen(gFloaterMap, FALSE);
1853 1842
1854 gIMMgr = LLIMMgr::getInstance(); 1843 gIMMgr = LLIMMgr::getInstance();
1855 1844
@@ -1932,7 +1921,6 @@ void LLViewerWindow::shutdownViews()
1932 gFloaterView = NULL; 1921 gFloaterView = NULL;
1933 gMorphView = NULL; 1922 gMorphView = NULL;
1934 1923
1935 gFloaterMap = NULL;
1936 gHUDView = NULL; 1924 gHUDView = NULL;
1937 1925
1938 gNotifyBoxView = NULL; 1926 gNotifyBoxView = NULL;
diff --git a/linden/indra/newview/llworldmapview.cpp b/linden/indra/newview/llworldmapview.cpp
index 244ee22..73c2d8b 100644
--- a/linden/indra/newview/llworldmapview.cpp
+++ b/linden/indra/newview/llworldmapview.cpp
@@ -208,8 +208,6 @@ LLWorldMapView::LLWorldMapView(const std::string& name, const LLRect& rect )
208 mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); 208 mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect );
209 mTextBoxNorthWest->setColor( minor_color ); 209 mTextBoxNorthWest->setColor( minor_color );
210 addChild( mTextBoxNorthWest ); 210 addChild( mTextBoxNorthWest );
211
212 glyph_color_avatar = gColors.getColor("NetMapGlyphColorAvatar");
213} 211}
214 212
215 213
@@ -866,6 +864,9 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i
866void LLWorldMapView::drawAgents() 864void LLWorldMapView::drawAgents()
867{ 865{
868 F32 agents_scale = (gMapScale * 0.9f) / 256.f; 866 F32 agents_scale = (gMapScale * 0.9f) / 256.f;
867
868 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
869 LLColor4 friend_color = gColors.getColor( "MapFriend" );
869 870
870 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) 871 for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter)
871 { 872 {
@@ -888,8 +889,8 @@ void LLWorldMapView::drawAgents()
888 S32 agent_count = info.mExtra; 889 S32 agent_count = info.mExtra;
889 sim_agent_count += info.mExtra; 890 sim_agent_count += info.mExtra;
890 // Here's how we'd choose the color if info.mID were available but it's not being sent: 891 // Here's how we'd choose the color if info.mID were available but it's not being sent:
891 //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? glyph_color_friend : glyph_color_avatar; 892 //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color;
892 drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, glyph_color_avatar); 893 drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, avatar_color);
893 } 894 }
894 LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim 895 LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim
895 } 896 }
diff --git a/linden/indra/newview/skins/default/colors_base.xml b/linden/indra/newview/skins/default/colors_base.xml
index ff3d53e..1f97a2e 100644
--- a/linden/indra/newview/skins/default/colors_base.xml
+++ b/linden/indra/newview/skins/default/colors_base.xml
@@ -155,8 +155,12 @@
155<!-- MEDIA ICONS --> 155<!-- MEDIA ICONS -->
156<IconEnabledColor value="255, 255, 255, 255"/> <!-- Media/music icon enabled --> 156<IconEnabledColor value="255, 255, 255, 255"/> <!-- Media/music icon enabled -->
157<IconDisabledColor value="147, 169, 213, 200"/> <!-- Media/music icon disabled --> 157<IconDisabledColor value="147, 169, 213, 200"/> <!-- Media/music icon disabled -->
158 158
159<!-- MINI-MAP --> 159<!-- MAP -->
160<MapAvatar value="0, 255, 0, 255" /> <!-- Your avatar's glyph color -->
161<MapFriend value="255, 255, 0, 255" /> <!-- Your friends' glyph color -->
162
163 <!-- MINI-MAP -->
160<NetMapBackgroundColor value="0, 0, 0, 77" /> <!-- Mini-map floater background --> 164<NetMapBackgroundColor value="0, 0, 0, 77" /> <!-- Mini-map floater background -->
161<NetMapYouOwnAboveWater value="0, 255, 255, 255" /> <!-- Objects owned by you above water --> 165<NetMapYouOwnAboveWater value="0, 255, 255, 255" /> <!-- Objects owned by you above water -->
162<NetMapYouOwnBelowWater value="0, 200, 200, 255" /> <!-- Objects owned by you below water --> 166<NetMapYouOwnBelowWater value="0, 200, 200, 255" /> <!-- Objects owned by you below water -->
@@ -164,10 +168,13 @@
164<NetMapGroupOwnBelowWater value="200, 0, 200, 255" /> <!-- Group owned objects below water --> 168<NetMapGroupOwnBelowWater value="200, 0, 200, 255" /> <!-- Group owned objects below water -->
165<NetMapOtherOwnAboveWater value="60, 60, 60, 255" /> <!-- Objects owned by others above water --> 169<NetMapOtherOwnAboveWater value="60, 60, 60, 255" /> <!-- Objects owned by others above water -->
166<NetMapOtherOwnBelowWater value="30, 30, 30, 255" /> <!-- Objects owned by others below water --> 170<NetMapOtherOwnBelowWater value="30, 30, 30, 255" /> <!-- Objects owned by others below water -->
167<NetMapGlyphColorAvatar value="0, 255, 0, 255" /> <!-- Also the color of avatar glyphs on the map --> 171<NetMapThisRegion value="255, 255, 255, 255" />
168<NetMapGlyphColorFriend value="255, 255, 0, 255" /> 172<NetMapLiveRegion value="204, 204, 204, 255" />
169 173<NetMapDeadRegion value="255, 128, 128, 255" />
170<!-- INVENTORY --> 174<NetMapFrustum value="255, 255, 255, 20" />
175<NetMapFrustumRotating value="255, 255, 255, 51" />
176
177 <!-- INVENTORY -->
171<InventoryBackgroundColor value="62, 62, 62, 80"/> <!-- Inventory floater background --> 178<InventoryBackgroundColor value="62, 62, 62, 80"/> <!-- Inventory floater background -->
172<FolderViewLoadingMessageTextColor value="240, 165, 90, 255"/> <!-- "loading..." --> 179<FolderViewLoadingMessageTextColor value="240, 165, 90, 255"/> <!-- "loading..." -->
173<InventoryItemSuffixColor value="191, 216, 216, 255"/> <!-- "worn", "no modify", etc --> 180<InventoryItemSuffixColor value="191, 216, 216, 255"/> <!-- "worn", "no modify", etc -->
diff --git a/linden/indra/newview/skins/silver/colors_base.xml b/linden/indra/newview/skins/silver/colors_base.xml
index b6e77be..9ec721c 100644
--- a/linden/indra/newview/skins/silver/colors_base.xml
+++ b/linden/indra/newview/skins/silver/colors_base.xml
@@ -155,6 +155,10 @@
155<!-- MEDIA ICONS --> 155<!-- MEDIA ICONS -->
156<IconEnabledColor value="255, 255, 255, 255"/> <!-- Media/music icon enabled --> 156<IconEnabledColor value="255, 255, 255, 255"/> <!-- Media/music icon enabled -->
157<IconDisabledColor value="147, 169, 213, 200"/> <!-- Media/music icon disabled --> 157<IconDisabledColor value="147, 169, 213, 200"/> <!-- Media/music icon disabled -->
158
159<!-- MAP -->
160<MapAvatar value="0, 255, 0, 255" /> <!-- Your avatar's glyph color -->
161<MapFriend value="255, 255, 0, 255" /> <!-- Your friends' glyph color -->
158 162
159<!-- MINI-MAP --> 163<!-- MINI-MAP -->
160<NetMapBackgroundColor value="0, 0, 0, 77" /> <!-- Mini-map floater background --> 164<NetMapBackgroundColor value="0, 0, 0, 77" /> <!-- Mini-map floater background -->
@@ -164,10 +168,13 @@
164<NetMapGroupOwnBelowWater value="200, 0, 200, 255" /> <!-- Group owned objects below water --> 168<NetMapGroupOwnBelowWater value="200, 0, 200, 255" /> <!-- Group owned objects below water -->
165<NetMapOtherOwnAboveWater value="60, 60, 60, 255" /> <!-- Objects owned by others above water --> 169<NetMapOtherOwnAboveWater value="60, 60, 60, 255" /> <!-- Objects owned by others above water -->
166<NetMapOtherOwnBelowWater value="30, 30, 30, 255" /> <!-- Objects owned by others below water --> 170<NetMapOtherOwnBelowWater value="30, 30, 30, 255" /> <!-- Objects owned by others below water -->
167<NetMapGlyphColorAvatar value="0, 255, 0, 255" /> <!-- Also the color of avatar glyphs on the map --> 171<NetMapThisRegion value="255, 255, 255, 255" />
168<NetMapGlyphColorFriend value="255, 255, 0, 255" /> 172<NetMapLiveRegion value="204, 204, 204, 255" />
169 173<NetMapDeadRegion value="255, 128, 128, 255" />
170<!-- INVENTORY --> 174<NetMapFrustum value="255, 255, 255, 20" />
175<NetMapFrustumRotating value="255, 255, 255, 51" />
176
177 <!-- INVENTORY -->
171<InventoryBackgroundColor value="255, 255, 255, 80"/> <!-- Inventory floater background --> 178<InventoryBackgroundColor value="255, 255, 255, 80"/> <!-- Inventory floater background -->
172<FolderViewLoadingMessageTextColor value="240, 165, 90, 255"/> <!-- "loading..." --> 179<FolderViewLoadingMessageTextColor value="240, 165, 90, 255"/> <!-- "loading..." -->
173<InventoryItemSuffixColor value="120, 70, 55, 255"/> <!-- "worn", "no modify", etc --> 180<InventoryItemSuffixColor value="120, 70, 55, 255"/> <!-- "worn", "no modify", etc -->