X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fapplescript.m;h=97ff247110b6fd35c7e88451a3ed586559c9e0c5;hb=905e5d8ae88a2d56f346fc33590dbe69bb07a5eb;hp=08b9b8543f97e40b94682b9d9abf88123433bf50;hpb=85b29bdc288a1573d43bd524908be5748a9b3640;p=vlc diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m index 08b9b8543f..97ff247110 100644 --- a/modules/gui/macosx/applescript.m +++ b/modules/gui/macosx/applescript.m @@ -1,7 +1,7 @@ /***************************************************************************** * applescript.m: MacOS X AppleScript support ***************************************************************************** - * Copyright (C) 2002-2003 VideoLAN (Centrale Réseaux) and its contributors + * Copyright (C) 2002-2003 the VideoLAN team * $Id$ * * Authors: Derk-Jan Hartman @@ -18,7 +18,7 @@ * * 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** @@ -29,7 +29,6 @@ #include "controls.h" #include "open.h" - /***************************************************************************** * VLGetURLScriptCommand implementation *****************************************************************************/ @@ -52,16 +51,21 @@ if ( o_urlString ) { NSURL * o_url; - - playlist_Add( p_playlist, [o_urlString fileSystemRepresentation], - [[[NSFileManager defaultManager] displayNameAtPath: o_urlString] UTF8String], - PLAYLIST_INSERT, PLAYLIST_END ); + input_item_t *p_input; + + p_input = input_ItemNew( p_playlist, + [o_urlString fileSystemRepresentation], + [[[NSFileManager defaultManager] + displayNameAtPath: o_urlString] UTF8String] ); + playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT, + PLAYLIST_END, VLC_TRUE, VLC_FALSE ); + o_url = [NSURL fileURLWithPath: o_urlString]; if( o_url != nil ) - { + { [[NSDocumentController sharedDocumentController] - noteNewRecentDocumentURL: o_url]; + noteNewRecentDocumentURL: o_url]; } } vlc_object_release( p_playlist ); @@ -118,8 +122,7 @@ } else if ( [o_command isEqualToString:@"fullscreen"] ) { - NSMenuItem *o_mi = [[NSMenuItem alloc] initWithTitle: _NS("Fullscreen") action: nil keyEquivalent:@""]; - [o_controls windowAction:[o_mi autorelease]]; + [o_controls toogleFullscreen: self]; return nil; } else if ( [o_command isEqualToString:@"mute"] ) @@ -143,3 +146,21 @@ } @end + +/***************************************************************************** + * Category that adds AppleScript support to NSApplication + *****************************************************************************/ +@implementation NSApplication(ScriptSupport) + +- (BOOL) scriptFullscreenMode { + VLCControls * o_controls = (VLCControls *)[[self delegate] getControls]; + + return [o_controls isFullscreen]; +} +- (void) setScriptFullscreenMode: (BOOL) mode { + VLCControls * o_controls = (VLCControls *)[[self delegate] getControls]; + if (mode == [o_controls isFullscreen]) return; + [o_controls toogleFullscreen: self]; +} + +@end