summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-07-25 18:20:54 -0700
committerRichard Linden <none@none>2012-07-25 18:20:54 -0700
commitf6dfd6bf0f3ea0e9b5f56a939867353c393539d6 (patch)
treef984a81438ce719beca9318fdc8e7a2fafe7cb48
parentc4f59fd5882d8b019830292e9e5ed1d2480f73ef (diff)
CHUI-222 FIX Selecting None in inventory filters does not update until inventory selected
-rw-r--r--indra/llui/llfolderview.cpp2
-rw-r--r--indra/llui/llfolderviewitem.cpp11
-rw-r--r--indra/llui/llfolderviewmodel.h4
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp74
-rw-r--r--indra/newview/llfolderviewmodelinventory.h4
-rw-r--r--indra/newview/llimfloatercontainer.h2
-rw-r--r--indra/newview/llpanelobjectinventory.cpp2
7 files changed, 49 insertions, 50 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 10729a3eae..147af04f30 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -266,8 +266,6 @@ LLFolderView::~LLFolderView( void )
mItems.clear();
mFolders.clear();
- //product engine bugfix, prevent deletion of non-heap data
- //delete mViewModel;
mViewModel = NULL;
}
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 741fc9c324..a356d587f9 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -1543,11 +1543,14 @@ BOOL LLFolderViewFolder::addFolder(LLFolderViewFolder* folder)
void LLFolderViewFolder::requestArrange()
{
- mLastArrangeGeneration = -1;
- // flag all items up to root
- if (mParentFolder)
+ //if ( mLastArrangeGeneration != -1)
{
- mParentFolder->requestArrange();
+ mLastArrangeGeneration = -1;
+ // flag all items up to root
+ if (mParentFolder)
+ {
+ mParentFolder->requestArrange();
+ }
}
}
diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h
index 268ae8eea8..acdec53602 100644
--- a/indra/llui/llfolderviewmodel.h
+++ b/indra/llui/llfolderviewmodel.h
@@ -152,7 +152,7 @@ public:
virtual bool potentiallyVisible() = 0; // is the item definitely visible or we haven't made up our minds yet?
- virtual bool filter( LLFolderViewFilter& filter) = 0;
+ virtual void filter( LLFolderViewFilter& filter) = 0;
virtual bool passedFilter(S32 filter_generation = -1) = 0;
virtual bool descendantsPassedFilter(S32 filter_generation = -1) = 0;
virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) = 0;
@@ -192,6 +192,7 @@ public:
: mSortVersion(-1),
mPassedFilter(true),
mPassedFolderFilter(true),
+ mPrevPassedAllFilters(false),
mFolderViewItem(NULL),
mLastFilterGeneration(-1),
mMostFilteredDescendantGeneration(-1),
@@ -232,6 +233,7 @@ protected:
S32 mSortVersion;
bool mPassedFilter;
bool mPassedFolderFilter;
+ bool mPrevPassedAllFilters;
S32 mLastFilterGeneration;
S32 mMostFilteredDescendantGeneration;
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index e8135496d5..13ca73917b 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -133,8 +133,9 @@ bool LLFolderViewModelItemInventory::passedFilter(S32 filter_generation)
filter_generation = mRootViewModel.getFilter()->getFirstSuccessGeneration();
return mPassedFolderFilter
- && mLastFilterGeneration >= filter_generation
- && (mPassedFilter || descendantsPassedFilter(filter_generation));
+ && (descendantsPassedFilter(filter_generation)
+ || (mLastFilterGeneration >= filter_generation
+ && mPassedFilter));
}
bool LLFolderViewModelItemInventory::descendantsPassedFilter(S32 filter_generation)
@@ -148,30 +149,29 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo
mPassedFilter = passed;
mPassedFolderFilter = passed_folder;
mLastFilterGeneration = filter_generation;
+
+ bool passed_filter_before = mPrevPassedAllFilters;
+ mPrevPassedAllFilters = passedFilter(filter_generation);
+
+ if (passed_filter_before != mPrevPassedAllFilters)
+ {
+ //TODO RN: ensure this still happens, but without dependency on folderview
+ LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder();
+ if (parent_folder)
+ {
+ parent_folder->requestArrange();
+ }
+ }
}
-bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
+void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter )
{
- bool passed_filter_before = item->passedFilter();
S32 filter_generation = filter.getCurrentGeneration();
- S32 must_pass_generation = filter.getFirstRequiredGeneration();
if (item->getLastFilterGeneration() < filter_generation)
{
// recursive application of the filter for child items
item->filter( filter );
-
- if (item->getLastFilterGeneration() >= must_pass_generation
- && !item->passedFilter(must_pass_generation))
- {
- // failed to pass an earlier filter that was a subset of the current one
- // go ahead and flag this item as done
- if (item->passedFilter())
- {
- llerrs << "Invalid shortcut in inventory filtering!" << llendl;
- }
- item->setPassedFilter(false, false, filter_generation);
- }
}
// track latest generation to pass any child items, for each folder up to root
@@ -184,39 +184,36 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite
view_model->mMostFilteredDescendantGeneration = filter_generation;
view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent);
}
-
- return !passed_filter_before;
- }
- else // !item->passedfilter()
- {
- return passed_filter_before;
}
}
-bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
+void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
{
- bool changed = false;
+ const S32 filter_generation = filter.getCurrentGeneration();
+ const S32 must_pass_generation = filter.getFirstRequiredGeneration();
+
+ if (getLastFilterGeneration() >= must_pass_generation
+ && !passedFilter(must_pass_generation))
+ {
+ // failed to pass an earlier filter that was a subset of the current one
+ // go ahead and flag this item as done
+ setPassedFilter(false, false, filter_generation);
+ return;
+ }
if(!mChildren.empty()
- && (getLastFilterGeneration() < filter.getFirstRequiredGeneration() // haven't checked descendants against minimum required generation to pass
- || descendantsPassedFilter(filter.getFirstRequiredGeneration()))) // or at least one descendant has passed the minimum requirement
+ && (getLastFilterGeneration() < must_pass_generation // haven't checked descendants against minimum required generation to pass
+ || descendantsPassedFilter(must_pass_generation))) // or at least one descendant has passed the minimum requirement
{
// now query children
- for (child_list_t::iterator iter = mChildren.begin();
- iter != mChildren.end() && filter.getFilterCount() > 0;
+ for (child_list_t::iterator iter = mChildren.begin(), end_iter = mChildren.end();
+ iter != end_iter && filter.getFilterCount() > 0;
++iter)
{
- changed |= filterChildItem((*iter), filter);
+ filterChildItem((*iter), filter);
}
}
- if (changed)
- {
- //TODO RN: ensure this still happens, but without dependency on folderview
- LLFolderViewFolder* folder = static_cast<LLFolderViewFolder*>(mFolderViewItem);
- folder->requestArrange();
- }
-
// if we didn't use all filter iterations
// that means we filtered all of our descendants
// so filter ourselves now
@@ -229,11 +226,10 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter)
? filter.checkFolder(this)
: true;
- setPassedFilter(passed_filter, passed_filter_folder, filter.getCurrentGeneration());
+ setPassedFilter(passed_filter, passed_filter_folder, filter_generation);
//TODO RN: create interface for string highlighting
//mStringMatchOffset = filter.getStringMatchOffset(this);
}
- return changed;
}
LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel()
diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h
index eb2a4bfdec..ab67c93897 100644
--- a/indra/newview/llfolderviewmodelinventory.h
+++ b/indra/newview/llfolderviewmodelinventory.h
@@ -59,8 +59,8 @@ public:
virtual bool passedFilter(S32 filter_generation = -1);
virtual bool descendantsPassedFilter(S32 filter_generation = -1);
virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation);
- virtual bool filter( LLFolderViewFilter& filter);
- virtual bool filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
+ virtual void filter( LLFolderViewFilter& filter);
+ virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter);
virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const = 0;
virtual LLToolDragAndDrop::ESource getDragSource() const = 0;
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index a25ea0ab46..7005ab7b6a 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -89,7 +89,7 @@ public:
virtual bool hasChildren() const { return FALSE; }
virtual bool potentiallyVisible() { return true; }
- virtual bool filter( LLFolderViewFilter& filter) { return true; }
+ virtual void filter( LLFolderViewFilter& filter) { }
virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; }
virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation) { }
virtual bool passedFilter(S32 filter_generation = -1) { return true; }
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 9bd716e900..4719191231 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -1616,7 +1616,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
iter != inventory->end(); )
{
LLInventoryObject* item = *iter++;
- LLFloaterProperties* floater = LLFloaterReg::findTypedInstance<LLFloaterProperties>("properites", item->getUUID());
+ LLFloaterProperties* floater = LLFloaterReg::findTypedInstance<LLFloaterProperties>("properties", item->getUUID());
if(floater)
{
floater->refresh();