]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.m
OS X intf work
[vlc] / modules / gui / macosx / intf.m
index d2cd62309d827cb8458a760d6b4ccb692d149dbb..80680ff95f59389347cebce1900807c716343023 100644 (file)
@@ -36,6 +36,8 @@
 #include "prefs.h"
 #include "playlist.h"
 #include "controls.h"
+#include "about.h"
+#include "open.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -289,7 +291,11 @@ static VLCMain *_o_sharedMainInstance = nil;
     } else {
         _o_sharedMainInstance = [super init];
     }
-
+    
+    o_about = [[VLAboutBox alloc] init];
+    o_prefs = [[VLCPrefs alloc] init];
+    o_open = [[VLCOpen alloc] init];
+    
     return _o_sharedMainInstance;
 }
 
@@ -363,11 +369,15 @@ static VLCMain *_o_sharedMainInstance = nil;
     i_key = config_GetInt( p_intf, "key-fullscreen" );
     [o_mi_fullscreen setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
     [o_mi_fullscreen setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
+    i_key = config_GetInt( p_intf, "key-snapshot" );
+    [o_mi_snapshot setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
+    [o_mi_snapshot setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
 
     var_Create( p_intf, "intf-change", VLC_VAR_BOOL );
 
     [self setSubmenusEnabled: FALSE];
     [self manageVolumeSlider];
+    [o_window setDelegate: self];
 
     p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
 
@@ -474,6 +484,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     [o_mi_fittoscreen setTitle: _NS("Fit to Screen")];
     [o_mi_fullscreen setTitle: _NS("Fullscreen")];
     [o_mi_floatontop setTitle: _NS("Float on Top")];
+    [o_mi_snapshot setTitle: _NS("Snapshot")];
     [o_mi_videotrack setTitle: _NS("Video Track")];
     [o_mu_videotrack setTitle: _NS("Video Track")];
     [o_mi_screen setTitle: _NS("Video Device")];
@@ -673,6 +684,15 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
 
+    switch( key )
+    {
+        case NSDeleteCharacter:
+        case NSDeleteFunctionKey:
+        case NSDeleteCharFunctionKey:
+        case NSBackspaceCharacter:
+            return YES;
+    }
+
     val.i_int |= CocoaKeyToVLC( key );
 
     for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
@@ -836,7 +856,7 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     if ( p_intf->p_sys->b_playlist_update )
     {
-       [o_playlist playlistUpdated];
+        [o_playlist playlistUpdated];
         p_intf->p_sys->b_playlist_update = VLC_FALSE;
     }
 
@@ -867,17 +887,13 @@ static VLCMain *_o_sharedMainInstance = nil;
             {
                 return;
             }
-
-            vlc_mutex_lock( &p_playlist->object_lock );
             o_temp = [NSString stringWithUTF8String:
-                p_playlist->p_input.psz_name];
+                p_playlist->status.p_item->input.psz_name];
             if( o_temp == NULL )
                 o_temp = [NSString stringWithCString:
-                    p_playlist->p_input.psz_name];
-            vlc_mutex_unlock( &p_playlist->object_lock );
+                    p_playlist->status.p_item->input.psz_name];
             [o_scrollfield setStringValue: o_temp ];
 
-
             p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
                                                     FIND_ANYWHERE );
             if( p_vout != NULL )
@@ -1270,6 +1286,59 @@ static VLCMain *_o_sharedMainInstance = nil;
     [self application: nil openFile: [sender title]];
 }
 
+- (IBAction)intfOpenFile:(id)sender
+{
+    if (!nib_open_loaded)
+    {
+        nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
+        [o_open awakeFromNib];
+        [o_open openFile];
+    } else {
+        [o_open openFile];
+    }
+}
+
+- (IBAction)intfOpenFileGeneric:(id)sender
+{
+    if (!nib_open_loaded)
+    {
+        nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
+        [o_open awakeFromNib];
+        [o_open openFileGeneric];
+    } else {
+        [o_open openFileGeneric];
+    }
+}
+
+- (IBAction)intfOpenDisc:(id)sender
+{
+    if (!nib_open_loaded)
+    {
+        nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
+        [o_open awakeFromNib];
+        [o_open openDisc];
+    } else {
+        [o_open openDisc];
+    }
+}
+
+- (IBAction)intfOpenNet:(id)sender
+{
+    if (!nib_open_loaded)
+    {
+        nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner:self];
+        [o_open awakeFromNib];
+        [o_open openNet];
+    } else {
+        [o_open openNet];
+    }
+}
+
+- (IBAction)viewAbout:(id)sender
+{
+    [o_about showPanel];
+}
+
 - (IBAction)viewPreferences:(id)sender
 {
     [o_prefs showPrefs];
@@ -1369,6 +1438,33 @@ static VLCMain *_o_sharedMainInstance = nil;
     }
 }
 
+- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize
+{
+    if( proposedFrameSize.height <= 200 )
+    {
+        if( [sender frame].size.height > 200 )
+        {
+            //rect_remember = [[o_playlist playlistView] frame];
+            o_document_view = [o_clip_view documentView];
+            [o_document_view retain];
+            [o_clip_view setDocumentView: NULL];
+        }
+        return NSMakeSize( proposedFrameSize.width, 95 );
+    }
+    else
+    {
+        if( [sender frame].size.height <= 200 )
+        {
+            [o_clip_view setDocumentView: o_document_view];
+            [o_document_view release];
+            [o_document_view setFrameSize: NSMakeSize( proposedFrameSize.width - 22, proposedFrameSize.height - 120 )];
+            //[[o_playlist playlistView] setFrame: rect_remember];
+        }
+        return proposedFrameSize;
+    }
+    return proposedFrameSize;
+}
+
 @end
 
 @implementation VLCMain (NSMenuValidation)