diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib b/extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib index 22553437e49f40ba36a3c952cea53dc4fb11df32..057c2028fafb5f8e653280155d9980ed4ffc27c3 100644 --- a/extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib +++ b/extras/package/macosx/Resources/English.lproj/MainMenu.nib/designable.nib @@ -12,12 +12,12 @@ </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> @@ -828,6 +828,7 @@ </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> @@ -860,6 +861,7 @@ </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> @@ -867,6 +869,7 @@ </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> diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib b/extras/package/macosx/Resources/English.lproj/MainMenu.nib/keyedobjects.nib index 1b6c268d1fe15a10351af2f7aa5ae4c5f65a20ab..bf42c0e68675c0112b3f7b04b121636ddf2d2663 100644 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 diff --git a/extras/package/macosx/vlc.xcodeproj/project.pbxproj b/extras/package/macosx/vlc.xcodeproj/project.pbxproj index 620203810534358e48183be11bdf55b09c926a12..e39ecbd8fd99511e26de18d71f11fee30a0f9a63 100644 --- a/extras/package/macosx/vlc.xcodeproj/project.pbxproj +++ b/extras/package/macosx/vlc.xcodeproj/project.pbxproj @@ -420,6 +420,10 @@ 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>"; }; @@ -564,6 +568,10 @@ 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 index 0000000000000000000000000000000000000000..ec44c6529b17e98d7234a6821b97aabe1510ceea --- /dev/null +++ b/modules/gui/macosx/CoreInteraction.h @@ -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 index 0000000000000000000000000000000000000000..faa1e254eb270eda62a7809e30388fff3d0921b5 --- /dev/null +++ b/modules/gui/macosx/CoreInteraction.m @@ -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 diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m index 12ce6d119a9e2f70083a234d22a6df84555db5f5..b8b2cc6be5ee779f2b26480cdc73063787bfc596 100644 --- a/modules/gui/macosx/MainMenu.m +++ b/modules/gui/macosx/MainMenu.m @@ -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 index 0000000000000000000000000000000000000000..1b63d4b2f3d1914acc79c8b27e3d80a709185259 --- /dev/null +++ b/modules/gui/macosx/MainWindow.h @@ -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 index 0000000000000000000000000000000000000000..3337770ac56133f316447b4a8418daeadf07f4de --- /dev/null +++ b/modules/gui/macosx/MainWindow.m @@ -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 diff --git a/modules/gui/macosx/Modules.am b/modules/gui/macosx/Modules.am index be991643b501339380473b23a361c0c079bae605..44e0430a0678679cc9e7c7808556f75aaae5587f 100644 --- a/modules/gui/macosx/Modules.am +++ b/modules/gui/macosx/Modules.am @@ -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 \ diff --git a/modules/gui/macosx/controls.h b/modules/gui/macosx/controls.h index 65f883e7d4b49fa58fd59885a7da516cf42b1a54..dd5c105b478ea5090a269e5186ceda902175b6eb 100644 --- a/modules/gui/macosx/controls.h +++ b/modules/gui/macosx/controls.h @@ -47,12 +47,8 @@ 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; @@ -67,12 +63,6 @@ - (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; @@ -97,17 +87,5 @@ - (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 diff --git a/modules/gui/macosx/controls.m b/modules/gui/macosx/controls.m index cae20c330d8daa5795b0c7f2ed8fa1dabf1ebf38..3c55d07c162a5489f2ec20f1a94840869d072384 100644 --- a/modules/gui/macosx/controls.m +++ b/modules/gui/macosx/controls.m @@ -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; } @@ -68,136 +67,48 @@ { [[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 ); @@ -224,57 +135,27 @@ 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; } @@ -285,25 +166,10 @@ 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 @@ -313,25 +179,10 @@ 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 @@ -343,53 +194,33 @@ - (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 @@ -408,12 +239,11 @@ } - (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]; @@ -431,7 +261,7 @@ 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") ] ) @@ -454,21 +284,14 @@ } 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 ); } @@ -514,12 +337,8 @@ - (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 @@ -560,6 +379,17 @@ } } +- (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; @@ -606,7 +436,7 @@ /* 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]; @@ -689,31 +519,4 @@ } } -- (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 diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m index 82b4d331a0994107495afa8c38c040bfd8a42034..e2a87c5b4ce904036b96bbdd00465a6264cb1bab 100644 --- a/modules/gui/macosx/embeddedwindow.m +++ b/modules/gui/macosx/embeddedwindow.m @@ -31,6 +31,7 @@ #import "vout.h" #import "embeddedwindow.h" #import "fspanel.h" +#import "CoreInteraction.h" #import "playlist.h" #import <vlc_url.h> @@ -279,7 +280,7 @@ 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]]; diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m index 89f2b402bf967ef7d9b4eb51dea72739723abaa4..9957922a3e22858a4efe6521f74454f17292c796 100644 --- a/modules/gui/macosx/fspanel.m +++ b/modules/gui/macosx/fspanel.m @@ -26,7 +26,7 @@ * Preamble *****************************************************************************/ #import "intf.h" -#import "controls.h" +#import "CoreInteraction.h" #import "vout.h" #import "misc.h" #import "fspanel.h" @@ -178,9 +178,9 @@ - (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]; @@ -247,8 +247,8 @@ - (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 @@ -559,7 +559,7 @@ - (IBAction)fsVolumeSliderUpdate:(id)sender { - [[[VLCMain sharedInstance] controls] volumeSliderUpdated: sender]; + [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]]; } #define addImage(image, _x, _y, mode, _width) \ diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 92dfba2b6ca51048596a6c175c632daea4efe63c..7567aef353d88287150ce288d91e20cb8baea987 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -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 */ diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 606d7f31771efbaf3b03f7073a8d4ad8df9e6669..b472e3b0e90e80e21e1c59e1b928fecbc25ab634 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -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")]; diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h index 99dcab95ccb8f858f13690aaabf16d2e6eb72c77..26154ffc5e4eb2726c240231219fe3d343e45836 100644 --- a/modules/gui/macosx/misc.h +++ b/modules/gui/macosx/misc.h @@ -156,3 +156,14 @@ - (void)drawKnobInRect:(NSRect)knobRect; @end + +/***************************************************************************** + * VLCTimeField interface + ***************************************************************************** + * we need the implementation to catch our click-event in the controller window + *****************************************************************************/ + +@interface VLCTimeField : NSTextField +{ +} +@end diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m index 2336553ee8114ccf2ef911f842c96985eb561cef..d890ae8d30d14a3193fe5588729613cf57be19ad 100644 --- a/modules/gui/macosx/misc.m +++ b/modules/gui/macosx/misc.m @@ -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 diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m index cd013c22d40f7c1769b92b480b855050b69efa3c..bd029a1ea231db2b34d305b74c4cd7974efbdc5a 100644 --- a/modules/gui/macosx/playlist.m +++ b/modules/gui/macosx/playlist.m @@ -522,6 +522,9 @@ - (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" ); @@ -533,7 +536,7 @@ else [[[VLCMain sharedInstance] controls] repeatOff]; - [[[VLCMain sharedInstance] controls] shuffle]; + [[[VLCMain sharedInstance] controls] shuffle];*/ } - (void)outlineViewSelectionDidChange:(NSNotification *)notification diff --git a/po/POTFILES.in b/po/POTFILES.in index 888f95fbbd5c7d57d1d49d33f7d2fb85c57c5960..db34da4b50dc095a432aa394ec8595b2c36fcf07 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -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