macosx: move re-useable code from VLCControls to a custom class
authorFelix Paul Kühne <fkuehne@videolan.org>
Thu, 30 Jun 2011 13:29:55 +0000 (15:29 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Thu, 30 Jun 2011 13:32:06 +0000 (15:32 +0200)
this also prepares a mainwindow object and includes some clean-up

19 files changed:
extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib
extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
extras/package/macosx/vlc.xcodeproj/project.pbxproj
modules/gui/macosx/CoreInteraction.h [new file with mode: 0644]
modules/gui/macosx/CoreInteraction.m [new file with mode: 0644]
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainWindow.h [new file with mode: 0644]
modules/gui/macosx/MainWindow.m [new file with mode: 0644]
modules/gui/macosx/Modules.am
modules/gui/macosx/controls.h
modules/gui/macosx/controls.m
modules/gui/macosx/embeddedwindow.m
modules/gui/macosx/fspanel.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/misc.h
modules/gui/macosx/misc.m
modules/gui/macosx/playlist.m
po/POTFILES.in

index 2255343..057c202 100644 (file)
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
-      <integer value="283"/>
       <integer value="24"/>
-      <integer value="915"/>
-      <integer value="2417"/>
       <integer value="2730"/>
       <integer value="2"/>
+      <integer value="283"/>
+      <integer value="2417"/>
+      <integer value="915"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
                   </object>
                   <string key="NSFrame">{{1, 17}, {604, 231}}</string>
                   <reference key="NSSuperview" ref="915491793"/>
+                  <reference key="NSNextKeyView" ref="23448837"/>
                   <reference key="NSDocView" ref="23448837"/>
                   <reference key="NSBGColor" ref="885475112"/>
                   <int key="NScvFlags">4</int>
                   </object>
                   <string key="NSFrame">{{1, 0}, {604, 17}}</string>
                   <reference key="NSSuperview" ref="915491793"/>
+                  <reference key="NSNextKeyView" ref="823165105"/>
                   <reference key="NSDocView" ref="823165105"/>
                   <reference key="NSBGColor" ref="885475112"/>
                   <int key="NScvFlags">4</int>
               </object>
               <string key="NSFrame">{{-1, 36}, {606, 249}}</string>
               <reference key="NSSuperview" ref="429932428"/>
+              <reference key="NSNextKeyView" ref="343242432"/>
               <int key="NSsFlags">133682</int>
               <reference key="NSVScroller" ref="573737110"/>
               <reference key="NSHScroller" ref="297523533"/>
@@ -5018,14 +5021,6 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">2759</int>
         </object>
-        <object class="IBConnectionRecord">
-          <object class="IBOutletConnection" key="connection">
-            <string key="label">o_fs_panel</string>
-            <reference key="source" ref="113811151"/>
-            <reference key="destination" ref="662599125"/>
-          </object>
-          <int key="connectionID">2786</int>
-        </object>
         <object class="IBConnectionRecord">
           <object class="IBOutletConnection" key="connection">
             <string key="label">o_btn_shuffle</string>
@@ -6802,6 +6797,14 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">4594</int>
         </object>
+        <object class="IBConnectionRecord">
+          <object class="IBOutletConnection" key="connection">
+            <string key="label">o_fs_panel</string>
+            <reference key="source" ref="113811151"/>
+            <reference key="destination" ref="662599125"/>
+          </object>
+          <int key="connectionID">4595</int>
+        </object>
       </object>
       <object class="IBMutableOrderedSet" key="objectRecords">
         <object class="NSArray" key="orderedObjects">
@@ -10273,9 +10276,9 @@ LCAuLi4</string>
           <string>{{473, 633}, {137, 103}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{71, 176}, {604, 310}}</string>
+          <string>{{329, 176}, {604, 310}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-          <string>{{71, 176}, {604, 310}}</string>
+          <string>{{329, 176}, {604, 310}}</string>
           <boolean value="YES"/>
           <boolean value="YES"/>
           <boolean value="YES"/>
@@ -10885,7 +10888,7 @@ LCAuLi4</string>
         </object>
       </object>
       <nil key="sourceID"/>
-      <int key="maxID">4594</int>
+      <int key="maxID">4595</int>
     </object>
     <object class="IBClassDescriber" key="IBDocument.Classes">
       <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
@@ -11174,6 +11177,7 @@ LCAuLi4</string>
               <bool key="EncodedWithXMLCoder">YES</bool>
               <string>o_btn_repeat</string>
               <string>o_btn_shuffle</string>
+              <string>o_fs_panel</string>
               <string>o_main</string>
               <string>o_specificTime_cancel_btn</string>
               <string>o_specificTime_enter_fld</string>
@@ -11189,6 +11193,7 @@ LCAuLi4</string>
               <bool key="EncodedWithXMLCoder">YES</bool>
               <string>id</string>
               <string>id</string>
+              <string>VLCFSPanel</string>
               <string>id</string>
               <string>id</string>
               <string>id</string>
@@ -11207,6 +11212,7 @@ LCAuLi4</string>
               <bool key="EncodedWithXMLCoder">YES</bool>
               <string>o_btn_repeat</string>
               <string>o_btn_shuffle</string>
+              <string>o_fs_panel</string>
               <string>o_main</string>
               <string>o_specificTime_cancel_btn</string>
               <string>o_specificTime_enter_fld</string>
@@ -11228,6 +11234,10 @@ LCAuLi4</string>
                 <string key="name">o_btn_shuffle</string>
                 <string key="candidateClassName">id</string>
               </object>
+              <object class="IBToOneOutletInfo">
+                <string key="name">o_fs_panel</string>
+                <string key="candidateClassName">VLCFSPanel</string>
+              </object>
               <object class="IBToOneOutletInfo">
                 <string key="name">o_main</string>
                 <string key="candidateClassName">id</string>
@@ -11270,11 +11280,19 @@ LCAuLi4</string>
               </object>
             </object>
           </object>
-          <object class="IBClassDescriptionSource" key="sourceIdentifier" id="361672446">
+          <object class="IBClassDescriptionSource" key="sourceIdentifier">
             <string key="majorKey">IBDocumentRelativeSource</string>
             <string key="minorKey">../../../../../modules/gui/macosx/controls.h</string>
           </object>
         </object>
+        <object class="IBPartialClassDescription">
+          <string key="className">VLCFSPanel</string>
+          <string key="superclassName">NSWindow</string>
+          <object class="IBClassDescriptionSource" key="sourceIdentifier">
+            <string key="majorKey">IBDocumentRelativeSource</string>
+            <string key="minorKey">../../../../../modules/gui/macosx/fspanel.h</string>
+          </object>
+        </object>
         <object class="IBPartialClassDescription">
           <string key="className">VLCMain</string>
           <string key="superclassName">NSObject</string>
@@ -11368,6 +11386,7 @@ LCAuLi4</string>
               <string>o_btn_stop</string>
               <string>o_controls</string>
               <string>o_coredialogs</string>
+              <string>o_coreinteraction</string>
               <string>o_crashrep_desc_txt</string>
               <string>o_crashrep_dontSend_btn</string>
               <string>o_crashrep_fld</string>
@@ -11410,6 +11429,7 @@ LCAuLi4</string>
               <string>NSButton</string>
               <string>VLCControls</string>
               <string>id</string>
+              <string>id</string>
               <string>NSTextField</string>
               <string>NSButton</string>
               <string>NSTextView</string>
@@ -11455,6 +11475,7 @@ LCAuLi4</string>
               <string>o_btn_stop</string>
               <string>o_controls</string>
               <string>o_coredialogs</string>
+              <string>o_coreinteraction</string>
               <string>o_crashrep_desc_txt</string>
               <string>o_crashrep_dontSend_btn</string>
               <string>o_crashrep_fld</string>
@@ -11533,6 +11554,10 @@ LCAuLi4</string>
                 <string key="name">o_coredialogs</string>
                 <string key="candidateClassName">id</string>
               </object>
+              <object class="IBToOneOutletInfo">
+                <string key="name">o_coreinteraction</string>
+                <string key="candidateClassName">id</string>
+              </object>
               <object class="IBToOneOutletInfo">
                 <string key="name">o_crashrep_desc_txt</string>
                 <string key="candidateClassName">NSTextField</string>
@@ -13178,7 +13203,7 @@ LCAuLi4</string>
         <object class="IBPartialClassDescription">
           <string key="className">VLCTimeField</string>
           <string key="superclassName">NSTextField</string>
-          <reference key="sourceIdentifier" ref="361672446"/>
+          <reference key="sourceIdentifier" ref="690328904"/>
         </object>
       </object>
     </object>
index 1b6c268..bf42c0e 100644 (file)
Binary files a/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ
index 6202038..e39ecbd 100644 (file)
                CC426FD01020D44F00A32659 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ../../contrib/Sparkle/Sparkle.framework; sourceTree = SOURCE_ROOT; };
                CC448A5A13B61D49009F72E0 /* MainMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainMenu.h; path = ../../../modules/gui/macosx/MainMenu.h; sourceTree = "<group>"; };
                CC448A5B13B61D49009F72E0 /* MainMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MainMenu.m; path = ../../../modules/gui/macosx/MainMenu.m; sourceTree = "<group>"; };
+               CC448A6013B68A0B009F72E0 /* CoreInteraction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CoreInteraction.h; path = ../../../modules/gui/macosx/CoreInteraction.h; sourceTree = "<group>"; };
+               CC448A6113B68A0B009F72E0 /* CoreInteraction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = CoreInteraction.m; path = ../../../modules/gui/macosx/CoreInteraction.m; sourceTree = "<group>"; };
+               CC448A6213B68A0B009F72E0 /* MainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainWindow.h; path = ../../../modules/gui/macosx/MainWindow.h; sourceTree = "<group>"; };
+               CC448A6313B68A0B009F72E0 /* MainWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MainWindow.m; path = ../../../modules/gui/macosx/MainWindow.m; sourceTree = "<group>"; };
                CC4A33210F8CB017000FC4A7 /* coredialogs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = coredialogs.m; path = ../../../modules/gui/macosx/coredialogs.m; sourceTree = SOURCE_ROOT; };
                CC4A33220F8CB017000FC4A7 /* coredialogs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = coredialogs.h; path = ../../../modules/gui/macosx/coredialogs.h; sourceTree = SOURCE_ROOT; };
                CC4D67F51348F587003FCC5B /* quartztext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = quartztext.c; path = ../../../modules/misc/text_renderer/quartztext.c; sourceTree = "<group>"; };
                                8ED6C27D03E2EB1C0059A3A7 /* intf.m */,
                                CC448A5A13B61D49009F72E0 /* MainMenu.h */,
                                CC448A5B13B61D49009F72E0 /* MainMenu.m */,
+                               CC448A6013B68A0B009F72E0 /* CoreInteraction.h */,
+                               CC448A6113B68A0B009F72E0 /* CoreInteraction.m */,
+                               CC448A6213B68A0B009F72E0 /* MainWindow.h */,
+                               CC448A6313B68A0B009F72E0 /* MainWindow.m */,
                                CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
                                CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
                                8E6BC6FA041684EC0059A3A7 /* controls.h */,
diff --git a/modules/gui/macosx/CoreInteraction.h b/modules/gui/macosx/CoreInteraction.h
new file mode 100644 (file)
index 0000000..ec44c65
--- /dev/null
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * CoreInteraction.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2011 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+#import <vlc_common.h>
+#import <vlc_interface.h>
+
+@interface VLCCoreInteraction : NSObject {
+    intf_thread_t * p_intf;
+
+    BOOL b_lockAspectRatio;
+}
++ (VLCCoreInteraction *)sharedInstance;
+
+- (void)play;
+- (void)stop;
+- (void)faster;
+- (void)slower;
+- (void)normalSpeed;
+- (void)next;
+- (void)previous;
+- (void)forward;
+- (void)backward;
+
+- (void)repeatOne;
+- (void)repeatAll;
+- (void)repeatOff;
+- (void)shuffle;
+
+- (void)volumeUp;
+- (void)volumeDown;
+- (void)mute;
+- (void)setVolume: (int)i_value;
+
+- (void)setAspectRatioLocked:(BOOL)b_value;
+- (BOOL)aspectRatioIsLocked;
+- (void)toggleFullscreen;
+- (id)voutView;
+@end
diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
new file mode 100644 (file)
index 0000000..faa1e25
--- /dev/null
@@ -0,0 +1,289 @@
+/*****************************************************************************
+ * CoreInteraction.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2011 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "CoreInteraction.h"
+#import "intf.h"
+#import "vout.h"
+#import "open.h"
+#import <vlc_playlist.h>
+#import <vlc_input.h>
+#import <vlc_keys.h>
+#import <vlc_osd.h>
+
+@implementation VLCCoreInteraction
+static VLCCoreInteraction *_o_sharedInstance = nil;
+
++ (VLCCoreInteraction *)sharedInstance
+{
+    return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
+}
+
+#pragma mark -
+#pragma mark Initialization
+
+- (id)init
+{
+    if( _o_sharedInstance)
+    {
+        [self dealloc];
+        return _o_sharedInstance;
+    }
+    else
+    {
+        _o_sharedInstance = [super init];
+        b_lockAspectRatio = YES;
+    }
+    
+    return _o_sharedInstance;
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver: self];
+    [super dealloc];
+}
+
+- (void)awakeFromNib
+{
+    [[NSNotificationCenter defaultCenter] addObserver: self 
+                                             selector: @selector(applicationWillFinishLaunching:)
+                                                 name: NSApplicationWillFinishLaunchingNotification
+                                               object: nil];
+}
+
+- (void)applicationWillFinishLaunching:(NSNotification *)o_notification
+{
+    p_intf = VLCIntf;
+}
+
+#pragma mark -
+#pragma mark Playback Controls
+
+- (void)play
+{
+    playlist_t * p_playlist = pl_Get( p_intf );
+    bool empty;
+    
+    PL_LOCK;
+    empty = playlist_IsEmpty( p_playlist );
+    PL_UNLOCK;
+    
+    if( empty )
+        [[[VLCMain sharedInstance] open] openFileGeneric];
+    
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
+}
+
+- (void)stop
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_STOP );
+    /* Close the window directly, because we do know that there
+     * won't be anymore video. It's currently waiting a bit. */
+    [[[self voutView] window] orderOut:self];
+}
+
+- (void)faster
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_FASTER );
+}
+
+- (void)slower
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_SLOWER );
+}
+
+- (void)normalSpeed
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_RATE_NORMAL );
+}
+
+- (void)previous
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PREV );
+}
+
+- (void)next
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_NEXT );
+}
+
+- (void)forward
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT );
+}
+
+- (void)backward
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT );
+}
+
+- (void)shuffle
+{
+    vlc_value_t val;
+    playlist_t * p_playlist = pl_Get( p_intf );
+    
+    var_Get( p_playlist, "random", &val );
+    val.b_bool = !val.b_bool;
+    var_Set( p_playlist, "random", val );
+    if( val.b_bool )
+    {
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
+        config_PutInt( p_playlist, "random", 1 );
+    }
+    else
+    {
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
+        config_PutInt( p_playlist, "random", 0 );
+    }
+    
+    p_intf->p_sys->b_playmode_update = true;
+    p_intf->p_sys->b_intf_update = true;
+}
+
+- (void)repeatAll
+{
+    playlist_t * p_playlist = pl_Get( p_intf );
+
+    var_SetBool( p_playlist, "repeat", NO );
+    var_SetBool( p_playlist, "loop", YES );
+    config_PutInt( p_playlist, "repeat", NO );
+    config_PutInt( p_playlist, "loop", YES );
+
+    //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
+
+    p_intf->p_sys->b_playmode_update = true;
+    p_intf->p_sys->b_intf_update = true;
+}
+
+- (void)repeatOne
+{
+    playlist_t * p_playlist = pl_Get( p_intf );
+
+    var_SetBool( p_playlist, "repeat", YES );
+    var_SetBool( p_playlist, "loop", NO );
+    config_PutInt( p_playlist, "repeat", YES );
+    config_PutInt( p_playlist, "loop", NO );
+
+    //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
+
+    p_intf->p_sys->b_playmode_update = true;
+    p_intf->p_sys->b_intf_update = true;
+}
+
+- (void)repeatOff
+{
+    playlist_t * p_playlist = pl_Get( p_intf );
+
+    var_SetBool( p_playlist, "repeat", NO );
+    var_SetBool( p_playlist, "loop", NO );
+    config_PutInt( p_playlist, "repeat", NO );
+    config_PutInt( p_playlist, "loop", NO );
+
+    //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
+
+    p_intf->p_sys->b_playmode_update = true;
+    p_intf->p_sys->b_intf_update = true;    
+}
+
+// CAVE: [o_main manageVolumeSlider]
+
+- (void)volumeUp
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
+}
+
+- (void)volumeDown
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
+}
+
+- (void)mute
+{
+    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_MUTE );
+}
+
+- (void)setVolume: (int)i_value
+{
+    playlist_t * p_playlist = pl_Get( p_intf );
+    int i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
+    aout_VolumeSet( p_playlist, i_value * i_volume_step );
+}
+
+#pragma mark -
+#pragma mark video output stuff
+
+- (void)setAspectRatioLocked:(BOOL)b_value
+{
+    b_lockAspectRatio = b_value;
+}
+
+- (BOOL)aspectRatioIsLocked
+{
+    return b_lockAspectRatio;
+}
+
+- (void)toggleFullscreen
+{
+    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 = [self voutView];
+            if( o_vout_view )
+                [o_vout_view toggleFullscreen];
+            vlc_object_release( p_vout );
+        }
+        else
+        {
+            playlist_t * p_playlist = pl_Get( VLCIntf );
+            var_ToggleBool( p_playlist, "fullscreen" );
+        }
+        vlc_object_release( p_input );
+    }
+}
+
+- (id)voutView
+{
+    id o_window;
+    id o_voutView = nil;
+    id o_embeddedViewList = [[VLCMain sharedInstance] embeddedList];
+    NSEnumerator *o_enumerator = [[NSApp orderedWindows] objectEnumerator];
+    while( !o_voutView && ( o_window = [o_enumerator nextObject] ) )
+    {
+        /* We have an embedded vout */
+        if( [o_embeddedViewList windowContainsEmbedded: o_window] )
+        {
+            o_voutView = [o_embeddedViewList viewForWindow: o_window];
+        }
+        /* We have a detached vout */
+        else if( [[o_window className] isEqualToString: @"VLCVoutWindow"] )
+        {
+            o_voutView = [o_window voutView];
+        }
+    }
+    return [[o_voutView retain] autorelease];
+}
+@end
index 12ce6d1..b8b2cc6 100644 (file)
@@ -38,6 +38,7 @@
 #import "controls.h"
 #import "playlistinfo.h"
 #import "vout.h"
