diff options
Diffstat (limited to 'indra/newview/llviewertexteditor.cpp')
-rw-r--r-- | indra/newview/llviewertexteditor.cpp | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index ed8d820844..8fad9e09cb 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -44,6 +44,9 @@ #include "llinventory.h" #include "llinventorybridge.h" #include "llinventorymodel.h" +#include "lllandmark.h" +#include "lllandmarkactions.h" +#include "lllandmarklist.h" #include "llmemorystream.h" #include "llmenugl.h" #include "llnotecard.h" @@ -64,10 +67,47 @@ #include "llviewertexturelist.h" #include "llviewerwindow.h" -#include "llappviewer.h" // for gPacificDaylightTime - static LLDefaultChildRegistry::Register<LLViewerTextEditor> r("text_editor"); +///----------------------------------------------------------------------- +/// Class LLEmbeddedLandmarkCopied +///----------------------------------------------------------------------- +class LLEmbeddedLandmarkCopied: public LLInventoryCallback +{ +public: + + LLEmbeddedLandmarkCopied(){} + void fire(const LLUUID& inv_item) + { + showInfo(inv_item); + } + static void showInfo(const LLUUID& landmark_inv_id) + { + LLSD key; + key["type"] = "landmark"; + key["id"] = landmark_inv_id; + LLSideTray::getInstance()->showPanel("panel_places", key); + } + static void processForeignLandmark(LLLandmark* landmark, + const LLUUID& object_id, const LLUUID& notecard_inventory_id, + LLInventoryItem* item) + { + LLVector3d global_pos; + landmark->getGlobalPos(global_pos); + LLViewerInventoryItem* agent_lanmark = + LLLandmarkActions::findLandmarkForGlobalPos(global_pos); + + if (agent_lanmark) + { + showInfo(agent_lanmark->getUUID()); + } + else + { + LLPointer<LLEmbeddedLandmarkCopied> cb = new LLEmbeddedLandmarkCopied(); + copy_inventory_from_notecard(object_id, notecard_inventory_id, item, gInventoryCallbacks.registerCB(cb)); + } + } +}; ///---------------------------------------------------------------------------- /// Class LLEmbeddedNotecardOpener ///---------------------------------------------------------------------------- @@ -1100,14 +1140,12 @@ void LLViewerTextEditor::openEmbeddedLandmark( LLInventoryItem* item, llwchar wc if (!item) return; - LLSD key; - key["type"] = "landmark"; - key["id"] = item->getUUID(); - - LLPanelPlaces *panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", key)); - if (panel) + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID(), + boost::bind(&LLEmbeddedLandmarkCopied::processForeignLandmark, _1, mObjectID, mNotecardInventoryID, item)); + if (landmark) { - panel->setItem(item); + LLEmbeddedLandmarkCopied::processForeignLandmark(landmark, mObjectID, + mNotecardInventoryID, item); } } |