summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-08-03 15:23:08 -0700
committerRichard Linden <none@none>2012-08-03 15:23:08 -0700
commitaf8d113557105075af0e010c560ba9846d812aa0 (patch)
treeeb7c9a3ff37965a97a9b1f2b970d31435c192df6 /indra
parentc43eedd43471fcbbbda91cc5f30674ba2485659a (diff)
CHUI-271 FIX Items that are cut and then removed from the clipboard without paste do not show in Trash until relog
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llfolderviewitem.h96
-rw-r--r--indra/llui/llfolderviewmodel.cpp15
-rw-r--r--indra/llui/llfolderviewmodel.h6
-rw-r--r--indra/newview/llinventorypanel.cpp34
4 files changed, 80 insertions, 71 deletions
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index e75059bc01..6eacbe8bd0 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -46,9 +46,6 @@ class LLFolderViewModelInterface;
class LLFolderViewItem : public LLView
{
public:
- static void initClass();
- static void cleanupClass();
-
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
Optional<LLUIImage*> folder_arrow_image,
@@ -67,20 +64,17 @@ public:
};
// layout constants
- static const S32 LEFT_PAD = 5;
- // LEFT_INDENTATION is set via folder_indentation above
- static const S32 ICON_PAD = 2;
- static const S32 ICON_WIDTH = 16;
- static const S32 TEXT_PAD = 1;
- static const S32 TEXT_PAD_RIGHT = 4;
- static const S32 ARROW_SIZE = 12;
- static const S32 MAX_FOLDER_ITEM_OVERLAP = 2;
+ static const S32 LEFT_PAD = 5,
+ ICON_PAD = 2,
+ ICON_WIDTH = 16,
+ TEXT_PAD = 1,
+ TEXT_PAD_RIGHT = 4,
+ ARROW_SIZE = 12,
+ MAX_FOLDER_ITEM_OVERLAP = 2;
+
// animation parameters
- static const F32 FOLDER_CLOSE_TIME_CONSTANT;
- static const F32 FOLDER_OPEN_TIME_CONSTANT;
-
-private:
- BOOL mIsSelected;
+ static const F32 FOLDER_CLOSE_TIME_CONSTANT,
+ FOLDER_OPEN_TIME_CONSTANT;
protected:
friend class LLUICtrlFactory;
@@ -95,9 +89,9 @@ protected:
LLFolderViewModelItem* mViewModelItem;
LLFontGL::StyleFlags mLabelStyle;
std::string mLabelSuffix;
- LLUIImagePtr mIcon;
- LLUIImagePtr mIconOpen;
- LLUIImagePtr mIconOverlay;
+ LLUIImagePtr mIcon,
+ mIconOpen,
+ mIconOverlay;
S32 mIndentation;
S32 mItemHeight;
S32 mDragStartX,
@@ -105,12 +99,12 @@ protected:
F32 mControlLabelRotation;
LLFolderView* mRoot;
- bool mHasVisibleChildren;
- bool mIsCurSelection;
- bool mDragAndDropTarget;
- bool mIsMouseOverTitle;
- bool mAllowOpen;
- bool mSelectPending;
+ bool mHasVisibleChildren,
+ mIsCurSelection,
+ mDragAndDropTarget,
+ mIsMouseOverTitle,
+ mAllowOpen,
+ mSelectPending;
// this is an internal method used for adding items to folders. A
// no-op at this level, but reimplemented in derived classes.
@@ -119,7 +113,13 @@ protected:
static LLFontGL* getLabelFontForStyle(U8 style);
+private:
+ BOOL mIsSelected;
+
public:
+ static void initClass();
+ static void cleanupClass();
+
BOOL postBuild();
virtual void openItem( void );
@@ -191,7 +191,6 @@ public:
// contents possible before the entire view has been constructed.
const std::string& getLabel() const { return mLabel; }
-
LLFolderViewFolder* getParentFolder( void ) { return mParentFolder; }
const LLFolderViewFolder* getParentFolder( void ) const { return mParentFolder; }
@@ -209,8 +208,7 @@ public:
// just rename the object.
void rename(const std::string& new_name);
-
- // Show children (unfortunate that this is called "open")
+ // Show children
virtual void setOpen(BOOL open = TRUE) {};
virtual BOOL isOpen() const { return FALSE; }
@@ -238,10 +236,10 @@ public:
// virtual void handleDropped();
virtual void draw();
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
@@ -262,7 +260,6 @@ protected:
friend class LLUICtrlFactory;
public:
-
typedef std::list<LLFolderViewItem*> items_t;
typedef std::list<LLFolderViewFolder*> folders_t;
@@ -330,12 +327,6 @@ public:
// destroys this folder, and all children
virtual void destroyView();
- // If this folder can be removed, remove all children that can be
- // removed, return TRUE if this is empty after the operation and
- // it's viewed folder object can be removed.
- //virtual BOOL removeRecursively(BOOL single_item);
- //virtual BOOL remove();
-
// extractItem() removes the specified item from the folder, but
// doesn't delete it.
virtual void extractItem( LLFolderViewItem* item );
@@ -366,16 +357,17 @@ public:
// special case if an object is dropped on the child.
BOOL handleDragAndDropFromChild(MASK mask,
- BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
+ BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
- void applyFunctorRecursively(LLFolderViewFunctor& functor);
// Just apply this functor to the folder's immediate children.
void applyFunctorToChildren(LLFolderViewFunctor& functor);
+ // apply this functor to the folder's descendants.
+ void applyFunctorRecursively(LLFolderViewFunctor& functor);
virtual void openItem( void );
@@ -384,12 +376,14 @@ public:
virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
- virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
- EDragAndDropType cargo_type,
- void* cargo_data,
- EAcceptance* accept,
- std::string& tooltip_msg);
- BOOL handleDragAndDropToThisFolder(MASK mask, BOOL drop,
+ virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
+ BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data,
+ EAcceptance* accept,
+ std::string& tooltip_msg);
+ BOOL handleDragAndDropToThisFolder(MASK mask,
+ BOOL drop,
EDragAndDropType cargo_type,
void* cargo_data,
EAcceptance* accept,
diff --git a/indra/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp
index 6aa4a63edc..3593804554 100644
--- a/indra/llui/llfolderviewmodel.cpp
+++ b/indra/llui/llfolderviewmodel.cpp
@@ -51,3 +51,18 @@ void LLFolderViewModelCommon::filter()
getFilter().setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000));
mFolderView->getViewModelItem()->filter(getFilter());
}
+
+bool LLFolderViewModelItemCommon::hasFilterStringMatch()
+{
+ return mStringMatchOffsetFilter != std::string::npos;
+}
+
+std::string::size_type LLFolderViewModelItemCommon::getFilterStringOffset()
+{
+ return mStringMatchOffsetFilter;
+}
+
+std::string::size_type LLFolderViewModelItemCommon::getFilterStringSize()
+{
+ return mRootViewModel.getFilter().getFilterStringSize();
+}
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 9908e538a4..41660c6e1e 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -245,9 +245,9 @@ public:
mParent->dirtyFilter();
}
}
- bool hasFilterStringMatch() { return mStringMatchOffsetFilter != std::string::npos; }
- std::string::size_type getFilterStringOffset() { return mStringMatchOffsetFilter; }
- std::string::size_type getFilterStringSize() { return mStringFilterSize; }
+ bool hasFilterStringMatch();
+ std::string::size_type getFilterStringOffset();
+ std::string::size_type getFilterStringSize();
virtual void addChild(LLFolderViewModelItem* child)
{
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d6a685541f..49bc3aae0b 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -600,6 +600,18 @@ void LLInventoryPanel::onIdle(void *userdata)
}
}
+struct DirtyFilterFunctor : public LLFolderViewFunctor
+{
+ /*virtual*/ void doFolder(LLFolderViewFolder* folder)
+ {
+ folder->getViewModelItem()->dirtyFilter();
+ }
+ /*virtual*/ void doItem(LLFolderViewItem* item)
+ {
+ item->getViewModelItem()->dirtyFilter();
+ }
+};
+
void LLInventoryPanel::idle(void* user_data)
{
LLInventoryPanel* panel = (LLInventoryPanel*)user_data;
@@ -607,25 +619,13 @@ void LLInventoryPanel::idle(void* user_data)
if (panel->mClipboardState != LLClipboard::instance().getGeneration())
{
panel->mClipboardState = LLClipboard::instance().getGeneration();
- if (LLClipboard::instance().isCutMode())
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLFolderViewFolder* trash_folder = panel->getFolderByID(trash_id);
+ if (trash_folder)
{
- LLDynamicArray<LLUUID> objects;
- LLClipboard::instance().pasteFromClipboard(objects);
-
- for (LLDynamicArray<LLUUID>::iterator it = objects.begin(), end_it = objects.end();
- it != end_it;
- ++it)
- {
- LLFolderViewItem* item = panel->getItemByID(*it);
- if (item)
- {
- item->getViewModelItem()->dirtyFilter();
- }
- }
- /*panel->getFilter().setModified(LLClipboard::instance().isCutMode()
- ? LLInventoryFilter::FILTER_MORE_RESTRICTIVE
- : LLInventoryFilter::FILTER_LESS_RESTRICTIVE);*/
+ trash_folder->applyFunctorToChildren(DirtyFilterFunctor());
}
+
}
panel->mFolderRoot->update();