Update to LLTombstone/LLHandle/LLRootHandle/LLHandleProvider.
This commit is contained in:
@@ -148,7 +148,6 @@ LLFloater::LLFloater() :
|
|||||||
mResizeHandle[i] = NULL;
|
mResizeHandle[i] = NULL;
|
||||||
}
|
}
|
||||||
mDragHandle = NULL;
|
mDragHandle = NULL;
|
||||||
mHandle.bind(this);
|
|
||||||
mNotificationContext = new LLFloaterNotificationContext(getHandle());
|
mNotificationContext = new LLFloaterNotificationContext(getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +221,6 @@ void LLFloater::initFloater(const std::string& title,
|
|||||||
BOOL resizable, S32 min_width, S32 min_height,
|
BOOL resizable, S32 min_width, S32 min_height,
|
||||||
BOOL drag_on_left, BOOL minimizable, BOOL close_btn)
|
BOOL drag_on_left, BOOL minimizable, BOOL close_btn)
|
||||||
{
|
{
|
||||||
mHandle.bind(this);
|
|
||||||
mNotificationContext = new LLFloaterNotificationContext(getHandle());
|
mNotificationContext = new LLFloaterNotificationContext(getHandle());
|
||||||
|
|
||||||
// Init function can be called more than once, so clear out old data.
|
// Init function can be called more than once, so clear out old data.
|
||||||
@@ -422,7 +420,7 @@ void LLFloater::initFloater(const std::string& title,
|
|||||||
setVisible(FALSE);
|
setVisible(FALSE);
|
||||||
|
|
||||||
// add self to handle->floater map
|
// add self to handle->floater map
|
||||||
sFloaterMap[mHandle] = this;
|
sFloaterMap[getHandle()] = this;
|
||||||
|
|
||||||
if (!getParent())
|
if (!getParent())
|
||||||
{
|
{
|
||||||
@@ -483,7 +481,7 @@ LLFloater::~LLFloater()
|
|||||||
// correct, non-minimized positions.
|
// correct, non-minimized positions.
|
||||||
setMinimized( FALSE );
|
setMinimized( FALSE );
|
||||||
|
|
||||||
sFloaterMap.erase(mHandle);
|
sFloaterMap.erase(getHandle());
|
||||||
|
|
||||||
delete mDragHandle;
|
delete mDragHandle;
|
||||||
for (S32 i = 0; i < 4; i++)
|
for (S32 i = 0; i < 4; i++)
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ public:
|
|||||||
void clearSnapTarget() { mSnappedTo.markDead(); }
|
void clearSnapTarget() { mSnappedTo.markDead(); }
|
||||||
LLHandle<LLFloater> getSnapTarget() const { return mSnappedTo; }
|
LLHandle<LLFloater> getSnapTarget() const { return mSnappedTo; }
|
||||||
|
|
||||||
LLHandle<LLFloater> getHandle() const { return mHandle; }
|
LLHandle<LLFloater> getHandle() const { return getDerivedHandle<LLFloater>(); }
|
||||||
|
|
||||||
// Return a closeable floater, if any, given the current focus.
|
// Return a closeable floater, if any, given the current focus.
|
||||||
static LLFloater* getClosableFloaterFromFocus();
|
static LLFloater* getClosableFloaterFromFocus();
|
||||||
@@ -331,7 +331,6 @@ private:
|
|||||||
S32 mPreviousMinimizedLeft;
|
S32 mPreviousMinimizedLeft;
|
||||||
|
|
||||||
LLFloaterNotificationContext* mNotificationContext;
|
LLFloaterNotificationContext* mNotificationContext;
|
||||||
LLRootHandle<LLFloater> mHandle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -28,38 +28,67 @@
|
|||||||
#define LLHANDLE_H
|
#define LLHANDLE_H
|
||||||
|
|
||||||
#include "llpointer.h"
|
#include "llpointer.h"
|
||||||
|
#include <boost/type_traits/is_convertible.hpp>
|
||||||
|
#include <boost/utility/enable_if.hpp>
|
||||||
|
|
||||||
template <typename T>
|
/**
|
||||||
|
* Helper object for LLHandle. Don't instantiate these directly, used
|
||||||
|
* exclusively by LLHandle.
|
||||||
|
*/
|
||||||
class LLTombStone : public LLRefCount
|
class LLTombStone : public LLRefCount
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLTombStone(T* target = NULL) : mTarget(target) {}
|
LLTombStone(void* target = NULL) : mTarget(target) {}
|
||||||
|
|
||||||
void setTarget(T* target) { mTarget = target; }
|
void setTarget(void* target) { mTarget = target; }
|
||||||
T* getTarget() const { return mTarget; }
|
void* getTarget() const { return mTarget; }
|
||||||
private:
|
private:
|
||||||
T* mTarget;
|
mutable void* mTarget;
|
||||||
};
|
};
|
||||||
|
|
||||||
// LLHandles are used to refer to objects whose lifetime you do not control or influence.
|
/**
|
||||||
// Calling get() on a handle will return a pointer to the referenced object or NULL,
|
* LLHandles are used to refer to objects whose lifetime you do not control or influence.
|
||||||
// if the object no longer exists. Note that during the lifetime of the returned pointer,
|
* Calling get() on a handle will return a pointer to the referenced object or NULL,
|
||||||
// you are assuming that the object will not be deleted by any action you perform,
|
* if the object no longer exists. Note that during the lifetime of the returned pointer,
|
||||||
// or any other thread, as normal when using pointers, so avoid using that pointer outside of
|
* you are assuming that the object will not be deleted by any action you perform,
|
||||||
// the local code block.
|
* or any other thread, as normal when using pointers, so avoid using that pointer outside of
|
||||||
//
|
* the local code block.
|
||||||
// https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
|
*
|
||||||
|
* https://wiki.lindenlab.com/mediawiki/index.php?title=LLHandle&oldid=79669
|
||||||
|
*
|
||||||
|
* The implementation is like some "weak pointer" implementations. When we
|
||||||
|
* can't control the lifespan of the referenced object of interest, we can
|
||||||
|
* still instantiate a proxy object whose lifespan we DO control, and store in
|
||||||
|
* the proxy object a dumb pointer to the actual target. Then we just have to
|
||||||
|
* ensure that on destruction of the target object, the proxy's dumb pointer
|
||||||
|
* is set NULL.
|
||||||
|
*
|
||||||
|
* LLTombStone is our proxy object. LLHandle contains an LLPointer to the
|
||||||
|
* LLTombStone, so every copy of an LLHandle increments the LLTombStone's ref
|
||||||
|
* count as usual.
|
||||||
|
*
|
||||||
|
* One copy of the LLHandle, specifically the LLRootHandle, must be stored in
|
||||||
|
* the referenced object. Destroying the LLRootHandle is what NULLs the
|
||||||
|
* proxy's target pointer.
|
||||||
|
*
|
||||||
|
* Minor optimization: we want LLHandle's mTombStone to always be a valid
|
||||||
|
* LLPointer, saving some conditionals in dereferencing. That's the
|
||||||
|
* getDefaultTombStone() mechanism. The default LLTombStone object's target
|
||||||
|
* pointer is always NULL, so it's semantically identical to allowing
|
||||||
|
* mTombStone to be invalid.
|
||||||
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class LLHandle
|
class LLHandle
|
||||||
{
|
{
|
||||||
|
template <typename U> friend class LLHandle;
|
||||||
|
template <typename U> friend class LLHandleProvider;
|
||||||
public:
|
public:
|
||||||
LLHandle() : mTombStone(getDefaultTombStone()) {}
|
LLHandle() : mTombStone(getDefaultTombStone()) {}
|
||||||
const LLHandle<T>& operator =(const LLHandle<T>& other)
|
|
||||||
{
|
template<typename U>
|
||||||
mTombStone = other.mTombStone;
|
LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0)
|
||||||
return *this;
|
: mTombStone(other.mTombStone)
|
||||||
}
|
{}
|
||||||
|
|
||||||
bool isDead() const
|
bool isDead() const
|
||||||
{
|
{
|
||||||
@@ -73,7 +102,7 @@ public:
|
|||||||
|
|
||||||
T* get() const
|
T* get() const
|
||||||
{
|
{
|
||||||
return mTombStone->getTarget();
|
return reinterpret_cast<T*>(mTombStone->getTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
friend bool operator== (const LLHandle<T>& lhs, const LLHandle<T>& rhs)
|
||||||
@@ -94,37 +123,49 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LLPointer<LLTombStone<T> > mTombStone;
|
LLPointer<LLTombStone> mTombStone;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static LLPointer<LLTombStone<T> >& getDefaultTombStone()
|
typedef T* pointer_t;
|
||||||
|
static LLPointer<LLTombStone>& getDefaultTombStone()
|
||||||
{
|
{
|
||||||
static LLPointer<LLTombStone<T> > sDefaultTombStone = new LLTombStone<T>;
|
static LLPointer<LLTombStone> sDefaultTombStone = new LLTombStone;
|
||||||
return sDefaultTombStone;
|
return sDefaultTombStone;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LLRootHandle isa LLHandle which must be stored in the referenced object.
|
||||||
|
* You can either store it directly and explicitly bind(this), or derive from
|
||||||
|
* LLHandleProvider (q.v.) which automates that for you. The essential point
|
||||||
|
* is that destroying the LLRootHandle (as a consequence of destroying the
|
||||||
|
* referenced object) calls unbind(), setting the LLTombStone's target pointer
|
||||||
|
* NULL.
|
||||||
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class LLRootHandle : public LLHandle<T>
|
class LLRootHandle : public LLHandle<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
typedef LLRootHandle<T> self_t;
|
||||||
|
typedef LLHandle<T> base_t;
|
||||||
|
|
||||||
LLRootHandle(T* object) { bind(object); }
|
LLRootHandle(T* object) { bind(object); }
|
||||||
LLRootHandle() {};
|
LLRootHandle() {};
|
||||||
~LLRootHandle() { unbind(); }
|
~LLRootHandle() { unbind(); }
|
||||||
|
|
||||||
// this is redundant, since a LLRootHandle *is* an LLHandle
|
// this is redundant, since an LLRootHandle *is* an LLHandle
|
||||||
LLHandle<T> getHandle() { return LLHandle<T>(*this); }
|
//LLHandle<T> getHandle() { return LLHandle<T>(*this); }
|
||||||
|
|
||||||
void bind(T* object)
|
void bind(T* object)
|
||||||
{
|
{
|
||||||
// unbind existing tombstone
|
// unbind existing tombstone
|
||||||
if (LLHandle<T>::mTombStone.notNull())
|
if (LLHandle<T>::mTombStone.notNull())
|
||||||
{
|
{
|
||||||
if (LLHandle<T>::mTombStone->getTarget() == object) return;
|
if (LLHandle<T>::mTombStone->getTarget() == (void*)object) return;
|
||||||
LLHandle<T>::mTombStone->setTarget(NULL);
|
LLHandle<T>::mTombStone->setTarget(NULL);
|
||||||
}
|
}
|
||||||
// tombstone reference counted, so no paired delete
|
// tombstone reference counted, so no paired delete
|
||||||
LLHandle<T>::mTombStone = new LLTombStone<T>(object);
|
LLHandle<T>::mTombStone = new LLTombStone((void*)object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unbind()
|
void unbind()
|
||||||
@@ -137,11 +178,22 @@ private:
|
|||||||
LLRootHandle(const LLRootHandle& other) {};
|
LLRootHandle(const LLRootHandle& other) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use this as a mixin for simple classes that need handles and when you don't
|
/**
|
||||||
// want handles at multiple points of the inheritance hierarchy
|
* Use this as a mixin for simple classes that need handles and when you don't
|
||||||
|
* want handles at multiple points of the inheritance hierarchy
|
||||||
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class LLHandleProvider
|
class LLHandleProvider
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
LLHandle<T> getHandle() const
|
||||||
|
{
|
||||||
|
// perform lazy binding to avoid small tombstone allocations for handle
|
||||||
|
// providers whose handles are never referenced
|
||||||
|
mHandle.bind(static_cast<T*>(const_cast<LLHandleProvider<T>* >(this)));
|
||||||
|
return mHandle;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef LLHandle<T> handle_type_t;
|
typedef LLHandle<T> handle_type_t;
|
||||||
LLHandleProvider()
|
LLHandleProvider()
|
||||||
@@ -149,16 +201,17 @@ protected:
|
|||||||
// provided here to enforce T deriving from LLHandleProvider<T>
|
// provided here to enforce T deriving from LLHandleProvider<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
LLHandle<T> getHandle()
|
template <typename U>
|
||||||
{
|
LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const
|
||||||
// perform lazy binding to avoid small tombstone allocations for handle
|
{
|
||||||
// providers whose handles are never referenced
|
LLHandle<U> downcast_handle;
|
||||||
mHandle.bind(static_cast<T*>(this));
|
downcast_handle.mTombStone = getHandle().mTombStone;
|
||||||
return mHandle;
|
return downcast_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLRootHandle<T> mHandle;
|
mutable LLRootHandle<T> mHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ void LLPanel::init()
|
|||||||
mDefaultBtn = NULL;
|
mDefaultBtn = NULL;
|
||||||
setIsChrome(FALSE); //is this a decorator to a live window or a form?
|
setIsChrome(FALSE); //is this a decorator to a live window or a form?
|
||||||
|
|
||||||
mPanelHandle.bind(this);
|
|
||||||
setTabStop(FALSE);
|
setTabStop(FALSE);
|
||||||
mVisibleSignal = NULL;
|
mVisibleSignal = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public:
|
|||||||
|
|
||||||
void setCtrlsEnabled(BOOL b);
|
void setCtrlsEnabled(BOOL b);
|
||||||
|
|
||||||
LLHandle<LLPanel> getHandle() const { return mPanelHandle; }
|
LLHandle<LLPanel> getHandle() const { return getDerivedHandle<LLPanel>(); }
|
||||||
|
|
||||||
const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
|
const LLCallbackMap::map_t& getFactoryMap() const { return mFactoryMap; }
|
||||||
|
|
||||||
@@ -246,7 +246,6 @@ private:
|
|||||||
LLViewBorder* mBorder;
|
LLViewBorder* mBorder;
|
||||||
LLButton* mDefaultBtn;
|
LLButton* mDefaultBtn;
|
||||||
std::string mLabel;
|
std::string mLabel;
|
||||||
LLRootHandle<LLPanel> mPanelHandle;
|
|
||||||
|
|
||||||
typedef std::map<std::string, std::string> ui_string_map_t;
|
typedef std::map<std::string, std::string> ui_string_map_t;
|
||||||
ui_string_map_t mUIStrings;
|
ui_string_map_t mUIStrings;
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ public:
|
|||||||
class LLView
|
class LLView
|
||||||
: public LLMouseHandler, // handles mouse events
|
: public LLMouseHandler, // handles mouse events
|
||||||
public LLFocusableElement, // handles keyboard events
|
public LLFocusableElement, // handles keyboard events
|
||||||
public LLMortician // lazy deletion
|
public LLMortician, // lazy deletion
|
||||||
//public LLHandleProvider<LLView> // passes out weak references to self
|
public LLHandleProvider<LLView> // passes out weak references to self
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Follows : public LLInitParam::ChoiceBlock<Follows>
|
struct Follows : public LLInitParam::ChoiceBlock<Follows>
|
||||||
@@ -344,8 +344,6 @@ public:
|
|||||||
void popVisible() { setVisible(mLastVisible); }
|
void popVisible() { setVisible(mLastVisible); }
|
||||||
BOOL getLastVisible() const { return mLastVisible; }
|
BOOL getLastVisible() const { return mLastVisible; }
|
||||||
|
|
||||||
LLHandle<LLView> getHandle() { mHandle.bind(this); return mHandle; }
|
|
||||||
|
|
||||||
U32 getFollows() const { return mReshapeFlags; }
|
U32 getFollows() const { return mReshapeFlags; }
|
||||||
BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; }
|
BOOL followsLeft() const { return mReshapeFlags & FOLLOWS_LEFT; }
|
||||||
BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; }
|
BOOL followsRight() const { return mReshapeFlags & FOLLOWS_RIGHT; }
|
||||||
@@ -678,7 +676,6 @@ private:
|
|||||||
BOOL mIsFocusRoot;
|
BOOL mIsFocusRoot;
|
||||||
BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
|
BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements
|
||||||
|
|
||||||
LLRootHandle<LLView> mHandle;
|
|
||||||
BOOL mLastVisible;
|
BOOL mLastVisible;
|
||||||
|
|
||||||
S32 mNextInsertionOrdinal;
|
S32 mNextInsertionOrdinal;
|
||||||
|
|||||||
@@ -971,7 +971,7 @@ void LLFastTimerView::draw()
|
|||||||
gGL.color4f(col[0], col[1], col[2], alpha);
|
gGL.color4f(col[0], col[1], col[2], alpha);
|
||||||
gGL.begin(LLRender::TRIANGLE_STRIP);
|
gGL.begin(LLRender::TRIANGLE_STRIP);
|
||||||
for (U32 j = llmax(0, LLFastTimer::NamedTimer::HISTORY_NUM - LLFastTimer::getLastFrameIndex());
|
for (U32 j = llmax(0, LLFastTimer::NamedTimer::HISTORY_NUM - LLFastTimer::getLastFrameIndex());
|
||||||
j < LLFastTimer::NamedTimer::HISTORY_NUM;
|
j < (U32)LLFastTimer::NamedTimer::HISTORY_NUM;
|
||||||
j++)
|
j++)
|
||||||
{
|
{
|
||||||
U64 ticks = idp->getHistoricalCount(j);
|
U64 ticks = idp->getHistoricalCount(j);
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory,
|
|||||||
mInvType(LLInventoryType::IT_NONE),
|
mInvType(LLInventoryType::IT_NONE),
|
||||||
mIsLink(FALSE)
|
mIsLink(FALSE)
|
||||||
{
|
{
|
||||||
mInventoryPanel = inventory->getHandle();
|
mInventoryPanel = inventory->getInventoryPanelHandle();
|
||||||
const LLInventoryObject* obj = getInventoryObject();
|
const LLInventoryObject* obj = getInventoryObject();
|
||||||
mIsLink = obj && obj->getIsLinkType();
|
mIsLink = obj && obj->getIsLinkType();
|
||||||
}
|
}
|
||||||
@@ -973,7 +973,7 @@ LLInventoryObject* LLInvFVBridge::getInventoryObject() const
|
|||||||
|
|
||||||
LLInventoryModel* LLInvFVBridge::getInventoryModel() const
|
LLInventoryModel* LLInvFVBridge::getInventoryModel() const
|
||||||
{
|
{
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
LLInventoryPanel* panel = mInventoryPanel.get();
|
||||||
return panel ? panel->getModel() : NULL;
|
return panel ? panel->getModel() : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1937,7 +1937,7 @@ BOOL LLFolderBridge::isItemRemovable() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
LLInventoryPanel* panel = mInventoryPanel.get();
|
||||||
LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
|
LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
|
||||||
if (folderp)
|
if (folderp)
|
||||||
{
|
{
|
||||||
@@ -3200,7 +3200,7 @@ void LLFolderBridge::buildContextMenuBaseOptions(U32 flags)
|
|||||||
// Not sure what the right thing is to do here.
|
// Not sure what the right thing is to do here.
|
||||||
if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
|
if (!isCOFFolder() && cat && (cat->getPreferredType() != LLFolderType::FT_OUTFIT))
|
||||||
{
|
{
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
LLInventoryPanel* panel = mInventoryPanel.get();
|
||||||
if(panel && !panel->getFilterWorn())
|
if(panel && !panel->getFilterWorn())
|
||||||
if (!isInboxFolder() && !isOutboxFolder()) // don't allow creation in inbox or outbox
|
if (!isInboxFolder() && !isOutboxFolder()) // don't allow creation in inbox or outbox
|
||||||
{
|
{
|
||||||
@@ -3481,7 +3481,7 @@ void LLFolderBridge::createNewCategory(void* user_data)
|
|||||||
{
|
{
|
||||||
LLFolderBridge* bridge = (LLFolderBridge*)user_data;
|
LLFolderBridge* bridge = (LLFolderBridge*)user_data;
|
||||||
if(!bridge) return;
|
if(!bridge) return;
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(bridge->mInventoryPanel.get());
|
LLInventoryPanel* panel = bridge->mInventoryPanel.get();
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
LLInventoryModel* model = panel->getModel();
|
LLInventoryModel* model = panel->getModel();
|
||||||
if(!model) return;
|
if(!model) return;
|
||||||
@@ -3675,7 +3675,7 @@ void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item)
|
|||||||
// use callback to rearrange favorite landmarks after adding
|
// use callback to rearrange favorite landmarks after adding
|
||||||
// to have new one placed before target (on which it was dropped). See EXT-4312.
|
// to have new one placed before target (on which it was dropped). See EXT-4312.
|
||||||
LLPointer<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback();
|
LLPointer<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback();
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
LLInventoryPanel* panel = mInventoryPanel.get();
|
||||||
LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
|
LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
|
||||||
if (drag_over_item && drag_over_item->getListener())
|
if (drag_over_item && drag_over_item->getListener())
|
||||||
{
|
{
|
||||||
@@ -3724,6 +3724,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
|||||||
if(!isAgentInventory()) return FALSE; // cannot drag into library
|
if(!isAgentInventory()) return FALSE; // cannot drag into library
|
||||||
if (!isAgentAvatarValid()) return FALSE;
|
if (!isAgentAvatarValid()) return FALSE;
|
||||||
|
|
||||||
|
LLInventoryPanel* destination_panel = mInventoryPanel.get();
|
||||||
|
if (!destination_panel) return false;
|
||||||
|
|
||||||
const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
|
const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
|
||||||
const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
|
const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
|
||||||
const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
|
const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
|
||||||
@@ -3855,6 +3858,15 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
|
||||||
|
|
||||||
|
// Check whether the item being dragged from active inventory panel
|
||||||
|
if (accept && active_panel)
|
||||||
|
{
|
||||||
|
LLFolderView* active_folder_view = active_panel->getRootFolder();
|
||||||
|
if (!active_folder_view) return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(accept && drop)
|
if(accept && drop)
|
||||||
{
|
{
|
||||||
if (inv_item->getType() == LLAssetType::AT_GESTURE
|
if (inv_item->getType() == LLAssetType::AT_GESTURE
|
||||||
@@ -3864,14 +3876,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
|||||||
}
|
}
|
||||||
// If an item is being dragged between windows, unselect everything in the active window
|
// If an item is being dragged between windows, unselect everything in the active window
|
||||||
// so that we don't follow the selection to its new location (which is very annoying).
|
// so that we don't follow the selection to its new location (which is very annoying).
|
||||||
LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
|
if (active_panel && (destination_panel != active_panel))
|
||||||
if (active_panel)
|
|
||||||
{
|
{
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
|
||||||
if (active_panel && (panel != active_panel))
|
|
||||||
{
|
|
||||||
active_panel->unSelectAll();
|
active_panel->unSelectAll();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FAVORITES folder
|
// FAVORITES folder
|
||||||
@@ -4034,6 +4041,15 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
|
|||||||
accept = can_move_to_landmarks(inv_item);
|
accept = can_move_to_landmarks(inv_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel(FALSE);
|
||||||
|
|
||||||
|
// Check whether the item being dragged from the library
|
||||||
|
if (accept && active_panel)
|
||||||
|
{
|
||||||
|
LLFolderView* active_folder_view = active_panel->getRootFolder();
|
||||||
|
if (!active_folder_view) return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (accept && drop)
|
if (accept && drop)
|
||||||
{
|
{
|
||||||
// FAVORITES folder
|
// FAVORITES folder
|
||||||
@@ -4436,7 +4452,7 @@ LLCallingCardBridge::~LLCallingCardBridge()
|
|||||||
|
|
||||||
void LLCallingCardBridge::refreshFolderViewItem()
|
void LLCallingCardBridge::refreshFolderViewItem()
|
||||||
{
|
{
|
||||||
LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
|
LLInventoryPanel* panel = mInventoryPanel.get();
|
||||||
LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL;
|
LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL;
|
||||||
if (itemp)
|
if (itemp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ protected:
|
|||||||
BOOL restamp);
|
BOOL restamp);
|
||||||
void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
|
void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
|
||||||
protected:
|
protected:
|
||||||
LLHandle<LLPanel> mInventoryPanel;
|
LLHandle<LLInventoryPanel> mInventoryPanel;
|
||||||
LLFolderView* mRoot;
|
LLFolderView* mRoot;
|
||||||
const LLUUID mUUID; // item id
|
const LLUUID mUUID; // item id
|
||||||
LLInventoryType::EType mInvType;
|
LLInventoryType::EType mInvType;
|
||||||
|
|||||||
@@ -129,6 +129,8 @@ public:
|
|||||||
LLScrollableContainerView* getScrollableContainer() { return mScroller; }
|
LLScrollableContainerView* getScrollableContainer() { return mScroller; }
|
||||||
|
|
||||||
void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
|
void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
|
||||||
|
|
||||||
|
LLHandle<LLInventoryPanel> getInventoryPanelHandle() const { return getDerivedHandle<LLInventoryPanel>(); }
|
||||||
// DEBUG ONLY:
|
// DEBUG ONLY:
|
||||||
static void dumpSelectionInformation(void* user_data);
|
static void dumpSelectionInformation(void* user_data);
|
||||||
|
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ LLPanelMediaHUD::LLPanelMediaHUD(viewer_media_t media_impl)
|
|||||||
mFadeTimer.stop();
|
mFadeTimer.stop();
|
||||||
mCurrentZoom = ZOOM_NONE;
|
mCurrentZoom = ZOOM_NONE;
|
||||||
mScrollState = SCROLL_NONE;
|
mScrollState = SCROLL_NONE;
|
||||||
|
|
||||||
mPanelHandle.bind(this);
|
|
||||||
}
|
}
|
||||||
LLPanelMediaHUD::~LLPanelMediaHUD()
|
LLPanelMediaHUD::~LLPanelMediaHUD()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ public:
|
|||||||
void nextZoomLevel();
|
void nextZoomLevel();
|
||||||
void resetZoomLevel() { mCurrentZoom = ZOOM_NONE; }
|
void resetZoomLevel() { mCurrentZoom = ZOOM_NONE; }
|
||||||
|
|
||||||
LLHandle<LLPanelMediaHUD> getHandle() const { return mPanelHandle; }
|
LLHandle<LLPanelMediaHUD> getHandle() const { return getDerivedHandle<LLPanelMediaHUD>(); }
|
||||||
|
|
||||||
void setMediaImpl(viewer_media_t media_impl) { mMediaImpl = media_impl; }
|
void setMediaImpl(viewer_media_t media_impl) { mMediaImpl = media_impl; }
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +106,6 @@ private:
|
|||||||
F32 mMouseInactiveTime;
|
F32 mMouseInactiveTime;
|
||||||
F32 mControlFadeTime;
|
F32 mControlFadeTime;
|
||||||
viewer_media_t mMediaImpl;
|
viewer_media_t mMediaImpl;
|
||||||
LLRootHandle<LLPanelMediaHUD> mPanelHandle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_PANELMEDIAHUD_H
|
#endif // LL_PANELMEDIAHUD_H
|
||||||
|
|||||||
Reference in New Issue
Block a user