diff options
author | Richard Linden <none@none> | 2012-08-01 19:42:22 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-08-01 19:42:22 -0700 |
commit | c009cf4f7656ec27347e1e9c740da26c12726c99 (patch) | |
tree | 1913ea58d2409160cb11adef01fe390a4c8a763d /indra/newview | |
parent | 898ec6cd362cd92ceef8dca8faf3fb8ed119b1be (diff) |
CHUI-223 WIP Selecting to cut an inventory item causes all open inventory windows to refresh
improved filtering behavior that should result in less flashes of emptiness
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.cpp | 42 | ||||
-rw-r--r-- | indra/newview/llfolderviewmodelinventory.h | 6 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 4 |
3 files changed, 33 insertions, 19 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index e2376b18d5..8a4b4bae84 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -125,9 +125,9 @@ void LLFolderViewModelItemInventory::requestSort() } } -void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) +void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { - LLFolderViewModelItemCommon::setPassedFilter(passed, passed_folder, filter_generation, string_offset, string_size); + LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); bool passed_filter_before = mPrevPassedAllFilters; mPrevPassedAllFilters = passedFilter(filter_generation); @@ -143,14 +143,15 @@ void LLFolderViewModelItemInventory::setPassedFilter(bool passed, bool passed_fo } } -void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) +bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter ) { S32 filter_generation = filter.getCurrentGeneration(); + bool continue_filtering = true; if (item->getLastFilterGeneration() < filter_generation) { // recursive application of the filter for child items - item->filter( filter ); + continue_filtering = item->filter( filter ); } // track latest generation to pass any child items, for each folder up to root @@ -164,22 +165,31 @@ void LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite view_model = static_cast<LLFolderViewModelItemInventory*>(view_model->mParent); } } + + return continue_filtering; } -void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { const S32 filter_generation = filter.getCurrentGeneration(); const S32 must_pass_generation = filter.getFirstRequiredGeneration(); if (getLastFilterGeneration() >= must_pass_generation + && getLastFolderFilterGeneration() >= 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; + setPassedFilter(false, filter_generation); + setPassedFolderFilter(false, filter_generation); + return true; } + const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) + ? filter.checkFolder(this) + : true; + setPassedFolderFilter(passed_filter_folder, filter_generation); + if(!mChildren.empty() && (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 @@ -189,7 +199,10 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != end_iter && filter.getFilterCount() > 0; ++iter) { - filterChildItem((*iter), filter); + if (!filterChildItem((*iter), filter)) + { + break; + } } } @@ -200,12 +213,13 @@ void LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { filter.decrementFilterCount(); - const BOOL passed_filter = filter.check(this); - const BOOL passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) - ? filter.checkFolder(this) - : true; - - setPassedFilter(passed_filter, passed_filter_folder, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); + const bool passed_filter = filter.check(this); + setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); + return true; + } + else + { + return false; } } diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h index 664addf336..890d03d1c9 100644 --- a/indra/newview/llfolderviewmodelinventory.h +++ b/indra/newview/llfolderviewmodelinventory.h @@ -53,9 +53,9 @@ public: virtual EInventorySortGroup getSortGroup() const = 0; virtual LLInventoryObject* getInventoryObject() const = 0; virtual void requestSort(); - virtual void setPassedFilter(bool filtered, bool filtered_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); - virtual void filter( LLFolderViewFilter& filter); - virtual void filterChildItem( LLFolderViewModelItem* item, LLFolderViewFilter& filter); + virtual void setPassedFilter(bool filtered, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0); + virtual bool filter( LLFolderViewFilter& filter); + virtual bool 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 b352e8a004..5154b02dd6 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -89,9 +89,9 @@ public: virtual bool hasChildren() const { return FALSE; } virtual bool potentiallyVisible() { return true; } - virtual void filter( LLFolderViewFilter& filter) { } + virtual bool filter( LLFolderViewFilter& filter) { return false; } virtual bool descendantsPassedFilter(S32 filter_generation = -1) { return true; } - virtual void setPassedFilter(bool passed, bool passed_folder, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { } + virtual void setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset = std::string::npos, std::string::size_type string_size = 0) { } virtual bool passedFilter(S32 filter_generation = -1) { return true; } // The action callbacks |