]> git.sesse.net Git - vlc/commitdiff
* Added sortID
authorDerk-Jan Hartman <hartman@videolan.org>
Fri, 6 Feb 2004 04:51:02 +0000 (04:51 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Fri, 6 Feb 2004 04:51:02 +0000 (04:51 +0000)
* Fixed adding multiple items
* playlist API changes fixes
* fixed options

extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m

index 12357b904a5e083da12530793ebf04e1c6673fd9..cd25d2bcb7977dc5771eb0f71d4f04a24e11494b 100644 (file)
                 "o_table_view" = id; 
                 "o_tc_author" = id; 
                 "o_tc_duration" = id; 
+                "o_tc_id" = id; 
                 "o_tc_name" = id; 
                 "o_window" = id; 
             }; 
index 2e0734c49d84b28ce2da439c756fb5ca573c8cb2..288375aef0f45fd6b08140937f3fa644f8d9bcac 100644 (file)
        <array/>
        <key>IBOpenObjects</key>
        <array>
-               <integer>1647</integer>
-               <integer>1617</integer>
-               <integer>984</integer>
                <integer>21</integer>
+               <integer>984</integer>
+               <integer>1617</integer>
+               <integer>1647</integer>
        </array>
        <key>IBSystem Version</key>
        <string>7D24</string>
index b7b18378aa3e4a91a54e463b098cc73cef8cce4e..68635da834c986ebe6cf0b64e5ce1ed871a4eaf8 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index 08e8e79fc3d391516fa0b6ea4ad321461e8c359f..346ac1e3d6199ca364db8dfb66f8985d508e6aa6 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.h: MacOS X interface module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
- * $Id: playlist.h,v 1.20 2004/01/25 17:01:57 murray Exp $
+ * $Id: playlist.h,v 1.21 2004/02/06 04:51:02 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <hartman at videolan dot org>
@@ -44,6 +44,7 @@
     IBOutlet id o_table_view;
     
     IBOutlet id o_status_field;
+    IBOutlet id o_tc_id;
     IBOutlet id o_tc_name;
     IBOutlet id o_tc_author;
     IBOutlet id o_tc_duration;
index 90df9a1b14aa7019cf0ab92d4a0bd31c72112341..08ee6206be64153c8e826105662500cd69c251be 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface module
  *****************************************************************************
  * Copyright (C) 2002-2004 VideoLAN
- * $Id: playlist.m,v 1.55 2004/01/25 17:01:57 murray Exp $
+ * $Id: playlist.m,v 1.56 2004/02/06 04:51:02 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <hartman at videolan dot org>
 /* We need to check whether _defaultTableHeaderSortImage exists, since it 
 belongs to an Apple hidden private API, and then can "disapear" at any time*/
 
-    if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)])
+    if( [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)] )
     {
-    o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage];
+        o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage];
     }
     else
     {
-    o_ascendingSortingImage = nil;
+        o_ascendingSortingImage = nil;
     }
 
-    if ([[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)])
+    if( [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)] )
     {
         o_descendingSortingImage = [[NSTableView class] _defaultTableHeaderReverseSortImage];
     }
@@ -192,39 +192,50 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
         return;
     }
 
-    if (o_tc_sortColumn == o_tc )
+    ifo_tc_sortColumn == o_tc )
     { 
         b_isSortDescending = !b_isSortDescending;
     }
-    else if (o_tc == o_tc_name || o_tc == o_tc_author)
+    else if( o_tc == o_tc_name || o_tc == o_tc_author || 
+        o_tc == o_tc_id )
     {
         b_isSortDescending = VLC_FALSE;
         [o_table_view setHighlightedTableColumn:o_tc];
         o_tc_sortColumn = o_tc;
-        for (i=0;i<max;i++)
+        for( i=0 ; i<max ; i++ )
         {
             [o_table_view setIndicatorImage:nil inTableColumn:[[o_table_view tableColumns] objectAtIndex:i]];
         }
     }
 
-    if (o_tc_name == o_tc && !b_isSortDescending)
+    if( o_tc_id == o_tc && !b_isSortDescending )
     {    
-        playlist_SortTitle( p_playlist , 0 );
+        playlist_SortID( p_playlist , ORDER_NORMAL );
         [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];    
     }
