diff options
author | Rider Linden <rider@lindenlab.com> | 2018-08-15 13:35:53 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-08-15 13:35:53 -0700 |
commit | eadf0b910174274e7c83fe37e417f576a7350edb (patch) | |
tree | 1560b09670fba4b867026f0ac7d087dacb1946b2 /indra/newview/llfloaterland.cpp | |
parent | 30ef616af5cfbb552458e88acd9f803aa076a08b (diff) |
MAINT-8990, MAINT-9002: First pass rework on environment panels, region/parcel
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r-- | indra/newview/llfloaterland.cpp | 133 |
1 files changed, 65 insertions, 68 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 995b5aaffc..5fcd3df7a8 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -145,14 +145,19 @@ class LLPanelLandEnvironment : public LLPanelEnvironmentInfo { public: - LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp); + LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp); - virtual BOOL postBuild(); - virtual void refresh(); + virtual bool isRegion() const override { return false; } + virtual BOOL postBuild() override; + virtual void refresh() override; + + virtual LLParcel * getParcel() override; + + virtual bool canEdit(); protected: - virtual void doApply(); + virtual void doApply(); LLSafeHandle<LLParcelSelection>& mParcel; @@ -3257,88 +3262,80 @@ BOOL LLPanelLandEnvironment::postBuild() if (!LLPanelEnvironmentInfo::postBuild()) return FALSE; - mAllowOverRide->setVisible(FALSE); + getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION)); + getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE); return TRUE; } void LLPanelLandEnvironment::refresh() { - /*TODO: if legacy don't do any of this.*/ + if (gDisconnected) + return; - LLParcel* parcel = mParcel->getParcel(); + LLParcel *parcel = getParcel(); if (!parcel) { - mRegionSettingsRadioGroup->setEnabled(FALSE); - mDayLengthSlider->setEnabled(FALSE); - mDayOffsetSlider->setEnabled(FALSE); - mAllowOverRide->setEnabled(FALSE); - + LL_INFOS("ENVPANEL") << "No parcel selected." << LL_ENDL; + mCurrentEnvironment.reset(); + mCurrentParcelId = INVALID_PARCEL_ID; + setControlsEnabled(false); return; } - //BOOL owner_or_god = gAgent.isGodlike() || (parcel owner or group) - BOOL owner_or_god = true; - //BOOL owner_or_god_or_manager = owner_or_god || (region && region->isEstateManager()); - - F64Hours daylength; - F64Hours dayoffset; - - LLEnvironment::EnvSelection_t env = LLEnvironment::ENV_PARCEL; - - if (!LLEnvironment::instance().hasEnvironment(env)) - env = LLEnvironment::ENV_REGION; - - daylength = LLEnvironment::instance().getEnvironmentDayLength(env); - dayoffset = LLEnvironment::instance().getEnvironmentDayOffset(env); - - LLSettingsDay::ptr_t pday = LLEnvironment::instance().getEnvironmentDay(env); - - mEditingDayCycle = pday->buildClone(); - - LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_EDIT, mEditingDayCycle, daylength, dayoffset); + if ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID())) + { + mCurrentParcelId = parcel->getLocalID(); + refreshFromSource(); + return; + } - if (dayoffset.value() > 12.0) - dayoffset = dayoffset - F32Hours(24.0f); + LLPanelEnvironmentInfo::refresh(); - mDayLengthSlider->setValue(daylength.value()); - mDayOffsetSlider->setValue(dayoffset.value()); +} - //mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1); - mRegionSettingsRadioGroup->setSelectedIndex(1); +LLParcel *LLPanelLandEnvironment::getParcel() +{ + return mParcel->getParcel(); +} - setControlsEnabled(owner_or_god); +bool LLPanelLandEnvironment::canEdit() +{ + LLParcel *parcel = getParcel(); + if (!parcel) + return false; + return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel); } void LLPanelLandEnvironment::doApply() { - LLParcel* parcel = mParcel->getParcel(); - if (!parcel) - { - LL_WARNS("PARCEL") << "Could not get parcel." << LL_ENDL; - return; - } - S32 parcel_id = parcel->getLocalID(); - - if (mRegionSettingsRadioGroup->getSelectedIndex() == 0) - { - LLEnvironment::instance().resetParcel(parcel_id); - } - else - { - LLSettingsDay::Seconds daylength; - F32Hours dayoffset_h; - - daylength = F32Hours(mDayLengthSlider->getValueF32()); - dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32()); - - if (dayoffset_h.value() < 0) - { - dayoffset_h = F32Hours(24.0f) + dayoffset_h; - } - - LLSettingsDay::Seconds dayoffset_s = dayoffset_h; - - LLEnvironment::instance().updateParcel(parcel_id, mEditingDayCycle, daylength.value(), dayoffset_s.value()); - } +// LLParcel* parcel = mParcel->getParcel(); +// if (!parcel) +// { +// LL_WARNS("PARCEL") << "Could not get parcel." << LL_ENDL; +// return; +// } +// S32 parcel_id = parcel->getLocalID(); +// +// if (mRegionSettingsRadioGroup->getSelectedIndex() == 0) +// { +// LLEnvironment::instance().resetParcel(parcel_id); +// } +// else +// { +// LLSettingsDay::Seconds daylength; +// F32Hours dayoffset_h; +// +// daylength = F32Hours(mDayLengthSlider->getValueF32()); +// dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32()); +// +// if (dayoffset_h.value() < 0) +// { +// dayoffset_h = F32Hours(24.0f) + dayoffset_h; +// } +// +// LLSettingsDay::Seconds dayoffset_s = dayoffset_h; +// +// LLEnvironment::instance().updateParcel(parcel_id, mEditingDayCycle, daylength.value(), dayoffset_s.value()); +// } } |