Changeset 5d3edb82f37d177671789808248251bfdeaf7fd1

Show
Ignore:
Timestamp:
13/12/04 22:48:06 (4 years ago)
Author:
Benjamin Pracht <bigben@videolan.org>
git-committer:
Benjamin Pracht <bigben@videolan.org> 1102974486 +0000
git-parent:

[c5d68965802198e8da1657f36cc39ee40b17eebf]

git-author:
Benjamin Pracht <bigben@videolan.org> 1102974486 +0000
Message:

Implements sorting of the current node from context menu

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib

    r251ee86 r5d3edb8  
    396396                searchItem = id;  
    397397                selectAll = id;  
     398                sortNodeByAuthor = id;  
     399                sortNodeByName = id;  
    398400            };  
    399401            CLASS = VLCPlaylist;  
     
    408410                "o_mi_save_playlist" = id;  
    409411                "o_mi_selectall" = id;  
     412                "o_mi_sort_author" = id;  
     413                "o_mi_sort_name" = id;  
    410414                "o_outline_view" = id;  
    411415                "o_random_ckb" = id;  
  • extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib

    r251ee86 r5d3edb8  
    44<dict> 
    55    <key>IBDocumentLocation</key> 
    6     <string>94 104 505 517 0 0 1024 746 </string> 
     6    <string>230 -84 505 517 0 0 1024 746 </string> 
    77    <key>IBEditorPositions</key> 
    88    <dict> 
     
    1414        <string>84 667 419 44 0 0 1024 746 </string> 
    1515        <key>915</key> 
    16         <string>620 326 100 130 0 0 1024 746 </string> 
     16        <string>731 416 165 180 0 0 1024 746 </string> 
    1717    </dict> 
    1818    <key>IBFramework Version</key> 
  • modules/gui/macosx/playlist.h

    r5eb406b r5d3edb8  
    5353    IBOutlet id o_mi_info; 
    5454    IBOutlet id o_mi_selectall; 
     55    IBOutlet id o_mi_sort_name; 
     56    IBOutlet id o_mi_sort_author; 
    5557 
    5658    NSImage *o_descendingSortingImage; 
     
    6971 
    7072- (void)playlistUpdated; 
     73- (void)sortNode:(int)i_mode; 
    7174 
    7275- (IBAction)playItem:(id)sender; 
    7376- (IBAction)deleteItem:(id)sender; 
    7477- (IBAction)selectAll:(id)sender; 
     78- (IBAction)sortNodeByName:(id)sender; 
     79- (IBAction)sortNodeByAuthor:(id)sender; 
    7580 
    7681- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue; 
  • modules/gui/macosx/playlist.m

    rc5d6896 r5d3edb8  
    153153    [o_mi_selectall setTitle: _NS("Select All")]; 
    154154    [o_mi_info setTitle: _NS("Properties")]; 
     155    [o_mi_sort_name setTitle: _NS("Sort Node by Name")]; 
     156    [o_mi_sort_author setTitle: _NS("Sort Node by Author")]; 
    155157    [[o_tc_name headerCell] setStringValue:_NS("Name")]; 
    156158    [[o_tc_author headerCell] setStringValue:_NS("Author")]; 
     
    317319        [self playlistUpdated]; 
    318320    } 
     321} 
     322 
     323- (IBAction)sortNodeByName:(id)sender 
     324{ 
     325    [self sortNode: SORT_TITLE]; 
     326} 
     327 
     328- (IBAction)sortNodeByAuthor:(id)sender 
     329{ 
     330    [self sortNode: SORT_AUTHOR]; 
     331} 
     332 
     333- (void)sortNode:(int)i_mode 
     334{ 
     335    playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, 
     336                                          FIND_ANYWHERE ); 
     337    playlist_item_t * p_item; 
     338 
     339    if (p_playlist == NULL) 
     340    { 
     341        return; 
     342    } 
     343 
     344    if ([o_outline_view selectedRow] > -1) 
     345    { 
     346        p_item = [[o_outline_view itemAtRow: [o_outline_view selectedRow]] 
     347                                                                pointerValue]; 
     348    } 
     349    else 
     350    /*If no item is selected, sort the whole playlist*/ 
     351    { 
     352        playlist_view_t * p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE ); 
     353        p_item = p_view->p_root; 
     354    } 
     355 
     356    if (p_item->i_children > -1) 
     357    { 
     358        vlc_mutex_lock(&p_playlist->object_lock ); 
     359        playlist_RecursiveNodeSort( p_playlist, p_item, i_mode, ORDER_NORMAL ); 
     360        vlc_mutex_unlock(&p_playlist->object_lock ); 
     361    } 
     362    else 
     363    { 
     364        int i; 
     365 
     366        for (i = 0 ; i < p_item->i_parents ; i++) 
     367        { 
     368            if (p_item->pp_parents[i]->i_view == VIEW_SIMPLE) 
     369            { 
     370                vlc_mutex_lock(&p_playlist->object_lock ); 
     371                playlist_RecursiveNodeSort( p_playlist, 
     372                        p_item->pp_parents[i]->p_parent, i_mode, ORDER_NORMAL ); 
     373                vlc_mutex_unlock(&p_playlist->object_lock ); 
     374                break; 
     375            } 
     376        } 
     377    } 
     378    vlc_object_release(p_playlist); 
     379    [self playlistUpdated]; 
    319380} 
    320381