-    else if (o_tc_author == o_tc && !b_isSortDescending)
+    else if( o_tc_name == o_tc && !b_isSortDescending )
+    {    
+        playlist_SortTitle( p_playlist , ORDER_NORMAL );
+        [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];    
+    }
+    else if( o_tc_author == o_tc && !b_isSortDescending )
     {
-        playlist_SortAuthor( p_playlist , 0 );
+        playlist_SortAuthor( p_playlist , ORDER_NORMAL );
         [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];
     }
-    else if (o_tc_name == o_tc && b_isSortDescending)
+    else if( o_tc_id == o_tc && b_isSortDescending )
+    {    
+        playlist_SortID( p_playlist , ORDER_REVERSE );
+        [o_table_view setIndicatorImage:o_ascendingSortingImage inTableColumn:o_tc];    
+    }
+    else if( o_tc_name == o_tc && b_isSortDescending )
     {    
-        playlist_SortTitle( p_playlist , 1 );
+        playlist_SortTitle( p_playlist , ORDER_REVERSE );
         [o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc];
     }
-    else if (o_tc_author == o_tc && b_isSortDescending)
+    else if( o_tc_author == o_tc && b_isSortDescending )
     {
-        playlist_SortAuthor( p_playlist , 1 );
+        playlist_SortAuthor( p_playlist , ORDER_REVERSE );
         [o_table_view setIndicatorImage:o_descendingSortingImage inTableColumn:o_tc];
     } 
     vlc_object_release( p_playlist );
@@ -423,12 +434,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     {
         /* One item */
         NSDictionary *o_one_item;
-        int j, i_new_id = -1;
+        int j, i_total_options = 0, i_new_id = -1;
         int i_mode = PLAYLIST_INSERT;
         BOOL b_rem = FALSE, b_dir = FALSE;
         NSString *o_uri, *o_name;
         NSArray *o_options;
         NSURL *o_true_file;
+        char **ppsz_options = NULL;
     
         /* Get the item */
         o_one_item = [o_array objectAtIndex: i_item];
@@ -455,28 +467,33 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             psz_dev[temp - psz_dev] = '\0';
             o_uri = [NSString stringWithCString: psz_dev ];
         }
-        
-        /* Add the item */
-        i_new_id = playlist_Add( p_playlist, [o_uri fileSystemRepresentation], 
-                      [o_name UTF8String], i_mode, 
-                      i_position == -1 ? PLAYLIST_END : i_position + i_item);
-        
-        /* Add the options, when there are any */
-        if( o_options )
+
+        if( o_options && [o_options count] > 0 )
         {
-            for( j = 0; j < [o_options count]; j++ )
+            /* Count the input options */
+            i_total_options = [o_options count];
+    
+            /* Allocate ppsz_options */
+            for( j = 0; j < i_total_options; j++ )
             {
-                playlist_AddOption( p_playlist, i_new_id,
-                 strdup( [[o_options objectAtIndex:j] UTF8String] ) );
+                if( !ppsz_options )
+                    ppsz_options = (char **)malloc( sizeof(char *) * i_total_options );
+    
+                ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
             }
         }
-        
-        if( i_item == 0 && !b_enqueue )
-        {
-            playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) );
-            playlist_Play( p_playlist );
-        }
-    
+
+        /* Add the item */
+        i_new_id = playlist_AddExt( p_playlist, [o_uri fileSystemRepresentation], 
+                      [o_name UTF8String], i_mode, 
+                      i_position == -1 ? PLAYLIST_END : i_position + i_item,
+                      0, (ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options );
+
+        /* clean up 
+        for( j = 0; j < i_total_options; j++ )
+            free( ppsz_options[j] );
+        if( ppsz_options ) free( ppsz_options ); */
+
         /* Recent documents menu */
         o_true_file = [NSURL fileURLWithPath: o_uri];
         if( o_true_file != nil )
@@ -484,6 +501,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
             [[NSDocumentController sharedDocumentController]
                 noteNewRecentDocumentURL: o_true_file]; 
         }
+        
+        if( i_item == 0 && !b_enqueue )
+        {
+            playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) );
+            playlist_Play( p_playlist );
+        }
     }
 
     vlc_object_release( p_playlist );