]> git.sesse.net Git - vlc/commitdiff
Don't rebuild the tree on node sort
authorClément Stenac <zorglub@videolan.org>
Mon, 22 Nov 2004 09:50:45 +0000 (09:50 +0000)
committerClément Stenac <zorglub@videolan.org>
Mon, 22 Nov 2004 09:50:45 +0000 (09:50 +0000)
modules/gui/wxwindows/playlist.cpp
modules/gui/wxwindows/wxwindows.h

index f96656c1c4843ce08360dd76ce986c76da46e994..3f06de1da4f5d795b31dd36b12fbd86a62619e12 100644 (file)
@@ -468,6 +468,14 @@ void Playlist::CreateNode( playlist_t *p_playlist, playlist_item_t *p_node,
                               -1,-1, new PlaylistItem( p_node ) );
     treectrl->SetItemImage( node, p_node->input.i_type );
 
+    UpdateNodeChildren( p_playlist, p_node, node );
+}
+
+void Playlist::UpdateNodeChildren( playlist_t *p_playlist,
+                                   playlist_item_t *p_node,
+                                   wxTreeItemId node )
+{
+
     for( int i = 0; i< p_node->i_children ; i++ )
     {
         /* Append the item */
@@ -1507,7 +1515,10 @@ void Playlist::OnPopupSort( wxMenuEvent& event )
             playlist_RecursiveNodeSort( p_playlist, p_wxitem->p_item,
                                         SORT_TITLE_NODES_FIRST, ORDER_NORMAL );
             vlc_mutex_unlock( &p_playlist->object_lock );
-            b_need_update = VLC_TRUE;
+
+            treectrl->DeleteChildren( i_popup_item );
+            UpdateNodeChildren( p_playlist, p_wxitem->p_item, i_popup_item );
+
             vlc_object_release( p_playlist );
         }
     }
index 96b07f80803de44081c8951cd17465fba6e8664d..5ea5f3b04e46fbeb26b8f7b6d968fe8276573e49 100644 (file)
@@ -838,6 +838,7 @@ private:
 
     /* Update */
     void UpdateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
+    void UpdateNodeChildren( playlist_t *, playlist_item_t*, wxTreeItemId );
     void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
 
     wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );