summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
authordolphin <dolphin@lindenlab.com>2014-05-16 15:52:39 -0700
committerdolphin <dolphin@lindenlab.com>2014-05-16 15:52:39 -0700
commit4c7b0cb528f61bc20866c2f7c43049ef7bc49bf2 (patch)
tree37c8d52aedb48e440ea66dfe734f08e3c708acd1 /indra/newview/llfloaterland.cpp
parent9a7458f9e32773c07b689a6d490e5bfe9c6ec47f (diff)
ACME-1459: Experience tab added to the about land tab for editing parcel Experiences
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rwxr-xr-xindra/newview/llfloaterland.cpp684
1 files changed, 441 insertions, 243 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 9b588dc166..7fbbef5ed3 100755
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -75,6 +75,7 @@
#include "llviewercontrol.h"
#include "roles_constants.h"
#include "lltrans.h"
+#include "llpanelexperiencelisteditor.h"
#include "llgroupactions.h"
@@ -86,7 +87,6 @@ static std::string MATURITY = "[MATURITY]";
// constants used in callbacks below - syntactic sugar.
static const BOOL BUY_GROUP_LAND = TRUE;
static const BOOL BUY_PERSONAL_LAND = FALSE;
-LLPointer<LLParcelSelection> LLPanelLandGeneral::sSelectionForBuyPass = NULL;
// Statics
LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
@@ -162,191 +162,117 @@ void send_parcel_select_objects(S32 parcel_local_id, U32 return_type,
msg->sendReliable(region->getHost());
}
-LLParcel* LLFloaterLand::getCurrentSelectedParcel()
+void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time)
{
- return mParcel->getParcel();
-};
+ LLMessageSystem *msg = gMessageSystem;
-//static
-LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects()
-{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- return land_instance->mPanelObjects;
- }
- else
- {
- return NULL;
- }
-}
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
-//static
-LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
-{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- return land_instance->mPanelCovenant;
- }
- else
- {
- return NULL;
- }
-}
+ msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
+ msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time);
-// static
-void LLFloaterLand::refreshAll()
-{
- LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
- if(land_instance)
- {
- land_instance->refresh();
- }
+ msg->sendReliable(region->getHost());
}
-void LLFloaterLand::onOpen(const LLSD& key)
+// 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]
+void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse)
{
- // 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);
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region)
+ return;
- 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();
-}
+ LLStyle::Params style;
-void LLFloaterLand::onVisibilityChanged(const LLSD& visible)
-{
- if (!visible.asBoolean())
- {
- // Might have been showing owned objects
- LLSelectMgr::getInstance()->unhighlightAll();
+ U8 sim_access = region->getSimAccess();
- // Save which panel we had open
- sLastTab = mTabLand->getCurrentPanelIndex();
- }
-}
+ switch(sim_access)
+ {
+ case SIM_ACCESS_PG:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general")));
+ break;
+ case SIM_ACCESS_ADULT:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult")));
+ break;
-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);
+ case SIM_ACCESS_MATURE:
+ style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate")));
+ break;
- sObserver = new LLParcelSelectionObserver();
- LLViewerParcelMgr::getInstance()->addObserver( sObserver );
-}
+ default:
+ break;
+ }
-BOOL LLFloaterLand::postBuild()
-{
- setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChanged, this, _2));
+ size_t maturity_pos = str_to_parse.find(MATURITY);
- LLTabContainer* tab = getChild<LLTabContainer>("landtab");
-
- mTabLand = (LLTabContainer*) tab;
-
- if (tab)
+ if (maturity_pos == std::string::npos)
{
- tab->selectTab(sLastTab);
+ return;
}
- return TRUE;
-}
+ std::string text_before_rating = str_to_parse.substr(0, maturity_pos);
+ std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length());
+ target_textbox->setText(text_before_rating);
-// virtual
-LLFloaterLand::~LLFloaterLand()
-{
- LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
- delete sObserver;
- sObserver = NULL;
-}
+ target_textbox->appendImageSegment(style);
-// public
-void LLFloaterLand::refresh()
-{
- mPanelGeneral->refresh();
- mPanelObjects->refresh();
- mPanelOptions->refresh();
- mPanelAudio->refresh();
- mPanelMedia->refresh();
- mPanelAccess->refresh();
- mPanelCovenant->refresh();
+ target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
+ target_textbox->appendText(text_after_rating, false);
}
-
-
-void* LLFloaterLand::createPanelLandGeneral(void* data)
+void send_return_objects_message(S32 parcel_local_id, S32 return_type,
+ uuid_list_t* owner_ids = NULL)
{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel);
- return self->mPanelGeneral;
-}
+ LLMessageSystem *msg = gMessageSystem;
-// static
-void* LLFloaterLand::createPanelLandCovenant(void* data)
-{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel);
- return self->mPanelCovenant;
-}
+ LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+ if (!region) return;
+ msg->newMessageFast(_PREHASH_ParcelReturnObjects);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ParcelData);
+ msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
+ msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type);
-// static
-void* LLFloaterLand::createPanelLandObjects(void* data)
-{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelObjects = new LLPanelLandObjects(self->mParcel);
- return self->mPanelObjects;
-}
+ // Dummy task id, not used
+ msg->nextBlock("TaskIDs");
+ msg->addUUID("TaskID", LLUUID::null);
-// static
-void* LLFloaterLand::createPanelLandOptions(void* data)
-{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelOptions = new LLPanelLandOptions(self->mParcel);
- return self->mPanelOptions;
-}
+ // Throw all return ids into the packet.
+ // TODO: Check for too many ids.
+ if (owner_ids)
+ {
+ uuid_list_t::iterator end = owner_ids->end();
+ for (uuid_list_t::iterator it = owner_ids->begin();
+ it != end;
+ ++it)
+ {
+ msg->nextBlockFast(_PREHASH_OwnerIDs);
+ msg->addUUIDFast(_PREHASH_OwnerID, (*it));
+ }
+ }
+ else
+ {
+ msg->nextBlockFast(_PREHASH_OwnerIDs);
+ msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
+ }
-// static
-void* LLFloaterLand::createPanelLandAudio(void* data)
-{
- LLFloaterLand* self = (LLFloaterLand*)data;
- self->mPanelAudio = new LLPanelLandAudio(self->mParcel);
- return self->mPanelAudio;
+ msg->sendReliable(region->getHost());
}
-// 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;
-}
+LLPointer<LLParcelSelection> LLPanelLandGeneral::sSelectionForBuyPass = NULL;
//---------------------------------------------------------------------------
// LLPanelLandGeneral
@@ -1063,6 +989,8 @@ void LLPanelLandGeneral::onClickStopSellLand(void* data)
LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate(parcel);
}
+
+
//---------------------------------------------------------------------------
// LLPanelLandObjects
//---------------------------------------------------------------------------
@@ -1308,66 +1236,6 @@ void LLPanelLandObjects::draw()
LLPanel::draw();
}
-void send_other_clean_time_message(S32 parcel_local_id, S32 other_clean_time)
-{
- LLMessageSystem *msg = gMessageSystem;
-
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
-
- msg->newMessageFast(_PREHASH_ParcelSetOtherCleanTime);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
- msg->addS32Fast(_PREHASH_OtherCleanTime, other_clean_time);
-
- msg->sendReliable(region->getHost());
-}
-
-void send_return_objects_message(S32 parcel_local_id, S32 return_type,
- uuid_list_t* owner_ids = NULL)
-{
- LLMessageSystem *msg = gMessageSystem;
-
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region) return;
-
- msg->newMessageFast(_PREHASH_ParcelReturnObjects);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ParcelData);
- msg->addS32Fast(_PREHASH_LocalID, parcel_local_id);
- msg->addU32Fast(_PREHASH_ReturnType, (U32) return_type);
-
- // Dummy task id, not used
- msg->nextBlock("TaskIDs");
- msg->addUUID("TaskID", LLUUID::null);
-
- // Throw all return ids into the packet.
- // TODO: Check for too many ids.
- if (owner_ids)
- {
- uuid_list_t::iterator end = owner_ids->end();
- for (uuid_list_t::iterator it = owner_ids->begin();
- it != end;
- ++it)
- {
- msg->nextBlockFast(_PREHASH_OwnerIDs);
- msg->addUUIDFast(_PREHASH_OwnerID, (*it));
- }
- }
- else
- {
- msg->nextBlockFast(_PREHASH_OwnerIDs);
- msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null);
- }
-
- msg->sendReliable(region->getHost());
-}
-
bool LLPanelLandObjects::callbackReturnOwnerObjects(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -1804,6 +1672,52 @@ void LLPanelLandObjects::onCommitClean(LLUICtrl *caller, void* user_data)
}
+class LLPanelLandOptions
+ : public LLPanel
+{
+public:
+ LLPanelLandOptions(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandOptions();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void refresh();
+
+private:
+ // Refresh the "show in search" checkbox and category selector.
+ void refreshSearch();
+
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onClickSet(void* userdata);
+ static void onClickClear(void* userdata);
+
+private:
+ LLCheckBoxCtrl* mCheckEditObjects;
+ LLCheckBoxCtrl* mCheckEditGroupObjects;
+ LLCheckBoxCtrl* mCheckAllObjectEntry;
+ LLCheckBoxCtrl* mCheckGroupObjectEntry;
+ LLCheckBoxCtrl* mCheckSafe;
+ LLCheckBoxCtrl* mCheckFly;
+ LLCheckBoxCtrl* mCheckGroupScripts;
+ LLCheckBoxCtrl* mCheckOtherScripts;
+
+ LLCheckBoxCtrl* mCheckShowDirectory;
+ LLComboBox* mCategoryCombo;
+ LLComboBox* mLandingTypeCombo;
+
+ LLTextureCtrl* mSnapshotCtrl;
+
+ LLTextBox* mLocationText;
+ LLButton* mSetBtn;
+ LLButton* mClearBtn;
+
+ LLCheckBoxCtrl *mMatureCtrl;
+ LLCheckBoxCtrl *mPushRestrictionCtrl;
+ LLCheckBoxCtrl *mSeeAvatarsCtrl;
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
+};
+
+
//---------------------------------------------------------------------------
// LLPanelLandOptions
//---------------------------------------------------------------------------
@@ -2320,6 +2234,37 @@ void LLPanelLandOptions::onClickClear(void* userdata)
}
+class LLPanelLandAccess
+ : public LLPanel
+{
+public:
+ LLPanelLandAccess(LLSafeHandle<LLParcelSelection>& parcelp);
+ virtual ~LLPanelLandAccess();
+ void refresh();
+ void refresh_ui();
+ void refreshNames();
+ virtual void draw();
+
+ static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata);
+ static void onCommitAny(LLUICtrl* ctrl, void *userdata);
+ static void onClickRemoveAccess(void*);
+ static void onClickRemoveBanned(void*);
+
+ virtual BOOL postBuild();
+
+ void onClickAddAccess();
+ void onClickAddBanned();
+ void callbackAvatarCBBanned(const uuid_vec_t& ids);
+ void callbackAvatarCBAccess(const uuid_vec_t& ids);
+
+protected:
+ LLNameListCtrl* mListAccess;
+ LLNameListCtrl* mListBanned;
+
+ LLSafeHandle<LLParcelSelection>& mParcel;
+};
+
+
//---------------------------------------------------------------------------
// LLPanelLandAccess
//---------------------------------------------------------------------------
@@ -2835,6 +2780,7 @@ void LLPanelLandAccess::onClickRemoveBanned(void* data)
}
}
+
//---------------------------------------------------------------------------
// LLPanelLandCovenant
//---------------------------------------------------------------------------
@@ -2948,51 +2894,303 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name)
}
}
-// 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]
-void insert_maturity_into_textbox(LLTextBox* target_textbox, LLFloater* names_floater, std::string str_to_parse)
+class LLPanelLandExperiences
+ : public LLPanel
{
- LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
- if (!region)
+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);
+
+ 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 (parcel == NULL || panel == NULL)
+ {
return;
+ }
- LLStyle::Params style;
+ 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();
+}
- U8 sim_access = region->getSimAccess();
+void LLPanelLandExperiences::refresh()
+{
+ refreshPanel(mAllowed, EXPERIENCE_KEY_TYPE_ALLOWED);
+ refreshPanel(mBlocked, EXPERIENCE_KEY_TYPE_BLOCKED);
+}
- switch(sim_access)
+LLParcel* LLFloaterLand::getCurrentSelectedParcel()
+{
+ return mParcel->getParcel();
+};
+
+//static
+LLPanelLandObjects* LLFloaterLand::getCurrentPanelLandObjects()
+{
+ LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
{
- case SIM_ACCESS_PG:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general")));
- break;
+ return land_instance->mPanelObjects;
+ }
+ else
+ {
+ return NULL;
+ }
+}
- case SIM_ACCESS_ADULT:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult")));
- break;
+//static
+LLPanelLandCovenant* LLFloaterLand::getCurrentPanelLandCovenant()
+{
+ LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
+ {
+ return land_instance->mPanelCovenant;
+ }
+ else
+ {
+ return NULL;
+ }
+}
- case SIM_ACCESS_MATURE:
- style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate")));
- break;
+// static
+void LLFloaterLand::refreshAll()
+{
+ LLFloaterLand* land_instance = LLFloaterReg::getTypedInstance<LLFloaterLand>("about_land");
+ if(land_instance)
+ {
+ land_instance->refresh();
+ }
+}
- default:
- break;
+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);
- size_t maturity_pos = str_to_parse.find(MATURITY);
+ mParcel = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection();
- if (maturity_pos == std::string::npos)
+ // 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())
{
- return;
+ // Might have been showing owned objects
+ LLSelectMgr::getInstance()->unhighlightAll();
+
+ // Save which panel we had open
+ sLastTab = mTabLand->getCurrentPanelIndex();
}
+}
- std::string text_before_rating = str_to_parse.substr(0, maturity_pos);
- std::string text_after_rating = str_to_parse.substr(maturity_pos + MATURITY.length());
- target_textbox->setText(text_before_rating);
+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);
- target_textbox->appendImageSegment(style);
+ sObserver = new LLParcelSelectionObserver();
+ LLViewerParcelMgr::getInstance()->addObserver( sObserver );
+}
- target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false);
- target_textbox->appendText(text_after_rating, false);
+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;
}