summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterwater.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/llfloaterwater.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/llfloaterwater.cpp')
-rw-r--r--indra/newview/llfloaterwater.cpp215
1 files changed, 73 insertions, 142 deletions
diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp
index 5b551af836..72c82c178b 100644
--- a/indra/newview/llfloaterwater.cpp
+++ b/indra/newview/llfloaterwater.cpp
@@ -37,6 +37,7 @@
#include "pipeline.h"
#include "llsky.h"
+#include "llfloaterreg.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "llcolorswatch.h"
@@ -62,15 +63,19 @@
#undef max
-LLFloaterWater* LLFloaterWater::sWaterMenu = NULL;
-
std::set<std::string> LLFloaterWater::sDefaultPresets;
-LLFloaterWater::LLFloaterWater()
- : LLFloater()
+LLFloaterWater::LLFloaterWater(const LLSD& key)
+ : LLFloater(key)
+{
+ //LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml");
+}
+
+LLFloaterWater::~LLFloaterWater()
+{
+}
+BOOL LLFloaterWater::postBuild()
{
- LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml");
-
std::string def_water = getString("WLDefaultWaterNames");
@@ -82,15 +87,7 @@ LLFloaterWater::LLFloaterWater()
std::string tok(*token_iter);
sDefaultPresets.insert(tok);
}
-
-
-}
-
-LLFloaterWater::~LLFloaterWater()
-{
-}
-BOOL LLFloaterWater::postBuild()
-{
+
// add the combo boxes
LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo");
@@ -108,6 +105,7 @@ BOOL LLFloaterWater::postBuild()
}
// load it up
initCallbacks();
+ syncMenu();
return TRUE;
}
void LLFloaterWater::initCallbacks(void) {
@@ -131,63 +129,58 @@ void LLFloaterWater::initCallbacks(void) {
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
- childSetCommitCallback("WaterFogColor", onWaterFogColorMoved, &param_mgr->mFogColor);
+ getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, &param_mgr->mFogColor));
//
- childSetCommitCallback("WaterGlow", onColorControlAMoved, &param_mgr->mFogColor);
+ getChild<LLUICtrl>("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterWater::onColorControlAMoved, this, _1, &param_mgr->mFogColor));
// fog density
- childSetCommitCallback("WaterFogDensity", onExpFloatControlMoved, &param_mgr->mFogDensity);
- childSetCommitCallback("WaterUnderWaterFogMod", onFloatControlMoved, &param_mgr->mUnderWaterFogMod);
+ getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterWater::onExpFloatControlMoved, this, _1, &param_mgr->mFogDensity));
+ getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mUnderWaterFogMod));
// blue density
- childSetCommitCallback("WaterNormalScaleX", onVector3ControlXMoved, &param_mgr->mNormalScale);
- childSetCommitCallback("WaterNormalScaleY", onVector3ControlYMoved, &param_mgr->mNormalScale);
- childSetCommitCallback("WaterNormalScaleZ", onVector3ControlZMoved, &param_mgr->mNormalScale);
+ getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlXMoved, this, _1, &param_mgr->mNormalScale));
+ getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlYMoved, this, _1, &param_mgr->mNormalScale));
+ getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlZMoved, this, _1, &param_mgr->mNormalScale));
// fresnel
- childSetCommitCallback("WaterFresnelScale", onFloatControlMoved, &param_mgr->mFresnelScale);
- childSetCommitCallback("WaterFresnelOffset", onFloatControlMoved, &param_mgr->mFresnelOffset);
+ getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mFresnelScale));
+ getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mFresnelOffset));
// scale above/below
- childSetCommitCallback("WaterScaleAbove", onFloatControlMoved, &param_mgr->mScaleAbove);
- childSetCommitCallback("WaterScaleBelow", onFloatControlMoved, &param_mgr->mScaleBelow);
+ getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mScaleAbove));
+ getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mScaleBelow));
// blur mult
- childSetCommitCallback("WaterBlurMult", onFloatControlMoved, &param_mgr->mBlurMultiplier);
+ getChild<LLUICtrl>("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &param_mgr->mBlurMultiplier));
// Load/save
- LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo");
-
- //childSetAction("WaterLoadPreset", onLoadPreset, comboBox);
- childSetAction("WaterNewPreset", onNewPreset, comboBox);
- childSetAction("WaterSavePreset", onSavePreset, comboBox);
- childSetAction("WaterDeletePreset", onDeletePreset, comboBox);
+// getChild<LLUICtrl>("WaterLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onLoadPreset, this));
+ getChild<LLUICtrl>("WaterNewPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onNewPreset, this));
+ getChild<LLUICtrl>("WaterSavePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onSavePreset, this));
+ getChild<LLUICtrl>("WaterDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onDeletePreset, this));
// wave direction
- childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, &param_mgr->mWave1Dir);
- childSetCommitCallback("WaterWave1DirY", onVector2ControlYMoved, &param_mgr->mWave1Dir);
- childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, &param_mgr->mWave2Dir);
- childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, &param_mgr->mWave2Dir);
+ getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &param_mgr->mWave1Dir));
+ getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &param_mgr->mWave1Dir));
+ getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &param_mgr->mWave2Dir));
+ getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &param_mgr->mWave2Dir));
- comboBox->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1));
+ getChild<LLUICtrl>("WaterPresetsCombo")->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1));
LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
- childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL);
+ getChild<LLUICtrl>("WaterNormalMap")->setCommitCallback(boost::bind(&LLFloaterWater::onNormalMapPicked, this, _1));
}
-void LLFloaterWater::onClickHelp(void* data)
+void LLFloaterWater::onClickHelp(std::string xml_alert)
{
- LLFloaterWater* self = LLFloaterWater::instance();
-
- const std::string* xml_alert = (std::string*)data;
- LLNotifications::instance().add(self->contextualNotification(*xml_alert));
+ LLNotifications::instance().add(contextualNotification(xml_alert));
}
void LLFloaterWater::initHelpBtn(const std::string& name, const std::string& xml_alert)
{
- childSetAction(name, onClickHelp, new std::string(xml_alert));
+ getChild<LLButton>(name)->setClickedCallback(boost::bind(&LLFloaterWater::onClickHelp, this, xml_alert));
}
bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& response)
@@ -201,7 +194,7 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res
}
if(option == 0) {
- LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>( "WaterPresetsCombo");
+ LLComboBox* comboBox = getChild<LLComboBox>( "WaterPresetsCombo");
LLWaterParamManager * param_mgr = LLWaterParamManager::instance();
@@ -245,7 +238,7 @@ void LLFloaterWater::syncMenu()
LLColor4 col = param_mgr->getFogColor();
childSetValue("WaterGlow", col.mV[3]);
col.mV[3] = 1.0f;
- LLColorSwatchCtrl* colCtrl = sWaterMenu->getChild<LLColorSwatchCtrl>("WaterFogColor");
+ LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("WaterFogColor");
colCtrl->set(col);
@@ -290,56 +283,15 @@ void LLFloaterWater::syncMenu()
childSetValue("WaterWave2DirX", param_mgr->mWave2Dir.mX);
childSetValue("WaterWave2DirY", param_mgr->mWave2Dir.mY);
- LLTextureCtrl* textCtrl = sWaterMenu->getChild<LLTextureCtrl>("WaterNormalMap");
+ LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
textCtrl->setImageAssetID(param_mgr->getNormalMapID());
}
-// static
-LLFloaterWater* LLFloaterWater::instance()
-{
- if (!sWaterMenu)
- {
- sWaterMenu = new LLFloaterWater();
- sWaterMenu->openFloater();
- sWaterMenu->setFocus(TRUE);
- }
- return sWaterMenu;
-}
-void LLFloaterWater::show()
-{
- LLFloaterWater* water = instance();
- water->syncMenu();
-
- // comment in if you want the menu to rebuild each time
- //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml");
- //water->initCallbacks();
-
- water->openFloater();
-}
-
-bool LLFloaterWater::isOpen()
-{
- if (sWaterMenu != NULL) {
- return true;
- }
- return false;
-}
-
-// virtual
-void LLFloaterWater::onClose(bool app_quitting)
-{
- if (sWaterMenu)
- {
- sWaterMenu->setVisible(FALSE);
- }
-}
-
// vector control callbacks
-void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData);
vectorControl->mX = sldrCtrl->getValueF32();
@@ -349,10 +301,9 @@ void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, void* userData)
}
// vector control callbacks
-void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData);
vectorControl->mY = sldrCtrl->getValueF32();
@@ -362,10 +313,9 @@ void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, void* userData)
}
// vector control callbacks
-void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vectorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(userData);
vectorControl->mZ = sldrCtrl->getValueF32();
@@ -376,10 +326,9 @@ void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, void* userData)
// vector control callbacks
-void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(userData);
vectorControl->mX = sldrCtrl->getValueF32();
@@ -389,10 +338,9 @@ void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, void* userData)
}
// vector control callbacks
-void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vectorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(userData);
vectorControl->mY = sldrCtrl->getValueF32();
@@ -402,10 +350,9 @@ void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, void* userData)
}
// color control callbacks
-void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
colorControl->mR = sldrCtrl->getValueF32();
@@ -418,7 +365,7 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
std::string name = colorControl->mSliderName;
name.append("I");
- sWaterMenu->childSetValue(name, colorControl->mR);
+ childSetValue(name, colorControl->mR);
}
colorControl->update(LLWaterParamManager::instance()->mCurParams);
@@ -426,10 +373,9 @@ void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData)
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
colorControl->mG = sldrCtrl->getValueF32();
@@ -442,7 +388,7 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
std::string name = colorControl->mSliderName;
name.append("I");
- sWaterMenu->childSetValue(name, colorControl->mG);
+ childSetValue(name, colorControl->mG);
}
@@ -451,10 +397,9 @@ void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData)
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
colorControl->mB = sldrCtrl->getValueF32();
@@ -467,7 +412,7 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
std::string name = colorControl->mSliderName;
name.append("I");
- sWaterMenu->childSetValue(name, colorControl->mB);
+ childSetValue(name, colorControl->mB);
}
colorControl->update(LLWaterParamManager::instance()->mCurParams);
@@ -475,10 +420,9 @@ void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData)
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
colorControl->mA = sldrCtrl->getValueF32();
@@ -488,10 +432,9 @@ void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, void* userData)
}
-void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
colorControl->mI = sldrCtrl->getValueF32();
@@ -538,9 +481,9 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
}
// set the sliders to the new vals
- sWaterMenu->childSetValue(rName, colorControl->mR);
- sWaterMenu->childSetValue(gName, colorControl->mG);
- sWaterMenu->childSetValue(bName, colorControl->mB);
+ childSetValue(rName, colorControl->mR);
+ childSetValue(gName, colorControl->mG);
+ childSetValue(bName, colorControl->mB);
}
// now update the current parameters and send them to shaders
@@ -548,10 +491,9 @@ void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData)
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData);
F32 val = sldrCtrl->getValueF32();
expFloatControl->mExp = val;
@@ -561,50 +503,40 @@ void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, void* userData)
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl)
{
LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl);
- WaterFloatControl * floatControl = static_cast<WaterFloatControl *>(userData);
floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult;
floatControl->update(LLWaterParamManager::instance()->mCurParams);
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* colorControl)
{
LLColorSwatchCtrl* swatch = static_cast<LLColorSwatchCtrl*>(ctrl);
- WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
*colorControl = swatch->get();
colorControl->update(LLWaterParamManager::instance()->mCurParams);
LLWaterParamManager::instance()->propagateParameters();
}
-void LLFloaterWater::onBoolToggle(LLUICtrl* ctrl, void* userData)
-{
- LLCheckBoxCtrl* cbCtrl = static_cast<LLCheckBoxCtrl*>(ctrl);
-
- bool value = cbCtrl->get();
- (*(static_cast<BOOL *>(userData))) = value;
-}
-
-void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl, void* userData)
+void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl)
{
LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(ctrl);
LLUUID textID = textCtrl->getImageAssetID();
LLWaterParamManager::instance()->setNormalMapID(textID);
}
-void LLFloaterWater::onNewPreset(void* userData)
+void LLFloaterWater::onNewPreset()
{
- LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback);
+ LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWater::newPromptCallback, this, _1, _2));
}
-void LLFloaterWater::onSavePreset(void* userData)
+void LLFloaterWater::onSavePreset()
{
// get the name
- LLComboBox* comboBox = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo");
+ LLComboBox* comboBox = getChild<LLComboBox>("WaterPresetsCombo");
// don't save the empty name
if(comboBox->getSelectedItemLabel() == "")
@@ -624,7 +556,7 @@ void LLFloaterWater::onSavePreset(void* userData)
return;
}
- LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback);
+ LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWater::saveAlertCallback, this, _1, _2));
}
bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& response)
@@ -645,9 +577,9 @@ bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& res
return false;
}
-void LLFloaterWater::onDeletePreset(void* userData)
+void LLFloaterWater::onDeletePreset()
{
- LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo");
+ LLComboBox* combo_box = getChild<LLComboBox>("WaterPresetsCombo");
if(combo_box->getSelectedValue().asString() == "")
{
@@ -656,7 +588,7 @@ void LLFloaterWater::onDeletePreset(void* userData)
LLSD args;
args["SKY"] = combo_box->getSelectedValue().asString();
- LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), deleteAlertCallback);
+ LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), boost::bind(&LLFloaterWater::deleteAlertCallback, this, _1, _2));
}
bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& response)
@@ -665,14 +597,13 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r
// if they choose delete, do it. Otherwise, don't do anything
if(option == 0)
{
- LLComboBox* combo_box = sWaterMenu->getChild<LLComboBox>("WaterPresetsCombo");
- LLFloaterDayCycle* day_cycle = NULL;
+ LLComboBox* combo_box = getChild<LLComboBox>("WaterPresetsCombo");
+ LLFloaterDayCycle* day_cycle = LLFloaterReg::findTypedInstance<LLFloaterDayCycle>("env_day_cycle");
LLComboBox* key_combo = NULL;
LLMultiSliderCtrl* mult_sldr = NULL;
- if(LLFloaterDayCycle::isOpen())
+ if (day_cycle)
{
- day_cycle = LLFloaterDayCycle::instance();
key_combo = day_cycle->getChild<LLComboBox>("WaterKeyPresets");
mult_sldr = day_cycle->getChild<LLMultiSliderCtrl>("WaterDayCycleKeys");
}
@@ -723,7 +654,7 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl)
if(!data.empty())
{
LLWaterParamManager::instance()->loadPreset(data);
- sWaterMenu->syncMenu();
+ syncMenu();
}
}