]> git.sesse.net Git - vlc/commitdiff
* Fix display of playlist on OSX. Looks briljant :)
authorDerk-Jan Hartman <hartman@videolan.org>
Wed, 17 Nov 2004 20:03:00 +0000 (20:03 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Wed, 17 Nov 2004 20:03:00 +0000 (20:03 +0000)
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/intf.m
modules/gui/macosx/playlist.h
modules/gui/macosx/playlist.m
modules/gui/macosx/vout.m

index 5caff8cc3997f4971019b1d4c527482f806758e8..fb3e98a80b340794d726901334af1b52f71aea30 100644 (file)
             SUPERCLASS = NSObject; 
         }, 
         {
-            ACTIONS = {}; 
             CLASS = VLCPlaylist; 
             LANGUAGE = ObjC; 
-            OUTLETS = {}; 
+            OUTLETS = {
+                "o_btn_playlist" = id; 
+                "o_outline_view" = id; 
+                "o_search_field" = id; 
+                "o_status_field" = id; 
+                "o_tc_author" = id; 
+                "o_tc_duration" = id; 
+                "o_tc_name" = id; 
+            }; 
             SUPERCLASS = NSObject; 
         }, 
         {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }, 
index c5b710a4579bdbaa5c36ca82974c78df04f18b78..3e3fc961f52599a387d3bf0e1b4067b06a72939e 100644 (file)
@@ -3,13 +3,13 @@
 <plist version="1.0">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>726 239 505 517 0 0 1280 938 </string>
+       <string>852 421 505 517 0 0 1280 938 </string>
        <key>IBEditorPositions</key>
        <dict>
                <key>1617</key>
                <string>542 480 104 149 0 0 1024 746 </string>
                <key>2197</key>
-               <string>9 51 596 368 0 0 1280 938 </string>
+               <string>150 134 596 368 0 0 1280 938 </string>
                <key>29</key>
                <string>58 849 419 44 0 0 1280 938 </string>
                <key>915</key>
                <integer>2206</integer>
                <integer>2208</integer>
                <integer>2202</integer>
-               <integer>2204</integer>
                <integer>2203</integer>
        </array>
        <key>IBOpenObjects</key>
        <array>
-               <integer>2197</integer>
                <integer>21</integer>
+               <integer>2197</integer>
        </array>
        <key>IBSystem Version</key>
        <string>7R28</string>
index 1d242d7bf18fa90846085745e7f8a29d40db4ed3..38048351c6ff3873c83e1078265891d10a0e506c 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 d2cd62309d827cb8458a760d6b4ccb692d149dbb..6e010dbbc504f870baa22b975181a62317fd9893 100644 (file)
@@ -836,7 +836,7 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     if ( p_intf->p_sys->b_playlist_update )
     {
-       [o_playlist playlistUpdated];
+        [o_playlist playlistUpdated];
         p_intf->p_sys->b_playlist_update = VLC_FALSE;
     }
 
@@ -867,16 +867,14 @@ static VLCMain *_o_sharedMainInstance = nil;
             {
                 return;
             }
-
-            vlc_mutex_lock( &p_playlist->object_lock );
+#if 0
             o_temp = [NSString stringWithUTF8String:
                 p_playlist->p_input.psz_name];
             if( o_temp == NULL )
                 o_temp = [NSString stringWithCString:
                     p_playlist->p_input.psz_name];
-            vlc_mutex_unlock( &p_playlist->object_lock );
             [o_scrollfield setStringValue: o_temp ];
-
+#endif
 
             p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
                                                     FIND_ANYWHERE );
@@ -894,7 +892,7 @@ static VLCMain *_o_sharedMainInstance = nil;
                 }
                 vlc_object_release( (vlc_object_t *)p_vout );
             }
-            [o_playlist updateRowSelection];
+            //[o_playlist updateRowSelection];
             vlc_object_release( p_playlist );
             p_intf->p_sys->b_current_title_update = FALSE;
         }
index 39617ef5b456f045b2a0f1c411bf4bce5e2437b4..942bfa60004e915f1cd52eb7e7f8a8021910ea16 100644 (file)
 {
     IBOutlet id o_btn_playlist;
     IBOutlet id o_outline_view;
+    IBOutlet id o_tc_name;
+    IBOutlet id o_tc_author;
+    IBOutlet id o_tc_duration;
+    IBOutlet id o_status_field;
+    IBOutlet id o_search_field;
+    
+    NSImage *o_descendingSortingImage;
+    NSImage *o_ascendingSortingImage;
 }
 
 - (void)initStrings;
 
+- (void)playlistUpdated;
+
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
 @end
 
