#include <wx/imaglist.h>
#include <vlc_meta.h>
-#include "charset.h"
+#include "vlc_charset.h"
#define HELP_SHUFFLE N_( "Shuffle" )
#define HELP_LOOP N_( "Repeat All" )
toolbar->Realize();
/* Create teh source selector */
- source_sel = new wxListCtrl( playlist_panel, Source_Event,
- wxDefaultPosition, wxDefaultSize,
- wxLC_AUTOARRANGE|wxLC_SINGLE_SEL );
+ source_sel = new wxListView( playlist_panel, Source_Event,
+ wxDefaultPosition, wxDefaultSize,
+ wxLC_AUTOARRANGE|wxLC_SINGLE_SEL );
/* Create the tree */
treectrl = new wxTreeCtrl( playlist_panel, TreeCtrl_Event,
if( !p_data ) return;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
- ((PlaylistItem *)p_data)->i_id );
+ ((PlaylistItem *)p_data)->i_id, VLC_TRUE );
if( !p_item )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
wxString msg;
wxString duration = wxU( "" );
- char *psz_author;
+ char *psz_artist;
if( p_item->p_input->p_meta )
{
- psz_author= p_item->p_input->p_meta->psz_artist ?
+ psz_artist= p_item->p_input->p_meta->psz_artist ?
strdup( p_item->p_input->p_meta->psz_artist ) :
strdup("");
}
else
- psz_author = strdup( "" );
+ psz_artist = strdup( "" );
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_item->p_input->i_duration;
wxU( " )" ) );
}
- if( !strcmp( psz_author, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
+ if( !strcmp( psz_artist, "" ) || p_item->p_input->b_fixed_name == VLC_TRUE )
{
msg = wxString( wxU( p_item->p_input->psz_name ) ) + duration;
}
else
{
- msg = wxString(wxU( psz_author )) + wxT(" - ") +
+ msg = wxString(wxU( psz_artist )) + wxT(" - ") +
wxString(wxU(p_item->p_input->psz_name)) + duration;
}
- free( psz_author );
+ free( psz_artist );
treectrl->SetItemText( item , msg );
treectrl->SetItemImage( item, p_item->p_input->i_type );
node = FindItem( treectrl->GetRootItem(), p_add->i_node );
if( !node.IsOk() ) goto update;
- p_item = playlist_ItemGetById( p_playlist, p_add->i_item );
+ p_item = playlist_ItemGetById( p_playlist, p_add->i_item, VLC_TRUE );
if( !p_item ) goto update;
if( (p_item->i_flags & PLAYLIST_DBL_FLAG ) ) goto update;
{
playlist_item_t *p_item;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, ((PlaylistItem *)treectrl->GetItemData( item ))->i_id );
+ p_item = playlist_ItemGetById( p_playlist, ((PlaylistItem *)treectrl->GetItemData( item ))->i_id, VLC_TRUE );
if( p_item && p_item->i_children == -1 )
count++;
UnlockPlaylist( p_intf->p_sys, p_playlist );
p_wxitem = (PlaylistItem *)treectrl->GetItemData( item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
if( !p_item )
{
void Playlist::DeleteItem( int item_id )
{
- playlist_DeleteAllFromInput( p_playlist, item_id );
+ playlist_DeleteFromInput( p_playlist, item_id, VLC_TRUE );
}
void Playlist::DeleteNode( playlist_item_t *p_item )
wxString filter = wxT("");
- if( p_playlist->i_size == 0 )
+ if( playlist_IsEmpty( p_playlist ) )
{
wxMessageBox( wxU(_("Playlist is empty") ), wxU(_("Can't save")),
wxICON_WARNING | wxOK, this );
if( dialog.ShowModal() == wxID_OK )
{
- if( dialog.GetPath().mb_str() )
+ if( dialog.GetPath().mb_str(wxConvUTF8) )
{
/* what root should we export? */
if( p_playlist->p_root_category->i_children > 0 )
{
- playlist_Export( p_playlist, dialog.GetPath().mb_str(),
+ playlist_Export( p_playlist, dialog.GetPath().mb_str(wxConvUTF8),
p_playlist->p_root_category->pp_children[0],
formats[dialog.GetFilterIndex()].psz_module );
}
if( dialog.ShowModal() == wxID_OK )
{
- playlist_Import( p_playlist, dialog.GetPath().mb_str() );
+ playlist_Import( p_playlist, dialog.GetPath().mb_str(wxConvUTF8) );
}
}
{
case SortTitle_Event:
playlist_RecursiveNodeSort( p_playlist,
- playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
+ playlist_ItemGetById( p_playlist, p_wxitem->i_id,
+ VLC_TRUE ),
SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
break;
case RSortTitle_Event:
playlist_RecursiveNodeSort( p_playlist,
- playlist_ItemGetById( p_playlist, p_wxitem->i_id ),
+ playlist_ItemGetById( p_playlist, p_wxitem->i_id,
+ VLC_TRUE ),
SORT_TITLE_NODES_FIRST, ORDER_REVERSE );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
wxString search_string = search_text->GetValue();
PlaylistItem *p_wxroot;
p_wxroot = (PlaylistItem *)treectrl->GetItemData( treectrl->GetRootItem() );
- playlist_item_t *p_root = playlist_ItemGetById( p_playlist, p_wxroot->i_id );
+ playlist_item_t *p_root = playlist_ItemGetById( p_playlist, p_wxroot->i_id,
+ VLC_TRUE );
assert( p_root );
char *psz_name = wxFromLocale( search_string );
{
wxTreeItemIdValue cookie;
wxTreeItemId child = treectrl->GetFirstChild( root, cookie );
+ wxTreeItemId nextchild;
+ bool childIsSelected = FALSE;
+ bool nextchildIsSelected = FALSE;
+
+ if( child.IsOk() ) childIsSelected = treectrl->IsSelected( child );
+
while( child.IsOk() )
{
- if( treectrl->ItemHasChildren( child ) )
- {
- RecursiveDeleteSelection( child );
- if( treectrl->IsSelected(child ) ) DeleteTreeItem( child );
- }
- else if( treectrl->IsSelected( child ) )
+ nextchild = treectrl->GetNextChild( root, cookie );
+ if( nextchild.IsOk() )
+ nextchildIsSelected = treectrl->IsSelected( nextchild );
+ if( childIsSelected )
DeleteTreeItem( child );
- child = treectrl->GetNextChild( root, cookie );
+ else if( treectrl->ItemHasChildren( child ) )
+ RecursiveDeleteSelection( child );
+ child = nextchild;
+ childIsSelected = nextchildIsSelected;
}
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
return;
}
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
p_parent = p_item;
while( p_parent )
if( p_parent )
{
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_parent, p_item );
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_parent, p_item );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
}
{
long keycode = event.GetKeyCode();
/* Delete selected items */
- if( keycode == WXK_BACK || keycode == WXK_DELETE )
+ if( keycode == WXK_BACK || keycode == WXK_DELETE || keycode == WXK_NUMPAD_DELETE )
{
/* We send a dummy event */
OnDeleteSelection( event );
if( !dest_tree_item.IsOk() ) return;
- /* check that we're not trying to move a node into one of it's children */
+ /* check that we're not trying to move a node into one of its children */
wxTreeItemId parent = dest_tree_item;
while( parent != treectrl->GetRootItem() )
{
}
playlist_item_t *p_drageditem =
- playlist_ItemGetById(p_playlist, p_wxdrageditem->i_id );
+ playlist_ItemGetById(p_playlist, p_wxdrageditem->i_id, VLC_TRUE );
playlist_item_t *p_destitem =
- playlist_ItemGetById(p_playlist, p_wxdestitem->i_id );
+ playlist_ItemGetById(p_playlist, p_wxdestitem->i_id, VLC_TRUE );
if( !p_drageditem || !p_destitem )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
return;
}
playlist_item_t *p_destitem2 =
- playlist_ItemGetById( p_playlist, p_parent->i_id );
+ playlist_ItemGetById( p_playlist, p_parent->i_id, VLC_TRUE );
if( !p_destitem2 )
{
UnlockPlaylist( p_intf->p_sys, p_playlist );
{
PlaylistItem *p_plitem =
(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, VLC_TRUE );
if( p_dest->i_children == -1 )
{
/* This is a leaf. Append right after it
* We thus need to find the parrent node and the position of the
- * leaf in it's children list */
+ * leaf in its children list */
wxTreeItemId parent = p->treectrl->GetItemParent( item );
PlaylistItem *p_parent =
(PlaylistItem *)p->treectrl->GetItemData( parent );
return FALSE;
}
playlist_item_t *p_node =
- playlist_ItemGetById( p->p_playlist, p_parent->i_id );
+ playlist_ItemGetById( p->p_playlist, p_parent->i_id, VLC_TRUE );
if( !p_node )
{
UnlockPlaylist( p->p_intf->p_sys, p->p_playlist );
/* Put the items in the playlist node */
for( size_t i = 0; i < filenames.GetCount(); i++ )
{
- const char *psz_utf8 = wxDnDFromLocale( filenames[i] );
+ char *psz_utf8 = wxDnDFromLocale( filenames[i] );
input_item_t *p_input = input_ItemNew( p->p_playlist,
psz_utf8, psz_utf8 );
playlist_NodeAddInput( p->p_playlist, p_input,
- p_dest, PLAYLIST_PREPARSE, i_pos );
+ p_dest, PLAYLIST_PREPARSE, i_pos, VLC_FALSE );
wxDnDLocaleFree( psz_utf8 );
}
treectrl->SelectItem( i_wx_popup_item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, i_popup_item );
+ p_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
if( !p_item )
{
{
playlist_item_t *p_popup_item, *p_popup_parent;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item );
+ p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
p_popup_parent = p_popup_item;
while( p_popup_parent )
if( p_popup_parent )
{
- playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, p_popup_parent,
+ playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VLC_TRUE, p_popup_parent,
p_popup_item );
}
UnlockPlaylist( p_intf->p_sys, p_playlist );
{
playlist_item_t *p_popup_item;
LockPlaylist( p_intf->p_sys, p_playlist );
- p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item );
+ p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item, VLC_TRUE );
if( p_popup_item != NULL )
{
p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_wx_popup_item );
LockPlaylist( p_intf->p_sys, p_playlist );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
if( p_item->i_children >= 0 )
{
playlist_RecursiveNodeSort( p_playlist, p_item,
void Playlist::OnPopupInfo( wxCommandEvent& event )
{
LockPlaylist( p_intf->p_sys, p_playlist );
- playlist_item_t *p_popup_item = playlist_ItemGetById( p_playlist, i_popup_item );
+ playlist_item_t *p_popup_item = playlist_ItemGetById( p_playlist,
+ i_popup_item,
+ VLC_TRUE );
if( p_popup_item )
{
iteminfo_dialog = new ItemInfoDialog( p_intf, p_popup_item, this );
p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_wx_popup_item );
- p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id );
+ p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id, VLC_TRUE );
- playlist_NodeCreate( p_playlist, psz_name, p_item );
+ playlist_NodeCreate( p_playlist, psz_name, p_item, 0 );
UnlockPlaylist( p_intf->p_sys, p_playlist );
Rebuild( VLC_TRUE );
if( p_current_treeroot && i_id != p_current_treeroot->i_id )
{
- playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
+ playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id,
+ VLC_TRUE );
if( p_item ) p_current_treeroot = p_item;
Rebuild( VLC_TRUE );
}
switch( event.GetId() )
{
case UpdateItem_Event:
- fprintf( stderr,"Update input item id %i\n", event.GetInt() );
UpdateItem( event.GetInt() );
break;
case AppendItem_Event:
- fprintf( stderr,"Append item id %i\n",
- ((playlist_add_t*)event.GetClientData())->i_item );
AppendItem( event );
break;
case RemoveItem_Event:
- fprintf( stderr,"Remove item id %i\n", event.GetInt() );
RemoveItem( event.GetInt() );
break;
}