Commit 3ff30fa9 authored by Benjamin Pracht's avatar Benjamin Pracht

* Some fixes

* Store object to move in the class itself, since I just don't manage to deal with NSPasteboards...
parent 06ba8929
...@@ -70,6 +70,8 @@ ...@@ -70,6 +70,8 @@
NSImage *o_descendingSortingImage; NSImage *o_descendingSortingImage;
NSImage *o_ascendingSortingImage; NSImage *o_ascendingSortingImage;
NSMutableArray *o_nodes_array;
NSMutableArray *o_items_array;
NSMutableDictionary *o_outline_dict; NSMutableDictionary *o_outline_dict;
BOOL b_selected_item_met; BOOL b_selected_item_met;
......
...@@ -103,6 +103,10 @@ ...@@ -103,6 +103,10 @@
if ( self != nil ) if ( self != nil )
{ {
o_outline_dict = [[NSMutableDictionary alloc] init]; o_outline_dict = [[NSMutableDictionary alloc] init];
o_nodes_array = [[NSMutableArray alloc] init];
o_items_array = [[NSMutableArray alloc] init];
//i_moveRow = -1; //i_moveRow = -1;
} }
return self; return self;
...@@ -365,6 +369,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -365,6 +369,8 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
return NO; return NO;
} }
if( p_node == p_item ) return YES;
if ( p_temp_item ) if ( p_temp_item )
{ {
int i; int i;
...@@ -1353,14 +1359,11 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -1353,14 +1359,11 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
unsigned int i,j; unsigned int i,j;
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
NSMutableArray *o_nodes_array = [NSMutableArray array];
NSMutableArray *o_items_array = [NSMutableArray array];
NSMutableArray *o_objects_array = [NSMutableArray array];
if( !p_playlist ) return NO; [o_items_array removeAllObjects];
[o_nodes_array removeAllObjects];
[pboard declareTypes: [NSArray arrayWithObjects: if( !p_playlist ) return NO;
@"VLCPlaylistItemPboardType", NSFilenamesPboardType, nil] owner: self];
for( i = 0 ; i < [items count] ; i++ ) for( i = 0 ; i < [items count] ; i++ )
{ {
...@@ -1408,21 +1411,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -1408,21 +1411,13 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
i--; i--;
break; break;
} }
if( j == [o_nodes_array count] ) i++;
} }
} }
[o_objects_array addObjectsFromArray: o_nodes_array]; [pboard declareTypes: [NSArray arrayWithObjects:
[o_objects_array addObjectsFromArray: o_items_array]; @"VLCPlaylistItemPboardType",NSFilenamesPboardType, nil] owner: self];
[pboard setPropertyList:[NSArray array]
if( ![pboard setPropertyList: o_objects_array forType:NSFilenamesPboardType];
forType:@"VLCPlaylistItemPboardType"] ||
![pboard setPropertyList: [NSArray array]
forType:@"VLCPlaylistItemPboardType"])
{
vlc_object_release(p_playlist);
return NO;
}
vlc_object_release(p_playlist); vlc_object_release(p_playlist);
return YES; return YES;
...@@ -1436,17 +1431,28 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/ ...@@ -1436,17 +1431,28 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
if( !p_playlist ) return NSDragOperationNone; if( !p_playlist ) return NSDragOperationNone;
if( ![self isItem: [item pointerValue] inNode: p_playlist->p_general] )
return NSDragOperationNone;
/* Drop from the Playlist */ /* Drop from the Playlist */
if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] && if( [[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] )
[self isItem: [item pointerValue] inNode: p_playlist->p_general])
{ {
unsigned int i;
for( i = 0 ; i < [o_nodes_array count] ; i++ )
{
if( [self isItem: [item pointerValue] inNode:
[[o_nodes_array objectAtIndex: i] pointerValue]] )
{
vlc_object_release(p_playlist);
return NSDragOperationNone;
}
}
vlc_object_release(p_playlist); vlc_object_release(p_playlist);
return NSDragOperationMove; return NSDragOperationMove;
} }
/* Drop from the Finder */ /* Drop from the Finder */
else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] && else if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
![[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"])
{ {
vlc_object_release(p_playlist); vlc_object_release(p_playlist);
return NSDragOperationGeneric; return NSDragOperationGeneric;
......
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