diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llfloaterwindlight.cpp | 99 |
1 files changed, 92 insertions, 7 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 98b3157..5468ca4 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp | |||
@@ -47,6 +47,7 @@ | |||
47 | #include "llcombobox.h" | 47 | #include "llcombobox.h" |
48 | #include "lllineeditor.h" | 48 | #include "lllineeditor.h" |
49 | #include "llfloaterdaycycle.h" | 49 | #include "llfloaterdaycycle.h" |
50 | #include "lltabcontainer.h" | ||
50 | #include "llboost.h" | 51 | #include "llboost.h" |
51 | 52 | ||
52 | #include "v4math.h" | 53 | #include "v4math.h" |
@@ -61,6 +62,7 @@ | |||
61 | 62 | ||
62 | #undef max | 63 | #undef max |
63 | 64 | ||
65 | |||
64 | LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; | 66 | LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; |
65 | 67 | ||
66 | std::set<std::string> LLFloaterWindLight::sDefaultPresets; | 68 | std::set<std::string> LLFloaterWindLight::sDefaultPresets; |
@@ -228,6 +230,10 @@ void LLFloaterWindLight::initCallbacks(void) { | |||
228 | // Dome | 230 | // Dome |
229 | childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); | 231 | childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); |
230 | childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); | 232 | childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); |
233 | |||
234 | // next/prev buttons | ||
235 | childSetAction("next", onClickNext, this); | ||
236 | childSetAction("prev", onClickPrev, this); | ||
231 | } | 237 | } |
232 | 238 | ||
233 | void LLFloaterWindLight::onClickHelp(void* data) | 239 | void LLFloaterWindLight::onClickHelp(void* data) |
@@ -314,6 +320,15 @@ void LLFloaterWindLight::syncMenu() | |||
314 | LLWLParamSet& currentParams = param_mgr->mCurParams; | 320 | LLWLParamSet& currentParams = param_mgr->mCurParams; |
315 | //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; | 321 | //std::map<std::string, LLVector4> & currentParams = param_mgr->mCurParams.mParamValues; |
316 | 322 | ||
323 | // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | ||
324 | // Fixes LL "bug" (preset name isn't kept synchronized) | ||
325 | LLComboBox* comboBox = getChild<LLComboBox>("WLPresetsCombo"); | ||
326 | if (comboBox->getSelectedItemLabel() != currentParams.mName) | ||
327 | { | ||
328 | comboBox->setSimple(currentParams.mName); | ||
329 | } | ||
330 | // [/RLVa:KB] | ||
331 | |||
317 | // blue horizon | 332 | // blue horizon |
318 | param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); | 333 | param_mgr->mBlueHorizon = currentParams.getVector(param_mgr->mBlueHorizon.mName, err); |
319 | childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); | 334 | childSetValue("WLBlueHorizonR", param_mgr->mBlueHorizon.r / 2.0); |
@@ -451,14 +466,26 @@ LLFloaterWindLight* LLFloaterWindLight::instance() | |||
451 | } | 466 | } |
452 | void LLFloaterWindLight::show() | 467 | void LLFloaterWindLight::show() |
453 | { | 468 | { |
454 | LLFloaterWindLight* windLight = instance(); | 469 | if (!sWindLight) |
455 | windLight->syncMenu(); | 470 | { |
456 | 471 | LLFloaterWindLight* windLight = instance(); | |
457 | // comment in if you want the menu to rebuild each time | 472 | windLight->syncMenu(); |
458 | //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); | ||
459 | //windLight->initCallbacks(); | ||
460 | 473 | ||
461 | windLight->open(); | 474 | // comment in if you want the menu to rebuild each time |
475 | //LLUICtrlFactory::getInstance()->buildFloater(windLight, "floater_windlight_options.xml"); | ||
476 | //windLight->initCallbacks(); | ||
477 | } | ||
478 | else | ||
479 | { | ||
480 | if (sWindLight->getVisible()) | ||
481 | { | ||
482 | sWindLight->close(); | ||
483 | } | ||
484 | else | ||
485 | { | ||
486 | sWindLight->open(); | ||
487 | } | ||
488 | } | ||
462 | } | 489 | } |
463 | 490 | ||
464 | bool LLFloaterWindLight::isOpen() | 491 | bool LLFloaterWindLight::isOpen() |
@@ -993,3 +1020,61 @@ void LLFloaterWindLight::deactivateAnimator() | |||
993 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; | 1020 | LLWLParamManager::instance()->mAnimator.mIsRunning = false; |
994 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; | 1021 | LLWLParamManager::instance()->mAnimator.mUseLindenTime = false; |
995 | } | 1022 | } |
1023 | |||
1024 | void LLFloaterWindLight::onClickNext(void* user_data) | ||
1025 | { | ||
1026 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1027 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1028 | |||
1029 | // find place of current param | ||
1030 | std::map<std::string, LLWLParamSet>::iterator mIt = | ||
1031 | param_mgr->mParamList.find(currentParams.mName); | ||
1032 | |||
1033 | // if at the end, loop | ||
1034 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
1035 | if(mIt == last) | ||
1036 | { | ||
1037 | mIt = param_mgr->mParamList.begin(); | ||
1038 | } | ||
1039 | else | ||
1040 | { | ||
1041 | mIt++; | ||
1042 | } | ||
1043 | param_mgr->mAnimator.mIsRunning = false; | ||
1044 | param_mgr->mAnimator.mUseLindenTime = false; | ||
1045 | param_mgr->loadPreset(mIt->first, true); | ||
1046 | } | ||
1047 | |||
1048 | void LLFloaterWindLight::onClickPrev(void* user_data) | ||
1049 | { | ||
1050 | LLWLParamManager * param_mgr = LLWLParamManager::instance(); | ||
1051 | LLWLParamSet& currentParams = param_mgr->mCurParams; | ||
1052 | |||
1053 | // find place of current param | ||
1054 | std::map<std::string, LLWLParamSet>::iterator mIt = | ||
1055 | param_mgr->mParamList.find(currentParams.mName); | ||
1056 | |||
1057 | // if at the beginning, loop | ||
1058 | if(mIt == param_mgr->mParamList.begin()) | ||
1059 | { | ||
1060 | std::map<std::string, LLWLParamSet>::iterator last = param_mgr->mParamList.end(); --last; | ||
1061 | mIt = last; | ||
1062 | } | ||
1063 | else | ||
1064 | { | ||
1065 | mIt--; | ||
1066 | } | ||
1067 | param_mgr->mAnimator.mIsRunning = false; | ||
1068 | param_mgr->mAnimator.mUseLindenTime = false; | ||
1069 | param_mgr->loadPreset(mIt->first, true); | ||
1070 | } | ||
1071 | |||
1072 | //static | ||
1073 | void LLFloaterWindLight::selectTab(std::string tab_name) | ||
1074 | { | ||
1075 | if (!tab_name.empty()) | ||
1076 | { | ||
1077 | LLTabContainer* tabs = LLFloaterWindLight::instance()->getChild<LLTabContainer>("WindLight Tabs"); | ||
1078 | tabs->selectTabByName(tab_name); | ||
1079 | } | ||
1080 | } | ||