static void ReplacePlaylistItem( playlist_t *p_playlist, char *psz_uri ) { playlist_Stop( p_playlist ); (void) playlist_Add( p_playlist, psz_uri, psz_uri, PLAYLIST_REPLACE, p_playlist->i_index ); playlist_Goto( p_playlist, p_playlist->i_index ); }
/***************************************************************************** * PlaylistView::MouseDown *****************************************************************************/ void PlaylistView::MouseDown( BPoint where ) { int32 clicks = 1; Window()->CurrentMessage()->FindInt32( "clicks", &clicks ); bool handled = false; for ( int32 i = 0; PlaylistItem* item = (PlaylistItem*)ItemAt( i ); i++ ) { BRect r = ItemFrame( i ); if ( r.Contains( where ) ) { if ( clicks == 2 ) { // only do something if user clicked the same item twice if ( fLastClickedItem == item ) { playlist_t * p_playlist; p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist ) { playlist_Goto( p_playlist, i ); vlc_object_release( p_playlist ); } handled = true; } } else { // remember last clicked item fLastClickedItem = item; if ( i == fCurrentIndex ) { r.right = r.left + TEXT_OFFSET; if ( r.Contains ( where ) ) { fMainWindow->PostMessage( PAUSE_PLAYBACK ); InvalidateItem( i ); handled = true; } } } break; } } if ( !handled ) DragSortableListView::MouseDown(where); }
void Playlist::action( Elem_t *pItem ) { // Find the index of the item int index = 0; ConstIterator it; for( it = begin(); it != end(); it++ ) { if( &*it == pItem ) break; index++; } // Item found ? if( index < size() ) { playlist_Goto( m_pPlaylist, index ); } }
void onPlaylistRow(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) { intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(treeview) ); GtkTreeSelection *p_selection = gtk_tree_view_get_selection(treeview); playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist == NULL ) { return; // FALSE; } if (gtk_tree_selection_count_selected_rows(p_selection) == 1) { GtkTreeModel *p_model; GtkTreeIter iter; int i_row; /* This might be a directory selection */ p_model = gtk_tree_view_get_model(treeview); if (!p_model) { msg_Err(p_intf, "PDA: Playlist model contains a NULL pointer\n" ); return; } if (!gtk_tree_model_get_iter(p_model, &iter, path)) { msg_Err( p_intf, "PDA: Playlist could not get iter from model" ); return; } gtk_tree_model_get(p_model, &iter, 2, &i_row, -1); playlist_Goto( p_playlist, i_row ); } vlc_object_release( p_playlist ); }
/***************************************************************************** * PlaylistView::_SetPlayingIndex *****************************************************************************/ void PlaylistView::_SetPlayingIndex( BListItem* playingItem ) { for ( int32 i = 0; BListItem* item = ItemAt( i ); i++ ) { if ( item == playingItem ) { playlist_t * p_playlist; p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( !p_playlist ) { return; } playlist_Goto( p_playlist, i ); SetCurrent( i ); vlc_object_release( p_playlist ); break; } } }