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.cpp189
1 files changed, 187 insertions, 2 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 3098c6d118..af0e56e448 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -79,9 +79,11 @@
#include "lltrans.h"
#include "llpanelexperiencelisteditor.h"
#include "llpanelexperiencepicker.h"
+#include "llpanelenvironment.h"
#include "llexperiencecache.h"
#include "llgroupactions.h"
+#include "llenvironment.h"
const F64 COVENANT_REFRESH_TIME_SEC = 60.0f;
@@ -139,6 +141,38 @@ protected:
LLPanelExperienceListEditor* mBlocked;
};
+
+class LLPanelLandEnvironment
+ : public LLPanelEnvironmentInfo
+{
+public:
+ LLPanelLandEnvironment(LLSafeHandle<LLParcelSelection>& parcelp);
+
+ virtual bool isRegion() const override { return false; }
+ virtual bool isLargeEnough() override
+ {
+ LLParcel *parcelp = mParcel->getParcel();
+ return ((parcelp) ? (parcelp->getArea() >= MINIMUM_PARCEL_SIZE) : false);
+ }
+
+ virtual BOOL postBuild() override;
+ virtual void refresh() override;
+
+ virtual LLParcel * getParcel() override;
+
+ virtual bool canEdit() override;
+ virtual S32 getParcelId() override;
+
+protected:
+ virtual void refreshFromSource() override;
+
+ bool isSameRegion();
+
+ LLSafeHandle<LLParcelSelection> & mParcel;
+ S32 mLastParcelId;
+};
+
+
// 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]
@@ -227,7 +261,7 @@ LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
// static
void LLFloaterLand::refreshAll()
{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ LLFloaterLand* land_instance = LLFloaterReg::findTypedInstance<LLFloaterLand>("about_land");
if(land_instance)
{
land_instance->refresh();
@@ -278,6 +312,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 );
@@ -319,6 +354,7 @@ void LLFloaterLand::refresh()
mPanelAccess->refresh();
mPanelCovenant->refresh();
mPanelExperiences->refresh();
+ mPanelEnvironment->refresh();
}
@@ -387,6 +423,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
@@ -2209,7 +2253,7 @@ void LLPanelLandOptions::refreshSearch()
// effort to reduce search spam from small parcels. See also
// the search crawler "grid-crawl.py" in secondlife.com/doc/app/search/ JC
const S32 MIN_PARCEL_AREA_FOR_SEARCH = 128;
- bool large_enough = parcel->getArea() > MIN_PARCEL_AREA_FOR_SEARCH;
+ bool large_enough = parcel->getArea() >= MIN_PARCEL_AREA_FOR_SEARCH;
if (large_enough)
{
if (can_change)
@@ -3268,3 +3312,144 @@ void LLPanelLandExperiences::refresh()
refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED);
refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED);
}
+
+//=========================================================================
+
+LLPanelLandEnvironment::LLPanelLandEnvironment(LLParcelSelectionHandle& parcel) :
+ LLPanelEnvironmentInfo(),
+ mParcel(parcel),
+ mLastParcelId(INVALID_PARCEL_ID)
+{
+}
+
+BOOL LLPanelLandEnvironment::postBuild()
+{
+ if (!LLPanelEnvironmentInfo::postBuild())
+ return FALSE;
+
+ getChild<LLUICtrl>(BTN_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION));
+ getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE);
+ getChild<LLUICtrl>(PNL_REGION_MSG)->setVisible(FALSE);
+ getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE);
+
+ return TRUE;
+}
+
+void LLPanelLandEnvironment::refresh()
+{
+ if (gDisconnected)
+ return;
+
+ commitDayLenOffsetChanges(false); // commit unsaved changes if any
+
+ if (!isSameRegion())
+ {
+ setCrossRegion(true);
+ mCurrentEnvironment.reset();
+ mLastParcelId = INVALID_PARCEL_ID;
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
+ setControlsEnabled(false);
+ return;
+ }
+
+ if (mLastParcelId != getParcelId())
+ {
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
+ mCurrentEnvironment.reset();
+ }
+
+ if (!mCurrentEnvironment && mCurEnvVersion <= INVALID_PARCEL_ENVIRONMENT_VERSION)
+ {
+ refreshFromSource();
+ return;
+ }
+
+ LLPanelEnvironmentInfo::refresh();
+}
+
+void LLPanelLandEnvironment::refreshFromSource()
+{
+ LLParcel *parcel = getParcel();
+
+ if (!LLEnvironment::instance().isExtendedEnvironmentEnabled())
+ {
+ setNoEnvironmentSupport(true);
+ setControlsEnabled(false);
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
+ return;
+ }
+ setNoEnvironmentSupport(false);
+
+ if (!parcel)
+ {
+ setNoSelection(true);
+ setControlsEnabled(false);
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
+ return;
+ }
+
+ setNoSelection(false);
+ if (isSameRegion())
+ {
+ LL_DEBUGS("ENVIRONMENT") << "Requesting environment for parcel " << parcel->getLocalID() << ", known version " << mCurEnvVersion << LL_ENDL;
+ setCrossRegion(false);
+
+ LLHandle<LLPanel> that_h = getHandle();
+
+ if (mCurEnvVersion < UNSET_PARCEL_ENVIRONMENT_VERSION)
+ {
+ // to mark as requesting
+ mCurEnvVersion = parcel->getParcelEnvironmentVersion();
+ }
+ mLastParcelId = parcel->getLocalID();
+
+ LLEnvironment::instance().requestParcel(parcel->getLocalID(),
+ [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo)
+ {
+ LLPanelLandEnvironment *that = (LLPanelLandEnvironment*)that_h.get();
+ if (!that) return;
+ that->mLastParcelId = parcel_id;
+ that->onEnvironmentReceived(parcel_id, envifo);
+ });
+ }
+ else
+ {
+ setCrossRegion(true);
+ mCurrentEnvironment.reset();
+ mLastParcelId = INVALID_PARCEL_ID;
+ mCurEnvVersion = INVALID_PARCEL_ENVIRONMENT_VERSION;
+ }
+ setControlsEnabled(false);
+}
+
+
+bool LLPanelLandEnvironment::isSameRegion()
+{
+ LLViewerRegion* regionp = LLViewerParcelMgr::instance().getSelectionRegion();
+
+ return (!regionp || (regionp->getRegionID() == gAgent.getRegion()->getRegionID()));
+}
+
+LLParcel *LLPanelLandEnvironment::getParcel()
+{
+ return mParcel->getParcel();
+}
+
+
+bool LLPanelLandEnvironment::canEdit()
+{
+ LLParcel *parcel = getParcel();
+ if (!parcel)
+ return false;
+
+ return LLEnvironment::instance().canAgentUpdateParcelEnvironment(parcel) && mAllowOverride;
+}
+
+S32 LLPanelLandEnvironment::getParcelId()
+{
+ LLParcel *parcel = getParcel();
+ if (!parcel)
+ return INVALID_PARCEL_ID;
+
+ return parcel->getLocalID();
+}