Skip to content

Commit 3e5f4fd

Browse files
authored
Merge pull request #3940 from Ansariel/devleop-picks-improvement
Restore option to change location of existing pick
2 parents b81be8e + fb0332d commit 3e5f4fd

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

indra/newview/llpanelprofilepicks.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ void LLPanelProfilePicks::onClickNewBtn()
248248
select_tab(true).
249249
label(pick_panel->getPickName()));
250250
updateButtons();
251+
252+
pick_panel->addLocationChangedCallbacks();
251253
}
252254

253255
void LLPanelProfilePicks::onClickDelete()
@@ -607,10 +609,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
607609
{
608610
mPickName->setEnabled(true);
609611
mPickDescription->setEnabled(true);
612+
mSetCurrentLocationButton->setVisible(true);
610613
}
611614
else
612615
{
613616
mSnapshotCtrl->setEnabled(false);
617+
mSetCurrentLocationButton->setVisible(false);
614618
}
615619
}
616620

@@ -621,6 +625,7 @@ bool LLPanelProfilePick::postBuild()
621625
mSaveButton = getChild<LLButton>("save_changes_btn");
622626
mCreateButton = getChild<LLButton>("create_changes_btn");
623627
mCancelButton = getChild<LLButton>("cancel_changes_btn");
628+
mSetCurrentLocationButton = getChild<LLButton>("set_to_curr_location_btn");
624629

625630
mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot");
626631
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this));
@@ -633,6 +638,7 @@ bool LLPanelProfilePick::postBuild()
633638
mSaveButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
634639
mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
635640
mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this));
641+
mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this));
636642

637643
mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL);
638644
mPickName->setEnabled(false);
@@ -811,6 +817,32 @@ bool LLPanelProfilePick::isDirty() const
811817
return false;
812818
}
813819

820+
void LLPanelProfilePick::onClickSetLocation()
821+
{
822+
// Save location for later use.
823+
setPosGlobal(gAgent.getPositionGlobal());
824+
825+
std::string parcel_name, region_name;
826+
827+
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
828+
if (parcel)
829+
{
830+
mParcelId = parcel->getID();
831+
parcel_name = parcel->getName();
832+
}
833+
834+
LLViewerRegion* region = gAgent.getRegion();
835+
if (region)
836+
{
837+
region_name = region->getName();
838+
}
839+
840+
setPickLocation(createLocationText(getLocationNotice(), parcel_name, region_name, getPosGlobal()));
841+
842+
mLocationChanged = true;
843+
enableSaveButton(true);
844+
}
845+
814846
void LLPanelProfilePick::onClickSave()
815847
{
816848
if (mRegionCallbackConnection.connected())
@@ -821,6 +853,10 @@ void LLPanelProfilePick::onClickSave()
821853
{
822854
mParcelCallbackConnection.disconnect();
823855
}
856+
if (mLocationChanged)
857+
{
858+
onClickSetLocation();
859+
}
824860
sendUpdate();
825861

826862
mLocationChanged = false;
@@ -871,6 +907,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data)
871907
}
872908
}
873909

910+
void LLPanelProfilePick::addLocationChangedCallbacks()
911+
{
912+
mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); });
913+
mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); });
914+
}
915+
874916
void LLPanelProfilePick::setParcelID(const LLUUID& parcel_id)
875917
{
876918
if (mParcelId != parcel_id)

indra/newview/llpanelprofilepicks.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class LLPanelProfilePick
141141
LLUUID getParcelID() const { return mParcelId; }
142142
void setErrorStatus(S32 status, const std::string& reason) override {};
143143

144+
void addLocationChangedCallbacks();
145+
144146
protected:
145147

146148
/**
@@ -202,6 +204,11 @@ class LLPanelProfilePick
202204
*/
203205
void resetDirty() override;
204206

207+
/**
208+
* Callback for "Set Location" button click
209+
*/
210+
void onClickSetLocation();
211+
205212
/**
206213
* Callback for "Save" and "Create" button click
207214
*/
@@ -224,6 +231,7 @@ class LLPanelProfilePick
224231
LLTextureCtrl* mSnapshotCtrl;
225232
LLLineEditor* mPickName;
226233
LLTextEditor* mPickDescription;
234+
LLButton* mSetCurrentLocationButton;
227235
LLButton* mSaveButton;
228236
LLButton* mCreateButton;
229237
LLButton* mCancelButton;
@@ -241,7 +249,7 @@ class LLPanelProfilePick
241249

242250
bool mLocationChanged;
243251
bool mNewPick;
244-
bool mIsEditing;
252+
bool mIsEditing;
245253

246254
void onDescriptionFocusReceived();
247255
};

indra/newview/skins/default/xui/en/panel_profile_pick.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,26 @@
198198
/>
199199
</layout_panel>
200200

201+
<layout_panel
202+
follows="all"
203+
layout="bottomleft"
204+
left_pad="2"
205+
name="set_to_curr_location_btn_lp"
206+
auto_resize="false"
207+
width="100">
208+
<button
209+
name="set_to_curr_location_btn"
210+
label="Set Location"
211+
tool_tip="Set to Current Location"
212+
left="0"
213+
top="0"
214+
height="23"
215+
width="100"
216+
follows="left|top"
217+
layout="topleft"
218+
/>
219+
</layout_panel>
220+
201221
<layout_panel
202222
follows="all"
203223
layout="topleft"

0 commit comments

Comments
 (0)