EXP-1841 : change mState to mGeneration in LLClipboard.

meow-7.2.2
Merov Linden 2012-03-01 23:10:06 -08:00
parent 44c66e11cc
commit a41507eef0
3 changed files with 12 additions and 13 deletions

View File

@ -35,7 +35,7 @@
#include "llwindow.h"
LLClipboard::LLClipboard() :
mState(0)
mGeneration(0)
{
reset();
}
@ -47,8 +47,8 @@ LLClipboard::~LLClipboard()
void LLClipboard::reset()
{
// Increment the clipboard state
mState++;
// Increment the clipboard count
mGeneration++;
// Call the cleanup function (if any) before releasing the object list
if (mCutMode && mCleanupCallback)
{
@ -84,7 +84,7 @@ bool LLClipboard::addToClipboard(const LLUUID& src, const LLAssetType::EType typ
if (res)
{
mObjects.push_back(src);
mState++;
mGeneration++;
}
}
return res;
@ -138,7 +138,7 @@ bool LLClipboard::addToClipboard(const LLWString &src, S32 pos, S32 len, bool us
{
mString = mString + sep + src.substr(pos, len);
}
mState++;
mGeneration++;
return (use_primary ? LLView::getWindow()->copyTextToPrimary(mString) : LLView::getWindow()->copyTextToClipboard(mString));
}

View File

@ -54,7 +54,7 @@ public:
// 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; }
int getGeneration() const { return mGeneration; }
// Text strings management:
// ------------------------
@ -80,15 +80,14 @@ 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, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mState++; }
void setCutMode(bool mode, cleanup_callback_t cb = NULL) { mCutMode = mode; mCleanupCallback = cb; mGeneration++; }
private:
std::vector<LLUUID> mObjects; // Objects on the clipboard. Can be empty while mString contains something licit (e.g. text from chat)
std::vector<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. Will determine if mCleanupCallback() needs to be called.
cleanup_callback_t mCleanupCallback;// Function to call when the cut clipboard is being wiped out. Can be set to NULL (nothing done then).
int mState; // Incremented when the clipboard change so that interested parties can check its state.
int mGeneration; // Incremented when the clipboard changes so that interested parties can check for changes on the clipboard.
};
#endif // LL_LLCLIPBOARD_H

View File

@ -249,7 +249,7 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params)
}
// keep track of the clipboard state so that we avoid filtering too much
mClipboardState = LLClipboard::instance().getState();
mClipboardState = LLClipboard::instance().getGeneration();
// Initialize base class params.
LLPanel::initFromParams(params);
@ -283,9 +283,9 @@ void LLInventoryPanel::draw()
mFolderRoot->updateSelection();
// Nudge the filter if the clipboard state changed
if (mClipboardState != LLClipboard::instance().getState())
if (mClipboardState != LLClipboard::instance().getGeneration())
{
mClipboardState = LLClipboard::instance().getState();
mClipboardState = LLClipboard::instance().getGeneration();
getFilter()->setModified(LLClipboard::instance().isCutMode() ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);
}