From 896af425f997e3a391c271b40f3ac4ebddd33f41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <fkuehne@videolan.org>
Date: Wed, 22 Jul 2015 14:26:48 +0200
Subject: [PATCH] macosx: split playlist source file

---
 .../macosx/vlc.xcodeproj/project.pbxproj      |  4 +
 modules/gui/macosx/Makefile.am                |  1 +
 modules/gui/macosx/playlist.h                 | 16 +---
 modules/gui/macosx/playlist.m                 | 86 ++---------------
 modules/gui/macosx/playlistview.h             | 29 ++++++
 modules/gui/macosx/playlistview.m             | 93 +++++++++++++++++++
 po/POTFILES.in                                |  2 +
 7 files changed, 139 insertions(+), 92 deletions(-)
 create mode 100644 modules/gui/macosx/playlistview.h
 create mode 100644 modules/gui/macosx/playlistview.m

diff --git a/extras/package/macosx/vlc.xcodeproj/project.pbxproj b/extras/package/macosx/vlc.xcodeproj/project.pbxproj
index f6c9b78f2998..82b953b39d25 100644
--- a/extras/package/macosx/vlc.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/vlc.xcodeproj/project.pbxproj
@@ -1246,6 +1246,8 @@
 		7D8BB0B61830311300FAE9B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/DebugMessageVisualizer.xib; sourceTree = "<group>"; };
 		7D8BB0B91830367200FAE9B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/PlaylistMenu.xib; sourceTree = "<group>"; };
 		7D8BB0BF1830393300FAE9B7 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/MainWindow.xib; sourceTree = "<group>"; };
+		7DA481221B5FC13700917FD7 /* playlistview.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = playlistview.h; path = ../../../modules/gui/macosx/playlistview.h; sourceTree = "<group>"; };
+		7DA481231B5FC13700917FD7 /* playlistview.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = playlistview.m; path = ../../../modules/gui/macosx/playlistview.m; sourceTree = "<group>"; };
 		7DB65D5218ABD6380053B874 /* AddonsWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AddonsWindowController.h; path = ../../../modules/gui/macosx/AddonsWindowController.h; sourceTree = SOURCE_ROOT; };
 		7DB65D5318ABD6380053B874 /* AddonsWindowController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AddonsWindowController.m; path = ../../../modules/gui/macosx/AddonsWindowController.m; sourceTree = SOURCE_ROOT; };
 		7DB65D5518ABD6490053B874 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/AddonManager.xib; sourceTree = "<group>"; };
@@ -1860,6 +1862,8 @@
 				8E55FB800459B0FD00FB3317 /* output.m */,
 				8ED6C28303E2EB1C0059A3A7 /* playlist.h */,
 				8ED6C28403E2EB1C0059A3A7 /* playlist.m */,
+				7DA481221B5FC13700917FD7 /* playlistview.h */,
+				7DA481231B5FC13700917FD7 /* playlistview.m */,
 				8E49720006417F6800370C9F /* playlistinfo.h */,
 				8E49720106417F6800370C9F /* playlistinfo.m */,
 				7DF812F11B5599E40052293C /* PLItem.h */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index b0a1d58f1c31..b9c2bf759118 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -50,6 +50,7 @@ libmacosx_plugin_la_SOURCES = \
 	misc.h misc.m \
 	open.h open.m \
 	output.h output.m \
+	playlistview.h playlistview.m \
 	playlist.h playlist.m \
 	playlistinfo.h playlistinfo.m \
 	PLItem.h PLItem.m \
diff --git a/modules/gui/macosx/playlist.h b/modules/gui/macosx/playlist.h
index e393f39a1ea1..6e1444531d71 100644
--- a/modules/gui/macosx/playlist.h
+++ b/modules/gui/macosx/playlist.h
@@ -4,9 +4,9 @@
  * Copyright (C) 2002-2015 VLC authors and VideoLAN
  * $Id$
  *
- * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
- *          Derk-Jan Hartman <hartman at videolan dot org>
+ * Authors: Benjamin Pracht <bigben at videolab dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,17 +25,8 @@
 
 #import "PXSourceList.h"
 #import "PLModel.h"
+#import "playlistview.h"
 
-/*****************************************************************************
- * VLCPlaylistView interface
- *****************************************************************************/
-@interface VLCPlaylistView : NSOutlineView
-
-@end
-
-/*****************************************************************************
- * VLCPlaylist interface
- *****************************************************************************/
 @interface VLCPlaylist : NSObject<NSOutlineViewDelegate>
 
 @property (readwrite, weak) IBOutlet NSMenu *playlistMenu;
@@ -71,7 +62,6 @@
 
 - (void)deletionCompleted;
 
-
 - (IBAction)playItem:(id)sender;
 - (IBAction)revealItemInFinder:(id)sender;
 - (IBAction)preparseItem:(id)sender;
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 128ba362b04e..354ed1253ee3 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -4,10 +4,10 @@
 * Copyright (C) 2002-2015 VLC authors and VideoLAN
  * $Id$
  *
- * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
- *          Derk-Jan Hartman <hartman at videola/n dot org>
- *          Benjamin Pracht <bigben at videolab dot org>
+ * Authors: Derk-Jan Hartman <hartman at videola/n dot org>
+ *          Benjamin Pracht <bigben at videolan dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -112,74 +112,6 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
     }
 }
 
-/*****************************************************************************
- * VLCPlaylistView implementation
- *****************************************************************************/
-@implementation VLCPlaylistView
-
-- (NSMenu *)menuForEvent:(NSEvent *)o_event
-{
-    return([(VLCPlaylist *)[self delegate] menuForEvent: o_event]);
-}
-
-- (void)keyDown:(NSEvent *)o_event
-{
-    unichar key = 0;
-
-    if ([[o_event characters] length])
-        key = [[o_event characters] characterAtIndex: 0];
-
-    switch(key) {
-        case NSDeleteCharacter:
-        case NSDeleteFunctionKey:
-        case NSDeleteCharFunctionKey:
-        case NSBackspaceCharacter:
-            [(VLCPlaylist *)[self delegate] deleteItem:self];
-            break;
-
-        case NSEnterCharacter:
-        case NSCarriageReturnCharacter:
-            [(VLCPlaylist *)[[VLCMain sharedInstance] playlist] playItem:nil];
-            break;
-
-        default:
-            [super keyDown: o_event];
-            break;
-    }
-}
-
-- (BOOL)validateMenuItem:(NSMenuItem *)item
-{
-    if (([self numberOfSelectedRows] >= 1 && [item action] == @selector(delete:)) || [item action] == @selector(selectAll:))
-        return YES;
-
-    return NO;
-}
-
-- (BOOL)acceptsFirstResponder
-{
-    return YES;
-}
-
-- (BOOL)becomeFirstResponder
-{
-    [self setNeedsDisplay:YES];
-    return YES;
-}
-
-- (BOOL)resignFirstResponder
-{
-    [self setNeedsDisplay:YES];
-    return YES;
-}
-
-- (IBAction)delete:(id)sender
-{
-    [[[VLCMain sharedInstance] playlist] deleteItem: sender];
-}
-
-@end
-
 /*****************************************************************************
  * An extension to NSOutlineView's interface to fix compilation warnings
  * and let us access these 2 functions properly.
@@ -193,10 +125,6 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
 + (NSImage *)_defaultTableHeaderReverseSortImage;
 @end
 
-
-/*****************************************************************************
- * VLCPlaylist implementation
- *****************************************************************************/
 @interface VLCPlaylist ()
 {
     NSImage *_descendingSortingImage;
@@ -732,12 +660,12 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
     if (optionsArray) {
         NSUInteger count = [optionsArray count];
         for (NSUInteger i = 0; i < count; i++)
-            input_item_AddOption(p_input, [o_options[i] UTF8String], VLC_INPUT_OPTION_TRUSTED);
+            input_item_AddOption(p_input, [optionsArray[i] UTF8String], VLC_INPUT_OPTION_TRUSTED);
     }
 
     /* Recent documents menu */
     if (url != nil && (BOOL)config_GetInt(p_playlist, "macosx-recentitems") == YES)
-        [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: o_nsurl];
+        [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];
 
     return p_input;
 }
