]> git.sesse.net Git - vlc/commitdiff
* fix the search field and cleanup of the checkboxes init.
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 17 Nov 2003 19:05:03 +0000 (19:05 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 17 Nov 2003 19:05:03 +0000 (19:05 +0000)
  - currently we don't seek in playlist position 0->currently selected
    wxwindows doesn't do this either.
  - bigben: for the state of the checkboxes look at callbacks (see playlistChanged in intf.m)

modules/gui/macosx/playlist.m

index a1b92906f5fc643c102d57a1a641ff6bfdb82068..f60b09c30a50574bfdf69beb160bb45c734921e6 100644 (file)
@@ -2,7 +2,7 @@
  * playlist.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: playlist.m,v 1.41 2003/11/17 14:11:05 bigben Exp $
+ * $Id: playlist.m,v 1.42 2003/11/17 19:05:03 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
                                                        FIND_ANYWHERE );
     if( p_playlist != NULL )
     {
-    int i_state;
+        var_Get( p_playlist, "random", &val );
+        [o_random_ckb setState: val.b_bool];
 
-    var_Get( p_playlist, "random", &val );
-    i_state = val.b_bool ? NSOnState : NSOffState;
-    [o_random_ckb setState: i_state];
+        var_Get( p_playlist, "loop", &val );
+        [o_loop_ckb setState: val.b_bool];
 
-    var_Get( p_playlist, "loop", &val );
-    i_state = val.b_bool ? NSOnState : NSOffState;
-    [o_loop_ckb setState: i_state];
+        var_Get( p_playlist, "repeat", &val );
+        [o_repeat_ckb setState: val.b_bool];
 
-    var_Get( p_playlist, "repeat", &val );
-    i_state = val.b_bool ? NSOnState : NSOffState;
-    [o_repeat_ckb setState: i_state];
-
-    vlc_mutex_unlock( &p_playlist->object_lock );
-    vlc_object_release( p_playlist );
+        vlc_object_release( p_playlist );
     }
 
 
 
 - (IBAction)searchItem:(id)sender
 {
-    int i_start;
-    int i_current;
-    id o_current_name;
+    int i_start, i_current;
+    NSString *o_current_name;
+    NSString *o_current_author;
 
     intf_thread_t * p_intf = [NSApp getIntf];
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                FIND_ANYWHERE );
+    
+    if( p_playlist == NULL )
+    {
+        return;
+    }
+
     if ( [o_table_view selectedRow] == [o_table_view numberOfRows]-1 )
     {
          i_start = -1;
 
     for ( i_current = i_start + 1 ; i_current < [o_table_view numberOfRows] ; i_current++ )
     {
+        vlc_mutex_lock( &p_playlist->object_lock );
+        o_current_name = [NSString stringWithUTF8String: 
+            p_playlist->pp_items[i_current]->psz_name];
+        o_current_author = [NSString stringWithUTF8String: 
+            p_playlist->pp_items[i_current]->psz_author];
+        vlc_mutex_unlock( &p_playlist->object_lock );
 
-        if( p_playlist == NULL )
-        {
-            o_current_name = nil;
-        }
-
-
-        else 
-        {
-            vlc_mutex_lock( &p_playlist->object_lock );
-            o_current_name = [[NSString stringWithUTF8String: 
-                p_playlist->pp_items[i_current]->psz_name] lastPathComponent]; 
-            vlc_mutex_unlock( &p_playlist->object_lock );
-        }
-
-        if( [o_current_name rangeOfString:[o_search_keyword stringValue] options:NSCaseInsensitiveSearch ].length )
+        if( [o_current_name rangeOfString:[o_search_keyword stringValue] options:NSCaseInsensitiveSearch ].length ||
+             [o_current_author rangeOfString:[o_search_keyword stringValue] options:NSCaseInsensitiveSearch ].length )
         {
              [o_table_view selectRow: i_current byExtendingSelection: NO];
              [o_table_view scrollRowToVisible: i_current];
              break;
         }
-    [o_table_view selectRow: i_current byExtendingSelection: NO];
-    [o_table_view scrollRowToVisible: i_current];
+        [o_table_view selectRow: i_start byExtendingSelection: NO];
+        [o_table_view scrollRowToVisible: i_start];
     }
     vlc_object_release( p_playlist );
 }