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 ![self isEvent: o_event forKey: "key-prev"] &&
127 ![self isEvent: o_event forKey: "key-next"] &&
128 ![self isEvent: o_event forKey: "key-jump+short"] &&
129 ![self isEvent: o_event forKey: "key-jump-short"]) {
130 /* We indeed want to prioritize some Cocoa key equivalent against libvlc,
131 so we perform the menu equivalent now. */
132 if ([[NSApp mainMenu] performKeyEquivalent:o_event])
138 return [[VLCMain sharedInstance] hasDefinedShortcutKey:o_event force:b_force] ||
139 [(VLCControls *)[[VLCMain sharedInstance] controls] keyEvent:o_event];
144 if (b_dark_interface)
145 [o_color_backdrop release];
147 [[NSNotificationCenter defaultCenter] removeObserver: self];
148 [o_sidebaritems release];
155 // sets lion fullscreen behaviour
156 [super awakeFromNib];
158 BOOL b_splitviewShouldBeHidden = NO;
160 /* setup the styled interface */
161 b_nativeFullscreenMode = NO;
162 #ifdef MAC_OS_X_VERSION_10_7
163 if (!OSX_SNOW_LEOPARD)
164 b_nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode");
166 [self useOptimizedDrawing: YES];
168 [[o_search_fld cell] setPlaceholderString: _NS("Search")];
169 [[o_search_fld cell] accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.") forAttribute:NSAccessibilityDescriptionAttribute];
171 [o_dropzone_btn setTitle: _NS("Open media...")];
172 [[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];
173 [o_dropzone_lbl setStringValue: _NS("Drop media here")];
175 [o_podcast_add_btn setTitle: _NS("Subscribe")];
176 [o_podcast_remove_btn setTitle: _NS("Unsubscribe")];
177 [o_podcast_subscribe_title_lbl setStringValue: _NS("Subscribe to a podcast")];
178 [o_podcast_subscribe_subtitle_lbl setStringValue: _NS("Enter URL of the podcast to subscribe to:")];
179 [o_podcast_subscribe_cancel_btn setTitle: _NS("Cancel")];
180 [o_podcast_subscribe_ok_btn setTitle: _NS("Subscribe")];
181 [o_podcast_unsubscribe_title_lbl setStringValue: _NS("Unsubscribe from a podcast")];
182 [o_podcast_unsubscribe_subtitle_lbl setStringValue: _NS("Select the podcast you would like to unsubscribe from:")];
183 [o_podcast_unsubscribe_ok_btn setTitle: _NS("Unsubscribe")];
184 [o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")];
186 /* interface builder action */
187 float f_threshold_height = f_min_video_height + [o_controls_bar height];
188 if (b_dark_interface)
189 f_threshold_height += [o_titlebar_view frame].size.height;
190 if ([[self contentView] frame].size.height < f_threshold_height)
191 b_splitviewShouldBeHidden = YES;
193 [self setDelegate: self];
194 [self setExcludedFromWindowsMenu: YES];
195 [self setAcceptsMouseMovedEvents: YES];
196 // Set that here as IB seems to be buggy
197 if (b_dark_interface)
198 [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
200 [self setContentMinSize:NSMakeSize(604., 288.)];
202 [self setTitle: _NS("VLC media player")];
204 b_dropzone_active = YES;
205 [o_dropzone_view setFrame: [o_playlist_table frame]];
206 [o_left_split_view setFrame: [o_sidebar_view frame]];
208 if (!OSX_SNOW_LEOPARD) {
209 /* the default small size of the search field is slightly different on Lion, let's work-around that */
211 frame = [o_search_fld frame];
212 frame.origin.y = frame.origin.y + 2.0;
213 frame.size.height = frame.size.height - 1.0;
214 [o_search_fld setFrame: frame];
217 /* create the sidebar */
218 o_sidebaritems = [[NSMutableArray alloc] init];
219 SideBarItem *libraryItem = [SideBarItem itemWithTitle:_NS("LIBRARY") identifier:@"library"];
220 SideBarItem *playlistItem = [SideBarItem itemWithTitle:_NS("Playlist") identifier:@"playlist"];
221 [playlistItem setIcon: [NSImage imageNamed:@"sidebar-playlist"]];
222 SideBarItem *medialibraryItem = [SideBarItem itemWithTitle:_NS("Media Library") identifier:@"medialibrary"];
223 [medialibraryItem setIcon: [NSImage imageNamed:@"sidebar-playlist"]];
224 SideBarItem *mycompItem = [SideBarItem itemWithTitle:_NS("MY COMPUTER") identifier:@"mycomputer"];
225 SideBarItem *devicesItem = [SideBarItem itemWithTitle:_NS("DEVICES") identifier:@"devices"];
226 SideBarItem *lanItem = [SideBarItem itemWithTitle:_NS("LOCAL NETWORK") identifier:@"localnetwork"];
227 SideBarItem *internetItem = [SideBarItem itemWithTitle:_NS("INTERNET") identifier:@"internet"];
229 /* SD subnodes, inspired by the Qt4 intf */
230 char **ppsz_longnames = NULL;
231 int *p_categories = NULL;
232 char **ppsz_names = vlc_sd_GetNames(pl_Get(VLCIntf), &ppsz_longnames, &p_categories);
234 msg_Err(VLCIntf, "no sd item found"); //TODO
235 char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
236 int *p_category = p_categories;
237 NSMutableArray *internetItems = [[NSMutableArray alloc] init];
238 NSMutableArray *devicesItems = [[NSMutableArray alloc] init];
239 NSMutableArray *lanItems = [[NSMutableArray alloc] init];
240 NSMutableArray *mycompItems = [[NSMutableArray alloc] init];
241 NSString *o_identifier;
242 for (; ppsz_name && *ppsz_name; ppsz_name++, ppsz_longname++, p_category++) {
243 o_identifier = [NSString stringWithCString: *ppsz_name encoding: NSUTF8StringEncoding];
244 switch (*p_category) {
245 case SD_CAT_INTERNET:
246 [internetItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
247 if (!strncmp(*ppsz_name, "podcast", 7))
248 [[internetItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-podcast"]];
250 [[internetItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
251 [[internetItems lastObject] setSdtype: SD_CAT_INTERNET];
252 [[internetItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String:*ppsz_longname]];
255 [devicesItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
256 [[devicesItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
257 [[devicesItems lastObject] setSdtype: SD_CAT_DEVICES];
258 [[devicesItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String:*ppsz_longname]];
261 [lanItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
262 [[lanItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-local"]];
263 [[lanItems lastObject] setSdtype: SD_CAT_LAN];
264 [[lanItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String:*ppsz_longname]];
266 case SD_CAT_MYCOMPUTER:
267 [mycompItems addObject: [SideBarItem itemWithTitle: _NS(*ppsz_longname) identifier: o_identifier]];
268 if (!strncmp(*ppsz_name, "video_dir", 9))
269 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-movie"]];
270 else if (!strncmp(*ppsz_name, "audio_dir", 9))
271 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-music"]];
272 else if (!strncmp(*ppsz_name, "picture_dir", 11))
273 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"sidebar-pictures"]];
275 [[mycompItems lastObject] setIcon: [NSImage imageNamed:@"NSApplicationIcon"]];
276 [[mycompItems lastObject] setUntranslatedTitle: [NSString stringWithUTF8String:*ppsz_longname]];
277 [[mycompItems lastObject] setSdtype: SD_CAT_MYCOMPUTER];
280 msg_Warn(VLCIntf, "unknown SD type found, skipping (%s)", *ppsz_name);
285 free(*ppsz_longname);
287 [mycompItem setChildren: [NSArray arrayWithArray: mycompItems]];
288 [devicesItem setChildren: [NSArray arrayWithArray: devicesItems]];
289 [lanItem setChildren: [NSArray arrayWithArray: lanItems]];
290 [internetItem setChildren: [NSArray arrayWithArray: internetItems]];
291 [mycompItems release];
292 [devicesItems release];
294 [internetItems release];
296 free(ppsz_longnames);
299 [libraryItem setChildren: [NSArray arrayWithObjects:playlistItem, medialibraryItem, nil]];
300 [o_sidebaritems addObject: libraryItem];
301 if ([mycompItem hasChildren])
302 [o_sidebaritems addObject: mycompItem];
303 if ([devicesItem hasChildren])
304 [o_sidebaritems addObject: devicesItem];
305 if ([lanItem hasChildren])
306 [o_sidebaritems addObject: lanItem];
307 if ([internetItem hasChildren])
308 [o_sidebaritems addObject: internetItem];
310 [o_sidebar_view reloadData];
311 [o_sidebar_view selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
312 [o_sidebar_view setDropItem:playlistItem dropChildIndex:NSOutlineViewDropOnItemIndex];
313 [o_sidebar_view registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
315 [o_sidebar_view setAutosaveName:@"mainwindow-sidebar"];
316 [(PXSourceList *)o_sidebar_view setDataSource:self];
317 [o_sidebar_view setDelegate:self];
318 [o_sidebar_view setAutosaveExpandedItems:YES];
320 [o_sidebar_view expandItem: libraryItem expandChildren: YES];
322 o_fspanel = [[VLCFSPanel alloc] initWithContentRect:NSMakeRect(110.,267.,549.,87.)
323 styleMask:NSTexturedBackgroundWindowMask
324 backing:NSBackingStoreBuffered
327 /* make sure we display the desired default appearance when VLC launches for the first time */
328 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
329 if (![defaults objectForKey:@"VLCFirstRun"]) {
330 [defaults setObject:[NSDate date] forKey:@"VLCFirstRun"];
332 NSUInteger i_sidebaritem_count = [o_sidebaritems count];
333 for (NSUInteger x = 0; x < i_sidebaritem_count; x++)
334 [o_sidebar_view expandItem: [o_sidebaritems objectAtIndex:x] expandChildren: YES];
339 if (b_dark_interface) {
340 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidResizeNotification object: nil];
341 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(windowResizedOrMoved:) name: NSWindowDidMoveNotification object: nil];
343 [self setBackgroundColor: [NSColor clearColor]];
344 [self setOpaque: NO];
346 [self setHasShadow:NO];
347 [self setHasShadow:YES];
349 NSRect winrect = [self frame];
350 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
352 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
353 winrect.size.width, f_titleBarHeight)];
354 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: o_split_view];
356 if (winrect.size.height > 100) {
357 [self setFrame: winrect display:YES animate:YES];
358 previousSavedFrame = winrect;
361 winrect = [o_split_view frame];
362 winrect.size.height = winrect.size.height - f_titleBarHeight;
363 [o_split_view setFrame: winrect];
364 [o_video_view setFrame: winrect];
366 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
367 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
368 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
370 [o_video_view setFrame: [o_split_view frame]];
371 [o_playlist_table setBorderType: NSNoBorder];
372 [o_sidebar_scrollview setBorderType: NSNoBorder];
375 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
376 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
377 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
378 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(mainSplitViewDidResizeSubviews:) name: NSSplitViewDidResizeSubviewsNotification object:o_split_view];
380 if (b_splitviewShouldBeHidden) {
381 [self hideSplitView: YES];
382 i_lastSplitViewHeight = 300;
385 /* sanity check for the window size */
386 NSRect frame = [self frame];
387 NSSize screenSize = [[self screen] frame].size;
388 if (screenSize.width <= frame.size.width || screenSize.height <= frame.size.height) {
389 nativeVideoSize = screenSize;
393 /* update fs button to reflect state for next startup */
394 if (var_InheritBool(pl_Get(VLCIntf), "fullscreen"))
395 [o_controls_bar setFullscreenState:YES];
397 /* restore split view */
398 i_lastLeftSplitViewWidth = 200;
399 /* trick NSSplitView implementation, which pretends to know better than us */
400 if (!config_GetInt(VLCIntf, "macosx-show-sidebar"))
401 [self performSelector:@selector(toggleLeftSubSplitView) withObject:nil afterDelay:0.05];
405 #pragma mark appearance management
407 - (VLCMainWindowControlsBar *)controlsBar;
409 return (VLCMainWindowControlsBar *)o_controls_bar;
412 - (void)resizePlaylistAfterCollapse
415 plrect = [o_playlist_table frame];
416 plrect.size.height = i_lastSplitViewHeight - 20.0; // actual pl top bar height, which differs from its frame
417 [[o_playlist_table animator] setFrame: plrect];
419 NSRect rightSplitRect;
420 rightSplitRect = [o_right_split_view frame];
421 plrect = [o_dropzone_box frame];
422 plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2;
423 plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2;
424 [[o_dropzone_box animator] setFrame: plrect];
427 - (void)makeSplitViewVisible
429 if (b_dark_interface)
430 [self setContentMinSize: NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
432 [self setContentMinSize: NSMakeSize(604., 288.)];
434 NSRect old_frame = [self frame];
435 float newHeight = [self minSize].height;
436 if (old_frame.size.height < newHeight) {
437 NSRect new_frame = old_frame;
438 new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
439 new_frame.size.height = newHeight;
441 [[self animator] setFrame: new_frame display: YES animate: YES];
444 [o_video_view setHidden: YES];
445 [o_split_view setHidden: NO];
446 if ([self fullscreen]) {
447 [[o_controls_bar bottomBarView] setHidden: NO];
448 [o_fspanel setNonActive:nil];
451 [self makeFirstResponder: o_playlist_table];
454 - (void)makeSplitViewHidden
456 if (b_dark_interface)
457 [self setContentMinSize: NSMakeSize(604., f_min_video_height + [o_titlebar_view frame].size.height)];
459 [self setContentMinSize: NSMakeSize(604., f_min_video_height)];
461 [o_split_view setHidden: YES];
462 [o_video_view setHidden: NO];
463 if ([self fullscreen]) {
464 [[o_controls_bar bottomBarView] setHidden: YES];
465 [o_fspanel setActive:nil];
468 if ([[o_video_view subviews] count] > 0)
469 [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
472 // only exception for an controls bar button action
473 - (IBAction)togglePlaylist:(id)sender
475 if (![self isVisible] && sender != nil) {
476 [self makeKeyAndOrderFront: sender];
480 BOOL b_activeVideo = [[VLCMain sharedInstance] activeVideoPlayback];
481 BOOL b_restored = NO;
483 BOOL b_have_alt_key = ([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0;
484 if (sender && [sender isKindOfClass: [NSMenuItem class]])
487 if (b_dropzone_active && b_have_alt_key) {
492 if (!(b_nativeFullscreenMode && b_fullscreen) && !b_splitview_removed && ((b_have_alt_key && b_activeVideo)
493 || (b_nonembedded && sender != nil)
494 || (!b_activeVideo && sender != nil)
495 || b_minimized_view))
496 [self hideSplitView: sender != nil];
498 if (b_splitview_removed) {
499 if (!b_nonembedded || (sender != nil && b_nonembedded))
500 [self showSplitView: sender != nil];
503 b_minimized_view = YES;
505 b_minimized_view = NO;
511 if (!b_nonembedded) {
512 if (([o_video_view isHidden] && b_activeVideo) || b_restored || (b_activeVideo && sender == nil))
513 [self makeSplitViewHidden];
515 [self makeSplitViewVisible];
517 [o_split_view setHidden: NO];
518 [o_playlist_table setHidden: NO];
519 [o_video_view setHidden: YES];
524 - (IBAction)dropzoneButtonAction:(id)sender
526 [[[VLCMain sharedInstance] open] openFileGeneric];
530 #pragma mark overwritten default functionality
532 - (void)windowResizedOrMoved:(NSNotification *)notification
534 [self saveFrameUsingName: [self frameAutosaveName]];
537 - (void)applicationWillTerminate:(NSNotification *)notification
539 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
541 [self saveFrameUsingName: [self frameAutosaveName]];
545 - (void)someWindowWillClose:(NSNotification *)notification
547 id obj = [notification object];
549 // hasActiveVideo is defined for VLCVideoWindowCommon and subclasses
550 if ([obj respondsToSelector:@selector(hasActiveVideo)] && [obj hasActiveVideo]) {
551 if ([[VLCMain sharedInstance] activeVideoPlayback])
552 [[VLCCoreInteraction sharedInstance] stop];
556 - (void)someWindowWillMiniaturize:(NSNotification *)notification
558 if (config_GetInt(VLCIntf, "macosx-pause-minimized")) {
559 id obj = [notification object];
561 if ([obj class] == [VLCVideoWindowCommon class] || [obj class] == [VLCDetachedVideoWindow class] || ([obj class] == [VLCMainWindow class] && !b_nonembedded)) {
562 if ([[VLCMain sharedInstance] activeVideoPlayback])
563 [[VLCCoreInteraction sharedInstance] pause];
569 #pragma mark Update interface and respond to foreign events
572 b_dropzone_active = YES;
573 [o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
574 [o_dropzone_view setFrame: [o_playlist_table frame]];
575 [[o_playlist_table animator] setHidden:YES];
580 b_dropzone_active = NO;
581 [o_dropzone_view removeFromSuperview];
582 [[o_playlist_table animator] setHidden: NO];
585 - (void)hideSplitView:(BOOL)b_with_resize
588 NSRect winrect = [self frame];
589 i_lastSplitViewHeight = [o_split_view frame].size.height;
590 winrect.size.height = winrect.size.height - i_lastSplitViewHeight;
591 winrect.origin.y = winrect.origin.y + i_lastSplitViewHeight;
592 [self setFrame: winrect display: YES animate: YES];
595 [self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
596 if (b_dark_interface) {
597 [self setContentMinSize: NSMakeSize(604., [o_controls_bar height] + [o_titlebar_view frame].size.height)];
598 [self setContentMaxSize: NSMakeSize(FLT_MAX, [o_controls_bar height] + [o_titlebar_view frame].size.height)];
600 [self setContentMinSize: NSMakeSize(604., [o_controls_bar height])];
601 [self setContentMaxSize: NSMakeSize(FLT_MAX, [o_controls_bar height])];
604 b_splitview_removed = YES;
607 - (void)showSplitView:(BOOL)b_with_resize
610 if (b_dark_interface)
611 [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
613 [self setContentMinSize:NSMakeSize(604., 288.)];
614 [self setContentMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)];
618 winrect = [self frame];
619 winrect.size.height = winrect.size.height + i_lastSplitViewHeight;
620 winrect.origin.y = winrect.origin.y - i_lastSplitViewHeight;
621 [self setFrame: winrect display: YES animate: YES];
624 [self performSelector:@selector(resizePlaylistAfterCollapse) withObject: nil afterDelay:0.75];
626 b_splitview_removed = NO;
629 - (void)updateTimeSlider
631 [o_controls_bar updateTimeSlider];
632 [o_fspanel updatePositionAndTime];
634 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
639 input_thread_t * p_input;
640 p_input = pl_CurrentInput(VLCIntf);
644 if (!config_GetPsz(VLCIntf, "video-title")) {
645 char *format = var_InheritString(VLCIntf, "input-title-format");
646 char *formated = str_format_meta(pl_Get(VLCIntf), format);
648 aString = [NSString stringWithUTF8String:formated];
651 aString = [NSString stringWithUTF8String:config_GetPsz(VLCIntf, "video-title")];
653 char *uri = input_item_GetURI(input_GetItem(p_input));
655 NSURL * o_url = [NSURL URLWithString:[NSString stringWithUTF8String:uri]];
656 if ([o_url isFileURL]) {
657 [self setRepresentedURL: o_url];
658 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
659 [o_window setRepresentedURL:o_url];
662 [self setRepresentedURL: nil];
663 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
664 [o_window setRepresentedURL:nil];
669 if ([aString isEqualToString:@""]) {
670 if ([o_url isFileURL])
671 aString = [[NSFileManager defaultManager] displayNameAtPath: [o_url path]];
673 aString = [o_url absoluteString];
676 if ([aString length] > 0) {
677 [self setTitle: aString];
678 [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
679 [o_window setTitle:aString];
682 [o_fspanel setStreamTitle: aString];
684 [self setTitle: _NS("VLC media player")];
685 [self setRepresentedURL: nil];
688 vlc_object_release(p_input);
690 [self setTitle: _NS("VLC media player")];
691 [self setRepresentedURL: nil];
697 [o_controls_bar updateControls];
698 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateControls)];
700 bool b_seekable = false;
702 playlist_t * p_playlist = pl_Get(VLCIntf);
703 input_thread_t * p_input = playlist_CurrentInput(p_playlist);
705 /* seekable streams */
706 b_seekable = var_GetBool(p_input, "can-seek");
708 vlc_object_release(p_input);
711 [self updateTimeSlider];
712 if ([o_fspanel respondsToSelector:@selector(setSeekable:)])
713 [o_fspanel setSeekable: b_seekable];
716 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
721 [o_sidebar_view setNeedsDisplay:YES];
726 [o_controls_bar setPause];
727 [o_fspanel setPause];
729 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPause)];
734 [o_controls_bar setPlay];
737 [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(setPlay)];
740 - (void)updateVolumeSlider
742 [[self controlsBar] updateVolumeSlider];
743 [o_fspanel setVolumeLevel: [[VLCCoreInteraction sharedInstance] volume]];
747 #pragma mark Video Output handling
749 - (void)videoplayWillBeStarted
752 frameBeforePlayback = [self frame];
755 - (void)setVideoplayEnabled
757 BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback];
759 if (!b_videoPlayback) {
760 if (!b_nonembedded && (!b_nativeFullscreenMode || (b_nativeFullscreenMode && !b_fullscreen)) && frameBeforePlayback.size.width > 0 && frameBeforePlayback.size.height > 0)
761 [[self animator] setFrame:frameBeforePlayback display:YES];
763 // update fs button to reflect state for next startup
764 if (var_InheritBool(VLCIntf, "fullscreen") || var_GetBool(pl_Get(VLCIntf), "fullscreen")) {
765 [o_controls_bar setFullscreenState:YES];
768 [self makeFirstResponder: o_playlist_table];
769 [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
771 // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
772 [self setAlphaValue:1.0];
775 if (b_nativeFullscreenMode) {
776 if ([self hasActiveVideo] && [self fullscreen]) {
777 [[o_controls_bar bottomBarView] setHidden: b_videoPlayback];
778 [o_fspanel setActive: nil];
780 [[o_controls_bar bottomBarView] setHidden: NO];
781 [o_fspanel setNonActive: nil];
787 #pragma mark Lion native fullscreen handling
788 - (void)windowWillEnterFullScreen:(NSNotification *)notification
790 [super windowWillEnterFullScreen:notification];
792 // update split view frame after removing title bar
793 if (b_dark_interface) {
794 NSRect frame = [[self contentView] frame];
795 frame.origin.y += [o_controls_bar height];
796 frame.size.height -= [o_controls_bar height];
797 [o_split_view setFrame:frame];
801 - (void)windowWillExitFullScreen:(NSNotification *)notification
803 [super windowWillExitFullScreen: notification];
805 // update split view frame after readding title bar
806 if (b_dark_interface) {
807 NSRect frame = [o_split_view frame];
808 frame.size.height -= [o_titlebar_view frame].size.height;
809 [o_split_view setFrame:frame];
813 #pragma mark Fullscreen support
815 - (void)showFullscreenController
817 id currentWindow = [NSApp keyWindow];
818 if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
819 if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen] && ![[currentWindow videoView] isHidden]) {
821 if ([[VLCMain sharedInstance] activeVideoPlayback])
829 #pragma mark split view delegate
830 - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
832 if (dividerIndex == 0)
838 - (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
840 if (dividerIndex == 0)
846 - (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
848 return ([subview isEqual:o_left_split_view]);
851 - (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
853 if ([subview isEqual:o_left_split_view])
858 - (void)mainSplitViewDidResizeSubviews:(id)object
860 i_lastLeftSplitViewWidth = [o_left_split_view frame].size.width;
861 config_PutInt(VLCIntf, "macosx-show-sidebar", ![o_split_view isSubviewCollapsed:o_left_split_view]);
862 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
865 - (void)toggleLeftSubSplitView
867 [o_split_view adjustSubviews];
868 if ([o_split_view isSubviewCollapsed:o_left_split_view])
869 [o_split_view setPosition:i_lastLeftSplitViewWidth ofDividerAtIndex:0];
871 [o_split_view setPosition:[o_split_view minPossiblePositionOfDividerAtIndex:0] ofDividerAtIndex:0];
872 [[[VLCMain sharedInstance] mainMenu] updateSidebarMenuItem];
876 #pragma mark Side Bar Data handling
877 /* taken under BSD-new from the PXSourceList sample project, adapted for VLC */
878 - (NSUInteger)sourceList:(PXSourceList*)sourceList numberOfChildrenOfItem:(id)item
880 //Works the same way as the NSOutlineView data source: `nil` means a parent item
882 return [o_sidebaritems count];
884 return [[item children] count];
888 - (id)sourceList:(PXSourceList*)aSourceList child:(NSUInteger)index ofItem:(id)item
890 //Works the same way as the NSOutlineView data source: `nil` means a parent item
892 return [o_sidebaritems objectAtIndex:index];
894 return [[item children] objectAtIndex:index];
898 - (id)sourceList:(PXSourceList*)aSourceList objectValueForItem:(id)item
903 - (void)sourceList:(PXSourceList*)aSourceList setObjectValue:(id)object forItem:(id)item
905 [item setTitle:object];
908 - (BOOL)sourceList:(PXSourceList*)aSourceList isItemExpandable:(id)item
910 return [item hasChildren];
914 - (BOOL)sourceList:(PXSourceList*)aSourceList itemHasBadge:(id)item
916 if ([[item identifier] isEqualToString: @"playlist"] || [[item identifier] isEqualToString: @"medialibrary"])
919 return [item hasBadge];
923 - (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item
925 playlist_t * p_playlist = pl_Get(VLCIntf);
926 NSInteger i_playlist_size = 0;
928 if ([[item identifier] isEqualToString: @"playlist"]) {
930 i_playlist_size = p_playlist->p_local_category->i_children;
933 return i_playlist_size;
935 if ([[item identifier] isEqualToString: @"medialibrary"]) {
937 if (p_playlist->p_ml_category)
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 if (p_playlist->p_ml_category)
1028 [[[VLCMain sharedInstance] playlist] setPlaylistRoot:p_playlist->p_ml_category];
1030 playlist_item_t * pl_item;
1032 pl_item = playlist_ChildSearchName(p_playlist->p_root, [[item untranslatedTitle] UTF8String]);
1034 [[[VLCMain sharedInstance] playlist] setPlaylistRoot: pl_item];
1038 if ([[[VLCMain sharedInstance] playlist] currentPlaylistRoot] != p_playlist->p_local_category || p_playlist->p_local_category->i_children > 0)
1039 [self hideDropZone];
1041 [self showDropZone];
1044 if ([[item identifier] isEqualToString:@"podcast{longname=\"Podcasts\"}"])
1045 [self showPodcastControls];
1047 [self hidePodcastControls];
1049 [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
1054 - (NSDragOperation)sourceList:(PXSourceList *)aSourceList validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index
1056 if ([[item identifier] isEqualToString:@"playlist"] || [[item identifier] isEqualToString:@"medialibrary"]) {
1057 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1058 if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"] || [[o_pasteboard types] containsObject: NSFilenamesPboardType])
1059 return NSDragOperationGeneric;
1061 return NSDragOperationNone;
1064 - (BOOL)sourceList:(PXSourceList *)aSourceList acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index
1066 NSPasteboard *o_pasteboard = [info draggingPasteboard];
1068 playlist_t * p_playlist = pl_Get(VLCIntf);
1069 playlist_item_t *p_node;
1071 if ([[item identifier] isEqualToString:@"playlist"])
1072 p_node = p_playlist->p_local_category;
1074 p_node = p_playlist->p_ml_category;
1076 if ([[o_pasteboard types] containsObject: NSFilenamesPboardType]) {
1077 NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector: @selector(caseInsensitiveCompare:)];
1078 NSUInteger count = [o_values count];
1079 NSMutableArray *o_array = [NSMutableArray arrayWithCapacity:count];
1081 for(NSUInteger i = 0; i < count; i++) {
1082 NSDictionary *o_dic;
1083 char *psz_uri = vlc_path2uri([[o_values objectAtIndex:i] UTF8String], NULL);
1087 o_dic = [NSDictionary dictionaryWithObject:[NSString stringWithCString:psz_uri encoding:NSUTF8StringEncoding] forKey:@"ITEM_URL"];
1091 [o_array addObject: o_dic];
1094 [[[VLCMain sharedInstance] playlist] appendNodeArray:o_array inNode: p_node atPos:-1 enqueue:YES];
1097 else if ([[o_pasteboard types] containsObject: @"VLCPlaylistItemPboardType"]) {
1098 NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
1100 NSUInteger count = [array count];
1101 playlist_item_t * p_item = NULL;
1104 for(NSUInteger i = 0; i < count; i++) {
1105 p_item = [[array objectAtIndex:i] pointerValue];
1106 if (!p_item) continue;
1107 playlist_NodeAddCopy(p_playlist, p_item, p_node, PLAYLIST_END);
1116 - (id)sourceList:(PXSourceList *)aSourceList persistentObjectForItem:(id)item
1118 return [item identifier];
1121 - (id)sourceList:(PXSourceList *)aSourceList itemForPersistentObject:(id)object
1123 /* the following code assumes for sakes of simplicity that only the top level
1124 * items are allowed to have children */
1126 NSArray * array = [NSArray arrayWithArray: o_sidebaritems]; // read-only arrays are noticebly faster
1127 NSUInteger count = [array count];
1131 for (NSUInteger x = 0; x < count; x++) {
1132 id item = [array objectAtIndex:x]; // save one objc selector call
1133 if ([[item identifier] isEqualToString:object])
1141 #pragma mark Podcast
1143 - (IBAction)addPodcast:(id)sender
1145 [NSApp beginSheet:o_podcast_subscribe_window modalForWindow:self modalDelegate:self didEndSelector:NULL contextInfo:nil];
1148 - (IBAction)addPodcastWindowAction:(id)sender
1150 [o_podcast_subscribe_window orderOut:sender];
1151 [NSApp endSheet: o_podcast_subscribe_window];
1153 if (sender == o_podcast_subscribe_ok_btn && [[o_podcast_subscribe_url_fld stringValue] length] > 0) {
1154 NSMutableString * podcastConf = [[NSMutableString alloc] init];
1155 if (config_GetPsz(VLCIntf, "podcast-urls") != NULL)
1156 [podcastConf appendFormat:@"%s|", config_GetPsz(VLCIntf, "podcast-urls")];
1158 [podcastConf appendString: [o_podcast_subscribe_url_fld stringValue]];
1159 config_PutPsz(VLCIntf, "podcast-urls", [podcastConf UTF8String]);
1160 var_SetString(pl_Get(VLCIntf), "podcast-urls", [podcastConf UTF8String]);
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]);
1183 var_SetString(pl_Get(VLCIntf), "podcast-urls", config_GetPsz(VLCIntf, "podcast-urls"));
1186 /* reload the podcast module, since it won't update its list when removing podcasts */
1187 playlist_t * p_playlist = pl_Get(VLCIntf);
1188 if (playlist_IsServicesDiscoveryLoaded(p_playlist, "podcast{longname=\"Podcasts\"}")) {
1189 playlist_ServicesDiscoveryRemove(p_playlist, "podcast{longname=\"Podcasts\"}");
1190 playlist_ServicesDiscoveryAdd(p_playlist, "podcast{longname=\"Podcasts\"}");
1191 [[[VLCMain sharedInstance] playlist] playlistUpdated];
1196 - (void)showPodcastControls
1198 NSRect podcastViewDimensions = [o_podcast_view frame];
1199 NSRect rightSplitRect = [o_right_split_view frame];
1200 NSRect playlistTableRect = [o_playlist_table frame];
1202 podcastViewDimensions.size.width = rightSplitRect.size.width;
1203 podcastViewDimensions.origin.x = podcastViewDimensions.origin.y = .0;
1204 [o_podcast_view setFrame:podcastViewDimensions];
1206 playlistTableRect.origin.y = playlistTableRect.origin.y + podcastViewDimensions.size.height;
1207 playlistTableRect.size.height = playlistTableRect.size.height - podcastViewDimensions.size.height;
1208 [o_playlist_table setFrame:playlistTableRect];
1209 [o_playlist_table setNeedsDisplay:YES];
1211 [o_right_split_view addSubview: o_podcast_view positioned: NSWindowAbove relativeTo: o_right_split_view];
1212 b_podcastView_displayed = YES;
1215 - (void)hidePodcastControls
1217 if (b_podcastView_displayed) {
1218 NSRect podcastViewDimensions = [o_podcast_view frame];
1219 NSRect playlistTableRect = [o_playlist_table frame];
1221 playlistTableRect.origin.y = playlistTableRect.origin.y - podcastViewDimensions.size.height;
1222 playlistTableRect.size.height = playlistTableRect.size.height + podcastViewDimensions.size.height;
1224 [o_podcast_view removeFromSuperviewWithoutNeedingDisplay];
1225 [o_playlist_table setFrame: playlistTableRect];
1226 b_podcastView_displayed = NO;
1232 @implementation VLCDetachedVideoWindow
1234 - (void)awakeFromNib
1236 // sets lion fullscreen behaviour
1237 [super awakeFromNib];
1238 [self setAcceptsMouseMovedEvents: YES];
1240 if (b_dark_interface) {
1241 [self setBackgroundColor: [NSColor clearColor]];
1243 [self setOpaque: NO];
1245 [self setHasShadow:NO];
1246 [self setHasShadow:YES];
1248 NSRect winrect = [self frame];
1249 CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
1251 [self setTitle: _NS("VLC media player")];
1252 [o_titlebar_view setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight)];
1253 [[self contentView] addSubview: o_titlebar_view positioned: NSWindowAbove relativeTo: nil];
1256 [self setBackgroundColor: [NSColor blackColor]];
1259 NSRect videoViewRect = [[self contentView] bounds];
1260 if (b_dark_interface)
1261 videoViewRect.size.height -= [o_titlebar_view frame].size.height;
1262 CGFloat f_bottomBarHeight = [[self controlsBar] height];
1263 videoViewRect.size.height -= f_bottomBarHeight;
1264 videoViewRect.origin.y = f_bottomBarHeight;
1265 [o_video_view setFrame: videoViewRect];
1267 if (b_dark_interface) {
1268 o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_video_view frame]];
1269 [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_video_view];
1270 [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
1272 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[self controlsBar] height] + [o_titlebar_view frame].size.height)];
1274 [self setContentMinSize: NSMakeSize(363., f_min_video_height + [[self controlsBar] height])];
1280 if (b_dark_interface)
1281 [o_color_backdrop release];