Commit 8be1fcea authored by Benjamin Pracht's avatar Benjamin Pracht

* playlist.* support for DnD from Finder

* BUGS: remove OSX playlist (anyone sees some more issue here readd it with a description...)
parent b9491a09
......@@ -7,12 +7,12 @@ Feel free to work on these :)
Regressions from previous versions
----------------------------------
*** OS X preferences
*** OS X playlist
*** OS X resampler
* CDDAX
** Playlist : previous item sometimes doesn't get any item, or an item
** Playlist : the "previous item" action sometimes doesn't get any item, or an item
at the other edge of the playlist, when at the beginning of a node
* Sort by Author unimplemented
*** wxWindows : Play button state
......
......@@ -97,6 +97,7 @@
- (IBAction)sortNodeByAuthor:(id)sender;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position inView:(int)i_view enqueue:(BOOL)b_enqueue;
- (playlist_item_t *)selectedPlaylistItem;
......
/*****************************************************************************
* playlist.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 VideoLAN
* Copyright (C) 2002-2005 VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -543,22 +543,16 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
[self playlistUpdated];
}
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
- (playlist_item_t *)createItem:(NSDictionary *)o_one_item
{
int i_item;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
return NULL;
}
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{
/* One item */
NSDictionary *o_one_item;
playlist_item_t *p_item;
int i;
BOOL b_rem = FALSE, b_dir = FALSE;
......@@ -567,7 +561,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
NSURL *o_true_file;
/* Get the item */
o_one_item = [o_array objectAtIndex: i_item];
o_uri = (NSString *)[o_one_item objectForKey: @"ITEM_URL"];
o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
......@@ -620,7 +613,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
p_item = playlist_ItemNew( p_intf, [o_uri fileSystemRepresentation], [o_name UTF8String] );
if( !p_item )
continue;
return NULL;
if( o_options )
{
......@@ -630,9 +623,6 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
}
}
/* Add the item */
playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, i_position == -1 ? PLAYLIST_END : i_position + i_item );
/* Recent documents menu */
o_true_file = [NSURL fileURLWithPath: o_uri];
if( o_true_file != nil )
......@@ -641,13 +631,77 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
noteNewRecentDocumentURL: o_true_file];
}
vlc_object_release( p_playlist );
return p_item;
}
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{
int i_item;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{
playlist_item_t *p_item;
NSDictionary *o_one_item;
/* Get the item */
o_one_item = [o_array objectAtIndex: i_item];
p_item = [self createItem: o_one_item];
if( !p_item )
{
continue;
}
/* Add the item */
playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, i_position == -1 ? PLAYLIST_END : i_position + i_item );
if( i_item == 0 && !b_enqueue )
{
playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
}
}
vlc_object_release( p_playlist );
}
- (void)appendNodeArray:(NSArray*)o_array inNode:(playlist_item_t *)p_node atPos:(int)i_position inView:(int)i_view enqueue:(BOOL)b_enqueue
{
int i_item;
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( i_item = 0; i_item < (int)[o_array count]; i_item++ )
{
playlist_item_t *p_item;
NSDictionary *o_one_item;
/* Get the item */
o_one_item = [o_array objectAtIndex: i_item];
p_item = [self createItem: o_one_item];
if( !p_item )
{
continue;
}
/* Add the item */
playlist_NodeAddItem( p_playlist, p_item, i_view, p_node, PLAYLIST_APPEND, i_position + i_item );
if( i_item == 0 && !b_enqueue )
{
playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
}
}
vlc_object_release( p_playlist );
}
- (IBAction)handlePopUp:(id)sender
......@@ -1132,14 +1186,92 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
/* Required for drag & drop and reordering */
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
{
/* unsigned int i;
for( i = 0 ; i < [items count] ; i++ )
{
if( [outlineView levelForItem: [items objectAtIndex: i]] == 0 )
{
return NO;
}
}*/
return NO;
}
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
{
NSPasteboard *o_pasteboard = [info draggingPasteboard];
if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
{
return NSDragOperationGeneric;
}
return NSDragOperationNone;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(int)index
{
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
NSPasteboard *o_pasteboard = [info draggingPasteboard];
if( !p_playlist ) return NO;
if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
{
int i;
playlist_item_t *p_node = [item pointerValue];
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_pasteboard propertyListForType:
NSFilenamesPboardType]
sortedArrayUsingSelector:
@selector(caseInsensitiveCompare:)];
for( i = 0; i < (int)[o_values count]; i++)
{
NSDictionary *o_dic;
o_dic = [NSDictionary dictionaryWithObject:[o_values
objectAtIndex:i] forKey:@"ITEM_URL"];
o_array = [o_array arrayByAddingObject: o_dic];
}
if ( item == nil )
{
[self appendArray: o_array atPos: index enqueue: YES];
}
else if( p_node->i_children == -1 )
{
int i_counter;
playlist_item_t *p_real_node = NULL;
for( i_counter = 0 ; i_counter < p_node->i_parents ; i_counter++ )
{
if( p_node->pp_parents[i_counter]->i_view == i_current_view )
{
p_real_node = p_node->pp_parents[i_counter]->p_parent;
break;
}
if( i_counter == p_node->i_parents )
{
return NO;
}
}
[self appendNodeArray: o_array inNode: p_real_node
atPos: index inView: i_current_view enqueue: YES];
}
else
{
[self appendNodeArray: o_array inNode: p_node
atPos: index inView: i_current_view enqueue: YES];
}
vlc_object_release( p_playlist );
return YES;
}
vlc_object_release( p_playlist );
return NO;
}
/* Delegate method of NSWindow */
/*- (void)windowWillClose:(NSNotification *)aNotification
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment