Commit 12c4a861 authored by Antoine Cellerier's avatar Antoine Cellerier

We can now DnD a file everywhere on the playlist dialog. Droping above the...

We can now DnD a file everywhere on the playlist dialog. Droping above the tree will insert at the begining of the playlist. Droping under the tree will insert at the end of the playlist.
parent 991ad2c1
...@@ -375,6 +375,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -375,6 +375,8 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
/* Associate drop targets with the playlist */ /* Associate drop targets with the playlist */
SetDropTarget( new PlaylistFileDropTarget( this ) ); SetDropTarget( new PlaylistFileDropTarget( this ) );
menubar->SetDropTarget( new PlaylistFileDropTarget( this ) );
toolbar->SetDropTarget( new PlaylistFileDropTarget( this ) );
#endif #endif
i_saved_id = -1; i_saved_id = -1;
...@@ -1242,10 +1244,9 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, ...@@ -1242,10 +1244,9 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y,
/* find the destination node and position in that node */ /* find the destination node and position in that node */
const wxPoint pt( x, y ); const wxPoint pt( x, y );
int flags = 0; wxTreeItemId item = p->treectrl->HitTest( pt );
wxTreeItemId item = p->treectrl->HitTest( pt, flags );
if( flags & wxTREE_HITTEST_NOWHERE ) if( !item.IsOk() )
{ {
/* We were droped below the last item so we append to the /* We were droped below the last item so we append to the
* general node */ * general node */
...@@ -1254,14 +1255,6 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, ...@@ -1254,14 +1255,6 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y,
} }
else else
{ {
/* We were droped on an item */
if( !item.IsOk() )
{
printf("Arf ....\n" );
UnlockPlaylist( p->p_intf->p_sys, p->p_playlist );
return FALSE;
}
PlaylistItem *p_plitem = PlaylistItem *p_plitem =
(PlaylistItem *)p->treectrl->GetItemData( item ); (PlaylistItem *)p->treectrl->GetItemData( item );
p_dest = playlist_ItemGetById( p->p_playlist, p_plitem->i_id ); p_dest = playlist_ItemGetById( p->p_playlist, p_plitem->i_id );
......
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