[vlc-commits] macosx: add multi-selection support to the playlist's recursiveExpandNode ( refs #6892)

Felix Paul Kühne git at videolan.org
Tue Jun 5 11:24:16 CEST 2012


vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun  5 10:55:37 2012 +0200| [2dfe7c350ee97ff6c5bd70cbd20700b4060dde4a] | committer: Felix Paul Kühne

macosx: add multi-selection support to the playlist's recursiveExpandNode (refs #6892)
(cherry picked from commit 0e5226e0eeee223fb5e8e7c33e1fa36f3c4f5e62)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=2dfe7c350ee97ff6c5bd70cbd20700b4060dde4a
---

 modules/gui/macosx/playlist.m |   30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 30f9302..1581984 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1267,18 +1267,28 @@
 
 - (IBAction)recursiveExpandNode:(id)sender
 {
-    id o_item = [o_outline_view itemAtRow: [o_outline_view selectedRow]];
-    playlist_item_t *p_item = (playlist_item_t *)[o_item pointerValue];
+    NSIndexSet * selectedRows = [o_outline_view selectedRowIndexes];
+    NSUInteger count = [selectedRows count];
+    NSUInteger indexes[count];
+    [selectedRows getIndexes:indexes maxCount:count inIndexRange:nil];
 
-    if( ![[o_outline_view dataSource] outlineView: o_outline_view isItemExpandable: o_item] )
-    {
-        o_item = [o_outline_dict objectForKey: [NSString stringWithFormat: @"%p", p_item->p_parent]];
-    }
+    id o_item;
+    playlist_item_t *p_item;
+    for (NSUInteger i = 0; i < count; i++) {
+        o_item = [o_outline_view itemAtRow: indexes[i]];
+        p_item = (playlist_item_t *)[o_item pointerValue];
 
-    /* We need to collapse the node first, since OSX refuses to recursively
-       expand an already expanded node, even if children nodes are collapsed. */
-    [o_outline_view collapseItem: o_item collapseChildren: YES];
-    [o_outline_view expandItem: o_item expandChildren: YES];
+        if( ![[o_outline_view dataSource] outlineView: o_outline_view isItemExpandable: o_item] )
+            o_item = [o_outline_dict objectForKey: [NSString stringWithFormat: @"%p", p_item->p_parent]];
+
+        /* We need to collapse the node first, since OSX refuses to recursively
+         expand an already expanded node, even if children nodes are collapsed. */
+        [o_outline_view collapseItem: o_item collapseChildren: YES];
+        [o_outline_view expandItem: o_item expandChildren: YES];
+
+        selectedRows = [o_outline_view selectedRowIndexes];
+        [selectedRows getIndexes:indexes maxCount:count inIndexRange:nil];
+    }
 }
 
 - (NSMenu *)menuForEvent:(NSEvent *)o_event



More information about the vlc-commits mailing list