]> git.sesse.net Git - vlc/commitdiff
Improvements of the OS X GUI.
authorChristophe Massiot <massiot@videolan.org>
Mon, 6 May 2002 22:59:46 +0000 (22:59 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 6 May 2002 22:59:46 +0000 (22:59 +0000)
12 files changed:
extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib
extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib
include/config.h
plugins/macosx/intf_controller.c
plugins/macosx/intf_controller.h
plugins/macosx/intf_macosx.c
plugins/macosx/intf_open.h
plugins/macosx/intf_vlc_wrapper.c
plugins/macosx/intf_vlc_wrapper.h
plugins/macosx/macosx.h
src/interface/intf_eject.c

index 5cf53211981c2e1d98fcc4c329100b24e9ff1b2a..9526066dc171622211aab6188522df15e52d53dc 100644 (file)
@@ -3,7 +3,10 @@
         {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
         {
             ACTIONS = {
+                eject = id; 
                 faster = id; 
+                fullscreen = id; 
+                mute = id; 
                 next = id; 
                 pause = id; 
                 play = id; 
index 285b4ee8c6081063536056f5a5efbef7dad40f53..ebcee693612be75aa9803af904a8fc71e7fb9ba2 100644 (file)
@@ -3,16 +3,25 @@
 <plist version="0.9">
 <dict>
        <key>IBDocumentLocation</key>
-       <string>729 10 500 426 0 0 1600 1178 </string>
+       <string>13 255 500 426 0 0 1152 746 </string>
        <key>IBEditorPositions</key>
        <dict>
+               <key>235</key>
+               <string>401 417 350 182 0 0 1152 746 </string>
                <key>29</key>
-               <string>108 456 205 44 0 0 1600 1178 </string>
+               <string>804 409 205 44 0 0 1152 746 </string>
+               <key>445</key>
+               <string>347 561 370 117 0 0 1152 746 </string>
                <key>460</key>
-               <string>120 456 104 66 0 0 1600 1178 </string>
+               <string>84 279 104 66 0 0 1152 746 </string>
        </dict>
        <key>IBFramework Version</key>
        <string>248.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>29</integer>
+               <integer>21</integer>
+       </array>
        <key>IBSystem Version</key>
        <string>5Q125</string>
 </dict>
index 72efdbe17f9b8cba826f0088e967bd63bcd910ee..7103ef67661c2b263120ff0b596d8c992740d863 100644 (file)
Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/objects.nib differ
index b4b25a14d6d113348782c5c23d51e9db94bdce01..9ac8c1a0e1639c0ffe6a322f1e70022c826662de 100644 (file)
 
 /* Duration between the time we receive the data packet, and the time we will
  * mark it to be presented */
-#define DEFAULT_PTS_DELAY               (mtime_t)(.2*CLOCK_FREQ)
+#define DEFAULT_PTS_DELAY               (mtime_t)(.35*CLOCK_FREQ)
 
 /*****************************************************************************
  * Audio configuration
  * - short, in order to be able to play a new song very quickly (especially a
  *   song from the interface)
  * - long, in order to perform the buffer calculations as few as possible */
-#define AOUT_BUFFER_DURATION            100000
+#define AOUT_BUFFER_DURATION            90000
 
 /*****************************************************************************
  * Video configuration
index 6030d632430afc0c04bbe379ae95c931a2bd584e..b30c9257b2315e38f417c108d9e1fa2de608ad5a 100644 (file)
@@ -2,7 +2,7 @@
  * intf_controller.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.c,v 1.6 2002/04/23 03:21:21 jlj Exp $
+ * $Id: intf_controller.c,v 1.7 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
     [o_intf playlistNext];
 }
 
+- (IBAction)mute:(id)sender
+{
+    NSMenuItem * item = (NSMenuItem *)sender;
+
+    [o_intf mute];
+
+    if( p_main->p_intf->p_sys->b_mute )
+    {
+        [item setState:NSOnState];
+    }
+    else
+    {
+        [item setState:NSOffState];
+    }
+}
+
+- (IBAction)fullscreen:(id)sender
+{
+    [o_intf fullscreen];
+}
+
+- (IBAction)eject:(id)sender
+{
+    [o_intf eject];
+}
+
 - (IBAction)timesliderUpdate:(id)slider
 {
     switch( [[NSApp currentEvent] type] )
index 835e9bcc211afc0dc7e1ab10d6c41041e754ca61..f93de7b5a11635234faadfac7ef7794fefa03240 100644 (file)
@@ -2,7 +2,7 @@
  * intf_controller.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_controller.h,v 1.5 2002/04/23 03:21:21 jlj Exp $
+ * $Id: intf_controller.h,v 1.6 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *
@@ -73,6 +73,9 @@
 - (IBAction)slower:(id)sender;
 - (IBAction)prev:(id)sender;
 - (IBAction)next:(id)sender;
+- (IBAction)mute:(id)sender;
+- (IBAction)fullscreen:(id)fullscreen;
+- (IBAction)eject:(id)sender;
 - (IBAction)timesliderUpdate:(id)slider;
 - (IBAction)quit:(id)sender;
 
index d005f823316d0ac1d8d86dbf9168edb27adf5ac9..813f648856fe3d29ad1734f12feeff6e7936e747 100644 (file)
@@ -2,7 +2,7 @@
  * intf_macosx.c: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_macosx.c,v 1.12 2002/04/16 23:00:54 massiot Exp $
+ * $Id: intf_macosx.c,v 1.13 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -67,6 +67,7 @@ static int intf_Open( intf_thread_t *p_intf )
 
     p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
     p_intf->p_sys->o_port = [[NSPort port] retain];
+    p_intf->p_sys->b_mute = 0;
 
     [[NSApplication sharedApplication] autorelease];
     [NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
index 6b7a847482b6465bc4b91991b44deb9578a5616e..330a075f8cb4e3fcfd5cc85438b7103c805f10f4 100644 (file)
@@ -2,7 +2,7 @@
  * intf_open.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_open.h,v 1.1 2002/04/23 03:21:21 jlj Exp $
+ * $Id: intf_open.h,v 1.2 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *
@@ -26,6 +26,8 @@
  *****************************************************************************/
 #import <Cocoa/Cocoa.h>
 
+NSArray *GetEjectableMediaOfClass( const char *psz_class );
+
 /*****************************************************************************
  * Intf_Open interface
  *****************************************************************************/
index fadf403fba5e4b5d87ccc3ca3a20fd904deab9c5..000c56eb92ae09033056b341b9ae8972a343aa8d 100644 (file)
@@ -2,10 +2,11 @@
  * intf_vlc_wrapper.c: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_vlc_wrapper.c,v 1.10 2002/04/23 03:21:21 jlj Exp $
+ * $Id: intf_vlc_wrapper.c,v 1.11 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
+ *          Christophe Massiot <massiot@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <sys/param.h>                                    /* for MAXPATHLEN */
 #include <string.h>
 
+#include <IOKit/storage/IOCDMedia.h>
+#include <IOKit/storage/IODVDMedia.h>
+
 #include <videolan/vlc.h>
 
 #include "interface.h"
 #include "intf_playlist.h"
+#include "intf_eject.h"
 
 #include "video.h"
 #include "video_output.h"
+#include "audio_output.h"
+
 #include "stream_control.h"
 #include "input_ext-intf.h"
 
@@ -79,6 +86,28 @@ static Intf_VLCWrapper *o_intf = nil;
         return( 1 );
     }
 
+    if( p_input_bank->pp_input[0] != NULL )
+    {
+        vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
+
+        if( !p_input_bank->pp_input[0]->b_die )
+        {
+            /* New input or stream map change */
+            if( p_input_bank->pp_input[0]->stream.b_changed ||
+                p_main->p_intf->p_sys->i_part !=
+                p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
+            {
+                [self setupMenus];
+            }
+        }
+
+        vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
+    }
+    else
+    {
+        [self setupMenus];
+    }
+
     return( 0 );
 }
 
@@ -195,6 +224,47 @@ static Intf_VLCWrapper *o_intf = nil;
     }
 }
 
+- (void)mute
+{
+    if( p_aout_bank->pp_aout[0] == NULL ) return;
+
+    if( p_main->p_intf->p_sys->b_mute )
+    {
+        p_aout_bank->pp_aout[0]->i_volume = 
+                            p_main->p_intf->p_sys->i_saved_volume;
+    }
+    else
+    {
+        p_main->p_intf->p_sys->i_saved_volume = 
+                            p_aout_bank->pp_aout[0]->i_volume;
+        p_aout_bank->pp_aout[0]->i_volume = 0;
+    }
+    p_main->p_intf->p_sys->b_mute = !p_main->p_intf->p_sys->b_mute;
+}
+
+- (void)fullscreen
+{
+    if( p_vout_bank->pp_vout[0] != NULL )
+    {
+        p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
+    }
+}
+
+- (void)eject
+{
+    /* FIXME : this will only eject the first drive found */
+    NSArray * o_devices = GetEjectableMediaOfClass(kIODVDMediaClass);
+    const char * psz_device;
+
+    if ( o_devices == nil )
+    {
+        o_devices = GetEjectableMediaOfClass(kIOCDMediaClass);
+    }
+
+    psz_device = [[o_devices objectAtIndex:0] cString];
+    intf_Eject( psz_device );
+}
+
 /* playback info */
 
 #define p_area p_input_bank->pp_input[0]->stream.p_selected_area
@@ -418,4 +488,25 @@ static Intf_VLCWrapper *o_intf = nil;
     config_PutIntVariable( "channel_port", i_port ); 
 }
 
