summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelplaceinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelplaceinfo.cpp')
-rw-r--r--indra/newview/llpanelplaceinfo.cpp452
1 files changed, 389 insertions, 63 deletions
diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp
index 3926ee0f07..793c25455d 100644
--- a/indra/newview/llpanelplaceinfo.cpp
+++ b/indra/newview/llpanelplaceinfo.cpp
@@ -48,6 +48,8 @@
#include "llscrollcontainer.h"
#include "lltextbox.h"
+#include "llaccordionctrl.h"
+#include "llaccordionctrltab.h"
#include "llagent.h"
#include "llavatarpropertiesprocessor.h"
#include "llfloaterworldmap.h"
@@ -67,7 +69,6 @@ LLPanelPlaceInfo::LLPanelPlaceInfo()
: LLPanel(),
mParcelID(),
mRequestedID(),
- mPosRegion(),
mLandmarkID(),
mMinHeight(0),
mScrollingPanel(NULL),
@@ -94,14 +95,42 @@ BOOL LLPanelPlaceInfo::postBuild()
mSnapshotCtrl = getChild<LLTextureCtrl>("logo");
mSnapshotCtrl->setEnabled(FALSE);
- mRegionName = getChild<LLTextBox>("region_name");
- mParcelName = getChild<LLTextBox>("parcel_name");
+ mRegionName = getChild<LLTextBox>("region_title");
+ mParcelName = getChild<LLTextBox>("parcel_title");
mDescEditor = getChild<LLTextEditor>("description");
- mRating = getChild<LLIconCtrl>("maturity");
- mRegionInfoDrillIn = getChild<LLButton>("region_info_drill_in");
- mMediaDrillIn = getChild<LLButton>("media_drill_in");
- mMediaDrillIn->setClickedCallback(boost::bind(&LLPanelPlaceInfo::toggleMediaPanel, this, TRUE));
+ mMaturityRatingText = getChild<LLTextBox>("maturity_value");
+ mParcelOwner = getChild<LLTextBox>("owner_value");
+ mLastVisited = getChild<LLTextBox>("last_visited_value");
+
+ mRatingText = getChild<LLTextBox>("rating_value");
+ mVoiceText = getChild<LLTextBox>("voice_value");
+ mFlyText = getChild<LLTextBox>("fly_value");
+ mPushText = getChild<LLTextBox>("push_value");
+ mBuildText = getChild<LLTextBox>("build_value");
+ mScriptsText = getChild<LLTextBox>("scripts_value");
+ mDamageText = getChild<LLTextBox>("damage_value");
+
+ mRegionNameText = getChild<LLTextBox>("region_name");
+ mRegionTypeText = getChild<LLTextBox>("region_type");
+ mRegionRatingText = getChild<LLTextBox>("region_rating");
+ mRegionOwnerText = getChild<LLTextBox>("region_owner");
+ mRegionGroupText = getChild<LLTextBox>("region_group");
+
+ mEstateNameText = getChild<LLTextBox>("estate_name");
+ mEstateRatingText = getChild<LLTextBox>("estate_rating");
+ mEstateOwnerText = getChild<LLTextBox>("estate_owner");
+ mCovenantText = getChild<LLTextEditor>("covenant");
+
+ mSalesPriceText = getChild<LLTextBox>("sales_price");
+ mAreaText = getChild<LLTextBox>("area");
+ mTrafficText = getChild<LLTextBox>("traffic");
+ mPrimitivesText = getChild<LLTextBox>("primitives");
+ mParcelScriptsText = getChild<LLTextBox>("parcel_scripts");
+ mTerraformLimitsText = getChild<LLTextBox>("terraform_limits");
+ mSubdivideText = getChild<LLTextEditor>("subdivide");
+ mResaleText = getChild<LLTextEditor>("resale");
+ mSaleToText = getChild<LLTextBox>("sale_to");
mOwner = getChild<LLTextBox>("owner");
mCreator = getChild<LLTextBox>("creator");
@@ -223,9 +252,10 @@ void LLPanelPlaceInfo::resetLocation()
mParcelID.setNull();
mRequestedID.setNull();
mLandmarkID.setNull();
- mPosRegion.clearVec();
std::string not_available = getString("not_available");
- mRating->setValue(not_available);
+ mMaturityRatingText->setValue(not_available);
+ mParcelOwner->setValue(not_available);
+ mLastVisited->setValue(not_available);
mRegionName->setText(not_available);
mParcelName->setText(not_available);
mDescEditor->setText(not_available);
@@ -236,6 +266,35 @@ void LLPanelPlaceInfo::resetLocation()
mNotesEditor->setText(LLStringUtil::null);
mSnapshotCtrl->setImageAssetID(LLUUID::null);
mSnapshotCtrl->setFallbackImageName("default_land_picture.j2c");
+
+ mRatingText->setText(not_available);
+ mVoiceText->setText(not_available);
+ mFlyText->setText(not_available);
+ mPushText->setText(not_available);
+ mBuildText->setText(not_available);
+ mParcelScriptsText->setText(not_available);
+ mDamageText->setText(not_available);
+
+ mRegionNameText->setValue(not_available);
+ mRegionTypeText->setValue(not_available);
+ mRegionRatingText->setValue(not_available);
+ mRegionOwnerText->setValue(not_available);
+ mRegionGroupText->setValue(not_available);
+
+ mEstateNameText->setValue(not_available);
+ mEstateRatingText->setValue(not_available);
+ mEstateOwnerText->setValue(not_available);
+ mCovenantText->setValue(not_available);
+
+ mSalesPriceText->setValue(not_available);
+ mAreaText->setValue(not_available);
+ mTrafficText->setValue(not_available);
+ mPrimitivesText->setValue(not_available);
+ mParcelScriptsText->setValue(not_available);
+ mTerraformLimitsText->setValue(not_available);
+ mSubdivideText->setValue(not_available);
+ mResaleText->setValue(not_available);
+ mSaleToText->setValue(not_available);
}
//virtual
@@ -252,12 +311,21 @@ void LLPanelPlaceInfo::setInfoType(INFO_TYPE type)
bool is_info_type_agent = type == AGENT;
bool is_info_type_landmark = type == LANDMARK;
+ bool is_info_type_teleport_history = type == TELEPORT_HISTORY;
+
+ getChild<LLTextBox>("maturity_label")->setVisible(!is_info_type_agent);
+ mMaturityRatingText->setVisible(!is_info_type_agent);
+
+ getChild<LLTextBox>("owner_label")->setVisible(is_info_type_agent);
+ mParcelOwner->setVisible(is_info_type_agent);
+
+ getChild<LLTextBox>("last_visited_label")->setVisible(is_info_type_teleport_history);
+ mLastVisited->setVisible(is_info_type_teleport_history);
landmark_info_panel->setVisible(is_info_type_landmark);
landmark_edit_panel->setVisible(is_info_type_landmark || type == CREATE_LANDMARK);
- mRegionInfoDrillIn->setVisible(is_info_type_agent);
- mMediaDrillIn->setVisible(is_info_type_agent);
+ getChild<LLAccordionCtrl>("advanced_info_accordion")->setVisible(is_info_type_agent);
switch(type)
{
@@ -275,26 +343,26 @@ void LLPanelPlaceInfo::setInfoType(INFO_TYPE type)
}
break;
- // Hide Media Panel if showing information about
- // a landmark or a teleport history item
case LANDMARK:
mCurrentTitle = getString("title_landmark");
break;
case TELEPORT_HISTORY:
- mCurrentTitle = getString("title_place");
+ mCurrentTitle = getString("title_teleport_history");
break;
}
- if (type != PLACE)
+ if (type != AGENT)
toggleMediaPanel(FALSE);
+
+ mInfoType = type;
}
BOOL LLPanelPlaceInfo::isMediaPanelVisible()
{
if (!mMediaPanel)
return FALSE;
-
+
return mMediaPanel->getVisible();
}
@@ -351,12 +419,16 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
mSnapshotCtrl->setImageAssetID(parcel_data.snapshot_id);
}
- if( !parcel_data.name.empty())
+ if(!parcel_data.name.empty())
{
mParcelName->setText(parcel_data.name);
}
+ else
+ {
+ mParcelName->setText(LLStringUtil::null);
+ }
- if( !parcel_data.desc.empty())
+ if(!parcel_data.desc.empty())
{
mDescEditor->setText(parcel_data.desc);
}
@@ -364,38 +436,28 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
// HACK: Flag 0x2 == adult region,
// Flag 0x1 == mature region, otherwise assume PG
std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
- std::string rating_icon = "icon_event.tga";
if (parcel_data.flags & 0x2)
{
rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT);
- rating_icon = "icon_event_adult.tga";
}
else if (parcel_data.flags & 0x1)
{
rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);
- rating_icon = "icon_event_mature.tga";
}
- mRating->setValue(rating_icon);
+
+ mMaturityRatingText->setValue(rating);
+ mRatingText->setValue(rating);
//update for_sale banner, here we should use DFQ_FOR_SALE instead of PF_FOR_SALE
//because we deal with remote parcel response format
bool isForSale = (parcel_data.flags & DFQ_FOR_SALE)? TRUE : FALSE;
getChild<LLIconCtrl>("icon_for_sale")->setVisible(isForSale);
-
- // Just use given region position for display
- S32 region_x = llround(mPosRegion.mV[0]);
- S32 region_y = llround(mPosRegion.mV[1]);
- S32 region_z = llround(mPosRegion.mV[2]);
- // If the region position is zero, grab position from the global
- if(mPosRegion.isExactlyZero())
- {
- region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
- region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
- region_z = llround(parcel_data.global_z);
- }
+ S32 region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
+ S32 region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
+ S32 region_z = llround(parcel_data.global_z);
- std::string name;
+ std::string name = getString("not_available");
if (!parcel_data.sim_name.empty())
{
name = llformat("%s (%d, %d, %d)",
@@ -403,19 +465,25 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data)
mRegionName->setText(name);
}
- if (mCurrentTitle != getString("title_landmark"))
+ if (mInfoType == CREATE_LANDMARK)
{
- mTitleEditor->setText(parcel_data.name);
+
+ if (parcel_data.name.empty())
+ {
+ mTitleEditor->setText(name);
+ }
+ else
+ {
+ mTitleEditor->setText(parcel_data.name);
+ }
+
mNotesEditor->setText(LLStringUtil::null);
}
}
-void LLPanelPlaceInfo::displayParcelInfo(const LLVector3& pos_region,
- const LLUUID& region_id,
- const LLVector3d& pos_global)
+void LLPanelPlaceInfo::displayParcelInfo(const LLUUID& region_id,
+ const LLVector3d& pos_global)
{
- mPosRegion = pos_region;
-
LLViewerRegion* region = gAgent.getRegion();
if (!region)
return;
@@ -424,6 +492,10 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLVector3& pos_region,
std::string url = region->getCapability("RemoteParcelRequest");
if (!url.empty())
{
+ F32 region_x = (F32)fmod(pos_global.mdV[VX], (F64)REGION_WIDTH_METERS);
+ F32 region_y = (F32)fmod(pos_global.mdV[VY], (F64)REGION_WIDTH_METERS);
+ LLVector3 pos_region(region_x, region_y, (F32)pos_global.mdV[VZ]);
+
body["location"] = ll_sd_from_vector3(pos_region);
if (!region_id.isNull())
{
@@ -442,15 +514,21 @@ void LLPanelPlaceInfo::displayParcelInfo(const LLVector3& pos_region,
}
}
-void LLPanelPlaceInfo::displayAgentParcelInfo()
+void LLPanelPlaceInfo::displaySelectedParcelInfo(LLParcel* parcel,
+ LLViewerRegion* region,
+ const LLVector3d& pos_global)
{
- mPosRegion = gAgent.getPositionAgent();
-
- LLViewerRegion* region = gAgent.getRegion();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (!region || !parcel)
return;
+ // send EstateCovenantInfo message
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessage("EstateCovenantRequest");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID,gAgent.getSessionID());
+ msg->sendReliable(region->getHost());
+
LLParcelData parcel_data;
// HACK: Converting sim access flags to the format
@@ -466,25 +544,240 @@ void LLPanelPlaceInfo::displayAgentParcelInfo()
default:
parcel_data.flags = 0;
}
-
- // Adding "For Sale" flag in remote parcel response format.
- if (parcel->getForSale())
- {
- parcel_data.flags |= DFQ_FOR_SALE;
- }
-
parcel_data.desc = parcel->getDesc();
parcel_data.name = parcel->getName();
parcel_data.sim_name = gAgent.getRegion()->getName();
parcel_data.snapshot_id = parcel->getSnapshotID();
- LLVector3d global_pos = gAgent.getPositionGlobal();
- parcel_data.global_x = global_pos.mdV[0];
- parcel_data.global_y = global_pos.mdV[1];
- parcel_data.global_z = global_pos.mdV[2];
+ parcel_data.global_x = pos_global.mdV[0];
+ parcel_data.global_y = pos_global.mdV[1];
+ parcel_data.global_z = pos_global.mdV[2];
-
+ std::string on = getString("on");
+ std::string off = getString("off");
+
+ // Processing parcel characteristics
+ if (parcel->getParcelFlagAllowVoice())
+ {
+ mVoiceText->setText(on);
+ }
+ else
+ {
+ mVoiceText->setText(off);
+ }
+
+ if (!region->getBlockFly() && parcel->getAllowFly())
+ {
+ mFlyText->setText(on);
+ }
+ else
+ {
+ mFlyText->setText(off);
+ }
+
+ if (region->getRestrictPushObject() || parcel->getRestrictPushObject())
+ {
+ mPushText->setText(off);
+ }
+ else
+ {
+ mPushText->setText(on);
+ }
+
+ if (parcel->getAllowModify())
+ {
+ mBuildText->setText(on);
+ }
+ else
+ {
+ mBuildText->setText(off);
+ }
+
+ if((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) ||
+ (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) ||
+ !parcel->getAllowOtherScripts())
+ {
+ mScriptsText->setText(off);
+ }
+ else
+ {
+ mScriptsText->setText(on);
+ }
+
+ if (region->getAllowDamage() || parcel->getAllowDamage())
+ {
+ mDamageText->setText(on);
+ }
+ else
+ {
+ mDamageText->setText(off);
+ }
+
+ mRegionNameText->setText(region->getName());
+ mRegionTypeText->setText(region->getSimProductName());
+ mRegionRatingText->setText(region->getSimAccessString());
+
+ // Determine parcel owner
+ if (parcel->isPublic())
+ {
+ mParcelOwner->setText(getString("public"));
+ mRegionOwnerText->setText(getString("public"));
+ }
+ else
+ {
+ if (parcel->getIsGroupOwned())
+ {
+ mRegionOwnerText->setText(getString("group_owned_text"));
+
+ if(!parcel->getGroupID().isNull())
+ {
+ // FIXME: Using parcel group as region group.
+ gCacheName->get(parcel->getGroupID(), TRUE,
+ boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mRegionGroupText, _2, _3));
+
+ gCacheName->get(parcel->getGroupID(), TRUE,
+ boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mParcelOwner, _2, _3));
+ }
+ else
+ {
+ std::string owner = getString("none_text");
+ mRegionGroupText->setText(owner);
+ mParcelOwner->setText(owner);
+ }
+ }
+ else
+ {
+ // Figure out the owner's name
+ gCacheName->get(parcel->getOwnerID(), FALSE,
+ boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mParcelOwner, _2, _3));
+ gCacheName->get(region->getOwner(), FALSE,
+ boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mRegionOwnerText, _2, _3));
+ }
+
+ if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
+ {
+ mRegionOwnerText->setText(mRegionOwnerText->getText() + getString("sale_pending_text"));
+ }
+ }
+
+ mEstateRatingText->setText(region->getSimAccessString());
+
+ S32 area;
+ S32 claim_price;
+ S32 rent_price;
+ F32 dwell;
+ BOOL for_sale = parcel->getForSale();
+ LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
+ &claim_price,
+ &rent_price,
+ &for_sale,
+ &dwell);
+
+ if (for_sale)
+ {
+ // Adding "For Sale" flag in remote parcel response format.
+ parcel_data.flags |= DFQ_FOR_SALE;
+
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+ if(auth_buyer_id.notNull())
+ {
+ gCacheName->get(auth_buyer_id, TRUE,
+ boost::bind(&LLPanelPlaceInfo::nameUpdatedCallback, this, mSaleToText, _2, _3));
+
+ // Show sales info to a specific person or a group he belongs to.
+ if (auth_buyer_id != gAgent.getID() && !gAgent.isInGroup(auth_buyer_id))
+ {
+ for_sale = FALSE;
+ }
+ }
+ else
+ {
+ mSaleToText->setText(getString("anyone"));
+ }
+
+ const U8* sign = (U8*)getString("price_text").c_str();
+ const U8* sqm = (U8*)getString("area_text").c_str();
+
+ mSalesPriceText->setText(llformat("%s%d ", sign, parcel->getSalePrice()));
+ mAreaText->setText(llformat("%d %s", area, sqm));
+ mTrafficText->setText(llformat("%.0f", dwell));
+
+ // Can't have more than region max tasks, regardless of parcel
+ // object bonus factor.
+ S32 primitives = llmin(llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()),
+ (S32)region->getMaxTasks());
+
+ const U8* available = (U8*)getString("available").c_str();
+ const U8* allocated = (U8*)getString("allocated").c_str();
+
+ mPrimitivesText->setText(llformat("%d %s, %d %s", primitives, available, parcel->getPrimCount(), allocated));
+
+ if (parcel->getAllowOtherScripts())
+ {
+ mParcelScriptsText->setText(getString("all_residents_text"));
+ }
+ else if (parcel->getAllowGroupScripts())
+ {
+ mParcelScriptsText->setText(getString("group_text"));
+ }
+ else
+ {
+ mParcelScriptsText->setText(off);
+ }
+
+ mTerraformLimitsText->setText(parcel->getAllowTerraform() ? on : off);
+
+ if (region->getRegionFlags() & REGION_FLAGS_ALLOW_PARCEL_CHANGES)
+ {
+ mSubdivideText->setText(getString("can_change"));
+ }
+ else
+ {
+ mSubdivideText->setText(getString("can_not_change"));
+ }
+ if (region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
+ {
+ mResaleText->setText(getString("can_not_resell"));
+ }
+ else
+ {
+ mResaleText->setText(getString("can_resell"));
+ }
+ }
processParcelInfo(parcel_data);
+
+ getChild<LLAccordionCtrlTab>("sales_tab")->setVisible(for_sale);
+}
+
+void LLPanelPlaceInfo::updateEstateName(const std::string& name)
+{
+ mEstateNameText->setText(name);
+}
+
+void LLPanelPlaceInfo::updateEstateOwnerName(const std::string& name)
+{
+ mEstateOwnerText->setText(name);
+}
+
+void LLPanelPlaceInfo::updateCovenantText(const std::string &text)
+{
+ mCovenantText->setText(text);
+}
+
+void LLPanelPlaceInfo::updateLastVisitedText(const LLDate &date)
+{
+ if (date.isNull())
+ {
+ mLastVisited->setText(getString("unknown"));
+ }
+ else
+ {
+ std::string timeStr = getString("acquired_date");
+ LLSD substitution;
+ substitution["datetime"] = (S32) date.secondsSinceEpoch();
+ LLStringUtil::format (timeStr, substitution);
+ mLastVisited->setText(timeStr);
+ }
}
void LLPanelPlaceInfo::onCommitTitleOrNote(LANDMARK_INFO_TYPE type)
@@ -512,7 +805,10 @@ void LLPanelPlaceInfo::onCommitTitleOrNote(LANDMARK_INFO_TYPE type)
}
}
- if (item_value != current_value &&
+ LLStringUtil::trim(current_value);
+
+ if (!current_value.empty() &&
+ item_value != current_value &&
gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))
{
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
@@ -544,11 +840,17 @@ void LLPanelPlaceInfo::createLandmark(const LLUUID& folder_id)
if (name.empty())
{
name = mParcelName->getText();
+
+ // If no parcel exists use the region name instead.
+ if (name.empty())
+ {
+ name = mRegionName->getText();
+ }
}
LLStringUtil::replaceChar(desc, '\n', ' ');
// If no folder chosen use the "Landmarks" folder.
- LLLandmarkActions::createLandmarkHere(name, desc,
+ LLLandmarkActions::createLandmarkHere(name, desc,
folder_id.notNull() ? folder_id : gInventory.findCategoryUUIDForType(LLAssetType::AT_LANDMARK));
}
@@ -561,19 +863,24 @@ void LLPanelPlaceInfo::createPick(const LLVector3d& global_pos)
pick_data.pick_id = LLUUID::generateNewID();
pick_data.creator_id = gAgentID;
- //legacy var need to be deleted
+ //legacy var needs to be deleted
pick_data.top_pick = FALSE;
pick_data.parcel_id = mParcelID;
pick_data.name = mParcelName->getText();
+ if (pick_data.name.empty())
+ {
+ pick_data.name = mRegionName->getText();
+ }
pick_data.desc = mDescEditor->getText();
pick_data.snapshot_id = mSnapshotCtrl->getImageAssetID();
pick_data.pos_global = global_pos;
pick_data.sort_order = 0;
pick_data.enabled = TRUE;
- LLAvatarPropertiesProcessor::instance().sendDataUpdate(&pick_data, APT_PICK_INFO);
+ LLAvatarPropertiesProcessor::instance().sendPickInfoUpdate(&pick_data);
}
+// virtual
void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
{
if (mMinHeight > 0 && mScrollingPanel != NULL)
@@ -583,3 +890,22 @@ void LLPanelPlaceInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
LLView::reshape(width, height, called_from_parent);
}
+
+// virtual
+void LLPanelPlaceInfo::handleVisibilityChange (BOOL new_visibility)
+{
+ LLPanel::handleVisibilityChange(new_visibility);
+
+ LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
+ if (!parcel_mgr)
+ return;
+
+ // Remove land selection when panel hides.
+ if (!new_visibility)
+ {
+ if (!parcel_mgr->selectionEmpty())
+ {
+ parcel_mgr->deselectLand();
+ }
+ }
+}