<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
- <string>94 104 505 517 0 0 1024 746 </string>
+ <string>230 -84 505 517 0 0 1024 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>1617</key>
<key>29</key>
<string>84 667 419 44 0 0 1024 746 </string>
<key>915</key>
- <string>620 326 100 130 0 0 1024 746 </string>
+ <string>731 416 165 180 0 0 1024 746 </string>
</dict>
<key>IBFramework Version</key>
<string>364.0</string>
IBOutlet id o_mi_delete;
IBOutlet id o_mi_info;
IBOutlet id o_mi_selectall;
+ IBOutlet id o_mi_sort_name;
+ IBOutlet id o_mi_sort_author;
NSImage *o_descendingSortingImage;
NSImage *o_ascendingSortingImage;
- (NSMenu *)menuForEvent:(NSEvent *)o_event;
- (void)playlistUpdated;
+- (void)sortNode:(int)i_mode;
- (IBAction)playItem:(id)sender;
- (IBAction)deleteItem:(id)sender;
- (IBAction)selectAll:(id)sender;
+- (IBAction)sortNodeByName:(id)sender;
+- (IBAction)sortNodeByAuthor:(id)sender;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
[o_mi_delete setTitle: _NS("Delete")];
[o_mi_selectall setTitle: _NS("Select All")];
[o_mi_info setTitle: _NS("Properties")];
+ [o_mi_sort_name setTitle: _NS("Sort Node by Name")];
+ [o_mi_sort_author setTitle: _NS("Sort Node by Author")];
[[o_tc_name headerCell] setStringValue:_NS("Name")];
[[o_tc_author headerCell] setStringValue:_NS("Author")];
[[o_tc_duration headerCell] setStringValue:_NS("Duration")];
}
}
+- (IBAction)sortNodeByName:(id)sender
+{
+ [self sortNode: SORT_TITLE];
+}
+
+- (IBAction)sortNodeByAuthor:(id)sender
+{
+ [self sortNode: SORT_AUTHOR];
+}
+
+- (void)sortNode:(int)i_mode
+{
+ playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ playlist_item_t * p_item;
+
+ if (p_playlist == NULL)
+ {
+ return;
+ }
+
+ if ([o_outline_view selectedRow] > -1)
+ {
+ p_item = [[o_outline_view itemAtRow: [o_outline_view selectedRow]]
+ pointerValue];
+ }
+ else
+ /*If no item is selected, sort the whole playlist*/
+ {
+ playlist_view_t * p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
+ p_item = p_view->p_root;
+ }
+
+ if (p_item->i_children > -1)
+ {
+ vlc_mutex_lock(&p_playlist->object_lock );
+ playlist_RecursiveNodeSort( p_playlist, p_item, i_mode, ORDER_NORMAL );
+ vlc_mutex_unlock(&p_playlist->object_lock );
+ }
+ else
+ {
+ int i;
+
+ for (i = 0 ; i < p_item->i_parents ; i++)
+ {
+ if (p_item->pp_parents[i]->i_view == VIEW_SIMPLE)
+ {
+ vlc_mutex_lock(&p_playlist->object_lock );
+ playlist_RecursiveNodeSort( p_playlist,
+ p_item->pp_parents[i]->p_parent, i_mode, ORDER_NORMAL );
+ vlc_mutex_unlock(&p_playlist->object_lock );
+ break;
+ }
+ }
+ }
+ vlc_object_release(p_playlist);
+ [self playlistUpdated];
+}
+
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{
int i_item;