diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj index fea8965c809119b48e4e9cb60485b3c37dc87080..a5d6ad34d0bd9e72d6319414fcd6510d90e0b811 100644 --- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj +++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj @@ -486,7 +486,6 @@ 7D445D8A22032B9200263D34 /* VLCPlaylistTableView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistTableView.m; sourceTree = "<group>"; }; 7D445D8C2203375100263D34 /* VLCPlaylistMenuController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistMenuController.h; sourceTree = "<group>"; }; 7D445D8D2203375100263D34 /* VLCPlaylistMenuController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistMenuController.m; sourceTree = "<group>"; }; - 7D445D8F220339D400263D34 /* VLCPlaylistMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCPlaylistMenu.xib; sourceTree = "<group>"; }; 7D460B0A229EB4C700097948 /* VLCDragDropView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCDragDropView.h; sourceTree = "<group>"; }; 7D460B0B229EB4C700097948 /* VLCDragDropView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCDragDropView.m; sourceTree = "<group>"; }; 7D5678EB1D5BA1DC002698F3 /* VLCApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCApplication.h; sourceTree = "<group>"; }; @@ -1518,7 +1517,6 @@ 6B8224091E4D2A9000833BE1 /* MainMenu.xib */, 7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */, 7D0F64002201F66D00FDB91F /* VLCPlaylistTableCellView.xib */, - 7D445D8F220339D400263D34 /* VLCPlaylistMenu.xib */, 7D0F64052202047900FDB91F /* VLCLibraryCollectionViewItem.xib */, 7DE2F0482282D7980040DD0A /* VLCLibraryTableCellView.xib */, 7DE82E7A228437AA002D341A /* VLCLibraryAlbumTableCellView.xib */, diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am index 9be4e913732fe02b336bb56a449fe3168fbb5ac6..d8f313a29d9d83f8b13c80eed1c3439967e4cd06 100644 --- a/modules/gui/macosx/Makefile.am +++ b/modules/gui/macosx/Makefile.am @@ -266,7 +266,6 @@ libmacosx_plugin_la_XIB_SOURCES = \ gui/macosx/UI/VLCLibraryAlbumTableCellView.xib \ gui/macosx/UI/VLCLibraryWindow.xib \ gui/macosx/UI/VLCLibraryTableCellView.xib \ - gui/macosx/UI/VLCPlaylistMenu.xib \ gui/macosx/UI/VLCPlaylistTableCellView.xib \ gui/macosx/UI/VLCLibraryCollectionViewItem.xib \ gui/macosx/UI/VLCMediaSourceCollectionViewItem.xib \ diff --git a/modules/gui/macosx/UI/VLCPlaylistMenu.xib b/modules/gui/macosx/UI/VLCPlaylistMenu.xib deleted file mode 100644 index abeb2628f97a75cad42fa8ddf5a1d334391dca58..0000000000000000000000000000000000000000 --- a/modules/gui/macosx/UI/VLCPlaylistMenu.xib +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> - <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> - </dependencies> - <objects> - <customObject id="-2" userLabel="File's Owner" customClass="VLCPlaylistMenuController"> - <connections> - <outlet property="addFilesToPlaylistMenuItem" destination="Mdx-tr-uuI" id="XXf-67-eWE"/> - <outlet property="clearPlaylistMenuItem" destination="mfa-zG-Des" id="NjY-ev-rHM"/> - <outlet property="playMenuItem" destination="f6u-YD-nbW" id="cf7-f3-bCx"/> - <outlet property="playlistMenu" destination="dq6-Th-J8r" id="9Tj-Qo-HbU"/> - <outlet property="removeMenuItem" destination="YHt-8w-4G2" id="bRJ-4k-Oa5"/> - <outlet property="revealInFinderMenuItem" destination="FgT-MW-hvr" id="677-Gn-fVV"/> - <outlet property="sortPlaylistMenu" destination="fcX-EB-mJe" id="ww1-Y1-3SO"/> - <outlet property="sortPlaylistMenuItem" destination="fcX-EB-mJe" id="61o-Ll-UrY"/> - </connections> - </customObject> - <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> - <customObject id="-3" userLabel="Application" customClass="NSObject"/> - <customObject id="YLy-65-1bz" customClass="NSFontManager"/> - <menu id="dq6-Th-J8r"> - <items> - <menuItem title="Play" id="f6u-YD-nbW"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="play:" target="-2" id="baE-Tq-f7Q"/> - </connections> - </menuItem> - <menuItem title="Remove" id="YHt-8w-4G2"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="remove:" target="-2" id="d7Q-Rl-br2"/> - </connections> - </menuItem> - <menuItem title="Reveal in Finder" id="FgT-MW-hvr"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="revealInFinder:" target="-2" id="1hT-vw-QWq"/> - </connections> - </menuItem> - <menuItem isSeparatorItem="YES" id="hKI-E8-VMA"/> - <menuItem title="Add Files" id="Mdx-tr-uuI"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="addFilesToPlaylist:" target="-2" id="1MB-8E-leR"/> - </connections> - </menuItem> - <menuItem title="Clear Playlist" id="mfa-zG-Des"> - <modifierMask key="keyEquivalentModifierMask"/> - <connections> - <action selector="clearPlaylist:" target="-2" id="yy4-15-pKY"/> - </connections> - </menuItem> - <menuItem isSeparatorItem="YES" id="8XF-0j-B5C"/> - <menuItem title="Sort" id="fcX-EB-mJe"> - <modifierMask key="keyEquivalentModifierMask"/> - <menu key="submenu" title="Sort" id="7gg-17-3N9"> - <items> - <menuItem title="Item" id="cjh-Mt-gsu"> - <modifierMask key="keyEquivalentModifierMask"/> - </menuItem> - </items> - </menu> - </menuItem> - </items> - <point key="canvasLocation" x="-88" y="-124"/> - </menu> - </objects> -</document> diff --git a/modules/gui/macosx/playlist/VLCPlaylistMenuController.h b/modules/gui/macosx/playlist/VLCPlaylistMenuController.h index 5c42e483d698c1a3affee89303cb0f279c09fb0c..ac78cb06181a8468d3a042f7baa9a80fdcefc3d5 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistMenuController.h +++ b/modules/gui/macosx/playlist/VLCPlaylistMenuController.h @@ -29,21 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @interface VLCPlaylistMenuController : NSObject @property (readwrite, weak) NSTableView *playlistTableView; - -@property (readwrite, strong) IBOutlet NSMenu *playlistMenu; -@property (readwrite, weak) IBOutlet NSMenuItem *playMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *revealInFinderMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *addFilesToPlaylistMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *removeMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *clearPlaylistMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *sortPlaylistMenuItem; -@property (readwrite, weak) IBOutlet NSMenuItem *sortPlaylistMenu; - -- (IBAction)play:(id)sender; -- (IBAction)remove:(id)sender; -- (IBAction)revealInFinder:(id)sender; -- (IBAction)addFilesToPlaylist:(id)sender; -- (IBAction)clearPlaylist:(id)sender; +@property (readonly) NSMenu *playlistMenu; @end diff --git a/modules/gui/macosx/playlist/VLCPlaylistMenuController.m b/modules/gui/macosx/playlist/VLCPlaylistMenuController.m index c5c887d00ee817b813c2ff0e4d514759dd36aa6c..3f627a9a3f8053a558b1418fef879630bf445540 100644 --- a/modules/gui/macosx/playlist/VLCPlaylistMenuController.m +++ b/modules/gui/macosx/playlist/VLCPlaylistMenuController.m @@ -34,6 +34,12 @@ @interface VLCPlaylistMenuController () { VLCPlaylistController *_playlistController; + + NSMenuItem *_playMenuItem; + NSMenuItem *_revealInFinderMenuItem; + NSMenuItem *_addFilesToPlaylistMenuItem; + NSMenuItem *_removeMenuItem; + NSMenuItem *_clearPlaylistMenuItem; } @end @@ -43,23 +49,40 @@ { self = [super init]; if (self) { + [self createMenu]; _playlistController = [[VLCMain sharedInstance] playlistController]; - [[NSBundle mainBundle] loadNibNamed:@"VLCPlaylistMenu" owner:self topLevelObjects:nil]; } return self; } -- (void)awakeFromNib +- (void)createMenu { - [_playMenuItem setTitle:_NS("Play")]; - [_revealInFinderMenuItem setTitle:_NS("Reveal in Finder")]; - [_addFilesToPlaylistMenuItem setTitle:_NS("Add File...")]; - [_removeMenuItem setTitle:_NS("Delete")]; - [_clearPlaylistMenuItem setTitle:_NS("Clear the playlist")]; - [_sortPlaylistMenuItem setTitle:_NS("Sort by")]; + _playlistMenu = [[NSMenu alloc] init]; + + _playMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Play") action:@selector(play:) keyEquivalent:@""]; + _playMenuItem.target = self; + [_playlistMenu addItem:_playMenuItem]; + + _removeMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Delete") action:@selector(remove:) keyEquivalent:@""]; + _removeMenuItem.target = self; + [_playlistMenu addItem:_removeMenuItem]; + + _revealInFinderMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Reveal in Finder") action:@selector(revealInFinder:) keyEquivalent:@""]; + _revealInFinderMenuItem.target = self; + [_playlistMenu addItem:_revealInFinderMenuItem]; + + [_playlistMenu addItem:[NSMenuItem separatorItem]]; + + _addFilesToPlaylistMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Add File...") action:@selector(addFilesToPlaylist:) keyEquivalent:@""]; + _addFilesToPlaylistMenuItem.target = self; + [_playlistMenu addItem:_addFilesToPlaylistMenuItem]; + + _clearPlaylistMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Clear the playlist") action:@selector(clearPlaylist:) keyEquivalent:@""]; + _clearPlaylistMenuItem.target = self; + [_playlistMenu addItem:_clearPlaylistMenuItem]; } -- (IBAction)play:(id)sender +- (void)play:(id)sender { NSInteger selectedRow = self.playlistTableView.selectedRow; @@ -70,7 +93,7 @@ } } -- (IBAction)remove:(id)sender +- (void)remove:(id)sender { if (self.playlistTableView.selectedRow == -1) return; @@ -78,7 +101,7 @@ [_playlistController removeItemsAtIndexes:self.playlistTableView.selectedRowIndexes]; } -- (IBAction)revealInFinder:(id)sender +- (void)revealInFinder:(id)sender { NSInteger selectedRow = self.playlistTableView.selectedRow; @@ -93,7 +116,7 @@ [[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:path]; } -- (IBAction)addFilesToPlaylist:(id)sender +- (void)addFilesToPlaylist:(id)sender { NSInteger selectedRow = self.playlistTableView.selectedRow; @@ -104,24 +127,24 @@ }]; } -- (IBAction)clearPlaylist:(id)sender +- (void)clearPlaylist:(id)sender { [_playlistController clearPlaylist]; } - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - if (menuItem == self.addFilesToPlaylistMenuItem) { + if (menuItem == _addFilesToPlaylistMenuItem) { return YES; - } else if (menuItem == self.clearPlaylistMenuItem) { + } else if (menuItem == _clearPlaylistMenuItem) { return (self.playlistTableView.numberOfRows > 0); - } else if (menuItem == self.removeMenuItem || - menuItem == self.playMenuItem) { + } else if (menuItem == _removeMenuItem || + menuItem == _playMenuItem) { return (self.playlistTableView.numberOfSelectedRows > 0); - } else if (menuItem == self.revealInFinderMenuItem) { + } else if (menuItem == _revealInFinderMenuItem) { return (self.playlistTableView.numberOfSelectedRows == 1); }