]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/controls.m
Qt4 - Open Dialog. Use #defines for tab naming to avoid miscomprehensions. Cosmectics.
[vlc] / modules / gui / macosx / controls.m
index d78236a7c4ee017d132d8a1a5397572d6fe35a93..92afaf8feaf9bac82255e8dccc4611ac2d7c9613 100644 (file)
@@ -1,13 +1,14 @@
 /*****************************************************************************
  * controls.m: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2005 the VideoLAN team
+ * Copyright (C) 2002-2006 the VideoLAN team
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *          Benjamin Pracht <bigben at videolan doit org>
+ *          Felix K\9fhne <fkuehne at videolan dot org>
  *
  * 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
@@ -38,7 +39,6 @@
 #import "playlist.h"
 #include <vlc_osd.h>
 
-
 /*****************************************************************************
  * VLCControls implementation 
  *****************************************************************************/
@@ -67,7 +67,7 @@
     playlist_t * p_playlist = pl_Yield( p_intf );
 
     vlc_mutex_lock( &p_playlist->object_lock );
-    if( p_playlist->i_size <= 0 )
+    if( playlist_IsEmpty( p_playlist ) )
     {
         vlc_mutex_unlock( &p_playlist->object_lock );
         vlc_object_release( p_playlist );
@@ -99,7 +99,7 @@
             o_vout_view = [o_embedded_vout_list getViewForWindow: o_window];
         }
         /* We have a detached vout */
-        else if( [[o_window className] isEqualToString: @"VLCWindow"] )
+        else if( [[o_window className] isEqualToString: @"VLCVoutWindow"] )
         {
             msg_Dbg( VLCIntf, "detached vout controls.m call getVoutView" );
             o_vout_view = [o_window getVoutView];
 /* three little ugly helpers */
 - (void)repeatOne
 {
-    [o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
-    [[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
-    [o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
-        [[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
+    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_single_embedded_blue"]];
+    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded_blue"]];
 }
 - (void)repeatAll
 {
-    [o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
-        [[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
-    [o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
-        [[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
+    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded_blue"]];
+    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_embedded"]];
 }
 - (void)repeatOff
 {
-    [o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
-        [[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
-    [o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
-    [[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
+    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat_embedded"]];
+    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat_single_embedded_blue"]];
 }
 - (void)shuffle
 {
     var_Get( p_playlist, "repeat", &repeating );
     var_Get( p_playlist, "loop", &looping );
 
-    [[o_btn_repeat image] release];
-    [[o_btn_repeat alternateImage] release];
-
     if( !repeating.b_bool && !looping.b_bool )
     {
         /* was: no repeating at all, switching to Repeat One */
     [o_main manageVolumeSlider];
 }
 
+- (IBAction)showPosition: (id)sender
+{
+    vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT,
+                                             FIND_ANYWHERE );
+    if( p_vout != NULL )
+    {
+        vlc_value_t val;
+        intf_thread_t * p_intf = VLCIntf;
+        val.i_int = config_GetInt( p_intf, "key-position" );
+        var_Set( p_intf, "key-pressed", val );
+        vlc_object_release( (vlc_object_t *)p_vout );
+    }
+}
+
+- (IBAction)toogleFullscreen:(id)sender {
+    NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""];             
+    [self windowAction: [o_mi autorelease]]; 
+}
+
+- (BOOL) isFullscreen {
+    id o_vout_view = [self getVoutView];
+    if( o_vout_view )
+    {
+        return [o_vout_view isFullscreen];
+    }
+    return NO;
+}
+
 - (IBAction)windowAction:(id)sender
 {
     NSString *o_title = [sender title];
         if( o_vout_view )
         {
             if( [o_title isEqualToString: _NS("Half Size") ] )
-                [o_vout_view scaleWindowWithFactor: 0.5];
+                [o_vout_view scaleWindowWithFactor: 0.5 animate: YES];
             else if( [o_title isEqualToString: _NS("Normal Size") ] )
-                [o_vout_view scaleWindowWithFactor: 1.0];
+                [o_vout_view scaleWindowWithFactor: 1.0 animate: YES];
             else if( [o_title isEqualToString: _NS("Double Size") ] )
-                [o_vout_view scaleWindowWithFactor: 2.0];
+                [o_vout_view scaleWindowWithFactor: 2.0 animate: YES];
             else if( [o_title isEqualToString: _NS("Float on Top") ] )
                 [o_vout_view toggleFloatOnTop];
             else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
     {
         if( p_input != NULL )
         {
-            bEnabled = p_input->input.b_can_pace_control;
+            bEnabled = p_input->b_can_pace_control;
         }
         else
         {
     else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
              [[o_mi title] isEqualToString: _NS("Next")] )
     {
-            bEnabled = p_playlist->i_size > 1;
+           /** \todo fix i_size use */
+            bEnabled = p_playlist->items.i_size > 1;
     }
     else if( [[o_mi title] isEqualToString: _NS("Random")] )
     {
 
             while( (o_window = [o_enumerator nextObject]))
             {
-                if( [[o_window className] isEqualToString: @"VLCWindow"] ||
+                if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
                             [[[VLCMain sharedInstance] getEmbeddedList]
                             windowContainsEmbedded: o_window])
                 {