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];
328 if (b_dark_interface) {
329 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidResizeNotification object: nil];
330 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidMoveNotification object: nil];
332 [self setBackgroundColor: [NSColor clearColor]];
333 [self setOpaque: NO];
335 [self setHasShadow:NO];
336 [self setHasShadow:YES];
338 NSRect winrect = [self frame];
339 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
341 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
342 winrect.size.width, f_titleBarHeight)];
343 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: o_split_view];
345 if (winrect.size.height > 100) {
346 [self setFrame: winrect display:YES animate:YES];
347 previousSavedFrame = winrect;
350 winrect = [o_split_view frame];
351 winrect.size.height = winrect.size.height - f_titleBarHeight;
352 [o_split_view setFrame: winrect];
353 [o_video_view setFrame: winrect];
355 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
356 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
357 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
359 [o_video_view setFrame: [o_split_view frame]];
360 [o_playlist_table setBorderType: NSNoBorder];
361 [o_sidebar_scrollview setBorderType: NSNoBorder];
364 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
365 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
366 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
367 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:o_split_view];
369 if (b_splitviewShouldBeHidden) {
370 [self hideSplitView];
371 i_lastSplitViewHeight = 300;
374 /* sanity check for the window size */
375 NSRect frame = [self frame];
376 NSSize screenSize = [[self screen] frame].size;
377 if (screenSize.width <= frame.size.width || screenSize.height <= frame.size.height) {
378 nativeVideoSize = screenSize;
382 /* update fs button to reflect state for next startup */
383 if (var_InheritBool(pl_Get(VLCIntf), "fullscreen"))
384 [o_controls_bar setFullscreenState:YES];
386 /* restore split view */
387 i_lastLeftSplitViewWidth = 200;
388 /* trick NSSplitView implementation, which pretends to know better than us */
389 if (!config_GetInt(VLCIntf, "macosx-show-sidebar"))
390 [self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
394 #pragma mark appearance management
396 - (VLCMainWindowControlsBar *)controlsBar;
398 return (VLCMainWindowControlsBar *)o_controls_bar;
401 - (void)resizePlaylistAfterCollapse
404 plrect = [o_playlist_table frame];
405 plrect.size.height = i_lastSplitViewHeight - 20.0; // actual pl top bar height, which differs from its frame
406 [[o_playlist_table animator] setFrame: plrect];
408 NSRect rightSplitRect;
409 rightSplitRect = [o_right_split_view frame];
410 plrect = [o_dropzone_box frame];
411 plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2;
412 plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2;
413 [[o_dropzone_box animator] setFrame: plrect];
416 - (void)makeSplitViewVisible
418 if (b_dark_interface)
419 [self setContentMinSize: NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
421 [self setContentMinSize: NSMakeSize(604., 288.)];
423 NSRect old_frame = [self frame];
424 float newHeight = [self minSize].height;
425 if (old_frame.size.height < newHeight) {
426 NSRect new_frame = old_frame;
427 new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
428 new_frame.size.height = newHeight;
430 [[self animator] setFrame: new_frame display: YES animate: YES];
433 [o_video_view setHidden: YES];
434 [o_split_view setHidden: NO];
435 [self makeFirstResponder: nil];
439 - (void)makeSplitViewHidden
441 if (b_dark_interface)
442 [self setContentMinSize: NSMakeSize(604., f_min_video_height + [o_titlebar_view frame].size.height)];
444 [self setContentMinSize: NSMakeSize(604., f_min_video_height)];
446 [o_split_view setHidden: YES];
447 [o_video_view setHidden: NO];
449 if ([[o_video_view subviews] count] > 0)
450 [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
453 // only exception for an controls bar button action
454 - (IBAction)togglePlaylist:(id)sender
456 if (![self isVisible] && sender != nil) {
457 [self makeKeyAndOrderFront: sender];
461 BOOL b_activeVideo = [[VLCMain sharedInstance] activeVideoPlayback];
462 BOOL b_restored = NO;
464 // TODO: implement toggle playlist in this situation (triggerd via menu item).
465 // but for now we block this case, to avoid displaying only the half
466 if (b_nativeFullscreenMode && b_fullscreen && b_activeVideo && sender != nil)
469 if (b_dropzone_active && ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) {
474 if (!(b_nativeFullscreenMode && b_fullscreen) && !b_splitview_removed && ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0 && b_activeVideo)
475 || (b_nonembedded && sender != nil)
476 || (!b_activeVideo && sender != nil)
477 || b_minimized_view))
478 [self hideSplitView];
480 if (b_splitview_removed) {
481 if (!b_nonembedded || (sender != nil && b_nonembedded))
482 [self showSplitView];
485 b_minimized_view = YES;
487 b_minimized_view = NO;
493 if (!b_nonembedded) {
494 if (([o_video_view isHidden] && b_activeVideo) || b_restored || (b_activeVideo && sender == nil))
495 [self makeSplitViewHidden];
497 [self makeSplitViewVisible];
499 [o_split_view setHidden: NO];
500 [o_playlist_table setHidden: NO];
501 [o_video_view setHidden: YES];
506 - (IBAction)dropzoneButtonAction:(id)sender
508 [[[VLCMain sharedInstance] open] openFileGeneric];
512 #pragma mark overwritten default functionality
514 - (void)windowResizedOrMoved:(NSNotification *)notification
516 [self saveFrameUsingName: [self frameAutosaveName]];
519 - (void)applicationWillTerminate:(NSNotification *)notification
521 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
523 [self saveFrameUsingName: [self frameAutosaveName]];
527 - (void)someWindowWillClose:(NSNotification *)notification
529 id obj = [notification object];
531 // hasActiveVideo is defined for VLCVideoWindowCommon and subclasses
532 if ([obj respondsToSelector:@selector(hasActiveVideo)] && [obj hasActiveVideo]) {
533 if ([[VLCMain sharedInstance] activeVideoPlayback])
534 [[VLCCoreInteraction sharedInstance] stop];
538 - (void)someWindowWillMiniaturize:(NSNotification *)notification
540 if (config_GetInt(VLCIntf, "macosx-pause-minimized")) {
541 id obj = [notification object];
543 if ([obj class] == [VLCVideoWindowCommon class] || [obj class] == [VLCDetachedVideoWindow class] || ([obj class] == [VLCMainWindow class] && !b_nonembedded)) {
544 if ([[VLCMain sharedInstance] activeVideoPlayback])
545 [[VLCCoreInteraction sharedInstance] pause];
551 #pragma mark Update interface and respond to foreign events
554 b_dropzone_active = YES;
555 [o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
556 [o_dropzone_view setFrame: [o_playlist_table frame]];
557 [[o_playlist_table animator] setHidden:YES];
562 b_dropzone_active = NO;
563 [o_dropzone_view removeFromSuperview];
564 [[o_playlist_table animator] setHidden: NO];
567 - (void)hideSplitView
569 NSRect winrect = [self frame];
570 i_lastSplitViewHeight = [o_split_view frame].size.height;
571 winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
572 winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
573 [self setFrame: winrect display: YES animate: YES];
574 [self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
575 if (b_dark_interface) {
576 [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
577 [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
579 [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height)];
580 [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height)];
583 b_splitview_removed = YES;
586 - (void)showSplitView
589 if (b_dark_interface)
590 [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
592 [self setContentMinSize:NSMakeSize(604., 288.)];
593 [self setContentMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)];
596 winrect = [self frame];
597 winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
598 winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
599 [self setFrame: winrect display: YES animate: YES];
601 [self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
603 b_splitview_removed = NO;
606 - (void)updateTimeSlider
608 [o_controls_bar updateTimeSlider];
609 [o_fspanel updatePositionAndTime];
611 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
616 input_thread_t * p_input;
617 p_input = pl_CurrentInput(VLCIntf);
620 char *format = var_InheritString(VLCIntf, "input-title-format");
621 char *formated = str_format_meta(pl_Get(VLCIntf), format);
623 aString = [NSString stringWithUTF8String:formated];
626 char *uri = input_item_GetURI(input_GetItem(p_input));
628 NSURL * o_url = [NSURL URLWithString: [NSString stringWithUTF8String: uri]];
629 if ([o_url isFileURL]) {
630 [self setRepresentedURL: o_url];
631 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
632 [o_window setRepresentedURL:o_url];
635 [self setRepresentedURL: nil];
636 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
637 [o_window setRepresentedURL:nil];
642 if ([aString isEqualToString:@""]) {
643 if ([o_url isFileURL])
644 aString = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
646 aString = [o_url absoluteString];
649 if ([aString length] > 0) {
650 [self setTitle: aString];
651 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
652 [o_window setTitle:aString];
655 [o_fspanel setStreamTitle: aString];
657 [self setTitle: _NS("VLC media player")];
658 [self setRepresentedURL: nil];
661 vlc_object_release(p_input);
663 [self setTitle: _NS("VLC media player")];
664 [self setRepresentedURL: nil];
670 [o_controls_bar updateControls];
671 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateControls)];
673 bool b_seekable = false;
675 playlist_t * p_playlist = pl_Get(VLCIntf);
676 input_thread_t * p_input = playlist_CurrentInput(p_playlist);
678 /* seekable streams */
679 b_seekable = var_GetBool(p_input, "can-seek");
681 vlc_object_release(p_input);
684 [self updateTimeSlider];
685 if ([o_fspanel respondsToSelector:@selector(setSeekable:)])
686 [o_fspanel setSeekable: b_seekable];
689 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
694 [o_sidebar_view setNeedsDisplay:YES];
699 [o_controls_bar setPause];
700 [o_fspanel setPause];
702 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPause)];
707 [o_controls_bar setPlay];
710 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPlay)];
714 - (void)updateVolumeSlider
716 [[self controlsBar] updateVolumeSlider];
717 [o_fspanel setVolumeLevel: [[VLCCoreInteraction sharedInstance] volume]];
721 #pragma mark Video Output handling
723 - (void)setVideoplayEnabled
725 BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback];
727 if (b_videoPlayback) {
729 frameBeforePlayback = [self frame];
731 if (!b_nonembedded && !b_fullscreen && frameBeforePlayback.size.width > 0 && frameBeforePlayback.size.height > 0)
732 [[self animator] setFrame:frameBeforePlayback display:YES];
734 // update fs button to reflect state for next startup
735 if (var_InheritBool(pl_Get(VLCIntf), "fullscreen")) {
736 [o_controls_bar setFullscreenState:YES];
739 [self makeFirstResponder: nil];
740 [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
742 // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
743 [self setAlphaValue:1.0];
746 if (b_nativeFullscreenMode) {
747 if ([self hasActiveVideo] && [self fullscreen]) {
748 [[o_controls_bar bottomBarView] setHidden: b_videoPlayback];
749 [o_fspanel setActive: nil];
751 [[o_controls_bar bottomBarView] setHidden: NO];
752 [o_fspanel setNonActive: nil];
758 #pragma mark Lion native fullscreen handling
759 - (void)windowWillEnterFullScreen:(NSNotification *)notification
761 [super windowWillEnterFullScreen:notification];
763 // update split view frame after removing title bar
764 [o_split_view setFrame: [o_video_view frame]];
767 - (void)windowWillExitFullScreen:(NSNotification *)notification
769 [super windowWillExitFullScreen: notification];
771 // update split view frame after readding title bar
772 [o_split_view setFrame: [o_video_view frame]];
775 #pragma mark Fullscreen support
777 - (void)showFullscreenController
780 id currentWindow = [NSApp keyWindow];
781 if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
782 if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen]) {
784 if ([[VLCMain sharedInstance] activeVideoPlayback])
793 - (void)makeKeyAndOrderFront: (id)sender
796 * when we exit fullscreen and fade out, we may endup in
797 * having a window that is faded. We can't have it fade in unless we
800 if (!b_window_is_invisible) {
801 /* Make sure we don't do it too much */
802 [super makeKeyAndOrderFront: sender];
806 [super setAlphaValue:0.0f];
807 [super makeKeyAndOrderFront: sender];
809 NSMutableDictionary * dict = [[NSMutableDictionary alloc] initWithCapacity:2];
810 [dict setObject:self forKey:NSViewAnimationTargetKey];
811 [dict setObject:NSViewAnimationFadeInEffect forKey:NSViewAnimationEffectKey];
813 o_makekey_anim = [[NSViewAnimation alloc] initWithViewAnimations:[NSArray arrayWithObject:dict]];
816 [o_makekey_anim setAnimationBlockingMode: NSAnimationNonblocking];
817 [o_makekey_anim setDuration: 0.1];
818 [o_makekey_anim setFrameRate: 30];
819 [o_makekey_anim setDelegate: self];
821 [o_makekey_anim startAnimation];
822 b_window_is_invisible = NO;
824 /* fullscreenAnimation will be unlocked when animation ends */
828 #pragma mark split view delegate
829 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
831 if (dividerIndex == 0)
837 - (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
839 if (dividerIndex == 0)
845 - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
847 return ([subview isEqual:o_left_split_view]);
850 - (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
852 if ([subview isEqual:o_left_split_view])
857 - (void)mainSplitViewDidResizeSubviews:(id)object
859 i_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
860 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
861 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
864 - (void)toggleLeftSubSplitView
866 [o_split_view adjustSubviews];
867 if ([o_split_view isSubviewCollapsed:o_left_split_view])
868 [o_split_view setPosition:i_lastLeftSplitViewWidth ofDividerAtIndex:0];
870 [o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
871 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
875 #pragma mark Side Bar Data handling
876 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
877 - (NSUInteger)sourceList:(PXSourceList*)sourceList numberOfChildrenOfItem:(id)item
879 //Works the same way as the NSOutlineView data source: `nil` means a parent item
881 return [o_sidebaritems count];
883 return [[item children] count];
887 - (id)sourceList:(PXSourceList*)aSourceList child:(NSUInteger)index ofItem:(id)item
889 //Works the same way as the NSOutlineView data source: `nil` means a parent item
891 return [o_sidebaritems objectAtIndex:index];
893 return [[item children] objectAtIndex:index];
897 - (id)sourceList:(PXSourceList*)aSourceList objectValueForItem:(id)item
902 - (void)sourceList:(PXSourceList*)aSourceList setObjectValue:(id)object forItem:(id)item
904 [item setTitle:object];
907 - (BOOL)sourceList:(PXSourceList*)aSourceList isItemExpandable:(id)item
909 return [item hasChildren];
913 - (BOOL)sourceList:(PXSourceList*)aSourceList itemHasBadge:(id)item
915 if ([[item identifier] isEqualToString: @"playlist"] || [[item identifier] isEqualToString: @"medialibrary"])
918 return [item hasBadge];
922 - (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item
924 playlist_t * p_playlist = pl_Get(VLCIntf);
925 NSInteger i_playlist_size;
927 if ([[item identifier] isEqualToString: @"playlist"]) {
929 i_playlist_size = p_playlist->p_local_category->i_children;
932 return i_playlist_size;
934 if ([[item identifier] isEqualToString: @"medialibrary"]) {
936 i_playlist_size = p_playlist->p_ml_category->i_children;
939 return i_playlist_size;
942 return [item badgeValue];
946 - (BOOL)sourceList:(PXSourceList*)aSourceList itemHasIcon:(id)item
948 return [item hasIcon];
952 - (NSImage*)sourceList:(PXSourceList*)aSourceList iconForItem:(id)item
957 - (NSMenu*)sourceList:(PXSourceList*)aSourceList menuForEvent:(NSEvent*)theEvent item:(id)item
959 if ([theEvent type] == NSRightMouseDown || ([theEvent type] == NSLeftMouseDown && ([theEvent modifierFlags] & NSControlKeyMask) == NSControlKeyMask)) {
962 if ([item sdtype] > 0)
964 m = [[NSMenu alloc] init];
965 playlist_t * p_playlist = pl_Get(VLCIntf);
966 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [[item identifier] UTF8String]);
968 [m addItemWithTitle:_NS("Enable") action:@selector(sdmenuhandler:) keyEquivalent:@""];
970 [m addItemWithTitle:_NS("Disable") action:@selector(sdmenuhandler:) keyEquivalent:@""];
971 [[m itemAtIndex:0] setRepresentedObject: [item identifier]];
973 return [m autorelease];
980 - (IBAction)sdmenuhandler:(id)sender
982 NSString * identifier = [sender representedObject];
983 if ([identifier length] > 0 && ![identifier isEqualToString:@"lua{sd='freebox',longname='Freebox TV'}"]) {
984 playlist_t * p_playlist = pl_Get(VLCIntf);
985 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [identifier UTF8String]);
988 playlist_ServicesDiscoveryAdd(p_playlist, [identifier UTF8String]);
990 playlist_ServicesDiscoveryRemove(p_playlist, [identifier UTF8String]);
995 #pragma mark Side Bar Delegate Methods
996 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
997 - (BOOL)sourceList:(PXSourceList*)aSourceList isGroupAlwaysExpanded:(id)group
999 if ([[group identifier] isEqualToString:@"library"])
1005 - (void)sourceListSelectionDidChange:(NSNotification *)notification
1007 playlist_t * p_playlist = pl_Get(VLCIntf);
1009 NSIndexSet *selectedIndexes = [o_sidebar_view selectedRowIndexes];
1010 id item = [o_sidebar_view itemAtRow:[selectedIndexes firstIndex]];
1013 //Set the label text to represent the new selection
1014 if ([item sdtype] > -1 && [[item identifier] length] > 0) {
1015 BOOL sd_loaded = playlist_IsServicesDiscoveryLoaded(p_playlist, [[item identifier] UTF8String]);
1017 playlist_ServicesDiscoveryAdd(p_playlist, [[item identifier] UTF8String]);
1020 [o_chosen_category_lbl setStringValue:[item title]];
1022 if ([[item identifier] isEqualToString:@"playlist"]) {
1023 [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_local_category];
1024 } else if ([[item identifier] isEqualToString:@"medialibrary"]) {
1025 [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_ml_category];
1027 playlist_item_t * pl_item;
1029 pl_item = playlist_ChildSearchName(p_playlist->p_root, [[item untranslatedTitle] UTF8String]);
1031 [[[VLCMain sharedInstance] playlist] setPlaylistRoot: pl_item];
1035 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
1036 [self hideDropZone];
1038 [self showDropZone];
1041 if ([[item identifier] isEqualToString:@"podcast{longname=\"Podcasts\"}"])
1042 [self showPodcastControls];
1044 [self hidePodcastControls];
1047 - (NSDragOperation)sourceList:(PXSourceList *)aSourceList validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
1049 if ([[item identifier] isEqualToString:@"playlist"] || [[item identifier] isEqualToString:@"medialibrary"]) {
1050 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1051 if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] || [[o_pasteboard types] containsObject: NSFilenamesPboardType])
1052 return NSDragOperationGeneric;
1054 return NSDragOperationNone;
1057 - (BOOL)sourceList:(PXSourceList *)aSourceList acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
1059 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1061 playlist_t * p_playlist = pl_Get(VLCIntf);
1062 playlist_item_t *p_node;
1064 if ([[item identifier] isEqualToString:@"playlist"])
1065 p_node = p_playlist->p_local_category;
1067 p_node = p_playlist->p_ml_category;
1069 if ([[o_pasteboard types] containsObject: NSFilenamesPboardType]) {
1070 NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
1071 NSUInteger count = [o_values count];
1072 NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
1074 for(NSUInteger i = 0; i < count; i++) {
1075 NSDictionary *o_dic;
1076 char *psz_uri = vlc_path2uri([[o_values objectAtIndex:i] UTF8String], NULL);
1080 o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
1084 [o_array addObject: o_dic];
1087 [[[VLCMain sharedInstance] playlist] appendNodeArray:o_array inNode: p_node atPos:-1 enqueue:YES];
1090 else if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"]) {
1091 NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
1093 NSUInteger count = [array count];
1094 playlist_item_t * p_item = NULL;
1097 for(NSUInteger i = 0; i < count; i++) {
1098 p_item = [[array objectAtIndex:i] pointerValue];
1099 if (!p_item) continue;
1100 playlist_NodeAddCopy(p_playlist, p_item, p_node, PLAYLIST_END);
1109 - (id)sourceList:(PXSourceList *)aSourceList persistentObjectForItem:(id)item
1111 return [item identifier];
1114 - (id)sourceList:(PXSourceList *)aSourceList itemForPersistentObject:(id)object
1116 /* the following code assumes for sakes of simplicity that only the top level
1117 * items are allowed to have children */
1119 NSArray * array = [NSArray arrayWithArray: o_sidebaritems]; // read-only arrays are noticebly faster
1120 NSUInteger count = [array count];
1124 for (NSUInteger x = 0; x < count; x++) {
1125 id item = [array objectAtIndex: x]; // save one objc selector call
1126 if ([[item identifier] isEqualToString:object])
1134 #pragma mark Podcast
1136 - (IBAction)addPodcast:(id)sender
1138 [NSApp beginSheet:o_podcast_subscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
1141 - (IBAction)addPodcastWindowAction:(id)sender
1143 [o_podcast_subscribe_window orderOut:sender];
1144 [NSApp endSheet: o_podcast_subscribe_window];
1146 if (sender == o_podcast_subscribe_ok_btn && [[o_podcast_subscribe_url_fld stringValue] length] > 0) {
1147 NSMutableString * podcastConf = [[NSMutableString alloc] init];
1148 if (config_GetPsz(VLCIntf, "podcast-urls") != NULL)
1149 [podcastConf appendFormat:@"%s|", config_GetPsz(VLCIntf, "podcast-urls")];
1151 [podcastConf appendString: [o_podcast_subscribe_url_fld stringValue]];
1152 config_PutPsz(VLCIntf, "podcast-urls", [podcastConf UTF8String]);
1154 vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name(VLCIntf->p_libvlc, "podcast");
1156 var_SetString(p_obj, "podcast-urls", [podcastConf UTF8String]);
1157 vlc_object_release(p_obj);
1159 [podcastConf release];
1163 - (IBAction)removePodcast:(id)sender
1165 if (config_GetPsz(VLCIntf, "podcast-urls") != NULL) {
1166 [o_podcast_unsubscribe_pop removeAllItems];
1167 [o_podcast_unsubscribe_pop addItemsWithTitles:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
1168 [NSApp beginSheet:o_podcast_unsubscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
1172 - (IBAction)removePodcastWindowAction:(id)sender
1174 [o_podcast_unsubscribe_window orderOut:sender];
1175 [NSApp endSheet: o_podcast_unsubscribe_window];
1177 if (sender == o_podcast_unsubscribe_ok_btn) {
1178 NSMutableArray * urls = [[NSMutableArray alloc] initWithArray:[[NSString stringWithUTF8String:config_GetPsz(VLCIntf, "podcast-urls")] componentsSeparatedByString:@"|"]];
1179 [urls removeObjectAtIndex: [o_podcast_unsubscribe_pop indexOfSelectedItem]];
1180 config_PutPsz(VLCIntf, "podcast-urls", [[urls componentsJoinedByString:@"|"] UTF8String]);
1183 vlc_object_t *p_obj = (vlc_object_t*)vlc_object_find_name(VLCIntf->p_libvlc, "podcast");
1185 var_SetString(p_obj, "podcast-urls", config_GetPsz(VLCIntf, "podcast-urls"));
1186 vlc_object_release(p_obj);
1189 /* reload the podcast module, since it won't update its list when removing podcasts */
1190 playlist_t * p_playlist = pl_Get(VLCIntf);
1191 if (playlist_IsServicesDiscoveryLoaded(p_playlist, "podcast{longname=\"Podcasts\"}")) {
1192 playlist_ServicesDiscoveryRemove(p_playlist, "podcast{longname=\"Podcasts\"}");
1193 playlist_ServicesDiscoveryAdd(p_playlist, "podcast{longname=\"Podcasts\"}");
1194 [o_playlist_table reloadData];
1200 - (void)showPodcastControls
1202 NSRect podcastViewDimensions = [o_podcast_view frame];
1203 NSRect rightSplitRect = [o_right_split_view frame];
1204 NSRect playlistTableRect = [o_playlist_table frame];
1206 podcastViewDimensions.size.width = rightSplitRect.size.width;
1207 podcastViewDimensions.origin.x = podcastViewDimensions.origin.y = .0;
1208 [o_podcast_view setFrame:podcastViewDimensions];
1210 playlistTableRect.origin.y = playlistTableRect.origin.y + podcastViewDimensions.size.height;
1211 playlistTableRect.size.height = playlistTableRect.size.height - podcastViewDimensions.size.height;
1212 [o_playlist_table setFrame:playlistTableRect];
1213 [o_playlist_table setNeedsDisplay:YES];
1215 [o_right_split_view addSubview: o_podcast_view positioned: NSWindowAbove relativeTo: o_right_split_view];
1216 b_podcastView_displayed = YES;
1219 - (void)hidePodcastControls
1221 if (b_podcastView_displayed) {
1222 NSRect podcastViewDimensions = [o_podcast_view frame];
1223 NSRect playlistTableRect = [o_playlist_table frame];
1225 playlistTableRect.origin.y = playlistTableRect.origin.y - podcastViewDimensions.size.height;
1226 playlistTableRect.size.height = playlistTableRect.size.height + podcastViewDimensions.size.height;
1228 [o_podcast_view removeFromSuperviewWithoutNeedingDisplay];
1229 [o_playlist_table setFrame: playlistTableRect];
1230 b_podcastView_displayed = NO;
1236 @implementation VLCDetachedVideoWindow
1238 - (void)awakeFromNib
1240 // sets lion fullscreen behaviour
1241 [super awakeFromNib];
1242 [self setAcceptsMouseMovedEvents: YES];
1244 if (b_dark_interface) {
1245 [self setBackgroundColor: [NSColor clearColor]];
1247 [self setOpaque: NO];
1249 [self setHasShadow:NO];
1250 [self setHasShadow:YES];
1252 NSRect winrect = [self frame];
1253 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
1255 [self setTitle: _NS("VLC media player")];
1256 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight)];
1257 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: nil];
1260 [self setBackgroundColor: [NSColor blackColor]];
1263 NSRect videoViewRect = [[self contentView] bounds];
1264 if (b_dark_interface)
1265 videoViewRect.size.height -= [o_titlebar_view frame].size.height;
1266 CGFloat f_bottomBarHeight = [[[self controlsBar] bottomBarView] frame].size.height;
1267 videoViewRect.size.height -= f_bottomBarHeight;
1268 videoViewRect.origin.y = f_bottomBarHeight;
1269 [o_video_view setFrame: videoViewRect];
1271 if (b_dark_interface) {
1272 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_video_view frame]];
1273 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_video_view];
1274 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
1276 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
1278 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[[self controlsBar] bottomBarView] frame].size.height)];
1284 if (b_dark_interface)
1285 [o_color_backdrop release];