+#import "CoreInteraction.h"
 
 @implementation VLCMainMenu
 static VLCMainMenu *_o_sharedInstance = nil;
@@ -789,7 +790,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
         o_lmi_tmp2 = [o_menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""];
         [o_lmi_tmp2 setTarget: self];
         [o_lmi_tmp2 setEnabled: YES];
-        [o_lmi_tmp2 setState: [[[VLCMain sharedInstance] controls] aspectRatioIsLocked]];
+        [o_lmi_tmp2 setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
         [o_parent setEnabled: YES];
         [o_menu addItem: [NSMenuItem separatorItem]];
     }
diff --git a/modules/gui/macosx/MainWindow.h b/modules/gui/macosx/MainWindow.h
new file mode 100644 (file)
index 0000000..1b63d4b
--- /dev/null
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * MainWindow.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2011 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+@interface VLCMainWindow : NSObject {
+
+}
+@end
\ No newline at end of file
diff --git a/modules/gui/macosx/MainWindow.m b/modules/gui/macosx/MainWindow.m
new file mode 100644 (file)
index 0000000..3337770
--- /dev/null
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * MainWindow.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2011 Felix Paul Kühne
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "MainWindow.h"
+
+@implementation VLCMainWindow
+
+
+@end
\ No newline at end of file
index be99164..44e0430 100644 (file)
@@ -12,6 +12,10 @@ SOURCES_macosx = \
        SPMediaKeyTap.m \
        MainMenu.h \
        MainMenu.m \
+       MainWindow.h \
+       MainWindow.m \
+       CoreInteraction.h \
+       CoreInteraction.m \
        about.h \
        about.m \
        applescript.h \
index 65f883e..dd5c105 100644 (file)
     IBOutlet id o_specificTime_stepper;
     IBOutlet id o_specificTime_mi;
 
-    VLCFSPanel *o_fs_panel;
-    BOOL b_lockAspectRatio;
+    IBOutlet VLCFSPanel *o_fs_panel;
 }
-- (id)voutView;
-- (BOOL)aspectRatioIsLocked;
-
 - (IBAction)play:(id)sender;
 - (IBAction)stop:(id)sender;
 - (IBAction)faster:(id)sender;
 - (IBAction)repeatButtonAction:(id)sender;
 - (IBAction)quitAfterPlayback:(id)sender;
 
-/* the three ugly helpers again */
-- (void)repeatOne;
-- (void)repeatAll;
-- (void)repeatOff;
-- (void)shuffle;
-
 - (IBAction)forward:(id)sender;
 - (IBAction)backward:(id)sender;
 
 - (IBAction)goToSpecificTime:(id)sender;
 
 - (id)fspanel;
-
-@end
-
-/*****************************************************************************
- * VLCTimeField interface
- *****************************************************************************
- * we need the implementation to catch our click-event in the controller window
- *****************************************************************************/
-
-@interface VLCTimeField : NSTextField
-{
-}
 @end
 
