* New Loop menu item in OS X interface.
authorChristophe Massiot <massiot@videolan.org>
Sun, 2 Jun 2002 12:16:31 +0000 (12:16 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 2 Jun 2002 12:16:31 +0000 (12:16 +0000)
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
plugins/macosx/intf_controller.h
plugins/macosx/intf_controller.m
plugins/macosx/intf_macosx.m
plugins/macosx/intf_vlc_wrapper.h
plugins/macosx/intf_vlc_wrapper.m
plugins/macosx/macosx.h

index 444b99f..eed22e7 100644 (file)
@@ -6,6 +6,7 @@
                 eject = id; 
                 faster = id; 
                 fullscreen = id; 
+                loop = id; 
                 maxvolume = id; 
                 mute = id; 
                 next = id; 
index 4e9932a..3f218ae 100644 (file)
@@ -19,9 +19,8 @@
        <string>248.0</string>
        <key>IBOpenObjects</key>
        <array>
-               <integer>29</integer>
                <integer>528</integer>
-               <integer>21</integer>
+               <integer>29</integer>
        </array>
        <key>IBSystem Version</key>
        <string>5Q125</string>
index eb3e89a..d5a4bdc 100644 (file)
@@ -2,7 +2,7 @@
  * intf_controller.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.h,v 1.9 2002/06/02 01:20:52 massiot Exp $
+ * $Id: intf_controller.h,v 1.10 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *
@@ -68,7 +68,7 @@
 - (void)applicationWillFinishLaunching:(NSNotification *)o_notification;
 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
 
-/* Functions atteched to user interface */
+/* Functions attached to user interface */
 - (IBAction)pause:(id)sender;
 - (IBAction)play:(id)sender;
 - (IBAction)stop:(id)sender;
@@ -78,6 +78,7 @@
 - (IBAction)next:(id)sender;
 - (IBAction)prevChannel:(id)sender;
 - (IBAction)nextChannel:(id)sender;
+- (IBAction)loop:(id)sender;
 - (IBAction)mute:(id)sender;
 - (IBAction)fullscreen:(id)fullscreen;
 - (IBAction)eject:(id)sender;
@@ -85,4 +86,6 @@
 - (IBAction)timesliderUpdate:(id)slider;
 - (IBAction)quit:(id)sender;
 
+- (BOOL)validateMenuItem:(id)sender;
+
 @end
index 0db0732..e7f4b2e 100644 (file)
@@ -2,7 +2,7 @@
  * intf_controller.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.m,v 1.6 2002/06/02 01:20:52 massiot Exp $
+ * $Id: intf_controller.m,v 1.7 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
     [o_intf channelNext];
 }
 
+- (IBAction)loop:(id)sender
+{
+    NSMenuItem * item = (NSMenuItem *)sender;
+
+    [o_intf loop];
+
+    if( p_main->p_intf->p_sys->b_loop )
+    {
+        [item setState:NSOnState];
+    }
+    else
+    {
+        [item setState:NSOffState];
+    }
+}
+
 - (IBAction)mute:(id)sender
 {
     NSMenuItem * item = (NSMenuItem *)sender;
     [o_intf quit];
 }
 
+- (BOOL)validateMenuItem:(id)sender
+{
+    NSMenuItem * o_item = (NSMenuItem *)sender;
+
+    if ( [o_item tag] == 12 || [o_item tag] == 13 )
+    {
+        if( !config_GetIntVariable( "network-channel" ) )
+        {
+            return NO;
+        }
+    }
+        
+    return YES;
+}
+
 @end
 
 @implementation Intf_PlaylistDS
index 74e18d3..4932af9 100644 (file)
@@ -2,7 +2,7 @@
  * intf_macosx.c: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_macosx.m,v 1.3 2002/06/02 01:20:52 massiot Exp $
+ * $Id: intf_macosx.m,v 1.4 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -69,6 +69,7 @@ static int intf_Open( intf_thread_t *p_intf )
     p_intf->p_sys->b_mute = 0;
     p_intf->p_sys->i_part = 0;
     p_intf->p_sys->b_disabled_menus = 0; 
+    p_intf->p_sys->b_loop = 0; 
     p_intf->p_sys->>i_channel = 0; 
 
     [[NSApplication sharedApplication] autorelease];
index 5a24172..534e191 100644 (file)
@@ -2,7 +2,7 @@
  * intf_vlc_wrapper.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.h,v 1.9 2002/06/02 01:20:52 massiot Exp $
+ * $Id: intf_vlc_wrapper.h,v 1.10 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -44,6 +44,7 @@
 - (void)playlistPrev;
 - (void)channelNext;
 - (void)channelPrev;
+- (void)loop;
 
 - (void)playSlower;
 - (void)playFaster;
