diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index 358f4192e151f21b6e44840d39aac0734451574a..1b6d452e7d32df6fc1e06b0066029edeff4b90b3 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -2,7 +2,7 @@ * controls.m: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: controls.m,v 1.14 2003/01/24 16:19:15 hartman Exp $ + * $Id: controls.m,v 1.15 2003/01/28 01:50:52 hartman Exp $ * * Authors: Jon Lech Johansen * Christophe Massiot @@ -241,29 +241,69 @@ - (IBAction)prev:(id)sender { intf_thread_t * p_intf = [NSApp getIntf]; + input_area_t * p_area; playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); - if( p_playlist == NULL ) + + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); + p_area = p_intf->p_sys->p_input->stream.p_selected_area; + + /* check if this is the first chapter and whether there are any chapters at all */ + if( p_area->i_part > 1 && p_area->i_part_nb > 1 ) { - return; - } + p_area->i_part--; + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); - playlist_Prev( p_playlist ); - vlc_object_release( p_playlist ); + input_ChangeArea( p_intf->p_sys->p_input, p_area ); + + p_intf->p_sys->b_chapter_update = VLC_TRUE; + } + else if( p_playlist != NULL ) + { + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + playlist_Prev( p_playlist ); + } + else + { + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + } + + if ( p_playlist != NULL ) + vlc_object_release( p_playlist ); } - (IBAction)next:(id)sender { intf_thread_t * p_intf = [NSApp getIntf]; + input_area_t * p_area; playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); - if( p_playlist == NULL ) + + vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock ); + p_area = p_intf->p_sys->p_input->stream.p_selected_area; + + /* check if this is the last chapter and whether there are any chapters at all */ + if( p_area->i_part_nb > 1 && p_area->i_part < p_area->i_part_nb ) { - return; - } + p_area->i_part++; + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); - playlist_Next( p_playlist ); - vlc_object_release( p_playlist ); + input_ChangeArea( p_intf->p_sys->p_input, p_area ); + + p_intf->p_sys->b_chapter_update = VLC_TRUE; + } + else if( p_playlist != NULL ) + { + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + playlist_Next( p_playlist ); + } + else + { + vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock ); + } + + if ( p_playlist != NULL ) + vlc_object_release( p_playlist ); } - (IBAction)loop:(id)sender diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 2a461547e1e39457f0935ab01e3e4a354dd5b95f..c2d7d93ec58d88be26b0a2a2c4959cff1548e479 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -2,7 +2,7 @@ * intf.m: MacOS X interface plugin ***************************************************************************** * Copyright (C) 2002-2003 VideoLAN - * $Id: intf.m,v 1.36 2003/01/27 00:08:31 jlj Exp $ + * $Id: intf.m,v 1.37 2003/01/28 01:50:52 hartman Exp $ * * Authors: Jon Lech Johansen * Christophe Massiot @@ -627,8 +627,10 @@ static void Run( intf_thread_t *p_intf ) - (void)setControlItems { intf_thread_t * p_intf = [NSApp getIntf]; vlc_bool_t b_input; - vlc_bool_t b_plmul = 0; - vlc_bool_t b_control = 0; + vlc_bool_t b_plmul = NO; + vlc_bool_t b_control = NO; + vlc_bool_t b_chapters = NO; + input_area_t * p_area; playlist_t * p_playlist = NULL; NSImage *playImage = [NSImage imageNamed:@"play"]; NSImage *pauseImage = [NSImage imageNamed:@"pause"]; @@ -643,18 +645,21 @@ static void Run( intf_thread_t *p_intf ) vlc_object_release( p_playlist ); } - if( ( b_input = ( p_intf->p_sys->p_input != NULL ) ) ) + if ( b_input = ( p_intf->p_sys->p_input != NULL ) ) { /* control buttons for free pace streams */ b_control = p_intf->p_sys->p_input->stream.b_pace_control; + p_area = p_intf->p_sys->p_input->stream.p_selected_area; + if ( p_area->i_part_nb > 1 ) + b_chapters = YES; } /* set control items */ [o_btn_stop setEnabled: b_input]; [o_btn_fastforward setEnabled: b_control]; [o_btn_slowmotion setEnabled: b_control]; - [o_btn_prev setEnabled: b_plmul]; - [o_btn_next setEnabled: b_plmul]; + [o_btn_prev setEnabled: (b_plmul || b_chapters) ]; + [o_btn_next setEnabled: (b_plmul || b_chapters) ]; [o_controls setVolumeSlider]; [o_timeslider setEnabled: b_input];