index cae20c3..3c55d07 100644 (file)
@@ -37,8 +37,8 @@
 #import "open.h"
 #import "controls.h"
 #import "playlist.h"
-#include <vlc_osd.h>
-#include <vlc_keys.h>
+#import "CoreInteraction.h"
+#import <vlc_keys.h>
 
 #pragma mark -
 /*****************************************************************************
@@ -50,7 +50,6 @@
 {
     [super init];
     o_fs_panel = [[VLCFSPanel alloc] init];
-    b_lockAspectRatio = YES;
     return self;
 }
 
 {
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
-    [o_fs_panel release];
-
     [super dealloc];
 }
 
 - (IBAction)play:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Get( p_intf );
-    bool empty;
-
-    PL_LOCK;
-    empty = playlist_IsEmpty( p_playlist );
-    PL_UNLOCK;
-
-    if( empty )
-        [[VLCOpen sharedInstance] openFileGeneric];
-
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
-}
-
-- (id)voutView
-{
-    id o_window;
-    id o_voutView = nil;
-    id o_embeddedViewList = [[VLCMain sharedInstance] embeddedList];
-    NSEnumerator *o_enumerator = [[NSApp orderedWindows] objectEnumerator];
-    while( !o_voutView && ( o_window = [o_enumerator nextObject] ) )
-    {
-        /* We have an embedded vout */
-        if( [o_embeddedViewList windowContainsEmbedded: o_window] )
-        {
-            o_voutView = [o_embeddedViewList viewForWindow: o_window];
-        }
-        /* We have a detached vout */
-        else if( [[o_window className] isEqualToString: @"VLCVoutWindow"] )
-        {
-            o_voutView = [o_window voutView];
-        }
-    }
-    return [[o_voutView retain] autorelease];
-}
-
-- (BOOL)aspectRatioIsLocked
-{
-    return b_lockAspectRatio;
+    [[VLCCoreInteraction sharedInstance] play];
 }
 
 - (IBAction)stop:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_STOP );
