summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-02-07 17:13:24 -0800
committerMerov Linden <merov@lindenlab.com>2012-02-07 17:13:24 -0800
commitc744603af9b53c6bc73fefbd56de68cf2778ed70 (patch)
tree353cea8bbf89f69bd644b6d0b3fd2fa4c66acf8b /indra/newview
parent9761375ac244af36635899c73e99efc46b68b589 (diff)
EXP-1873 : Implement cut in the inventory contextual menu. Works without deleting the items but simply dimming them and moving them. Doesn't work for folders yet.
Diffstat (limited to 'indra/newview')
-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
4 files changed, 38 insertions, 4 deletions
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">