@@ -866,9 +794,9 @@ static int VolumeUpdated(vlc_object_t *p_this, const char *psz_var,
         b_isSortDescending = false;
 
     if (b_isSortDescending)
-        i_type = ORDER_REVERSE;
+        type = ORDER_REVERSE;
     else
-        i_type = ORDER_NORMAL;
+        type = ORDER_NORMAL;
 
     [[self model] sortForColumn:identifier withMode:type];
 
diff --git a/modules/gui/macosx/playlistview.h b/modules/gui/macosx/playlistview.h
new file mode 100644
index 000000000000..fe96528e0c4f
--- /dev/null
+++ b/modules/gui/macosx/playlistview.h
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * playlist.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2002-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Derk-Jan Hartman <hartman at videolan dot org>
+ *          Felix Paul Kühne <fkuehne at videolan dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@interface VLCPlaylistView : NSOutlineView
+
+@end
diff --git a/modules/gui/macosx/playlistview.m b/modules/gui/macosx/playlistview.m
new file mode 100644
index 000000000000..24a08f9b149c
--- /dev/null
+++ b/modules/gui/macosx/playlistview.m
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * playlistview.m: MacOS X interface module
+ *****************************************************************************
+* Copyright (C) 2003-2015 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Derk-Jan Hartman <hartman at videola/n dot org>
+ *          Benjamin Pracht <bigben at videolab dot org>
+ *          Felix Paul Kühne <fkuehne at videolan dot org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "intf.h"
+#import "playlistview.h"
+#import "playlist.h"
+
+@implementation VLCPlaylistView
+
+- (NSMenu *)menuForEvent:(NSEvent *)event
+{
+    return([(VLCPlaylist *)[self delegate] menuForEvent: event]);
+}
+
+- (void)keyDown:(NSEvent *)event
+{
+    unichar key = 0;
+
+    if ([[event characters] length])
+        key = [[event characters] characterAtIndex: 0];
+
+    switch(key) {
+        case NSDeleteCharacter:
+        case NSDeleteFunctionKey:
+        case NSDeleteCharFunctionKey:
+        case NSBackspaceCharacter:
+            [(VLCPlaylist *)[self delegate] deleteItem:self];
+            break;
+
+        case NSEnterCharacter:
+        case NSCarriageReturnCharacter:
+            [(VLCPlaylist *)[[VLCMain sharedInstance] playlist] playItem:nil];
+            break;
+
+        default:
+            [super keyDown: event];
+            break;
+    }
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem *)item
+{
+    if (([self numberOfSelectedRows] >= 1 && [item action] == @selector(delete:)) || [item action] == @selector(selectAll:))
+        return YES;
+
+    return NO;
+}
+
+- (BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+- (BOOL)becomeFirstResponder
+{
+    [self setNeedsDisplay:YES];
+    return YES;
+}
+
+- (BOOL)resignFirstResponder
+{
+    [self setNeedsDisplay:YES];
+    return YES;
+}
+
+- (IBAction)delete:(id)sender
+{
+    [[[VLCMain sharedInstance] playlist] deleteItem: sender];
+}
+
+@end
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ea4359c69728..ab1b49a0f340 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -596,6 +596,8 @@ modules/gui/macosx/playlist.h
 modules/gui/macosx/playlist.m
 modules/gui/macosx/playlistinfo.h
 modules/gui/macosx/playlistinfo.m
+modules/gui/macosx/playlistview.h
+modules/gui/macosx/playlistview.m
 modules/gui/macosx/prefs.h
 modules/gui/macosx/prefs.m
 modules/gui/macosx/prefs_widgets.h
-- 
GitLab