diff options
author | Jacek Antonelli | 2009-10-29 16:45:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-10-30 00:15:09 -0500 |
commit | 1f9ab41a28f0977efd33cedbbcbeb2091280169e (patch) | |
tree | f3a18f8828e78a6a7aa1f6d2864d2f34c8ec3489 | |
parent | Added a button that will toggle the minimap radar. (diff) | |
download | meta-impy-1f9ab41a28f0977efd33cedbbcbeb2091280169e.zip meta-impy-1f9ab41a28f0977efd33cedbbcbeb2091280169e.tar.gz meta-impy-1f9ab41a28f0977efd33cedbbcbeb2091280169e.tar.bz2 meta-impy-1f9ab41a28f0977efd33cedbbcbeb2091280169e.tar.xz |
Minimap radar can now be toggled.
-rw-r--r-- | ChangeLog.txt | 6 | ||||
-rw-r--r-- | linden/indra/newview/llfloatermap.cpp | 56 | ||||
-rw-r--r-- | linden/indra/newview/llfloatermap.h | 1 |
3 files changed, 63 insertions, 0 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index 17baabc..d88db37 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt | |||
@@ -1,5 +1,11 @@ | |||
1 | 2009-10-29 Jacek Antonelli <jacek.antonelli@gmail.com> | 1 | 2009-10-29 Jacek Antonelli <jacek.antonelli@gmail.com> |
2 | 2 | ||
3 | * Minimap radar can now be toggled. | ||
4 | |||
5 | modified: llfloatermap.cpp | ||
6 | modified: llfloatermap.h | ||
7 | |||
8 | |||
3 | * Added a button that will toggle the minimap radar. | 9 | * Added a button that will toggle the minimap radar. |
4 | 10 | ||
5 | modified: app_settings/settings.xml | 11 | modified: app_settings/settings.xml |
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 5aed515..e482d99 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp | |||
@@ -84,6 +84,12 @@ BOOL LLFloaterMap::postBuild() | |||
84 | setIsChrome(TRUE); | 84 | setIsChrome(TRUE); |
85 | 85 | ||
86 | childSetAction("toggle_radar", onToggleRadar, this); | 86 | childSetAction("toggle_radar", onToggleRadar, this); |
87 | |||
88 | if (!gSavedSettings.getBOOL("ShowMiniMapRadar")) | ||
89 | { | ||
90 | // Collapse radar if it's not showing. | ||
91 | adjustLayout( false ); | ||
92 | } | ||
87 | 93 | ||
88 | return TRUE; | 94 | return TRUE; |
89 | } | 95 | } |
@@ -179,8 +185,17 @@ void LLFloaterMap::toggleRadarVisible() | |||
179 | 185 | ||
180 | void LLFloaterMap::setRadarVisible( bool show_radar ) | 186 | void LLFloaterMap::setRadarVisible( bool show_radar ) |
181 | { | 187 | { |
188 | bool old_show_radar = gSavedSettings.getBOOL("ShowMiniMapRadar"); | ||
189 | |||
182 | gSavedSettings.setBOOL("ShowMiniMapRadar", show_radar); | 190 | gSavedSettings.setBOOL("ShowMiniMapRadar", show_radar); |
183 | setRadarButtonState( show_radar ); | 191 | setRadarButtonState( show_radar ); |
192 | mPanelRadar->setVisible( show_radar ); | ||
193 | |||
194 | // Adjust the minimap window's size if visibility is changing | ||
195 | if (show_radar != old_show_radar) | ||
196 | { | ||
197 | adjustLayout( show_radar ); | ||
198 | } | ||
184 | } | 199 | } |
185 | 200 | ||
186 | 201 | ||
@@ -202,3 +217,44 @@ void LLFloaterMap::setRadarButtonState( bool showing_radar ) | |||
202 | } | 217 | } |
203 | } | 218 | } |
204 | } | 219 | } |
220 | |||
221 | |||
222 | void LLFloaterMap::adjustLayout( bool expand ) | ||
223 | { | ||
224 | S32 radar_height = mPanelRadar->getRect().getHeight(); | ||
225 | S32 height = getRect().getHeight(); | ||
226 | LLRect map_rect = mPanelMap->getRect(); | ||
227 | S32 map_bottom = map_rect.mBottom; | ||
228 | |||
229 | S32 min_width, min_height; | ||
230 | getResizeLimits( &min_width, &min_height ); | ||
231 | |||
232 | S32 adjust = radar_height; | ||
233 | if (!expand) | ||
234 | { | ||
235 | adjust = -adjust; | ||
236 | } | ||
237 | |||
238 | height += adjust; | ||
239 | min_height += adjust; | ||
240 | map_bottom += adjust; | ||
241 | |||
242 | map_rect.set( map_rect.mLeft, map_rect.mTop, | ||
243 | map_rect.mRight, map_bottom ); | ||
244 | mPanelMap->setRect(map_rect); | ||
245 | |||
246 | setResizeLimits( min_width, min_height ); | ||
247 | reshape( getRect().getWidth(), height, false ); | ||
248 | |||
249 | LLRect temp_rect = getRect(); | ||
250 | temp_rect.translate( 0, -adjust ); | ||
251 | setRect( temp_rect ); | ||
252 | |||
253 | LLButton* toggle = getChild<LLButton>("toggle_radar"); | ||
254 | if (toggle) | ||
255 | { | ||
256 | temp_rect = toggle->getRect(); | ||
257 | temp_rect.translate( 0, adjust ); | ||
258 | toggle->setRect( temp_rect ); | ||
259 | } | ||
260 | } | ||
diff --git a/linden/indra/newview/llfloatermap.h b/linden/indra/newview/llfloatermap.h index 7937836..ec6f4d3 100644 --- a/linden/indra/newview/llfloatermap.h +++ b/linden/indra/newview/llfloatermap.h | |||
@@ -71,6 +71,7 @@ private: | |||
71 | void toggleRadarVisible(); | 71 | void toggleRadarVisible(); |
72 | void setRadarVisible( bool show_radar ); | 72 | void setRadarVisible( bool show_radar ); |
73 | void setRadarButtonState(bool showing_radar); | 73 | void setRadarButtonState(bool showing_radar); |
74 | void adjustLayout( bool expand ); | ||
74 | }; | 75 | }; |
75 | 76 | ||
76 | #endif // LL_LLFLOATERMAP_H | 77 | #endif // LL_LLFLOATERMAP_H |