]> git.sesse.net Git - vlc/commitdiff
* modules/gui/macosx/controls.m:
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 30 Jun 2003 01:51:10 +0000 (01:51 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 30 Jun 2003 01:51:10 +0000 (01:51 +0000)
* modules/gui/macosx/intf.m:
  - Our Next/Previous commands now go from chapter trough title trough playlist.
  - We weren't checking for titles without chapters, which made using CDDA
    a little hard.
* modules/gui/macosx/playlist.m: An improved way to delete selected items.
  - also fixes a bug where only half the items selected in the playlist got
    actually deleted.

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

index 383bcec2803a355d9302e4dedc4175f55596d92d..158cd6e299ec2c3922e66e89de020aae20e54d9e 100644 (file)
@@ -2,7 +2,7 @@
  * controls.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: controls.m,v 1.41 2003/06/03 22:21:46 hartman Exp $
+ * $Id: controls.m,v 1.42 2003/06/30 01:51:10 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
 
 - (IBAction)prev:(id)sender
 {
+    vlc_value_t val;
     intf_thread_t * p_intf = [NSApp getIntf];
 
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
     vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
 
 #define p_area p_playlist->p_input->stream.p_selected_area
-
-    if( p_area->i_part_nb > 1 && p_area->i_part > 1 )
+NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
+    if( p_area->i_part > 0 && p_area->i_part_nb > 1)
     {
-        p_area->i_part--;
+        NSLog(@"Prev Chap");
+        vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
+        vlc_mutex_unlock( &p_playlist->object_lock );
+        var_Get( p_playlist->p_input, "prev-chapter", &val );
+        var_Set( p_playlist->p_input, "prev-chapter", val );
 
+        p_intf->p_sys->b_input_update = VLC_TRUE;
+    }
+    else if( p_area->i_id > 1 )
+    {
+        NSLog(@"Prev Title");
         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
-        input_ChangeArea( p_playlist->p_input, p_area );
         vlc_mutex_unlock( &p_playlist->object_lock );
+        var_Get( p_playlist->p_input, "prev-title", &val );
+        var_Set( p_playlist->p_input, "prev-title", val );
 
         p_intf->p_sys->b_input_update = VLC_TRUE;
     }
     else
     {
+        NSLog(@"Prev PlaylistItem");
         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
         vlc_mutex_unlock( &p_playlist->object_lock );
         playlist_Prev( p_playlist );
     }
-
+NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
 #undef p_area
 
     vlc_object_release( p_playlist );
 
 - (IBAction)next:(id)sender
 {
+    vlc_value_t val;
     intf_thread_t * p_intf = [NSApp getIntf];
 
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
     {
         return;
     }
-
+    
     vlc_mutex_lock( &p_playlist->object_lock );
 
     if( p_playlist->p_input == NULL )
     vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
 
 #define p_area p_playlist->p_input->stream.p_selected_area
-
-    if( p_area->i_part_nb > 1 && p_area->i_part + 1 < p_area->i_part_nb )
+NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
+    if( p_area->i_part < p_area->i_part_nb && p_area->i_part_nb > 1 )
     {
-        p_area->i_part++;
+        NSLog(@"Next Chap");
+        vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
+        vlc_mutex_unlock( &p_playlist->object_lock );
+        var_Get( p_playlist->p_input, "next-chapter", &val );
+        var_Set( p_playlist->p_input, "next-chapter", val );
 
+        p_intf->p_sys->b_input_update = VLC_TRUE;
+    }
+    else if( p_area->i_id < p_playlist->p_input->stream.i_area_nb )
+    {
+        NSLog(@"Next Title");
         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
-        input_ChangeArea( p_playlist->p_input, p_area );
         vlc_mutex_unlock( &p_playlist->object_lock );
+        var_Get( p_playlist->p_input, "next-title", &val );
+        var_Set( p_playlist->p_input, "next-title", val );
 
         p_intf->p_sys->b_input_update = VLC_TRUE;
     }
     else
     {
+        NSLog(@"Next PlaylistItem");
         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
         vlc_mutex_unlock( &p_playlist->object_lock );
         playlist_Next( p_playlist );
     }
-
+NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
 #undef p_area
 
     vlc_object_release( p_playlist );
             if( p_input != NULL )
             {
                 vlc_mutex_lock( &p_input->stream.stream_lock );
-                bEnabled |= p_input->stream.p_selected_area->i_part_nb > 1;
+                bEnabled |= p_input->stream.i_area_nb > 1;
                 vlc_mutex_unlock( &p_input->stream.stream_lock );
             }
         }
index c02b334ace954daabf3238e59c94e4f8b4e0a919..d3d609fdcd5a484e81f35c95eb6e6f314ac25848 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.90 2003/06/17 14:43:22 hartman Exp $
+ * $Id: intf.m,v 1.91 2003/06/30 01:51:10 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -669,8 +669,8 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
             /* control buttons for free pace streams */
             b_control = p_input->stream.b_pace_control; 
 
-            /* chapters */
-            b_chapters = p_input->stream.p_selected_area->i_part_nb > 1; 
+            /* chapters & titles */
+            b_chapters = p_input->stream.i_area_nb > 1; 
 
             /* play status */
             p_intf->p_sys->b_play_status = 
index 0d6cdc04f6e8b5fcf0de845df5e9ffb4334f637a..0b5138af8c8bdb3d6352cb25756feb74caceee8d 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.26 2003/06/29 00:14:50 hartman Exp $
+ * $Id: playlist.m,v 1.27 2003/06/30 01:51:10 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
@@ -57,7 +57,10 @@ int MacVersion102 = -1;
 - (void)keyDown:(NSEvent *)o_event
 {
     unichar key = 0;
-    int i_row;
+    int i, c, i_row;
+    NSMutableArray *o_to_delete;
+    NSNumber *o_number;
+    
     playlist_t * p_playlist;
     intf_thread_t * p_intf = [NSApp getIntf];
 
@@ -89,16 +92,20 @@ int MacVersion102 = -1;
         case NSDeleteFunctionKey:
         case NSDeleteCharFunctionKey:
         case NSBackspaceCharacter:
-            while( ( i_row = [self selectedRow] ) != -1 )
-            {
+            o_to_delete = [NSMutableArray arrayWithArray:[[self selectedRowEnumerator] allObjects]];
+            c = [o_to_delete count];
+            
+            for( i = 0; i < c; i++ ) {
+                o_number = [o_to_delete lastObject];
+                i_row = [o_number intValue];
+                
                 if( p_playlist->i_index == i_row && p_playlist->i_status )
                 {
                     playlist_Stop( p_playlist );
                 }
-        
-                playlist_Delete( p_playlist, i_row ); 
-        
+                [o_to_delete removeObject: o_number];
                 [self deselectRow: i_row];
+                playlist_Delete( p_playlist, i_row );
             }
             [self reloadData];
             break;
@@ -236,7 +243,9 @@ int MacVersion102 = -1;
 
 - (IBAction)deleteItems:(id)sender
 {
-    int i_row;
+    int i, c, i_row;
+    NSMutableArray *o_to_delete;
+    NSNumber *o_number;
 
     intf_thread_t * p_intf = [NSApp getIntf];
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
@@ -246,17 +255,21 @@ int MacVersion102 = -1;
     {
         return;
     }
-
-    while( ( i_row = [o_table_view selectedRow] ) != -1 )
-    {
+    
+    o_to_delete = [NSMutableArray arrayWithArray:[[o_table_view selectedRowEnumerator] allObjects]];
+    c = [o_to_delete count];
+    
+    for( i = 0; i < c; i++ ) {
+        o_number = [o_to_delete lastObject];
+        i_row = [o_number intValue];
+        
         if( p_playlist->i_index == i_row && p_playlist->i_status )
         {
             playlist_Stop( p_playlist );
         }
-
-        playlist_Delete( p_playlist, i_row ); 
-
+        [o_to_delete removeObject: o_number];
         [o_table_view deselectRow: i_row];
+        playlist_Delete( p_playlist, i_row );
     }
 
     vlc_object_release( p_playlist );