diff options
author | McCabe Maxsted | 2009-09-13 20:26:02 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-09-13 20:26:02 -0700 |
commit | 162ac8865cb927c561283da696570dcd68490c67 (patch) | |
tree | 46fc91ae7a03fadbb03afa5d87f15f6986f044b9 /linden/indra/newview/llfloaterwindlight.cpp | |
parent | Fixed windlight toolbar presets not applying when region default (diff) | |
download | meta-impy-162ac8865cb927c561283da696570dcd68490c67.zip meta-impy-162ac8865cb927c561283da696570dcd68490c67.tar.gz meta-impy-162ac8865cb927c561283da696570dcd68490c67.tar.bz2 meta-impy-162ac8865cb927c561283da696570dcd68490c67.tar.xz |
Added prev/next buttons for windlight presets, cleaned up some stuff
Diffstat (limited to 'linden/indra/newview/llfloaterwindlight.cpp')
-rw-r--r-- | linden/indra/newview/llfloaterwindlight.cpp | 67 |
1 files changed, 59 insertions, 8 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 1c3db9b..914513b 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp | |||
@@ -228,6 +228,10 @@ void LLFloaterWindLight::initCallbacks(void) { | |||
228 | // Dome | 228 | // Dome |
229 | childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); | 229 | childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); |
230 | childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); | 230 | childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); |
231 | |||
232 | // next/prev buttons | ||
233 | childSetAction("next", onClickNext, this); | ||
234 | childSetAction("prev", onClickPrev, this); | ||
231 | } | 235 | } |
232 | 236 | ||
233 | void LLFloaterWindLight::onClickHelp(void* data) | 237 | void LLFloaterWindLight::onClickHelp(void* data) |
@@ -318,6 +322,13 @@ void LLFloaterWindLight::syncMenu() | |||
318 | LLWLParamSet& currentParams = param_mgr->mCurParams; | 322 | LLWLParamSet& currentParams = param_mgr->mCurParams; |
319 | //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; | 323 | //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; |
320 | 324 | ||
325 | // Fixes LL "bug" (preset name isn't kept synchronized) | ||
326 | LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); | ||
327 | if (comboBox->getSelectedItemLabel() != currentParams.mName) | ||
328 | { | ||
329 | comboBox->setSimple(currentParams.mName); | ||
330 | } | ||
331 | |||
321 | // blue horizon | 332 | // blue horizon |
322 | param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); | 333 | param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); |
323 | childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); | 334 | childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); |
@@ -439,14 +450,6 @@ void LLFloaterWindLight::syncMenu() | |||
439 | childSetValue("WLGamma", param_mgr->mWLGamma.x); | 450 | childSetValue("WLGamma", param_mgr->mWLGamma.x); |
440 | 451 | ||
441 | childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); | 452 | childSetValue("WLStarAlpha", param_mgr->mCurParams.getStarBrightness()); |
442 | |||
443 | // Update combobox name | ||
444 | LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); | ||
445 | std::string current_name = param_mgr->mCurPresetName; | ||
446 | if (!current_name.empty() && current_name != comboBox->getSelectedValue().asString()) | ||
447 | { | ||
448 | comboBox->selectByValue(LLSD(current_name)); | ||
449 | } | ||
450 | } | 453 | } |
451 | 454 | ||
452 | 455 | ||
@@ -1001,3 +1004,51 @@ void LLFloaterWindLight::deactivateAnimator() | |||
1001 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; | 1004 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; |
1002 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; | 1005 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; |
1003 | } | 1006 | } |
1007 | |||
1008 | void LLFloaterWindLight::onClickNext(void* user_data) | ||
1009 | { | ||
1010 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1011 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1012 | |||
1013 | // find place of current param | ||
1014 | std::map<std::string, LLWLParamSet>::iterator mIt = | ||
1015 | param_mgr->mParamList.find(currentParams.mName); | ||
1016 | |||
1017 | // if at the end, loop | ||
1018 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
1019 | if(mIt == last) | ||
1020 | { | ||
1021 | mIt = param_mgr->mParamList.begin(); | ||
1022 | } | ||
1023 | else | ||
1024 | { | ||
1025 | mIt++; | ||
1026 | } | ||
1027 | param_mgr->mAnimator.mIsRunning = false; | ||
1028 | param_mgr->mAnimator.mUseLindenTime = false; | ||
1029 | param_mgr->loadPreset(mIt->first, true); | ||
1030 | } | ||
1031 | |||
1032 | void LLFloaterWindLight::onClickPrev(void* user_data) | ||
1033 | { | ||
1034 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1035 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1036 | |||
1037 | // find place of current param | ||
1038 | std::map<std::string, LLWLParamSet>::iterator mIt = | ||
1039 | param_mgr->mParamList.find(currentParams.mName); | ||
1040 | |||
1041 | // if at the beginning, loop | ||
1042 | if(mIt == param_mgr->mParamList.begin()) | ||
1043 | { | ||
1044 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
1045 | mIt = last; | ||
1046 | } | ||
1047 | else | ||
1048 | { | ||
1049 | mIt--; | ||
1050 | } | ||
1051 | param_mgr->mAnimator.mIsRunning = false; | ||
1052 | param_mgr->mAnimator.mUseLindenTime = false; | ||
1053 | param_mgr->loadPreset(mIt->first, true); | ||
1054 | } | ||