/*****************************************************************************
* embeddedwindow.m: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2005-2008 the VideoLAN team
+ * Copyright (C) 2005-2011 the VideoLAN team
* $Id$
*
* Authors: Benjamin Pracht <bigben at videolan dot org>
#import "vout.h"
#import "embeddedwindow.h"
#import "fspanel.h"
+#import "CoreInteraction.h"
#import "playlist.h"
+#import <vlc_url.h>
/* SetSystemUIMode, ... */
#import <Carbon/Carbon.h>
o_img_play = [NSImage imageNamed: @"play_embedded"];
o_img_pause = [NSImage imageNamed: @"pause_embedded"];
- [self controlTintChanged];
- [[NSNotificationCenter defaultCenter] addObserver: self
- selector: @selector( controlTintChanged )
- name: NSControlTintDidChangeNotification
- object: nil];
-
/* Set color of sidebar to Leopard's "Sidebar Blue" */
[o_sidebar_list setBackgroundColor: [NSColor colorWithCalibratedRed:0.820
green:0.843
[self orderOut:self];
b_window_is_invisible = YES;
videoRatio = NSMakeSize( 0., 0. );
+
+ /* enlarge the time slider and move items around in case we have no window resize control */
+ if ([self showsResizeIndicator] == NO) {
+ NSRect view_rect;
+ view_rect = [o_backgroundimg_right frame];
+
+ [o_backgroundimg_right setFrame: NSMakeRect( view_rect.origin.x+15,
+ view_rect.origin.y,
+ view_rect.size.width,
+ view_rect.size.height )];
+
+ view_rect = [o_backgroundimg_middle frame];
+ [o_backgroundimg_middle setFrame: NSMakeRect( view_rect.origin.x,
+ view_rect.origin.y,
+ view_rect.size.width+15,
+ view_rect.size.height )];
+
+ view_rect = [o_timeslider frame];
+ [o_timeslider setFrame: NSMakeRect( view_rect.origin.x,
+ view_rect.origin.y,
+ view_rect.size.width+15,
+ view_rect.size.height )];
+
+ view_rect = [o_time frame];
+ [o_time setFrame: NSMakeRect( view_rect.origin.x+15,
+ view_rect.origin.y,
+ view_rect.size.width,
+ view_rect.size.height )];
+ }
+
+ /* we don't want this window to be restored on relaunch */
+ if ([self respondsToSelector:@selector(setRestorable:)])
+ [self setRestorable:NO];
}
- (void)controlTintChanged
- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize
{
- NSView *playlist_area = [[o_vertical_split subviews] objectAtIndex:1];
- NSRect newList = [playlist_area frame];
- if( newList.size.height < 50 && newList.size.height > 0 ) {
- [self togglePlaylist:self];
- }
-
- /* With no video open or with the playlist open the behavior is odd */
- if( newList.size.height > 50 )
- return proposedFrameSize;
-
if( videoRatio.height == 0. || videoRatio.width == 0. )
return proposedFrameSize;
- NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
- NSRect contentRect = [self contentRectForFrameRect:[self frame]];
- float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
- float marginx = contentRect.size.width - viewRect.size.width;
-
- proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
+ if( [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked] )
+ {
+ NSRect viewRect = [o_view convertRect:[o_view bounds] toView: nil];
+ NSRect contentRect = [self contentRectForFrameRect:[self frame]];
+ float marginy = viewRect.origin.y + [self frame].size.height - contentRect.size.height;
+ float marginx = contentRect.size.width - viewRect.size.width;
+ proposedFrameSize.height = (proposedFrameSize.width - marginx) * videoRatio.height / videoRatio.width + marginy;
+ }
return proposedFrameSize;
}
vout_thread_t *p_vout = getVout();
BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
- screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )];
+ if( p_vout )
+ screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_GetInteger( p_vout, "video-device" )];
[self lockFullscreenAnimation];
if (!screen)
{
- msg_Dbg( p_vout, "chosen screen isn't present, using current screen for fullscreen mode" );
+ msg_Dbg( VLCIntf, "chosen screen isn't present, using current screen for fullscreen mode" );
screen = [self screen];
}
if (!screen)
{
- msg_Dbg( p_vout, "Using deepest screen" );
+ msg_Dbg( VLCIntf, "Using deepest screen" );
screen = [NSScreen deepestScreen];
}
- vlc_object_release( p_vout );
+ if( p_vout )
+ vlc_object_release( p_vout );
screen_rect = [screen frame];
/* Only create the o_fullscreen_window if we are not in the middle of the zooming animation */
if (!o_fullscreen_window)
{
- /* We can't change the styleMask of an already created NSWindow, so we create an other window, and do eye catching stuff */
+ /* We can't change the styleMask of an already created NSWindow, so we create another window, and do eye catching stuff */
rect = [[o_view superview] convertRect: [o_view frame] toView: nil]; /* Convert to Window base coord */
rect.origin.x += [self frame].origin.x;
* simply fade the display */
CGDisplayFadeReservationToken token;
- CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
- CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+ if( blackout_other_displays )
+ {
+ CGAcquireDisplayFadeReservation( kCGMaxDisplayReservationInterval, &token );
+ CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+ }
if ([screen isMainScreen])
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
[o_fullscreen_window setFrame:screen_rect display:YES];
- CGDisplayFade( token, 0.3, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
- CGReleaseDisplayFadeReservation( token);
+ if( blackout_other_displays )
+ {
+ CGDisplayFade( token, 0.3, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
+ CGReleaseDisplayFadeReservation( token );
+ }
/* Will release the lock */
[self hasBecomeFullscreen];
{
NSMutableDictionary *dict1, *dict2;
NSRect frame;
+ BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
[self lockFullscreenAnimation];
* simply fade the display */
CGDisplayFadeReservationToken token;
- CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
- CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+ if( blackout_other_displays )
+ {
+ CGAcquireDisplayFadeReservation( kCGMaxDisplayReservationInterval, &token );
+ CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES );
+ }
[[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
* here */
b_window_is_invisible = YES;
- CGDisplayFade( token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
- CGReleaseDisplayFadeReservation( token);
+ if( blackout_other_displays )
+ {
+ CGDisplayFade( token, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO );
+ CGReleaseDisplayFadeReservation( token );
+ }
+
return;
}
for( i = 0; i < (int)[o_values count]; i++)
{
NSDictionary *o_dic;
- o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
+ char *psz_uri = make_URI([[o_values objectAtIndex:i] UTF8String], NULL);
+ if( !psz_uri )
+ continue;
+
+ o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
+ free( psz_uri );
+
o_array = [o_array arrayByAddingObject: o_dic];
}
if( b_autoplay )