+- (void)setupMenus
+{
+#if 0
+    NSMenu * o_main_menu = [NSApp mainMenu];
+    NSMenuItem * o_program_item = [o_main_menu itemWithTitle:@"Program"];
+
+    if( p_input_bank->pp_input[0] == NULL )
+    {
+        NSMenu * o_program = [o_program_item submenu];
+        [o_program_item setEnabled:0];
+        [o_program removeItemAtIndex:0];
+    }
+    else
+    {
+        NSMenu * o_program = [o_program_item submenu];
+        [o_program_item setEnabled:1];
+        [o_program removeItemAtIndex:0];
+    }
+#endif
+}
+
 @end
index 39838bc6c9afd0c876124e16b9f28c1d5d3922d1..4e9d8e28770fb1edfc6ad065fb07d37311db6a64 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.5 2002/04/23 03:21:21 jlj Exp $
+ * $Id: intf_vlc_wrapper.h,v 1.6 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -45,6 +45,9 @@
 
 - (void)playSlower;
 - (void)playFaster;
+- (void)mute;
+- (void)fullscreen;
+- (void)eject;
 
 /* playback info */
 - (NSString *)getTimeAsString;
@@ -67,5 +70,6 @@
 - (void)openDisc:(NSString*)o_type device:(NSString*)o_device title:(int)i_title chapter:(int)i_chapter;
 - (void)openNet:(NSString*)o_protocol addr:(NSString*)o_addr port:(int)i_port baddr:(NSString*)o_baddr;
 - (void)openNetChannel:(NSString*)o_addr port:(int)i_port;
+- (void)setupMenus;
 
 @end
index 17a60a5733f0adad29f4dd1167efac026473dc33..3029c411dae6221851faf191be3fdbd13ecd14ff 100644 (file)
@@ -2,7 +2,7 @@
  * macosx.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: macosx.h,v 1.7 2002/04/25 23:07:23 massiot Exp $
+ * $Id: macosx.h,v 1.8 2002/05/06 22:59:46 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
@@ -37,6 +37,11 @@ typedef struct intf_sys_s
 {
     NSPort *o_port;
     NSAutoreleasePool *o_pool;
+
+    boolean_t b_mute;
+    int i_saved_volume;
+    
+    int i_part;
 } intf_sys_t;
 
 /*****************************************************************************
@@ -52,7 +57,7 @@ typedef struct vout_sys_s
     boolean_t b_mouse_moved;
     boolean_t b_mouse_pointer_visible;
     mtime_t i_time_mouse_last_moved;
-
+    
     CodecType i_codec;
     CGrafPtr p_qdport;
     ImageSequence i_seq;
index 06c89b903f5324671ca5efdf5062c7fac98d2b46..b26956a3eb342f73c0ea67dadc1262867915e206 100644 (file)
@@ -2,10 +2,11 @@
  * intf_eject.c: CD/DVD-ROM ejection handling functions
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: intf_eject.c,v 1.9 2002/04/04 22:08:05 massiot Exp $
+ * $Id: intf_eject.c,v 1.10 2002/05/06 22:59:46 massiot Exp $
  *
  * Author: Julien Blache <jb@technologeek.org> for the Linux part
  *               with code taken from the Linux "eject" command
+ *         Jon Lech Johanson <jon-vl@nanocrew.net> for Darwin
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -81,7 +82,6 @@ static int EjectSCSI ( int i_fd );
  *****************************************************************************/
 int intf_Eject( const char *psz_device )
 {
-    int i_fd;
     int i_ret;
 
 #ifdef SYS_DARWIN
@@ -99,7 +99,7 @@ int intf_Eject( const char *psz_device )
     if( ( psz_disk = (char *)strstr( psz_device, "disk" ) ) != NULL &&
         strlen( psz_disk ) > 4 )
     {
-#define EJECT_CMD "disktool -e %s 0"
+#define EJECT_CMD "/usr/sbin/disktool -e %s 0"
         snprintf( sz_cmd, sizeof(sz_cmd), EJECT_CMD, psz_disk );
 #undef EJECT_CMD
 
@@ -127,7 +127,9 @@ int intf_Eject( const char *psz_device )
 
     return 1;
 
-#endif
+#else /* SYS_DARWIN */
+
+    int i_fd;
 
     /* This code could be extended to support CD/DVD-ROM chargers */
 
@@ -164,6 +166,7 @@ int intf_Eject( const char *psz_device )
     close( i_fd );
 
     return i_ret;
+#endif
 }
 
 /* The following functions are local */