Commit e6d0343f authored by Felix Paul Kühne's avatar Felix Paul Kühne

* implement the playmode buttons and the fullscreen panel. TODO: fix...

* implement the playmode buttons and the fullscreen panel. TODO: fix mainmenu.nib (bring back the old-school error panel), fix some compilation warnings, make sure that the fspanel is hidden on vout:close. Any other remarks are appreciated.
parent ce013a3e
......@@ -42,5 +42,7 @@ SOURCES_macosx = \
embeddedwindow.m \
update.h \
update.m \
fspanel.h \
fspanel.m \
$(NULL)
......@@ -23,6 +23,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "fspanel.h"
/*****************************************************************************
* VLCControls interface
*****************************************************************************/
......@@ -32,6 +34,10 @@
IBOutlet id o_btn_fullscreen;
IBOutlet id o_volumeslider;
IBOutlet id o_btn_shuffle;
IBOutlet id o_btn_addNode;
IBOutlet id o_btn_repeat;
IBOutlet id o_specificTime_cancel_btn;
IBOutlet id o_specificTime_enter_fld;
......@@ -41,6 +47,8 @@
IBOutlet id o_specificTime_sec_lbl;
IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi;
VLCFSPanel *o_fs_panel;
}
- (IBAction)play:(id)sender;
......@@ -53,6 +61,13 @@
- (IBAction)random:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)repeatButtonAction:(id)sender;
/* the three ugly helpers again */
- (void)repeatOne;
- (void)repeatAll;
- (void)repeatOff;
- (void)shuffle;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
......@@ -79,6 +94,7 @@
- (IBAction)goToSpecificTime:(id)sender;
- (id)getFSPanel;
@end
/*****************************************************************************
......
/*****************************************************************************
* controls.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
* Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
* Felix Khne <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
......@@ -31,10 +32,11 @@
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#include "intf.h"
#include "vout.h"
#include "open.h"
#include "controls.h"
#import "intf.h"
#import "vout.h"
#import "open.h"
#import "controls.h"
#import "playlist.h"
#include <vlc_osd.h>
......@@ -43,6 +45,13 @@
*****************************************************************************/
@implementation VLCControls
- (id)init
{
[super init];
o_fs_panel = [[VLCFSPanel alloc] init];
return self;
}
- (void)awakeFromNib
{
[o_specificTime_mi setTitle: _NS("Jump To Time")];
......@@ -174,6 +183,117 @@
vlc_object_release( p_playlist );
}
/* three little ugly helpers */
- (void)repeatOne
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
}
- (void)repeatAll
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded_blue.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
}
- (void)repeatOff
{
[o_btn_repeat setImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_embedded.png"]]];
[o_btn_repeat setAlternateImage: [[NSImage alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForImageResource:@"repeat_single_embedded_blue.png"]]];
}
- (void)shuffle
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "random", &val );
[o_btn_shuffle setState: val.b_bool];
vlc_object_release( p_playlist );
}
- (IBAction)repeatButtonAction:(id)sender
{
vlc_value_t looping,repeating;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
var_Get( p_playlist, "repeat", &repeating );
var_Get( p_playlist, "loop", &looping );
[[o_btn_repeat image] release];
[[o_btn_repeat alternateImage] release];
if( !repeating.b_bool && !looping.b_bool )
{
/* was: no repeating at all, switching to Repeat One */
/* set our button's look */
[self repeatOne];
/* prepare core communication */
repeating.b_bool = VLC_TRUE;
looping.b_bool = VLC_FALSE;
config_PutInt( p_playlist, "repeat", 1 );
config_PutInt( p_playlist, "loop", 0 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
}
else if( repeating.b_bool && !looping.b_bool )
{
/* was: Repeat One, switching to Repeat All */
/* set our button's look */
[self repeatAll];
/* prepare core communication */
repeating.b_bool = VLC_FALSE;
looping.b_bool = VLC_TRUE;
config_PutInt( p_playlist, "repeat", 0 );
config_PutInt( p_playlist, "loop", 1 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
}
else
{
/* was: Repeat All or bug in VLC, switching to Repeat Off */
/* set our button's look */
[self repeatOff];
/* prepare core communication */
repeating.b_bool = VLC_FALSE;
looping.b_bool = VLC_FALSE;
config_PutInt( p_playlist, "repeat", 0 );
config_PutInt( p_playlist, "loop", 0 );
/* show the change */
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "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 = VLC_TRUE;
p_intf->p_sys->b_intf_update = VLC_TRUE;
vlc_object_release( p_playlist );
}
- (IBAction)repeat:(id)sender
{
vlc_value_t val;
......@@ -670,6 +790,16 @@
}
}
- (id)getFSPanel
{
if( o_fs_panel )
return o_fs_panel;
else
{
msg_Err( VLCIntf, "FSPanel is nil" );
return NULL;
}
}
@end
@implementation VLCControls (NSMenuValidation)
......
/*****************************************************************************
* fspanel.h: MacOS X full screen panel
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: fspanel.h 16935 2006-10-04 08:19:38Z fkuehne $
*
* Authors: Jrme Decoodt <djc at videolan dot org>
* Felix Khne <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.
*****************************************************************************/
@interface VLCFSPanel : NSWindow
{
NSTimer *fadeTimer,*hideAgainTimer;
NSPoint mouseClic;
BOOL b_fadeQueued;
BOOL b_keptVisible;
BOOL b_alreadyCounting;
int i_timeToKeepVisibleInSec;
}
- (id)initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
- (void)awakeFromNib;
- (BOOL)canBecomeKeyWindow;
- (void)dealloc;
- (void)setPlay;
- (void)setPause;
- (void)setStreamTitle:(NSString *)o_title;
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time;
- (void)setSeekable:(BOOL) b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (void)focus:(NSTimer *)timer;
- (void)unfocus:(NSTimer *)timer;
- (void)mouseExited:(NSEvent *)theEvent;
- (void)fadeIn;
- (void)quickFadeIn;
- (void)fadeOut;
- (NSTimer *)fadeTimer;
- (void)setFadeTimer:(NSTimer *)timer;
- (void)autoHide;
- (void)keepVisible:(NSTimer *)timer;
- (void)mouseDown:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
@end
@interface VLCFSPanelView : NSView
{
NSColor *fillColor;
NSButton *o_prev, *o_next, *o_slow, *o_fast, *o_play, *o_fullscreen;
NSTextField *o_streamTitle_txt, *o_streamPosition_txt;
NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
}
- (id)initWithFrame:(NSRect)frameRect;
- (void)drawRect:(NSRect)rect;
- (void)setPlay;
- (void)setPause;
- (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;
- (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (float)f_volumeLevel;
- (IBAction)play:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
- (IBAction)fsTimeSliderUpdate:(id)sender;
- (IBAction)fsVolumeSliderUpdate:(id)sender;
@end
@interface VLCFSTimeSlider : NSSlider
{
}
- (void)drawKnobInRect:(NSRect)knobRect;
- (void)drawRect:(NSRect)rect;
@end
@interface VLCFSVolumeSlider : NSSlider
{
}
- (void)drawKnobInRect:(NSRect)knobRect;
- (void)drawRect:(NSRect)rect;
@end
/*****************************************************************************
* fspanel.m: MacOS X full screen panel
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id: fspanel.m 17038 2006-10-12 18:24:34Z fkuehne $
*
* Authors: Jérôme Decoodt <djc at videolan dot org>
* Felix 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#import "intf.h"
#import "controls.h"
#import "vout.h"
#import "fspanel.h"
#define KEEP_VISIBLE_AFTER_ACTION 4 /* time in half-sec until this panel will hide again after an user's action */
/*****************************************************************************
* VLCFSPanel
*****************************************************************************/
@implementation VLCFSPanel
/* We override this initializer so we can set the NSBorderlessWindowMask styleMask, and set a few other important settings */
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(unsigned int)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
id win=[super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
[win setOpaque:NO];
[win setHasShadow: NO];
[win setBackgroundColor:[NSColor clearColor]];
/* let the window sit on top of everything else and start out completely transparent */
[win setLevel:NSFloatingWindowLevel];
[win setAlphaValue:0.0];
return win;
}
- (void)awakeFromNib
{
[self setContentView:[[VLCFSPanelView alloc] initWithFrame: [self frame]]];
BOOL isInside=(NSPointInRect([NSEvent mouseLocation],[self frame]));
[[self contentView] addTrackingRect:[[self contentView] bounds] owner:self userData:nil assumeInside:isInside];
if (isInside)
[self mouseEntered:NULL];
if (!isInside)
[self mouseExited:NULL];
}
/* Windows created with NSBorderlessWindowMask normally can't be key, but we want ours to be */
- (BOOL)canBecomeKeyWindow
{
return YES;
}
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
-(void)dealloc
{
if( hideAgainTimer )
[hideAgainTimer release];
[self setFadeTimer:nil];
[super dealloc];
}
- (void)setPlay
{
[[self contentView] setPlay];
}
- (void)setPause
{
[[self contentView] setPause];
}
- (void)setStreamTitle:(NSString *)o_title
{
[[self contentView] setStreamTitle: o_title];
}
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time
{
[[self contentView] setStreamPos:f_pos andTime: o_time];
}
- (void)setSeekable:(BOOL) b_seekable
{
[[self contentView] setSeekable: b_seekable];
}
- (void)setVolumeLevel: (float)f_volumeLevel
{
[[self contentView] setVolumeLevel: f_volumeLevel];
}
/* This routine is called repeatedly to fade in the window */
- (void)focus:(NSTimer *)timer
{
if( [self alphaValue] < 1.0 )
[self setAlphaValue:[self alphaValue]+0.1];
if( [self alphaValue] >= 1.0 )
{
[self setAlphaValue: 1.0];
[self setFadeTimer:nil];
if( b_fadeQueued )
{
b_fadeQueued=NO;
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:NULL repeats:YES]];
}
}
}
/* This routine is called repeatedly to hide the window */
- (void)unfocus:(NSTimer *)timer
{
if( b_keptVisible )
{
b_keptVisible = NO;
b_fadeQueued = NO;
[[self fadeTimer] release];
[self setFadeTimer: NULL];
[self fadeIn];
return;
}
if( [self alphaValue] > 0.0 )
[self setAlphaValue:[self alphaValue]-0.1];
if( [self alphaValue] <= 0.1 )
{
[self setAlphaValue:0.0];
[self setFadeTimer:nil];
if( b_fadeQueued )
{
b_fadeQueued=NO;
[self setFadeTimer:
[NSTimer scheduledTimerWithTimeInterval:0.1
target:self
selector:@selector(focus:)
userInfo:NULL
repeats:YES]];
}
}
}
- (void)mouseExited:(NSEvent *)theEvent
{
/* give up our focus, so the vout may show us again without letting the user clicking it */
if( [[[[VLCMain sharedInstance] getControls] getVoutView] isFullscreen] )
[[[[[VLCMain sharedInstance] getControls] getVoutView] window] makeKeyWindow];
}
- (void)fadeIn
{
if( [self alphaValue] < 1.0 )
{
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(focus:) userInfo:[NSNumber numberWithShort:1] repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==0)
b_fadeQueued=YES;
}
[self autoHide];
}
- (void)fadeOut
{
if( ( [self alphaValue] > 0.0 ) )
{
if (![self fadeTimer])
[self setFadeTimer:[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(unfocus:) userInfo:[NSNumber numberWithShort:0] repeats:YES]];
else if ([[[self fadeTimer] userInfo] shortValue]==1)
b_fadeQueued=YES;
}
}
/* triggers a timer to autoHide us again after some seconds of no activity */
- (void)autoHide
{
/* this will tell the timer to start over again or to start at all */
b_keptVisible = YES;
/* get us a valid timer */
if(! b_alreadyCounting )
{
hideAgainTimer = [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self
selector: @selector(keepVisible:)
userInfo: nil
repeats: YES];
[hideAgainTimer fire];
[hideAgainTimer retain];
b_alreadyCounting = YES;
}
}
- (void)keepVisible:(NSTimer *)timer
{
/* if the user triggered an action, start over again */
if( b_keptVisible )
{
i_timeToKeepVisibleInSec = KEEP_VISIBLE_AFTER_ACTION;
b_keptVisible = NO;
}
/* count down until we hide ourselfes again and do so if necessary */
i_timeToKeepVisibleInSec -= 1;
if( i_timeToKeepVisibleInSec < 1 )
{
[self fadeOut];
[timer invalidate];
[timer release];
b_alreadyCounting = NO;
timer = NULL;
}
}
/* A getter and setter for our main timer that handles window fading */
- (NSTimer *)fadeTimer
{
return fadeTimer;
}
- (void)setFadeTimer:(NSTimer *)timer
{
[timer retain];
[fadeTimer invalidate];
[fadeTimer release];
fadeTimer=timer;
}
- (void)mouseDown:(NSEvent *)theEvent
{
mouseClic = [theEvent locationInWindow];
}
- (void)mouseDragged:(NSEvent *)theEvent
{
NSPoint point = [NSEvent mouseLocation];
point.x -= mouseClic.x;
point.y -= mouseClic.y;
[self setFrameOrigin:point];
}
@end
/*****************************************************************************
* FSPanelView
*****************************************************************************/
@implementation VLCFSPanelView
#define addButton( o_button, imageOff, imageOn, _x, _y, action ) \
s_rc.origin.x = _x; \
s_rc.origin.y = _y; \
o_button = [[NSButton alloc] initWithFrame: s_rc]; \
[o_button setButtonType: NSMomentaryChangeButton]; \
[o_button setBezelStyle: NSRegularSquareBezelStyle]; \
[o_button setBordered: NO]; \
[o_button setFont:[NSFont systemFontOfSize:0]]; \
[o_button setImage:[NSImage imageNamed:imageOff]]; \
[o_button setAlternateImage:[NSImage imageNamed:imageOn]]; \
[o_button sizeToFit]; \
[o_button setTarget: self]; \
[o_button setAction: @selector(action:)]; \
[self addSubview:o_button];
#define addTextfield( o_text, align, font, color, size ) \
o_text = [[NSTextField alloc] initWithFrame: s_rc]; \
[o_text setDrawsBackground: NO]; \
[o_text setBordered: NO]; \
[o_text setEditable: NO]; \
[o_text setSelectable: NO]; \
[o_text setStringValue: _NS("(no item is being played)")]; \
[o_text setAlignment: align]; \
[o_text setTextColor: [NSColor color]]; \
[o_text setFont:[NSFont font:[NSFont smallSystemFontSize] - size]]; \
[self addSubview:o_text];
- (id)initWithFrame:(NSRect)frameRect
{
id view = [super initWithFrame:frameRect];
fillColor = [[NSColor clearColor] retain];
NSRect s_rc = [self frame];
NSImage * image;
addButton( o_prev, @"fs_skip_previous" , @"fs_skip_previous_highlight", 174, 15, prev );
addButton( o_slow, @"fs_rewind" , @"fs_rewind_highlight" , 211, 14, slower );
addButton( o_play, @"fs_play" , @"fs_play_highlight" , 267, 10, play );
addButton( o_fast, @"fs_forward" , @"fs_forward_highlight" , 313, 14, faster );
addButton( o_next, @"fs_skip_next" , @"fs_skip_next_highlight" , 365, 15, next );
addButton( o_fullscreen, @"fs_exit_fullscreen", @"fs_exit_fullscreen_hightlight", 507, 13, windowAction );
/*
addButton( o_button, @"image (off state)", @"image (on state)", 38, 51, something );
*/
/* time slider */
s_rc = [self frame];
s_rc.origin.x = 15;
s_rc.origin.y = 53;
s_rc.size.width = 518;
s_rc.size.height = 9;
o_fs_timeSlider = [[VLCFSTimeSlider alloc] initWithFrame: s_rc];
[o_fs_timeSlider setMinValue:0];
[o_fs_timeSlider setMaxValue:10000];
[o_fs_timeSlider setFloatValue: 0];
[o_fs_timeSlider setContinuous: YES];
[o_fs_timeSlider setTarget: self];
[o_fs_timeSlider setAction: @selector(fsTimeSliderUpdate:)];
[self addSubview: o_fs_timeSlider];
/* volume slider */
s_rc = [self frame];
s_rc.origin.x = 26;
s_rc.origin.y = 17.5;
s_rc.size.width = 95;
s_rc.size.height = 10;
o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
[o_fs_volumeSlider setMinValue:0];
[o_fs_volumeSlider setMaxValue:32];
[o_fs_volumeSlider setFloatValue: 0];
[o_fs_volumeSlider setContinuous: YES];
[o_fs_volumeSlider setTarget: self];
[o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];
[self addSubview: o_fs_volumeSlider];
/* time counter and stream title output fields */
s_rc = [self frame];
s_rc.origin.x = 98;
s_rc.origin.y = 64;
s_rc.size.width = 352;
s_rc.size.height = 14;
addTextfield( o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor, 0 );
s_rc.origin.x = 486;
s_rc.origin.y = 64;
s_rc.size.width = 50;
addTextfield( o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor, 0 );
return view;
}
- (void)dealloc
{
[o_fs_timeSlider release];
[o_fs_volumeSlider release];
[o_prev release];
[o_next release];
[o_slow release];
[o_play release];
[o_fast release];
[o_fullscreen release];
[o_streamTitle_txt release];
[o_streamPosition_txt release];
[super dealloc];
}
- (void)setPlay
{
NSBundle *bundle = [NSBundle mainBundle];
NSImage *image;
image = [NSImage imageNamed:@"fs_play"];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_play_highlight"];
[o_play setAlternateImage:image];
}
- (void)setPause
{
NSBundle *bundle = [NSBundle mainBundle];
NSImage *image;
image = [NSImage imageNamed:@"fs_pause"];
[o_play setImage:image];
image = [NSImage imageNamed:@"fs_pause_highlight"];
[o_play setAlternateImage:image];
}
- (void)setStreamTitle:(NSString *)o_title
{
[o_streamTitle_txt setStringValue: o_title];
}
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time
{
[o_streamPosition_txt setStringValue: o_time];
[o_fs_timeSlider setFloatValue: f_pos];
}
- (void)setSeekable:(BOOL)b_seekable
{
[o_slow setEnabled: b_seekable];
[o_fast setEnabled: b_seekable];
[o_fs_timeSlider setEnabled: b_seekable];
}
- (void)setVolumeLevel: (float)f_volumeLevel
{
[o_fs_volumeSlider setFloatValue: f_volumeLevel];
}
- (IBAction)play:(id)sender
{
[[[VLCMain sharedInstance] getControls] play: sender];
}
- (IBAction)faster:(id)sender
{
[[[VLCMain sharedInstance] getControls] faster: sender];
}
- (IBAction)slower:(id)sender
{
[[[VLCMain sharedInstance] getControls] slower: sender];
}
- (IBAction)prev:(id)sender
{
[[[VLCMain sharedInstance] getControls] prev: sender];
}
- (IBAction)next:(id)sender
{
[[[VLCMain sharedInstance] getControls] next: sender];
}
- (IBAction)windowAction:(id)sender
{
[[[VLCMain sharedInstance] getControls] windowAction: sender];
}
- (IBAction)fsTimeSliderUpdate:(id)sender
{
[[VLCMain sharedInstance] timesliderUpdate: sender];
}
- (IBAction)fsVolumeSliderUpdate:(id)sender
{
[[[VLCMain sharedInstance] getControls] volumeSliderUpdated: sender];
}
#define addImage(image, _x, _y, mode, _width) \
img = [NSImage imageNamed:image]; \
image_rect.size = [img size]; \
image_rect.origin.x = 0; \
image_rect.origin.y = 0; \
frame.origin.x = _x; \
frame.origin.y = _y; \
frame.size = [img size]; \
if( _width ) frame.size.width = _width; \
[img drawInRect:frame fromRect:image_rect operation:mode fraction:1];
- (void)drawRect:(NSRect)rect
{
NSRect frame = [self frame];
NSRect image_rect;
NSImage *img;
addImage( @"fs_background", 0, 0, NSCompositeCopy, 0 );
addImage( @"fs_volume_slider_bar", 26, 22, NSCompositeSourceOver, 0 );
addImage( @"fs_volume_mute", 16, 18, NSCompositeSourceOver, 0 );
addImage( @"fs_volume_max", 124, 17, NSCompositeSourceOver, 0 );
addImage( @"fs_time_slider", 15, 53, NSCompositeSourceOver, 0);
}
@end
/*****************************************************************************
* VLCFSTimeSlider
*****************************************************************************/
@implementation VLCFSTimeSlider
- (void)drawKnobInRect:(NSRect)knobRect
{
NSBundle *bundle = [NSBundle mainBundle];
NSRect image_rect;
NSImage *img = [NSImage imageNamed:@"fs_time_slider_knob_highlight"];
image_rect.size = [img size];
image_rect.origin.x = 0;
image_rect.origin.y = 0;
knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
knobRect.size.width = image_rect.size.width;
knobRect.size.height = image_rect.size.height;
[img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
}
- (void)drawRect:(NSRect)rect
{
/* Draw default to make sure the slider behaves correctly */
[[NSGraphicsContext currentContext] saveGraphicsState];
NSRectClip(NSZeroRect);
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=7.5;
[[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnobInRect: knobRect];
}
@end
/*****************************************************************************
* VLCFSVolumeSlider
*****************************************************************************/
@implementation VLCFSVolumeSlider
- (void)drawKnobInRect:(NSRect) knobRect
{
NSBundle *bundle = [NSBundle mainBundle];
NSRect image_rect;
NSImage *img = [NSImage imageNamed:@"fs_volume_slider_knob"];
image_rect.size = [img size];
image_rect.origin.x = 0;
image_rect.origin.y = 0;
knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
knobRect.size.width = image_rect.size.width;
knobRect.size.height = image_rect.size.height;
[img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
}
- (void)drawRect:(NSRect)rect
{
/* Draw default to make sure the slider behaves correctly */
[[NSGraphicsContext currentContext] saveGraphicsState];
NSRectClip(NSZeroRect);
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=6;
[[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
[self drawKnobInRect: knobRect];
}
@end
\ No newline at end of file
......@@ -32,20 +32,21 @@
#include <string.h>
#include <vlc_keys.h>
#include "intf.h"
#include "vout.h"
#include "prefs.h"
#include "playlist.h"
#include "controls.h"
#include "about.h"
#include "open.h"
#include "wizard.h"
#include "extended.h"
#include "bookmarks.h"
#include "interaction.h"
#include "embeddedwindow.h"
#include "update.h"
#include "AppleRemote.h"
#import "intf.h"
#import "fspanel.h"
#import "vout.h"
#import "prefs.h"
#import "playlist.h"
#import "controls.h"
#import "about.h"
#import "open.h"
#import "wizard.h"
#import "extended.h"
#import "bookmarks.h"
#import "interaction.h"
#import "embeddedwindow.h"
#import "update.h"
#import "AppleRemote.h"
/*****************************************************************************
* Local prototypes.
......@@ -477,6 +478,9 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback( p_intf, "interaction", InteractCallback, self );
p_intf->b_interaction = VLC_TRUE;
/* update the playmode stuff */
p_intf->p_sys->b_playmode_update = VLC_TRUE;
nib_main_loaded = TRUE;
}
......@@ -1055,6 +1059,8 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_timeslider setFloatValue: 0.0];
[o_timeslider setEnabled: b_seekable];
[o_timefield setStringValue: @"0:00:00"];
[[[self getControls] getFSPanel] setStreamPos: 0 andTime: @"0:00:00"];
[[[self getControls] getFSPanel] setSeekable: b_seekable];
[o_embedded_window setSeekable: b_seekable];
......@@ -1111,6 +1117,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_temp = [NSString stringWithCString:
p_playlist->status.p_item->input.psz_name];
[self setScrollField: o_temp stopAfter:-1];
[[[self getControls] getFSPanel] setStreamTitle: o_temp];
p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT,
FIND_PARENT );
......@@ -1157,6 +1164,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: f_updated andTime: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
......@@ -1170,6 +1178,7 @@ static VLCMain *_o_sharedMainInstance = nil;
i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" );
[o_volumeslider setFloatValue: (float)i_lastShownVolume / i_volume_step];
[o_volumeslider setEnabled: TRUE];
[[[self getControls] getFSPanel] setVolumeLevel: (float)i_lastShownVolume / i_volume_step];
p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 );
p_intf->p_sys->b_volume_update = FALSE;
}
......@@ -1398,6 +1407,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
if( i_status == PLAYING_S )
{
[[[self getControls] getFSPanel] setPause];
[o_btn_play setImage: o_img_pause];
[o_btn_play setAlternateImage: o_img_pause_pressed];
[o_btn_play setToolTip: _NS("Pause")];
......@@ -1407,6 +1417,7 @@ static VLCMain *_o_sharedMainInstance = nil;
}
else
{
[[[self getControls] getFSPanel] setPlay];
[o_btn_play setImage: o_img_play];
[o_btn_play setAlternateImage: o_img_play_pressed];
[o_btn_play setToolTip: _NS("Play")];
......@@ -1482,6 +1493,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: f_updated andTime: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
#undef p_input
......
/*****************************************************************************
* playlist.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -74,8 +74,6 @@
IBOutlet id o_playlist_view;
IBOutlet id o_status_field;
IBOutlet id o_search_field;
IBOutlet id o_random_ckb;
IBOutlet id o_loop_popup;
IBOutlet id o_mi_save_playlist;
IBOutlet id o_ctx_menu;
......@@ -119,7 +117,6 @@
- (void)searchfieldChanged:(NSNotification *)o_notification;
- (NSMenu *)menuForEvent:(NSEvent *)o_event;
- (IBAction)handlePopUp:(id)sender;
- (IBAction)searchItem:(id)sender;
- (void)playlistUpdated;
......
/*****************************************************************************
* playlist.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* Copyright (C) 2002-2006 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <hartman at videola/n dot org>
* Benjamin Pracht <bigben at videolab dot org>
* Felix Khne <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
......@@ -25,9 +26,6 @@
/* TODO
* add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
* create a new search field build with pictures from the 'regular' search field, so it can be emulated on 10.2
* create toggle buttons for the shuffle, repeat one, repeat all functions.
* implement drag and drop and item reordering.
* reimplement enable/disable item
* create a new 'tool' button (see the gear button in the Finder window) for 'actions'
(adding service discovery, other views, new node/playlist, save node/playlist) stuff like that
......@@ -44,14 +42,14 @@
#include <sys/mount.h>
#include <vlc_keys.h>
#include "intf.h"
#import "intf.h"
#import "wizard.h"
#import "bookmarks.h"
#import "playlistinfo.h"
#include "playlist.h"
#include "controls.h"
#include "vlc_osd.h"
#include "misc.h"
#import "playlist.h"
#import "controls.h"
#import "vlc_osd.h"
#import "misc.h"
/*****************************************************************************
* VLCPlaylistView implementation
......@@ -491,14 +489,10 @@
[o_status_field setStringValue: [NSString stringWithFormat:
_NS("No items in the playlist")]];
[o_random_ckb setTitle: _NS("Random")];
#if 0
[o_search_button setTitle: _NS("Search")];
#endif
[o_search_field setToolTip: _NS("Search in Playlist")];
[[o_loop_popup itemAtIndex:0] setTitle: _NS("Standard Play")];
[[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")];
[[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")];
[o_mi_addNode setTitle: _NS("Add Folder to Playlist")];
[o_save_accessory_text setStringValue: _NS("File Format:")];
......@@ -564,19 +558,18 @@
var_Get( p_playlist, "repeat", &val );
if( val.b_bool == VLC_TRUE )
{
[o_loop_popup selectItemAtIndex: 1];
[[[VLCMain sharedInstance] getControls] repeatOne];
}
else if( val2.b_bool == VLC_TRUE )
{
[o_loop_popup selectItemAtIndex: 2];
[[[VLCMain sharedInstance] getControls] repeatAll];
}
else
{
[o_loop_popup selectItemAtIndex: 0];
[[[VLCMain sharedInstance] getControls] repeatOff];
}
var_Get( p_playlist, "random", &val );
[o_random_ckb setState: val.b_bool];
[[[VLCMain sharedInstance] getControls] shuffle];
vlc_object_release( p_playlist );
}
......@@ -1221,53 +1214,6 @@
}
- (IBAction)handlePopUp:(id)sender
{
intf_thread_t * p_intf = VLCIntf;
vlc_value_t val1,val2;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
switch( [o_loop_popup indexOfSelectedItem] )
{
case 1:
val1.b_bool = 0;
var_Set( p_playlist, "loop", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "repeat", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
break;
case 2:
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
break;
default:
var_Get( p_playlist, "repeat", &val1 );
var_Get( p_playlist, "loop", &val2 );
if( val1.b_bool || val2.b_bool )
{
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
}
break;
}
vlc_object_release( p_playlist );
[self playlistUpdated];
}
- (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
{
playlist_t *p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
......
......@@ -40,7 +40,9 @@
#include <vlc_keys.h>
#include "intf.h"
#include "fspanel.h"
#include "vout.h"
#import "controls.h"
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
......@@ -376,6 +378,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Get( p_real_vout, "fullscreen", &val );
val.b_bool = !val.b_bool;
var_Set( p_real_vout, "fullscreen", val );
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self];
else
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderOut: self];
}
- (BOOL)isFullscreen
......@@ -605,6 +611,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val );
}
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] fadeIn];
}
[super mouseMoved: o_event];
......
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