Commit 740370c5 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: move re-useable code from VLCControls to a custom class

this also prepares a mainwindow object and includes some clean-up
parent d8549ccd
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
</object> </object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<integer value="283"/>
<integer value="24"/> <integer value="24"/>
<integer value="915"/>
<integer value="2417"/>
<integer value="2730"/> <integer value="2730"/>
<integer value="2"/> <integer value="2"/>
<integer value="283"/>
<integer value="2417"/>
<integer value="915"/>
</object> </object>
<object class="NSArray" key="IBDocument.PluginDependencies"> <object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
...@@ -828,6 +828,7 @@ ...@@ -828,6 +828,7 @@
</object> </object>
<string key="NSFrame">{{1, 17}, {604, 231}}</string> <string key="NSFrame">{{1, 17}, {604, 231}}</string>
<reference key="NSSuperview" ref="915491793"/> <reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="23448837"/>
<reference key="NSDocView" ref="23448837"/> <reference key="NSDocView" ref="23448837"/>
<reference key="NSBGColor" ref="885475112"/> <reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int> <int key="NScvFlags">4</int>
...@@ -860,6 +861,7 @@ ...@@ -860,6 +861,7 @@
</object> </object>
<string key="NSFrame">{{1, 0}, {604, 17}}</string> <string key="NSFrame">{{1, 0}, {604, 17}}</string>
<reference key="NSSuperview" ref="915491793"/> <reference key="NSSuperview" ref="915491793"/>
<reference key="NSNextKeyView" ref="823165105"/>
<reference key="NSDocView" ref="823165105"/> <reference key="NSDocView" ref="823165105"/>
<reference key="NSBGColor" ref="885475112"/> <reference key="NSBGColor" ref="885475112"/>
<int key="NScvFlags">4</int> <int key="NScvFlags">4</int>
...@@ -867,6 +869,7 @@ ...@@ -867,6 +869,7 @@
</object> </object>
<string key="NSFrame">{{-1, 36}, {606, 249}}</string> <string key="NSFrame">{{-1, 36}, {606, 249}}</string>
<reference key="NSSuperview" ref="429932428"/> <reference key="NSSuperview" ref="429932428"/>
<reference key="NSNextKeyView" ref="343242432"/>
<int key="NSsFlags">133682</int> <int key="NSsFlags">133682</int>
<reference key="NSVScroller" ref="573737110"/> <reference key="NSVScroller" ref="573737110"/>
<reference key="NSHScroller" ref="297523533"/> <reference key="NSHScroller" ref="297523533"/>
...@@ -5018,14 +5021,6 @@ LCAuLi4</string> ...@@ -5018,14 +5021,6 @@ LCAuLi4</string>
</object> </object>
<int key="connectionID">2759</int> <int key="connectionID">2759</int>
</object> </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="IBConnectionRecord">
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">o_btn_shuffle</string> <string key="label">o_btn_shuffle</string>
...@@ -6802,6 +6797,14 @@ LCAuLi4</string> ...@@ -6802,6 +6797,14 @@ LCAuLi4</string>
</object> </object>
<int key="connectionID">4594</int> <int key="connectionID">4594</int>
</object> </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>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
...@@ -10273,9 +10276,9 @@ LCAuLi4</string> ...@@ -10273,9 +10276,9 @@ LCAuLi4</string>
<string>{{473, 633}, {137, 103}}</string> <string>{{473, 633}, {137, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/> <boolean value="YES"/>
<string>{{71, 176}, {604, 310}}</string> <string>{{329, 176}, {604, 310}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</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"/> <boolean value="YES"/>
<boolean value="YES"/> <boolean value="YES"/>
...@@ -10885,7 +10888,7 @@ LCAuLi4</string> ...@@ -10885,7 +10888,7 @@ LCAuLi4</string>
</object> </object>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">4594</int> <int key="maxID">4595</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+"> <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
...@@ -11174,6 +11177,7 @@ LCAuLi4</string> ...@@ -11174,6 +11177,7 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>o_btn_repeat</string> <string>o_btn_repeat</string>
<string>o_btn_shuffle</string> <string>o_btn_shuffle</string>
<string>o_fs_panel</string>
<string>o_main</string> <string>o_main</string>
<string>o_specificTime_cancel_btn</string> <string>o_specificTime_cancel_btn</string>
<string>o_specificTime_enter_fld</string> <string>o_specificTime_enter_fld</string>
...@@ -11189,6 +11193,7 @@ LCAuLi4</string> ...@@ -11189,6 +11193,7 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>VLCFSPanel</string>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
<string>id</string> <string>id</string>
...@@ -11207,6 +11212,7 @@ LCAuLi4</string> ...@@ -11207,6 +11212,7 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>o_btn_repeat</string> <string>o_btn_repeat</string>
<string>o_btn_shuffle</string> <string>o_btn_shuffle</string>
<string>o_fs_panel</string>
<string>o_main</string> <string>o_main</string>
<string>o_specificTime_cancel_btn</string> <string>o_specificTime_cancel_btn</string>
<string>o_specificTime_enter_fld</string> <string>o_specificTime_enter_fld</string>
...@@ -11228,6 +11234,10 @@ LCAuLi4</string> ...@@ -11228,6 +11234,10 @@ LCAuLi4</string>
<string key="name">o_btn_shuffle</string> <string key="name">o_btn_shuffle</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBToOneOutletInfo">
<string key="name">o_fs_panel</string>
<string key="candidateClassName">VLCFSPanel</string>
</object>
<object class="IBToOneOutletInfo"> <object class="IBToOneOutletInfo">
<string key="name">o_main</string> <string key="name">o_main</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
...@@ -11270,11 +11280,19 @@ LCAuLi4</string> ...@@ -11270,11 +11280,19 @@ LCAuLi4</string>
</object> </object>
</object> </object>
</object> </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="361672446"> <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBDocumentRelativeSource</string> <string key="majorKey">IBDocumentRelativeSource</string>
<string key="minorKey">../../../../../modules/gui/macosx/controls.h</string> <string key="minorKey">../../../../../modules/gui/macosx/controls.h</string>
</object> </object>
</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"> <object class="IBPartialClassDescription">
<string key="className">VLCMain</string> <string key="className">VLCMain</string>
<string key="superclassName">NSObject</string> <string key="superclassName">NSObject</string>
...@@ -11368,6 +11386,7 @@ LCAuLi4</string> ...@@ -11368,6 +11386,7 @@ LCAuLi4</string>
<string>o_btn_stop</string> <string>o_btn_stop</string>
<string>o_controls</string> <string>o_controls</string>
<string>o_coredialogs</string> <string>o_coredialogs</string>
<string>o_coreinteraction</string>
<string>o_crashrep_desc_txt</string> <string>o_crashrep_desc_txt</string>
<string>o_crashrep_dontSend_btn</string> <string>o_crashrep_dontSend_btn</string>
<string>o_crashrep_fld</string> <string>o_crashrep_fld</string>
...@@ -11410,6 +11429,7 @@ LCAuLi4</string> ...@@ -11410,6 +11429,7 @@ LCAuLi4</string>
<string>NSButton</string> <string>NSButton</string>
<string>VLCControls</string> <string>VLCControls</string>
<string>id</string> <string>id</string>
<string>id</string>
<string>NSTextField</string> <string>NSTextField</string>
<string>NSButton</string> <string>NSButton</string>
<string>NSTextView</string> <string>NSTextView</string>
...@@ -11455,6 +11475,7 @@ LCAuLi4</string> ...@@ -11455,6 +11475,7 @@ LCAuLi4</string>
<string>o_btn_stop</string> <string>o_btn_stop</string>
<string>o_controls</string> <string>o_controls</string>
<string>o_coredialogs</string> <string>o_coredialogs</string>
<string>o_coreinteraction</string>
<string>o_crashrep_desc_txt</string> <string>o_crashrep_desc_txt</string>
<string>o_crashrep_dontSend_btn</string> <string>o_crashrep_dontSend_btn</string>
<string>o_crashrep_fld</string> <string>o_crashrep_fld</string>
...@@ -11533,6 +11554,10 @@ LCAuLi4</string> ...@@ -11533,6 +11554,10 @@ LCAuLi4</string>
<string key="name">o_coredialogs</string> <string key="name">o_coredialogs</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBToOneOutletInfo">
<string key="name">o_coreinteraction</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo"> <object class="IBToOneOutletInfo">
<string key="name">o_crashrep_desc_txt</string> <string key="name">o_crashrep_desc_txt</string>
<string key="candidateClassName">NSTextField</string> <string key="candidateClassName">NSTextField</string>
...@@ -13178,7 +13203,7 @@ LCAuLi4</string> ...@@ -13178,7 +13203,7 @@ LCAuLi4</string>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">VLCTimeField</string> <string key="className">VLCTimeField</string>
<string key="superclassName">NSTextField</string> <string key="superclassName">NSTextField</string>
<reference key="sourceIdentifier" ref="361672446"/> <reference key="sourceIdentifier" ref="690328904"/>
</object> </object>
</object> </object>
</object> </object>
......
...@@ -420,6 +420,10 @@ ...@@ -420,6 +420,10 @@
CC426FD01020D44F00A32659 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = ../../contrib/Sparkle/Sparkle.framework; sourceTree = SOURCE_ROOT; }; 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>"; }; 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>"; }; 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; }; 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; }; 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>"; }; 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 @@ ...@@ -564,6 +568,10 @@
8ED6C27D03E2EB1C0059A3A7 /* intf.m */, 8ED6C27D03E2EB1C0059A3A7 /* intf.m */,
CC448A5A13B61D49009F72E0 /* MainMenu.h */, CC448A5A13B61D49009F72E0 /* MainMenu.h */,
CC448A5B13B61D49009F72E0 /* MainMenu.m */, CC448A5B13B61D49009F72E0 /* MainMenu.m */,
CC448A6013B68A0B009F72E0 /* CoreInteraction.h */,
CC448A6113B68A0B009F72E0 /* CoreInteraction.m */,
CC448A6213B68A0B009F72E0 /* MainWindow.h */,
CC448A6313B68A0B009F72E0 /* MainWindow.m */,
CC4A33220F8CB017000FC4A7 /* coredialogs.h */, CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
CC4A33210F8CB017000FC4A7 /* coredialogs.m */, CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
8E6BC6FA041684EC0059A3A7 /* controls.h */, 8E6BC6FA041684EC0059A3A7 /* controls.h */,
......
/*****************************************************************************
* 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
/*****************************************************************************
* 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
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#import "controls.h" #import "controls.h"
#import "playlistinfo.h" #import "playlistinfo.h"
#import "vout.h" #import "vout.h"
#import "CoreInteraction.h"
@implementation VLCMainMenu @implementation VLCMainMenu
static VLCMainMenu *_o_sharedInstance = nil; static VLCMainMenu *_o_sharedInstance = nil;
...@@ -789,7 +790,7 @@ 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 = [o_menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""];
[o_lmi_tmp2 setTarget: self]; [o_lmi_tmp2 setTarget: self];
[o_lmi_tmp2 setEnabled: YES]; [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_parent setEnabled: YES];
[o_menu addItem: [NSMenuItem separatorItem]]; [o_menu addItem: [NSMenuItem separatorItem]];
} }
......
/*****************************************************************************
* 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
/*****************************************************************************
* 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
...@@ -12,6 +12,10 @@ SOURCES_macosx = \ ...@@ -12,6 +12,10 @@ SOURCES_macosx = \
SPMediaKeyTap.m \ SPMediaKeyTap.m \
MainMenu.h \ MainMenu.h \
MainMenu.m \ MainMenu.m \
MainWindow.h \
MainWindow.m \
CoreInteraction.h \
CoreInteraction.m \
about.h \ about.h \
about.m \ about.m \
applescript.h \ applescript.h \
......
...@@ -47,12 +47,8 @@ ...@@ -47,12 +47,8 @@
IBOutlet id o_specificTime_stepper; IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi; IBOutlet id o_specificTime_mi;
VLCFSPanel *o_fs_panel; IBOutlet VLCFSPanel *o_fs_panel;
BOOL b_lockAspectRatio;
} }
- (id)voutView;
- (BOOL)aspectRatioIsLocked;
- (IBAction)play:(id)sender; - (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender; - (IBAction)stop:(id)sender;
- (IBAction)faster:(id)sender; - (IBAction)faster:(id)sender;
...@@ -67,12 +63,6 @@ ...@@ -67,12 +63,6 @@
- (IBAction)repeatButtonAction:(id)sender; - (IBAction)repeatButtonAction:(id)sender;
- (IBAction)quitAfterPlayback:(id)sender; - (IBAction)quitAfterPlayback:(id)sender;
/* the three ugly helpers again */
- (void)repeatOne;
- (void)repeatAll;
- (void)repeatOff;
- (void)shuffle;
- (IBAction)forward:(id)sender; - (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender; - (IBAction)backward:(id)sender;
...@@ -97,17 +87,5 @@ ...@@ -97,17 +87,5 @@
- (IBAction)goToSpecificTime:(id)sender; - (IBAction)goToSpecificTime:(id)sender;
- (id)fspanel; - (id)fspanel;
@end
/*****************************************************************************
* VLCTimeField interface
*****************************************************************************
* we need the implementation to catch our click-event in the controller window
*****************************************************************************/
@interface VLCTimeField : NSTextField
{
}
@end @end
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
#import "open.h" #import "open.h"
#import "controls.h" #import "controls.h"
#import "playlist.h" #import "playlist.h"
#include <vlc_osd.h> #import "CoreInteraction.h"
#include <vlc_keys.h> #import <vlc_keys.h>
#pragma mark - #pragma mark -
/***************************************************************************** /*****************************************************************************
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
{ {
[super init]; [super init];
o_fs_panel = [[VLCFSPanel alloc] init]; o_fs_panel = [[VLCFSPanel alloc] init];
b_lockAspectRatio = YES;
return self; return self;
} }
...@@ -68,136 +67,48 @@ ...@@ -68,136 +67,48 @@
{ {
[[NSNotificationCenter defaultCenter] removeObserver: self]; [[NSNotificationCenter defaultCenter] removeObserver: self];
[o_fs_panel release];
[super dealloc]; [super dealloc];
} }
- (IBAction)play:(id)sender - (IBAction)play:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] play];
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;
} }
- (IBAction)stop:(id)sender - (IBAction)stop:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] 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];
} }
- (IBAction)faster:(id)sender - (IBAction)faster:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] faster];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_FASTER );
} }
- (IBAction)slower:(id)sender - (IBAction)slower:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] slower];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_SLOWER );
} }
- (IBAction)normalSpeed:(id)sender - (IBAction)normalSpeed:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] normalSpeed];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_RATE_NORMAL );
} }
- (IBAction)prev:(id)sender - (IBAction)prev:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] previous];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PREV );
} }
- (IBAction)next:(id)sender - (IBAction)next:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] next];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_NEXT );
} }
- (IBAction)random:(id)sender - (IBAction)random:(id)sender
{ {
vlc_value_t val; [[VLCCoreInteraction sharedInstance] shuffle];
intf_thread_t * p_intf = VLCIntf;
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 );
}
[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; vlc_value_t val;
playlist_t *p_playlist = pl_Get( VLCIntf ); playlist_t *p_playlist = pl_Get( VLCIntf );
var_Get( p_playlist, "random", &val ); var_Get( p_playlist, "random", &val );
...@@ -224,57 +135,27 @@ ...@@ -224,57 +135,27 @@
if( !repeating.b_bool && !looping.b_bool ) if( !repeating.b_bool && !looping.b_bool )
{ {
/* was: no repeating at all, switching to Repeat One */ /* was: no repeating at all, switching to Repeat One */
[[VLCCoreInteraction sharedInstance] repeatOne];
/* set our button's look */ [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-one"]];
[self repeatOne]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-one-pressed"]];
/* 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" ) );
} }
else if( repeating.b_bool && !looping.b_bool ) else if( repeating.b_bool && !looping.b_bool )
{ {
/* was: Repeat One, switching to Repeat All */ /* was: Repeat One, switching to Repeat All */
[[VLCCoreInteraction sharedInstance] repeatAll];
/* set our button's look */ [o_btn_repeat setImage: [NSImage imageNamed:@"repeat-all"]];
[self repeatAll]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-all-pressed"]];
/* 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" ) );
} }
else else
{ {
/* was: Repeat All or bug in VLC, switching to Repeat Off */ /* was: Repeat All or bug in VLC, switching to Repeat Off */
[[VLCCoreInteraction sharedInstance] repeatOff];
/* set our button's look */ [o_btn_repeat setImage: [NSImage imageNamed:@"repeat"]];
[self repeatOff]; [o_btn_repeat setAlternateImage: [NSImage imageNamed:@"repeat-pressed"]];
/* 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" ) );
} }
/* 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 @@ ...@@ -285,25 +166,10 @@
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "repeat", &val ); var_Get( p_playlist, "repeat", &val );
if (!val.b_bool) if(! val.b_bool )
{ [[VLCCoreInteraction sharedInstance] repeatOne];
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 );
}
else else
{ [[VLCCoreInteraction sharedInstance] repeatOff];
//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;
} }
- (IBAction)loop:(id)sender - (IBAction)loop:(id)sender
...@@ -313,25 +179,10 @@ ...@@ -313,25 +179,10 @@
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get( p_intf );
var_Get( p_playlist, "loop", &val ); var_Get( p_playlist, "loop", &val );
if (!val.b_bool) if(! val.b_bool )
{ [[VLCCoreInteraction sharedInstance] repeatAll];
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 );
}
else else
{ [[VLCCoreInteraction sharedInstance] repeatOff];
//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;
} }
- (IBAction)quitAfterPlayback:(id)sender - (IBAction)quitAfterPlayback:(id)sender
...@@ -343,53 +194,33 @@ ...@@ -343,53 +194,33 @@
- (IBAction)forward:(id)sender - (IBAction)forward:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] forward];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_FORWARD_SHORT );
} }
- (IBAction)backward:(id)sender - (IBAction)backward:(id)sender
{ {
vlc_value_t val; [[VLCCoreInteraction sharedInstance] backward];
intf_thread_t * p_intf = VLCIntf;
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_JUMP_BACKWARD_SHORT );
} }
- (IBAction)volumeUp:(id)sender - (IBAction)volumeUp:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] volumeUp];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_UP );
/* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)volumeDown:(id)sender - (IBAction)volumeDown:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] volumeDown];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_DOWN );
/* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)mute:(id)sender - (IBAction)mute:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] mute];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_VOL_MUTE );
/* Manage volume status */
[o_main manageVolumeSlider];
} }
- (IBAction)volumeSliderUpdated:(id)sender - (IBAction)volumeSliderUpdated:(id)sender
{ {
intf_thread_t * p_intf = VLCIntf; [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
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];
} }
- (IBAction)showPosition: (id)sender - (IBAction)showPosition: (id)sender
...@@ -408,12 +239,11 @@ ...@@ -408,12 +239,11 @@
} }
- (IBAction)toogleFullscreen:(id)sender { - (IBAction)toogleFullscreen:(id)sender {
NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
[self windowAction: [o_mi autorelease]];
} }
- (BOOL) isFullscreen { - (BOOL) isFullscreen {
id o_vout_view = [self voutView]; id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
if( o_vout_view ) if( o_vout_view )
{ {
return [o_vout_view isFullscreen]; return [o_vout_view isFullscreen];
...@@ -431,7 +261,7 @@ ...@@ -431,7 +261,7 @@
vout_thread_t *p_vout = input_GetVout( p_input ); vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout != NULL ) if( p_vout != NULL )
{ {
id o_vout_view = [self voutView]; id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
if( o_vout_view ) if( o_vout_view )
{ {
if( [o_title isEqualToString: _NS("Half Size") ] ) if( [o_title isEqualToString: _NS("Half Size") ] )
...@@ -454,21 +284,14 @@ ...@@ -454,21 +284,14 @@
} }
else else
{ {
/* Fullscreen state for next time will be saved here too */ [[VLCCoreInteraction sharedInstance] toggleFullscreen];
[o_vout_view toggleFullscreen];
} }
} }
vlc_object_release( (vlc_object_t *)p_vout ); vlc_object_release( (vlc_object_t *)p_vout );
} }
else else
{ {
playlist_t * p_playlist = pl_Get( VLCIntf ); [[VLCCoreInteraction sharedInstance] toggleFullscreen];
if( [o_title isEqualToString: _NS("Fullscreen")] ||
[sender isKindOfClass:[NSButton class]] )
{
var_ToggleBool( p_playlist, "fullscreen" );
}
} }
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
...@@ -514,12 +337,8 @@ ...@@ -514,12 +337,8 @@
- (IBAction)lockVideosAspectRatio:(id)sender - (IBAction)lockVideosAspectRatio:(id)sender
{ {
if( [sender state] == NSOffState ) [[VLCCoreInteraction sharedInstance] setAspectRatioLocked: [sender state]];
[sender setState: NSOnState]; [sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
else
[sender setState: NSOffState];
b_lockAspectRatio = !b_lockAspectRatio;
} }
- (IBAction)addSubtitleFile:(id)sender - (IBAction)addSubtitleFile:(id)sender
...@@ -560,6 +379,17 @@ ...@@ -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 - (void)scrollWheel:(NSEvent *)theEvent
{ {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
...@@ -606,7 +436,7 @@ ...@@ -606,7 +436,7 @@
/* Escape */ /* Escape */
if( key == (unichar) 0x1b ) 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] ) if( o_vout_view && [o_vout_view isFullscreen] )
{ {
[o_vout_view toggleFullscreen]; [o_vout_view toggleFullscreen];
...@@ -689,31 +519,4 @@ ...@@ -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 @end
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#import "vout.h" #import "vout.h"
#import "embeddedwindow.h" #import "embeddedwindow.h"
#import "fspanel.h" #import "fspanel.h"
#import "CoreInteraction.h"
#import "playlist.h" #import "playlist.h"
#import <vlc_url.h> #import <vlc_url.h>
...@@ -279,7 +280,7 @@ ...@@ -279,7 +280,7 @@
if( videoRatio.height == 0. || videoRatio.width == 0. ) if( videoRatio.height == 0. || videoRatio.width == 0. )
return proposedFrameSize; return proposedFrameSize;
if( [[[VLCMain sharedInstance] controls] aspectRatioIsLocked] ) if( [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked] )
{ {
NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil]; NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
NSRect contentRect = [self contentRectForFrameRect:[self frame]]; NSRect contentRect = [self contentRectForFrameRect:[self frame]];
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#import "intf.h" #import "intf.h"
#import "controls.h" #import "CoreInteraction.h"
#import "vout.h" #import "vout.h"
#import "misc.h" #import "misc.h"
#import "fspanel.h" #import "fspanel.h"
...@@ -178,9 +178,9 @@ ...@@ -178,9 +178,9 @@
- (void)setActive:(id)noData - (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; b_nonActive = NO;
[self fadeIn]; [self fadeIn];
...@@ -247,8 +247,8 @@ ...@@ -247,8 +247,8 @@
- (void)mouseExited:(NSEvent *)theEvent - (void)mouseExited:(NSEvent *)theEvent
{ {
/* give up our focus, so the vout may show us again without letting the user clicking it */ /* give up our focus, so the vout may show us again without letting the user clicking it */
if( [[[[VLCMain sharedInstance] controls] voutView] isFullscreen] ) if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] )
[[[[[VLCMain sharedInstance] controls] voutView] window] makeKeyWindow]; [[[[VLCCoreInteraction sharedInstance] voutView] window] makeKeyWindow];
} }
- (void)hideMouse - (void)hideMouse
...@@ -559,7 +559,7 @@ ...@@ -559,7 +559,7 @@
- (IBAction)fsVolumeSliderUpdate:(id)sender - (IBAction)fsVolumeSliderUpdate:(id)sender
{ {
[[[VLCMain sharedInstance] controls] volumeSliderUpdated: sender]; [[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
} }
#define addImage(image, _x, _y, mode, _width) \ #define addImage(image, _x, _y, mode, _width) \
......
...@@ -110,6 +110,7 @@ struct intf_sys_t ...@@ -110,6 +110,7 @@ struct intf_sys_t
VLCInformation * o_info; /* VLCInformation */ VLCInformation * o_info; /* VLCInformation */
id o_eyetv; /* VLCEyeTVController */ id o_eyetv; /* VLCEyeTVController */
id o_bookmarks; /* VLCBookmarks */ id o_bookmarks; /* VLCBookmarks */
id o_coreinteraction; /* VLCCoreInteraction */
BOOL nib_main_loaded; /* main nibfile */ BOOL nib_main_loaded; /* main nibfile */
BOOL nib_open_loaded; /* open nibfile */ BOOL nib_open_loaded; /* open nibfile */
BOOL nib_about_loaded; /* about nibfile */ BOOL nib_about_loaded; /* about nibfile */
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#import "AppleRemote.h" #import "AppleRemote.h"
#import "eyetv.h" #import "eyetv.h"
#import "simple_prefs.h" #import "simple_prefs.h"
#import "CoreInteraction.h"
#import <AddressBook/AddressBook.h> /* for crashlog send mechanism */ #import <AddressBook/AddressBook.h> /* for crashlog send mechanism */
#import <Sparkle/Sparkle.h> /* we're the update delegate */ #import <Sparkle/Sparkle.h> /* we're the update delegate */
...@@ -343,6 +344,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -343,6 +344,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_coredialogs = [[VLCCoreDialogProvider alloc] init]; o_coredialogs = [[VLCCoreDialogProvider alloc] init];
o_info = [[VLCInfo alloc] init]; o_info = [[VLCInfo alloc] init];
o_mainmenu = [[VLCMainMenu alloc] init]; o_mainmenu = [[VLCMainMenu alloc] init];
o_coreinteraction = [[VLCCoreInteraction alloc] init];
i_lastShownVolume = -1; i_lastShownVolume = -1;
...@@ -605,7 +607,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -605,7 +607,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* Close the window directly, because we do know that there /* Close the window directly, because we do know that there
* won't be anymore video. It's currently waiting a bit. */ * 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 - #pragma mark -
...@@ -1457,7 +1459,7 @@ static void manage_cleanup( void * args ) ...@@ -1457,7 +1459,7 @@ static void manage_cleanup( void * args )
if( p_intf->p_sys->b_intf_show ) 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]; [[o_controls fspanel] fadeIn];
else else
[o_window makeKeyAndOrderFront: self]; [o_window makeKeyAndOrderFront: self];
...@@ -1486,7 +1488,7 @@ static void manage_cleanup( void * args ) ...@@ -1486,7 +1488,7 @@ static void manage_cleanup( void * args )
[self setScrollField: aString stopAfter:-1]; [self setScrollField: aString stopAfter:-1];
[[[self controls] fspanel] setStreamTitle: aString]; [[[self controls] fspanel] setStreamTitle: aString];
[[o_controls voutView] updateTitle]; [[o_coreinteraction voutView] updateTitle];
[o_playlist updateRowSelection]; [o_playlist updateRowSelection];
...@@ -1623,6 +1625,7 @@ end: ...@@ -1623,6 +1625,7 @@ end:
else else
{ {
[[[self controls] fspanel] setPlay]; [[[self controls] fspanel] setPlay];
[[self mainMenu] setPlay];
[o_btn_play setImage: o_img_play]; [o_btn_play setImage: o_img_play];
[o_btn_play setAlternateImage: o_img_play_pressed]; [o_btn_play setAlternateImage: o_img_play_pressed];
[o_btn_play setToolTip: _NS("Play")]; [o_btn_play setToolTip: _NS("Play")];
......
...@@ -156,3 +156,14 @@ ...@@ -156,3 +156,14 @@
- (void)drawKnobInRect:(NSRect)knobRect; - (void)drawKnobInRect:(NSRect)knobRect;
@end @end
/*****************************************************************************
* VLCTimeField interface
*****************************************************************************
* we need the implementation to catch our click-event in the controller window
*****************************************************************************/
@interface VLCTimeField : NSTextField
{
}
@end
...@@ -720,7 +720,6 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -720,7 +720,6 @@ void _drawFrameInRect(NSRect frameRect)
NSRect knobRect = [[self cell] knobRectFlipped:NO]; NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=1; knobRect.origin.y+=1;
// [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnobInRect: knobRect]; [self drawKnobInRect: knobRect];
} }
...@@ -755,9 +754,23 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -755,9 +754,23 @@ void _drawFrameInRect(NSRect frameRect)
NSRect knobRect = [[self cell] knobRectFlipped:NO]; NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=2; knobRect.origin.y+=2;
// [[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnobInRect: knobRect]; [self drawKnobInRect: knobRect];
} }
@end @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
...@@ -522,6 +522,9 @@ ...@@ -522,6 +522,9 @@
- (void)playModeUpdated - (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 ); playlist_t *p_playlist = pl_Get( VLCIntf );
bool loop = var_GetBool( p_playlist, "loop" ); bool loop = var_GetBool( p_playlist, "loop" );
...@@ -533,7 +536,7 @@ ...@@ -533,7 +536,7 @@
else else
[[[VLCMain sharedInstance] controls] repeatOff]; [[[VLCMain sharedInstance] controls] repeatOff];
[[[VLCMain sharedInstance] controls] shuffle]; [[[VLCMain sharedInstance] controls] shuffle];*/
} }
- (void)outlineViewSelectionDidChange:(NSNotification *)notification - (void)outlineViewSelectionDidChange:(NSNotification *)notification
......
...@@ -501,6 +501,7 @@ modules/gui/macosx/AudioEffects.m ...@@ -501,6 +501,7 @@ modules/gui/macosx/AudioEffects.m
modules/gui/macosx/AppleRemote.h modules/gui/macosx/AppleRemote.h
modules/gui/macosx/AppleRemote.m modules/gui/macosx/AppleRemote.m
modules/gui/macosx/MainMenu.m modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainWindow.m
modules/gui/macosx/TrackSynchronization.m modules/gui/macosx/TrackSynchronization.m
modules/gui/macosx/VideoEffects.m modules/gui/macosx/VideoEffects.m
modules/gui/macosx/about.h modules/gui/macosx/about.h
...@@ -513,6 +514,7 @@ modules/gui/macosx/controls.h ...@@ -513,6 +514,7 @@ modules/gui/macosx/controls.h
modules/gui/macosx/controls.m modules/gui/macosx/controls.m
modules/gui/macosx/coredialogs.h modules/gui/macosx/coredialogs.h
modules/gui/macosx/coredialogs.m modules/gui/macosx/coredialogs.m
modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/embeddedwindow.h modules/gui/macosx/embeddedwindow.h
modules/gui/macosx/embeddedwindow.m modules/gui/macosx/embeddedwindow.m
modules/gui/macosx/equalizer.h modules/gui/macosx/equalizer.h
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment