summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelpick.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2009-09-29 19:37:05 +0000
committerSteven Bennetts <steve@lindenlab.com>2009-09-29 19:37:05 +0000
commit606b381c9fbc43c214afd26fb2e2598eec656b66 (patch)
tree422a6d5d94d50bd97ac5bcbdb52f0f6de083c6e7 /indra/newview/llpanelpick.cpp
parent751cc7cf68bb4d766e8ecaaf76af054dcfbbe9dc (diff)
merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1830 https://svn.aws.productengine.com/secondlife/pe/stable-2@1839 -> viewer-2.0.0-3
JIRAS: EXT-96 EXT-204 EXT-312 EXT-334 EXT-479 EXT-498 EXT-514 EXT-637 EXT-647 EXT-746 EXT-748 EXT-749 EXT-757 EXT-789 EXT-794 EXT-808 EXT-817 EXT-823 EXT-831 EXT-834 EXT-837 EXT-844 EXT-848 EXT-862 EXT-876 EXT-896 EXT-897 EXT-898 EXT-899 EXT-910 EXT-912 EXT-918 EXT-921 EXT-925 EXT-926 EXT-928 EXT-930 EXT-931 EXT-935 EXT-938 EXT-939 EXT-952 EXT-985 EXT-986 EXT-992 EXT-994 EXT-995 EXT-996 EXT-997 EXT-998 EXT-1001 EXT-1004 EXT-1010 EXT-1012 EXT-1016 EXT-1018 EXT-1020 EXT-1028 EXT-1041 EXT-1044 EXT-1051 EXT-1052 EXT-1061 EXT-1069 EXT-1071 EXT-1074 EXT-1075 EXT-1076 EXT-1078 EXT-1080 EXT-1081 EXT-1082 EXT-1083 EXT-1085 EXT-1092 EXT-1093 EXT-1099 EXT-1100 EXT-1101 EXT-1104 EXT-1106 EXT-1111 EXT-1113 EXT-1114 EXT-1115 EXT-1116 EXT-1118 EXT-1119 EXT-1129 EXT-1132 EXT-1135 EXT-1138 EXT-1142 EXT-1161 EXT-1162 EXT-1178 EXT-1180 * NEW DEVELOPMENT: * EXT-898 - Add dock/undock support for camera and movement controls * Avatar list changes * Bottom bar changes: menu, docking, visibility * Camera changes * Camera & Movement Floaters * Dockable Floaters (LLDockableFloater) * Removed LLListCtrl * Toast / Notification changes: signal / destruction changes, ordering * Nearby chat input should display active voice indicator QA NOTES: * Message Well Window is ready to be tested for regression & matching the spec. * Verify Group List Item L&F * Verify All tabs in People Panel * Verify that Picks behavior is not changed
Diffstat (limited to 'indra/newview/llpanelpick.cpp')
-rw-r--r--indra/newview/llpanelpick.cpp122
1 files changed, 98 insertions, 24 deletions
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 9ae58d1cb6..42185d28e5 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -64,6 +64,7 @@
#define LABEL_PICK = "Pick"
#define LABEL_CHANGES = "Changes"
+std::string SET_LOCATION_NOTICE("(will update after save)");
LLPanelPick::LLPanelPick(BOOL edit_mode/* = FALSE */)
: LLPanel(), LLAvatarPropertiesObserver(), LLRemoteParcelInfoObserver(),
@@ -71,7 +72,8 @@ LLPanelPick::LLPanelPick(BOOL edit_mode/* = FALSE */)
mSnapshotCtrl(NULL),
mPickId(LLUUID::null),
mCreatorId(LLUUID::null),
- mDataReceived(FALSE)
+ mDataReceived(FALSE),
+ mIsPickNew(false)
{
if (edit_mode)
{
@@ -171,7 +173,7 @@ void LLPanelPick::init(LLPickData *pick_data)
setPickName(pick_data->name);
setPickDesc(pick_data->desc);
- setPickLocation(pick_data->location_text);
+
mSnapshotCtrl->setImageAssetID(pick_data->snapshot_id);
//*HACK see reset() where the texture control was set to FALSE
@@ -180,27 +182,45 @@ void LLPanelPick::init(LLPickData *pick_data)
mPosGlobal = pick_data->pos_global;
mSimName = pick_data->sim_name;
mParcelId = pick_data->parcel_id;
+
+ setPickLocation(createLocationText(pick_data->user_name, pick_data->original_name,
+ pick_data->sim_name, pick_data->pos_global));
}
-// Fill in some reasonable defaults for a new pick.
-void LLPanelPick::createNewPick()
+void LLPanelPick::prepareNewPick(const LLVector3d pos_global,
+ const std::string& name,
+ const std::string& desc,
+ const LLUUID& snapshot_id,
+ const LLUUID& parcel_id)
{
mPickId.generate();
mCreatorId = gAgent.getID();
- mPosGlobal = gAgent.getPositionGlobal();
+ mPosGlobal = pos_global;
+ setPickName(name);
+ setPickDesc(desc);
+ mSnapshotCtrl->setImageAssetID(snapshot_id);
+ mParcelId = parcel_id;
+
+ setPickLocation(createLocationText(std::string(""), SET_LOCATION_NOTICE, name, pos_global));
+ childSetLabelArg(XML_BTN_SAVE, SAVE_BTN_LABEL, std::string("Pick"));
+
+ mIsPickNew = true;
+}
+
+// Fill in some reasonable defaults for a new pick.
+void LLPanelPick::prepareNewPick()
+{
// Try to fill in the current parcel
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (parcel)
{
- setPickName(parcel->getName());
- setPickDesc(parcel->getDesc());
- mSnapshotCtrl->setImageAssetID(parcel->getSnapshotID());
+ prepareNewPick(gAgent.getPositionGlobal(),
+ parcel->getName(),
+ parcel->getDesc(),
+ parcel->getSnapshotID(),
+ parcel->getID());
}
-
- sendUpdate();
-
- childSetLabelArg(XML_BTN_SAVE, SAVE_BTN_LABEL, std::string("Pick"));
}
/*virtual*/ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type)
@@ -235,6 +255,15 @@ void LLPanelPick::setEditMode( BOOL edit_mode )
deleteAllChildren();
+ // *WORKAROUND: for EXT-931. Children are created for both XML_PANEL_EDIT_PICK & XML_PANEL_PICK_INFO files
+ // The reason is in LLPanel::initPanelXML called from the LLUICtrlFactory::buildPanel().
+ // It creates children from the xml file stored while previous initializing in the "mXMLFilename" member
+ // and then in creates children from the parameters passed from the LLUICtrlFactory::buildPanel().
+ // Xml filename is stored after LLPanel::initPanelXML is called (added with export-from-ll/viewer-2-0, r1594 into LLUICtrlFactory::buildPanel & LLUICtrlFactory::buildFloater)
+ // In case panel creates children from the different xml files they appear from both files.
+ // So, let clear xml filename related to this instance.
+ setXMLFilename("");
+
if (edit_mode)
{
LLUICtrlFactory::getInstance()->buildPanel(this, XML_PANEL_EDIT_PICK);
@@ -258,6 +287,40 @@ void LLPanelPick::setEditMode( BOOL edit_mode )
updateButtons();
}
+//////////////////////////////////////////////////////////////////////////
+// PROTECTED AREA
+//////////////////////////////////////////////////////////////////////////
+
+//static
+std::string LLPanelPick::createLocationText(const std::string& owner_name, const std::string& original_name,
+ const std::string& sim_name, const LLVector3d& pos_global)
+{
+ std::string location_text;
+ location_text.append(owner_name);
+ if (!original_name.empty())
+ {
+ if (!location_text.empty()) location_text.append(", ");
+ location_text.append(original_name);
+
+ }
+ if (!sim_name.empty())
+ {
+ if (!location_text.empty()) location_text.append(", ");
+ location_text.append(sim_name);
+ }
+
+ if (!location_text.empty()) location_text.append(" ");
+
+ if (!pos_global.isNull())
+ {
+ S32 region_x = llround((F32)pos_global.mdV[VX]) % REGION_WIDTH_UNITS;
+ S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
+ S32 region_z = llround((F32)pos_global.mdV[VZ]);
+ location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
+ }
+ return location_text;
+}
+
void LLPanelPick::setPickName(std::string name)
{
if (mEditMode)
@@ -288,7 +351,7 @@ void LLPanelPick::setPickDesc(std::string desc)
mDesc = desc;
}
-void LLPanelPick::setPickLocation(std::string location)
+void LLPanelPick::setPickLocation(const std::string& location)
{
childSetWrappedText(XML_LOCATION, location);
@@ -375,6 +438,12 @@ void LLPanelPick::onClickCancel()
{
if (!mEditMode) return;
+ if (mIsPickNew)
+ {
+ mBackCb(this, LLSD());
+ return;
+ }
+
LLUUID pick_id = mPickId;
LLUUID creator_id = mCreatorId;
reset();
@@ -385,29 +454,34 @@ void LLPanelPick::onClickCancel()
void LLPanelPick::onClickSet()
{
if (!mEditMode) return;
- if (!mDataReceived) return;
+ if (!mIsPickNew && !mDataReceived) return;
// Save location for later.
mPosGlobal = gAgent.getPositionGlobal();
- S32 region_x = llround((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS;
- S32 region_y = llround((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS;
- S32 region_z = llround((F32)mPosGlobal.mdV[VZ]);
-
- std::string location_text = "(will update after save), ";
- location_text.append(mSimName);
- location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
-
- setPickLocation(location_text);
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ mParcelId = parcel->getID();
+ mSimName = parcel->getName();
+ }
+ setPickLocation(createLocationText(std::string(""), SET_LOCATION_NOTICE, mSimName, mPosGlobal));
}
// static
void LLPanelPick::onClickSave()
{
if (!mEditMode) return;
- if (!mDataReceived) return;
+ if (!mIsPickNew && !mDataReceived) return;
sendUpdate();
+
+ if (mIsPickNew)
+ {
+ mBackCb(this, LLSD());
+ return;
+ }
+
setEditMode(FALSE);
}