Commit ada76aae authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* modules/gui/macosx/controls.m:

* modules/gui/macosx/intf.m:
  - Our Next/Previous commands now go from chapter trough title trough playlist.
  - We weren't checking for titles without chapters, which made using CDDA
    a little hard.
* modules/gui/macosx/playlist.m: An improved way to delete selected items.
  - also fixes a bug where only half the items selected in the playlist got
    actually deleted.
parent 08e46e02
......@@ -2,7 +2,7 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: controls.m,v 1.41 2003/06/03 22:21:46 hartman Exp $
* $Id: controls.m,v 1.42 2003/06/30 01:51:10 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -130,6 +130,7 @@
- (IBAction)prev:(id)sender
{
vlc_value_t val;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
......@@ -151,24 +152,35 @@
vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
#define p_area p_playlist->p_input->stream.p_selected_area
if( p_area->i_part_nb > 1 && p_area->i_part > 1 )
NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
if( p_area->i_part > 0 && p_area->i_part_nb > 1)
{
p_area->i_part--;
NSLog(@"Prev Chap");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
vlc_mutex_unlock( &p_playlist->object_lock );
var_Get( p_playlist->p_input, "prev-chapter", &val );
var_Set( p_playlist->p_input, "prev-chapter", val );
p_intf->p_sys->b_input_update = VLC_TRUE;
}
else if( p_area->i_id > 1 )
{
NSLog(@"Prev Title");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
input_ChangeArea( p_playlist->p_input, p_area );
vlc_mutex_unlock( &p_playlist->object_lock );
var_Get( p_playlist->p_input, "prev-title", &val );
var_Set( p_playlist->p_input, "prev-title", val );
p_intf->p_sys->b_input_update = VLC_TRUE;
}
else
{
NSLog(@"Prev PlaylistItem");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Prev( p_playlist );
}
NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
#undef p_area
vlc_object_release( p_playlist );
......@@ -176,6 +188,7 @@
- (IBAction)next:(id)sender
{
vlc_value_t val;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
......@@ -184,7 +197,7 @@
{
return;
}
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->p_input == NULL )
......@@ -197,24 +210,35 @@
vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
#define p_area p_playlist->p_input->stream.p_selected_area
if( p_area->i_part_nb > 1 && p_area->i_part + 1 < p_area->i_part_nb )
NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
if( p_area->i_part < p_area->i_part_nb && p_area->i_part_nb > 1 )
{
p_area->i_part++;
NSLog(@"Next Chap");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
vlc_mutex_unlock( &p_playlist->object_lock );
var_Get( p_playlist->p_input, "next-chapter", &val );
var_Set( p_playlist->p_input, "next-chapter", val );
p_intf->p_sys->b_input_update = VLC_TRUE;
}
else if( p_area->i_id < p_playlist->p_input->stream.i_area_nb )
{
NSLog(@"Next Title");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
input_ChangeArea( p_playlist->p_input, p_area );
vlc_mutex_unlock( &p_playlist->object_lock );
var_Get( p_playlist->p_input, "next-title", &val );
var_Set( p_playlist->p_input, "next-title", val );
p_intf->p_sys->b_input_update = VLC_TRUE;
}
else
{
NSLog(@"Next PlaylistItem");
vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Next( p_playlist );
}
NSLog( @"current title: %d, all titles: %d\ncurrent chapter: %d, all chapters: %d", p_area->i_id, p_playlist->p_input->stream.i_area_nb, p_area->i_part, p_area->i_part_nb);
#undef p_area
vlc_object_release( p_playlist );
......@@ -651,7 +675,7 @@
if( p_input != NULL )
{
vlc_mutex_lock( &p_input->stream.stream_lock );
bEnabled |= p_input->stream.p_selected_area->i_part_nb > 1;
bEnabled |= p_input->stream.i_area_nb > 1;
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
}
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.90 2003/06/17 14:43:22 hartman Exp $
* $Id: intf.m,v 1.91 2003/06/30 01:51:10 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -669,8 +669,8 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
/* control buttons for free pace streams */
b_control = p_input->stream.b_pace_control;
/* chapters */
b_chapters = p_input->stream.p_selected_area->i_part_nb > 1;
/* chapters & titles */
b_chapters = p_input->stream.i_area_nb > 1;
/* play status */
p_intf->p_sys->b_play_status =
......
......@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.m,v 1.26 2003/06/29 00:14:50 hartman Exp $
* $Id: playlist.m,v 1.27 2003/06/30 01:51:10 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net>
......@@ -57,7 +57,10 @@ int MacVersion102 = -1;
- (void)keyDown:(NSEvent *)o_event
{
unichar key = 0;
int i_row;
int i, c, i_row;
NSMutableArray *o_to_delete;
NSNumber *o_number;
playlist_t * p_playlist;
intf_thread_t * p_intf = [NSApp getIntf];
......@@ -89,16 +92,20 @@ int MacVersion102 = -1;
case NSDeleteFunctionKey:
case NSDeleteCharFunctionKey:
case NSBackspaceCharacter:
while( ( i_row = [self selectedRow] ) != -1 )
{
o_to_delete = [NSMutableArray arrayWithArray:[[self selectedRowEnumerator] allObjects]];
c = [o_to_delete count];
for( i = 0; i < c; i++ ) {
o_number = [o_to_delete lastObject];
i_row = [o_number intValue];
if( p_playlist->i_index == i_row && p_playlist->i_status )
{
playlist_Stop( p_playlist );
}
playlist_Delete( p_playlist, i_row );
[o_to_delete removeObject: o_number];
[self deselectRow: i_row];
playlist_Delete( p_playlist, i_row );
}
[self reloadData];
break;
......@@ -236,7 +243,9 @@ int MacVersion102 = -1;
- (IBAction)deleteItems:(id)sender
{
int i_row;
int i, c, i_row;
NSMutableArray *o_to_delete;
NSNumber *o_number;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
......@@ -246,17 +255,21 @@ int MacVersion102 = -1;
{
return;
}
while( ( i_row = [o_table_view selectedRow] ) != -1 )
{
o_to_delete = [NSMutableArray arrayWithArray:[[o_table_view selectedRowEnumerator] allObjects]];
c = [o_to_delete count];
for( i = 0; i < c; i++ ) {
o_number = [o_to_delete lastObject];
i_row = [o_number intValue];
if( p_playlist->i_index == i_row && p_playlist->i_status )
{
playlist_Stop( p_playlist );
}
playlist_Delete( p_playlist, i_row );
[o_to_delete removeObject: o_number];
[o_table_view deselectRow: i_row];
playlist_Delete( p_playlist, i_row );
}
vlc_object_release( p_playlist );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment