36
36
#include " lldispatcher.h"
37
37
#include " llfloaterreg.h"
38
38
#include " llfloaterworldmap.h"
39
+ #include " lllandmarkactions.h"
39
40
#include " lllineeditor.h"
40
41
#include " llnotificationsutil.h"
41
42
#include " llpanelavatar.h"
42
43
#include " llpanelprofile.h"
43
44
#include " llparcel.h"
45
+ #include " llregionhandle.h"
44
46
#include " llstartup.h"
45
47
#include " lltabcontainer.h"
46
48
#include " lltextbox.h"
51
53
#include " llviewergenericmessage.h" // send_generic_message
52
54
#include " llviewerparcelmgr.h"
53
55
#include " llviewerregion.h"
56
+ #include " llworldmap.h"
54
57
55
58
static LLPanelInjector<LLPanelProfilePicks> t_panel_profile_picks (" panel_profile_picks" );
56
59
static LLPanelInjector<LLPanelProfilePick> t_panel_profile_pick (" panel_profile_pick" );
@@ -589,26 +592,28 @@ bool LLPanelProfilePick::postBuild()
589
592
mSaveButton = getChild<LLButton>(" save_changes_btn" );
590
593
mCreateButton = getChild<LLButton>(" create_changes_btn" );
591
594
mCancelButton = getChild<LLButton>(" cancel_changes_btn" );
595
+ mCreateLandmarkButton = getChild<LLButton>(" create_landmark_btn" );
592
596
mSetCurrentLocationButton = getChild<LLButton>(" set_to_curr_location_btn" );
593
597
594
598
mSnapshotCtrl = getChild<LLTextureCtrl>(" pick_snapshot" );
595
- mSnapshotCtrl ->setCommitCallback (boost::bind (&LLPanelProfilePick::onSnapshotChanged, this ) );
599
+ mSnapshotCtrl ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onSnapshotChanged (); } );
596
600
mSnapshotCtrl ->setAllowLocalTexture (false );
597
601
mSnapshotCtrl ->setBakeTextureEnabled (false );
598
602
599
- childSetAction (" teleport_btn" , boost::bind (&LLPanelProfilePick::onClickTeleport, this ) );
600
- childSetAction (" show_on_map_btn" , boost::bind (&LLPanelProfilePick::onClickMap, this ) );
603
+ childSetAction (" teleport_btn" , [&](LLUICtrl*, const LLSD&) { onClickTeleport (); } );
604
+ childSetAction (" show_on_map_btn" , [&](LLUICtrl*, const LLSD&) { onClickMap (); } );
601
605
602
- mSaveButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSave, this ));
603
- mCreateButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSave, this ));
604
- mCancelButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickCancel, this ));
605
- mSetCurrentLocationButton ->setCommitCallback (boost::bind (&LLPanelProfilePick::onClickSetLocation, this ));
606
+ mSaveButton ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onClickSave (); });
607
+ mCreateButton ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onClickSave (); });
608
+ mCancelButton ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onClickCancel (); });
609
+ mCreateLandmarkButton ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onClickCreateLandmark (); });
610
+ mSetCurrentLocationButton ->setCommitCallback ([&](LLUICtrl*, const LLSD&) { onClickSetLocation (); });
606
611
607
- mPickName ->setKeystrokeCallback (boost::bind (&LLPanelProfilePick::onPickChanged, this , _1) , NULL );
612
+ mPickName ->setKeystrokeCallback ([&](LLLineEditor* ctrl, void *) { onPickChanged (ctrl); } , NULL );
608
613
mPickName ->setEnabled (false );
609
614
610
- mPickDescription ->setKeystrokeCallback (boost::bind (&LLPanelProfilePick::onPickChanged, this , _1) );
611
- mPickDescription ->setFocusReceivedCallback (boost::bind (&LLPanelProfilePick::onDescriptionFocusReceived, this ) );
615
+ mPickDescription ->setKeystrokeCallback ([&](LLTextEditor* ctrl) { onPickChanged (ctrl); } );
616
+ mPickDescription ->setFocusReceivedCallback ([&](LLFocusableElement*) { onDescriptionFocusReceived (); } );
612
617
613
618
getChild<LLUICtrl>(" pick_location" )->setEnabled (false );
614
619
@@ -765,6 +770,27 @@ bool LLPanelProfilePick::isDirty() const
765
770
return false ;
766
771
}
767
772
773
+ void LLPanelProfilePick::onClickCreateLandmark ()
774
+ {
775
+ if (gAgent .getRegion () &&
776
+ !gAgent .getRegion ()->getCapability (" CreateLandmarkForPosition" ).empty ())
777
+ {
778
+ U64 handle = to_region_handle (mPosGlobal );
779
+ if (LLSimInfo* info = LLWorldMap::getInstance ()->simInfoFromHandle (handle))
780
+ {
781
+ std::string region_name = info->getName ();
782
+ S32 x = llclamp (ll_round ((F32)mPosGlobal .mdV [VX]), 0 , REGION_WIDTH_UNITS);
783
+ S32 y = llclamp (ll_round ((F32)mPosGlobal .mdV [VY]), 0 , REGION_WIDTH_UNITS);
784
+ S32 z = ll_round (llclamp ((F32)mPosGlobal .mdV [VZ], MIN_OBJECT_Z, MAX_OBJECT_Z));
785
+ std::string title = getChild<LLUICtrl>(" pick_location" )->getValue ().asString ();
786
+ LLLandmarkActions::showFloaterCreateLandmarkForCoords (region_name, x, y, z, title);
787
+ return ;
788
+ }
789
+ }
790
+
791
+ LLNotificationsUtil::add (" CantCreateLandmark" );
792
+ }
793
+
768
794
void LLPanelProfilePick::onClickSetLocation ()
769
795
{
770
796
// Save location for later use.
@@ -899,14 +925,14 @@ void LLPanelProfilePick::sendUpdate()
899
925
std::string LLPanelProfilePick::createLocationText (const std::string& owner_name, const std::string& original_name, const std::string& sim_name, const LLVector3d& pos_global)
900
926
{
901
927
std::string location_text (owner_name);
928
+
902
929
if (!original_name.empty ())
903
930
{
904
931
if (!location_text.empty ())
905
932
{
906
933
location_text.append (" , " );
907
934
}
908
935
location_text.append (original_name);
909
-
910
936
}
911
937
912
938
if (!sim_name.empty ())
@@ -918,18 +944,18 @@ std::string LLPanelProfilePick::createLocationText(const std::string& owner_name
918
944
location_text.append (sim_name);
919
945
}
920
946
921
- if (!location_text.empty ())
922
- {
923
- location_text.append (" " );
924
- }
925
-
926
947
if (!pos_global.isNull ())
927
948
{
949
+ if (!location_text.empty ())
950
+ {
951
+ location_text.append (" " );
952
+ }
928
953
S32 region_x = ll_round ((F32)pos_global.mdV [VX]) % REGION_WIDTH_UNITS;
929
954
S32 region_y = ll_round ((F32)pos_global.mdV [VY]) % REGION_WIDTH_UNITS;
930
955
S32 region_z = ll_round ((F32)pos_global.mdV [VZ]);
931
- location_text.append (llformat (" (%d, %d, %d)" , region_x, region_y, region_z));
956
+ location_text.append (llformat (" (%d, %d, %d)" , region_x, region_y, region_z));
932
957
}
958
+
933
959
return location_text;
934
960
}
935
961
0 commit comments