-    /* Close the window directly, because we do know that there
-     * won't be anymore video. It's currently waiting a bit. */
-    [[[self voutView] window] orderOut:self];
+    [[VLCCoreInteraction sharedInstance] stop];
 }
 
 - (IBAction)faster:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_FASTER );
+    [[VLCCoreInteraction sharedInstance] faster];
 }
 
 - (IBAction)slower:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_SLOWER );
+    [[VLCCoreInteraction sharedInstance] slower];
 }
 
 - (IBAction)normalSpeed:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_RATE_NORMAL );
+    [[VLCCoreInteraction sharedInstance] normalSpeed];
 }
 
 - (IBAction)prev:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PREV );
+    [[VLCCoreInteraction sharedInstance] previous];
 }
 
 - (IBAction)next:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_NEXT );
+    [[VLCCoreInteraction sharedInstance] next];
 }
 
 - (IBAction)random:(id)sender
 {
-    vlc_value_t val;
-    intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Get( p_intf );
+    [[VLCCoreInteraction sharedInstance] shuffle];
 
-    var_Get( p_playlist, "random", &val );
-    val.b_bool = !val.b_bool;
-    var_Set( p_playlist, "random", val );
-    if( val.b_bool )
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
-        config_PutInt( p_playlist, "random", 1 );
-    }
-    else
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
-        config_PutInt( p_playlist, "random", 0 );
-    }
-    [self shuffle];
-
-    p_intf->p_sys->b_playmode_update = true;
-    p_intf->p_sys->b_intf_update = true;
-}
-
-/* three little ugly helpers */
-- (void)repeatOne
-{
-    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-one"]];
-    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-one-pressed"]];
-}
-- (void)repeatAll
-{
-    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-all"]];
-    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-all-pressed"]];
-}
-- (void)repeatOff
-{
-    [o_btn_repeat setImage: [NSImage imageNamed:@"repeat"]];
-    [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-pressed"]];
-}
-- (void)shuffle
-{
     vlc_value_t val;
     playlist_t *p_playlist = pl_Get( VLCIntf );
     var_Get( p_playlist, "random", &val );
     if( !repeating.b_bool && !looping.b_bool )
     {
         /* was: no repeating at all, switching to Repeat One */
+        [[VLCCoreInteraction sharedInstance] repeatOne];
 
-        /* set our button's look */
-        [self repeatOne];
-
-        /* prepare core communication */
-        repeating.b_bool = true;
-        looping.b_bool = false;
-        config_PutInt( p_playlist, "repeat", 1 );
-        config_PutInt( p_playlist, "loop", 0 );
-
-        /* show the change */
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
+        [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];
 
-        /* set our button's look */
-        [self repeatAll];
-
-        /* prepare core communication */
-        repeating.b_bool = false;
-        looping.b_bool = true;
-        config_PutInt( p_playlist, "repeat", 0 );
-        config_PutInt( p_playlist, "loop", 1 );
-
-        /* show the change */
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
+        [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];
 
-        /* set our button's look */
-        [self repeatOff];
-
-        /* prepare core communication */
-        repeating.b_bool = false;
-        looping.b_bool = false;
-        config_PutInt( p_playlist, "repeat", 0 );
-        config_PutInt( p_playlist, "loop", 0 );
-
-        /* show the change */
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
+        [o_btn_repeat setImage: [NSImage imageNamed:@"repeat"]];
+        [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-pressed"]];
     }
-
-    /* communicate with core and the main intf loop */
-    var_Set( p_playlist, "repeat", repeating );
-    var_Set( p_playlist, "loop", looping );
-    p_intf->p_sys->b_playmode_update = true;
-    p_intf->p_sys->b_intf_update = true;
 }
 
 
     playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "repeat", &val );
-    if (!val.b_bool)
-    {
-        var_Set( p_playlist, "loop", val );
-    }
-    val.b_bool = !val.b_bool;
-    var_Set( p_playlist, "repeat", val );
-    if( val.b_bool )
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
-        config_PutInt( p_playlist, "repeat", 1 );
-    }
+    if(! val.b_bool )
+        [[VLCCoreInteraction sharedInstance] repeatOne];
     else
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
-        config_PutInt( p_playlist, "repeat", 0 );
-    }
-
-    p_intf->p_sys->b_playmode_update = true;
-    p_intf->p_sys->b_intf_update = true;
+        [[VLCCoreInteraction sharedInstance] repeatOff];
 }
 
 - (IBAction)loop:(id)sender
     playlist_t * p_playlist = pl_Get( p_intf );
 
     var_Get( p_playlist, "loop", &val );
