From db6862e15b1ff6257593eab798250316a350cf73 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 19 Apr 2011 23:24:28 +0300 Subject: STORM-1174 FIX Moved "Use Region Environment Settings" to the "World -> Edit My Environment" menu. It has been a checkbox in the environment editor. --- indra/newview/llfloaterenvsettings.cpp | 25 +------------- indra/newview/llfloaterenvsettings.h | 4 --- indra/newview/llviewermenu.cpp | 39 ++++++++++++++++++++++ .../skins/default/xui/en/floater_env_settings.xml | 10 ++---- indra/newview/skins/default/xui/en/menu_viewer.xml | 18 +++++++++- 5 files changed, 59 insertions(+), 37 deletions(-) diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index 2fa022049d..a2a6005b14 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -71,31 +71,9 @@ BOOL LLFloaterEnvSettings::postBuild() initCallbacks(); syncMenu(); - LLEnvKey::EScope cur_scope = LLEnvManager::getInstance()->getNormallyDisplayedScope(); - childSetValue("RegionWLOptIn", cur_scope == LLEnvKey::SCOPE_REGION); - return TRUE; } -void LLFloaterEnvSettings::onUseRegionEnvironment(LLUICtrl* ctrl, void* data) -{ - //LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data; - LLCheckBoxCtrl* checkbox = static_cast(ctrl); //self->getChildView("RegionWLOptIn"); - setOptIn(checkbox->getValue().asBoolean()); -} - -void LLFloaterEnvSettings::setOptIn(bool opt_in) -{ - if (opt_in) - { - LLEnvManager::getInstance()->setNormallyDisplayedScope(LLEnvKey::SCOPE_REGION); - } - else - { - LLEnvManager::getInstance()->setNormallyDisplayedScope(LLEnvKey::SCOPE_LOCAL); - } -} - void LLFloaterEnvSettings::initCallbacks(void) { // our three sliders @@ -112,8 +90,7 @@ void LLFloaterEnvSettings::initCallbacks(void) childSetCommitCallback("EnvUseEstateTimeButton", &LLFloaterEnvSettings::onUseEstateTime, NULL); getChild("EnvUseLocalTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseLocalTime)); - childSetCommitCallback("RegionWLOptIn", &LLFloaterEnvSettings::onUseRegionEnvironment, NULL); - getChild("RegionWLOptIn")->setRightMouseDownCallback(boost::bind(&LLEnvManager::dumpScopes, &LLEnvManager::instance())); + getChild("EnvUseEstateTimeButton")->setRightMouseDownCallback(boost::bind(&LLEnvManager::dumpScopes, &LLEnvManager::instance())); } diff --git a/indra/newview/llfloaterenvsettings.h b/indra/newview/llfloaterenvsettings.h index 440c73961f..b93bf07395 100644 --- a/indra/newview/llfloaterenvsettings.h +++ b/indra/newview/llfloaterenvsettings.h @@ -74,9 +74,6 @@ public: /// sync time with local clock static void onUseLocalTime(); - // opt-in for region Windlight settings - //static void onUseRegionEnvironment(LLUICtrl* ctrl, void* userData); - static void onUseRegionEnvironment(LLUICtrl*, void*); //// menu management @@ -86,7 +83,6 @@ public: private: // one instance on the inside - static void setOptIn(bool opt_in); }; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 3fe2cf3bb2..6f06e766e8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -44,6 +44,7 @@ #include "llcompilequeue.h" #include "llconsole.h" #include "lldebugview.h" +#include "llenvmanager.h" #include "llfilepicker.h" #include "llfirstuse.h" #include "llfloaterbuy.h" @@ -7633,6 +7634,42 @@ class LLWorldEnvSettings : public view_listener_t } }; +class LLWorldCheckEnvironment : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + const std::string& item = userdata.asString(); + + if (item == "use_region_settings") + { + // Check whether we're using region environment settings. + LLEnvKey::EScope cur_scope = LLEnvManager::getInstance()->getNormallyDisplayedScope(); + return cur_scope == LLEnvKey::SCOPE_REGION; + } + + return true; + } +}; + +class LLWorldEnvironment : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + const std::string& item = userdata.asString(); + + if (item == "use_region_settings") + { + // Toggle using region environment settings. + LLEnvManager* env_mgr = LLEnvManager::getInstance(); + LLEnvKey::EScope cur_scope = env_mgr->getNormallyDisplayedScope(); + LLEnvKey::EScope new_scope = (cur_scope == LLEnvKey::SCOPE_LOCAL ? LLEnvKey::SCOPE_REGION : LLEnvKey::SCOPE_LOCAL); + env_mgr->setNormallyDisplayedScope(new_scope); + } + + return true; + } +}; + /// Post-Process callbacks class LLWorldPostProcess : public view_listener_t { @@ -7881,6 +7918,8 @@ void initialize_menus() view_listener_t::addMenu(new LLWorldCheckAlwaysRun(), "World.CheckAlwaysRun"); view_listener_t::addMenu(new LLWorldEnvSettings(), "World.EnvSettings"); + view_listener_t::addEnable(new LLWorldCheckEnvironment(), "World.CheckEnvironment"); + view_listener_t::addMenu(new LLWorldEnvironment(), "World.Environment"); view_listener_t::addMenu(new LLWorldPostProcess(), "World.PostProcess"); view_listener_t::addMenu(new LLWorldDayCycle(), "World.DayCycle"); diff --git a/indra/newview/skins/default/xui/en/floater_env_settings.xml b/indra/newview/skins/default/xui/en/floater_env_settings.xml index dbd75495b1..e6cf433c8d 100644 --- a/indra/newview/skins/default/xui/en/floater_env_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_env_settings.xml @@ -1,7 +1,7 @@ -