diff options
author | Merov Linden <merov@lindenlab.com> | 2012-02-08 15:44:02 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-02-08 15:44:02 -0800 |
commit | 91f77318db63d4b2560390551306056c4a6cc2d5 (patch) | |
tree | 4aa42af172b0d0552e490f7bdd5d92e40906d60e /indra/llui | |
parent | ee3c3c15b714f8f68e98a2d4064afaec665bd64a (diff) |
EXP-1873 : Implement the hiding of cut items on the clipboard
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llclipboard.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llclipboard.h | 14 |
2 files changed, 14 insertions, 6 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 |