From 702eb95b8445aa1eecba4051c67c9121fc2f16cc Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 10 Dec 2012 19:39:55 -0500 Subject: [PATCH] Add Paste As Copy to inventory menu... The opposite of Paste As Link, this will make copies of everything in the paste buffer, allowing the user to copy bunches of items or links and simply paste them to make new copies. Also appears when not needed... unsure how to go about removing, maybe comment out in release? --- indra/newview/llfoldervieweventlistener.h | 2 +- indra/newview/llinventorybridge.cpp | 32 +++++++++++++++++-- indra/newview/llinventorybridge.h | 4 +-- indra/newview/llpanelobjectinventory.cpp | 4 +-- .../default/xui/en-us/menu_inventory.xml | 4 +++ 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index 3bfbf3611..69060653f 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -77,7 +77,7 @@ public: virtual BOOL copyToClipboard() const = 0; virtual void cutToClipboard() = 0; virtual BOOL isClipboardPasteable() const = 0; - virtual void pasteFromClipboard() = 0; + virtual void pasteFromClipboard(bool only_copies = false) = 0; virtual void pasteLinkFromClipboard() = 0; virtual void buildContextMenu(LLMenuGL& menu, U32 flags) = 0; virtual BOOL isUpToDate() const = 0; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ff3a0a3da..ab240c996 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -816,10 +816,14 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id, if (!isCOFFolder() && !isInboxFolder() && !isOutboxFolder()) { items.push_back(std::string("Paste")); + // Paste as copy if we have links. + if (InventoryLinksEnabled() && !LLInventoryClipboard::instance().isCutMode()) + items.push_back(std::string("Paste As Copy")); } if (!isClipboardPasteable() || ((flags & FIRST_SELECTED_ITEM) == 0)) { disabled_items.push_back(std::string("Paste")); + disabled_items.push_back(std::string("Paste As Copy")); } if(InventoryLinksEnabled()) @@ -1483,6 +1487,18 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action) folder_view_itemp->getListener()->pasteFromClipboard(); return; } + else if ("paste_copies" == action) + { + // Single item only + LLInventoryItem* itemp = model->getItem(mUUID); + if (!itemp) return; + + LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID()); + if (!folder_view_itemp) return; + + folder_view_itemp->getListener()->pasteFromClipboard(true); + return; + } else if ("paste_link" == action) { // Single item only @@ -2854,6 +2870,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) pasteFromClipboard(); return; } + else if ("paste_copies" == action) + { + pasteFromClipboard(true); + return; + } else if ("paste_link" == action) { pasteLinkFromClipboard(); @@ -3092,7 +3113,7 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re return FALSE; } -void LLFolderBridge::pasteFromClipboard() +void LLFolderBridge::pasteFromClipboard(bool only_copies) { LLInventoryModel* model = getInventoryModel(); if(model && isClipboardPasteable()) @@ -3165,7 +3186,7 @@ void LLFolderBridge::pasteFromClipboard() dropToOutfit(item, move_is_into_current_outfit); } } - else if(LLInventoryClipboard::instance().isCutMode()) + else if (!only_copies && LLInventoryClipboard::instance().isCutMode()) { // Do a move to "paste" a "cut" // move_inventory_item() is not enough, as we have to update inventory locally too @@ -3190,6 +3211,11 @@ void LLFolderBridge::pasteFromClipboard() } else { + if (only_copies) + { + item = model->getLinkedItem(item_id); + obj = model->getObject(item->getUUID()); + } // Do a "copy" to "paste" a regular copy clipboard if (LLAssetType::AT_CATEGORY == obj->getType()) { @@ -3201,7 +3227,7 @@ void LLFolderBridge::pasteFromClipboard() } } // [SL:KB] - Patch: Inventory-Links | Checked: 2010-04-12 (Catznip-2.2.0a) | Added: Catznip-2.0.0a - else if (LLAssetType::lookupIsLinkType(item->getActualType())) + else if (!only_copies && LLAssetType::lookupIsLinkType(item->getActualType())) { link_inventory_item( gAgent.getID(), diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 945c653ba..ca2c906a3 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -109,7 +109,7 @@ public: virtual void cutToClipboard(); virtual BOOL isClipboardPasteable() const; virtual BOOL isClipboardPasteableAsLink() const; - virtual void pasteFromClipboard() {} + virtual void pasteFromClipboard(bool only_copies = false) {} virtual void pasteLinkFromClipboard() {} void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, menuentry_vec_t &disabled_items, U32 flags); @@ -261,7 +261,7 @@ public: BOOL removeSystemFolder(); bool removeItemResponse(const LLSD& notification, const LLSD& response); - virtual void pasteFromClipboard(); + virtual void pasteFromClipboard(bool only_copies = false); virtual void pasteLinkFromClipboard(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual BOOL hasChildren() const; diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 8929780d5..cd9d17587 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -131,7 +131,7 @@ public: virtual BOOL copyToClipboard() const; virtual void cutToClipboard(); virtual BOOL isClipboardPasteable() const; - virtual void pasteFromClipboard(); + virtual void pasteFromClipboard(bool only_copies = false); virtual void pasteLinkFromClipboard(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual void performAction(LLInventoryModel* model, std::string action); @@ -604,7 +604,7 @@ BOOL LLTaskInvFVBridge::isClipboardPasteable() const return FALSE; } -void LLTaskInvFVBridge::pasteFromClipboard() +void LLTaskInvFVBridge::pasteFromClipboard(bool only_copies) { } diff --git a/indra/newview/skins/default/xui/en-us/menu_inventory.xml b/indra/newview/skins/default/xui/en-us/menu_inventory.xml index 012524098..ee207769a 100644 --- a/indra/newview/skins/default/xui/en-us/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en-us/menu_inventory.xml @@ -198,6 +198,10 @@ name="Paste" width="128"> + + +