aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llnetmap.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-09-23 02:29:44 -0500
committerJacek Antonelli2009-09-23 02:29:44 -0500
commitcd2b97b3e6446449443700ae9a1521c402c93850 (patch)
tree0c45e5a05cdcb6956fb859c9fef834a5c5613a04 /linden/indra/newview/llnetmap.cpp
parentCommented out Linux tarball building. (diff)
parentDisplay selected avatars larger than normal, zoom in at a reasonable speed. I... (diff)
downloadmeta-impy-cd2b97b3e6446449443700ae9a1521c402c93850.zip
meta-impy-cd2b97b3e6446449443700ae9a1521c402c93850.tar.gz
meta-impy-cd2b97b3e6446449443700ae9a1521c402c93850.tar.bz2
meta-impy-cd2b97b3e6446449443700ae9a1521c402c93850.tar.xz
Merge remote branch 'mccabe/1.2.0-next' into next
Conflicts: linden/indra/newview/llfloaterchat.cpp linden/indra/newview/llfloatermap.cpp linden/indra/newview/llinventorybridge.cpp linden/indra/newview/llnetmap.cpp linden/indra/newview/llviewermessage.cpp linden/indra/newview/llviewerobjectlist.cpp
Diffstat (limited to 'linden/indra/newview/llnetmap.cpp')
-rw-r--r--linden/indra/newview/llnetmap.cpp99
1 files changed, 79 insertions, 20 deletions
diff --git a/linden/indra/newview/llnetmap.cpp b/linden/indra/newview/llnetmap.cpp
index 8f5d90d..9ef56c1 100644
--- a/linden/indra/newview/llnetmap.cpp
+++ b/linden/indra/newview/llnetmap.cpp
@@ -45,6 +45,7 @@
45#include "llcolorscheme.h" 45#include "llcolorscheme.h"
46#include "llviewercontrol.h" 46#include "llviewercontrol.h"
47#include "llfloateravatarinfo.h" 47#include "llfloateravatarinfo.h"
48#include "llfloatermap.h"
48#include "llfloaterworldmap.h" 49#include "llfloaterworldmap.h"
49#include "llframetimer.h" 50#include "llframetimer.h"
50#include "llmutelist.h" 51#include "llmutelist.h"
@@ -69,13 +70,15 @@
69#include "llglheaders.h" 70#include "llglheaders.h"
70 71
71const F32 MAP_SCALE_MIN = 32; 72const F32 MAP_SCALE_MIN = 32;
72const F32 MAP_SCALE_MID = 172; 73const F32 MAP_SCALE_MID = 1024;
73const F32 MAP_SCALE_MAX = 512; 74const F32 MAP_SCALE_MAX = 4096;
74const F32 MAP_SCALE_INCREMENT = 16; 75const F32 MAP_SCALE_INCREMENT = 16;
75const F32 MAP_MIN_PICK_DIST = 4; 76const F32 MAP_SCALE_ZOOM_FACTOR = 1.25f; // Zoom in factor per click of the scroll wheel (25%)
76const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; 77const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f;
78const F32 MIN_DOT_RADIUS = 3.5f;
79const F32 DOT_SCALE = 0.75f;
80const F32 MIN_PICK_SCALE = 2.f;
77const S32 SLOP = 2; 81const S32 SLOP = 2;
78
79const S32 TRACKING_RADIUS = 3; 82const S32 TRACKING_RADIUS = 3;
80 83
81LLNetMap::LLNetMap(const std::string& name) : 84LLNetMap::LLNetMap(const std::string& name) :
@@ -91,6 +94,7 @@ LLNetMap::LLNetMap(const std::string& name) :
91{ 94{
92 mScale = gSavedSettings.getF32("MiniMapScale"); 95 mScale = gSavedSettings.getF32("MiniMapScale");
93 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 96 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
97 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
94 98
95 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); 99 mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal();
96 100
@@ -98,6 +102,8 @@ LLNetMap::LLNetMap(const std::string& name) :
98 (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel"); 102 (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel");
99 (new LLCenterMap())->registerListener(this, "MiniMap.Center"); 103 (new LLCenterMap())->registerListener(this, "MiniMap.Center");
100 (new LLCheckCenterMap())->registerListener(this, "MiniMap.CheckCenter"); 104 (new LLCheckCenterMap())->registerListener(this, "MiniMap.CheckCenter");
105 (new LLRotateMap())->registerListener(this, "MiniMap.Rotate");
106 (new LLCheckRotateMap())->registerListener(this, "MiniMap.CheckRotate");
101 (new LLShowWorldMap())->registerListener(this, "MiniMap.ShowWorldMap"); 107 (new LLShowWorldMap())->registerListener(this, "MiniMap.ShowWorldMap");
102 (new LLStopTracking())->registerListener(this, "MiniMap.StopTracking"); 108 (new LLStopTracking())->registerListener(this, "MiniMap.StopTracking");
103 (new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking"); 109 (new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking");
@@ -117,6 +123,11 @@ LLNetMap::LLNetMap(const std::string& name) :
117 mPopupMenuHandle = menu->getHandle(); 123 mPopupMenuHandle = menu->getHandle();
118} 124}
119 125
126BOOL LLNetMap::postBuild()
127{
128 return TRUE;
129}
130
120LLNetMap::~LLNetMap() 131LLNetMap::~LLNetMap()
121{ 132{
122} 133}
@@ -143,6 +154,7 @@ void LLNetMap::setScale( F32 scale )
143 } 154 }
144 155
145 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); 156 mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters();
157 mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
146 158
147 mUpdateNow = TRUE; 159 mUpdateNow = TRUE;
148} 160}
@@ -325,12 +337,15 @@ void LLNetMap::draw()
325 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); 337 LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y);
326 mClosestAgentToCursor.setNull(); 338 mClosestAgentToCursor.setNull();
327 F32 closest_dist = F32_MAX; 339 F32 closest_dist = F32_MAX;
340 F32 min_pick_dist = mDotRadius * MIN_PICK_SCALE;
328 341
329 // Draw avatars 342 // Draw avatars
330 LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); 343 LLColor4 avatar_color = gColors.getColor( "MapAvatar" );
331 LLColor4 friend_color = gColors.getColor( "MapFriend" ); 344 LLColor4 friend_color = gColors.getColor( "MapFriend" );
332 LLColor4 muted_color = gColors.getColor( "MapMuted" ); 345 LLColor4 muted_color = gColors.getColor( "MapMuted" );
346 LLColor4 selected_color = gColors.getColor( "MapSelected" );
333 LLColor4 glyph_color; 347 LLColor4 glyph_color;
348 F32 glyph_radius;
334 349
335 std::vector<LLUUID> avatar_ids; 350 std::vector<LLUUID> avatar_ids;
336 std::vector<LLVector3d> positions; 351 std::vector<LLVector3d> positions;
@@ -340,20 +355,38 @@ void LLNetMap::draw()
340 // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. 355 // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest.
341 // just be careful to sort the avatar IDs along with the positions. -MG 356 // just be careful to sort the avatar IDs along with the positions. -MG
342 pos_map = globalPosToView(positions[i], rotate_map); 357 pos_map = globalPosToView(positions[i], rotate_map);
343 358
344 // Show them muted even if they're friends 359 if (LLFloaterMap::getSelected() == avatar_ids[i])
345 if (LLMuteList::getInstance()->isMuted(avatar_ids[i]))
346 { 360 {
347 glyph_color = muted_color; 361 glyph_radius = mDotRadius * 1.7f;
362 glyph_color = selected_color;
348 } 363 }
349 else if (is_agent_friend(avatar_ids[i])) 364 else
350 { 365 {
351 glyph_color = friend_color; 366 glyph_radius = mDotRadius;
367 // Show them muted even if they're friends
368 if (LLMuteList::getInstance()->isMuted(avatar_ids[i]))
369 {
370 glyph_color = muted_color;
371 }
372 else if (is_agent_friend(avatar_ids[i]))
373 {
374 glyph_color = friend_color;
375 }
376 else
377 {
378 glyph_color = avatar_color;
379 }
352 } 380 }
353 else 381
382// [RLVa:KB]
383 if ( rlv_handler_t::isEnabled() && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) )
354 { 384 {
385 // User is not allowed to see who it is, or even if it's a friend,
386 // due to RLV settings.
355 glyph_color = avatar_color; 387 glyph_color = avatar_color;
356 } 388 }
389// [/RLVa:KB]
357 390
358// [RLVa:KB] 391// [RLVa:KB]
359 if ( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) ) 392 if ( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) )
@@ -368,10 +401,11 @@ void LLNetMap::draw()
368 LLWorldMapView::drawAvatar( 401 LLWorldMapView::drawAvatar(
369 pos_map.mV[VX], pos_map.mV[VY], 402 pos_map.mV[VX], pos_map.mV[VY],
370 glyph_color, 403 glyph_color,
371 pos_map.mV[VZ]); 404 pos_map.mV[VZ],
405 glyph_radius);
372 406
373 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); 407 F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y));
374 if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) 408 if(dist_to_cursor < min_pick_dist && dist_to_cursor < closest_dist)
375 { 409 {
376 closest_dist = dist_to_cursor; 410 closest_dist = dist_to_cursor;
377 mClosestAgentToCursor = avatar_ids[i]; 411 mClosestAgentToCursor = avatar_ids[i];
@@ -400,10 +434,13 @@ void LLNetMap::draw()
400 // Draw dot for self avatar position 434 // Draw dot for self avatar position
401 pos_global = gAgent.getPositionGlobal(); 435 pos_global = gAgent.getPositionGlobal();
402 pos_map = globalPosToView(pos_global, rotate_map); 436 pos_map = globalPosToView(pos_global, rotate_map);
403 LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; 437 LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage;
438 S32 dot_width = llround(mDotRadius * 2.f);
404 you->draw( 439 you->draw(
405 llround(pos_map.mV[VX]) - you->getWidth()/2, 440 llround(pos_map.mV[VX] - mDotRadius),
406 llround(pos_map.mV[VY]) - you->getHeight()/2); 441 llround(pos_map.mV[VY] - mDotRadius),
442 dot_width,
443 dot_width);
407 444
408 // Draw frustum 445 // Draw frustum
409 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); 446 F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters();
@@ -460,6 +497,8 @@ void LLNetMap::draw()
460 setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); 497 setDirectionPos( getChild<LLTextBox>("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2);
461 498
462 LLView::draw(); 499 LLView::draw();
500
501 LLFloaterMap::updateRadar();
463} 502}
464 503
465void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) 504void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent)
@@ -542,8 +581,12 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated )
542 581
543BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) 582BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
544{ 583{
545 // note that clicks are reversed from what you'd think 584 // note that clicks are reversed from what you'd think: i.e. > 0 means zoom out, < 0 means zoom in
546 setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); 585 F32 scale = mScale;
586
587 scale *= pow(MAP_SCALE_ZOOM_FACTOR, -clicks);
588 setScale(llclamp(scale, MAP_SCALE_MIN, MAP_SCALE_MAX));
589
547 return TRUE; 590 return TRUE;
548} 591}
549 592
@@ -562,7 +605,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
562 if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) 605 if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname))
563 { 606 {
564// [RLVa:KB] 607// [RLVa:KB]
565 if ( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) ) 608 if ( rlv_handler_t::isEnabled() && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) )
566 { 609 {
567 // User is not allowed to see who it is, due to RLV settings. 610 // User is not allowed to see who it is, due to RLV settings.
568 msg.append(rlv_handler_t::cstrHidden); 611 msg.append(rlv_handler_t::cstrHidden);
@@ -576,7 +619,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec
576 } 619 }
577 620
578// [RLVa:KB] 621// [RLVa:KB]
579 if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) 622 if (rlv_handler_t::isEnabled() && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
580 { 623 {
581 // User is not allowed to see where they are, due to RLV settings. 624 // User is not allowed to see where they are, due to RLV settings.
582 msg.append( rlv_handler_t::cstrHidden ); 625 msg.append( rlv_handler_t::cstrHidden );
@@ -922,6 +965,22 @@ bool LLNetMap::LLScaleMap::handleEvent(LLPointer<LLEvent> event, const LLSD& use
922 return true; 965 return true;
923} 966}
924 967
968bool LLNetMap::LLRotateMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
969{
970 BOOL rotate = gSavedSettings.getBOOL("MiniMapRotate");
971 gSavedSettings.setBOOL("MiniMapRotate", !rotate);
972
973 return true;
974}
975
976bool LLNetMap::LLCheckRotateMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
977{
978 LLNetMap *self = mPtr;
979 BOOL enabled = gSavedSettings.getBOOL("MiniMapRotate");
980 self->findControl(userdata["control"].asString())->setValue(enabled);
981 return true;
982}
983
925bool LLNetMap::LLCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) 984bool LLNetMap::LLCenterMap::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
926{ 985{
927 S32 center = userdata.asInteger(); 986 S32 center = userdata.asInteger();