summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-02-08 15:44:02 -0800
committerMerov Linden <merov@lindenlab.com>2012-02-08 15:44:02 -0800
commit91f77318db63d4b2560390551306056c4a6cc2d5 (patch)
tree4aa42af172b0d0552e490f7bdd5d92e40906d60e /indra
parentee3c3c15b714f8f68e98a2d4064afaec665bd64a (diff)
EXP-1873 : Implement the hiding of cut items on the clipboard
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llclipboard.cpp6
-rw-r--r--indra/llui/llclipboard.h14
-rw-r--r--indra/newview/llfolderviewitem.cpp6
-rw-r--r--indra/newview/llinventoryfilter.cpp19
-rw-r--r--indra/newview/llinventoryfilter.h4
-rw-r--r--indra/newview/llinventorypanel.cpp13
-rw-r--r--indra/newview/llinventorypanel.h1
7 files changed, 49 insertions, 14 deletions
diff --git a/indra/llui/llclipboard.cpp b/indra/llui/llclipboard.cpp
index 7794a0537f..ee1f1aa816 100644
--- a/indra/llui/llclipboard.cpp
+++ b/indra/llui/llclipboard.cpp
@@ -34,7 +34,8 @@
#include "llview.h"
#include "llwindow.h"
-LLClipboard::LLClipboard()
+LLClipboard::LLClipboard() :
+ mState(0)
{
reset();
}
@@ -46,6 +47,7 @@ LLClipboard::~LLClipboard()
void LLClipboard::reset()
{
+ mState++;
mObjects.reset();
mCutMode = false;
mString = LLWString();
@@ -74,6 +76,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ
if (res)
{
mObjects.put(src);
+ mState++;
}
}
return res;
@@ -126,6 +129,7 @@ bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool us
{
mString = mString + sep + src.substr(pos, len);
}
+ mState++;
return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString));
}
diff --git a/indra/llui/llclipboard.h b/indra/llui/llclipboard.h
index 608ea246a7..0231169748 100644
--- a/indra/llui/llclipboard.h
+++ b/indra/llui/llclipboard.h
@@ -47,6 +47,11 @@ class LLClipboard : public LLSingleton<LLClipboard>
public:
LLClipboard();
~LLClipboard();
+
+ // Clears the clipboard
+ void reset();
+ // Returns the state of the clipboard so client can know if it has been modified (comparing with tracked state)
+ int getState() const { return mState; }
// Text strings management:
// ------------------------
@@ -61,8 +66,6 @@ public:
// Object list management:
// -----------------------
- // Clears the clipboard
- void reset();
// Clears and adds one single object to the clipboard
bool copyToClipboard(const LLUUID& src, const LLAssetType::EType type = LLAssetType::AT_NONE);
// Adds one object to the current list of objects on the clipboard
@@ -74,12 +77,13 @@ public:
bool isOnClipboard(const LLUUID& object) const; // True if the input object uuid is on the clipboard
bool isCutMode() const { return mCutMode; }
- void setCutMode(bool mode) { mCutMode = mode; }
+ void setCutMode(bool mode) { mCutMode = mode; mState++; }
private:
- LLDynamicArray<LLUUID> mObjects;
- LLWString mString;
+ LLDynamicArray<LLUUID> mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat)
+ LLWString mString; // The text string. If mObjects is not empty, this string is reflecting them (UUIDs for the moment).
bool mCutMode; // This is a convenience flag for the viewer. It has no influence on the cliboard management.
+ int mState; // Incremented when the clipboard change so that interested parties can check its state.
};
#endif // LL_LLCLIPBOARD_H
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 37ef27a5d7..884cddfe7f 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -1004,12 +1004,6 @@ void LLFolderViewItem::draw()
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/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 796251cae5..9d12478019 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -39,6 +39,7 @@
#include "llviewerfoldertype.h"
// linden library includes
+#include "llclipboard.h"
#include "lltrans.h"
LLInventoryFilter::FilterOps::FilterOps() :
@@ -236,7 +237,18 @@ BOOL LLInventoryFilter::checkAgainstFilterType(const LLFolderViewItem* item) con
}
}
}
-
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // FILTERTYPE_CLIPBOARD
+ // Pass if this item is not on the clipboard
+ if (filterTypes & FILTERTYPE_CLIPBOARD)
+ {
+ if (LLClipboard::getInstance()->isCutMode() && LLClipboard::getInstance()->isOnClipboard(object_id))
+ {
+ return FALSE;
+ }
+ }
+
return TRUE;
}
@@ -450,6 +462,11 @@ void LLInventoryFilter::setFilterEmptySystemFolders()
mFilterOps.mFilterTypes |= FILTERTYPE_EMPTYFOLDERS;
}
+void LLInventoryFilter::setFilterClipboard()
+{
+ mFilterOps.mFilterTypes |= FILTERTYPE_CLIPBOARD;
+}
+
void LLInventoryFilter::setFilterUUID(const LLUUID& object_id)
{
if (mFilterOps.mFilterUUID == LLUUID::null)
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index 343306ae8e..fb4f84b139 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -59,7 +59,8 @@ public:
FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it
FILTERTYPE_DATE = 0x1 << 3, // search by date range
FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type
- FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if empty
+ FILTERTYPE_EMPTYFOLDERS = 0x1 << 5, // pass if folder is not a system folder to be hidden if empty
+ FILTERTYPE_CLIPBOARD = 0x1 << 6 // pass if item is not on the clipboard
};
enum EFilterLink
@@ -91,6 +92,7 @@ public:
void setFilterUUID(const LLUUID &object_id);
void setFilterWearableTypes(U64 types);
void setFilterEmptySystemFolders();
+ void setFilterClipboard();
void updateFilterTypes(U64 types, U64& current_types);
void setFilterSubString(const std::string& string);
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 382569fa3a..27f97ad26f 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -33,6 +33,7 @@
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "llavataractions.h"
+#include "llclipboard.h"
#include "llfloaterinventory.h"
#include "llfloaterreg.h"
#include "llfloatersidepanelcontainer.h"
@@ -247,6 +248,10 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
getFilter()->setFilterEmptySystemFolders();
}
+ // hide items that are on the clipboard
+ getFilter()->setFilterClipboard();
+ mClipboardState = LLClipboard::getInstance()->getState();
+
// Initialize base class params.
LLPanel::initFromParams(params);
}
@@ -277,6 +282,14 @@ void LLInventoryPanel::draw()
{
// Select the desired item (in case it wasn't loaded when the selection was requested)
mFolderRoot->updateSelection();
+
+ // Nudge the filter if the clipboard state changed
+ if (mClipboardState != LLClipboard::getInstance()->getState())
+ {
+ mClipboardState = LLClipboard::getInstance()->getState();
+ getFilter()->setModified(LLInventoryFilter::FILTER_RESTART);
+ }
+
LLPanel::draw();
}
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 7d805f6862..6db59afb9b 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -222,6 +222,7 @@ public:
private:
std::string mSortOrderSetting;
+ int mClipboardState;
//--------------------------------------------------------------------
// Hidden folders