[vlc-commits] macosx: Add recursive collapse context menu item
David Fuhrmann
git at videolan.org
Sat Jun 17 13:58:32 CEST 2017
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Jun 17 13:53:01 2017 +0200| [6d194c87e6998640daab2e006f445fed621f292f] | committer: David Fuhrmann
macosx: Add recursive collapse context menu item
As we already have recursive expansion, also add recursive
collapsing of all items.
refs #17726
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6d194c87e6998640daab2e006f445fed621f292f
---
modules/gui/macosx/UI/PlaylistMenu.xib | 18 ++++++++++--------
modules/gui/macosx/VLCPlaylist.h | 3 ++-
modules/gui/macosx/VLCPlaylist.m | 13 +++++++++----
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/modules/gui/macosx/UI/PlaylistMenu.xib b/modules/gui/macosx/UI/PlaylistMenu.xib
index ccbbd6d970..9a5d9c50ef 100644
--- a/modules/gui/macosx/UI/PlaylistMenu.xib
+++ b/modules/gui/macosx/UI/PlaylistMenu.xib
@@ -1,9 +1,8 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="15G1217" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="16F73" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
- <deployment identifier="macosx"/>
<development version="7000" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCPlaylist">
@@ -13,6 +12,7 @@
<outlet property="infoPlaylistMenuItem" destination="9" id="uIr-Np-fpB"/>
<outlet property="playPlaylistMenuItem" destination="12" id="Dv9-jX-Q4W"/>
<outlet property="playlistMenu" destination="1" id="i0k-dj-ZpJ"/>
+ <outlet property="recursiveCollapsePlaylistMenuItem" destination="4xC-4n-AL0" id="xSX-gh-auF"/>
<outlet property="recursiveExpandPlaylistMenuItem" destination="5" id="vFK-br-qmx"/>
<outlet property="revealInFinderPlaylistMenuItem" destination="3" id="IrJ-gR-Zqp"/>
<outlet property="selectAllPlaylistMenuItem" destination="14" id="drx-ij-QhT"/>
@@ -43,13 +43,15 @@
<menuItem isSeparatorItem="YES" id="8">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
- <menuItem title="Expand Node" id="5">
+ <menuItem title="Expand All" id="5">
<connections>
- <action selector="recursiveExpandNode:" target="-2" id="29"/>
+ <action selector="recursiveExpandOrCollapseNode:" target="-2" id="eXQ-bT-oYi"/>
</connections>
</menuItem>
- <menuItem isSeparatorItem="YES" id="10">
- <modifierMask key="keyEquivalentModifierMask" command="YES"/>
+ <menuItem title="Collapse All" id="4xC-4n-AL0">
+ <connections>
+ <action selector="recursiveExpandOrCollapseNode:" target="-2" id="uUM-ci-hOU"/>
+ </connections>
</menuItem>
<menuItem title="Media Information..." id="9">
<connections>
diff --git a/modules/gui/macosx/VLCPlaylist.h b/modules/gui/macosx/VLCPlaylist.h
index 6416708e54..0045d6b43b 100644
--- a/modules/gui/macosx/VLCPlaylist.h
+++ b/modules/gui/macosx/VLCPlaylist.h
@@ -36,6 +36,7 @@
@property (readwrite, weak) IBOutlet NSMenuItem *revealInFinderPlaylistMenuItem;
@property (readwrite, weak) IBOutlet NSMenuItem *selectAllPlaylistMenuItem;
@property (readwrite, weak) IBOutlet NSMenuItem *recursiveExpandPlaylistMenuItem;
+ at property (readwrite, weak) IBOutlet NSMenuItem *recursiveCollapsePlaylistMenuItem;
@property (readwrite, weak) IBOutlet NSMenuItem *addFilesToPlaylistMenuItem;
@property (nonatomic, readwrite, weak) VLCPlaylistView *outlineView;
@@ -58,7 +59,7 @@
- (IBAction)revealItemInFinder:(id)sender;
- (IBAction)deleteItem:(id)sender;
- (IBAction)selectAll:(id)sender;
-- (IBAction)recursiveExpandNode:(id)sender;
+- (IBAction)recursiveExpandOrCollapseNode:(id)sender;
- (IBAction)showInfoPanel:(id)sender;
- (IBAction)addFilesToPlaylist:(id)sender;
diff --git a/modules/gui/macosx/VLCPlaylist.m b/modules/gui/macosx/VLCPlaylist.m
index 828d715589..9d1c54d810 100644
--- a/modules/gui/macosx/VLCPlaylist.m
+++ b/modules/gui/macosx/VLCPlaylist.m
@@ -229,7 +229,8 @@
{
[_playPlaylistMenuItem setTitle: _NS("Play")];
[_deletePlaylistMenuItem setTitle: _NS("Delete")];
- [_recursiveExpandPlaylistMenuItem setTitle: _NS("Expand Node")];
+ [_recursiveExpandPlaylistMenuItem setTitle: _NS("Expand All")];
+ [_recursiveCollapsePlaylistMenuItem setTitle: _NS("Collapse All")];
[_selectAllPlaylistMenuItem setTitle: _NS("Select All")];
[_infoPlaylistMenuItem setTitle: _NS("Media Information...")];
[_revealInFinderPlaylistMenuItem setTitle: _NS("Reveal in Finder")];
@@ -453,7 +454,7 @@
return [_outlineView numberOfRows] > 0;
} else if ([item action] == @selector(playItem:)) {
return [_outlineView numberOfSelectedRows] > 0;
- } else if ([item action] == @selector(recursiveExpandNode:)) {
+ } else if ([item action] == @selector(recursiveExpandOrCollapseNode:)) {
return [_outlineView numberOfSelectedRows] > 0;
} else if ([item action] == @selector(showInfoPanel:)) {
return [_outlineView numberOfSelectedRows] > 0;
@@ -662,8 +663,10 @@
PL_UNLOCK;
}
-- (IBAction)recursiveExpandNode:(id)sender
+- (IBAction)recursiveExpandOrCollapseNode:(id)sender
{
+ bool expand = (sender == _recursiveExpandPlaylistMenuItem);
+
NSIndexSet * selectedRows = [_outlineView selectedRowIndexes];
NSUInteger count = [selectedRows count];
NSUInteger indexes[count];
@@ -678,7 +681,9 @@
expand an already expanded node, even if children nodes are collapsed. */
if ([_outlineView isExpandable:item]) {
[_outlineView collapseItem: item collapseChildren: YES];
- [_outlineView expandItem: item expandChildren: YES];
+
+ if (expand)
+ [_outlineView expandItem: item expandChildren: YES];
}
selectedRows = [_outlineView selectedRowIndexes];
More information about the vlc-commits
mailing list