From e5dbb8e4dc05e664102362685ddca94f37cdf575 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 9 Jun 2009 09:41:04 -0700 Subject: Backported 1.23's minimap conversion to XUI --- linden/indra/llui/llui.cpp | 12 + linden/indra/llui/llui.h | 1 + linden/indra/newview/CMakeLists.txt | 3 + linden/indra/newview/llagent.cpp | 6 +- linden/indra/newview/llcolorscheme.cpp | 11 - linden/indra/newview/llcolorscheme.h | 3 - linden/indra/newview/llfloatermap.cpp | 142 ++------ linden/indra/newview/llfloatermap.h | 28 +- linden/indra/newview/llmenucommands.cpp | 2 +- linden/indra/newview/llnetmap.cpp | 399 ++++++++++----------- linden/indra/newview/llnetmap.h | 89 +++-- linden/indra/newview/llstartup.cpp | 10 +- linden/indra/newview/llviewercontrol.cpp | 8 - linden/indra/newview/llviewermenu.cpp | 19 +- linden/indra/newview/llviewerobject.cpp | 1 - linden/indra/newview/llviewerregion.cpp | 1 - linden/indra/newview/llviewerwindow.cpp | 12 - linden/indra/newview/llworldmapview.cpp | 9 +- linden/indra/newview/skins/default/colors_base.xml | 19 +- linden/indra/newview/skins/silver/colors_base.xml | 15 +- 20 files changed, 340 insertions(+), 450 deletions(-) (limited to 'linden/indra') 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) setCursorPositionScreen(screen_x, screen_y); } +//static +void LLUI::getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y) +{ + LLCoordWindow cursor_pos_window; + LLView::getWindow()->getCursorPosition(&cursor_pos_window); + LLCoordGL cursor_pos_gl; + LLView::getWindow()->convertCoords(cursor_pos_window, &cursor_pos_gl); + cursor_pos_gl.mX = llround((F32)cursor_pos_gl.mX / LLUI::sGLScaleFactor.mV[VX]); + cursor_pos_gl.mY = llround((F32)cursor_pos_gl.mY / LLUI::sGLScaleFactor.mV[VY]); + viewp->screenPointToLocal(cursor_pos_gl.mX, cursor_pos_gl.mY, x, y); +} + // On Windows, the user typically sets the language when they install the // app (by running it with a shortcut that sets InstallLanguage). On Mac, // 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: static std::string locateSkin(const std::string& filename); static void setCursorPositionScreen(S32 x, S32 y); static void setCursorPositionLocal(const LLView* viewp, S32 x, S32 y); + static void getCursorPositionLocal(const LLView* viewp, S32 *x, S32 *y); static void setScaleFactor(const LLVector2& scale_factor); static void setLineWidth(F32 width); 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 skins/default/xui/en-us/floater_live_lsleditor.xml skins/default/xui/en-us/floater_lsl_guide.xml skins/default/xui/en-us/floater_media_browser.xml + skins/default/xui/en-us/floater_mini_map.xml skins/default/xui/en-us/floater_moveview.xml skins/default/xui/en-us/floater_mute_object.xml skins/default/xui/en-us/floater_mute.xml @@ -1125,6 +1126,7 @@ set(viewer_XUI_FILES skins/default/xui/en-us/floater_world_map.xml skins/default/xui/en-us/menu_inventory.xml skins/default/xui/en-us/menu_login.xml + skins/default/xui/en-us/menu_mini_map.xml skins/default/xui/en-us/menu_pie_attachment.xml skins/default/xui/en-us/menu_pie_avatar.xml skins/default/xui/en-us/menu_pie_hud.xml @@ -1162,6 +1164,7 @@ set(viewer_XUI_FILES skins/default/xui/en-us/panel_media_controls.xml skins/default/xui/en-us/panel_media_remote_expanded.xml skins/default/xui/en-us/panel_media_remote.xml + skins/default/xui/en-us/panel_mini_map.xml skins/default/xui/en-us/panel_overlaybar.xml skins/default/xui/en-us/panel_place_small.xml 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() static const LLFloaterView::skip_list_t& get_skip_list() { static LLFloaterView::skip_list_t skip_list; - skip_list.insert(gFloaterMap); + skip_list.insert(LLFloaterMap::getInstance()); return skip_list; } @@ -2894,7 +2894,7 @@ void LLAgent::endAnimationUpdateUI() // let the mini-map go visible again. JC if (!LLAppViewer::instance()->quitRequested()) { - gFloaterMap->popVisible(); + LLFloaterMap::getInstance()->popVisible(); } if( gMorphView ) @@ -2991,7 +2991,7 @@ void LLAgent::endAnimationUpdateUI() { LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset); - gFloaterMap->pushVisible(FALSE); + LLFloaterMap::getInstance()->pushVisible(FALSE); /* LLView *view; 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 @@ #include "llviewercontrol.h" LLColor4 gTrackColor; -LLColor4 gSelfMapColor; LLColor4 gLandmarkMapColor; LLColor4 gLocationMapColor; LLColor4 gTelehubMapColor; -LLColor4 gFrustumMapColor; -LLColor4 gRotatingFrustumMapColor; LLColor4 gEventColor; LLColor4 gPopularColor; LLColor4 gPickColor; @@ -52,17 +49,9 @@ void init_colors() { gTrackColor = LLColor4::red; gDisabledTrackColor.setVec( 0.5f, 0.f, 0.f, 1.f ); - - gSelfMapColor = LLColor4::white; - - // fleshy color - //gAvatarMapColor.setVec( 255.f/255.f, 223.f/255.f, 170.f/255.f, 1.f); - gLandmarkMapColor = LLColor4::red; gLocationMapColor.setVec( 0.f, 0.72f, 1.f, 1.f); gTelehubMapColor.setVec( 0.9f, 0.9f, 0.f, 1.f); // dk yellow - gFrustumMapColor.setVec( 1.f, 1.f, 1.f, 0.08f); - gRotatingFrustumMapColor.setVec(1.f, 1.f, 1.f, 0.2f); gEventColor.setVec( 1.f, 0.5f, 1.f, 1.f ); gPopularColor.setVec( 1.f, 0.0f, 0.f, 1.f ); 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 @@ #include "v4color.h" extern LLColor4 gTrackColor; -extern LLColor4 gSelfMapColor; extern LLColor4 gLandmarkMapColor; extern LLColor4 gLocationMapColor; extern LLColor4 gTelehubMapColor; -extern LLColor4 gFrustumMapColor; -extern LLColor4 gRotatingFrustumMapColor; extern LLColor4 gEventColor; extern LLColor4 gPopularColor; extern 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 @@ #include "llviewerprecompiledheaders.h" -// self include #include "llfloatermap.h" -// Library includes -#include "llfontgl.h" -#include "llinventory.h" -#include "message.h" - -// Viewer includes #include "llagent.h" #include "llcolorscheme.h" #include "llviewercontrol.h" #include "lldraghandle.h" -#include "lleconomy.h" -#include "llfloaterworldmap.h" -#include "llfocusmgr.h" #include "llnetmap.h" #include "llregionhandle.h" #include "llresizebar.h" -#include "llresizehandle.h" -#include "llresmgr.h" -#include "llsky.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "llstatgraph.h" -#include "llstatusbar.h" -//#include "lltextbox.h" -#include "llui.h" -#include "llviewermenu.h" -#include "llviewerparceloverlay.h" -#include "llviewerregion.h" -#include "llviewerstats.h" -#include "llurlsimstring.h" - -#include "llglheaders.h" - -// -// Constants -// -const S32 LEGEND_SIZE = 16; - -const S32 HPAD = 4; - -const S32 MAP_COMBOBOX_WIDTH = 128; -const S32 MAP_COMBOBOX_HEIGHT = 20; -const S32 GO_BTN_WIDTH = 20; -const S32 SLIDER_WIDTH = LEGEND_SIZE + MAP_COMBOBOX_WIDTH + HPAD + GO_BTN_WIDTH - HPAD; -const S32 SLIDER_HEIGHT = 16; - -const S32 SIM_STAT_WIDTH = 8; - -const S32 MAP_SCALE_MIN = 35; // in pixels per sim -const S32 MAP_SCALE_MAX = 180; // in pixels per sim -const S32 MAP_SCALE_INCREMENT = 5; - -const S32 NETMAP_MIN_WIDTH = 128; -const S32 NETMAP_MIN_HEIGHT = 128; - -const S32 FLOATERMAP_MIN_WIDTH = - SLIDER_WIDTH + - 2 * (HPAD + LLPANEL_BORDER_WIDTH); - -const S32 MORE_BTN_VPAD = 2; - -const S32 SPIN_VPAD = 4; - -const S32 TRACKING_LABEL_HEIGHT = 16; - -const S32 FLOATERMAP_MIN_HEIGHT_LARGE = 60; - -// -// Globals -// -LLFloaterMap *gFloaterMap = NULL; - +#include "lluictrlfactory.h" +LLFloaterMap::LLFloaterMap(const LLSD& key) + : + LLFloater(std::string("minimap")), + mPanelMap(NULL) +{ + LLCallbackMap::map_t factory_map; + factory_map["mini_mapview"] = LLCallbackMap(createPanelMiniMap, this); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_mini_map.xml", &factory_map, FALSE); +} -// -// Member functions -// +// static +void* LLFloaterMap::createPanelMiniMap(void* data) +{ + LLFloaterMap* self = (LLFloaterMap*)data; + self->mPanelMap = new LLNetMap("Mapview"); + return self->mPanelMap; +} -LLFloaterMap::LLFloaterMap(const std::string& name) - : - LLFloater(name, - std::string("FloaterMiniMapRect"), - LLStringUtil::null, - TRUE, - FLOATERMAP_MIN_WIDTH, - FLOATERMAP_MIN_HEIGHT_LARGE, - FALSE, - FALSE, - TRUE) // close button +BOOL LLFloaterMap::postBuild() { - const S32 LEFT = LLPANEL_BORDER_WIDTH; - const S32 TOP = getRect().getHeight(); - - S32 y = 0; - - // Map itself - LLRect map_rect( - LEFT, - TOP - LLPANEL_BORDER_WIDTH, - getRect().getWidth() - LLPANEL_BORDER_WIDTH, - y ); - LLColor4 bg_color = gColors.getColor( "NetMapBackgroundColor" ); - mMap = new LLNetMap("Net Map", map_rect, bg_color); - mMap->setFollowsAll(); - addChildAtEnd(mMap); - - // Get the drag handle all the way in back + // Send the drag handle to the back, but make sure close stays on top sendChildToBack(getDragHandle()); - + sendChildToFront(getChild("llfloater_close_btn")); setIsChrome(TRUE); + return TRUE; } @@ -154,11 +77,11 @@ LLFloaterMap::~LLFloaterMap() // virtual -void LLFloaterMap::setVisible(BOOL visible) +void LLFloaterMap::onOpen() { - LLFloater::setVisible(visible); + gFloaterView->adjustToFitScreen(this, FALSE); - gSavedSettings.setBOOL("ShowMiniMap", visible); + gSavedSettings.setBOOL("ShowMiniMap", TRUE); } @@ -188,7 +111,7 @@ void LLFloaterMap::draw() setMouseOpaque(FALSE); getDragHandle()->setMouseOpaque(FALSE); - drawChild(mMap); + drawChild(mPanelMap); } else { @@ -199,18 +122,3 @@ void LLFloaterMap::draw() } } -// static -void LLFloaterMap::toggle(void*) -{ - if( gFloaterMap ) - { - if (gFloaterMap->getVisible()) - { - gFloaterMap->close(); - } - else - { - gFloaterMap->open(); /* Flawfinder: ignore */ - } - } -} 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 @@ class LLNetMap; -// -// Classes -// -class LLFloaterMap -: public LLFloater +class LLFloaterMap : + public LLFloater, + public LLFloaterSingleton { + friend class LLUISingleton >; public: - LLFloaterMap(const std::string& name); virtual ~LLFloaterMap(); - static void toggle(void*); + static void* createPanelMiniMap(void* data); + + BOOL postBuild(); - /*virtual*/ void setVisible(BOOL visible); /*virtual*/ void draw(); + /*virtual*/ void onOpen(); /*virtual*/ void onClose(bool app_quitting); /*virtual*/ BOOL canClose(); -protected: - LLNetMap* mMap; +private: + LLFloaterMap(const LLSD& key = LLSD()); + LLNetMap* mPanelMap; }; - -// -// Globals -// - -extern LLFloaterMap *gFloaterMap; - #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*) void handle_mini_map(void*) { - LLFloaterMap::toggle(NULL); + LLFloaterMap::toggleInstance(); } 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 @@ #include "llcallingcard.h" #include "llcolorscheme.h" #include "llviewercontrol.h" +#include "llfloateravatarinfo.h" #include "llfloaterworldmap.h" -#include "llfloatermap.h" #include "llframetimer.h" #include "lltracker.h" #include "llmenugl.h" -#include "llstatgraph.h" #include "llsurface.h" #include "lltextbox.h" +#include "lluictrlfactory.h" #include "lluuid.h" #include "llviewercamera.h" #include "llviewerimage.h" #include "llviewerimagelist.h" #include "llviewermenu.h" #include "llviewerobjectlist.h" -#include "llviewermenu.h" -#include "llviewerparceloverlay.h" #include "llviewerregion.h" #include "llviewerwindow.h" #include "llvoavatar.h" @@ -73,19 +71,14 @@ const F32 MAP_SCALE_MIN = 32; const F32 MAP_SCALE_MID = 172; const F32 MAP_SCALE_MAX = 512; const F32 MAP_SCALE_INCREMENT = 16; +const F32 MAP_MIN_PICK_DIST = 4; +const F32 MAP_MINOR_DIR_THRESHOLD = 0.08f; const S32 TRACKING_RADIUS = 3; -//static -BOOL LLNetMap::sRotateMap = FALSE; -LLNetMap* LLNetMap::sInstance = NULL; - -LLNetMap::LLNetMap( - const std::string& name, - const LLRect& rect, - const LLColor4& bg_color ) - : - LLUICtrl(name, rect, FALSE, NULL, NULL), mBackgroundColor( bg_color ), +LLNetMap::LLNetMap(const std::string& name) : + LLPanel(name), + mScale(128.f), mObjectMapTPM(1.f), mObjectMapPixels(255.f), mTargetPanX( 0.f ), @@ -94,109 +87,57 @@ LLNetMap::LLNetMap( mCurPanY( 0.f ), mUpdateNow( FALSE ) { - mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS; - - LLNetMap::sRotateMap = gSavedSettings.getBOOL( "MiniMapRotate" ); - - glyph_color_avatar = gColors.getColor("NetMapGlyphColorAvatar"); - glyph_color_friend = gColors.getColor("NetMapGlyphColorFriend"); - - // Surface texture is dynamically generated/updated. -// createObjectImage(); + mScale = gSavedSettings.getF32("MiniMapScale"); + mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); mObjectImageCenterGlobal = gAgent.getCameraPositionGlobal(); - // TODO: exteralize hardcoded constants. - const S32 DIR_WIDTH = 10; - const S32 DIR_HEIGHT = 10; - LLRect major_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH, 0 ); - const LLColor4 minor_color( 1.f, 1.f, 1.f, .7f ); - const LLRect minor_dir_rect( 0, DIR_HEIGHT, DIR_WIDTH * 2, 0 ); - - // Note: removing special treatment for north compass point (DEV-10559). -MG - //mTextBoxNorth = new LLTextBox( "N", major_dir_rect ); - //mTextBoxNorth->setFontStyle(LLFontGL::DROP_SHADOW_SOFT); - //addChild( mTextBoxNorth ); - mTextBoxNorth = new LLTextBox( std::string("N"), major_dir_rect ); - mTextBoxNorth->setColor( minor_color ); - addChild( mTextBoxNorth ); - - mTextBoxEast = new LLTextBox( std::string("E"), major_dir_rect ); - mTextBoxEast->setColor( minor_color ); - addChild( mTextBoxEast ); - - major_dir_rect.mRight += 1 ; - mTextBoxWest = new LLTextBox( std::string("W"), major_dir_rect ); - mTextBoxWest->setColor( minor_color ); - addChild( mTextBoxWest ); - major_dir_rect.mRight -= 1 ; - - mTextBoxSouth = new LLTextBox( std::string("S"), major_dir_rect ); - mTextBoxSouth->setColor( minor_color ); - addChild( mTextBoxSouth ); - - mTextBoxSouthEast = new LLTextBox( std::string("SE"), minor_dir_rect ); - mTextBoxSouthEast->setColor( minor_color ); - addChild( mTextBoxSouthEast ); - - mTextBoxNorthEast = new LLTextBox( std::string("NE"), minor_dir_rect ); - mTextBoxNorthEast->setColor( minor_color ); - addChild( mTextBoxNorthEast ); - - mTextBoxSouthWest = new LLTextBox( std::string("SW"), minor_dir_rect ); - mTextBoxSouthWest->setColor( minor_color ); - addChild( mTextBoxSouthWest ); - - mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); - mTextBoxNorthWest->setColor( minor_color ); - addChild( mTextBoxNorthWest ); - - // Right-click menu - LLMenuGL* menu; - menu = new LLMenuGL(std::string("popup")); - menu->setCanTearOff(FALSE); - menu->append(new LLMenuItemCallGL(std::string("Zoom Close"), handleZoomLevel, - NULL, (void*)2) ); - menu->append(new LLMenuItemCallGL(std::string("Zoom Medium"), handleZoomLevel, - NULL, (void*)1) ); - menu->append(new LLMenuItemCallGL(std::string("Zoom Far"), handleZoomLevel, - NULL, (void*)0) ); - menu->appendSeparator(); - menu->append(new LLMenuItemCallGL(std::string("Stop Tracking"), &LLTracker::stopTracking, - &LLTracker::isTracking, NULL) ); + // Register event listeners for popup menu + (new LLScaleMap())->registerListener(this, "MiniMap.ZoomLevel"); + (new LLStopTracking())->registerListener(this, "MiniMap.StopTracking"); + (new LLEnableTracking())->registerListener(this, "MiniMap.EnableTracking"); + (new LLShowAgentProfile())->registerListener(this, "MiniMap.ShowProfile"); + (new LLEnableProfile())->registerListener(this, "MiniMap.EnableProfile"); + + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_mini_map.xml"); + + updateMinorDirections(); + + LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_mini_map.xml", this); + if (!menu) + { + menu = new LLMenuGL(LLStringUtil::null); + } menu->setVisible(FALSE); - addChild(menu); mPopupMenuHandle = menu->getHandle(); - - sInstance = this; } LLNetMap::~LLNetMap() { - sInstance = NULL; } void LLNetMap::setScale( F32 scale ) { - gMiniMapScale = scale; - if (gMiniMapScale == 0.f) + mScale = scale; + if (mScale == 0.f) { - gMiniMapScale = 0.1f; + mScale = 0.1f; } + gSavedSettings.setF32("MiniMapScale", mScale); if (mObjectImagep.notNull()) { - F32 half_width = (F32)(getRect().getWidth() / 2); - F32 half_height = (F32)(getRect().getHeight() / 2); - F32 radius = sqrt( half_width * half_width + half_height * half_height ); - F32 region_widths = (2.f*radius)/gMiniMapScale; + F32 width = (F32)(getRect().getWidth()); + F32 height = (F32)(getRect().getHeight()); + F32 diameter = sqrt(width * width + height * height); + F32 region_widths = diameter / mScale; F32 meters = region_widths * LLWorld::getInstance()->getRegionWidthInMeters(); F32 num_pixels = (F32)mObjectImagep->getWidth(); - mObjectMapTPM = num_pixels/meters; - mObjectMapPixels = 2.f*radius; + mObjectMapTPM = num_pixels / meters; + mObjectMapPixels = diameter; } - mPixelsPerMeter = gMiniMapScale / REGION_WIDTH_METERS; + mPixelsPerMeter = mScale / LLWorld::getInstance()->getRegionWidthInMeters(); mUpdateNow = TRUE; } @@ -218,16 +159,16 @@ void LLNetMap::draw() { createObjectImage(); } - + mCurPanX = lerp(mCurPanX, mTargetPanX, LLCriticalDamp::getInterpolant(0.1f)); mCurPanY = lerp(mCurPanY, mTargetPanY, LLCriticalDamp::getInterpolant(0.1f)); - // Prepare a scissor region F32 rotation = 0; + // Prepare a scissor region { LLGLEnable scissor(GL_SCISSOR_TEST); - + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLLocalClipRect clip(getLocalRect()); @@ -235,8 +176,11 @@ void LLNetMap::draw() glMatrixMode(GL_MODELVIEW); // Draw background rectangle - gGL.color4fv( mBackgroundColor.mV ); - gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); + if(isBackgroundVisible()) + { + gGL.color4fv(isBackgroundOpaque() ? getBackgroundColor().mV : getTransparentColor().mV); + gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0); + } } // region 0,0 is in the middle @@ -247,7 +191,8 @@ void LLNetMap::draw() gGL.translatef( (F32) center_sw_left, (F32) center_sw_bottom, 0.f); - if( LLNetMap::sRotateMap ) + BOOL rotate_map = gSavedSettings.getBOOL( "MiniMapRotate" ); + if( rotate_map ) { // rotate subsequent draws to agent rotation rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); @@ -256,35 +201,30 @@ void LLNetMap::draw() // figure out where agent is S32 region_width = llround(LLWorld::getInstance()->getRegionWidthInMeters()); + LLColor4 this_region_color = gColors.getColor( "NetMapThisRegion" ); + LLColor4 live_region_color = gColors.getColor( "NetMapLiveRegion" ); + LLColor4 dead_region_color = gColors.getColor( "NetMapDeadRegion" ); - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* regionp = *iter; // Find x and y position relative to camera's center. LLVector3 origin_agent = regionp->getOriginAgent(); LLVector3 rel_region_pos = origin_agent - gAgent.getCameraPositionAgent(); - F32 relative_x = (rel_region_pos.mV[0] / region_width) * gMiniMapScale; - F32 relative_y = (rel_region_pos.mV[1] / region_width) * gMiniMapScale; + F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale; + F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale; // background region rectangle F32 bottom = relative_y; F32 left = relative_x; - F32 top = bottom + gMiniMapScale ; - F32 right = left + gMiniMapScale ; - - if (regionp == gAgent.getRegion()) - { - gGL.color4f(1.f, 1.f, 1.f, 1.f); - } - else - { - gGL.color4f(0.8f, 0.8f, 0.8f, 1.f); - } + F32 top = bottom + mScale ; + F32 right = left + mScale ; + gGL.color4fv(regionp == gAgent.getRegion() ? this_region_color.mV : live_region_color.mV); if (!regionp->isAlive()) { - gGL.color4f(1.f, 0.5f, 0.5f, 1.f); + gGL.color4fv(dead_region_color.mV); } @@ -350,8 +290,8 @@ void LLNetMap::draw() LLVector3 map_center_agent = gAgent.getPosAgentFromGlobal(mObjectImageCenterGlobal); map_center_agent -= gAgent.getCameraPositionAgent(); - map_center_agent.mV[VX] *= gMiniMapScale/region_width; - map_center_agent.mV[VY] *= gMiniMapScale/region_width; + map_center_agent.mV[VX] *= mScale/region_width; + map_center_agent.mV[VY] *= mScale/region_width; gGL.getTexUnit(0)->bind(mObjectImagep); F32 image_half_width = 0.5f*mObjectMapPixels; @@ -373,81 +313,67 @@ void LLNetMap::draw() LLVector3d pos_global; LLVector3 pos_map; + // Mouse pointer in local coordinates + S32 local_mouse_x; + S32 local_mouse_y; + LLUI::getCursorPositionLocal(this, &local_mouse_x, &local_mouse_y); + mClosestAgentToCursor.setNull(); + F32 closest_dist = F32_MAX; + // Draw avatars - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); + LLColor4 friend_color = gColors.getColor( "MapFriend" ); + std::vector avatar_ids; + std::vector positions; + LLWorld::getInstance()->getAvatars(&avatar_ids, &positions); + for(U32 i=0; igetOriginGlobal(); - - S32 count = regionp->mMapAvatars.count(); - S32 i; - LLVector3 pos_local; - U32 compact_local; - U8 bits; // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. // just be careful to sort the avatar IDs along with the positions. -MG - for (i = 0; i < count; i++) - { - compact_local = regionp->mMapAvatars.get(i); - - bits = compact_local & 0xFF; - pos_local.mV[VZ] = F32(bits) * 4.f; - compact_local >>= 8; - - bits = compact_local & 0xFF; - pos_local.mV[VY] = (F32)bits; - compact_local >>= 8; + pos_map = globalPosToView(positions[i], rotate_map); - bits = compact_local & 0xFF; - pos_local.mV[VX] = (F32)bits; + LLWorldMapView::drawAvatar( + pos_map.mV[VX], pos_map.mV[VY], + is_agent_friend(avatar_ids[i]) ? friend_color : avatar_color, + pos_map.mV[VZ]); - pos_global.setVec( pos_local ); - pos_global += origin_global; - - pos_map = globalPosToView(pos_global); - - BOOL show_as_friend = FALSE; - if( i < regionp->mMapAvatarIDs.count()) - { - show_as_friend = is_agent_friend(regionp->mMapAvatarIDs.get(i)); - } - LLWorldMapView::drawAvatar( - pos_map.mV[VX], pos_map.mV[VY], - show_as_friend ? glyph_color_friend : glyph_color_avatar, - pos_map.mV[VZ]); + F32 dist_to_cursor = dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x,local_mouse_y)); + if(dist_to_cursor < MAP_MIN_PICK_DIST && dist_to_cursor < closest_dist) + { + closest_dist = dist_to_cursor; + mClosestAgentToCursor = avatar_ids[i]; } } // Draw dot for autopilot target if (gAgent.getAutoPilot()) { - drawTracking( gAgent.getAutoPilotTargetGlobal(), gTrackColor ); + drawTracking( gAgent.getAutoPilotTargetGlobal(), rotate_map, gTrackColor ); } else { LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); if ( LLTracker::TRACKING_AVATAR == tracking_status ) { - drawTracking( LLAvatarTracker::instance().getGlobalPos(), gTrackColor ); + drawTracking( LLAvatarTracker::instance().getGlobalPos(), rotate_map, gTrackColor ); } else if ( LLTracker::TRACKING_LANDMARK == tracking_status || LLTracker::TRACKING_LOCATION == tracking_status ) { - drawTracking( LLTracker::getTrackedPositionGlobal(), gTrackColor ); + drawTracking( LLTracker::getTrackedPositionGlobal(), rotate_map, gTrackColor ); } } // Draw dot for self avatar position pos_global = gAgent.getPositionGlobal(); - pos_map = globalPosToView(pos_global); + pos_map = globalPosToView(pos_global, rotate_map); LLUIImagePtr you = LLWorldMapView::sAvatarYouSmallImage; you->draw( llround(pos_map.mV[VX]) - you->getWidth()/2, llround(pos_map.mV[VY]) - you->getHeight()/2); // Draw frustum - F32 meters_to_pixels = gMiniMapScale/ LLWorld::getInstance()->getRegionWidthInMeters(); + F32 meters_to_pixels = mScale/ LLWorld::getInstance()->getRegionWidthInMeters(); F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); @@ -462,9 +388,9 @@ void LLNetMap::draw() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if( LLNetMap::sRotateMap ) + if( rotate_map ) { - gGL.color4fv(gFrustumMapColor.mV); + gGL.color4fv(gColors.getColor("NetMapFrustum").mV); gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( ctr_x, ctr_y ); @@ -474,7 +400,7 @@ void LLNetMap::draw() } else { - gGL.color4fv(gRotatingFrustumMapColor.mV); + gGL.color4fv(gColors.getColor("NetMapFrustumRotating").mV); // If we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); @@ -490,21 +416,26 @@ void LLNetMap::draw() } // Rotation of 0 means that North is up - setDirectionPos( mTextBoxEast, rotation ); - setDirectionPos( mTextBoxNorth, rotation + F_PI_BY_TWO ); - setDirectionPos( mTextBoxWest, rotation + F_PI ); - setDirectionPos( mTextBoxSouth, rotation + F_PI + F_PI_BY_TWO ); + setDirectionPos( getChild("e_label"), rotation); + setDirectionPos( getChild("n_label"), rotation + F_PI_BY_TWO); + setDirectionPos( getChild("w_label"), rotation + F_PI); + setDirectionPos( getChild("s_label"), rotation + F_PI + F_PI_BY_TWO); - setDirectionPos( mTextBoxNorthEast, rotation + F_PI_BY_TWO / 2); - setDirectionPos( mTextBoxNorthWest, rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2); - setDirectionPos( mTextBoxSouthWest, rotation + F_PI + F_PI_BY_TWO / 2); - setDirectionPos( mTextBoxSouthEast, rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); + setDirectionPos( getChild("ne_label"), rotation + F_PI_BY_TWO / 2); + setDirectionPos( getChild("nw_label"), rotation + F_PI_BY_TWO + F_PI_BY_TWO / 2); + setDirectionPos( getChild("sw_label"), rotation + F_PI + F_PI_BY_TWO / 2); + setDirectionPos( getChild("se_label"), rotation + F_PI + F_PI_BY_TWO + F_PI_BY_TWO / 2); - LLUICtrl::draw(); + LLView::draw(); } -LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) +void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) { + LLPanel::reshape(width, height, called_from_parent); + updateMinorDirections(); +} + +LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos, BOOL rotated ){ LLVector3d relative_pos_global = global_pos - gAgent.getCameraPositionGlobal(); LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles @@ -513,7 +444,7 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) pos_local.mV[VY] *= mPixelsPerMeter; // leave Z component in meters - if( LLNetMap::sRotateMap ) + if( rotated ) { F32 radians = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); @@ -526,10 +457,10 @@ LLVector3 LLNetMap::globalPosToView( const LLVector3d& global_pos ) return pos_local; } -void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, - BOOL draw_arrow ) +void LLNetMap::drawTracking(const LLVector3d& pos_global, BOOL rotated, + const LLColor4& color, BOOL draw_arrow ) { - LLVector3 pos_local = globalPosToView( pos_global ); + LLVector3 pos_local = globalPosToView( pos_global, rotated ); if( (pos_local.mV[VX] < 0) || (pos_local.mV[VY] < 0) || (pos_local.mV[VX] >= getRect().getWidth()) || @@ -552,22 +483,22 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, } } -LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) +LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y, BOOL rotated ) { x -= llround(getRect().getWidth() / 2 + mCurPanX); y -= llround(getRect().getHeight() / 2 + mCurPanY); - LLVector3 pos_local( (F32)x, (F32)y, 0 ); + LLVector3 pos_local( (F32)x, (F32)y, 0.f ); F32 radians = - atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); - if( LLNetMap::sRotateMap ) + if( rotated ) { LLQuaternion rot(radians, LLVector3(0.f, 0.f, 1.f)); pos_local.rotVec( rot ); } - pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / gMiniMapScale ); + pos_local *= ( LLWorld::getInstance()->getRegionWidthInMeters() / mScale ); LLVector3d pos_global; pos_global.setVec( pos_local ); @@ -579,7 +510,7 @@ LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) BOOL LLNetMap::handleScrollWheel(S32 x, S32 y, S32 clicks) { // note that clicks are reversed from what you'd think - setScale(llclamp(gMiniMapScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); + setScale(llclamp(mScale - clicks*MAP_SCALE_INCREMENT, MAP_SCALE_MIN, MAP_SCALE_MAX)); return TRUE; } @@ -590,10 +521,17 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec { return FALSE; } - LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y ) ); + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosGlobal( viewPosToGlobal( x, y , gSavedSettings.getBOOL( "MiniMapRotate" )) ); if( region ) { - msg.assign( region->getName() ); + msg.assign(""); + std::string fullname; + if(mClosestAgentToCursor.notNull() && gCacheName->getFullName(mClosestAgentToCursor, fullname)) + { + msg.append(fullname); + msg.append("\n"); + } + msg.append( region->getName() ); #ifndef LL_RELEASE_FOR_DOWNLOAD std::string buffer; @@ -618,8 +556,12 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rec &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; + handled = TRUE; + } + if(!handled) + { + return LLPanel::handleToolTip(x, y, msg, sticky_rect_screen); } - handled = TRUE; return handled; } @@ -629,19 +571,32 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) // Rotation is in radians. // Rotation of 0 means x = 1, y = 0 on the unit circle. - - F32 map_half_height = (F32)(getRect().getHeight() / 2); - F32 map_half_width = (F32)(getRect().getWidth() / 2); - F32 text_half_height = (F32)(text_box->getRect().getHeight() / 2); - F32 text_half_width = (F32)(text_box->getRect().getWidth() / 2); - F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); + F32 half_height = (F32)( (getRect().getHeight() - text_box->getRect().getHeight()) / 2); + F32 half_width = (F32)( (getRect().getWidth() - text_box->getRect().getWidth()) / 2); + F32 radius = llmin( half_height, half_width ); // Inset by a little to account for position display. radius -= 8.f; - text_box->setOrigin( - llround(map_half_width - text_half_width + radius * cos( rotation )), - llround(map_half_height - text_half_height + radius * sin( rotation )) ); + text_box->setOrigin(llround(half_width + radius * cos( rotation )), + llround(half_height + radius * sin( rotation ))); +} + +void LLNetMap::updateMinorDirections() +{ + if (getChild("ne_label") == NULL) + { + return; + } + + // Hide minor directions if they cover too much of the map + bool show_minors = getChild("ne_label")->getRect().getHeight() < MAP_MINOR_DIR_THRESHOLD * + llmin(getRect().getWidth(), getRect().getHeight()); + + getChild("ne_label")->setVisible(show_minors); + getChild("nw_label")->setVisible(show_minors); + getChild("sw_label")->setVisible(show_minors); + getChild("se_label")->setVisible(show_minors); } void 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, void LLNetMap::createObjectImage() { // Find the size of the side of a square that surrounds the circle that surrounds getRect(). - F32 half_width = (F32)(getRect().getWidth() / 2); - F32 half_height = (F32)(getRect().getHeight() / 2); - F32 radius = sqrt( half_width * half_width + half_height * half_height ); - S32 square_size = S32( 2 * radius ); + // ... which is, the diagonal of the rect. + F32 width = getRect().getWidth(); + F32 height = getRect().getHeight(); + S32 square_size = llround( sqrt(width*width + height*height) ); // Find the least power of two >= the minimum size. const S32 MIN_SIZE = 32; @@ -768,7 +723,7 @@ void LLNetMap::createObjectImage() U8* data = mObjectRawImagep->getData(); memset( data, 0, img_size * img_size * 4 ); mObjectImagep = new LLImageGL( mObjectRawImagep, FALSE); - setScale(gMiniMapScale); + setScale(mScale); } mUpdateNow = TRUE; } @@ -778,7 +733,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) if (gSavedSettings.getBOOL( "MiniMapTeleport" )) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); - gAgent.teleportViaLocation( viewPosToGlobal(x,y) ); + gAgent.teleportViaLocation( viewPosToGlobal(x,y,gSavedSettings.getBOOL("MiniMapRotate")) ); } else LLFloaterWorldMap::show(NULL, FALSE); @@ -788,6 +743,7 @@ BOOL LLNetMap::handleDoubleClick( S32 x, S32 y, MASK mask ) BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { + mClosestAgentAtLastRightClick = mClosestAgentToCursor; LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); if (menu) { @@ -800,22 +756,53 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) // static -void LLNetMap::handleZoomLevel(void* which) +bool LLNetMap::LLScaleMap::handleEvent(LLPointer event, const LLSD& userdata) { - intptr_t level = (intptr_t)which; + LLNetMap *self = mPtr; + + S32 level = userdata.asInteger(); switch(level) { case 0: - LLNetMap::sInstance->setScale(MAP_SCALE_MIN); + self->setScale(MAP_SCALE_MIN); break; case 1: - LLNetMap::sInstance->setScale(MAP_SCALE_MID); + self->setScale(MAP_SCALE_MID); break; case 2: - LLNetMap::sInstance->setScale(MAP_SCALE_MAX); + self->setScale(MAP_SCALE_MAX); break; default: break; } + + return true; +} + +bool LLNetMap::LLStopTracking::handleEvent(LLPointer event, const LLSD& userdata) +{ + LLTracker::stopTracking(NULL); + return true; +} + +bool LLNetMap::LLEnableTracking::handleEvent(LLPointer event, const LLSD& userdata) +{ + LLNetMap *self = mPtr; + self->findControl(userdata["control"].asString())->setValue(LLTracker::isTracking(NULL)); + return true; +} + +bool LLNetMap::LLShowAgentProfile::handleEvent(LLPointer event, const LLSD& userdata) +{ + LLNetMap *self = mPtr; + LLFloaterAvatarInfo::show(self->mClosestAgentAtLastRightClick); + return true; +} + +bool LLNetMap::LLEnableProfile::handleEvent(LLPointer event, const LLSD& userdata) +{ + LLNetMap *self = mPtr; + self->findControl(userdata["control"].asString())->setValue(self->isAgentUnderCursor()); + return true; } 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 @@ #ifndef LL_LLNETMAP_H #define LL_LLNETMAP_H -#include "llmath.h" -#include "lluictrl.h" +#include "llpanel.h" +#include "llmemberlistener.h" #include "v3math.h" #include "v3dmath.h" #include "v4color.h" #include "llimage.h" #include "llimagegl.h" -class LLColor4U; -class LLCoordGL; + class LLTextBox; -class LLMenuGL; -class LLNetMap : public LLUICtrl +class LLNetMap : public LLPanel { public: - LLNetMap(const std::string& name, const LLRect& rect, const LLColor4& bg_color ); + LLNetMap(const std::string& name); virtual ~LLNetMap(); virtual void draw(); + virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleToolTip( S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen ); + void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); + +private: + void setScale( F32 scale ); + + // *TODO: Enable panning of the mini-map void translatePan( F32 delta_x, F32 delta_y ); void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; } - const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; } void renderPoint(const LLVector3 &pos, const LLColor4U &color, S32 diameter, S32 relative_height = 0); - void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius ); - - LLVector3 globalPosToView(const LLVector3d& global_pos); - LLVector3d viewPosToGlobal(S32 x,S32 y); - - static void setRotateMap( BOOL b ) { LLNetMap::sRotateMap = b; } - static void handleZoomLevel(void* which); + LLVector3 globalPosToView(const LLVector3d& global_pos, BOOL rotated); + LLVector3d viewPosToGlobal(S32 x,S32 y, BOOL rotated); - void drawTracking( const LLVector3d& pos_global, - const LLColor4& color, - BOOL draw_arrow = TRUE); + void drawTracking( const LLVector3d& pos_global, + BOOL rotated, + const LLColor4& color, + BOOL draw_arrow = TRUE); -protected: void setDirectionPos( LLTextBox* text_box, F32 rotation ); + void updateMinorDirections(); void createObjectImage(); - static void teleport( const LLVector3d& destination ); - static void fly( const LLVector3d& destination ); -public: LLHandle mPopupMenuHandle; - LLColor4 mBackgroundColor; - LLColor4 glyph_color_avatar; - LLColor4 glyph_color_friend; - F32 mScale; // Size of a region in pixels F32 mPixelsPerMeter; // world meters to map pixels F32 mObjectMapTPM; // texels per meter on map @@ -101,18 +94,46 @@ public: LLVector3d mObjectImageCenterGlobal; LLPointer mObjectRawImagep; LLPointer mObjectImagep; - LLTextBox* mTextBoxEast; - LLTextBox* mTextBoxNorth; - LLTextBox* mTextBoxWest; - LLTextBox* mTextBoxSouth; - LLTextBox* mTextBoxSouthEast; - LLTextBox* mTextBoxNorthEast; - LLTextBox* mTextBoxNorthWest; - LLTextBox* mTextBoxSouthWest; +private: + LLUUID mClosestAgentToCursor; + LLUUID mClosestAgentAtLastRightClick; static BOOL sRotateMap; static LLNetMap* sInstance; + static BOOL isAgentUnderCursor(void*) { return sInstance && sInstance->mClosestAgentToCursor.notNull(); } + static void showAgentProfile(void*); + BOOL isAgentUnderCursor() { return mClosestAgentToCursor.notNull(); } + + class LLScaleMap : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; + + class LLStopTracking : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; + + class LLEnableTracking : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; + + class LLShowAgentProfile : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; + + class LLEnableProfile : public LLMemberListener + { + public: + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + }; }; 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() gLoginMenuBarView->setVisible( FALSE ); gLoginMenuBarView->setEnabled( FALSE ); - gFloaterMap->setVisible( gSavedSettings.getBOOL("ShowMiniMap") ); - LLRect window(0, gViewerWindow->getWindowHeight(), gViewerWindow->getWindowWidth(), 0); gViewerWindow->adjustControlRectanglesForFirstUse(window); + if(gSavedSettings.getBOOL("ShowMiniMap")) + { + LLFloaterMap::showInstance(); + } + if (gSavedSettings.getBOOL("ShowCameraControls")) { LLFloaterCamera::showInstance(); @@ -3911,8 +3914,7 @@ void reset_login() } // Hide any other stuff - if ( gFloaterMap ) - gFloaterMap->setVisible( FALSE ); + LLFloaterMap::hideInstance(); } //--------------------------------------------------------------------------- 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 @@ #include "llflexibleobject.h" #include "llfeaturemanager.h" #include "llviewershadermgr.h" -#include "llnetmap.h" #include "llpanelgeneral.h" #include "llpanelinput.h" #include "llsky.h" @@ -409,12 +408,6 @@ bool handleEffectColorChanged(const LLSD& newvalue) return true; } -bool handleRotateNetMapChanged(const LLSD& newvalue) -{ - LLNetMap::setRotateMap(newvalue.asBoolean()); - return true; -} - bool handleVectorizeChanged(const LLSD& newvalue) { LLViewerJointMesh::updateVectorize(); @@ -559,7 +552,6 @@ void settings_setup_listeners() gSavedSettings.getControl("UserLogFile")->getSignal()->connect(boost::bind(&handleLogFileChanged, _1)); gSavedSettings.getControl("RenderHideGroupTitle")->getSignal()->connect(boost::bind(handleHideGroupTitleChanged, _1)); gSavedSettings.getControl("EffectColor")->getSignal()->connect(boost::bind(handleEffectColorChanged, _1)); - gSavedSettings.getControl("MiniMapRotate")->getSignal()->connect(boost::bind(handleRotateNetMapChanged, _1)); gSavedSettings.getControl("VectorizePerfTest")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); gSavedSettings.getControl("VectorizeEnable")->getSignal()->connect(boost::bind(&handleVectorizeChanged, _1)); 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*); void print_object_info(void*); void print_agent_nvpairs(void*); void toggle_debug_menus(void*); -void toggle_map( void* user_data ); void export_info_callback(LLAssetInfo *info, void **user_data, S32 result); void export_data_callback(LLVFS *vfs, const LLUUID& uuid, LLAssetType::EType type, void **user_data, S32 result); void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); @@ -4578,22 +4577,6 @@ void toggle_debug_menus(void*) } -void toggle_map( void* user_data ) -{ - // Toggle the item - BOOL checked = gSavedSettings.getBOOL( static_cast(user_data) ); - gSavedSettings.setBOOL( static_cast(user_data), !checked ); - if (checked) - { - gFloaterMap->close(); - } - else - { - gFloaterMap->open(); /* Flawfinder: ignore */ - } -} - - // LLUUID gExporterRequestID; // std::string gExportDirectory; @@ -5116,7 +5099,7 @@ class LLShowFloater : public view_listener_t } else if (floater_name == "mini map") { - LLFloaterMap::toggle(NULL); + LLFloaterMap::toggleInstance(); } else if (floater_name == "stat bar") { 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 @@ #include "llface.h" #include "llfloaterproperties.h" #include "llfollowcam.h" -#include "llnetmap.h" #include "llselectmgr.h" #include "llrendersphere.h" #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 @@ #include "llfloaterreporter.h" #include "llfloaterregioninfo.h" #include "llhttpnode.h" -#include "llnetmap.h" #include "llsdutil.h" #include "llstartup.h" #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 @@ #include "llfloatereditui.h" // HACK JAMESDEBUG for ui editor #include "llfloaterland.h" #include "llfloaterinspect.h" -#include "llfloatermap.h" #include "llfloaternamedesc.h" #include "llfloaterpreference.h" #include "llfloatersnapshot.h" @@ -1840,16 +1839,6 @@ void LLViewerWindow::initWorldUI() gHoverView = new LLHoverView(std::string("gHoverView"), full_window); gHoverView->setVisible(TRUE); mRootView->addChild(gHoverView); - - // - // Map - // - // TODO: Move instance management into class - gFloaterMap = new LLFloaterMap(std::string("Map")); - gFloaterMap->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - - // keep onscreen - gFloaterView->adjustToFitScreen(gFloaterMap, FALSE); gIMMgr = LLIMMgr::getInstance(); @@ -1932,7 +1921,6 @@ void LLViewerWindow::shutdownViews() gFloaterView = NULL; gMorphView = NULL; - gFloaterMap = NULL; gHUDView = NULL; 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 ) mTextBoxNorthWest = new LLTextBox( std::string("NW"), minor_dir_rect ); mTextBoxNorthWest->setColor( minor_color ); addChild( mTextBoxNorthWest ); - - glyph_color_avatar = gColors.getColor("NetMapGlyphColorAvatar"); } @@ -866,6 +864,9 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i void LLWorldMapView::drawAgents() { F32 agents_scale = (gMapScale * 0.9f) / 256.f; + + LLColor4 avatar_color = gColors.getColor( "MapAvatar" ); + LLColor4 friend_color = gColors.getColor( "MapFriend" ); for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) { @@ -888,8 +889,8 @@ void LLWorldMapView::drawAgents() S32 agent_count = info.mExtra; sim_agent_count += info.mExtra; // Here's how we'd choose the color if info.mID were available but it's not being sent: - //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? glyph_color_friend : glyph_color_avatar; - drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, glyph_color_avatar); + //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color; + drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, avatar_color); } LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim } 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 @@ - - + + + + + + @@ -164,10 +168,13 @@ - - - - + + + + + + + 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 @@ + + + + @@ -164,10 +168,13 @@ - - - - + + + + + + + -- cgit v1.1