index a0cfafe11b3492d87a57853e6dfa357e8bea19b9..da2ce700beb8ce82712661f080cbd5418c93374e 100644 (file)
     self = [super init];
     if ( self !=nil )
     {
-        i_moveRow = -1;
+        //i_moveRow = -1;
     }
     return self;
 }
 /* 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( [[NSOutlineView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)] )
     {
-        o_ascendingSortingImage = [[NSTableView class] _defaultTableHeaderSortImage];
+        o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
     }
     else
     {
         o_ascendingSortingImage = nil;
     }
 
-    if( [[NSTableView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)] )
+    if( [[NSOutlineView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)] )
     {
-        o_descendingSortingImage = [[NSTableView class] _defaultTableHeaderReverseSortImage];
+        o_descendingSortingImage = [[NSOutlineView class] _defaultTableHeaderReverseSortImage];
     }
     else
     {
@@ -177,13 +177,12 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 
     [self initStrings];
-    [self playlistUpdated];
+    //[self playlistUpdated];
 }
 
 - (void)initStrings
 {
 #if 0
-    [o_window setTitle: _NS("Playlist")];
     [o_mi_save_playlist setTitle: _NS("Save Playlist...")];
     [o_mi_play setTitle: _NS("Play")];
     [o_mi_delete setTitle: _NS("Delete")];
@@ -192,19 +191,26 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     [o_mi_enableGroup setTitle: _NS("Enable all group items")];
     [o_mi_disableGroup setTitle: _NS("Disable all group items")];
     [o_mi_info setTitle: _NS("Properties")];
-
+#endif
     [[o_tc_name headerCell] setStringValue:_NS("Name")];
     [[o_tc_author headerCell] setStringValue:_NS("Author")];
     [[o_tc_duration headerCell] setStringValue:_NS("Duration")];
+#if 0
     [o_random_ckb setTitle: _NS("Random")];
     [o_search_button setTitle: _NS("Search")];
+#endif
     [o_btn_playlist setToolTip: _NS("Playlist")];
+#if 0    
     [[o_loop_popup itemAtIndex:0] setTitle: _NS("Standard Play")];
     [[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")];
     [[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")];
 #endif
 }
 
+- (void)playlistUpdated
+{
+    [o_outline_view reloadData];
+}
 
 
 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
@@ -315,7 +321,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     {
         /* root object */
         playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
+        p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
         if( p_view && p_view->p_root )
             i_return = p_view->p_root->i_children;
     }
@@ -327,23 +333,24 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
     vlc_object_release( p_playlist );
     if( i_return == -1 ) i_return = 0;
+    msg_Dbg( p_playlist, "I have %d children", i_return );
     return i_return;
 }
 
 /* return the child at index for the Obj-C pointer item */ /* DONE */
 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
 {
-    playlist_item *p_return = NULL;
+    playlist_item_t *p_return = NULL;
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
                                                        FIND_ANYWHERE );
     if( p_playlist == NULL )
-        return 0;
+        return nil;
 
     if( item == nil )
     {
         /* root object */
         playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
+        p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
         if( p_view && index < p_view->p_root->i_children )
             p_return = p_view->p_root->pp_children[index];
     }
@@ -357,7 +364,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
 
     vlc_object_release( p_playlist );
-    return [NSValue valueWithPointer: p_return];
+    msg_Dbg( p_playlist, "childitem with index %d", index );
+    return [[NSValue valueWithPointer: p_return] retain];
 }
 
 /* is the item expandable */
@@ -367,13 +375,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
                                                        FIND_ANYWHERE );
     if( p_playlist == NULL )
-        return 0;
+        return NO;
 
     if( item == nil )
     {
         /* root object */
         playlist_view_t *p_view;
-        p_view = playlist_ViewFind( p_playlist, VIEW_CATEGORY );
+        p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
         if( p_view && p_view->p_root )
             i_return = p_view->p_root->i_children;
     }
@@ -385,24 +393,24 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     }
     vlc_object_release( p_playlist );
 
-    if( i_return == -1 )
+    if( i_return == -1 || i_return == 0 )
         return NO;
     else
         return YES;
 }
 
 /* retrieve the string values for the cells */
-- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
+- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)o_tc byItem:(id)item
 {
     id o_value = nil;
     intf_thread_t * p_intf = VLCIntf;
     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                                FIND_ANYWHERE );
-    playlist_item_t * p_item = [item pointerValue];
+    playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
 
     if( p_playlist == NULL || p_item == NULL )
     {
-        return( nil );
+        return( @"error" );
     }
 
     if( [[o_tc identifier] isEqualToString:@"1"] )
@@ -416,7 +424,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
     else if( [[o_tc identifier] isEqualToString:@"2"] )
     {
         char *psz_temp;
-        psz_temp = playlist_GetInfo( p_item ,_("Meta-information"),_("Artist") );
+        psz_temp = playlist_ItemGetInfo( p_item ,_("Meta-information"),_("Artist") );
 
         if( psz_temp == NULL )
             o_value = @"";
index 0b1267aa66282e79bff906ab025b93ad982e3a5f..580d2f9f1f523a5e3e6cdab6fac793f95a81984a 100644 (file)
 
     vlc_mutex_lock( &p_playlist->object_lock );
     o_title = [NSMutableString stringWithUTF8String: 
-        p_playlist->p_input.psz_uri]; 
+        p_playlist->status.p_item->input.psz_uri]; 
     vlc_mutex_unlock( &p_playlist->object_lock );
     vlc_object_release( p_playlist );