summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llclipboard.cpp6
-rw-r--r--indra/llui/llclipboard.h2
-rw-r--r--indra/newview/llfolderview.cpp3
-rw-r--r--indra/newview/llfolderviewitem.cpp9
-rw-r--r--indra/newview/llinventorybridge.cpp22
-rw-r--r--indra/newview/skins/default/xui/en/menu_inventory.xml8
6 files changed, 46 insertions, 4 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 5c8db29ae4..a2a3f7f285 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -97,6 +97,12 @@ BOOL LLClipboard::hasContents() const
return (mObjects.count() > 0);
}
+// Returns true if the input uuid is in the list of clipboard objects
+bool LLClipboard::isOnClipboard(const LLUUID& object) const
+{
+ return (mObjects.find(object) != LLDynamicArray<LLUUID>::FAIL);
+}
+
// Copy the input string to the LL and the system clipboard
bool LLClipboard::copyToClipboard(const LLWString &src, S32 pos, S32 len, bool use_primary)
{
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index bb2d003703..8e417a490d 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -69,6 +69,8 @@ public:
BOOL hasContents() const; // true if the clipboard has something pasteable in it
bool isCutMode() const { return mCutMode; }
+ void setCutMode(bool mode) { mCutMode = mode; }
+ bool isOnClipboard(const LLUUID& object) const;
private:
LLDynamicArray<LLUUID> mObjects;
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 438d7e7ae3..1d318ca221 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2108,8 +2108,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
removeSelectedItems();
return true;
}
-
- if ("copy" == action)
+ if (("copy" == action) || ("cut" == action))
{
LLClipboard::getInstance()->reset();
}
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 734adbc648..37ef27a5d7 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -40,6 +40,7 @@
#include "llviewerwindow.h" // Argh, only for setCursor()
// linden library includes
+#include "llclipboard.h"
#include "llfocusmgr.h" // gFocusMgr
#include "lltrans.h"
@@ -1002,7 +1003,13 @@ void LLFolderViewItem::draw()
LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
if (highlight_link) color = sLinkColor;
if (in_library) color = sLibraryColor;
-
+
+ // Cut state rendering tweak (experimental)
+ if (LLClipboard::getInstance()->isCutMode() && LLClipboard::getInstance()->isOnClipboard(getListener()->getUUID()))
+ {
+ color.setAlpha(0.5);
+ }
+
F32 right_x = 0;
F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 14f1bb9d41..7ba914eaf6 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -210,7 +210,7 @@ BOOL LLInvFVBridge::isLink() const
*/
void LLInvFVBridge::cutToClipboard()
{
- if(isItemMovable())
+ if (isItemMovable() && isItemRemovable())
{
LLClipboard::getInstance()->cut(mUUID);
}
@@ -602,6 +602,12 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Copy"));
}
+ items.push_back(std::string("Cut"));
+ if (!isItemMovable() || !isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Cut"));
+ }
+
if (canListOnMarketplace())
{
items.push_back(std::string("Marketplace Separator"));
@@ -1281,6 +1287,11 @@ void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(buffer));
return;
}
+ else if ("cut" == action)
+ {
+ cutToClipboard();
+ return;
+ }
else if ("copy" == action)
{
copyToClipboard();
@@ -2608,6 +2619,11 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
modifyOutfit(TRUE);
return;
}
+ else if ("cut" == action)
+ {
+ cutToClipboard();
+ return;
+ }
else if ("copy" == action)
{
copyToClipboard();
@@ -2867,6 +2883,8 @@ void LLFolderBridge::pasteFromClipboard()
}
}
}
+ // Change mode to paste for next paste
+ LLClipboard::getInstance()->setCutMode(false);
}
}
@@ -2920,6 +2938,8 @@ void LLFolderBridge::pasteLinkFromClipboard()
LLPointer<LLInventoryCallback>(NULL));
}
}
+ // Change mode to paste for next paste
+ LLClipboard::getInstance()->setCutMode(false);
}
}
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index ef4a1bc061..b13bf5b508 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -453,6 +453,14 @@
layout="topleft"
name="Copy Separator" />
<menu_item_call
+ label="Cut"
+ layout="topleft"
+ name="Cut">
+ <menu_item_call.on_click
+ function="Inventory.DoToSelected"
+ parameter="cut" />
+ </menu_item_call>
+ <menu_item_call
label="Copy"
layout="topleft"
name="Copy">