Changeset e0d08374cf0261657843261e1b295fa3704051e5

Show
Ignore:
Timestamp:
21/11/04 18:45:09 (4 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1101059109 +0000
git-parent:

[0b62ce6ddea078551980803454777fed033c2ba4]

git-author:
Clément Stenac <zorglub@videolan.org> 1101059109 +0000
Message:

Sort a node (alphabetically, all sub-nodes come first)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_playlist.h

    r3bb2997 re0d0837  
    209209#define SORT_ID 0 
    210210#define SORT_TITLE 1 
    211 #define SORT_AUTHOR 2 
     211#define SORT_TITLE_NODES_FIRST 2 
     212#define SORT_AUTHOR 3 
    212213#define SORT_RANDOM 4 
    213214#define SORT_DURATION 5 
     
    332333VLC_EXPORT( int,  playlist_Move, ( playlist_t *, int, int ) ); 
    333334VLC_EXPORT( int,  playlist_NodeGroup, ( playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int ) ); 
     335VLC_EXPORT( int,  playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) ); 
    334336 
    335337/* Load/Save */ 
  • modules/gui/wxwindows/playlist.cpp

    rd0cc314 re0d0837  
    9494    PopupPlay_Event, 
    9595    PopupPlayThis_Event, 
     96    PopupSort_Event, 
    9697    PopupDel_Event, 
    9798    PopupEna_Event, 
     
    155156    EVT_MENU( PopupPlay_Event, Playlist::OnPopupPlay) 
    156157    EVT_MENU( PopupPlayThis_Event, Playlist::OnPopupPlay) 
     158    EVT_MENU( PopupSort_Event, Playlist::OnPopupSort) 
    157159    EVT_MENU( PopupDel_Event, Playlist::OnPopupDel) 
    158160    EVT_MENU( PopupEna_Event, Playlist::OnPopupEna) 
     
    277279    popup_menu->Append( PopupPlay_Event, wxU(_("Play")) ); 
    278280    popup_menu->Append( PopupPlayThis_Event, wxU(_("Play this branch")) ); 
     281    popup_menu->Append( PopupSort_Event, wxU(_("Sort this branch")) ); 
    279282    popup_menu->Append( PopupDel_Event, wxU(_("Delete")) ); 
    280283    popup_menu->Append( PopupEna_Event, wxU(_("Enable/Disable")) ); 
     
    14531456} 
    14541457 
     1458void Playlist::OnPopupSort( wxMenuEvent& event ) 
     1459{ 
     1460    PlaylistItem *p_wxitem; 
     1461 
     1462    p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_popup_item ); 
     1463 
     1464    if( p_wxitem->p_item->i_children >= 0 ) 
     1465    { 
     1466        playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, 
     1467                                        VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); 
     1468 
     1469        if( p_playlist ) 
     1470        { 
     1471            playlist_NodeSort( p_playlist, p_wxitem->p_item, 
     1472                               SORT_TITLE_NODES_FIRST, ORDER_NORMAL ); 
     1473            vlc_object_release( p_playlist ); 
     1474        } 
     1475    } 
     1476} 
     1477 
    14551478void Playlist::OnPopupEna( wxMenuEvent& event ) 
    14561479{ 
  • modules/gui/wxwindows/wxwindows.h

    r12f48a5 re0d0837  
    830830    void OnPopup( wxContextMenuEvent& event ); 
    831831    void OnPopupPlay( wxMenuEvent& event ); 
     832    void OnPopupSort( wxMenuEvent& event ); 
    832833    void OnPopupDel( wxMenuEvent& event ); 
    833834    void OnPopupEna( wxMenuEvent& event ); 
  • src/playlist/sort.c

    r3bb2997 re0d0837  
    154154                msg_Err( p_playlist,"META SORT not implemented" ); 
    155155            } 
     156            else if( i_mode == SORT_TITLE_NODES_FIRST ) 
     157            { 
     158                /* Alphabetic sort, all nodes first */ 
     159 
     160                if( pp_items[i]->i_children == -1 && 
     161                    pp_items[i_small]->i_children >= 0 ) 
     162                { 
     163                    i_test = 1; 
     164                } 
     165                else if( pp_items[i]->i_children >= 0 && 
     166                         pp_items[i_small]->i_children == -1 ) 
     167                { 
     168                    i_test = -1; 
     169                } 
     170                else 
     171                { 
     172                    i_test = strcasecmp( pp_items[i]->input.psz_name, 
     173                                         pp_items[i_small]->input.psz_name ); 
     174                } 
     175            } 
    156176 
    157177            if( ( i_type == ORDER_NORMAL  && i_test < 0 ) ||