summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterenvsettings.cpp
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
committerRichard Nelson <richard@lindenlab.com>2009-08-04 01:12:59 +0000
commiteb853f55c07ae4a3c3f2aa05fbabcf2e4b4dc115 (patch)
tree7707fccb8d0946b6257d5ed7c5dfd3941c53eec0 /indra/newview/llfloaterenvsettings.cpp
parentdb5cda26676f376f18816013c0c5e3fbad5b20d0 (diff)
svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3
Diffstat (limited to 'indra/newview/llfloaterenvsettings.cpp')
-rw-r--r--indra/newview/llfloaterenvsettings.cpp121
1 files changed, 32 insertions, 89 deletions
diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp
index cfdf49373e..a520df36de 100644
--- a/indra/newview/llfloaterenvsettings.cpp
+++ b/indra/newview/llfloaterenvsettings.cpp
@@ -34,6 +34,7 @@
#include "llfloaterenvsettings.h"
+#include "llfloaterreg.h"
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
#include "lluictrlfactory.h"
@@ -52,12 +53,10 @@
#include <sstream>
-LLFloaterEnvSettings* LLFloaterEnvSettings::sEnvSettings = NULL;
-
-LLFloaterEnvSettings::LLFloaterEnvSettings()
- : LLFloater()
+LLFloaterEnvSettings::LLFloaterEnvSettings(const LLSD& key)
+ : LLFloater(key)
{
- LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml");
+ //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_env_settings.xml");
}
// virtual
LLFloaterEnvSettings::~LLFloaterEnvSettings()
@@ -68,31 +67,29 @@ BOOL LLFloaterEnvSettings::postBuild()
{
// load it up
initCallbacks();
+ syncMenu();
return TRUE;
}
-void LLFloaterEnvSettings::onClickHelp(void* data)
+void LLFloaterEnvSettings::onClickHelp()
{
- LLFloaterEnvSettings* self = (LLFloaterEnvSettings*)data;
- LLNotifications::instance().add(self->contextualNotification("EnvSettingsHelpButton"));
+ LLNotifications::instance().add(contextualNotification("EnvSettingsHelpButton"));
}
void LLFloaterEnvSettings::initCallbacks(void)
{
// our three sliders
- childSetCommitCallback("EnvTimeSlider", onChangeDayTime, NULL);
- childSetCommitCallback("EnvCloudSlider", onChangeCloudCoverage, NULL);
- childSetCommitCallback("EnvWaterFogSlider", onChangeWaterFogDensity,
- &LLWaterParamManager::instance()->mFogDensity);
+ getChild<LLUICtrl>("EnvTimeSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeDayTime, this, _1));
+ getChild<LLUICtrl>("EnvCloudSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeCloudCoverage, this, _1));
+ getChild<LLUICtrl>("EnvWaterFogSlider")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterFogDensity, this, _1, &LLWaterParamManager::instance()->mFogDensity));
// color picker
- childSetCommitCallback("EnvWaterColor", onChangeWaterColor,
- &LLWaterParamManager::instance()->mFogColor);
+ getChild<LLUICtrl>("EnvWaterColor")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onChangeWaterColor, this, _1, &LLWaterParamManager::instance()->mFogColor));
// WL Top
- childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, NULL);
- childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, NULL);
- childSetAction("EnvUseEstateTimeButton", onUseEstateTime, NULL);
- childSetAction("EnvSettingsHelpButton", onClickHelp, this);
+ getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedSky, this));
+ getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onOpenAdvancedWater, this));
+ getChild<LLUICtrl>("EnvUseEstateTimeButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onUseEstateTime, this));
+ getChild<LLUICtrl>("EnvSettingsHelpButton")->setCommitCallback(boost::bind(&LLFloaterEnvSettings::onClickHelp, this));
}
@@ -101,14 +98,14 @@ void LLFloaterEnvSettings::initCallbacks(void)
void LLFloaterEnvSettings::syncMenu()
{
LLSliderCtrl* sldr;
- sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider");
+ sldr = getChild<LLSliderCtrl>("EnvTimeSlider");
// sync the clock
F32 val = (F32)LLWLParamManager::instance()->mAnimator.getDayTime();
std::string timeStr = timeToString(val);
LLTextBox* textBox;
- textBox = sEnvSettings->getChild<LLTextBox>("EnvTimeText");
+ textBox = getChild<LLTextBox>("EnvTimeText");
textBox->setValue(timeStr);
@@ -127,7 +124,7 @@ void LLFloaterEnvSettings::syncMenu()
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
// sync water params
LLColor4 col = param_mgr->getFogColor();
- LLColorSwatchCtrl* colCtrl = sEnvSettings->getChild<LLColorSwatchCtrl>("EnvWaterColor");
+ LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor");
col.mV[3] = 1.0f;
colCtrl->set(col);
@@ -171,53 +168,9 @@ void LLFloaterEnvSettings::syncMenu()
}
}
-
-// static instance of it
-LLFloaterEnvSettings* LLFloaterEnvSettings::instance()
-{
- if (!sEnvSettings)
- {
- sEnvSettings = new LLFloaterEnvSettings();
- sEnvSettings->openFloater();
- sEnvSettings->setFocus(TRUE);
- }
- return sEnvSettings;
-}
-void LLFloaterEnvSettings::show()
+void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl)
{
- LLFloaterEnvSettings* envSettings = instance();
- envSettings->syncMenu();
-
- // comment in if you want the menu to rebuild each time
- //LLUICtrlFactory::getInstance()->buildFloater(envSettings, "floater_env_settings.xml");
- //envSettings->initCallbacks();
-
- envSettings->openFloater();
-}
-
-bool LLFloaterEnvSettings::isOpen()
-{
- if (sEnvSettings != NULL)
- {
- return true;
- }
- return false;
-}
-
-// virtual
-void LLFloaterEnvSettings::onClose(bool app_quitting)
-{
- if (sEnvSettings)
- {
- sEnvSettings->setVisible(FALSE);
- }
-}
-
-
-void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
-{
- LLSliderCtrl* sldr;
- sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvTimeSlider");
+ LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
// deactivate animator
LLWLParamManager::instance()->mAnimator.mIsRunning = false;
@@ -234,10 +187,9 @@ void LLFloaterEnvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
LLWLParamManager::instance()->mCurParams);
}
-void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData)
+void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl)
{
- LLSliderCtrl* sldr;
- sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvCloudSlider");
+ LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
// deactivate animator
//LLWLParamManager::instance()->mAnimator.mIsRunning = false;
@@ -247,17 +199,10 @@ void LLFloaterEnvSettings::onChangeCloudCoverage(LLUICtrl* ctrl, void* userData)
LLWLParamManager::instance()->mCurParams.set("cloud_shadow", val);
}
-void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userData)
+void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
{
LLSliderCtrl* sldr;
- sldr = sEnvSettings->getChild<LLSliderCtrl>("EnvWaterFogSlider");
-
- if(NULL == userData)
- {
- return;
- }
-
- WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData);
+ sldr = getChild<LLSliderCtrl>("EnvWaterFogSlider");
F32 val = sldr->getValueF32();
expFloatControl->mExp = val;
@@ -267,10 +212,9 @@ void LLFloaterEnvSettings::onChangeWaterFogDensity(LLUICtrl* ctrl, void* userDat
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
+void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
*colorControl = swatch->get();
colorControl->update(LLWaterParamManager::instance()->mCurParams);
@@ -278,23 +222,22 @@ void LLFloaterEnvSettings::onChangeWaterColor(LLUICtrl* ctrl, void* userData)
}
-void LLFloaterEnvSettings::onOpenAdvancedSky(void* userData)
+void LLFloaterEnvSettings::onOpenAdvancedSky()
{
- LLFloaterWindLight::show();
+ LLFloaterReg::showInstance("env_windlight");
}
-void LLFloaterEnvSettings::onOpenAdvancedWater(void* userData)
+void LLFloaterEnvSettings::onOpenAdvancedWater()
{
- LLFloaterWater::show();
+ LLFloaterReg::showInstance("env_water");
}
-void LLFloaterEnvSettings::onUseEstateTime(void* userData)
+void LLFloaterEnvSettings::onUseEstateTime()
{
- if(LLFloaterWindLight::isOpen())
+ LLFloaterWindLight* wl = LLFloaterReg::findTypedInstance<LLFloaterWindLight>("env_windlight");
+ if(wl)
{
- // select the blank value in
- LLFloaterWindLight* wl = LLFloaterWindLight::instance();
LLComboBox* box = wl->getChild<LLComboBox>("WLPresetsCombo");
box->selectByValue("");
}