diff options
| author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-06-20 17:38:23 +0300 | 
|---|---|---|
| committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-06-20 17:38:23 +0300 | 
| commit | 6c0891473ff1d5f740e3d3624cec2f5c17da0ad6 (patch) | |
| tree | 8e2ece0d452245d6ec43adf6c78553f47b76cc96 | |
| parent | 2a035c080dec2aa16b9628aac7b120e4f15135c2 (diff) | |
SL-19892 add missing menu items for Landmarks in Gallery view
| -rw-r--r-- | indra/newview/llinventorygallerymenu.cpp | 59 | 
1 files changed, 59 insertions, 0 deletions
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<void(LLLandmark*)> copy_slurl_cb = [](LLLandmark* landmark) +        { +            LLVector3d global_pos; +            landmark->getGlobalPos(global_pos); +            boost::function<void(std::string& slurl)> 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<void(LLLandmark*)> 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)  | 
