summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-09 01:59:15 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-02-09 01:59:15 +0200
commitd12514af8193888f9eb66bb92a9c2ac3d4e0e56e (patch)
tree5aa45a1a417b80e236eed7bee5417cbc338270e5 /indra/newview
parent74d3f9d017a424d69bfc256ecc1062fdaa3b18c3 (diff)
SL-14797 Normalize right-click menus on Landmarks & Picks Part#3
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lllandmarkactions.cpp22
-rw-r--r--indra/newview/lllandmarkactions.h6
-rw-r--r--indra/newview/llpanelteleporthistory.cpp38
-rw-r--r--indra/newview/llpanelteleporthistory.h4
-rw-r--r--indra/newview/llteleporthistorystorage.cpp22
-rw-r--r--indra/newview/llteleporthistorystorage.h7
-rw-r--r--indra/newview/skins/default/xui/en/menu_teleport_history_item.xml19
7 files changed, 66 insertions, 52 deletions
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index c243f8b4f0..a17dc674ac 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -228,23 +228,6 @@ LLViewerInventoryItem* LLLandmarkActions::findLandmarkForAgentPos()
return findLandmarkForGlobalPos(gAgent.getPositionGlobal());
}
-bool LLLandmarkActions::canCreateLandmarkHere()
-{
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if(!agent_parcel)
- {
- LL_WARNS() << "No agent region" << LL_ENDL;
- return false;
- }
- if (agent_parcel->getAllowLandmark()
- || LLViewerParcelMgr::isParcelOwnedByAgent(agent_parcel, GP_LAND_ALLOW_LANDMARK))
- {
- return true;
- }
-
- return false;
-}
-
void LLLandmarkActions::createLandmarkHere(
const std::string& name,
const std::string& desc,
@@ -261,11 +244,6 @@ void LLLandmarkActions::createLandmarkHere(
LL_WARNS() << "No agent parcel" << LL_ENDL;
return;
}
- if (!canCreateLandmarkHere())
- {
- LLNotificationsUtil::add("CannotCreateLandmarkNotOwner");
- return;
- }
create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
folder_id, LLTransactionID::tnull,
diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h
index 870d92811e..ae7b072fcb 100644
--- a/indra/newview/lllandmarkactions.h
+++ b/indra/newview/lllandmarkactions.h
@@ -72,12 +72,6 @@ public:
*/
static LLViewerInventoryItem* findLandmarkForAgentPos();
-
- /**
- * @brief Checks whether agent has rights to create landmark for current parcel.
- */
- static bool canCreateLandmarkHere();
-
/**
* @brief Creates landmark for current parcel.
*/
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index fe0608d544..3f5664f431 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -396,9 +396,7 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
// (N.B. callbacks don't take const refs as mID is local scope)
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- registrar.add("TeleportHistory.Teleport", boost::bind(&LLTeleportHistoryPanel::ContextMenu::onTeleport, this));
- registrar.add("TeleportHistory.MoreInformation",boost::bind(&LLTeleportHistoryPanel::ContextMenu::onInfo, this));
- registrar.add("TeleportHistory.CopyToClipboard",boost::bind(&LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard, this));
+ registrar.add("TeleportHistory.Action", boost::bind(&LLTeleportHistoryPanel::ContextMenu::onUserAction, this, _2));
// create the context menu from the XUI
llassert(LLMenuGL::sMenuContainer != NULL);
@@ -406,14 +404,27 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
"menu_teleport_history_item.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
}
-void LLTeleportHistoryPanel::ContextMenu::onTeleport()
+void LLTeleportHistoryPanel::ContextMenu::onUserAction(const LLSD& userdata)
{
- confirmTeleport(mIndex);
-}
-
-void LLTeleportHistoryPanel::ContextMenu::onInfo()
-{
- LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
+ std::string command_name = userdata.asString();
+ if ("teleport" == command_name)
+ {
+ confirmTeleport(mIndex);
+ }
+ else if ("view" == command_name)
+ {
+ LLTeleportHistoryFlatItem::showPlaceInfoPanel(mIndex);
+ }
+ else if ("show_on_map" == command_name)
+ {
+ LLTeleportHistoryStorage::getInstance()->showItemOnMap(mIndex);
+ }
+ else if ("copy_slurl" == command_name)
+ {
+ LLVector3d globalPos = LLTeleportHistoryStorage::getInstance()->getItems()[mIndex].mGlobalPos;
+ LLLandmarkActions::getSLURLfromPosGlobal(globalPos,
+ boost::bind(&LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback, _1));
+ }
}
//static
@@ -427,13 +438,6 @@ void LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback(const std::string& sl
LLNotificationsUtil::add("CopySLURL", args);
}
-void LLTeleportHistoryPanel::ContextMenu::onCopyToClipboard()
-{
- LLVector3d globalPos = LLTeleportHistoryStorage::getInstance()->getItems()[mIndex].mGlobalPos;
- LLLandmarkActions::getSLURLfromPosGlobal(globalPos,
- boost::bind(&LLTeleportHistoryPanel::ContextMenu::gotSLURLCallback, _1));
-}
-
// Not yet implemented; need to remove buildPanel() from constructor when we switch
//static LLRegisterPanelClassWrapper<LLTeleportHistoryPanel> t_teleport_history("panel_teleport_history");
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index b88861c5c6..e0abbc47db 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -52,9 +52,7 @@ public:
private:
LLContextMenu* createMenu();
- void onTeleport();
- void onInfo();
- void onCopyToClipboard();
+ void onUserAction(const LLSD& userdata);
static void gotSLURLCallback(const std::string& slurl);
diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp
index 8a5704939a..93fa457bd0 100644
--- a/indra/newview/llteleporthistorystorage.cpp
+++ b/indra/newview/llteleporthistorystorage.cpp
@@ -33,6 +33,8 @@
#include "lldir.h"
#include "llteleporthistory.h"
#include "llagent.h"
+#include "llfloaterreg.h"
+#include "llfloaterworldmap.h"
// Max offset for two global positions to consider them as equal
const F64 MAX_GLOBAL_POS_OFFSET = 5.0f;
@@ -253,3 +255,23 @@ void LLTeleportHistoryStorage::goToItem(S32 idx)
gAgent.teleportViaLocation(mItems[idx].mGlobalPos);
}
+void LLTeleportHistoryStorage::showItemOnMap(S32 idx)
+{
+ // Validate specified index.
+ if (idx < 0 || idx >= (S32)mItems.size())
+ {
+ LL_WARNS() << "Invalid teleport history index (" << idx << ") specified" << LL_ENDL;
+ dump();
+ return;
+ }
+
+ LLVector3d landmark_global_pos = mItems[idx].mGlobalPos;
+
+ LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance();
+ if (!landmark_global_pos.isExactlyZero() && worldmap_instance)
+ {
+ worldmap_instance->trackLocation(landmark_global_pos);
+ LLFloaterReg::showInstance("world_map", "center");
+ }
+}
+
diff --git a/indra/newview/llteleporthistorystorage.h b/indra/newview/llteleporthistorystorage.h
index 946ac0af1a..3578923fd7 100644
--- a/indra/newview/llteleporthistorystorage.h
+++ b/indra/newview/llteleporthistorystorage.h
@@ -107,6 +107,13 @@ public:
*/
void goToItem(S32 idx);
+ /**
+ * Show specific item on map.
+ *
+ * The item is specified by its index (starting from 0).
+ */
+ void showItemOnMap(S32 idx);
+
private:
void load();
diff --git a/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml b/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml
index f939c3996d..52da591e35 100644
--- a/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml
+++ b/indra/newview/skins/default/xui/en/menu_teleport_history_item.xml
@@ -7,20 +7,31 @@
layout="topleft"
name="Teleport">
<menu_item_call.on_click
- function="TeleportHistory.Teleport" />
+ function="TeleportHistory.Action"
+ parameter="teleport" />
</menu_item_call>
<menu_item_call
- label="More Information"
+ label="View"
layout="topleft"
name="More Information">
<menu_item_call.on_click
- function="TeleportHistory.MoreInformation" />
+ function="TeleportHistory.Action"
+ parameter="view" />
+ </menu_item_call>
+ <menu_item_call
+ label="Show on map"
+ layout="topleft"
+ name="show_on_map">
+ <menu_item_call.on_click
+ function="TeleportHistory.Action"
+ parameter="show_on_map" />
</menu_item_call>
<menu_item_call
label="Copy SLurl"
layout="topleft"
name="CopyToClipboard">
<menu_item_call.on_click
- function="TeleportHistory.CopyToClipboard" />
+ function="TeleportHistory.Action"
+ parameter="copy_slurl" />
</menu_item_call>
</context_menu>