From 52ab75d1e59241d00a99618d8ce8f447b09de29d Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 16 Dec 2009 10:05:25 -0800 Subject: Undo previous change to this file. --- indra/newview/skins/default/xui/en/panel_prim_media_controls.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index bffb28d16e..03528c578c 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -9,7 +9,7 @@ width="800"> Inspector_Background 0.2 - 300 + 400 120 1.0 1.25 -- cgit v1.2.3 From aee5dc617242a1cb9d800b6d546798efdca7cd87 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 16 Dec 2009 11:16:41 -0800 Subject: Enable OK button in media settings panel even if nothing is changed, but have it be a no-op Review #63 This change addresses an issue where the OK button was greyed out even if nothing was different (changed) in the medias settings floater. This originally was implemented so that no "empty media" data would accidentally get added to the object. But that was confusing (the OK button should never be greyed out). This changes it so that apply() will simply be a no-op if the data has not changed, and now the OK button is always enabled. --- indra/newview/llfloatermediasettings.cpp | 59 ++++++++++++++++---------------- indra/newview/llfloatermediasettings.h | 2 +- 2 files changed, 30 insertions(+), 31 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp index 16a76723eb..5cfd56193e 100644 --- a/indra/newview/llfloatermediasettings.cpp +++ b/indra/newview/llfloatermediasettings.cpp @@ -145,18 +145,21 @@ LLFloaterMediaSettings* LLFloaterMediaSettings::getInstance() //static void LLFloaterMediaSettings::apply() { - LLSD settings; - sInstance->mPanelMediaSettingsGeneral->preApply(); - sInstance->mPanelMediaSettingsGeneral->getValues( settings ); - sInstance->mPanelMediaSettingsSecurity->preApply(); - sInstance->mPanelMediaSettingsSecurity->getValues( settings ); - sInstance->mPanelMediaSettingsPermissions->preApply(); - sInstance->mPanelMediaSettingsPermissions->getValues( settings ); - LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA ); - LLSelectMgr::getInstance()->selectionSetMediaData(settings); - sInstance->mPanelMediaSettingsGeneral->postApply(); - sInstance->mPanelMediaSettingsSecurity->postApply(); - sInstance->mPanelMediaSettingsPermissions->postApply(); + if (sInstance->haveValuesChanged()) + { + LLSD settings; + sInstance->mPanelMediaSettingsGeneral->preApply(); + sInstance->mPanelMediaSettingsGeneral->getValues( settings ); + sInstance->mPanelMediaSettingsSecurity->preApply(); + sInstance->mPanelMediaSettingsSecurity->getValues( settings ); + sInstance->mPanelMediaSettingsPermissions->preApply(); + sInstance->mPanelMediaSettingsPermissions->getValues( settings ); + LLSelectMgr::getInstance()->selectionSetMedia( LLTextureEntry::MF_HAS_MEDIA ); + LLSelectMgr::getInstance()->selectionSetMediaData(settings); + sInstance->mPanelMediaSettingsGeneral->postApply(); + sInstance->mPanelMediaSettingsSecurity->postApply(); + sInstance->mPanelMediaSettingsPermissions->postApply(); + } } //////////////////////////////////////////////////////////////////////////////// @@ -249,15 +252,6 @@ void LLFloaterMediaSettings::onTabChanged(void* user_data, bool from_click) LLTabContainer* self = (LLTabContainer*)user_data; gSavedSettings.setS32("LastMediaSettingsTab", self->getCurrentPanelIndex()); } - -//////////////////////////////////////////////////////////////////////////////// -// -void LLFloaterMediaSettings::enableOkApplyBtns( bool enable ) -{ - childSetEnabled( "OK", enable ); - childSetEnabled( "Apply", enable ); -} - //////////////////////////////////////////////////////////////////////////////// // const std::string LLFloaterMediaSettings::getHomeUrl() @@ -272,17 +266,25 @@ const std::string LLFloaterMediaSettings::getHomeUrl() // virtual void LLFloaterMediaSettings::draw() { + // Set the enabled state of the "Apply" button if values changed + childSetEnabled( "Apply", haveValuesChanged() ); + + LLFloater::draw(); +} + + +//private +bool LLFloaterMediaSettings::haveValuesChanged() const +{ + bool values_changed = false; // *NOTE: The code below is very inefficient. Better to do this // only when data change. // Every frame, check to see what the values are. If they are not - // the same as the default media data, enable the OK/Apply buttons + // the same as the initial media data, enable the OK/Apply buttons LLSD settings; sInstance->mPanelMediaSettingsGeneral->getValues( settings ); sInstance->mPanelMediaSettingsSecurity->getValues( settings ); - sInstance->mPanelMediaSettingsPermissions->getValues( settings ); - - bool values_changed = false; - + sInstance->mPanelMediaSettingsPermissions->getValues( settings ); LLSD::map_const_iterator iter = settings.beginMap(); LLSD::map_const_iterator end = settings.endMap(); for ( ; iter != end; ++iter ) @@ -295,9 +297,6 @@ void LLFloaterMediaSettings::draw() break; } } - - enableOkApplyBtns(values_changed); - - LLFloater::draw(); + return values_changed; } diff --git a/indra/newview/llfloatermediasettings.h b/indra/newview/llfloatermediasettings.h index b72e3d855d..cdfd5aa8ae 100644 --- a/indra/newview/llfloatermediasettings.h +++ b/indra/newview/llfloatermediasettings.h @@ -85,7 +85,7 @@ protected: private: - void enableOkApplyBtns( bool enable ); + bool haveValuesChanged() const; LLSD mInitialValues; bool mWaitingToClose; -- cgit v1.2.3