From 6989e0125a7041d3e21c6f53143aeedbb4e94b70 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 11 Oct 2009 06:59:37 -0700 Subject: Added next/prev buttons to windlight water window --- linden/indra/newview/llfloaterwater.cpp | 59 +++++++++++++++++++++- linden/indra/newview/llfloaterwater.h | 3 ++ .../skins/default/xui/en-us/floater_water.xml | 16 ++++-- 3 files changed, 72 insertions(+), 6 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/llfloaterwater.cpp b/linden/indra/newview/llfloaterwater.cpp index c42b12b..d2ea74e 100644 --- a/linden/indra/newview/llfloaterwater.cpp +++ b/linden/indra/newview/llfloaterwater.cpp @@ -168,7 +168,11 @@ void LLFloaterWater::initCallbacks(void) { LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); + childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); + + // next/prev buttons + childSetAction("next", onClickNext, this); + childSetAction("prev", onClickPrev, this); } void LLFloaterWater::onClickHelp(void* data) @@ -237,6 +241,12 @@ void LLFloaterWater::syncMenu() LLWaterParamSet & current_params = param_mgr->mCurParams; + LLComboBox* comboBox = getChild("WaterPresetsCombo"); + if (comboBox->getSelectedItemLabel() != current_params.mName) + { + comboBox->setSimple(current_params.mName); + } + // blue horizon param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); @@ -727,3 +737,50 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) sWaterMenu->syncMenu(); } +void LLFloaterWater::onClickNext(void* user_data) +{ + LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamSet& currentParams = param_mgr->mCurParams; + + // find place of current param + std::map::iterator mIt = + param_mgr->mParamList.find(currentParams.mName); + + // if at the end, loop + std::map::iterator last = param_mgr->mParamList.end(); --last; + if(mIt == last) + { + mIt = param_mgr->mParamList.begin(); + } + else + { + mIt++; + } + /*param_mgr->mAnimator.mIsRunning = false; + param_mgr->mAnimator.mUseLindenTime = false;*/ + param_mgr->loadPreset(mIt->first, true); +} + +void LLFloaterWater::onClickPrev(void* user_data) +{ + LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + LLWaterParamSet & currentParams = param_mgr->mCurParams; + + // find place of current param + std::map::iterator mIt = + param_mgr->mParamList.find(currentParams.mName); + + // if at the beginning, loop + if(mIt == param_mgr->mParamList.begin()) + { + std::map::iterator last = param_mgr->mParamList.end(); --last; + mIt = last; + } + else + { + mIt--; + } + /*param_mgr->mAnimator.mIsRunning = false; + param_mgr->mAnimator.mUseLindenTime = false;*/ + param_mgr->loadPreset(mIt->first, true); +} diff --git a/linden/indra/newview/llfloaterwater.h b/linden/indra/newview/llfloaterwater.h index 5c1fced..40704f2 100644 --- a/linden/indra/newview/llfloaterwater.h +++ b/linden/indra/newview/llfloaterwater.h @@ -127,6 +127,9 @@ private: static LLFloaterWater* sWaterMenu; static std::set sDefaultPresets; + + static void onClickNext(void* user_data); + static void onClickPrev(void* user_data); }; diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_water.xml b/linden/indra/newview/skins/default/xui/en-us/floater_water.xml index 9dcb96e..7038c93 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_water.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_water.xml @@ -11,17 +11,23 @@ width="110"> Water Presets: - +