diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.cpp | 74 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.h | 4 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelobjectinventory.cpp | 2 |
4 files changed, 39 insertions, 43 deletions
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(); |