-/*****************************************************************************\r
- * fspanel.h: MacOS X full screen panel\r
- *****************************************************************************\r
- * Copyright (C) 2006-2007 the VideoLAN team\r
- * $Id$\r
- *\r
- * Authors: Jérôme Decoodt <djc at videolan dot org>\r
- * Felix Kühne <fkuehne at videolan dot org>\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\r
- *****************************************************************************/\r
-\r
-@interface VLCFSPanel : NSWindow\r
-{\r
- NSTimer *fadeTimer,*hideAgainTimer;\r
- NSPoint mouseClic;\r
- BOOL b_fadeQueued;\r
- BOOL b_keptVisible;\r
- BOOL b_alreadyCounting;\r
- int i_timeToKeepVisibleInSec;\r
-\r
- BOOL b_nonActive;\r
- BOOL b_displayed;\r
- BOOL b_voutWasUpdated;\r
- int i_device;\r
-}\r
-- (id)initWithContentRect: (NSRect)contentRect\r
- styleMask: (NSUInteger)aStyle\r
- backing: (NSBackingStoreType)bufferingType\r
- defer: (BOOL)flag;\r
-- (void)awakeFromNib;\r
-- (BOOL)canBecomeKeyWindow;\r
-- (void)dealloc;\r
-\r
-- (void)setPlay;\r
-- (void)setPause;\r
-- (void)setStreamTitle: (NSString *)o_title;\r
-- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;\r
-- (void)setSeekable: (BOOL)b_seekable;\r
-- (void)setVolumeLevel: (float)f_volumeLevel;\r
-\r
-- (void)setNonActive: (id)noData;\r
-- (void)setActive: (id)noData;\r
-\r
-- (void)focus: (NSTimer *)timer;\r
-- (void)unfocus: (NSTimer *)timer;\r
-- (void)mouseExited: (NSEvent *)theEvent;\r
-\r
-- (void)fadeIn;\r
-- (void)fadeOut;\r
-\r
-- (NSTimer *)fadeTimer;\r
-- (void)setFadeTimer: (NSTimer *)timer;\r
-- (void)autoHide;\r
-- (void)keepVisible: (NSTimer *)timer;\r
-\r
-- (void)mouseDown: (NSEvent *)theEvent;\r
-- (void)mouseDragged: (NSEvent *)theEvent;\r
-\r
-- (BOOL)isDisplayed;\r
-- (void)setVoutWasUpdated: (int)i_screen;\r
-@end\r
-\r
-@interface VLCFSPanelView : NSView\r
-{\r
- NSColor *fillColor;\r
- NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen;\r
- NSTextField *o_streamTitle_txt, *o_streamPosition_txt;\r
- NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;\r
-}\r
-- (id)initWithFrame: (NSRect)frameRect;\r
-- (void)drawRect: (NSRect)rect;\r
-\r
-- (void)setPlay;\r
-- (void)setPause;\r
-- (void)setStreamTitle: (NSString *)o_title;\r
-- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time;\r
-- (void)setSeekable: (BOOL)b_seekable;\r
-- (void)setVolumeLevel: (float)f_volumeLevel;\r
-- (IBAction)play:(id)sender;\r
-- (IBAction)prev:(id)sender;\r
-- (IBAction)next:(id)sender;\r
-- (IBAction)forward:(id)sender;\r
-- (IBAction)backward:(id)sender;\r
-- (IBAction)fsTimeSliderUpdate: (id)sender;\r
-- (IBAction)fsVolumeSliderUpdate: (id)sender;\r
-\r
-@end\r
-\r
-@interface VLCFSTimeSlider : NSSlider\r
-{\r
-}\r
-- (void)drawKnobInRect: (NSRect)knobRect;\r
-- (void)drawRect: (NSRect)rect;\r
-\r
-@end\r
-\r
-@interface VLCFSVolumeSlider : NSSlider\r
-{\r
-}\r
-- (void)drawKnobInRect: (NSRect)knobRect;\r
-- (void)drawRect: (NSRect)rect;\r
-\r
-@end\r
+/*****************************************************************************
+ * fspanel.h: MacOS X full screen panel
+ *****************************************************************************
+ * Copyright (C) 2006-2011 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Jérôme Decoodt <djc at videolan dot org>
+ * Felix Paul 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.
+ *****************************************************************************/
+
+@interface VLCFSPanel : NSWindow
+{
+ NSTimer *fadeTimer,*hideAgainTimer;
+ NSPoint mouseClic;
+ BOOL b_fadeQueued;
+ BOOL b_keptVisible;
+ BOOL b_alreadyCounting;
+ int i_timeToKeepVisibleInSec;
+
+ BOOL b_nonActive;
+ BOOL b_displayed;
+ BOOL b_voutWasUpdated;
+ int i_device;
+
+ BOOL b_usingBigScreen;
+}
+- (id)initWithContentRect: (NSRect)contentRect
+ styleMask: (NSUInteger)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)setNonActive: (id)noData;
+- (void)setActive: (id)noData;
+
+- (void)focus: (NSTimer *)timer;
+- (void)unfocus: (NSTimer *)timer;
+- (void)mouseExited: (NSEvent *)theEvent;
+
+- (void)fadeIn;
+- (void)fadeOut;
+
+- (NSTimer *)fadeTimer;
+- (void)setFadeTimer: (NSTimer *)timer;
+- (void)autoHide;
+- (void)keepVisible: (NSTimer *)timer;
+
+- (void)mouseDown: (NSEvent *)theEvent;
+- (void)mouseDragged: (NSEvent *)theEvent;
+
+- (BOOL)isDisplayed;
+- (void)setVoutWasUpdated: (int)i_screen;
+- (void)adaptWindowSizeToScreen;
+@end
+
+@interface VLCFSPanelView : NSView
+{
+ NSColor *fillColor;
+ NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen;
+ NSTextField *o_streamTitle_txt, *o_streamPosition_txt;
+ NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
+
+ BOOL b_usingBigScreen;
+}
+- (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)forward:(id)sender;
+- (IBAction)backward:(id)sender;
+- (IBAction)fsTimeSliderUpdate: (id)sender;
+- (IBAction)fsVolumeSliderUpdate: (id)sender;
+- (void)adaptViewSizeToScreen: (BOOL)b_value;
+
+@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-2008 the VideoLAN team
+ * Copyright (C) 2006-2011 VLC authors and VideoLAN
* $Id$
*
* Authors: Jérôme Decoodt <djc at videolan dot org>
/* let the window sit on top of everything else and start out completely transparent */
[win setLevel:NSModalPanelWindowLevel];
i_device = 0;
- [win center];
hideAgainTimer = fadeTimer = nil;
[self setNonActive:nil];
return win;
[self mouseEntered:NULL];
if (!isInside)
[self mouseExited:NULL];
+
+ [self center];
/* get a notification if VLC isn't the active app anymore */
[[NSNotificationCenter defaultCenter]
}
theScreensFrame = [screen frame];
-
theWindowsFrame = [self frame];
+ if( theScreensFrame.size.width >= 1920 ) // 17" MBP, 24"/27" iMacs, external displays
+ b_usingBigScreen = YES;
+
+ if( (b_usingBigScreen && theWindowsFrame.size.width < 820) || (!b_usingBigScreen && theWindowsFrame.size.width > 550) )
+ [self adaptWindowSizeToScreen];
+
theCoordinate.x = (theScreensFrame.size.width - theWindowsFrame.size.width) / 2 + theScreensFrame.origin.x;
theCoordinate.y = (theScreensFrame.size.height / 3) - theWindowsFrame.size.height + theScreensFrame.origin.y;
[self setFrameTopLeftPoint: theCoordinate];
[self center];
}
}
+
+- (void)adaptWindowSizeToScreen
+{
+ NSRect theWindowsFrame = [self frame];
+ if( b_usingBigScreen )
+ {
+ theWindowsFrame.size.width = 824;
+ theWindowsFrame.size.height = 131;
+ }
+ else
+ {
+ theWindowsFrame.size.width = 549;
+ theWindowsFrame.size.height = 87;
+ }
+
+ [[self contentView] adaptViewSizeToScreen: b_usingBigScreen];
+
+ [self setFrame:theWindowsFrame display:YES animate:YES];
+}
@end
/*****************************************************************************
[o_button setAction: @selector(action:)]; \
[self addSubview:o_button];
-#define addTextfield( class, o_text, align, font, color, size ) \
+#define addTextfield( class, o_text, align, font, color ) \
o_text = [[class alloc] initWithFrame: s_rc]; \
[o_text setDrawsBackground: NO]; \
[o_text setBordered: 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]]; \
+ [o_text setFont:[NSFont font:[NSFont smallSystemFontSize]]]; \
[self addSubview:o_text];
+#define restyleButton( o_button, imageOff, imageOn, _x, _y ) \
+ [o_button setFrameOrigin: NSMakePoint( _x, _y )]; \
+ [o_button setImage: [NSImage imageNamed: imageOff]]; \
+ [o_button setAlternateImage: [NSImage imageNamed: imageOn]]; \
+ [o_button sizeToFit]; \
+ [o_button setNeedsDisplay: YES]
+
+#define restyleTextfieldOrSlider( o_field, _x, _y, _w, _h ) \
+ [o_field setFrameOrigin: NSMakePoint( _x, _y )]; \
+ [o_field setFrameSize: NSMakeSize( _w, _h )]; \
+ [o_field setNeedsDisplay: YES]
+
+
- (id)initWithFrame:(NSRect)frameRect
{
id view = [super initWithFrame:frameRect];
/* volume slider */
s_rc = [self frame];
s_rc.origin.x = 26;
- s_rc.origin.y = 18.5;
+ s_rc.origin.y = 20;
s_rc.size.width = 95;
s_rc.size.height = 10;
o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
s_rc.origin.y = 64;
s_rc.size.width = 352;
s_rc.size.height = 14;
- addTextfield( NSTextField, o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor, 0 );
+ addTextfield( NSTextField, o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor );
s_rc.origin.x = 481;
s_rc.origin.y = 64;
s_rc.size.width = 55;
- addTextfield( VLCTimeField, o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor, 0 );
+ addTextfield( VLCTimeField, o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor );
return view;
}
- (void)setPlay
{
- [o_play setImage:[NSImage imageNamed:@"fs_play"]];
- [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
+ if( b_usingBigScreen )
+ {
+ [o_play setImage:[NSImage imageNamed:@"fs_play@x1.5"]];
+ [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight@x1.5"]];
+ }
+ else
+ {
+ [o_play setImage:[NSImage imageNamed:@"fs_play"]];
+ [o_play setAlternateImage: [NSImage imageNamed:@"fs_play_highlight"]];
+ }
}
- (void)setPause
{
- [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
- [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
+ if( b_usingBigScreen )
+ {
+ [o_play setImage: [NSImage imageNamed:@"fs_pause@x1.5"]];
+ [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight@x1.5"]];
+ }
+ else
+ {
+ [o_play setImage: [NSImage imageNamed:@"fs_pause"]];
+ [o_play setAlternateImage: [NSImage imageNamed:@"fs_pause_highlight"]];
+ }
}
- (void)setStreamTitle:(NSString *)o_title
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);
+ if (b_usingBigScreen)
+ {
+ addImage( @"fs_background@x1.5", 0, 0, NSCompositeCopy, 0 );
+ addImage( @"fs_volume_slider_bar@x1.5", 39, 35.5, NSCompositeSourceOver, 0 );
+ addImage( @"fs_volume_mute@x1.5", 24, 27, NSCompositeSourceOver, 0 );
+ addImage( @"fs_volume_max@x1.5", 186, 27, NSCompositeSourceOver, 0 );
+ addImage( @"fs_time_slider@x1.5", 22.5, 79.5, NSCompositeSourceOver, 0);
+ }
+ else
+ {
+ addImage( @"fs_background", 0, 0, NSCompositeCopy, 0 );
+ addImage( @"fs_volume_slider_bar", 26, 23, NSCompositeSourceOver, 0 );
+ addImage( @"fs_volume_mute", 16, 18, NSCompositeSourceOver, 0 );
+ addImage( @"fs_volume_max", 124, 18, NSCompositeSourceOver, 0 );
+ addImage( @"fs_time_slider", 15, 53, NSCompositeSourceOver, 0);
+ }
+}
+
+- (void)adaptViewSizeToScreen:(BOOL)b_value
+{
+ b_usingBigScreen = b_value;
+
+ if (b_usingBigScreen)
+ {
+ restyleButton( o_prev, @"fs_skip_previous@x1.5", @"fs_skip_previous_highlight@x1.5", 261, 22.5 );
+ restyleButton( o_bwd, @"fs_rewind@x1.5", @"fs_rewind_highlight@x1.5", 316.5, 21 );
+ restyleButton( o_play, @"fs_play@x1.5", @"fs_play_highlight@x1.5", 400.5, 15 );
+ restyleButton( o_fwd, @"fs_forward@x1.5", @"fs_forward_highlight@x1.5", 469.5, 21 );
+ restyleButton( o_next, @"fs_skip_next@x1.5", @"fs_skip_next_highlight@x1.5", 547.5, 22.5 );
+ restyleButton( o_fullscreen, @"fs_exit_fullscreen@x1.5", @"fs_exit_fullscreen_hightlight@x1.5", 765.5, 19.5 );
+ restyleTextfieldOrSlider( o_streamTitle_txt, 148, 96, 528, 21 );
+ [o_streamTitle_txt setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
+ restyleTextfieldOrSlider( o_streamPosition_txt, 718, 96, 82.5, 21 );
+ [o_streamPosition_txt setFont:[NSFont systemFontOfSize:[NSFont systemFontSize]]];
+ restyleTextfieldOrSlider( o_fs_timeSlider, 22.5, 82.5, 777, 13.5 );
+ restyleTextfieldOrSlider( o_fs_volumeSlider, 39, 32, 142.5, 15);
+ }
+ else
+ {
+ restyleButton( o_prev, @"fs_skip_previous", @"fs_skip_previous_highlight", 174, 15 );
+ restyleButton( o_bwd, @"fs_rewind", @"fs_rewind_highlight", 211, 14 );
+ restyleButton( o_play, @"fs_play", @"fs_play_highlight", 267, 10 );
+ restyleButton( o_fwd, @"fs_forward", @"fs_forward_highlight", 313, 14 );
+ restyleButton( o_next, @"fs_skip_next", @"fs_skip_next_highlight", 365, 15 );
+ restyleButton( o_fullscreen, @"fs_exit_fullscreen", @"fs_exit_fullscreen_hightlight", 507, 13 );
+ restyleTextfieldOrSlider( o_streamTitle_txt, 98, 64, 352, 14 );
+ [o_streamTitle_txt setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ restyleTextfieldOrSlider( o_streamPosition_txt, 481, 64, 55, 14);
+ [o_streamPosition_txt setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ restyleTextfieldOrSlider( o_fs_timeSlider, 15, 55, 518, 9 );
+ restyleTextfieldOrSlider( o_fs_volumeSlider, 26, 20, 95, 10);
+ }
}
@end