vlc_object_release( p_playlist );
+
/* Update the playlist */
Rebuild();
}
return dummy;
}
-/*wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current )
+wxTreeItemId Playlist::FindItemByName( wxTreeItemId root, wxString search_string, wxTreeItemId current, vlc_bool_t *pb_current_found )
{
long cookie;
PlaylistItem *p_wxcurrent;
if( treectrl->GetItemText( item).Lower().Contains(
search_string.Lower() ) )
{
- return item;
+ if( !current.IsOk() || *pb_current_found == VLC_TRUE )
+ {
+ return item;
+ }
+ else if( current.IsOk() && item == current )
+ {
+ *pb_current_found = VLC_TRUE;
+ }
+ }
if( treectrl->ItemHasChildren( item ) )
{
- wxTreeItemId search = FindItem( item, p_item );
+ wxTreeItemId search = FindItemByName( item, search_string, current,
+ pb_current_found );
if( search.IsOk() )
{
return search;
}
item = treectrl->GetNextChild( root, cookie);
}
- */ /* Not found */
- /*wxTreeItemId dummy;
+ /* Not found */
+ wxTreeItemId dummy;
return dummy;
}
-*/
-
void Playlist::SetCurrentItem( wxTreeItemId item )
{
wxString search_string = search_text->GetValue();
- bool b_ok = false;
- int i_current;
- int i_first = 0 ;
- int i_item = -1;
+ vlc_bool_t pb_found = VLC_FALSE;
+
+ wxTreeItemId found =
+ FindItemByName( treectrl->GetRootItem(), search_string,
+ search_current, &pb_found );
+
+ if( found.IsOk() )
+ {
+ search_current = found;
+ treectrl->SelectItem( found, true );
+ }
+ else
+ {
+ wxTreeItemId dummy;
+ search_current = dummy;
+ found = FindItemByName( treectrl->GetRootItem(), search_string,
+ search_current, &pb_found );
+ if( found.IsOk() )
+ {
+ search_current = found;
+ treectrl->SelectItem( found, true );
+ }
+ }
}
#if 0
void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );
+ wxTreeItemId FindItemByName( wxTreeItemId, wxString, wxTreeItemId, vlc_bool_t *);
void SetCurrentItem( wxTreeItemId );
void UpdateTreeItem( playlist_t *, wxTreeItemId );
int i_current_view;
wxTreeItemId i_popup_item;
+ wxTreeItemId search_current;
playlist_item_t *p_popup_item;
playlist_item_t *p_popup_parent;