diff options
Diffstat (limited to 'linden/indra/newview/llfolderview.cpp')
-rw-r--r-- | linden/indra/newview/llfolderview.cpp | 73 |
1 files changed, 45 insertions, 28 deletions
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 | |||
2528 | mShowSelectionContext(FALSE), | 2528 | mShowSelectionContext(FALSE), |
2529 | mShowSingleSelection(FALSE), | 2529 | mShowSingleSelection(FALSE), |
2530 | mArrangeGeneration(0), | 2530 | mArrangeGeneration(0), |
2531 | mUserData(NULL), | ||
2531 | mSelectCallback(NULL), | 2532 | mSelectCallback(NULL), |
2532 | mSelectionChanged(FALSE), | 2533 | mSelectionChanged(FALSE), |
2533 | mMinWidth(0), | 2534 | mMinWidth(0), |
@@ -4254,73 +4255,89 @@ LLFolderViewItem* LLFolderView::getItemByID(const LLUUID& id) | |||
4254 | return NULL; | 4255 | return NULL; |
4255 | } | 4256 | } |
4256 | 4257 | ||
4257 | //static | 4258 | |
4258 | void LLFolderView::idle(void* user_data) | 4259 | // Main idle routine |
4260 | void LLFolderView::doIdle() | ||
4259 | { | 4261 | { |
4260 | LLFastTimer t2(LLFastTimer::FTM_INVENTORY); | 4262 | LLFastTimer t2(LLFastTimer::FTM_INVENTORY); |
4261 | LLFolderView* self = (LLFolderView*)user_data; | ||
4262 | 4263 | ||
4263 | BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters"); | 4264 | BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters"); |
4264 | if (debug_filters != self->getDebugFilters()) | 4265 | if (debug_filters != getDebugFilters()) |
4265 | { | 4266 | { |
4266 | self->mDebugFilters = debug_filters; | 4267 | mDebugFilters = debug_filters; |
4267 | self->arrangeAll(); | 4268 | arrangeAll(); |
4268 | } | 4269 | } |
4269 | 4270 | ||
4270 | self->mFilter.clearModified(); | 4271 | mFilter.clearModified(); |
4271 | BOOL filter_modified_and_active = self->mCompletedFilterGeneration < self->mFilter.getCurrentGeneration() && | 4272 | BOOL filter_modified_and_active = mCompletedFilterGeneration < mFilter.getCurrentGeneration() && |
4272 | self->mFilter.isNotDefault(); | 4273 | mFilter.isNotDefault(); |
4273 | self->mNeedsAutoSelect = filter_modified_and_active && | 4274 | mNeedsAutoSelect = filter_modified_and_active && |
4274 | !(gFocusMgr.childHasKeyboardFocus(self) || gFocusMgr.getMouseCapture()); | 4275 | !(gFocusMgr.childHasKeyboardFocus(this) || gFocusMgr.getMouseCapture()); |
4275 | 4276 | ||
4276 | // filter to determine visiblity before arranging | 4277 | // filter to determine visiblity before arranging |
4277 | self->filterFromRoot(); | 4278 | filterFromRoot(); |
4278 | 4279 | ||
4279 | // automatically show matching items, and select first one | 4280 | // automatically show matching items, and select first one |
4280 | // do this every frame until user puts keyboard focus into the inventory window | 4281 | // do this every frame until user puts keyboard focus into the inventory window |
4281 | // signaling the end of the automatic update | 4282 | // signaling the end of the automatic update |
4282 | // only do this when mNeedsFilter is set, meaning filtered items have | 4283 | // only do this when mNeedsFilter is set, meaning filtered items have |
4283 | // potentially changed | 4284 | // potentially changed |
4284 | if (self->mNeedsAutoSelect) | 4285 | if (mNeedsAutoSelect) |
4285 | { | 4286 | { |
4286 | LLFastTimer t3(LLFastTimer::FTM_AUTO_SELECT); | 4287 | LLFastTimer t3(LLFastTimer::FTM_AUTO_SELECT); |
4287 | // select new item only if a filtered item not currently selected | 4288 | // select new item only if a filtered item not currently selected |
4288 | LLFolderViewItem* selected_itemp = self->mSelectedItems.empty() ? NULL : self->mSelectedItems.back(); | 4289 | LLFolderViewItem* selected_itemp = mSelectedItems.empty() ? NULL : mSelectedItems.back(); |
4289 | if ((!selected_itemp || !selected_itemp->getFiltered()) && !self->mAutoSelectOverride) | 4290 | if ((!selected_itemp || !selected_itemp->getFiltered()) && !mAutoSelectOverride) |
4290 | { | 4291 | { |
4291 | // select first filtered item | 4292 | // select first filtered item |
4292 | LLSelectFirstFilteredItem filter; | 4293 | LLSelectFirstFilteredItem filter; |
4293 | self->applyFunctorRecursively(filter); | 4294 | applyFunctorRecursively(filter); |
4294 | } | 4295 | } |
4295 | self->scrollToShowSelection(); | 4296 | scrollToShowSelection(); |
4296 | } | 4297 | } |
4297 | 4298 | ||
4298 | self->sanitizeSelection(); | 4299 | BOOL is_visible = isInVisibleChain(); |
4299 | 4300 | ||
4300 | if( self->needsArrange() && self->isInVisibleChain()) | 4301 | if ( is_visible ) |
4301 | { | 4302 | { |
4302 | self->arrangeFromRoot(); | 4303 | sanitizeSelection(); |
4304 | if( needsArrange() ) | ||
4305 | { | ||
4306 | arrangeFromRoot(); | ||
4307 | } | ||
4303 | } | 4308 | } |
4304 | 4309 | ||
4305 | if (self->mSelectedItems.size() && self->mNeedsScroll) | 4310 | if (mSelectedItems.size() && mNeedsScroll) |
4306 | { | 4311 | { |
4307 | self->scrollToShowItem(self->mSelectedItems.back()); | 4312 | scrollToShowItem(mSelectedItems.back()); |
4308 | // continue scrolling until animated layout change is done | 4313 | // continue scrolling until animated layout change is done |
4309 | if (self->getCompletedFilterGeneration() >= self->mFilter.getMinRequiredGeneration() && | 4314 | if (getCompletedFilterGeneration() >= mFilter.getMinRequiredGeneration() && |
4310 | (!self->needsArrange() || !self->isInVisibleChain())) | 4315 | (!needsArrange() || !is_visible)) |
4311 | { | 4316 | { |
4312 | self->mNeedsScroll = FALSE; | 4317 | mNeedsScroll = FALSE; |
4313 | } | 4318 | } |
4314 | } | 4319 | } |
4315 | 4320 | ||
4316 | if (self->mSelectionChanged && self->mSelectCallback) | 4321 | if (mSelectionChanged && mSelectCallback) |
4317 | { | 4322 | { |
4318 | //RN: we use keyboard focus as a proxy for user-explicit actions | 4323 | //RN: we use keyboard focus as a proxy for user-explicit actions |
4319 | self->mSelectCallback(self->mSelectedItems, gFocusMgr.childHasKeyboardFocus(self), self->mUserData); | 4324 | mSelectCallback(mSelectedItems, gFocusMgr.childHasKeyboardFocus(this), mUserData); |
4320 | } | 4325 | } |
4321 | self->mSelectionChanged = FALSE; | 4326 | mSelectionChanged = FALSE; |
4322 | } | 4327 | } |
4323 | 4328 | ||
4329 | |||
4330 | //static | ||
4331 | void LLFolderView::idle(void* user_data) | ||
4332 | { | ||
4333 | LLFolderView* self = (LLFolderView*)user_data; | ||
4334 | if ( self ) | ||
4335 | { // Do the real idle | ||
4336 | self->doIdle(); | ||
4337 | } | ||
4338 | } | ||
4339 | |||
4340 | |||
4324 | void LLFolderView::dumpSelectionInformation() | 4341 | void LLFolderView::dumpSelectionInformation() |
4325 | { | 4342 | { |
4326 | llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; | 4343 | llinfos << "LLFolderView::dumpSelectionInformation()" << llendl; |