macosx: prepared fullscreen support and clean-up
[vlc.git] / modules / gui / macosx / controls.m
index 3c55d07..226d667 100644 (file)
     [[VLCCoreInteraction sharedInstance] stop];
 }
 
-- (IBAction)faster:(id)sender
-{
-    [[VLCCoreInteraction sharedInstance] faster];
-}
-
-- (IBAction)slower:(id)sender
-{
-    [[VLCCoreInteraction sharedInstance] slower];
-}
-
-- (IBAction)normalSpeed:(id)sender
-{
-    [[VLCCoreInteraction sharedInstance] normalSpeed];
-}
-
 - (IBAction)prev:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] previous];
 - (IBAction)random:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] shuffle];
-
-    vlc_value_t val;
-    playlist_t *p_playlist = pl_Get( VLCIntf );
-    var_Get( p_playlist, "random", &val );
-       if(val.b_bool) {
-        [o_btn_shuffle setImage: [NSImage imageNamed:@"shuffle-on"]];
-        [o_btn_shuffle setAlternateImage: [NSImage imageNamed:@"shuffle-blue-pressed"]];
-    }
-    else
-    {
-        [o_btn_shuffle setImage: [NSImage imageNamed:@"shuffle"]];
-        [o_btn_shuffle setAlternateImage: [NSImage imageNamed:@"shuffle-pressed"]];
-    }
-}
-
-- (IBAction)repeatButtonAction:(id)sender
-{
-    vlc_value_t looping,repeating;
-    intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Get( p_intf );
-
-    var_Get( p_playlist, "repeat", &repeating );
-    var_Get( p_playlist, "loop", &looping );
-
-    if( !repeating.b_bool && !looping.b_bool )
-    {
-        /* was: no repeating at all, switching to Repeat One */
-        [[VLCCoreInteraction sharedInstance] repeatOne];
-
-        [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-one"]];
-        [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-one-pressed"]];
-    }
-    else if( repeating.b_bool && !looping.b_bool )
-    {
-        /* was: Repeat One, switching to Repeat All */
-        [[VLCCoreInteraction sharedInstance] repeatAll];
-
-        [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-all"]];
-        [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-all-pressed"]];
-    }
-    else
-    {
-        /* was: Repeat All or bug in VLC, switching to Repeat Off */
-        [[VLCCoreInteraction sharedInstance] repeatOff];
-
-        [o_btn_repeat setImage: [NSImage imageNamed:@"repeat"]];
-        [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-pressed"]];
-    }
 }
 
-
 - (IBAction)repeat:(id)sender
 {
     vlc_value_t val;
     [[VLCCoreInteraction sharedInstance] backward];
 }
 
-
 - (IBAction)volumeUp:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] volumeUp];
     return NO;
 }
 
-- (IBAction)windowAction:(id)sender
-{
-    NSString *o_title = [sender title];
-    input_thread_t * p_input = pl_CurrentInput( VLCIntf );
-
-    if( p_input != NULL )
-    {
-        vout_thread_t *p_vout = input_GetVout( p_input );
-        if( p_vout != NULL )
-        {
-            id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
-            if( o_vout_view )
-            {
-                if( [o_title isEqualToString: _NS("Half Size") ] )
-                    [o_vout_view scaleWindowWithFactor: 0.5 animate: YES];
-                else if( [o_title isEqualToString: _NS("Normal Size") ] )
-                    [o_vout_view scaleWindowWithFactor: 1.0 animate: YES];
-                else if( [o_title isEqualToString: _NS("Double Size") ] )
-                    [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") ] )
-                {
-                    id o_window = [o_vout_view voutWindow];
-                    if( ![o_window isZoomed] )
-                        [o_window performZoom:self];
-                }
-                else if( [o_title isEqualToString: _NS("Snapshot") ] )
-                {
-                    [o_vout_view snapshot];
-                }
-                else
-                {
-                    [[VLCCoreInteraction sharedInstance] toggleFullscreen];
-                }
-            }
-            vlc_object_release( (vlc_object_t *)p_vout );
-        }
-        else
-        {
-            [[VLCCoreInteraction sharedInstance] toggleFullscreen];
-        }
-        vlc_object_release( p_input );
-    }
-}
-
 - (IBAction)telxTransparent:(id)sender
 {
     vlc_object_t *p_vbi;
 - (void)scrollWheel:(NSEvent *)theEvent
 {
     intf_thread_t * p_intf = VLCIntf;
+    BOOL b_invertedEventFromDevice = NO;
+    if ([theEvent respondsToSelector:@selector(isDirectionInvertedFromDevice)])
+    {
+        if ([theEvent isDirectionInvertedFromDevice])
+            b_invertedEventFromDevice = YES;
+    }
+
     float f_yabsvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY];
     float f_xabsvalue = [theEvent deltaX] > 0.0f ? [theEvent deltaX] : -[theEvent deltaX];
     int i, i_yvlckey, i_xvlckey;
 
-    if ([theEvent deltaY] < 0.0f)
-        i_yvlckey = KEY_MOUSEWHEELDOWN;
-    else
-        i_yvlckey = KEY_MOUSEWHEELUP;
+    if (b_invertedEventFromDevice)
+    {
+        if ([theEvent deltaY] > 0.0f)
+            i_yvlckey = KEY_MOUSEWHEELDOWN;
+        else
+            i_yvlckey = KEY_MOUSEWHEELUP;
 
-    if ([theEvent deltaX] < 0.0f)
-        i_xvlckey = KEY_MOUSEWHEELRIGHT;
+        if ([theEvent deltaX] > 0.0f)
+            i_xvlckey = KEY_MOUSEWHEELRIGHT;
+        else
+            i_xvlckey = KEY_MOUSEWHEELLEFT;
+    }
     else
-        i_xvlckey = KEY_MOUSEWHEELLEFT;
+    {
+        if ([theEvent deltaY] < 0.0f)
+            i_yvlckey = KEY_MOUSEWHEELDOWN;
+        else
+            i_yvlckey = KEY_MOUSEWHEELUP;
+
+        if ([theEvent deltaX] < 0.0f)
+            i_xvlckey = KEY_MOUSEWHEELRIGHT;
+        else
+            i_xvlckey = KEY_MOUSEWHEELLEFT;
+    }
 
     /* Send multiple key event, depending on the intensity of the event */
     for (i = 0; i < (int)(f_yabsvalue/4.+1.) && f_yabsvalue > 0.05 ; i++)