From a4000c3744e42fcbb638e742f3b63fa31a0dee15 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 8 May 2009 07:43:08 +0000 Subject: merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7 --- indra/newview/llfloaterwater.cpp | 61 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'indra/newview/llfloaterwater.cpp') diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index 730c1393ca..5b551af836 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -66,25 +66,11 @@ LLFloaterWater* LLFloaterWater::sWaterMenu = NULL; std::set LLFloaterWater::sDefaultPresets; -LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) +LLFloaterWater::LLFloaterWater() + : LLFloater() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_water.xml"); - // add the combo boxes - LLComboBox* comboBox = getChild("WaterPresetsCombo"); - - if(comboBox != NULL) { - - std::map::iterator mIt = - LLWaterParamManager::instance()->mParamList.begin(); - for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++) - { - comboBox->add(mIt->first); - } - - // set defaults on combo boxes - comboBox->selectByValue(LLSD("Default")); - } std::string def_water = getString("WLDefaultWaterNames"); @@ -97,14 +83,33 @@ LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) sDefaultPresets.insert(tok); } - // load it up - initCallbacks(); + } LLFloaterWater::~LLFloaterWater() { } +BOOL LLFloaterWater::postBuild() +{ + // add the combo boxes + LLComboBox* comboBox = getChild("WaterPresetsCombo"); + + if(comboBox != NULL) { + + std::map::iterator mIt = + LLWaterParamManager::instance()->mParamList.begin(); + for(; mIt != LLWaterParamManager::instance()->mParamList.end(); mIt++) + { + comboBox->add(mIt->first); + } + // set defaults on combo boxes + comboBox->selectByValue(LLSD("Default")); + } + // load it up + initCallbacks(); + return TRUE; +} void LLFloaterWater::initCallbacks(void) { // help buttons @@ -165,7 +170,7 @@ void LLFloaterWater::initCallbacks(void) { childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, ¶m_mgr->mWave2Dir); childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, ¶m_mgr->mWave2Dir); - comboBox->setCommitCallback(onChangePresetName); + comboBox->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); @@ -296,7 +301,7 @@ LLFloaterWater* LLFloaterWater::instance() if (!sWaterMenu) { sWaterMenu = new LLFloaterWater(); - sWaterMenu->open(); + sWaterMenu->openFloater(); sWaterMenu->setFocus(TRUE); } return sWaterMenu; @@ -310,7 +315,7 @@ void LLFloaterWater::show() //LLUICtrlFactory::getInstance()->buildFloater(water, "floater_water.xml"); //water->initCallbacks(); - water->open(); + water->openFloater(); } bool LLFloaterWater::isOpen() @@ -712,17 +717,13 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r } -void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) +void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) { - LLComboBox * combo_box = static_cast(ctrl); - - if(combo_box->getSimple() == "") + std::string data = ctrl->getValue().asString(); + if(!data.empty()) { - return; + LLWaterParamManager::instance()->loadPreset(data); + sWaterMenu->syncMenu(); } - - LLWaterParamManager::instance()->loadPreset( - combo_box->getSelectedValue().asString()); - sWaterMenu->syncMenu(); } -- cgit v1.2.3