Commit 9c841645 authored by hartman's avatar hartman
Browse files

* modules/gui/macosx/applescript.?

* extras/MacOSX/Resources/vlc.scriptSuite
* extras/MacOSX/Resources/English.lproj/vlc.scriptTerminology
  - moved existing applescript commands to these files
  - added several control commands. supported are: play/pause, stop,
    previous, next, fullscreen, mute, volumeUp and volumeDown.
    These correspond to the existing menuitems. This still requires work
    in the future to make it more correct AppleScript, but it works for now.

* modules/gui/macosx/controls.?
  - split up the controls.m into a .m and a .h

* modules/gui/macosx/intf.?
  - added a getControls method to gain access to the controller object from
    the AppleScript commands.

* modules/gui/macosx/open.?
  - removed the applescript support existing here and moved it to applescript.?

* modules/gui/macosx/playlist.m
  - made the tooltips for the add and remove buttons localizable.

* modules/gui/macosx/vout.m
  - added a comment on the meaning of otherMouse events.

* ALL:
  - updated copyright information to include the current year ;)
parent 0474a40f
{
"Name" = "vlc suite";
"Description" = "vlc specific classes.";
"Name" = "VLC suite";
"Description" = "VLC commands.";
"Commands" = {
"OpenURL" = {
......@@ -11,5 +11,37 @@
Name = "GetURL";
Description = "Get a URL";
};
"play" = {
Name = "play";
Description = "Start playing the current playlistitem or pause it when it is already playing.";
};
"stop" = {
Name = "stop";
Description = "Stop playing the current playlistitem.";
};
"previous" = {
Name = "previous";
Description = "Go to the previous item in the playlist or the previous chapter in the DVD/VCD.";
};
"next" = {
Name = "next";
Description = "Go to the next item in the playlist or the next chapter in the DVD/VCD.";
};
"fullscreen" = {
Name = "fullscreen";
Description = "Toggle between fullscreen and windowed mode.";
};
"mute" = {
Name = "mute";
Description = "Mute the audio";
};
"volumeUp" = {
Name = "volumeUp";
Description = "Bring the volume up by one step. There are 32 steps from 0 to 100% volume.";
};
"volumeDown" = {
Name = "volumeDown";
Description = "Bring the volume down by one step. There are 32 steps from 0 to 100% volume.";
};
};
}
\ No newline at end of file
......@@ -13,5 +13,37 @@
AppleEventCode = "GURL";
CommandClass = "VLGetURLScriptCommand";
};
"play" = {
AppleEventCode = "VLC1";
CommandClass = "VLControlScriptCommand";
};
"stop" = {
AppleEventCode = "VLC2";
CommandClass = "VLControlScriptCommand";
};
"previous" = {
AppleEventCode = "GURL";
CommandClass = "VLControlScriptCommand";
};
"next" = {
AppleEventCode = "VLC3";
CommandClass = "VLControlScriptCommand";
};
"fullscreen" = {
AppleEventCode = "VLC4";
CommandClass = "VLControlScriptCommand";
};
"mute" = {
AppleEventCode = "VLC5";
CommandClass = "VLControlScriptCommand";
};
"volumeUp" = {
AppleEventCode = "VLC6";
CommandClass = "VLControlScriptCommand";
};
"volumeDown" = {
AppleEventCode = "VLC7";
CommandClass = "VLControlScriptCommand";
};
};
}
\ No newline at end of file
......@@ -501,7 +501,10 @@
};
08FB77AFFE84173DC02AAC07 = {
children = (
8E6BC6F6041643860059A3A7,
8E6BC6F7041643860059A3A7,
8ED6C27A03E2EB1C0059A3A7,
8E6BC6FA041684EC0059A3A7,
8ED6C27B03E2EB1C0059A3A7,
8ED6C27C03E2EB1C0059A3A7,
8ED6C27D03E2EB1C0059A3A7,
......@@ -602,6 +605,27 @@
settings = {
};
};
8E6BC6F6041643860059A3A7 = {
fileEncoding = 4;
isa = PBXFileReference;
name = applescript.h;
path = ../../modules/gui/macosx/applescript.h;
refType = 2;
};
8E6BC6F7041643860059A3A7 = {
fileEncoding = 4;
isa = PBXFileReference;
name = applescript.m;
path = ../../modules/gui/macosx/applescript.m;
refType = 2;
};
8E6BC6FA041684EC0059A3A7 = {
fileEncoding = 4;
isa = PBXFileReference;
name = controls.h;
path = ../../modules/gui/macosx/controls.h;
refType = 2;
};
8E88833C03DD6E870059A3A7 = {
isa = PBXFileReference;
name = slow.png;
......
SOURCES_macosx = \
modules/gui/macosx/applescript.h \
modules/gui/macosx/applescript.m \
modules/gui/macosx/aout.m \
modules/gui/macosx/controls.h \
modules/gui/macosx/controls.m \
modules/gui/macosx/intf.m \
modules/gui/macosx/intf.h \
......
/*****************************************************************************
* applescript.h: MacOS X AppleScript support
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: applescript.h,v 1.1 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* VLGetURLScriptCommand interface
*****************************************************************************/
@interface VLGetURLScriptCommand : NSScriptCommand
@end
/*****************************************************************************
* VLControlScriptCommand interface
*****************************************************************************/
@interface VLControlScriptCommand : NSScriptCommand
@end
\ No newline at end of file
/*****************************************************************************
* applescript.m: MacOS X AppleScript support
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: applescript.m,v 1.1 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Derk-Jan Hartman <thedj@users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "intf.h"
#include "applescript.h"
#include "controls.h"
#include "open.h"
/*****************************************************************************
* VLGetURLScriptCommand implementation
*****************************************************************************/
@implementation VLGetURLScriptCommand
- (id)performDefaultImplementation {
NSString *o_command = [[self commandDescription] commandName];
NSString *o_urlString = [self directParameter];
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return nil;
}
if ( o_urlString )
{
NSURL * o_url;
int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
i_mode, PLAYLIST_END );
o_url = [NSURL fileURLWithPath: o_urlString];
if( o_url != nil )
{
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_url];
}
}
vlc_object_release( p_playlist );
}
return nil;
}
@end
/*****************************************************************************
* VLControlScriptCommand implementation
*****************************************************************************/
/*
* This entire control command needs a better design. more object oriented.
* Applescript developers would be very welcome (hartman)
*/
@implementation VLControlScriptCommand
- (id)performDefaultImplementation {
NSString *o_command = [[self commandDescription] commandName];
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return nil;
}
VLCControls * o_controls = (VLCControls *)[[NSApp delegate] getControls];
if ( o_controls )
{
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 fullscreen: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;
}
}
vlc_object_release( p_playlist );
return nil;
}
@end
\ No newline at end of file
/*****************************************************************************
* controls.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: controls.h,v 1.1 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
* Derk-Jan Hartman <thedj@users.sourceforge.net>
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* VLCControls interface
*****************************************************************************/
@interface VLCControls : NSObject
{
IBOutlet id o_open;
IBOutlet id o_main;
IBOutlet id o_volumeslider;
}
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)volumeSliderUpdated:(id)sender;
- (void)updateVolumeSlider;
- (IBAction)halfWindow:(id)sender;
- (IBAction)normalWindow:(id)sender;
- (IBAction)doubleWindow:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)deinterlace:(id)sender;
- (IBAction)toggleProgram:(id)sender;
- (IBAction)toggleTitle:(id)sender;
- (IBAction)toggleChapter:(id)sender;
- (IBAction)toggleLanguage:(id)sender;
- (IBAction)toggleVar:(id)sender;
@end
\ No newline at end of file
/*****************************************************************************
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: controls.m,v 1.28 2003/02/12 14:22:23 hartman Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: controls.m,v 1.29 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -32,49 +32,7 @@
#include "intf.h"
#include "vout.h"
/*****************************************************************************
* VLCControls interface
*****************************************************************************/
@interface VLCControls : NSObject
{
IBOutlet id o_open;
IBOutlet id o_main;
IBOutlet id o_volumeslider;
}
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)volumeSliderUpdated:(id)sender;
- (void)updateVolumeSlider;
- (IBAction)halfWindow:(id)sender;
- (IBAction)normalWindow:(id)sender;
- (IBAction)doubleWindow:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)deinterlace:(id)sender;
- (IBAction)toggleProgram:(id)sender;
- (IBAction)toggleTitle:(id)sender;
- (IBAction)toggleChapter:(id)sender;
- (IBAction)toggleLanguage:(id)sender;
- (IBAction)toggleVar:(id)sender;
@end
#include "controls.h"
/*****************************************************************************
* VLCControls implementation
......
/*****************************************************************************
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.30 2003/03/04 17:31:45 hartman Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.h,v 1.31 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -214,6 +214,8 @@ struct intf_sys_t
IBOutlet id o_dmi_previous;
}
- (id)getControls;
- (void)terminate;
- (void)manage;
......
......@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.65 2003/03/04 23:36:57 massiot Exp $
* $Id: intf.m,v 1.66 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -418,6 +418,15 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
return( TRUE );
}
- (id)getControls
{
if ( o_controls )
{
return o_controls;
}
return nil;
}
- (void)manage
{
NSDate * o_sleep_date;
......
/*****************************************************************************
* open.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: open.h,v 1.11 2003/02/16 01:29:40 massiot Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: open.h,v 1.12 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -126,6 +126,3 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
- (IBAction)openFile:(id)sender;
@end
@interface VLGetURLScriptCommand : NSScriptCommand
@end
/*****************************************************************************
* open.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: open.m,v 1.23 2003/02/16 01:29:40 massiot Exp $
* Copyright (C) 2002-2003 VideoLAN
* $Id: open.m,v 1.24 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -827,45 +827,3 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
}
@end
@implementation VLGetURLScriptCommand
- (id)performDefaultImplementation {
NSString *o_command = [[self commandDescription] commandName];
NSString *o_urlString = [self directParameter];
NSLog(@"test1");
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] )
{
intf_thread_t * p_intf = [NSApp getIntf];
NSLog( o_command );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return nil;
}
if ( o_urlString )
{
NSURL * o_url;
int i_mode = PLAYLIST_INSERT | PLAYLIST_GO;
playlist_Add( p_playlist, [o_urlString fileSystemRepresentation],
i_mode, PLAYLIST_END );
NSLog( o_urlString );
o_url = [NSURL fileURLWithPath: o_urlString];
if( o_url != nil )
{
[[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_url];
}
}
vlc_object_release( p_playlist );
}
return nil;
}
@end
......@@ -2,9 +2,10 @@
* playlist.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.m,v 1.12 2003/02/23 05:53:53 jlj Exp $
* $Id: playlist.m,v 1.13 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net>
*
* 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
......@@ -122,6 +123,9 @@
[o_mi_play setTitle: _NS("Play")];
[o_mi_delete setTitle: _NS("Delete")];
[o_mi_selectall setTitle: _NS("Select All")];
[o_btn_add setToolTip: _NS("Add")];
[o_btn_remove setToolTip: _NS("Delete")];
}
- (BOOL)tableView:(NSTableView *)o_tv
......
/*****************************************************************************
* vout.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN
* $Id: vout.h,v 1.9 2003/02/13 02:00:56 hartman Exp $
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.h,v 1.10 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......
......@@ -2,7 +2,7 @@
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.36 2003/03/04 23:32:06 hartman Exp $
* $Id: vout.m,v 1.37 2003/03/06 11:43:07 hartman Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
......@@ -934,6 +934,8 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )