From 0ecbbe9571be298284c2410ea441877b611bd875 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 15 Apr 2013 11:16:57 -0700 Subject: CHUI-912 : WIP : Try to change the return value of filter() so to trigger arrange on the fly. --- indra/llui/llfolderview.cpp | 13 ++++++++++++- indra/llui/llfolderviewitem.h | 1 - indra/newview/llfolderviewmodelinventory.cpp | 27 ++++++++++++--------------- indra/newview/llinventoryfilter.cpp | 4 ---- indra/newview/llpanelobjectinventory.cpp | 1 + 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 5bca589bc4..3ca549ae72 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -327,7 +327,13 @@ void LLFolderView::filter( LLFolderViewFilter& filter ) LLFastTimer t2(FTM_FILTER); filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); - getViewModelItem()->filter(filter); + bool filtered_items = getViewModelItem()->filter(filter); + //if (getViewModelItem()->descendantsPassedFilter(filter.getCurrentGeneration())) + if (filtered_items) + { + llinfos << "Merov : LLFolderView::filter, request arrange, new elements passed the filter" << llendl; + requestArrange(); + } } void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -1665,9 +1671,14 @@ void LLFolderView::update() { S32 height = 0; S32 width = 0; + llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", is been arranged, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; S32 total_height = arrange( &width, &height ); notifyParent(LLSD().with("action", "size_changes").with("height", total_height)); } + else + { + llinfos << "Merov : LLFolderView::update: parent = " << mParentPanel->getName() << ", doesn't need arranging, last arrange = " << mLastArrangeGeneration << ", root arrange = " << getRoot()->getArrangeGeneration() << llendl; + } } // during filtering process, try to pin selected item's location on screen diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index ca31931e19..a9b0201236 100755 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -316,7 +316,6 @@ protected: F32 mAutoOpenCountdown; S32 mLastArrangeGeneration; S32 mLastCalculatedWidth; - S32 mMostFilteredDescendantGeneration; bool mNeedsSort; public: diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 5ad94bfaba..49b72485e0 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -71,7 +71,7 @@ bool LLFolderViewModelInventory::startDrag(std::vector& void LLFolderViewModelInventory::sort( LLFolderViewFolder* folder ) { LLFastTimer _(FTM_INVENTORY_SORT); - llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << llendl; + llinfos << "Merov : LLFolderViewModelInventory::sort of instance = " << mModelInstance << ", folder = " << folder->getName() << llendl; if (!needsSort(folder->getViewModelItem())) return; @@ -155,11 +155,12 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite { S32 filter_generation = filter.getCurrentGeneration(); - bool continue_filtering = true; +// bool continue_filtering = true; + bool new_filtered_item = false; if (item->getLastFilterGeneration() < filter_generation) { // recursive application of the filter for child items - continue_filtering = item->filter( filter ); + new_filtered_item = item->filter( filter ); } // track latest generation to pass any child items, for each folder up to root @@ -174,7 +175,7 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite } } - return continue_filtering; + return new_filtered_item; } bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) @@ -186,10 +187,6 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) { llinfos << "Merov : LLFolderViewModelItemInventory::filter : special NOUNOURS case, filter count = " << filter.getFilterCount() << ", must pass = " << must_pass_generation << ", current = " << filter_generation << ", item last = " << getLastFilterGeneration() << ", folder last = " << getLastFolderFilterGeneration() << llendl; } - else - { - llinfos << "Merov : LLFolderViewModelItemInventory::filter : filter count = " << filter.getFilterCount() << llendl; - } if (getLastFilterGeneration() >= must_pass_generation && getLastFolderFilterGeneration() >= must_pass_generation @@ -199,12 +196,14 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) // go ahead and flag this item as done setPassedFilter(false, filter_generation); setPassedFolderFilter(false, filter_generation); - return true; + return false; } const bool passed_filter_folder = (getInventoryType() == LLInventoryType::IT_CATEGORY) ? filter.checkFolder(this) : true; setPassedFolderFilter(passed_filter_folder, filter_generation); + bool new_filtered_item = false; + 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 @@ -214,7 +213,8 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) iter != end_iter && filter.getFilterCount() > 0; ++iter) { - if (!filterChildItem((*iter), filter)) + new_filtered_item |= filterChildItem((*iter), filter); + if (filter.getFilterCount() <= 0) { break; } @@ -230,12 +230,9 @@ bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) const bool passed_filter = filter.check(this); setPassedFilter(passed_filter, filter_generation, filter.getStringMatchOffset(this), filter.getFilterStringSize()); - return true; - } - else - { - return false; + new_filtered_item |= passed_filter; } + return new_filtered_item; } LLFolderViewModelInventory* LLInventoryPanel::getFolderViewModel() diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index eef0adda52..d3f5d68708 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -104,10 +104,6 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) { llinfos << "Merov : LLInventoryFilter::check : Here we go with our special NOUNOURS case, checked for string '" << mFilterSubString << "', passed = " << passed << ", name = " << listener->getSearchableName() << llendl; } - else - { - llinfos << "Merov : LLInventoryFilter::check : checked for string '" << mFilterSubString << "', passed = " << passed << ", name = " << listener->getSearchableName() << llendl; - } return passed; } diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 7555ac7b2c..4d8fa07336 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1492,6 +1492,7 @@ LLPanelObjectInventory::LLPanelObjectInventory(const LLPanelObjectInventory::Par mIsInventoryEmpty(TRUE), mInventoryNeedsUpdate(FALSE) { + llinfos << "Merov : LLPanelObjectInventory::LLPanelObjectInventory, name = " << getName() << ", label = " << getLabel() << llendl; // Setup context menu callbacks mCommitCallbackRegistrar.add("Inventory.DoToSelected", boost::bind(&LLPanelObjectInventory::doToSelected, this, _2)); mCommitCallbackRegistrar.add("Inventory.EmptyTrash", boost::bind(&LLInventoryModel::emptyFolderType, &gInventory, "ConfirmEmptyTrash", LLFolderType::FT_TRASH)); -- cgit v1.2.3