vlc | branch: master | David Fuhrmann <[email protected]> | Sat Jun 17 13:01:02 2017 +0200| [b1a99e0b7fa017fbff235a3d0272a5caee7618b3] | committer: David Fuhrmann
macosx: Fix expanding and highlighting of currently playing item Correctly expand and scroll to currently playing item. Update table view, to remove highlight of previously played item. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b1a99e0b7fa017fbff235a3d0272a5caee7618b3 --- modules/gui/macosx/VLCPlaylist.m | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m index 25d66b07ed..828d715589 100644 --- a/modules/gui/macosx/VLCPlaylist.m +++ b/modules/gui/macosx/VLCPlaylist.m @@ -258,27 +258,33 @@ if (!item) return; - // select item + // Search for item row for selection NSInteger itemIndex = [_outlineView rowForItem:item]; if (itemIndex < 0) { - // expand if needed - while (item != nil) { - VLCPLItem *parent = [item parent]; - - if (![_outlineView isExpandable: parent]) - break; - if (![_outlineView isItemExpanded: parent]) - [_outlineView expandItem: parent]; - item = parent; + // Expand if needed. This must be done from root to child + // item in order to work + NSMutableArray *itemsToExpand = [NSMutableArray array]; + VLCPLItem *tmpItem = [item parent]; + while (tmpItem != nil) { + [itemsToExpand addObject:tmpItem]; + tmpItem = [tmpItem parent]; } - // search for row again - itemIndex = [_outlineView rowForItem:item]; - if (itemIndex < 0) { - return; + for(int i = itemsToExpand.count - 1; i >= 0; i--) { + VLCPLItem *currentItem = [itemsToExpand objectAtIndex:i]; + [_outlineView expandItem: currentItem]; } } + // Update highlight for currently playing item + [_outlineView reloadData]; + + // Search for row again + itemIndex = [_outlineView rowForItem:item]; + if (itemIndex < 0) { + return; + } + [_outlineView selectRowIndexes: [NSIndexSet indexSetWithIndex: itemIndex] byExtendingSelection: NO]; [_outlineView scrollRowToVisible: itemIndex]; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
