diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfolderview.cpp | 26 | ||||
-rwxr-xr-x | indra/llui/llfolderviewitem.cpp | 30 | ||||
-rwxr-xr-x | indra/llui/llfolderviewitem.h | 1 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llfolderviewmodel.h | 31 |
5 files changed, 50 insertions, 40 deletions
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 8feaf654f0..bf4d5ae1f9 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -323,9 +323,11 @@ static LLFastTimer::DeclareTimer FTM_FILTER("Filter Folder View"); void LLFolderView::filter( LLFolderViewFilter& filter ) { + // Entry point of inventory filtering (CHUI-849) LLFastTimer t2(FTM_FILTER); - filter.setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + filter.resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32(mParentPanel->getVisible() ? "FilterItemsMaxTimePerFrameVisible" : "FilterItemsMaxTimePerFrameUnvisible"), 1, 100)); + // Note: we filter the model, not the view getViewModelItem()->filter(filter); } @@ -661,7 +663,7 @@ void LLFolderView::draw() // get preferable text height... S32 pixel_height = mStatusTextBox->getTextPixelHeight(); - bool height_changed = local_rect.getHeight() != pixel_height; + bool height_changed = (local_rect.getHeight() < pixel_height); if (height_changed) { // ... if it does not match current height, lets rearrange current view. @@ -1607,15 +1609,17 @@ void LLFolderView::update() { mNeedsAutoSelect = TRUE; } - // filter to determine visibility before arranging + + // Filter to determine visibility before arranging filter(getFolderViewModel()->getFilter()); - // Clear the modified setting on the filter only if the filter count is non-zero after running the filter process - // Note: if the filter count is zero, then the filter most likely halted before completing the entire set of items - if (getFolderViewModel()->getFilter().isModified() && (getFolderViewModel()->getFilter().getFilterCount() > 0)) + + // Clear the modified setting on the filter only if the filter finished after running the filter process + // Note: if the filter count has timed out, that means the filter halted before completing the entire set of items + if (getFolderViewModel()->getFilter().isModified() && (!getFolderViewModel()->getFilter().isTimedOut())) { getFolderViewModel()->getFilter().clearModified(); } - + // automatically show matching items, and select first one if we had a selection if (mNeedsAutoSelect) { @@ -1655,11 +1659,13 @@ void LLFolderView::update() BOOL is_visible = isInVisibleChain(); - //Puts folders/items in proper positions - if ( is_visible ) + // Puts folders/items in proper positions + // arrange() takes the model filter flag into account and call sort() if necessary (CHUI-849) + // It also handles the open/close folder animation + if (is_visible) { sanitizeSelection(); - if( needsArrange() ) + if (needsArrange()) { S32 height = 0; S32 width = 0; diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index fdb4108afb..6c147ccc12 100755 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -274,6 +274,7 @@ void LLFolderViewItem::refresh() } mLabelWidthDirty = true; + // Dirty the filter flag of the model from the view (CHUI-849) vmi.dirtyFilter(); } @@ -943,11 +944,17 @@ void LLFolderViewFolder::addToFolder(LLFolderViewFolder* folder) static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange"); -// Finds width and height of this object and its children. Also -// makes sure that this view and its children are the right size. +// Make everything right and in the right place ready for drawing (CHUI-849) +// * Sort everything correctly if necessary +// * Turn widgets visible/invisible according to their model filtering state +// * Takes animation state into account for opening/closing of folders (this makes widgets visible/invisible) +// * Reposition visible widgets so that they line up correctly with no gap +// * Compute the width and height of the current folder and its children +// * Makes sure that this view and its children are the right size S32 LLFolderViewFolder::arrange( S32* width, S32* height ) { - // sort before laying out contents + // Sort before laying out contents + // Note that we sort from the root (CHUI-849) getRoot()->getFolderViewModel()->sort(this); LLFastTimer t2(FTM_ARRANGE); @@ -1613,16 +1620,13 @@ void LLFolderViewFolder::addFolder(LLFolderViewFolder* folder) } void LLFolderViewFolder::requestArrange() -{ - if ( mLastArrangeGeneration != -1) - { - mLastArrangeGeneration = -1; - // flag all items up to root - if (mParentFolder) - { - mParentFolder->requestArrange(); - } - } +{ + mLastArrangeGeneration = -1; + // flag all items up to root + if (mParentFolder) + { + mParentFolder->requestArrange(); + } } void LLFolderViewFolder::toggleOpen() 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/llui/llfolderviewmodel.cpp b/indra/llui/llfolderviewmodel.cpp index 3593804554..3363dc5316 100644 --- a/indra/llui/llfolderviewmodel.cpp +++ b/indra/llui/llfolderviewmodel.cpp @@ -48,7 +48,7 @@ std::string LLFolderViewModelCommon::getStatusText() void LLFolderViewModelCommon::filter() { - getFilter().setFilterCount(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsPerFrame"), 1, 5000)); + getFilter().resetTime(llclamp(LLUI::sSettingGroups["config"]->getS32("FilterItemsMaxTimePerFrameVisible"), 1, 100)); mFolderView->getViewModelItem()->filter(getFilter()); } diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 1b61212c0e..b1bcc8bbb4 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -87,12 +87,11 @@ public: virtual void setModified(EFilterModified behavior = FILTER_RESTART) = 0; // +-------------------------------------------------------------------+ - // + Count + // + Time // +-------------------------------------------------------------------+ - virtual void setFilterCount(S32 count) = 0; - virtual S32 getFilterCount() const = 0; - virtual void decrementFilterCount() = 0; - + virtual void resetTime(S32 timeout) = 0; + virtual bool isTimedOut() = 0; + // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ @@ -308,26 +307,28 @@ public: virtual bool potentiallyVisible() { return passedFilter() // we've passed the filter - || getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration() // or we don't know yet + || (getLastFilterGeneration() < mRootViewModel.getFilter().getFirstSuccessGeneration()) // or we don't know yet || descendantsPassedFilter(); } virtual bool passedFilter(S32 filter_generation = -1) { - if (filter_generation < 0) + if (filter_generation < 0) + { filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - - bool passed_folder_filter = mPassedFolderFilter && mLastFolderFilterGeneration >= filter_generation; - bool passed_filter = mPassedFilter && mLastFilterGeneration >= filter_generation; - return passed_folder_filter - && (descendantsPassedFilter(filter_generation) - || passed_filter); + } + bool passed_folder_filter = mPassedFolderFilter && (mLastFolderFilterGeneration >= filter_generation); + bool passed_filter = mPassedFilter && (mLastFilterGeneration >= filter_generation); + return passed_folder_filter && (passed_filter || descendantsPassedFilter(filter_generation)); } virtual bool descendantsPassedFilter(S32 filter_generation = -1) { - if (filter_generation < 0) filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); - return mMostFilteredDescendantGeneration >= filter_generation; + if (filter_generation < 0) + { + filter_generation = mRootViewModel.getFilter().getFirstSuccessGeneration(); + } + return mMostFilteredDescendantGeneration >= filter_generation; } |