@@ -248,6 +248,8 @@ void LLPanelProfilePicks::onClickNewBtn()
248
248
select_tab (true ).
249
249
label (pick_panel->getPickName ()));
250
250
updateButtons ();
251
+
252
+ pick_panel->addLocationChangedCallbacks ();
251
253
}
252
254
253
255
void LLPanelProfilePicks::onClickDelete ()
@@ -607,10 +609,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
607
609
{
608
610
mPickName ->setEnabled (true );
609
611
mPickDescription ->setEnabled (true );
612
+ mSetCurrentLocationButton ->setVisible (true );
610
613
}
611
614
else
612
615
{
613
616
mSnapshotCtrl ->setEnabled (false );
617
+ mSetCurrentLocationButton ->setVisible (false );
614
618
}
615
619
}
616
620
@@ -621,6 +625,7 @@ bool LLPanelProfilePick::postBuild()
621
625
mSaveButton = getChild<LLButton>(" save_changes_btn" );
622
626
mCreateButton = getChild<LLButton>(" create_changes_btn" );
623
627
mCancelButton = getChild<LLButton>(" cancel_changes_btn" );
628
+ mSetCurrentLocationButton = getChild<LLButton>(" set_to_curr_location_btn" );
624
629
625
630
mSnapshotCtrl = getChild<LLTextureCtrl>(" pick_snapshot" );
626
631
mSnapshotCtrl ->setCommitCallback (boost::bind (&LLPanelProfilePick::onSnapshotChanged, this ));
@@ -633,6 +638,7 @@ bool LLPanelProfilePick::postBuild()
633
638
mSaveButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSave, this ));
634
639
mCreateButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSave, this ));
635
640
mCancelButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickCancel, this ));
641
+ mSetCurrentLocationButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSetLocation, this ));
636
642
637
643
mPickName ->setKeystrokeCallback (boost::bind (&LLPanelProfilePick::onPickChanged, this , _1), NULL );
638
644
mPickName ->setEnabled (false );
@@ -811,6 +817,32 @@ bool LLPanelProfilePick::isDirty() const
811
817
return false ;
812
818
}
813
819
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
+
814
846
void LLPanelProfilePick::onClickSave ()
815
847
{
816
848
if (mRegionCallbackConnection .connected ())
@@ -821,6 +853,10 @@ void LLPanelProfilePick::onClickSave()
821
853
{
822
854
mParcelCallbackConnection .disconnect ();
823
855
}
856
+ if (mLocationChanged )
857
+ {
858
+ onClickSetLocation ();
859
+ }
824
860
sendUpdate ();
825
861
826
862
mLocationChanged = false ;
@@ -871,6 +907,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data)
871
907
}
872
908
}
873
909
910
+ void LLPanelProfilePick::addLocationChangedCallbacks ()
911
+ {
912
+ mRegionCallbackConnection = gAgent .addRegionChangedCallback ([this ]() { onClickSetLocation (); });
913
+ mParcelCallbackConnection = gAgent .addParcelChangedCallback ([this ]() { onClickSetLocation (); });
914
+ }
915
+
874
916
void LLPanelProfilePick::setParcelID (const LLUUID& parcel_id)
875
917
{
876
918
if (mParcelId != parcel_id)
0 commit comments