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/llfloatermap.cpp | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'linden/indra/newview/llfloatermap.cpp') 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"); + } + } +} -- cgit v1.1