diff options
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rwxr-xr-x | indra/newview/llfloaterland.cpp | 320 |
1 files changed, 320 insertions, 0 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 7621c35ed2..7081377097 100755 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -75,6 +75,9 @@ #include "llviewercontrol.h" #include "roles_constants.h" #include "lltrans.h" +#include "llpanelexperiencelisteditor.h" +#include "llpanelexperiencepicker.h" +#include "llexperiencecache.h" #include "llgroupactions.h" @@ -3038,3 +3041,320 @@ void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_fl target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); target_textbox->appendText(text_after_rating, false); } + +class LLPanelLandExperiences + : public LLPanel +{ +public: + LLPanelLandExperiences(LLSafeHandle<LLParcelSelection>& parcelp); + virtual BOOL postBuild(); + void refresh(); + + void experienceAdded(const LLUUID& id, U32 xp_type, U32 access_type); + void experienceRemoved(const LLUUID& id, U32 access_type); +protected: + LLPanelExperienceListEditor* setupList( const char* control_name, U32 xp_type, U32 access_type ); + void refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type); + + LLSafeHandle<LLParcelSelection>& mParcel; + + + LLPanelExperienceListEditor* mAllowed; + LLPanelExperienceListEditor* mBlocked; +}; + +LLPanelLandExperiences::LLPanelLandExperiences( LLSafeHandle<LLParcelSelection>& parcelp ) + : mParcel(parcelp) +{ + +} + + +BOOL LLPanelLandExperiences::postBuild() +{ + mAllowed = setupList("panel_allowed", EXPERIENCE_KEY_TYPE_ALLOWED, AL_ALLOW_EXPERIENCE); + mBlocked = setupList("panel_blocked", EXPERIENCE_KEY_TYPE_BLOCKED, AL_BLOCK_EXPERIENCE); + + // only non-grid-wide experiences + mAllowed->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithProperty, _1, LLExperienceCache::PROPERTY_GRID)); + + // no privileged ones + mBlocked->addFilter(boost::bind(LLPanelExperiencePicker::FilterWithoutProperties, _1, LLExperienceCache::PROPERTY_PRIVILEGED|LLExperienceCache::PROPERTY_GRID)); + + getChild<LLLayoutPanel>("trusted_layout_panel")->setVisible(FALSE); + getChild<LLTextBox>("experiences_help_text")->setVisible(FALSE); + getChild<LLTextBox>("allowed_text_help")->setText(getString("allowed_parcel_text")); + getChild<LLTextBox>("blocked_text_help")->setText(getString("blocked_parcel_text")); + + return LLPanel::postBuild(); +} + +LLPanelExperienceListEditor* LLPanelLandExperiences::setupList( const char* control_name, U32 xp_type, U32 access_type ) +{ + LLPanelExperienceListEditor* child = findChild<LLPanelExperienceListEditor>(control_name); + if(child) + { + child->getChild<LLTextBox>("text_name")->setText(child->getString(control_name)); + child->setMaxExperienceIDs(PARCEL_MAX_EXPERIENCE_LIST); + child->setAddedCallback(boost::bind(&LLPanelLandExperiences::experienceAdded, this, _1, xp_type, access_type)); + child->setRemovedCallback(boost::bind(&LLPanelLandExperiences::experienceRemoved, this, _1, access_type)); + } + + return child; +} + +void LLPanelLandExperiences::experienceAdded( const LLUUID& id, U32 xp_type, U32 access_type ) +{ + LLParcel* parcel = mParcel->getParcel(); + if (parcel) + { + parcel->setExperienceKeyType(id, xp_type); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type); + refresh(); + } +} + +void LLPanelLandExperiences::experienceRemoved( const LLUUID& id, U32 access_type ) +{ + LLParcel* parcel = mParcel->getParcel(); + if (parcel) + { + parcel->setExperienceKeyType(id, EXPERIENCE_KEY_TYPE_NONE); + LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(access_type); + refresh(); + } +} + +void LLPanelLandExperiences::refreshPanel(LLPanelExperienceListEditor* panel, U32 xp_type) +{ + LLParcel *parcel = mParcel->getParcel(); + + // Display options + if (panel == NULL) + { + return; + } + if (parcel == NULL) + { + // disable the panel + panel->setEnabled(FALSE); + panel->setExperienceIds(LLSD::emptyArray()); + } + else + { + // enable the panel + panel->setEnabled(TRUE); + LLAccessEntry::map entries = parcel->getExperienceKeysByType(xp_type); + LLAccessEntry::map::iterator it = entries.begin(); + LLSD ids = LLSD::emptyArray(); + for (/**/; it != entries.end(); ++it) + { + ids.append(it->second.mID); + } + panel->setExperienceIds(ids); + panel->setReadonly(!LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS)); + panel->refreshExperienceCounter(); + } +} + +void LLPanelLandExperiences::refresh() +{ + refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED); + refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED); +} + +LLParcel* LLFloaterLand::getCurrentSelectedParcel() +{ + return mParcel->getParcel(); +}; + +//static +LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects() +{ + LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); + if(land_instance) + { + return land_instance->mPanelObjects; + } + else + { + return NULL; + } +} + +//static +LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant() +{ + LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); + if(land_instance) + { + return land_instance->mPanelCovenant; + } + else + { + return NULL; + } +} + +// static +void LLFloaterLand::refreshAll() +{ + LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land"); + if(land_instance) + { + land_instance->refresh(); + } +} + +void LLFloaterLand::onOpen(const LLSD& key) +{ + // moved from triggering show instance in llviwermenu.cpp + + if (LLViewerParcelMgr::getInstance()->selectionEmpty()) + { + LLViewerParcelMgr::getInstance()->selectParcelAt(gAgent.getPositionGlobal()); + } + + // Done automatically when the selected parcel's properties arrive + // (and hence we have the local id). + // LLViewerParcelMgr::getInstance()->sendParcelAccessListRequest(AL_ACCESS | AL_BAN | AL_RENTER); + + mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); + + // Refresh even if not over a region so we don't get an + // uninitialized dialog. The dialog is 0-region aware. + refresh(); +} + +void LLFloaterLand::onVisibilityChanged(const LLSD& visible) +{ + if (!visible.asBoolean()) + { + // Might have been showing owned objects + LLSelectMgr::getInstance()->unhighlightAll(); + + // Save which panel we had open + sLastTab = mTabLand->getCurrentPanelIndex(); + } +} + + +LLFloaterLand::LLFloaterLand(const LLSD& seed) +: LLFloater(seed) +{ + mFactoryMap["land_general_panel"] = LLCallbackMap(createPanelLandGeneral, this); + mFactoryMap["land_covenant_panel"] = LLCallbackMap(createPanelLandCovenant, this); + mFactoryMap["land_objects_panel"] = LLCallbackMap(createPanelLandObjects, this); + mFactoryMap["land_options_panel"] = LLCallbackMap(createPanelLandOptions, this); + mFactoryMap["land_audio_panel"] = LLCallbackMap(createPanelLandAudio, this); + mFactoryMap["land_media_panel"] = LLCallbackMap(createPanelLandMedia, this); + mFactoryMap["land_access_panel"] = LLCallbackMap(createPanelLandAccess, this); + mFactoryMap["land_experiences_panel"] = LLCallbackMap(createPanelLandExperiences, this); + + sObserver = new LLParcelSelectionObserver(); + LLViewerParcelMgr::getInstance()->addObserver( sObserver ); +} + +BOOL LLFloaterLand::postBuild() +{ + setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2)); + + LLTabContainer* tab = getChild<LLTabContainer>("landtab"); + + mTabLand = (LLTabContainer*) tab; + + if (tab) + { + tab->selectTab(sLastTab); + } + + return TRUE; +} + + +// virtual +LLFloaterLand::~LLFloaterLand() +{ + LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); + delete sObserver; + sObserver = NULL; +} + +// public +void LLFloaterLand::refresh() +{ + mPanelGeneral->refresh(); + mPanelObjects->refresh(); + mPanelOptions->refresh(); + mPanelAudio->refresh(); + mPanelMedia->refresh(); + mPanelAccess->refresh(); + mPanelCovenant->refresh(); + mPanelExperiences->refresh(); +} + + + +void* LLFloaterLand::createPanelLandGeneral(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel); + return self->mPanelGeneral; +} + +// static +void* LLFloaterLand::createPanelLandCovenant(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel); + return self->mPanelCovenant; +} + + +// static +void* LLFloaterLand::createPanelLandObjects(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelObjects = new LLPanelLandObjects(self->mParcel); + return self->mPanelObjects; +} + +// static +void* LLFloaterLand::createPanelLandOptions(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelOptions = new LLPanelLandOptions(self->mParcel); + return self->mPanelOptions; +} + +// static +void* LLFloaterLand::createPanelLandAudio(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelAudio = new LLPanelLandAudio(self->mParcel); + return self->mPanelAudio; +} + +// static +void* LLFloaterLand::createPanelLandMedia(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelMedia = new LLPanelLandMedia(self->mParcel); + return self->mPanelMedia; +} + +// static +void* LLFloaterLand::createPanelLandAccess(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelAccess = new LLPanelLandAccess(self->mParcel); + return self->mPanelAccess; +} + +// static +void* LLFloaterLand::createPanelLandExperiences(void* data) +{ + LLFloaterLand* self = (LLFloaterLand*)data; + self->mPanelExperiences = new LLPanelLandExperiences(self->mParcel); + return self->mPanelExperiences; +} |