/*****************************************************************************
* applescript.m: MacOS X AppleScript support
*****************************************************************************
- * Copyright (C) 2002-2003, 2005, 2007 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*****************************************************************************/
#include "intf.h"
#include "applescript.h"
-#include "controls.h"
-#include "open.h"
+#include "CoreInteraction.h"
/*****************************************************************************
* VLGetURLScriptCommand implementation
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ playlist_t * p_playlist = pl_Get( p_intf );
if( p_playlist == NULL )
{
return nil;
NSURL * o_url;
input_item_t *p_input;
- p_input = input_ItemNew( p_playlist,
- [o_urlString fileSystemRepresentation],
+ p_input = input_item_New( [o_urlString fileSystemRepresentation],
[[[NSFileManager defaultManager]
displayNameAtPath: o_urlString] UTF8String] );
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT,
- PLAYLIST_END, true, false );
+ PLAYLIST_END, true, pl_Unlocked );
vlc_gc_decref( p_input );
noteNewRecentDocumentURL: o_url];
}
}
- vlc_object_release( p_playlist );
}
return nil;
}
NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = VLCIntf;
- playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
+ playlist_t * p_playlist = pl_Get( p_intf );
if( p_playlist == NULL )
{
return nil;
}
- VLCControls * o_controls = (VLCControls *)[[NSApp delegate] getControls];
-
- if ( o_controls )
+ if ( [o_command isEqualToString:@"play"] )
{
- if ( [o_command isEqualToString:@"play"] )
- {
- [o_controls play:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"stop"] )
- {
- [o_controls stop:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"previous"] )
- {
- [o_controls prev:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"next"] )
- {
- [o_controls next:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"fullscreen"] )
- {
- [o_controls toogleFullscreen: self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"mute"] )
- {
- [o_controls mute:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"volumeUp"] )
- {
- [o_controls volumeUp:self];
- return nil;
- }
- else if ( [o_command isEqualToString:@"volumeDown"] )
- {
- [o_controls volumeDown:self];
- return nil;
- }
+ [[VLCCoreInteraction sharedInstance] play];
+ }
+ else if ( [o_command isEqualToString:@"stop"] )
+ {
+ [[VLCCoreInteraction sharedInstance] stop];
+ }
+ else if ( [o_command isEqualToString:@"previous"] )
+ {
+ [[VLCCoreInteraction sharedInstance] previous];
+ }
+ else if ( [o_command isEqualToString:@"next"] )
+ {
+ [[VLCCoreInteraction sharedInstance] next];
+ }
+ else if ( [o_command isEqualToString:@"fullscreen"] )
+ {
+ [[VLCCoreInteraction sharedInstance] toggleFullscreen];
+ }
+ else if ( [o_command isEqualToString:@"mute"] )
+ {
+ [[VLCCoreInteraction sharedInstance] mute];
+ }
+ else if ( [o_command isEqualToString:@"volumeUp"] )
+ {
+ [[VLCCoreInteraction sharedInstance] volumeUp];
+ }
+ else if ( [o_command isEqualToString:@"volumeDown"] )
+ {
+ [[VLCCoreInteraction sharedInstance] volumeDown];
}
- vlc_object_release( p_playlist );
return nil;
}
@implementation NSApplication(ScriptSupport)
- (BOOL) scriptFullscreenMode {
- VLCControls * o_controls = (VLCControls *)[[self delegate] getControls];
-
- return [o_controls isFullscreen];
+ vout_thread_t * p_vout = getVout();
+ if( !p_vout )
+ return NO;
+ BOOL b_value = var_GetBool( p_vout, "fullscreen");
+ vlc_object_release( p_vout );
+ return b_value;
}
- (void) setScriptFullscreenMode: (BOOL) mode {
- VLCControls * o_controls = (VLCControls *)[[self delegate] getControls];
- if (mode == [o_controls isFullscreen]) return;
- [o_controls toogleFullscreen: self];
+ vout_thread_t * p_vout = getVout();
+ if( !p_vout )
+ return;
+ if (var_GetBool( p_vout, "fullscreen") == mode)
+ {
+ vlc_object_release( p_vout );
+ return;
+ }
+ vlc_object_release( p_vout );
+ [[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
@end