Changeset e0d08374cf0261657843261e1b295fa3704051e5
- 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
| r3bb2997 |
re0d0837 |
|
| 209 | 209 | #define SORT_ID 0 |
|---|
| 210 | 210 | #define SORT_TITLE 1 |
|---|
| 211 | | #define SORT_AUTHOR 2 |
|---|
| | 211 | #define SORT_TITLE_NODES_FIRST 2 |
|---|
| | 212 | #define SORT_AUTHOR 3 |
|---|
| 212 | 213 | #define SORT_RANDOM 4 |
|---|
| 213 | 214 | #define SORT_DURATION 5 |
|---|
| … | … | |
| 332 | 333 | VLC_EXPORT( int, playlist_Move, ( playlist_t *, int, int ) ); |
|---|
| 333 | 334 | VLC_EXPORT( int, playlist_NodeGroup, ( playlist_t *, int,playlist_item_t *,playlist_item_t **,int, int, int ) ); |
|---|
| | 335 | VLC_EXPORT( int, playlist_NodeSort, ( playlist_t *, playlist_item_t *,int, int ) ); |
|---|
| 334 | 336 | |
|---|
| 335 | 337 | /* Load/Save */ |
|---|
| rd0cc314 |
re0d0837 |
|
| 94 | 94 | PopupPlay_Event, |
|---|
| 95 | 95 | PopupPlayThis_Event, |
|---|
| | 96 | PopupSort_Event, |
|---|
| 96 | 97 | PopupDel_Event, |
|---|
| 97 | 98 | PopupEna_Event, |
|---|
| … | … | |
| 155 | 156 | EVT_MENU( PopupPlay_Event, Playlist::OnPopupPlay) |
|---|
| 156 | 157 | EVT_MENU( PopupPlayThis_Event, Playlist::OnPopupPlay) |
|---|
| | 158 | EVT_MENU( PopupSort_Event, Playlist::OnPopupSort) |
|---|
| 157 | 159 | EVT_MENU( PopupDel_Event, Playlist::OnPopupDel) |
|---|
| 158 | 160 | EVT_MENU( PopupEna_Event, Playlist::OnPopupEna) |
|---|
| … | … | |
| 277 | 279 | popup_menu->Append( PopupPlay_Event, wxU(_("Play")) ); |
|---|
| 278 | 280 | popup_menu->Append( PopupPlayThis_Event, wxU(_("Play this branch")) ); |
|---|
| | 281 | popup_menu->Append( PopupSort_Event, wxU(_("Sort this branch")) ); |
|---|
| 279 | 282 | popup_menu->Append( PopupDel_Event, wxU(_("Delete")) ); |
|---|
| 280 | 283 | popup_menu->Append( PopupEna_Event, wxU(_("Enable/Disable")) ); |
|---|
| … | … | |
| 1453 | 1456 | } |
|---|
| 1454 | 1457 | |
|---|
| | 1458 | void 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 | |
|---|
| 1455 | 1478 | void Playlist::OnPopupEna( wxMenuEvent& event ) |
|---|
| 1456 | 1479 | { |
|---|
| r12f48a5 |
re0d0837 |
|
| 830 | 830 | void OnPopup( wxContextMenuEvent& event ); |
|---|
| 831 | 831 | void OnPopupPlay( wxMenuEvent& event ); |
|---|
| | 832 | void OnPopupSort( wxMenuEvent& event ); |
|---|
| 832 | 833 | void OnPopupDel( wxMenuEvent& event ); |
|---|
| 833 | 834 | void OnPopupEna( wxMenuEvent& event ); |
|---|
| r3bb2997 |
re0d0837 |
|
| 154 | 154 | msg_Err( p_playlist,"META SORT not implemented" ); |
|---|
| 155 | 155 | } |
|---|
| | 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 | } |
|---|
| 156 | 176 | |
|---|
| 157 | 177 | if( ( i_type == ORDER_NORMAL && i_test < 0 ) || |
|---|