diff options
author | McCabe Maxsted | 2009-09-15 23:44:25 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-09-15 23:44:25 -0700 |
commit | b86a81bb6a425234238770c7ff997e92b94777f1 (patch) | |
tree | 66c192d887c4a6e521bf4dd617a3e28603e912e3 | |
parent | Added tabs to mini-map radar (diff) | |
download | meta-impy-b86a81bb6a425234238770c7ff997e92b94777f1.zip meta-impy-b86a81bb6a425234238770c7ff997e92b94777f1.tar.gz meta-impy-b86a81bb6a425234238770c7ff997e92b94777f1.tar.bz2 meta-impy-b86a81bb6a425234238770c7ff997e92b94777f1.tar.xz |
Some code cleanup
-rw-r--r-- | ChangeLog.txt | 7 | ||||
-rw-r--r-- | linden/indra/newview/llfloatermap.cpp | 31 | ||||
-rw-r--r-- | linden/indra/newview/llfloatermap.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/llnetmap.cpp | 12 |
4 files changed, 23 insertions, 30 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt index 4fedaa8..7653e53 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt | |||
@@ -27,6 +27,13 @@ | |||
27 | modified: linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml | 27 | modified: linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml |
28 | 28 | ||
29 | 29 | ||
30 | * Some code cleanup. | ||
31 | |||
32 | modified: linden/indra/newview/llfloatermap.cpp | ||
33 | modified: linden/indra/newview/llfloatermap.h | ||
34 | modified: linden/indra/newview/llnetmap.cpp | ||
35 | |||
36 | |||
30 | 2009-09-14 McCabe Maxsted <hakushakukun@gmail.com> | 37 | 2009-09-14 McCabe Maxsted <hakushakukun@gmail.com> |
31 | 38 | ||
32 | * Small improvement to hide selection outlines in LLSelectMgr. | 39 | * Small improvement to hide selection outlines in LLSelectMgr. |
diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index 29a95c2..748bb7e 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp | |||
@@ -59,8 +59,6 @@ | |||
59 | #include "llviewerwindow.h" | 59 | #include "llviewerwindow.h" |
60 | #include "llworld.h" | 60 | #include "llworld.h" |
61 | 61 | ||
62 | LLFloaterMap* LLFloaterMap::sInstance = NULL; | ||
63 | |||
64 | LLFloaterMap::LLFloaterMap(const LLSD& key) | 62 | LLFloaterMap::LLFloaterMap(const LLSD& key) |
65 | : | 63 | : |
66 | LLFloater(std::string("minimap")), | 64 | LLFloater(std::string("minimap")), |
@@ -73,8 +71,6 @@ LLFloaterMap::LLFloaterMap(const LLSD& key) | |||
73 | 71 | ||
74 | mSelectedAvatar.setNull(); | 72 | mSelectedAvatar.setNull(); |
75 | mAvatars.clear(); | 73 | mAvatars.clear(); |
76 | |||
77 | sInstance = this; | ||
78 | } | 74 | } |
79 | 75 | ||
80 | 76 | ||
@@ -122,7 +118,6 @@ BOOL LLFloaterMap::postBuild() | |||
122 | 118 | ||
123 | LLFloaterMap::~LLFloaterMap() | 119 | LLFloaterMap::~LLFloaterMap() |
124 | { | 120 | { |
125 | sInstance = NULL; | ||
126 | } | 121 | } |
127 | 122 | ||
128 | 123 | ||
@@ -195,8 +190,7 @@ void LLFloaterMap::open() | |||
195 | //static | 190 | //static |
196 | void LLFloaterMap::updateRadar() | 191 | void LLFloaterMap::updateRadar() |
197 | { | 192 | { |
198 | LLFloaterMap* self = sInstance; | 193 | LLFloaterMap::getInstance()->populateRadar(); |
199 | self->populateRadar(); | ||
200 | } | 194 | } |
201 | 195 | ||
202 | void LLFloaterMap::populateRadar() | 196 | void LLFloaterMap::populateRadar() |
@@ -208,7 +202,7 @@ void LLFloaterMap::populateRadar() | |||
208 | 202 | ||
209 | if (visibleItemsSelected()) | 203 | if (visibleItemsSelected()) |
210 | { | 204 | { |
211 | mSelectedAvatar = mRadarList->getSelectedValue().asUUID(); | 205 | mSelectedAvatar = mRadarList->getFirstSelected()->getUUID(); |
212 | } | 206 | } |
213 | else | 207 | else |
214 | { | 208 | { |
@@ -283,11 +277,7 @@ void LLFloaterMap::populateRadar() | |||
283 | 277 | ||
284 | mRadarList->sortItems(); | 278 | mRadarList->sortItems(); |
285 | mRadarList->setScrollPos(scroll_pos); | 279 | mRadarList->setScrollPos(scroll_pos); |
286 | 280 | mRadarList->selectByID(mSelectedAvatar); | |
287 | if (mSelectedAvatar.notNull()) | ||
288 | { | ||
289 | mRadarList->selectByID(mSelectedAvatar); | ||
290 | } | ||
291 | 281 | ||
292 | // set count | 282 | // set count |
293 | std::stringstream avatar_count; | 283 | std::stringstream avatar_count; |
@@ -304,12 +294,14 @@ void LLFloaterMap::populateRadar() | |||
304 | childSetText("lblAvatarCount", avatar_count.str()); | 294 | childSetText("lblAvatarCount", avatar_count.str()); |
305 | 295 | ||
306 | toggleButtons(); | 296 | toggleButtons(); |
297 | |||
298 | //llinfos << "mSelectedAvatar: " << mSelectedAvatar.asString() << llendl; | ||
307 | } | 299 | } |
308 | 300 | ||
309 | void LLFloaterMap::toggleButtons() | 301 | void LLFloaterMap::toggleButtons() |
310 | { | 302 | { |
311 | BOOL enabled = mRadarList->hasFocus() ? visibleItemsSelected() : FALSE; | 303 | BOOL enabled = mSelectedAvatar.notNull() ? visibleItemsSelected() : FALSE; |
312 | BOOL unmute_enabled = mRadarList->hasFocus() ? LLMuteList::getInstance()->isMuted(mSelectedAvatar) : FALSE; | 304 | BOOL unmute_enabled = mSelectedAvatar.notNull() ? LLMuteList::getInstance()->isMuted(mSelectedAvatar) : FALSE; |
313 | 305 | ||
314 | childSetEnabled("im_btn", enabled); | 306 | childSetEnabled("im_btn", enabled); |
315 | childSetEnabled("profile_btn", enabled); | 307 | childSetEnabled("profile_btn", enabled); |
@@ -334,7 +326,6 @@ void LLFloaterMap::onList(LLUICtrl* ctrl, void* user_data) | |||
334 | self->toggleButtons(); | 326 | self->toggleButtons(); |
335 | } | 327 | } |
336 | } | 328 | } |
337 | |||
338 | 329 | ||
339 | BOOL LLFloaterMap::visibleItemsSelected() const | 330 | BOOL LLFloaterMap::visibleItemsSelected() const |
340 | { | 331 | { |
@@ -356,13 +347,9 @@ void LLFloaterMap::onRangeChange(LLFocusableElement* focus, void* user_data) | |||
356 | } | 347 | } |
357 | 348 | ||
358 | // static | 349 | // static |
359 | BOOL LLFloaterMap::isSelected(LLUUID agent) | 350 | LLUUID LLFloaterMap::getSelected() |
360 | { | 351 | { |
361 | if (sInstance->mSelectedAvatar == agent) | 352 | return LLFloaterMap::getInstance()->mSelectedAvatar; |
362 | { | ||
363 | return TRUE; | ||
364 | } | ||
365 | return FALSE; | ||
366 | } | 353 | } |
367 | 354 | ||
368 | // | 355 | // |
diff --git a/linden/indra/newview/llfloatermap.h b/linden/indra/newview/llfloatermap.h index 0fff8a3..09fce01 100644 --- a/linden/indra/newview/llfloatermap.h +++ b/linden/indra/newview/llfloatermap.h | |||
@@ -48,7 +48,7 @@ public: | |||
48 | static void* createPanelMiniMap(void* data); | 48 | static void* createPanelMiniMap(void* data); |
49 | 49 | ||
50 | static void updateRadar(); | 50 | static void updateRadar(); |
51 | static BOOL isSelected(LLUUID agent); | 51 | static LLUUID getSelected(); |
52 | 52 | ||
53 | BOOL postBuild(); | 53 | BOOL postBuild(); |
54 | 54 | ||
@@ -69,7 +69,6 @@ private: | |||
69 | LLUUID mSelectedAvatar; | 69 | LLUUID mSelectedAvatar; |
70 | std::map<LLUUID, LLVector3d> mAvatars; | 70 | std::map<LLUUID, LLVector3d> mAvatars; |
71 | bool mUpdate; | 71 | bool mUpdate; |
72 | static LLFloaterMap* sInstance; | ||
73 | 72 | ||
74 | static void onList(LLUICtrl* ctrl, void* user_data); | 73 | static void onList(LLUICtrl* ctrl, void* user_data); |
75 | static void onRangeChange(LLFocusableElement* focus, void* user_data); | 74 | static void onRangeChange(LLFocusableElement* focus, void* user_data); |
diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp index c66e816..1f6f6bd 100644 --- a/linden/indra/newview/llnetmap.cpp +++ b/linden/indra/newview/llnetmap.cpp | |||
@@ -347,9 +347,13 @@ void LLNetMap::draw() | |||
347 | // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. | 347 | // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. |
348 | // just be careful to sort the avatar IDs along with the positions. -MG | 348 | // just be careful to sort the avatar IDs along with the positions. -MG |
349 | pos_map = globalPosToView(positions[i], rotate_map); | 349 | pos_map = globalPosToView(positions[i], rotate_map); |
350 | 350 | ||
351 | if (LLFloaterMap::getSelected() == avatar_ids[i]) | ||
352 | { | ||
353 | glyph_color = selected_color; | ||
354 | } | ||
351 | // Show them muted even if they're friends | 355 | // Show them muted even if they're friends |
352 | if (LLMuteList::getInstance()->isMuted(avatar_ids[i])) | 356 | else if (LLMuteList::getInstance()->isMuted(avatar_ids[i])) |
353 | { | 357 | { |
354 | glyph_color = muted_color; | 358 | glyph_color = muted_color; |
355 | } | 359 | } |
@@ -357,10 +361,6 @@ void LLNetMap::draw() | |||
357 | { | 361 | { |
358 | glyph_color = friend_color; | 362 | glyph_color = friend_color; |
359 | } | 363 | } |
360 | else if (LLFloaterMap::isSelected(avatar_ids[i])) | ||
361 | { | ||
362 | glyph_color = selected_color; | ||
363 | } | ||
364 | else | 364 | else |
365 | { | 365 | { |
366 | glyph_color = avatar_color; | 366 | glyph_color = avatar_color; |