From 8465910c79b8e746e04fd581cca2d60399e569b9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:07 -0500 Subject: Second Life viewer sources 1.18.3.2-RC --- linden/indra/newview/llfolderview.cpp | 73 +++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 28 deletions(-) (limited to 'linden/indra/newview/llfolderview.cpp') diff --git a/linden/indra/newview/llfolderview.cpp b/linden/indra/newview/llfolderview.cpp index f3c6ace..3a58be9 100644 --- a/linden/indra/newview/llfolderview.cpp +++ b/linden/indra/newview/llfolderview.cpp @@ -2528,6 +2528,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico mShowSelectionContext(FALSE), mShowSingleSelection(FALSE), mArrangeGeneration(0), + mUserData(NULL), mSelectCallback(NULL), mSelectionChanged(FALSE), mMinWidth(0), @@ -4254,73 +4255,89 @@ LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id) return NULL; } -//static -void LLFolderView::idle(void* user_data) + +// Main idle routine +void LLFolderView::doIdle() { LLFastTimer t2(LLFastTimer::FTM_INVENTORY); - LLFolderView* self = (LLFolderView*)user_data; BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters"); - if (debug_filters != self->getDebugFilters()) + if (debug_filters != getDebugFilters()) { - self->mDebugFilters = debug_filters; - self->arrangeAll(); + mDebugFilters = debug_filters; + arrangeAll(); } - self->mFilter.clearModified(); - BOOL filter_modified_and_active = self->mCompletedFilterGeneration < self->mFilter.getCurrentGeneration() && - self->mFilter.isNotDefault(); - self->mNeedsAutoSelect = filter_modified_and_active && - !(gFocusMgr.childHasKeyboardFocus(self) || gFocusMgr.getMouseCapture()); + mFilter.clearModified(); + BOOL filter_modified_and_active = mCompletedFilterGeneration < mFilter.getCurrentGeneration() && + mFilter.isNotDefault(); + mNeedsAutoSelect = filter_modified_and_active && + !(gFocusMgr.childHasKeyboardFocus(this) || gFocusMgr.getMouseCapture()); // filter to determine visiblity before arranging - self->filterFromRoot(); + filterFromRoot(); // automatically show matching items, and select first one // do this every frame until user puts keyboard focus into the inventory window // signaling the end of the automatic update // only do this when mNeedsFilter is set, meaning filtered items have // potentially changed - if (self->mNeedsAutoSelect) + if (mNeedsAutoSelect) { LLFastTimer t3(LLFastTimer::FTM_AUTO_SELECT); // select new item only if a filtered item not currently selected - LLFolderViewItem* selected_itemp = self->mSelectedItems.empty() ? NULL : self->mSelectedItems.back(); - if ((!selected_itemp || !selected_itemp->getFiltered()) && !self->mAutoSelectOverride) + LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); + if ((!selected_itemp || !selected_itemp->getFiltered()) && !mAutoSelectOverride) { // select first filtered item LLSelectFirstFilteredItem filter; - self->applyFunctorRecursively(filter); + applyFunctorRecursively(filter); } - self->scrollToShowSelection(); + scrollToShowSelection(); } - self->sanitizeSelection(); + BOOL is_visible = isInVisibleChain(); - if( self->needsArrange() && self->isInVisibleChain()) + if ( is_visible ) { - self->arrangeFromRoot(); + sanitizeSelection(); + if( needsArrange() ) + { + arrangeFromRoot(); + } } - if (self->mSelectedItems.size() && self->mNeedsScroll) + if (mSelectedItems.size() && mNeedsScroll) { - self->scrollToShowItem(self->mSelectedItems.back()); + scrollToShowItem(mSelectedItems.back()); // continue scrolling until animated layout change is done - if (self->getCompletedFilterGeneration() >= self->mFilter.getMinRequiredGeneration() && - (!self->needsArrange() || !self->isInVisibleChain())) + if (getCompletedFilterGeneration() >= mFilter.getMinRequiredGeneration() && + (!needsArrange() || !is_visible)) { - self->mNeedsScroll = FALSE; + mNeedsScroll = FALSE; } } - if (self->mSelectionChanged && self->mSelectCallback) + if (mSelectionChanged && mSelectCallback) { //RN: we use keyboard focus as a proxy for user-explicit actions - self->mSelectCallback(self->mSelectedItems, gFocusMgr.childHasKeyboardFocus(self), self->mUserData); + mSelectCallback(mSelectedItems, gFocusMgr.childHasKeyboardFocus(this), mUserData); } - self->mSelectionChanged = FALSE; + mSelectionChanged = FALSE; } + +//static +void LLFolderView::idle(void* user_data) +{ + LLFolderView* self = (LLFolderView*)user_data; + if ( self ) + { // Do the real idle + self->doIdle(); + } +} + + void LLFolderView::dumpSelectionInformation() { llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; -- cgit v1.1