diff options
Diffstat (limited to 'indra/newview/llfloatereditdaycycle.cpp')
-rw-r--r-- | indra/newview/llfloatereditdaycycle.cpp | 107 |
1 files changed, 77 insertions, 30 deletions
diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 5c0991b0b3..efeec72f6e 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -41,11 +41,11 @@ // newview #include "llagent.h" -#include "lldaycyclemanager.h" -#include "llenvmanager.h" #include "llregioninfomodel.h" #include "llviewerregion.h" -#include "llwlparammanager.h" + +#include "llenvironment.h" +#include "lltrans.h" const F32 LLFloaterEditDayCycle::sHoursPerDay = 24.0f; @@ -114,7 +114,7 @@ void LLFloaterEditDayCycle::onClose(bool app_quitting) { if (!app_quitting) // there's no point to change environment if we're quitting { - LLEnvManagerNew::instance().usePrefs(); // revert changes made to current day cycle + LLEnvironment::instance().applyChosenEnvironment(); } } @@ -127,6 +127,7 @@ void LLFloaterEditDayCycle::draw() void LLFloaterEditDayCycle::initCallbacks(void) { +#if 0 mDayCycleNameEditor->setKeystrokeCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this), NULL); mDayCyclesCombo->setCommitCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleSelected, this)); mDayCyclesCombo->setTextEntryCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleNameEdited, this)); @@ -147,51 +148,55 @@ void LLFloaterEditDayCycle::initCallbacks(void) env_mgr.setRegionSettingsChangeCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsChange, this)); gAgent.addRegionChangedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionChange, this)); env_mgr.setRegionSettingsAppliedCallback(boost::bind(&LLFloaterEditDayCycle::onRegionSettingsApplied, this, _1)); - // Connect to day cycle manager events. LLDayCycleManager::instance().setModifyCallback(boost::bind(&LLFloaterEditDayCycle::onDayCycleListChange, this)); // Connect to sky preset list changes. LLWLParamManager::instance().setPresetListChangeCallback(boost::bind(&LLFloaterEditDayCycle::onSkyPresetListChange, this)); + // Connect to region info updates. LLRegionInfoModel::instance().setUpdateCallback(boost::bind(&LLFloaterEditDayCycle::onRegionInfoUpdate, this)); +#endif } void LLFloaterEditDayCycle::syncTimeSlider() { +#if 0 // set time mTimeSlider->setCurSliderValue((F32)LLWLParamManager::getInstance()->mAnimator.getDayTime() * sHoursPerDay); +#endif } void LLFloaterEditDayCycle::loadTrack() { - // clear the slider - mKeysSlider->clear(); - mSliderToKey.clear(); - - // add sliders - - LL_DEBUGS() << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << LL_ENDL; - - LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; - for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) - { - addSliderKey(it->first * sHoursPerDay, it->second); - } - - // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) - const std::string& cur_sldr = mKeysSlider->getCurSlider(); - if (strlen(cur_sldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map - { - mSkyPresetsCombo->selectByValue(mSliderToKey[cur_sldr].keyframe.toStringVal()); - } - - syncTimeSlider(); +// // clear the slider +// mKeysSlider->clear(); +// mSliderToKey.clear(); +// +// // add sliders +// +// LL_DEBUGS() << "Adding " << LLWLParamManager::getInstance()->mDay.mTimeMap.size() << " keys to slider" << LL_ENDL; +// +// LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; +// for (std::map<F32, LLWLParamKey>::iterator it = cur_dayp.mTimeMap.begin(); it != cur_dayp.mTimeMap.end(); ++it) +// { +// addSliderKey(it->first * sHoursPerDay, it->second); +// } +// +// // set drop-down menu to match preset of currently-selected keyframe (one is automatically selected initially) +// const std::string& cur_sldr = mKeysSlider->getCurSlider(); +// if (strlen(cur_sldr.c_str()) > 0) // only do this if there is a curSldr, otherwise we put an invalid entry into the map +// { +// mSkyPresetsCombo->selectByValue(mSliderToKey[cur_sldr].keyframe.toStringVal()); +// } +// +// syncTimeSlider(); } void LLFloaterEditDayCycle::applyTrack() { +#if 0 LL_DEBUGS() << "Applying track (" << mSliderToKey.size() << ")" << LL_ENDL; // if no keys, do nothing @@ -220,10 +225,12 @@ void LLFloaterEditDayCycle::applyTrack() LLWLParamManager::getInstance()->mAnimator.update( LLWLParamManager::getInstance()->mCurParams); +#endif } void LLFloaterEditDayCycle::refreshSkyPresetsList() { +#if 0 // Don't allow selecting region skies for a local day cycle, // because thus we may end up with invalid day cycle. bool include_region_skies = getSelectedDayCycle().scope == LLEnvKey::SCOPE_REGION; @@ -269,10 +276,12 @@ void LLFloaterEditDayCycle::refreshSkyPresetsList() // set defaults on combo boxes mSkyPresetsCombo->selectFirstItem(); +#endif } void LLFloaterEditDayCycle::refreshDayCyclesList() { +#if 0 llassert(isNewDay() == false); mDayCyclesCombo->removeall(); @@ -308,10 +317,12 @@ void LLFloaterEditDayCycle::refreshDayCyclesList() } mDayCyclesCombo->setLabel(getString("combo_label")); +#endif } void LLFloaterEditDayCycle::onTimeSliderMoved() { +#if 0 /// get the slider value F32 val = mTimeSlider->getCurSliderValue() / sHoursPerDay; @@ -322,10 +333,12 @@ void LLFloaterEditDayCycle::onTimeSliderMoved() // then call update once LLWLParamManager::getInstance()->mAnimator.update( LLWLParamManager::getInstance()->mCurParams); +#endif } void LLFloaterEditDayCycle::onKeyTimeMoved() { +#if 0 if (mKeysSlider->getValue().size() == 0) { return; @@ -351,10 +364,12 @@ void LLFloaterEditDayCycle::onKeyTimeMoved() mTimeCtrl->setTime24(time24); applyTrack(); +#endif } void LLFloaterEditDayCycle::onKeyTimeChanged() { +#if 0 // if no keys, skipped if (mSliderToKey.size() == 0) { @@ -372,10 +387,12 @@ void LLFloaterEditDayCycle::onKeyTimeChanged() mSliderToKey[cur_sldr].time = time; applyTrack(); +#endif } void LLFloaterEditDayCycle::onKeyPresetChanged() { +#if 0 // do nothing if no sliders if (mKeysSlider->getValue().size() == 0) { @@ -399,10 +416,12 @@ void LLFloaterEditDayCycle::onKeyPresetChanged() // Apply changes to current day cycle. applyTrack(); +#endif } void LLFloaterEditDayCycle::onAddKey() { +#if 0 llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); S32 max_sliders; @@ -420,6 +439,7 @@ void LLFloaterEditDayCycle::onAddKey() break; } +#if 0 if ((S32)mSliderToKey.size() >= max_sliders) { LLSD args; @@ -428,6 +448,7 @@ void LLFloaterEditDayCycle::onAddKey() LLNotificationsUtil::add("DayCycleTooManyKeyframes", args, LLSD(), LLNotificationFunctorRegistry::instance().DONOTHING); return; } +#endif // add the slider key std::string key_val = mSkyPresetsCombo->getSelectedValue().asString(); @@ -439,8 +460,10 @@ void LLFloaterEditDayCycle::onAddKey() // apply the change to current day cycles applyTrack(); +#endif } +#if 0 void LLFloaterEditDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) { // make a slider @@ -460,7 +483,9 @@ void LLFloaterEditDayCycle::addSliderKey(F32 time, LLWLParamKey keyframe) llassert_always(mSliderToKey.size() == mKeysSlider->getValue().size()); } +#endif +#if 0 LLWLParamKey LLFloaterEditDayCycle::getSelectedDayCycle() { LLWLParamKey dc_key; @@ -487,6 +512,7 @@ LLWLParamKey LLFloaterEditDayCycle::getSelectedDayCycle() return dc_key; } +#endif bool LLFloaterEditDayCycle::isNewDay() const { @@ -495,6 +521,7 @@ bool LLFloaterEditDayCycle::isNewDay() const void LLFloaterEditDayCycle::dumpTrack() { +#if 0 LL_DEBUGS("Windlight") << "Dumping day cycle" << LL_ENDL; LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; @@ -505,6 +532,7 @@ void LLFloaterEditDayCycle::dumpTrack() S32 m = (S32) ((time - h) * 60.0f); LL_DEBUGS("Windlight") << llformat("(%.3f) %02d:%02d", time, h, m) << " => " << it->second.name << LL_ENDL; } +#endif } void LLFloaterEditDayCycle::enableEditing(bool enable) @@ -518,6 +546,7 @@ void LLFloaterEditDayCycle::enableEditing(bool enable) void LLFloaterEditDayCycle::reset() { +#if 0 // clear the slider mKeysSlider->clear(); mSliderToKey.clear(); @@ -543,10 +572,12 @@ void LLFloaterEditDayCycle::reset() // Disable controls until a day cycle to edit is selected. enableEditing(false); } +#endif } void LLFloaterEditDayCycle::saveRegionDayCycle() { +#if 0 LLEnvManagerNew& env_mgr = LLEnvManagerNew::instance(); LLWLDayCycle& cur_dayp = LLWLParamManager::instance().mDay; // the day cycle being edited @@ -570,6 +601,7 @@ void LLFloaterEditDayCycle::saveRegionDayCycle() setApplyProgress(true); #endif +#endif } void LLFloaterEditDayCycle::setApplyProgress(bool started) @@ -595,6 +627,7 @@ bool LLFloaterEditDayCycle::getApplyProgress() const void LLFloaterEditDayCycle::onDeleteKey() { +#if 0 if (mSliderToKey.size() == 0) { return; @@ -624,10 +657,12 @@ void LLFloaterEditDayCycle::onDeleteKey() mTimeCtrl->setTime24(time24); applyTrack(); +#endif } void LLFloaterEditDayCycle::onRegionSettingsChange() { +#if 0 LL_DEBUGS("Windlight") << "Region settings changed" << LL_ENDL; if (getApplyProgress()) // our region settings have being applied @@ -643,10 +678,12 @@ void LLFloaterEditDayCycle::onRegionSettingsChange() closeFloater(); } +#endif } void LLFloaterEditDayCycle::onRegionChange() { +#if 0 LL_DEBUGS("Windlight") << "Region changed" << LL_ENDL; // If we're editing the region day cycle @@ -654,6 +691,7 @@ void LLFloaterEditDayCycle::onRegionChange() { reset(); // undoes all unsaved changes } +#endif } void LLFloaterEditDayCycle::onRegionSettingsApplied(bool success) @@ -669,6 +707,7 @@ void LLFloaterEditDayCycle::onRegionSettingsApplied(bool success) void LLFloaterEditDayCycle::onRegionInfoUpdate() { +#if 0 LL_DEBUGS("Windlight") << "Region info updated" << LL_ENDL; bool can_edit = true; @@ -680,17 +719,22 @@ void LLFloaterEditDayCycle::onRegionInfoUpdate() } enableEditing(can_edit); +#endif } void LLFloaterEditDayCycle::onDayCycleNameEdited() { +#if 0 // Disable saving a day cycle having empty name. LLWLParamKey key = getSelectedDayCycle(); mSaveButton->setEnabled(!key.name.empty()); +#endif } void LLFloaterEditDayCycle::onDayCycleSelected() { +#if 0 + LLSD day_data; LLWLParamKey dc_key = getSelectedDayCycle(); bool can_edit = true; @@ -722,12 +766,13 @@ void LLFloaterEditDayCycle::onDayCycleSelected() F32 slider_time = mTimeSlider->getCurSliderValue() / sHoursPerDay; LLWLParamManager::instance().applyDayCycleParams(day_data, dc_key.scope, slider_time); loadTrack(); - - enableEditing(can_edit); +#endif + enableEditing(false); } void LLFloaterEditDayCycle::onBtnSave() { +#if 0 LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); LLWLParamKey selected_day = getSelectedDayCycle(); @@ -763,6 +808,7 @@ void LLFloaterEditDayCycle::onBtnSave() // new preset, hence no confirmation needed onSaveConfirmed(); } +#endif } void LLFloaterEditDayCycle::onBtnCancel() @@ -785,6 +831,7 @@ bool LLFloaterEditDayCycle::onSaveAnswer(const LLSD& notification, const LLSD& r void LLFloaterEditDayCycle::onSaveConfirmed() { +#if 0 std::string name = getSelectedDayCycle().name; // Save preset. @@ -798,7 +845,7 @@ void LLFloaterEditDayCycle::onSaveConfirmed() LL_DEBUGS("Windlight") << name << " is now the new preferred day cycle" << LL_ENDL; LLEnvManagerNew::instance().setUseDayCycle(name); } - +#endif closeFloater(); } |