From 6c0891473ff1d5f740e3d3624cec2f5c17da0ad6 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Tue, 20 Jun 2023 17:38:23 +0300 Subject: SL-19892 add missing menu items for Landmarks in Gallery view --- indra/newview/llinventorygallerymenu.cpp | 59 ++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'indra') diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp index e30883d564..541fed8172 100644 --- a/indra/newview/llinventorygallerymenu.cpp +++ b/indra/newview/llinventorygallerymenu.cpp @@ -33,9 +33,12 @@ #include "llavataractions.h" #include "llclipboard.h" #include "llfloaterreg.h" +#include "llfloatersidepanelcontainer.h" +#include "llfloaterworldmap.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventorymodel.h" +#include "lllandmarkactions.h" #include "llmarketplacefunctions.h" #include "llmenugl.h" #include "llnotificationsutil.h" @@ -217,6 +220,55 @@ void LLInventoryGalleryContextMenu::doToSelected(const LLSD& userdata, const LLU { LLFloaterReg::showInstance("linkreplace", LLSD(selected_id)); } + else if ("copy_slurl" == action) + { + boost::function copy_slurl_cb = [](LLLandmark* landmark) + { + LLVector3d global_pos; + landmark->getGlobalPos(global_pos); + boost::function copy_slurl_to_clipboard_cb = [](const std::string& slurl) + { + gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(slurl)); + LLSD args; + args["SLURL"] = slurl; + LLNotificationsUtil::add("CopySLURL", args); + }; + LLLandmarkActions::getSLURLfromPosGlobal(global_pos, copy_slurl_to_clipboard_cb, true); + }; + LLLandmark* landmark = LLLandmarkActions::getLandmark(selected_id, copy_slurl_cb); + if (landmark) + { + copy_slurl_cb(landmark); + } + } + else if ("about" == action) + { + LLSD key; + key["type"] = "landmark"; + key["id"] = selected_id; + LLFloaterSidePanelContainer::showPanel("places", key); + } + else if ("show_on_map" == action) + { + boost::function show_on_map_cb = [](LLLandmark* landmark) + { + LLVector3d landmark_global_pos; + if (landmark->getGlobalPos(landmark_global_pos)) + { + LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); + if (!landmark_global_pos.isExactlyZero() && worldmap_instance) + { + worldmap_instance->trackLocation(landmark_global_pos); + LLFloaterReg::showInstance("world_map", "center"); + } + } + }; + LLLandmark* landmark = LLLandmarkActions::getLandmark(selected_id, show_on_map_cb); + if(landmark) + { + show_on_map_cb(landmark); + } + } } void LLInventoryGalleryContextMenu::onRename(const LLSD& notification, const LLSD& response) @@ -357,6 +409,13 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men { items.push_back(std::string("Replace Links")); } + if (obj->getType() == LLAssetType::AT_LANDMARK) + { + items.push_back(std::string("Landmark Separator")); + items.push_back(std::string("url_copy")); + items.push_back(std::string("About Landmark")); + items.push_back(std::string("show_on_map")); + } } if(is_trash) -- cgit v1.2.3