index 04588c3..4a1cd8f 100644 (file)
@@ -2,7 +2,7 @@
  * intf_vlc_wrapper.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.m,v 1.10 2002/06/02 01:20:52 massiot Exp $
+ * $Id: intf_vlc_wrapper.m,v 1.11 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -275,6 +275,23 @@ static Intf_VLCWrapper *o_intf = nil;
     vlc_mutex_unlock( &p_intf->change_lock );
 }
 
+- (void)loop
+{
+    intf_thread_t * p_intf = p_main->p_intf;
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistDelete( p_main->p_playlist,
+                             p_main->p_playlist->i_size - 1 );
+    }
+    else
+    {
+        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
+                          "vlc:loop" );
+    }
+    p_intf->p_sys->b_loop = !p_intf->p_sys->b_loop;
+}
+
 - (void)playSlower
 {
     if( p_input_bank->pp_input[0] != NULL )
@@ -499,6 +516,13 @@ static Intf_VLCWrapper *o_intf = nil;
     NSString *o_file;
     int i_end = p_main->p_playlist->i_size;
     NSEnumerator *o_enum = [o_files objectEnumerator];
+    intf_thread_t * p_intf = p_main->p_intf;
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistDelete( p_main->p_playlist,
+                             p_main->p_playlist->i_size - 1 );
+    }
 
     while( ( o_file = (NSString *)[o_enum nextObject] ) )
     {
@@ -513,16 +537,29 @@ static Intf_VLCWrapper *o_intf = nil;
     }
 
     intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
+                          "vlc:loop" );
+    }
 }
 
 - (void)openDisc:(NSString*)o_type device:(NSString*)o_device title:(int)i_title chapter:(int)i_chapter
 {
     NSString *o_source;
     int i_end = p_main->p_playlist->i_size;
+    intf_thread_t * p_intf = p_main->p_intf;
 
     o_source = [NSString stringWithFormat: @"%@:%@@%d,%d", 
                     o_type, o_device, i_title, i_chapter];
 
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistDelete( p_main->p_playlist,
+                             p_main->p_playlist->i_size - 1 );
+    }
+
     intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
                       [o_source fileSystemRepresentation] );
 
@@ -533,12 +570,19 @@ static Intf_VLCWrapper *o_intf = nil;
     }
 
     intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
+                          "vlc:loop" );
+    }
 }
 
 - (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr
 {
     NSString *o_source;
     int i_end = p_main->p_playlist->i_size;
+    intf_thread_t * p_intf = p_main->p_intf;
 
     if( p_input_bank->pp_input[0] != NULL )
     {
@@ -558,10 +602,22 @@ static Intf_VLCWrapper *o_intf = nil;
                         o_protocol, o_addr, i_port];
     }
 
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistDelete( p_main->p_playlist,
+                             p_main->p_playlist->i_size - 1 );
+    }
+
     intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
                       [o_source fileSystemRepresentation] );
 
     intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
+
+    if ( p_intf->p_sys->b_loop )
+    {
+        intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, 
+                          "vlc:loop" );
+    }
 }
 
 - (void)openNetChannel:(NSString*)o_addr port:(int)i_port
@@ -737,8 +793,8 @@ static Intf_VLCWrapper *o_intf = nil;
     o_chapter_item = [[o_controls_item submenu] itemWithTitle: @"Chapter"]; 
     o_language_item = [[o_controls_item submenu] itemWithTitle: @"Language"]; 
     o_subtitle_item = [[o_controls_item submenu] itemWithTitle: @"Subtitles"]; 
-    o_next_channel_item = [[o_controls_item submenu] itemWithTag: 2]; 
-    o_prev_channel_item = [[o_controls_item submenu] itemWithTag: 1]; 
+    o_next_channel_item = [[o_controls_item submenu] itemWithTag: 13]; 
+    o_prev_channel_item = [[o_controls_item submenu] itemWithTag: 12]; 
 
     if( p_input == NULL )
     {
@@ -1007,17 +1063,6 @@ static Intf_VLCWrapper *o_intf = nil;
         }
         p_input->stream.b_changed = 0;
     }
-
-    if( config_GetIntVariable( "network-channel" ) )
-    {
-        [o_next_channel_item setEnabled: 1];
-        [o_prev_channel_item setEnabled: 1];
-    }
-    else
-    {
-        [o_next_channel_item setEnabled: 0];
-        [o_prev_channel_item setEnabled: 0];
-    }
 }
 
 @end
index 774e9bf..668904d 100644 (file)
@@ -2,7 +2,7 @@
  * macosx.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: macosx.h,v 1.11 2002/06/02 01:20:52 massiot Exp $
+ * $Id: macosx.h,v 1.12 2002/06/02 12:16:31 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
@@ -43,6 +43,7 @@ struct intf_sys_s
     
     int i_part;
     vlc_bool_t b_disabled_menus;
+    vlc_bool_t b_loop;
     int i_channel;
 };