From 7510d9581320943aa33202c881b544b72ed6f401 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 29 Oct 2009 03:35:49 -0500 Subject: Added a button that will toggle the minimap radar. --- linden/indra/newview/app_settings/settings.xml | 11 +++++ linden/indra/newview/llfloatermap.cpp | 48 ++++++++++++++++++++++ linden/indra/newview/llfloatermap.h | 4 ++ .../skins/default/xui/en-us/floater_mini_map.xml | 6 +++ 4 files changed, 69 insertions(+) (limited to 'linden') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 15bb319..e1a6f1f 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -7534,6 +7534,17 @@ Value 0 + ShowMiniMapRadar + + Comment + Reveal the minimap radar + Persist + 1 + Type + Boolean + Value + 1 + ShowMovementControls Comment diff --git a/linden/indra/newview/llfloatermap.cpp b/linden/indra/newview/llfloatermap.cpp index b9dc80e..5aed515 100644 --- a/linden/indra/newview/llfloatermap.cpp +++ b/linden/indra/newview/llfloatermap.cpp @@ -82,6 +82,8 @@ BOOL LLFloaterMap::postBuild() sendChildToFront(getChild("llfloater_minimize_btn")); sendChildToFront(getChild("llfloater_close_btn")); setIsChrome(TRUE); + + childSetAction("toggle_radar", onToggleRadar, this); return TRUE; } @@ -98,6 +100,9 @@ void LLFloaterMap::onOpen() gFloaterView->adjustToFitScreen(this, FALSE); gSavedSettings.setBOOL("ShowMiniMap", TRUE); + + bool showing_radar = gSavedSettings.getBOOL("ShowMiniMapRadar"); + setRadarVisible( showing_radar ); } @@ -154,3 +159,46 @@ PanelRadar* LLFloaterMap::getRadar() { return mPanelRadar; } + + +// static +void LLFloaterMap::onToggleRadar(void *user_data) +{ + LLFloaterMap* self = (LLFloaterMap*) user_data; + self->toggleRadarVisible(); +} + + +void LLFloaterMap::toggleRadarVisible() +{ + bool show_radar = gSavedSettings.getBOOL("ShowMiniMapRadar"); + show_radar = !show_radar; + setRadarVisible( show_radar ); +} + + +void LLFloaterMap::setRadarVisible( bool show_radar ) +{ + gSavedSettings.setBOOL("ShowMiniMapRadar", show_radar); + setRadarButtonState( show_radar ); +} + + +void LLFloaterMap::setRadarButtonState( bool showing_radar ) +{ + LLButton* toggle = getChild("toggle_radar"); + if (toggle) + { + toggle->setToggleState(showing_radar); + if (showing_radar) + { + // Expanded, so show image to offer to collapse upwards. + toggle->setImageOverlay("arrow_up.tga"); + } + else + { + // Collapsed, so show image to offer to expand downwards. + toggle->setImageOverlay("arrow_down.tga"); + } + } +} diff --git a/linden/indra/newview/llfloatermap.h b/linden/indra/newview/llfloatermap.h index 7cde970..7937836 100644 --- a/linden/indra/newview/llfloatermap.h +++ b/linden/indra/newview/llfloatermap.h @@ -67,6 +67,10 @@ private: LLNetMap* mPanelMap; PanelRadar* mPanelRadar; + static void onToggleRadar(void *user_data); + void toggleRadarVisible(); + void setRadarVisible( bool show_radar ); + void setRadarButtonState(bool showing_radar); }; #endif // LL_LLFLOATERMAP_H diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml b/linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml index b24004b..8dfd43c 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_mini_map.xml @@ -15,4 +15,10 @@ left="2" top="196" right="196" height="120" follows="left|right|bottom" /> +