+- (NSMutableArray *)selectedPlaylistItemsList
+{
+ return [NSMutableArray arrayWithArray:[[o_table_view
+ selectedRowEnumerator] allObjects]];
+
+}
+
+- (void)deleteGroup:(int)i_id
+{
+ intf_thread_t * p_intf = VLCIntf;
+ playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ int i;
+ int i_newgroup = 0;
+
+ if (p_playlist)
+ {
+
+ /*first, change the group of all the items that belong to the group to
+ delete. Change it to the group with the smallest id.*/
+
+ /*search for the group with the smallest id*/
+
+ if(p_playlist->i_groups == 1)
+ {
+ msg_Warn(p_playlist,"Trying to delete last group, cancelling");
+ vlc_object_release(p_playlist);
+ return;
+ }
+
+ for (i = 0 ; i<p_playlist->i_groups ; i++)
+ {
+ if((i_newgroup == 0 || i_newgroup > p_playlist->pp_groups[i]->i_id)
+ && p_playlist->pp_groups[i]->i_id != i_id)
+ {
+ i_newgroup = p_playlist->pp_groups[i]->i_id;
+ }
+ }
+
+ vlc_mutex_lock( &p_playlist->object_lock );
+
+ for (i = 0; i < p_playlist->i_size;i++)
+ {
+ if (p_playlist->pp_items[i]->i_group == i_id)
+ {
+ vlc_mutex_lock(&p_playlist->pp_items[i]->input.lock);
+ p_playlist->pp_items[i]->i_group = i_newgroup;
+ vlc_mutex_unlock(&p_playlist->pp_items[i]->input.lock);
+ }
+ }
+ vlc_mutex_unlock( &p_playlist->object_lock );
+
+ playlist_DeleteGroup( p_playlist, i_id );
+
+ vlc_object_release(p_playlist);
+ [self playlistUpdated];
+ }
+}
+
+- (NSColor *)getColor:(int)i_group
+{
+ NSColor * o_color = nil;
+ switch ( i_group % 8 )
+ {
+ case 1:
+ /*white*/
+ o_color = [NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+ break;
+
+ case 2:
+ /*red*/
+ o_color = [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:0.76471 alpha:1.0];
+ break;
+
+ case 3:
+ /*dark blue*/
+ o_color = [NSColor colorWithDeviceRed:0.76471 green:0.76471 blue:1.0 alpha:1.0];
+ break;
+
+ case 4:
+ /*orange*/
+ o_color = [NSColor colorWithDeviceRed:1.0 green:0.89804 blue:0.76471 alpha:1.0];
+ break;
+
+ case 5:
+ /*purple*/
+ o_color = [NSColor colorWithDeviceRed:1.0 green:0.76471 blue:1.0 alpha:1.0];
+ break;
+
+ case 6:
+ /*green*/
+ o_color = [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:0.76471 alpha:1.0];
+ break;
+
+ case 7:
+ /*light blue*/
+ o_color = [NSColor colorWithDeviceRed:0.76471 green:1.0 blue:1.0 alpha:1.0];
+ break;
+
+ case 0:
+ /*yellow*/
+ o_color = [NSColor colorWithDeviceRed:1.0 green:1.0 blue:0.76471 alpha:1.0];
+ break;
+ }
+ return o_color;
+}
+