-    if (!val.b_bool)
-    {
-        var_Set( p_playlist, "repeat", val );
-    }
-    val.b_bool = !val.b_bool;
-    var_Set( p_playlist, "loop", val );
-    if( val.b_bool )
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
-        config_PutInt( p_playlist, "loop", 1 );
-    }
+    if(! val.b_bool )
+        [[VLCCoreInteraction sharedInstance] repeatAll];
     else
-    {
-        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
-        config_PutInt( p_playlist, "loop", 0 );
-    }
-
-    p_intf->p_sys->b_playmode_update = true;
-    p_intf->p_sys->b_intf_update = true;
+        [[VLCCoreInteraction sharedInstance] repeatOff];
 }
 
 - (IBAction)quitAfterPlayback:(id)sender
 
 - (IBAction)forward:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT );
+    [[VLCCoreInteraction sharedInstance] forward];
 }
 
 - (IBAction)backward:(id)sender
 {
-    vlc_value_t val;
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT );
+    [[VLCCoreInteraction sharedInstance] backward];
 }
 
 
 - (IBAction)volumeUp:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
-    /* Manage volume status */
-    [o_main manageVolumeSlider];
+    [[VLCCoreInteraction sharedInstance] volumeUp];
 }
 
 - (IBAction)volumeDown:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
-    /* Manage volume status */
-    [o_main manageVolumeSlider];
+    [[VLCCoreInteraction sharedInstance] volumeDown];
 }
 
 - (IBAction)mute:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_MUTE );
-    /* Manage volume status */
-    [o_main manageVolumeSlider];
+    [[VLCCoreInteraction sharedInstance] mute];
 }
 
 - (IBAction)volumeSliderUpdated:(id)sender
 {
-    intf_thread_t * p_intf = VLCIntf;
-    playlist_t * p_playlist = pl_Get( p_intf );
-    audio_volume_t i_volume = (audio_volume_t)[sender intValue];
-    int i_volume_step;
-
-    i_volume_step = config_GetInt( p_intf->p_libvlc, "volume-step" );
-    aout_VolumeSet( p_playlist, i_volume * i_volume_step );
-    /* Manage volume status */
-    [o_main manageVolumeSlider];
+    [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
 }
 
 - (IBAction)showPosition: (id)sender
 }
 
 - (IBAction)toogleFullscreen:(id)sender {
-    NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""];
-    [self windowAction: [o_mi autorelease]];
+    [[VLCCoreInteraction sharedInstance] toggleFullscreen];
 }
 
 - (BOOL) isFullscreen {
-    id o_vout_view = [self voutView];
+    id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
     if( o_vout_view )
     {
         return [o_vout_view isFullscreen];
         vout_thread_t *p_vout = input_GetVout( p_input );
         if( p_vout != NULL )
         {
-            id o_vout_view = [self voutView];
+            id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
             if( o_vout_view )
             {
                 if( [o_title isEqualToString: _NS("Half Size") ] )
                 }
                 else
                 {
-                    /* Fullscreen state for next time will be saved here too */
-                    [o_vout_view toggleFullscreen];
+                    [[VLCCoreInteraction sharedInstance] toggleFullscreen];
                 }
             }
             vlc_object_release( (vlc_object_t *)p_vout );
         }
         else
         {
-            playlist_t * p_playlist = pl_Get( VLCIntf );
-
-            if( [o_title isEqualToString: _NS("Fullscreen")] ||
-                [sender isKindOfClass:[NSButton class]] )
-            {
-                var_ToggleBool( p_playlist, "fullscreen" );
-            }
+            [[VLCCoreInteraction sharedInstance] toggleFullscreen];
         }
         vlc_object_release( p_input );
     }
 
 - (IBAction)lockVideosAspectRatio:(id)sender
 {
-    if( [sender state] == NSOffState )
-        [sender setState: NSOnState];
-    else
-        [sender setState: NSOffState];
-
-    b_lockAspectRatio = !b_lockAspectRatio;
+    [[VLCCoreInteraction sharedInstance] setAspectRatioLocked: [sender state]];
+    [sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
 }
 
 - (IBAction)addSubtitleFile:(id)sender
     }
 }
 
