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.cpp130
1 files changed, 130 insertions, 0 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 596b04c31c..fcf836f4a0 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -77,10 +77,12 @@
#include "lltrans.h"
#include "llpanelexperiencelisteditor.h"
#include "llpanelexperiencepicker.h"
+#include "llpanelenvironment.h"
#include "llexperiencecache.h"
#include "llweb.h"
#include "llgroupactions.h"
+#include "llenvironment.h"
const F64 COVENANT_REFRESH_TIME_SEC = 60.0f;
@@ -138,6 +140,26 @@ protected:
LLPanelExperienceListEditor* mBlocked;
};
+
+class LLPanelLandEnvironment
+ : public LLPanelEnvironmentInfo
+{
+public:
+ LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
+
+ virtual BOOL postBuild();
+ virtual void refresh();
+
+protected:
+
+ virtual void doApply();
+
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
+
+};
+
+
// inserts maturity info(icon and text) into target textbox
// names_floater - pointer to floater which contains strings with maturity icons filenames
// str_to_parse is string in format "txt1[MATURITY]txt2" where maturity icon and text will be inserted instead of [MATURITY]
@@ -277,6 +299,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed)
mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this);
mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this);
mFactoryMap["land_experiences_panel"] = LLCallbackMap(createPanelLandExperiences, this);
+ mFactoryMap["land_environment_panel"] = LLCallbackMap(createPanelLandEnvironment, this);
sObserver = new LLParcelSelectionObserver();
LLViewerParcelMgr::getInstance()->addObserver( sObserver );
@@ -318,6 +341,7 @@ void LLFloaterLand::refresh()
mPanelAccess->refresh();
mPanelCovenant->refresh();
mPanelExperiences->refresh();
+ mPanelEnvironment->refresh();
}
@@ -386,6 +410,14 @@ void* LLFloaterLand::createPanelLandExperiences(void* data)
return self->mPanelExperiences;
}
+//static
+void* LLFloaterLand::createPanelLandEnvironment(void* data)
+{
+ LLFloaterLand* self = (LLFloaterLand*)data;
+ self->mPanelEnvironment = new LLPanelLandEnvironment(self->mParcel);
+ return self->mPanelEnvironment;
+}
+
//---------------------------------------------------------------------------
// LLPanelLandGeneral
@@ -3192,3 +3224,101 @@ void LLPanelLandExperiences::refresh()
refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED);
refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED);
}
+
+//=========================================================================
+
+LLPanelLandEnvironment::LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp):
+ LLPanelEnvironmentInfo(),
+ mParcel(parcelp)
+{
+}
+
+BOOL LLPanelLandEnvironment::postBuild()
+{
+ if (!LLPanelEnvironmentInfo::postBuild())
+ return FALSE;
+
+ mAllowOverRide->setVisible(FALSE);
+ return TRUE;
+}
+
+void LLPanelLandEnvironment::refresh()
+{
+ /*TODO: if legacy don't do any of this.*/
+
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel)
+ {
+ mRegionSettingsRadioGroup->setEnabled(FALSE);
+ mDayLengthSlider->setEnabled(FALSE);
+ mDayOffsetSlider->setEnabled(FALSE);
+ mAllowOverRide->setEnabled(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)
+ {
+ LL_WARNS("PARCEL") << "Could not get parcel." << LL_ENDL;
+ }
+ 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());
+ }
+}