1 /*****************************************************************************
2 * MainWindow.m: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2013 VLC authors and VideoLAN
7 * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
8 * Jon Lech Johansen <jon-vl@nanocrew.net>
9 * Christophe Massiot <massiot@via.ecp.fr>
10 * Derk-Jan Hartman <hartman at videolan.org>
11 * David Fuhrmann <david dot fuhrmann at googlemail dot com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
28 #import "CompatibilityFixes.h"
29 #import "MainWindow.h"
31 #import "CoreInteraction.h"
32 #import "AudioEffects.h"
35 #import "controls.h" // TODO: remove me
37 #import "SideBarItem.h"
39 #import <vlc_playlist.h>
41 #import <vlc_strings.h>
42 #import <vlc_services_discovery.h>
44 #import "ControlsBar.h"
46 #import "VLCVoutWindowController.h"
49 @interface VLCMainWindow (Internal)
50 - (void)resizePlaylistAfterCollapse;
51 - (void)makeSplitViewVisible;
52 - (void)makeSplitViewHidden;
53 - (void)showPodcastControls;
54 - (void)hidePodcastControls;
58 @implementation VLCMainWindow
60 @synthesize nativeFullscreenMode=b_nativeFullscreenMode;
61 @synthesize nonembedded=b_nonembedded;
62 @synthesize fsPanel=o_fspanel;
64 static VLCMainWindow *_o_sharedInstance = nil;
66 + (VLCMainWindow *)sharedInstance
68 return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
72 #pragma mark Initialization
76 if (_o_sharedInstance) {
78 return _o_sharedInstance;
80 _o_sharedInstance = [super init];
82 return _o_sharedInstance;
85 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
86 backing:(NSBackingStoreType)backingType defer:(BOOL)flag
88 self = [super initWithContentRect:contentRect styleMask:styleMask
89 backing:backingType defer:flag];
90 _o_sharedInstance = self;
92 [[VLCMain sharedInstance] updateTogglePlaylistState];
97 - (BOOL)isEvent:(NSEvent *)o_event forKey:(const char *)keyString
102 key = config_GetPsz(VLCIntf, keyString);
103 o_key = [NSString stringWithFormat:@"%s", key];
106 unsigned int i_keyModifiers = [[VLCStringUtility sharedInstance] VLCModifiersToCocoa:o_key];
108 NSString * characters = [o_event charactersIgnoringModifiers];
109 if ([characters length] > 0) {
110 return [[characters lowercaseString] isEqualToString: [[VLCStringUtility sharedInstance] VLCKeyToString: o_key]] &&
111 (i_keyModifiers & NSShiftKeyMask) == ([o_event modifierFlags] & NSShiftKeyMask) &&
112 (i_keyModifiers & NSControlKeyMask) == ([o_event modifierFlags] & NSControlKeyMask) &&
113 (i_keyModifiers & NSAlternateKeyMask) == ([o_event modifierFlags] & NSAlternateKeyMask) &&
114 (i_keyModifiers & NSCommandKeyMask) == ([o_event modifierFlags] & NSCommandKeyMask);
119 - (BOOL)performKeyEquivalent:(NSEvent *)o_event
122 // these are key events which should be handled by vlc core, but are attached to a main menu item
123 if (![self isEvent: o_event forKey: "key-vol-up"] &&
124 ![self isEvent: o_event forKey: "key-vol-down"] &&
125 ![self isEvent: o_event forKey: "key-vol-mute"]) {
126 /* We indeed want to prioritize some Cocoa key equivalent against libvlc,
127 so we perform the menu equivalent now. */
128 if ([[NSApp mainMenu] performKeyEquivalent:o_event])
134 return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event force:b_force] ||
135 [(VLCControls *)[[VLCMain sharedInstance] controls] keyEvent:o_event];
140 if (b_dark_interface)
141 [o_color_backdrop release];
143 [[NSNotificationCenter defaultCenter] removeObserver: self];
144 [o_sidebaritems release];
151 // sets lion fullscreen behaviour
152 [super awakeFromNib];
154 BOOL b_splitviewShouldBeHidden = NO;
156 /* setup the styled interface */
157 b_nativeFullscreenMode = NO;
158 #ifdef MAC_OS_X_VERSION_10_7
159 if (!OSX_SNOW_LEOPARD)
160 b_nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode");
162 [self useOptimizedDrawing: YES];
164 [[o_search_fld cell] setPlaceholderString: _NS("Search")];
165 [[o_search_fld cell] accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.") forAttribute:NSAccessibilityDescriptionAttribute];
167 [o_dropzone_btn setTitle: _NS("Open media...")];
168 [[o_dropzone_btn cell] accessibilitySetOverrideValue:_NS("Click to open an advanced dialog to select the media to play. You can also drop files here to play.") forAttribute:NSAccessibilityDescriptionAttribute];
169 [o_dropzone_lbl setStringValue: _NS("Drop media here")];
171 [o_podcast_add_btn setTitle: _NS("Subscribe")];
172 [o_podcast_remove_btn setTitle: _NS("Unsubscribe")];
173 [o_podcast_subscribe_title_lbl setStringValue: _NS("Subscribe to a podcast")];
174 [o_podcast_subscribe_subtitle_lbl setStringValue: _NS("Enter URL of the podcast to subscribe to:")];
175 [o_podcast_subscribe_cancel_btn setTitle: _NS("Cancel")];
176 [o_podcast_subscribe_ok_btn setTitle: _NS("Subscribe")];
177 [o_podcast_unsubscribe_title_lbl setStringValue: _NS("Unsubscribe from a podcast")];
178 [o_podcast_unsubscribe_subtitle_lbl setStringValue: _NS("Select the podcast you would like to unsubscribe from:")];
179 [o_podcast_unsubscribe_ok_btn setTitle: _NS("Unsubscribe")];
180 [o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")];
182 /* interface builder action */
183 float f_threshold_height = f_min_video_height + [[o_controls_bar bottomBarView] frame].size.height;
184 if (b_dark_interface)
185 f_threshold_height += [o_titlebar_view frame].size.height;
186 if ([[self contentView] frame].size.height < f_threshold_height)
187 b_splitviewShouldBeHidden = YES;
189 [self setDelegate: self];
190 [self setExcludedFromWindowsMenu: YES];
191 [self setAcceptsMouseMovedEvents: YES];
192 // Set that here as IB seems to be buggy
193 if (b_dark_interface)
194 [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
196 [self setContentMinSize:NSMakeSize(604., 288.)];
198 [self setTitle: _NS("VLC media player")];
200 b_dropzone_active = YES;
201 [o_dropzone_view setFrame: [o_playlist_table frame]];
202 [o_left_split_view setFrame: [o_sidebar_view frame]];
204 if (!OSX_SNOW_LEOPARD) {
205 /* the default small size of the search field is slightly different on Lion, let's work-around that */
207 frame = [o_search_fld frame];
208 frame.origin.y = frame.origin.y + 2.0;
209 frame.size.height = frame.size.height - 1.0;
210 [o_search_fld setFrame: frame];
213 /* create the sidebar */
214 o_sidebaritems = [[NSMutableArray alloc] init];
215 SideBarItem *libraryItem = [SideBarItem itemWithTitle:_NS("LIBRARY") identifier:@"library"];
216 SideBarItem *playlistItem = [SideBarItem itemWithTitle:_NS("Playlist") identifier:@"playlist"];
217 [playlistItem setIcon: [NSImage imageNamed:@"sidebar-playlist"]];
218 SideBarItem *medialibraryItem = [SideBarItem itemWithTitle:_NS("Media Library") identifier:@"medialibrary"];
219 [medialibraryItem setIcon: [NSImage imageNamed:@"sidebar-playlist"]];
220 SideBarItem *mycompItem = [SideBarItem itemWithTitle:_NS("MY COMPUTER") identifier:@"mycomputer"];
221 SideBarItem *devicesItem = [SideBarItem itemWithTitle:_NS("DEVICES") identifier:@"devices"];
222 SideBarItem *lanItem = [SideBarItem itemWithTitle:_NS("LOCAL NETWORK") identifier:@"localnetwork"];
223 SideBarItem *internetItem = [SideBarItem itemWithTitle:_NS("INTERNET") identifier:@"internet"];
225 /* SD subnodes, inspired by the Qt4 intf */
226 char **ppsz_longnames;
228 char **ppsz_names = vlc_sd_GetNames(pl_Get(VLCIntf), &ppsz_longnames, &p_categories);
230 msg_Err(VLCIntf, "no sd item found"); //TODO
231 char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
232 int *p_category = p_categories;
233 NSMutableArray *internetItems = [[NSMutableArray alloc] init];
234 NSMutableArray *devicesItems = [[NSMutableArray alloc] init];
235 NSMutableArray *lanItems = [[NSMutableArray alloc] init];
236 NSMutableArray *mycompItems = [[NSMutableArray alloc] init];
237 NSString *o_identifier;
238 for (; *ppsz_name; ppsz_name++, ppsz_longname++, p_category++) {
239 o_identifier = [NSString stringWithCString: *ppsz_name encoding: NSUTF8StringEncoding];
240 switch (*p_category) {
241 case SD_CAT_INTERNET:
242 [internetItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
243 if (!strncmp(*ppsz_name, "podcast", 7))
244 [[internetItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-podcast"]];
246 [[internetItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
247 [[internetItems lastObject] setSdtype: SD_CAT_INTERNET];
248 [[internetItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
251 [devicesItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
252 [[devicesItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
253 [[devicesItems lastObject] setSdtype: SD_CAT_DEVICES];
254 [[devicesItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
257 [lanItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
258 [[lanItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-local"]];
259 [[lanItems lastObject] setSdtype: SD_CAT_LAN];
260 [[lanItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
262 case SD_CAT_MYCOMPUTER:
263 [mycompItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
264 if (!strncmp(*ppsz_name, "video_dir", 9))
265 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-movie"]];
266 else if (!strncmp(*ppsz_name, "audio_dir", 9))
267 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-music"]];
268 else if (!strncmp(*ppsz_name, "picture_dir", 11))
269 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-pictures"]];
271 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
272 [[mycompItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String: *ppsz_longname]];
273 [[mycompItems lastObject] setSdtype: SD_CAT_MYCOMPUTER];
276 msg_Warn(VLCIntf, "unknown SD type found, skipping (%s)", *ppsz_name);
281 free(*ppsz_longname);
283 [mycompItem setChildren: [NSArray arrayWithArray: mycompItems]];
284 [devicesItem setChildren: [NSArray arrayWithArray: devicesItems]];
285 [lanItem setChildren: [NSArray arrayWithArray: lanItems]];
286 [internetItem setChildren: [NSArray arrayWithArray: internetItems]];
287 [mycompItems release];
288 [devicesItems release];
290 [internetItems release];
292 free(ppsz_longnames);
295 [libraryItem setChildren: [NSArray arrayWithObjects: playlistItem, medialibraryItem, nil]];
296 [o_sidebaritems addObject: libraryItem];
297 if ([mycompItem hasChildren])
298 [o_sidebaritems addObject: mycompItem];
299 if ([devicesItem hasChildren])
300 [o_sidebaritems addObject: devicesItem];
301 if ([lanItem hasChildren])
302 [o_sidebaritems addObject: lanItem];
303 if ([internetItem hasChildren])
304 [o_sidebaritems addObject: internetItem];
306 [o_sidebar_view reloadData];
307 [o_sidebar_view selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
308 [o_sidebar_view setDropItem:playlistItem dropChildIndex:NSOutlineViewDropOnItemIndex];
309 [o_sidebar_view registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
311 [o_sidebar_view setAutosaveName:@"mainwindow-sidebar"];
312 [(PXSourceList *)o_sidebar_view setDataSource:self];
313 [o_sidebar_view setDelegate:self];
314 [o_sidebar_view setAutosaveExpandedItems:YES];
316 [o_sidebar_view expandItem: libraryItem expandChildren: YES];
318 /* make sure we display the desired default appearance when VLC launches for the first time */
319 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
320 if (![defaults objectForKey:@"VLCFirstRun"]) {
321 [defaults setObject:[NSDate date] forKey:@"VLCFirstRun"];
323 NSUInteger i_sidebaritem_count = [o_sidebaritems count];
324 for (NSUInteger x = 0; x < i_sidebaritem_count; x++)
325 [o_sidebar_view expandItem: [o_sidebaritems objectAtIndex: x] expandChildren: YES];
330 if (b_dark_interface) {
331 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidResizeNotification object: nil];
332 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidMoveNotification object: nil];
334 [self setBackgroundColor: [NSColor clearColor]];
335 [self setOpaque: NO];
337 [self setHasShadow:NO];
338 [self setHasShadow:YES];
340 NSRect winrect = [self frame];
341 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
343 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
344 winrect.size.width, f_titleBarHeight)];
345 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: o_split_view];
347 if (winrect.size.height > 100) {
348 [self setFrame: winrect display:YES animate:YES];
349 previousSavedFrame = winrect;
352 winrect = [o_split_view frame];
353 winrect.size.height = winrect.size.height - f_titleBarHeight;
354 [o_split_view setFrame: winrect];
355 [o_video_view setFrame: winrect];
357 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
358 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
359 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
361 [o_video_view setFrame: [o_split_view frame]];
362 [o_playlist_table setBorderType: NSNoBorder];
363 [o_sidebar_scrollview setBorderType: NSNoBorder];
366 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
367 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
368 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
369 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:o_split_view];
371 if (b_splitviewShouldBeHidden) {
372 [self hideSplitView];
373 i_lastSplitViewHeight = 300;
376 /* sanity check for the window size */
377 NSRect frame = [self frame];
378 NSSize screenSize = [[self screen] frame].size;
379 if (screenSize.width <= frame.size.width || screenSize.height <= frame.size.height) {
380 nativeVideoSize = screenSize;
384 /* update fs button to reflect state for next startup */
385 if (var_InheritBool(pl_Get(VLCIntf), "fullscreen"))
386 [o_controls_bar setFullscreenState:YES];
388 /* restore split view */
389 i_lastLeftSplitViewWidth = 200;
390 /* trick NSSplitView implementation, which pretends to know better than us */
391 if (!config_GetInt(VLCIntf, "macosx-show-sidebar"))
392 [self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
396 #pragma mark appearance management
398 - (VLCMainWindowControlsBar *)controlsBar;
400 return (VLCMainWindowControlsBar *)o_controls_bar;
403 - (void)resizePlaylistAfterCollapse
406 plrect = [o_playlist_table frame];
407 plrect.size.height = i_lastSplitViewHeight - 20.0; // actual pl top bar height, which differs from its frame
408 [[o_playlist_table animator] setFrame: plrect];
410 NSRect rightSplitRect;
411 rightSplitRect = [o_right_split_view frame];
412 plrect = [o_dropzone_box frame];
413 plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2;
414 plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2;
415 [[o_dropzone_box animator] setFrame: plrect];
418 - (void)makeSplitViewVisible
420 if (b_dark_interface)
421 [self setContentMinSize: NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
423 [self setContentMinSize: NSMakeSize(604., 288.)];
425 NSRect old_frame = [self frame];
426 float newHeight = [self minSize].height;
427 if (old_frame.size.height < newHeight) {
428 NSRect new_frame = old_frame;
429 new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
430 new_frame.size.height = newHeight;
432 [[self animator] setFrame: new_frame display: YES animate: YES];
435 [o_video_view setHidden: YES];
436 [o_split_view setHidden: NO];
437 [self makeFirstResponder: nil];
441 - (void)makeSplitViewHidden
443 if (b_dark_interface)
444 [self setContentMinSize: NSMakeSize(604., f_min_video_height + [o_titlebar_view frame].size.height)];
446 [self setContentMinSize: NSMakeSize(604., f_min_video_height)];
448 [o_split_view setHidden: YES];
449 [o_video_view setHidden: NO];
451 if ([[o_video_view subviews] count] > 0)
452 [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
455 // only exception for an controls bar button action
456 - (IBAction)togglePlaylist:(id)sender
458 if (![self isVisible] && sender != nil) {
459 [self makeKeyAndOrderFront: sender];
463 BOOL b_activeVideo = [[VLCMain sharedInstance] activeVideoPlayback];
464 BOOL b_restored = NO;
466 // TODO: implement toggle playlist in this situation (triggerd via menu item).
467 // but for now we block this case, to avoid displaying only the half
468 if (b_nativeFullscreenMode && b_fullscreen && b_activeVideo && sender != nil)
471 if (b_dropzone_active && ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) {
476 if (!(b_nativeFullscreenMode && b_fullscreen) && !b_splitview_removed && ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0 && b_activeVideo)
477 || (b_nonembedded && sender != nil)
478 || (!b_activeVideo && sender != nil)
479 || b_minimized_view))
480 [self hideSplitView];
482 if (b_splitview_removed) {
483 if (!b_nonembedded || (sender != nil && b_nonembedded))
484 [self showSplitView];
487 b_minimized_view = YES;
489 b_minimized_view = NO;
495 if (!b_nonembedded) {
496 if (([o_video_view isHidden] && b_activeVideo) || b_restored || (b_activeVideo && sender == nil))
497 [self makeSplitViewHidden];
499 [self makeSplitViewVisible];
501 [o_split_view setHidden: NO];
502 [o_playlist_table setHidden: NO];
503 [o_video_view setHidden: YES];
508 - (IBAction)dropzoneButtonAction:(id)sender
510 [[[VLCMain sharedInstance] open] openFileGeneric];
514 #pragma mark overwritten default functionality
516 - (void)windowResizedOrMoved:(NSNotification *)notification
518 [self saveFrameUsingName: [self frameAutosaveName]];
521 - (void)applicationWillTerminate:(NSNotification *)notification
523 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
525 [self saveFrameUsingName: [self frameAutosaveName]];
529 - (void)someWindowWillClose:(NSNotification *)notification
531 id obj = [notification object];
533 // hasActiveVideo is defined for VLCVideoWindowCommon and subclasses
534 if ([obj respondsToSelector:@selector(hasActiveVideo)] && [obj hasActiveVideo]) {
535 if ([[VLCMain sharedInstance] activeVideoPlayback])
536 [[VLCCoreInteraction sharedInstance] stop];
540 - (void)someWindowWillMiniaturize:(NSNotification *)notification
542 if (config_GetInt(VLCIntf, "macosx-pause-minimized")) {
543 id obj = [notification object];
545 if ([obj class] == [VLCVideoWindowCommon class] || [obj class] == [VLCDetachedVideoWindow class] || ([obj class] == [VLCMainWindow class] && !b_nonembedded)) {
546 if ([[VLCMain sharedInstance] activeVideoPlayback])
547 [[VLCCoreInteraction sharedInstance] pause];
553 #pragma mark Update interface and respond to foreign events
556 b_dropzone_active = YES;
557 [o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
558 [o_dropzone_view setFrame: [o_playlist_table frame]];
559 [[o_playlist_table animator] setHidden:YES];
564 b_dropzone_active = NO;
565 [o_dropzone_view removeFromSuperview];
566 [[o_playlist_table animator] setHidden: NO];
569 - (void)hideSplitView
571 NSRect winrect = [self frame];
572 i_lastSplitViewHeight = [o_split_view frame].size.height;
573 winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
574 winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
575 [self setFrame: winrect display: YES animate: YES];
576 [self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
577 if (b_dark_interface) {
578 [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
579 [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
581 [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height)];
582 [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height)];
585 b_splitview_removed = YES;
588 - (void)showSplitView
591 if (b_dark_interface)
592 [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
594 [self setContentMinSize:NSMakeSize(604., 288.)];
595 [self setContentMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)];
598 winrect = [self frame];
599 winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
600 winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
601 [self setFrame: winrect display: YES animate: YES];
603 [self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
605 b_splitview_removed = NO;
608 - (void)updateTimeSlider
610 [o_controls_bar updateTimeSlider];
611 [o_fspanel updatePositionAndTime];
613 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
618 input_thread_t * p_input;
619 p_input = pl_CurrentInput(VLCIntf);
622 char *format = var_InheritString(VLCIntf, "input-title-format");
623 char *formated = str_format_meta(pl_Get(VLCIntf), format);
625 aString = [NSString stringWithUTF8String:formated];
628 char *uri = input_item_GetURI(input_GetItem(p_input));
630 NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: uri]];
631 if ([o_url isFileURL]) {
632 [self setRepresentedURL: o_url];
633 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
634 [o_window setRepresentedURL:o_url];
637 [self setRepresentedURL: nil];
638 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
639 [o_window setRepresentedURL:nil];
644 if ([aString isEqualToString:@""]) {
645 if ([o_url isFileURL])
646 aString = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
648 aString = [o_url absoluteString];
651 if ([aString length] > 0) {
652 [self setTitle: aString];
653 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
654 [o_window setTitle:aString];
657 [o_fspanel setStreamTitle: aString];
659 [self setTitle: _NS("VLC media player")];
660 [self setRepresentedURL: nil];
663 vlc_object_release(p_input);
665 [self setTitle: _NS("VLC media player")];
666 [self setRepresentedURL: nil];
672 [o_controls_bar updateControls];
673 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateControls)];
675 bool b_seekable = false;
677 playlist_t * p_playlist = pl_Get(VLCIntf);
678 input_thread_t * p_input = playlist_CurrentInput(p_playlist);
680 /* seekable streams */
681 b_seekable = var_GetBool(p_input, "can-seek");
683 vlc_object_release(p_input);
686 [self updateTimeSlider];
687 if ([o_fspanel respondsToSelector:@selector(setSeekable:)])
688 [o_fspanel setSeekable: b_seekable];
691 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
696 [o_sidebar_view setNeedsDisplay:YES];
701 [o_controls_bar setPause];
702 [o_fspanel setPause];
704 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPause)];
709 [o_controls_bar setPlay];
712 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPlay)];
716 - (void)updateVolumeSlider
718 [[self controlsBar] updateVolumeSlider];
719 [o_fspanel setVolumeLevel: [[VLCCoreInteraction sharedInstance] volume]];
723 #pragma mark Video Output handling
725 - (void)setVideoplayEnabled
727 BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback];
729 if (b_videoPlayback) {
731 frameBeforePlayback = [self frame];
733 if (!b_nonembedded && !b_fullscreen && frameBeforePlayback.size.width > 0 && frameBeforePlayback.size.height > 0)
734 [[self animator] setFrame:frameBeforePlayback display:YES];
736 // update fs button to reflect state for next startup
737 if (var_InheritBool(pl_Get(VLCIntf), "fullscreen")) {
738 [o_controls_bar setFullscreenState:YES];
741 [self makeFirstResponder: nil];
742 [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
744 // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
745 [self setAlphaValue:1.0];
748 if (b_nativeFullscreenMode) {
749 if ([self hasActiveVideo] && [self fullscreen]) {
750 [[o_controls_bar bottomBarView] setHidden: b_videoPlayback];
751 [o_fspanel setActive: nil];
753 [[o_controls_bar bottomBarView] setHidden: NO];
754 [o_fspanel setNonActive: nil];
760 #pragma mark Lion native fullscreen handling
761 - (void)windowWillEnterFullScreen:(NSNotification *)notification
763 [super windowWillEnterFullScreen:notification];
765 // update split view frame after removing title bar
766 [o_split_view setFrame: [o_video_view frame]];
769 - (void)windowWillExitFullScreen:(NSNotification *)notification
771 [super windowWillExitFullScreen: notification];
773 // update split view frame after readding title bar
774 [o_split_view setFrame: [o_video_view frame]];
777 #pragma mark Fullscreen support
779 - (void)showFullscreenController
782 id currentWindow = [NSApp keyWindow];
783 if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
784 if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen]) {
786 if ([[VLCMain sharedInstance] activeVideoPlayback])
795 - (void)makeKeyAndOrderFront: (id)sender
798 * when we exit fullscreen and fade out, we may endup in
799 * having a window that is faded. We can't have it fade in unless we
802 if (!b_window_is_invisible) {
803 /* Make sure we don't do it too much */
804 [super makeKeyAndOrderFront: sender];
808 [super setAlphaValue:0.0f];
809 [super makeKeyAndOrderFront: sender];
811 NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:2];
812 [dict setObject:self forKey:NSViewAnimationTargetKey];
813 [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
815 o_makekey_anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]];
818 [o_makekey_anim setAnimationBlockingMode: NSAnimationNonblocking];
819 [o_makekey_anim setDuration: 0.1];
820 [o_makekey_anim setFrameRate: 30];
821 [o_makekey_anim setDelegate: self];
823 [o_makekey_anim startAnimation];
824 b_window_is_invisible = NO;
826 /* fullscreenAnimation will be unlocked when animation ends */
830 #pragma mark split view delegate
831 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
833 if (dividerIndex == 0)
839 - (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
841 if (dividerIndex == 0)
847 - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
849 return ([subview isEqual:o_left_split_view]);
852 - (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
854 if ([subview isEqual:o_left_split_view])
859 - (void)mainSplitViewDidResizeSubviews:(id)object
861 i_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
862 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
863 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
866 - (void)toggleLeftSubSplitView
868 [o_split_view adjustSubviews];
869 if ([o_split_view isSubviewCollapsed:o_left_split_view])
870 [o_split_view setPosition:i_lastLeftSplitViewWidth ofDividerAtIndex:0];
872 [o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
873 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
877 #pragma mark Side Bar Data handling
878 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
879 - (NSUInteger)sourceList:(PXSourceList*)sourceList numberOfChildrenOfItem:(id)item
881 //Works the same way as the NSOutlineView data source: `nil` means a parent item
883 return [o_sidebaritems count];
885 return [[item children] count];
889 - (id)sourceList:(PXSourceList*)aSourceList child:(NSUInteger)index ofItem:(id)item
891 //Works the same way as the NSOutlineView data source: `nil` means a parent item
893 return [o_sidebaritems objectAtIndex:index];
895 return [[item children] objectAtIndex:index];
899 - (id)sourceList:(PXSourceList*)aSourceList objectValueForItem:(id)item
904 - (void)sourceList:(PXSourceList*)aSourceList setObjectValue:(id)object forItem:(id)item
906 [item setTitle:object];
909 - (BOOL)sourceList:(PXSourceList*)aSourceList isItemExpandable:(id)item
911 return [item hasChildren];
915 - (BOOL)sourceList:(PXSourceList*)aSourceList itemHasBadge:(id)item
917 if ([[item identifier] isEqualToString: @"playlist"] || [[item identifier] isEqualToString: @"medialibrary"])
920 return [item hasBadge];
924 - (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item
926 playlist_t * p_playlist = pl_Get(VLCIntf);
927 NSInteger i_playlist_size;
929 if ([[item identifier] isEqualToString: @"playlist"]) {
931 i_playlist_size = p_playlist->p_local_category->i_children;
934 return i_playlist_size;
936 if ([[item identifier] isEqualToString: @"medialibrary"]) {
938 i_playlist_size = p_playlist->p_ml_category->i_children;
941 return i_playlist_size;
944 return [item badgeValue];
948 - (BOOL)sourceList:(PXSourceList*)aSourceList itemHasIcon:(id)item
950 return [item hasIcon];
954 - (NSImage*)sourceList:(PXSourceList*)aSourceList iconForItem:(id)item
959 - (NSMenu*)sourceList:(PXSourceList*)aSourceList menuForEvent:(NSEvent*)theEvent item:(id)item
961 if ([theEvent type] == NSRightMouseDown || ([theEvent type] == NSLeftMouseDown && ([theEvent modifierFlags] & NSControlKeyMask) == NSControlKeyMask)) {
964 if ([item sdtype] > 0)
966 m = [[NSMenu alloc] init];
967 playlist_t * p_playlist = pl_Get(VLCIntf);
968 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [[item identifier] UTF8String]);
970 [m addItemWithTitle:_NS("Enable") action:@selector(sdmenuhandler:) keyEquivalent:@""];
972 [m addItemWithTitle:_NS("Disable") action:@selector(sdmenuhandler:) keyEquivalent:@""];
973 [[m itemAtIndex:0] setRepresentedObject: [item identifier]];
975 return [m autorelease];
982 - (IBAction)sdmenuhandler:(id)sender
984 NSString * identifier = [sender representedObject];
985 if ([identifier length] > 0 && ![identifier isEqualToString:@"lua{sd='freebox',longname='Freebox TV'}"]) {
986 playlist_t * p_playlist = pl_Get(VLCIntf);
987 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [identifier UTF8String]);
990 playlist_ServicesDiscoveryAdd(p_playlist, [identifier UTF8String]);
992 playlist_ServicesDiscoveryRemove(p_playlist, [identifier UTF8String]);
997 #pragma mark Side Bar Delegate Methods
998 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
999 - (BOOL)sourceList:(PXSourceList*)aSourceList isGroupAlwaysExpanded:(id)group
1001 if ([[group identifier] isEqualToString:@"library"])
1007 - (void)sourceListSelectionDidChange:(NSNotification *)notification
1009 playlist_t * p_playlist = pl_Get(VLCIntf);
1011 NSIndexSet *selectedIndexes = [o_sidebar_view selectedRowIndexes];
1012 id item = [o_sidebar_view itemAtRow:[selectedIndexes firstIndex]];
1015 //Set the label text to represent the new selection
1016 if ([item sdtype] > -1 && [[item identifier] length] > 0) {
1017 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [[item identifier] UTF8String]);
1019 playlist_ServicesDiscoveryAdd(p_playlist, [[item identifier] UTF8String]);
1022 [o_chosen_category_lbl setStringValue:[item title]];
1024 if ([[item identifier] isEqualToString:@"playlist"]) {
1025 [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_local_category];
1026 } else if ([[item identifier] isEqualToString:@"medialibrary"]) {
1027 [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_ml_category];
1029 playlist_item_t * pl_item;
1031 pl_item = playlist_ChildSearchName(p_playlist->p_root, [[item untranslatedTitle] UTF8String]);
1033 [[[VLCMain sharedInstance] playlist] setPlaylistRoot: pl_item];
1037 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
1038 [self hideDropZone];
1040 [self showDropZone];
1043 if ([[item identifier] isEqualToString:@"podcast{longname=\"Podcasts\"}"])
1044 [self showPodcastControls];
1046 [self hidePodcastControls];
1049 - (NSDragOperation)sourceList:(PXSourceList *)aSourceList validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
1051 if ([[item identifier] isEqualToString:@"playlist"] || [[item identifier] isEqualToString:@"medialibrary"]) {
1052 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1053 if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] || [[o_pasteboard types] containsObject: NSFilenamesPboardType])
1054 return NSDragOperationGeneric;
1056 return NSDragOperationNone;
1059 - (BOOL)sourceList:(PXSourceList *)aSourceList acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
1061 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1063 playlist_t * p_playlist = pl_Get(VLCIntf);
1064 playlist_item_t *p_node;
1066 if ([[item identifier] isEqualToString:@"playlist"])
1067 p_node = p_playlist->p_local_category;
1069 p_node = p_playlist->p_ml_category;
1071 if ([[o_pasteboard types] containsObject: NSFilenamesPboardType]) {
1072 NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
1073 NSUInteger count = [o_values count];
1074 NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
1076 for(NSUInteger i = 0; i < count; i++) {
1077 NSDictionary *o_dic;
1078 char *psz_uri = vlc_path2uri([[o_values objectAtIndex:i] UTF8String], NULL);
1082 o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
1086 [o_array addObject: o_dic];
1089 [[[VLCMain sharedInstance] playlist] appendNodeArray:o_array inNode: p_node atPos:-1 enqueue:YES];
1092 else if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"]) {
1093 NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
1095 NSUInteger count = [array count];
1096 playlist_item_t * p_item = NULL;
1099 for(NSUInteger i = 0; i < count; i++) {
1100 p_item = [[array objectAtIndex:i] pointerValue];
1101 if (!p_item) continue;
1102 playlist_NodeAddCopy(p_playlist, p_item, p_node, PLAYLIST_END);
1111 - (id)sourceList:(PXSourceList *)aSourceList persistentObjectForItem:(id)item
1113 return [item identifier];
1116 - (id)sourceList:(PXSourceList *)aSourceList itemForPersistentObject:(id)object
1118 /* the following code assumes for sakes of simplicity that only the top level
1119 * items are allowed to have children */
1121 NSArray * array = [NSArray arrayWithArray: o_sidebaritems]; // read-only arrays are noticebly faster
1122 NSUInteger count = [array count];
1126 for (NSUInteger x = 0; x < count; x++) {
1127 id item = [array objectAtIndex: x]; // save one objc selector call
1128 if ([[item identifier] isEqualToString:object])
1136 #pragma mark Podcast
1138 - (IBAction)addPodcast:(id)sender
1140 [NSApp beginSheet:o_podcast_subscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
1143 - (IBAction)addPodcastWindowAction:(id)sender
1145 [o_podcast_subscribe_window orderOut:sender];
1146 [NSApp endSheet: o_podcast_subscribe_window];
1148 if (sender == o_podcast_subscribe_ok_btn && [[o_podcast_subscribe_url_fld stringValue] length] > 0) {
1149 NSMutableString * podcastConf = [[NSMutableString alloc] init];
1150 if (config_GetPsz(VLCIntf, "podcast-urls") != NULL)
1151 [podcastConf appendFormat:@"%s|", config_GetPsz(VLCIntf, "podcast-urls")];
1153 [podcastConf appendString: [o_podcast_subscribe_url_fld stringValue]];
1154 config_PutPsz(VLCIntf, "podcast-urls", [podcastConf UTF8String]);
1156 vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name(VLCIntf->p_libvlc, "podcast");
1158 var_SetString(p_obj, "podcast-urls", [podcastConf UTF8String]);
1159 vlc_object_release(p_obj);
1161 [podcastConf release];
1165 - (IBAction)removePodcast:(id)sender
1167 if (config_GetPsz(VLCIntf, "podcast-urls") != NULL) {
1168 [o_podcast_unsubscribe_pop removeAllItems];
1169 [o_podcast_unsubscribe_pop addItemsWithTitles:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
1170 [NSApp beginSheet:o_podcast_unsubscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
1174 - (IBAction)removePodcastWindowAction:(id)sender
1176 [o_podcast_unsubscribe_window orderOut:sender];
1177 [NSApp endSheet: o_podcast_unsubscribe_window];
1179 if (sender == o_podcast_unsubscribe_ok_btn) {
1180 NSMutableArray * urls = [[NSMutableArray alloc] initWithArray:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
1181 [urls removeObjectAtIndex: [o_podcast_unsubscribe_pop indexOfSelectedItem]];
1182 config_PutPsz(VLCIntf, "podcast-urls", [[urls componentsJoinedByString:@"|"] UTF8String]);
1185 vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name(VLCIntf->p_libvlc, "podcast");
1187 var_SetString(p_obj, "podcast-urls", config_GetPsz(VLCIntf, "podcast-urls"));
1188 vlc_object_release(p_obj);
1191 /* reload the podcast module, since it won't update its list when removing podcasts */
1192 playlist_t * p_playlist = pl_Get(VLCIntf);
1193 if (playlist_IsServicesDiscoveryLoaded(p_playlist, "podcast{longname=\"Podcasts\"}")) {
1194 playlist_ServicesDiscoveryRemove(p_playlist, "podcast{longname=\"Podcasts\"}");
1195 playlist_ServicesDiscoveryAdd(p_playlist, "podcast{longname=\"Podcasts\"}");
1196 [o_playlist_table reloadData];
1202 - (void)showPodcastControls
1204 NSRect podcastViewDimensions = [o_podcast_view frame];
1205 NSRect rightSplitRect = [o_right_split_view frame];
1206 NSRect playlistTableRect = [o_playlist_table frame];
1208 podcastViewDimensions.size.width = rightSplitRect.size.width;
1209 podcastViewDimensions.origin.x = podcastViewDimensions.origin.y = .0;
1210 [o_podcast_view setFrame:podcastViewDimensions];
1212 playlistTableRect.origin.y = playlistTableRect.origin.y + podcastViewDimensions.size.height;
1213 playlistTableRect.size.height = playlistTableRect.size.height - podcastViewDimensions.size.height;
1214 [o_playlist_table setFrame:playlistTableRect];
1215 [o_playlist_table setNeedsDisplay:YES];
1217 [o_right_split_view addSubview: o_podcast_view positioned: NSWindowAbove relativeTo: o_right_split_view];
1218 b_podcastView_displayed = YES;
1221 - (void)hidePodcastControls
1223 if (b_podcastView_displayed) {
1224 NSRect podcastViewDimensions = [o_podcast_view frame];
1225 NSRect playlistTableRect = [o_playlist_table frame];
1227 playlistTableRect.origin.y = playlistTableRect.origin.y - podcastViewDimensions.size.height;
1228 playlistTableRect.size.height = playlistTableRect.size.height + podcastViewDimensions.size.height;
1230 [o_podcast_view removeFromSuperviewWithoutNeedingDisplay];
1231 [o_playlist_table setFrame: playlistTableRect];
1232 b_podcastView_displayed = NO;
1238 @implementation VLCDetachedVideoWindow
1240 - (void)awakeFromNib
1242 // sets lion fullscreen behaviour
1243 [super awakeFromNib];
1244 [self setAcceptsMouseMovedEvents: YES];
1246 if (b_dark_interface) {
1247 [self setBackgroundColor: [NSColor clearColor]];
1249 [self setOpaque: NO];
1251 [self setHasShadow:NO];
1252 [self setHasShadow:YES];
1254 NSRect winrect = [self frame];
1255 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
1257 [self setTitle: _NS("VLC media player")];
1258 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight)];
1259 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: nil];
1262 [self setBackgroundColor: [NSColor blackColor]];
1265 NSRect videoViewRect = [[self contentView] bounds];
1266 if (b_dark_interface)
1267 videoViewRect.size.height -= [o_titlebar_view frame].size.height;
1268 CGFloat f_bottomBarHeight = [[[self controlsBar] bottomBarView] frame].size.height;
1269 videoViewRect.size.height -= f_bottomBarHeight;
1270 videoViewRect.origin.y = f_bottomBarHeight;
1271 [o_video_view setFrame: videoViewRect];
1273 if (b_dark_interface) {
1274 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_video_view frame]];
1275 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_video_view];
1276 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
1278 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
1280 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height)];
1286 if (b_dark_interface)
1287 [o_color_backdrop release];