+- (id)fspanel
+{
+    if( o_fs_panel )
+        return o_fs_panel;
+    else
+    {
+        msg_Err( VLCIntf, "FSPanel is nil" );
+        return NULL;
+    }
+}
+
 - (void)scrollWheel:(NSEvent *)theEvent
 {
     intf_thread_t * p_intf = VLCIntf;
                 /* Escape */
                 if( key == (unichar) 0x1b )
                 {
-                    id o_vout_view = [self voutView];
+                    id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
                     if( o_vout_view && [o_vout_view isFullscreen] )
                     {
                         [o_vout_view toggleFullscreen];
     }
 }
 
-- (id)fspanel
-{
-    if( o_fs_panel )
-        return o_fs_panel;
-    else
-    {
-        msg_Err( VLCIntf, "FSPanel is nil" );
-        return NULL;
-    }
-}
-
-@end
-
-/*****************************************************************************
- * VLCTimeField implementation
- *****************************************************************************
- * we need this to catch our click-event in the controller window
- *****************************************************************************/
-
-@implementation VLCTimeField
-- (void)mouseDown: (NSEvent *)ourEvent
-{
-    if( [ourEvent clickCount] > 1 )
-        [[[VLCMain sharedInstance] controls] goToSpecificTime: nil];
-    else
-        [[VLCMain sharedInstance] timeFieldWasClicked: self];
-}
 @end
index 82b4d33..e2a87c5 100644 (file)
@@ -31,6 +31,7 @@
 #import "vout.h"
 #import "embeddedwindow.h"
 #import "fspanel.h"
+#import "CoreInteraction.h"
 #import "playlist.h"
 #import <vlc_url.h>
 
     if( videoRatio.height == 0. || videoRatio.width == 0. )
         return proposedFrameSize;
 
-    if( [[[VLCMain sharedInstance] controls] aspectRatioIsLocked] )
+    if( [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked] )
     {
         NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
         NSRect contentRect = [self contentRectForFrameRect:[self frame]];
index 89f2b40..9957922 100644 (file)
@@ -26,7 +26,7 @@
  * Preamble
  *****************************************************************************/
 #import "intf.h"
-#import "controls.h"
+#import "CoreInteraction.h"
 #import "vout.h"
 #import "misc.h"
 #import "fspanel.h"
 
 - (void)setActive:(id)noData
 {
-    if( [[[VLCMain sharedInstance] controls] voutView] != nil )
+    if( [[VLCCoreInteraction sharedInstance] voutView] != nil )
     {
-        if( [[[[VLCMain sharedInstance] controls] voutView] isFullscreen] )
+        if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] )
         {
             b_nonActive = NO;
             [self fadeIn];
 - (void)mouseExited:(NSEvent *)theEvent
 {
     /* give up our focus, so the vout may show us again without letting the user clicking it */
-    if( [[[[VLCMain sharedInstance] controls] voutView] isFullscreen] )
-        [[[[[VLCMain sharedInstance] controls] voutView] window] makeKeyWindow];
+    if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] )
+        [[[[VLCCoreInteraction sharedInstance] voutView] window] makeKeyWindow];
 }
 
 - (void)hideMouse
 
 - (IBAction)fsVolumeSliderUpdate:(id)sender
 {
-    [[[VLCMain sharedInstance] controls] volumeSliderUpdated: sender];
+    [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
 }
 
 #define addImage(image, _x, _y, mode, _width)                                               \
index 92dfba2..7567aef 100644 (file)
@@ -110,6 +110,7 @@ struct intf_sys_t
     VLCInformation * o_info;    /* VLCInformation */
     id o_eyetv;                 /* VLCEyeTVController */
     id o_bookmarks;             /* VLCBookmarks */
+    id o_coreinteraction;       /* VLCCoreInteraction */
     BOOL nib_main_loaded;       /* main nibfile */
     BOOL nib_open_loaded;       /* open nibfile */
     BOOL nib_about_loaded;      /* about nibfile */
index 606d7f3..b472e3b 100644 (file)
@@ -53,6 +53,7 @@
 #import "AppleRemote.h"
 #import "eyetv.h"
 #import "simple_prefs.h"
+#import "CoreInteraction.h"
 
 #import <AddressBook/AddressBook.h>         /* for crashlog send mechanism */
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
@@ -343,6 +344,7 @@ static VLCMain *_o_sharedMainInstance = nil;
     o_coredialogs = [[VLCCoreDialogProvider alloc] init];
     o_info = [[VLCInfo alloc] init];
     o_mainmenu = [[VLCMainMenu alloc] init];
+    o_coreinteraction = [[VLCCoreInteraction alloc] init];
 
     i_lastShownVolume = -1;
 
@@ -605,7 +607,7 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     /* Close the window directly, because we do know that there
      * won't be anymore video. It's currently waiting a bit. */
-    [[[o_controls voutView] window] orderOut:self];
+    [[[o_coreinteraction voutView] window] orderOut:self];
 }
 
 #pragma mark -
@@ -1457,7 +1459,7 @@ static void manage_cleanup( void * args )
 
     if( p_intf->p_sys->b_intf_show )
     {
-        if( [[o_controls voutView] isFullscreen] && config_GetInt( VLCIntf, "macosx-fspanel" ) )
+        if( [[o_coreinteraction voutView] isFullscreen] && config_GetInt( VLCIntf, "macosx-fspanel" ) )
             [[o_controls fspanel] fadeIn];
         else
             [o_window makeKeyAndOrderFront: self];
@@ -1486,7 +1488,7 @@ static void manage_cleanup( void * args )
             [self setScrollField: aString stopAfter:-1];
             [[[self controls] fspanel] setStreamTitle: aString];
 
-            [[o_controls voutView] updateTitle];
+            [[o_coreinteraction voutView] updateTitle];
 
             [o_playlist updateRowSelection];
 
@@ -1623,6 +1625,7 @@ end:
     else
     {
         [[[self controls] fspanel] setPlay];
+        [[self mainMenu] setPlay];
         [o_btn_play setImage: o_img_play];
         [o_btn_play setAlternateImage: o_img_play_pressed];
         [o_btn_play setToolTip: _NS("Play")];
index 99dcab9..26154ff 100644 (file)
 - (void)drawKnobInRect:(NSRect)knobRect;
 
 @end
+
+/*****************************************************************************
+ * VLCTimeField interface
+ *****************************************************************************
+ * we need the implementation to catch our click-event in the controller window
+ *****************************************************************************/
+
+@interface VLCTimeField : NSTextField
+{
+}
+@end
index 2336553..d890ae8 100644 (file)
@@ -720,7 +720,6 @@ void _drawFrameInRect(NSRect frameRect)
 
     NSRect knobRect = [[self cell] knobRectFlipped:NO];
     knobRect.origin.y+=1;
-    //    [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
     [self drawKnobInRect: knobRect];
 }
 
@@ -755,9 +754,23 @@ void _drawFrameInRect(NSRect frameRect)
 
     NSRect knobRect = [[self cell] knobRectFlipped:NO];
     knobRect.origin.y+=2;
-//    [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
     [self drawKnobInRect: knobRect];
 }
 
 @end
 
+/*****************************************************************************
+ * VLCTimeField implementation
+ *****************************************************************************
+ * we need this to catch our click-event in the controller window
+ *****************************************************************************/
+
+@implementation VLCTimeField
+- (void)mouseDown: (NSEvent *)ourEvent
+{
+    if( [ourEvent clickCount] > 1 )
+        [[[VLCMain sharedInstance] controls] goToSpecificTime: nil];
+    else
+        [[VLCMain sharedInstance] timeFieldWasClicked: self];
+}
+@end
index cd013c2..bd029a1 100644 (file)
 
 - (void)playModeUpdated
 {
+    //FIXME this is broken, re-write with VLCMainWindow!
+    NSLog( @"playModeUpdated is broken, re-write with VLCMainWindow!" );
+    /*
     playlist_t *p_playlist = pl_Get( VLCIntf );
 
     bool loop = var_GetBool( p_playlist, "loop" );
     else
         [[[VLCMain sharedInstance] controls] repeatOff];
 
-    [[[VLCMain sharedInstance] controls] shuffle];
+    [[[VLCMain sharedInstance] controls] shuffle];*/
 }
 
 - (void)outlineViewSelectionDidChange:(NSNotification *)notification
index 888f95f..db34da4 100644 (file)
@@ -501,6 +501,7 @@ modules/gui/macosx/AudioEffects.m
 modules/gui/macosx/AppleRemote.h
 modules/gui/macosx/AppleRemote.m
 modules/gui/macosx/MainMenu.m
+modules/gui/macosx/MainWindow.m
 modules/gui/macosx/TrackSynchronization.m
 modules/gui/macosx/VideoEffects.m
 modules/gui/macosx/about.h
@@ -513,6 +514,7 @@ modules/gui/macosx/controls.h
 modules/gui/macosx/controls.m
 modules/gui/macosx/coredialogs.h
 modules/gui/macosx/coredialogs.m
+modules/gui/macosx/CoreInteraction.m
 modules/gui/macosx/embeddedwindow.h
 modules/gui/macosx/embeddedwindow.m
 modules/gui/macosx/equalizer.h