Commit 6484d33c authored by hartman's avatar hartman

* ./modules/gui/macosx/controls.m:

  - Added a volumeslider
  - removed pause button
  - added a fast forward action (increases speed in time)
  - changed the play method to allow for a toggled play pause button
  - volumeUp and VolumeDown take the state of the Mute Menuitem into account
  - volumeUp and VolumeDown take the volumeSlider into account
* ./modules/gui/macosx/intf.h:
  - added references for the volumeslider, new menuitems
* ./modules/gui/macosx/intf.m:
  - correct init of volumeslider and other new intf elements
  - new title for Controller window
  - the state of buttons is dependant on a movie being played
  - toggle the play/pause button if a play/pause action is detected.
* ./modules/gui/macosx/playlist.h: added add/remove buttons to playlist
* ./modules/gui/macosx/vout.m:
  - removed some control keys which were no longer necesarry
  - give the window the title of the item being played
parent a16b6c3c
......@@ -2,10 +2,11 @@
* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: controls.m,v 1.7 2003/01/15 11:27:29 massiot Exp $
* $Id: controls.m,v 1.8 2003/01/16 13:49:44 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
......@@ -45,13 +46,16 @@
@interface VLCControls : NSObject
{
IBOutlet id o_open;
IBOutlet id o_mi_mute;
IBOutlet id o_volumeslider;
int i_ff;
}
- (IBAction)play:(id)sender;
- (IBAction)pause:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)fastForward:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
......@@ -60,6 +64,7 @@
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)volumeSliderUpdate:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)deinterlace:(id)sender;
......@@ -69,6 +74,8 @@
- (IBAction)toggleLanguage:(id)sender;
- (IBAction)toggleVar:(id)sender;
- (void)setVolumeSlider;
@end
/*****************************************************************************
......@@ -86,33 +93,28 @@
return;
}
/* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
if ( p_intf->p_sys->p_input != NULL && p_intf->p_sys->p_input->stream.control.i_status != PAUSE_S)
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
[o_open openFile: nil];
}
}
- (IBAction)pause:(id)sender
{
intf_thread_t * p_intf = [NSApp getIntf];
/* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
if( p_intf->p_sys->p_input == NULL )
{
return;
[o_open openFile: nil];
}
}
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
- (IBAction)stop:(id)sender
......@@ -154,6 +156,51 @@
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
- (IBAction)fastForward:(id)sender
{
playlist_t * p_playlist = vlc_object_find( [NSApp getIntf], VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
i_ff++;
switch( [[NSApp currentEvent] type] )
{
/* A button does not send a NSLeftMouseDown unfortunately.
* Therefore we need to count. I know, it is ugly. We could have used
* a bool as well, but now we can also accellerate after a certain period.
* Currently this method is called every second if the button is pressed.
* You can set this value in intf.m
*/
case NSPeriodic:
if (i_ff == 1)
{
[self faster:self];
}
else if ( i_ff == 5 )
{
[self faster:self];
}
else if ( i_ff == 15 )
{
[self faster:self];
}
break;
case NSLeftMouseUp:
i_ff = 0;
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
break;
default:
break;
}
}
- (IBAction)prev:(id)sender
{
intf_thread_t * p_intf = [NSApp getIntf];
......@@ -217,9 +264,14 @@
if ( p_aout != NULL )
{
if (p_intf->p_sys->b_mute)
{
[self mute:o_mi_mute];
}
aout_VolumeUp( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
[self setVolumeSlider];
}
- (IBAction)volumeDown:(id)sender
......@@ -230,9 +282,14 @@
if ( p_aout != NULL )
{
if (p_intf->p_sys->b_mute)
{
[self mute:o_mi_mute];
}
aout_VolumeDown( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
[self setVolumeSlider];
}
- (IBAction)mute:(id)sender
......@@ -248,9 +305,54 @@
vlc_object_release( (vlc_object_t *)p_aout );
}
NSMenuItem * o_mi = (NSMenuItem *)sender;
p_intf->p_sys->b_mute = (i_volume == 0);
[o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
[o_mi_mute setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
[self setVolumeSlider];
}
- (IBAction)volumeSliderUpdate:(id)sender
{
intf_thread_t * p_intf = [NSApp getIntf];
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
audio_volume_t i_volume;
switch( [[NSApp currentEvent] type] )
{
case NSLeftMouseDragged:
if ( p_aout != NULL )
{
i_volume = (int) [sender floatValue];
aout_VolumeSet( p_aout, i_volume * AOUT_VOLUME_STEP);
vlc_object_release( (vlc_object_t *)p_aout );
p_intf->p_sys->b_mute = (i_volume == 0);
[o_mi_mute setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
}
break;
default:
break;
}
}
- (void)setVolumeSlider
{
intf_thread_t * p_intf = [NSApp getIntf];
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
audio_volume_t i_volume;
if ( p_aout != NULL )
{
aout_VolumeGet( p_aout, &i_volume );
vlc_object_release( (vlc_object_t *)p_aout );
[o_volumeslider setFloatValue: (float) (i_volume / AOUT_VOLUME_STEP)];
}
else
{
[o_volumeslider setFloatValue: config_GetInt( p_intf, "volume" )];
}
}
- (IBAction)fullscreen:(id)sender
......@@ -407,8 +509,7 @@
NSMenu * o_menu = [o_mi menu];
intf_thread_t * p_intf = [NSApp getIntf];
if( [[o_mi title] isEqualToString: _NS("Pause")] ||
[[o_mi title] isEqualToString: _NS("Faster")] ||
if( [[o_mi title] isEqualToString: _NS("Faster")] ||
[[o_mi title] isEqualToString: _NS("Slower")] )
{
if( p_intf->p_sys->p_input != NULL )
......@@ -446,22 +547,6 @@
vlc_object_release( p_playlist );
}
}
else if( [[o_mi title] isEqualToString: _NS("Volume Up")] ||
[[o_mi title] isEqualToString: _NS("Volume Down")] ||
[[o_mi title] isEqualToString: _NS("Mute")] )
{
aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
vlc_object_release( (vlc_object_t *)p_aout );
}
else
{
bEnabled = FALSE;
}
}
else if( [[o_mi title] isEqualToString: _NS("Fullscreen")] )
{
id o_window = [NSApp keyWindow];
......
......@@ -2,10 +2,11 @@
* intf.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: intf.h,v 1.12 2003/01/06 22:07:47 massiot Exp $
* $Id: intf.h,v 1.13 2003/01/16 13:49:44 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
......@@ -93,14 +94,14 @@ struct intf_sys_t
NSLock * o_slider_lock; /* slider lock */
float f_slider; /* slider value */
float f_slider_old; /* old slider val */
IBOutlet id o_volumeslider; /* volume slider */
IBOutlet id o_btn_playlist; /* btn playlist */
IBOutlet id o_btn_prev; /* btn previous */
IBOutlet id o_btn_slower; /* btn slower */
IBOutlet id o_btn_play; /* btn play */
IBOutlet id o_btn_pause; /* btn pause */
IBOutlet id o_btn_stop; /* btn stop */
IBOutlet id o_btn_faster; /* btn faster */
IBOutlet id o_btn_fastforward; /* btn fastforward */
IBOutlet id o_btn_next; /* btn next */
IBOutlet id o_btn_prefs; /* btn prefs */
......@@ -142,41 +143,42 @@ struct intf_sys_t
IBOutlet id o_mi_clear;
IBOutlet id o_mi_select_all;
IBOutlet id o_mu_view;
IBOutlet id o_mi_playlist;
IBOutlet id o_mi_messages;
IBOutlet id o_mu_controls;
IBOutlet id o_mi_play;
IBOutlet id o_mi_pause;
IBOutlet id o_mi_stop;
IBOutlet id o_mi_faster;
IBOutlet id o_mi_slower;
IBOutlet id o_mi_previous;
IBOutlet id o_mi_next;
IBOutlet id o_mi_loop;
IBOutlet id o_mi_program;
IBOutlet id o_mi_title;
IBOutlet id o_mi_chapter;
IBOutlet id o_mi_language;
IBOutlet id o_mi_subtitle;
IBOutlet id o_mu_audio;
IBOutlet id o_mi_vol_up;
IBOutlet id o_mi_vol_down;
IBOutlet id o_mi_mute;
IBOutlet id o_mi_channels;
IBOutlet id o_mi_device;
IBOutlet id o_mu_video;
IBOutlet id o_mi_fullscreen;
IBOutlet id o_mi_screen;
IBOutlet id o_mi_deinterlace;
IBOutlet id o_mi_program;
IBOutlet id o_mi_title;
IBOutlet id o_mi_chapter;
IBOutlet id o_mi_language;
IBOutlet id o_mi_subtitle;
IBOutlet id o_mu_window;
IBOutlet id o_mi_minimize;
IBOutlet id o_mi_close_window;
IBOutlet id o_mi_controller;
IBOutlet id o_mi_playlist;
IBOutlet id o_mi_messages;
IBOutlet id o_mi_bring_atf;
/* dock menu */
IBOutlet id o_dmi_play;
IBOutlet id o_dmi_pause;
IBOutlet id o_dmi_stop;
}
......
......@@ -2,10 +2,11 @@
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.25 2003/01/15 23:55:22 massiot Exp $
* $Id: intf.m,v 1.26 2003/01/16 13:49:44 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
......@@ -186,8 +187,8 @@ static void Run( intf_thread_t *p_intf )
- (void)awakeFromNib
{
NSString * pTitle = [NSString
stringWithCString: VOUT_TITLE " (Cocoa)"];
NSString * pTitle;
pTitle = _NS("VLC - Controller");
[o_window setTitle: pTitle];
......@@ -196,12 +197,14 @@ static void Run( intf_thread_t *p_intf )
[o_btn_prev setToolTip: _NS("Previous")];
[o_btn_slower setToolTip: _NS("Slower")];
[o_btn_play setToolTip: _NS("Play")];
[o_btn_pause setToolTip: _NS("Pause")];
[o_btn_stop setToolTip: _NS("Stop")];
[o_btn_faster setToolTip: _NS("Faster")];
[o_btn_fastforward setToolTip: _NS("Fast Forward")];
[o_btn_fastforward setPeriodicDelay: 0.0 interval: 1];
[o_btn_next setToolTip: _NS("Next")];
[o_btn_prefs setToolTip: _NS("Preferences")];
[o_volumeslider setToolTip: _NS("Volume")];
[o_timeslider setToolTip: _NS("Position")];
/* messages panel */
[o_msgs_panel setTitle: _NS("Messages")];
[o_msgs_btn_ok setTitle: _NS("Close")];
......@@ -229,41 +232,43 @@ static void Run( intf_thread_t *p_intf )
[o_mi_clear setTitle: _NS("Clear")];
[o_mi_select_all setTitle: _NS("Select All")];
[o_mu_view setTitle: _NS("View")];
[o_mi_playlist setTitle: _NS("Playlist")];
[o_mi_messages setTitle: _NS("Messages")];
[o_mu_controls setTitle: _NS("Controls")];
[o_mi_play setTitle: _NS("Play")];
[o_mi_pause setTitle: _NS("Pause")];
[o_mi_play setTitle: _NS("Play/Pause")];
[o_mi_stop setTitle: _NS("Stop")];
[o_mi_faster setTitle: _NS("Faster")];
[o_mi_slower setTitle: _NS("Slower")];
[o_mi_previous setTitle: _NS("Previous")];
[o_mi_next setTitle: _NS("Next")];
[o_mi_loop setTitle: _NS("Loop")];
[o_mi_program setTitle: _NS("Program")];
[o_mi_title setTitle: _NS("Title")];
[o_mi_chapter setTitle: _NS("Chapter")];
[o_mi_language setTitle: _NS("Language")];
[o_mi_subtitle setTitle: _NS("Subtitles")];
[o_mu_audio setTitle: _NS("Audio")];
[o_mi_vol_up setTitle: _NS("Volume Up")];
[o_mi_vol_down setTitle: _NS("Volume Down")];
[o_mi_mute setTitle: _NS("Mute")];
[o_mi_channels setTitle: _NS("Channels")];
[o_mi_device setTitle: _NS("Device")];
[o_mu_video setTitle: _NS("Video")];
[o_mi_fullscreen setTitle: _NS("Fullscreen")];
[o_mi_screen setTitle: _NS("Screen")];
[o_mi_deinterlace setTitle: _NS("Deinterlace")];
[o_mi_program setTitle: _NS("Program")];
[o_mi_title setTitle: _NS("Title")];
[o_mi_chapter setTitle: _NS("Chapter")];
[o_mi_language setTitle: _NS("Language")];
[o_mi_subtitle setTitle: _NS("Subtitles")];
[o_mu_window setTitle: _NS("Window")];
[o_mi_minimize setTitle: _NS("Minimize Window")];
[o_mi_close_window setTitle: _NS("Close Window")];
[o_mi_controller setTitle: _NS("Controller")];
[o_mi_playlist setTitle: _NS("Playlist")];
[o_mi_messages setTitle: _NS("Messages")];
[o_mi_bring_atf setTitle: _NS("Bring All to Front")];
/* dock menu */
[o_dmi_play setTitle: _NS("Play")];
[o_dmi_pause setTitle: _NS("Pause")];
[o_dmi_play setTitle: _NS("Play/Pause")];
[o_dmi_stop setTitle: _NS("Stop")];
/* error panel */
......@@ -317,6 +322,11 @@ static void Run( intf_thread_t *p_intf )
{
p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
[o_btn_play setState: NSOffState];
[o_btn_stop setEnabled: NO];
[o_btn_slower setEnabled: NO];
[o_btn_fastforward setEnabled: NO];
[o_timeslider setEnabled: NO];
}
else if( p_intf->p_sys->p_input->b_dead )
{
......@@ -337,6 +347,11 @@ static void Run( intf_thread_t *p_intf )
}
p_intf->p_sys->b_stopping = 0;
[o_btn_play setState: NSOffState];
[o_btn_stop setEnabled: NO];
[o_btn_fastforward setEnabled: NO];
[o_btn_slower setEnabled: NO];
[o_timeslider setEnabled: NO];
}
[self displayTime];
......@@ -401,12 +416,22 @@ static void Run( intf_thread_t *p_intf )
if ( b_need_menus )
[self setupMenus];
if ( p_intf->p_sys->p_input != NULL && p_intf->p_sys->p_input->stream.control.i_status != PAUSE_S)
{
[o_btn_play setState: NSOnState];
}
else
{
[o_btn_play setState: NSOffState];
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else if( p_intf->p_sys->b_playing && !p_intf->b_die )
{
[self displayTime];
[self manageMode];
[o_btn_play setState: NSOffState];
p_intf->p_sys->b_playing = 0;
}
......@@ -612,11 +637,11 @@ static void Run( intf_thread_t *p_intf )
/* set control items */
[o_btn_stop setEnabled: b_input];
[o_btn_pause setEnabled: b_control];
[o_btn_faster setEnabled: b_control];
[o_btn_fastforward setEnabled: b_control];
[o_btn_slower setEnabled: b_control];
[o_btn_prev setEnabled: b_plmul];
[o_btn_next setEnabled: b_plmul];
[o_controls setVolumeSlider];
if ( (p_intf->p_sys->b_loop = config_GetInt( p_intf, "loop" )) )
{
......
......@@ -2,9 +2,10 @@
* playlist.h: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: playlist.h,v 1.2 2003/01/05 03:21:50 jlj Exp $
* $Id: playlist.h,v 1.3 2003/01/16 13:49:44 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
......@@ -43,6 +44,9 @@
IBOutlet id o_mi_play;
IBOutlet id o_mi_delete;
IBOutlet id o_mi_selectall;
IBOutlet id o_btn_add;
IBOutlet id o_btn_remove;
}
- (NSMenu *)menuForEvent:(NSEvent *)o_event;
......
......@@ -2,11 +2,12 @@
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.12 2003/01/15 00:49:49 jlj Exp $
* $Id: vout.m,v 1.13 2003/01/16 13:49:44 hartman Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
* 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
......@@ -819,30 +820,6 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
switch( key )
{
case (unichar)0xf700: /* up-arrow */
{
aout_instance_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
aout_VolumeUp( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
break;
case (unichar)0xf701: /* down-arrow */
{
aout_instance_t * p_aout = vlc_object_find( p_vout, VLC_OBJECT_AOUT,
FIND_ANYWHERE );
if ( p_aout != NULL )
{
aout_VolumeDown( p_aout, 1, NULL );
vlc_object_release( (vlc_object_t *)p_aout );
}
}
break;
case 'f': case 'F':
[self toggleFullscreen];
break;
......@@ -858,10 +835,6 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->p_vlc->b_die = VLC_TRUE;
break;
case ' ':
input_SetStatus( p_vout, INPUT_STATUS_PAUSE );
break;
default:
[super keyDown: o_event];
break;
......@@ -999,7 +972,12 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
VLCView * o_view;
NSScreen * o_screen;
vout_thread_t * p_vout;
id o_title;
intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
p_vout = (vout_thread_t *)[o_value pointerValue];
p_vout->p_sys->o_window = [VLCWindow alloc];
......@@ -1071,9 +1049,30 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->p_sys->p_qdport = [o_view qdPort];
[o_view unlockFocus];
[p_vout->p_sys->o_window setTitle:
[NSString stringWithCString: VOUT_TITLE " (QuickTime)"]];
[p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
if( p_playlist == NULL )
{
return;
}
vlc_mutex_lock( &p_playlist->object_lock );
o_title = [NSString stringWithUTF8String:
p_playlist->pp_items[p_playlist->i_index]->psz_name];
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
if (o_title)
{
[p_vout->p_sys->o_window setTitle: o_title];
[p_vout->p_sys->o_window makeKeyAndOrderFront: nil];
}
else
{
[p_vout->p_sys->o_window setTitle: