]> git.sesse.net Git - vlc/commitdiff
* You can doubleclick an item to play it now.
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 18 Nov 2004 02:18:34 +0000 (02:18 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 18 Nov 2004 02:18:34 +0000 (02:18 +0000)
* implemented delete, but for some reason the key events don't arrive

modules/gui/macosx/intf.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index 6e010dbbc504f870baa22b975181a62317fd9893..afb39695c810c0067503f603740e1998340e1064 100644 (file)
@@ -673,6 +673,15 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
 
+    switch( key )
+    {
+        case NSDeleteCharacter:
+        case NSDeleteFunctionKey:
+        case NSDeleteCharFunctionKey:
+        case NSBackspaceCharacter:
+            return YES;
+    }
+
     val.i_int |= CocoaKeyToVLC( key );
 
     for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
index 942bfa60004e915f1cd52eb7e7f8a8021910ea16..9e8cc4b41d8bc6547e065518708db9f7b5ce884a 100644 (file)
@@ -51,6 +51,7 @@
 - (void)initStrings;
 
 - (void)playlistUpdated;
+- (void)playItem:(id)sender;
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
 @end
index da2ce700beb8ce82712661f080cbd5418c93374e..76b9e7f2357af55e4fcfc7f2be0da40a2773a9d5 100644 (file)
 
 /* TODO
  * connect delegates, actions and outlets in IB
- * implement play by double click
  * implement delete by backspace
  * implement playlist item rightclick menu
  * implement sorting
- * reconnect menu items etc
- * add 'icons' for different types of nodes?
+ * add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
  * create a new 'playlist toggle' that hides the playlist and in effect give you the old controller
  * create a new search field build with pictures from the 'regular' search field, so it can be emulated on 10.2
  * create toggle buttons for the shuffle, repeat one, repeat all functions.
@@ -76,7 +74,7 @@
 
     playlist_t * p_playlist;
     intf_thread_t * p_intf = VLCIntf;
-
+msg_Dbg( p_intf, "KEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
     if( [[o_event characters] length] )
     {
         key = [[o_event characters] characterAtIndex: 0];
                 o_number = [o_to_delete lastObject];
                 i_row = [o_number intValue];
 
-                if( p_playlist->i_index == i_row && p_playlist->status.i_status )
+                if( p_playlist->status.p_item == [[self itemAtRow: i_row] pointerValue] && p_playlist->status.i_status )
                 {
                     playlist_Stop( p_playlist );
                 }
                 [o_to_delete removeObject: o_number];
                 [self deselectRow: i_row];
-                playlist_Delete( p_playlist, i_row );
+                playlist_ItemDelete( [[self itemAtRow: i_row] pointerValue] );
             }
-            [self reloadData];
             break;
 
         default:
     [o_outline_view setDelegate: self];
     [o_outline_view setDataSource: self];
 
-    //[o_outline_view setDoubleAction: @selector(playItem:)];
+    [o_outline_view setDoubleAction: @selector(playItem:)];
 
     [o_outline_view registerForDraggedTypes: 
         [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
@@ -212,6 +209,24 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     [o_outline_view reloadData];
 }
 
+- (IBAction)playItem:(id)sender
+{
+    intf_thread_t * p_intf = VLCIntf;
+    playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                       FIND_ANYWHERE );
+
+    if( p_playlist != NULL )
+    {
+        playlist_item_t *p_item;
+        playlist_view_t *p_view;
+        p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
+        p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
+        
+        if( p_item )
+            playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VIEW_SIMPLE, p_view ? p_view->p_root : NULL, p_item );
+        vlc_object_release( p_playlist );
+    }
+}
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
 {