summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r--indra/newview/llfloaterland.cpp101
1 files changed, 31 insertions, 70 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 995b5aaffc..57d34c5c5a 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -145,15 +145,17 @@ 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; }
-protected:
+ virtual BOOL postBuild() override;
+ virtual void refresh() override;
- virtual void doApply();
+ virtual LLParcel * getParcel() override;
+ virtual bool canEdit();
+protected:
LLSafeHandle<LLParcelSelection>& mParcel;
@@ -3257,88 +3259,47 @@ 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 (dayoffset.value() > 12.0)
- dayoffset = dayoffset - F32Hours(24.0f);
-
- mDayLengthSlider->setValue(daylength.value());
- mDayOffsetSlider->setValue(dayoffset.value());
-
- //mRegionSettingsRadioGroup->setSelectedIndex(parcel->getUsesDefaultDayCycle() ? 0 : 1);
- mRegionSettingsRadioGroup->setSelectedIndex(1);
-
- setControlsEnabled(owner_or_god);
-
-}
-
-void LLPanelLandEnvironment::doApply()
-{
- LLParcel* parcel = mParcel->getParcel();
- if (!parcel)
+ if ((!mCurrentEnvironment) || (mCurrentEnvironment->mParcelId != parcel->getLocalID()))
{
- LL_WARNS("PARCEL") << "Could not get parcel." << LL_ENDL;
+ mCurrentParcelId = parcel->getLocalID();
+ refreshFromSource();
return;
}
- S32 parcel_id = parcel->getLocalID();
- if (mRegionSettingsRadioGroup->getSelectedIndex() == 0)
- {
- LLEnvironment::instance().resetParcel(parcel_id);
- }
- else
- {
- LLSettingsDay::Seconds daylength;
- F32Hours dayoffset_h;
+ LLPanelEnvironmentInfo::refresh();
- daylength = F32Hours(mDayLengthSlider->getValueF32());
- dayoffset_h = F32Hours(mDayOffsetSlider->getValueF32());
+}
- if (dayoffset_h.value() < 0)
- {
- dayoffset_h = F32Hours(24.0f) + dayoffset_h;
- }
+LLParcel *LLPanelLandEnvironment::getParcel()
+{
+ return mParcel->getParcel();
+}
- LLSettingsDay::Seconds dayoffset_s = dayoffset_h;
- LLEnvironment::instance().updateParcel(parcel_id, mEditingDayCycle, daylength.value(), dayoffset_s.value());
- }
+bool LLPanelLandEnvironment::canEdit()
+{
+ LLParcel *parcel = getParcel();
+ if (!parcel)
+ return false;
+ return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel);
}