Commit 7b80f575 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: implemented playback controls for the detached video window...

macosx: implemented playback controls for the detached video window (bwd/play/fwd, position, time, fullscreen)

2 things todo:

- get custom artwork for the fullscreen button

- implement window title when using the black ui mode
(cherry picked from commit 05a4b8a6f245d3487570dfee38bacad4a03175de)
parent 0afe7c38
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -71,6 +71,19 @@ ...@@ -71,6 +71,19 @@
IBOutlet id o_titlebar_view; IBOutlet id o_titlebar_view;
IBOutlet id o_resize_view; IBOutlet id o_resize_view;
IBOutlet id o_detached_play_btn;
IBOutlet id o_detached_fwd_btn;
IBOutlet id o_detached_bwd_btn;
IBOutlet id o_detached_fullscreen_btn;
IBOutlet id o_detached_time_fld;
IBOutlet id o_detached_time_sld;
IBOutlet id o_detached_time_sld_background;
IBOutlet id o_detached_progress_bar;
IBOutlet id o_detached_time_sld_fancygradient_view;
IBOutlet id o_detached_bottombar_view;
IBOutlet id o_detached_titlebar_view;
IBOutlet id o_detached_video_window;
BOOL b_dark_interface; BOOL b_dark_interface;
BOOL b_nativeFullscreenMode; BOOL b_nativeFullscreenMode;
BOOL b_video_playback_enabled; BOOL b_video_playback_enabled;
...@@ -101,7 +114,6 @@ ...@@ -101,7 +114,6 @@
BOOL just_triggered_previous; BOOL just_triggered_previous;
NSMutableArray *o_sidebaritems; NSMutableArray *o_sidebaritems;
VLCWindow * o_nonembedded_window;
BOOL b_nonembedded; BOOL b_nonembedded;
VLCWindow * o_fullscreen_window; VLCWindow * o_fullscreen_window;
...@@ -183,3 +195,11 @@ ...@@ -183,3 +195,11 @@
- (void)windowWillExitFullScreen:(NSNotification *)notification; - (void)windowWillExitFullScreen:(NSNotification *)notification;
@end @end
@interface VLCDetachedVideoWindow : NSWindow
{
}
- (BOOL)isFullscreen;
@end
...@@ -133,32 +133,42 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -133,32 +133,42 @@ static VLCMainWindow *_o_sharedInstance = nil;
t_hide_mouse_timer = nil; t_hide_mouse_timer = nil;
[o_play_btn setToolTip: _NS("Play/Pause")]; [o_play_btn setToolTip: _NS("Play/Pause")];
[o_detached_play_btn setToolTip: [o_play_btn toolTip]];
[o_bwd_btn setToolTip: _NS("Backward")]; [o_bwd_btn setToolTip: _NS("Backward")];
[o_detached_bwd_btn setToolTip: [o_bwd_btn toolTip]];
[o_fwd_btn setToolTip: _NS("Forward")]; [o_fwd_btn setToolTip: _NS("Forward")];
[o_detached_fwd_btn setToolTip: [o_fwd_btn toolTip]];
[o_stop_btn setToolTip: _NS("Stop")]; [o_stop_btn setToolTip: _NS("Stop")];
[o_playlist_btn setToolTip: _NS("Show/Hide Playlist")]; [o_playlist_btn setToolTip: _NS("Show/Hide Playlist")];
[o_repeat_btn setToolTip: _NS("Repeat")]; [o_repeat_btn setToolTip: _NS("Repeat")];
[o_shuffle_btn setToolTip: _NS("Shuffle")]; [o_shuffle_btn setToolTip: _NS("Shuffle")];
[o_effects_btn setToolTip: _NS("Effects")]; [o_effects_btn setToolTip: _NS("Effects")];
[o_fullscreen_btn setToolTip: _NS("Toggle Fullscreen mode")]; [o_fullscreen_btn setToolTip: _NS("Toggle Fullscreen mode")];
[o_detached_fullscreen_btn setToolTip: [o_fullscreen_btn toolTip]];
[[o_search_fld cell] setPlaceholderString: _NS("Search")]; [[o_search_fld cell] setPlaceholderString: _NS("Search")];
[o_volume_sld setToolTip: _NS("Volume")]; [o_volume_sld setToolTip: _NS("Volume")];
[o_volume_down_btn setToolTip: _NS("Mute")]; [o_volume_down_btn setToolTip: _NS("Mute")];
[o_volume_up_btn setToolTip: _NS("Full Volume")]; [o_volume_up_btn setToolTip: _NS("Full Volume")];
[o_time_sld setToolTip: _NS("Position")]; [o_time_sld setToolTip: _NS("Position")];
[o_detached_time_sld setToolTip: [o_time_sld toolTip]];
[o_dropzone_btn setTitle: _NS("Open media...")]; [o_dropzone_btn setTitle: _NS("Open media...")];
[o_dropzone_lbl setStringValue: _NS("Drop media here")]; [o_dropzone_lbl setStringValue: _NS("Drop media here")];
if (!b_dark_interface) { if (!b_dark_interface) {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]]; [o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
[o_detached_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"back"]]; [o_bwd_btn setImage: [NSImage imageNamed:@"back"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed"]]; [o_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed"]];
[o_detached_bwd_btn setImage: [NSImage imageNamed:@"back"]];
[o_detached_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed"]];
o_play_img = [[NSImage imageNamed:@"play"] retain]; o_play_img = [[NSImage imageNamed:@"play"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed"] retain]; o_play_pressed_img = [[NSImage imageNamed:@"play-pressed"] retain];
o_pause_img = [[NSImage imageNamed:@"pause"] retain]; o_pause_img = [[NSImage imageNamed:@"pause"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed"] retain]; o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward"]]; [o_fwd_btn setImage: [NSImage imageNamed:@"forward"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed"]]; [o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed"]];
[o_detached_fwd_btn setImage: [NSImage imageNamed:@"forward"]];
[o_detached_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed"]];
[o_stop_btn setImage: [NSImage imageNamed:@"stop"]]; [o_stop_btn setImage: [NSImage imageNamed:@"stop"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed"]]; [o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist"]]; [o_playlist_btn setImage: [NSImage imageNamed:@"playlist"]];
...@@ -174,6 +184,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -174,6 +184,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue"] retain]; o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed"] retain]; o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed"] retain];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]]; [o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_detached_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]]; [o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]]; [o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]]; [o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]];
...@@ -189,19 +200,27 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -189,19 +200,27 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]]; [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]]; [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
[o_detached_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_detached_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]]; [o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
[o_detached_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
} }
else else
{ {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]]; [o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
[o_detached_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"back_dark"]]; [o_bwd_btn setImage: [NSImage imageNamed:@"back_dark"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed_dark"]]; [o_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed_dark"]];
[o_detached_bwd_btn setImage: [NSImage imageNamed:@"back_dark"]];
[o_detached_bwd_btn setAlternateImage: [NSImage imageNamed:@"back-pressed_dark"]];
o_play_img = [[NSImage imageNamed:@"play_dark"] retain]; o_play_img = [[NSImage imageNamed:@"play_dark"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed_dark"] retain]; o_play_pressed_img = [[NSImage imageNamed:@"play-pressed_dark"] retain];
o_pause_img = [[NSImage imageNamed:@"pause_dark"] retain]; o_pause_img = [[NSImage imageNamed:@"pause_dark"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed_dark"] retain]; o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed_dark"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward_dark"]]; [o_fwd_btn setImage: [NSImage imageNamed:@"forward_dark"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed_dark"]]; [o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed_dark"]];
[o_detached_fwd_btn setImage: [NSImage imageNamed:@"forward_dark"]];
[o_detached_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed_dark"]];
[o_stop_btn setImage: [NSImage imageNamed:@"stop_dark"]]; [o_stop_btn setImage: [NSImage imageNamed:@"stop_dark"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed_dark"]]; [o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed_dark"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist_dark"]]; [o_playlist_btn setImage: [NSImage imageNamed:@"playlist_dark"]];
...@@ -217,6 +236,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -217,6 +236,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue_dark"] retain]; o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue_dark"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed_dark"] retain]; o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed_dark"] retain];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]]; [o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
[o_detached_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]]; [o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]]; [o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]]; [o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]];
...@@ -232,7 +252,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -232,7 +252,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]]; [o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]]; [o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
[o_detached_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
[o_detached_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]]; [o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]];
[o_detached_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]];
} }
[o_repeat_btn setImage: o_repeat_img]; [o_repeat_btn setImage: o_repeat_img];
[o_repeat_btn setAlternateImage: o_repeat_pressed_img]; [o_repeat_btn setAlternateImage: o_repeat_pressed_img];
...@@ -240,6 +263,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -240,6 +263,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_shuffle_btn setAlternateImage: o_shuffle_pressed_img]; [o_shuffle_btn setAlternateImage: o_shuffle_pressed_img];
[o_play_btn setImage: o_play_img]; [o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img]; [o_play_btn setAlternateImage: o_play_pressed_img];
[o_detached_play_btn setImage: o_play_img];
[o_detached_play_btn setAlternateImage: o_play_pressed_img];
BOOL b_mute = ![[VLCCoreInteraction sharedInstance] isMuted]; BOOL b_mute = ![[VLCCoreInteraction sharedInstance] isMuted];
[o_volume_sld setEnabled: b_mute]; [o_volume_sld setEnabled: b_mute];
[o_volume_up_btn setEnabled: b_mute]; [o_volume_up_btn setEnabled: b_mute];
...@@ -458,6 +483,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -458,6 +483,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame.origin.y = frame.origin.y + 1; frame.origin.y = frame.origin.y + 1;
[o_time_sld_fancygradient_view setFrame: frame]; [o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.height = frame.size.height - 1;
frame.origin.y = frame.origin.y + 1;
[o_detached_time_sld_fancygradient_view setFrame: frame];
[o_video_view setFrame: [o_split_view frame]]; [o_video_view setFrame: [o_split_view frame]];
[o_playlist_table setBorderType: NSNoBorder]; [o_playlist_table setBorderType: NSNoBorder];
[o_sidebar_scrollview setBorderType: NSNoBorder]; [o_sidebar_scrollview setBorderType: NSNoBorder];
...@@ -468,6 +498,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -468,6 +498,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame.size.width = 0; frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame]; [o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_detached_time_sld_fancygradient_view setFrame: frame];
if (OSX_LION) if (OSX_LION)
[o_resize_view setImage: NULL]; [o_resize_view setImage: NULL];
...@@ -590,7 +624,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -590,7 +624,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (IBAction)togglePlaylist:(id)sender - (IBAction)togglePlaylist:(id)sender
{ {
if ( ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) && !b_splitview_removed && ![[VLCMain sharedInstance] activeVideoPlayback]) || (b_nonembedded && [[VLCMain sharedInstance] activeVideoPlayback] && sender != nil) ) BOOL b_activeVideo = [[VLCMain sharedInstance] activeVideoPlayback];
if ( ((([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask) != 0) && !b_splitview_removed && !b_activeVideo) || (b_nonembedded && b_activeVideo && sender != nil) )
{ {
[self hideSplitView]; [self hideSplitView];
} }
...@@ -602,7 +638,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -602,7 +638,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self showSplitView]; [self showSplitView];
} }
if (b_dropzone_active && ![[VLCMain sharedInstance] activeVideoPlayback]) if (b_dropzone_active && !b_activeVideo)
{ {
b_dropzone_active = NO; b_dropzone_active = NO;
[self hideDropZone]; [self hideDropZone];
...@@ -610,7 +646,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -610,7 +646,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (!b_nonembedded) if (!b_nonembedded)
{ {
if ([o_video_view isHidden] && [[VLCMain sharedInstance] activeVideoPlayback]) { if ([o_video_view isHidden] && b_activeVideo) {
[o_split_view setHidden: YES]; [o_split_view setHidden: YES];
[o_video_view setHidden: NO]; [o_video_view setHidden: NO];
[self makeFirstResponder: o_video_view]; [self makeFirstResponder: o_video_view];
...@@ -626,7 +662,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -626,7 +662,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
[o_split_view setHidden: NO]; [o_split_view setHidden: NO];
[o_playlist_table setHidden: NO]; [o_playlist_table setHidden: NO];
[o_video_view setHidden: ![[VLCMain sharedInstance] activeVideoPlayback]]; [o_video_view setHidden: !b_activeVideo];
if (b_activeVideo)
[o_detached_video_window makeFirstResponder: o_video_view];
} }
} }
} }
...@@ -794,7 +832,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -794,7 +832,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (b_dark_interface) if (b_dark_interface)
[o_titlebar_view setWindowTitle: title]; [o_titlebar_view setWindowTitle: title];
if (b_nonembedded && [[VLCMain sharedInstance] activeVideoPlayback]) if (b_nonembedded && [[VLCMain sharedInstance] activeVideoPlayback])
[o_nonembedded_window setTitle: title]; [o_detached_video_window setTitle: title];
[super setTitle: title]; [super setTitle: title];
} }
...@@ -811,7 +849,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -811,7 +849,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
else else
{ {
if( b_nonembedded && o_key_window != self ) if( b_nonembedded && o_key_window != self )
[o_nonembedded_window performClose: sender]; [o_detached_video_window performClose: sender];
else else
[super performClose: sender]; [super performClose: sender];
} }
...@@ -962,7 +1000,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -962,7 +1000,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)someWindowWillClose:(NSNotification *)notification - (void)someWindowWillClose:(NSNotification *)notification
{ {
if([notification object] == o_nonembedded_window || ([notification object] == self && !b_nonembedded)) if([notification object] == o_detached_video_window || ([notification object] == self && !b_nonembedded))
{ {
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] stop]; [[VLCCoreInteraction sharedInstance] stop];
...@@ -973,7 +1011,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -973,7 +1011,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
if (config_GetInt( VLCIntf, "macosx-pause-minimized" )) if (config_GetInt( VLCIntf, "macosx-pause-minimized" ))
{ {
if([notification object] == o_nonembedded_window || [notification object] == self) if([notification object] == o_detached_video_window || [notification object] == self)
{ {
if([[VLCMain sharedInstance] activeVideoPlayback]) if([[VLCMain sharedInstance] activeVideoPlayback])
[[VLCCoreInteraction sharedInstance] pause]; [[VLCCoreInteraction sharedInstance] pause];
...@@ -1088,7 +1126,13 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1088,7 +1126,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_time_sld setEnabled: NO]; [o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES]; [o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES]; [o_time_sld_fancygradient_view setHidden: YES];
[o_detached_time_sld_fancygradient_view setHidden: YES];
} }
[o_detached_time_sld setFloatValue: [o_time_sld floatValue]];
[o_detached_time_sld setEnabled: [o_time_sld isEnabled]];
[o_detached_time_fld setStringValue: [o_time_fld stringValue]];
[o_detached_time_sld setHidden: [o_time_sld isHidden]];
} }
- (void)updateVolumeSlider - (void)updateVolumeSlider
...@@ -1209,6 +1253,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1209,6 +1253,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_stop_btn setEnabled: b_input]; [o_stop_btn setEnabled: b_input];
[o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_detached_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_detached_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control]; [[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
[o_time_sld setEnabled: b_seekable]; [o_time_sld setEnabled: b_seekable];
...@@ -1229,6 +1275,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1229,6 +1275,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_play_btn setImage: o_pause_img]; [o_play_btn setImage: o_pause_img];
[o_play_btn setAlternateImage: o_pause_pressed_img]; [o_play_btn setAlternateImage: o_pause_pressed_img];
[o_play_btn setToolTip: _NS("Pause")]; [o_play_btn setToolTip: _NS("Pause")];
[o_detached_play_btn setImage: o_pause_img];
[o_detached_play_btn setAlternateImage: o_pause_pressed_img];
[o_detached_play_btn setToolTip: _NS("Pause")];
[o_fspanel setPause]; [o_fspanel setPause];
} }
...@@ -1237,6 +1286,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1237,6 +1286,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_play_btn setImage: o_play_img]; [o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img]; [o_play_btn setAlternateImage: o_play_pressed_img];
[o_play_btn setToolTip: _NS("Play")]; [o_play_btn setToolTip: _NS("Play")];
[o_detached_play_btn setImage: o_play_img];
[o_detached_play_btn setAlternateImage: o_play_pressed_img];
[o_detached_play_btn setToolTip: _NS("Play")];
[o_fspanel setPlay]; [o_fspanel setPlay];
} }
...@@ -1256,6 +1308,18 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1256,6 +1308,18 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_time_sld_fancygradient_view setHidden: NO]; [o_time_sld_fancygradient_view setHidden: NO];
[o_time_sld_fancygradient_view setFrame: NSMakeRect( oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height )]; [o_time_sld_fancygradient_view setFrame: NSMakeRect( oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height )];
} }
if (b_nonembedded)
{
f_value = [o_detached_time_sld knobPosition];
oldFrame = [o_detached_time_sld_fancygradient_view frame];
if (f_value != oldFrame.size.width)
{
if ([o_detached_time_sld_fancygradient_view isHidden])
[o_detached_time_sld_fancygradient_view setHidden: NO];
[o_detached_time_sld_fancygradient_view setFrame: NSMakeRect( oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height )];
}
}
} }
else else
{ {
...@@ -1265,8 +1329,13 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1265,8 +1329,13 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
frame.size.width = 0; frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame]; [o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_detached_time_sld_fancygradient_view setFrame: frame];
} }
[o_time_sld_fancygradient_view setHidden: YES]; [o_time_sld_fancygradient_view setHidden: YES];
[o_detached_time_sld_fancygradient_view setHidden: YES];
} }
[o_pool release]; [o_pool release];
} }
...@@ -1295,22 +1364,17 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1295,22 +1364,17 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
if ([o_video_view superview] != NULL) if ([o_video_view superview] != NULL)
[o_video_view removeFromSuperviewWithoutNeedingDisplay]; [o_video_view removeFromSuperviewWithoutNeedingDisplay];
if (o_nonembedded_window)
[o_nonembedded_window release]; NSRect frame = [o_detached_video_window frame];
NSRect videoFrame = [o_video_view frame];
o_nonembedded_window = [[VLCWindow alloc] initWithContentRect:[o_video_view frame] styleMask: NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask backing:NSBackingStoreBuffered defer:YES]; frame.size.width = videoFrame.size.width;
[o_nonembedded_window setFrame:[o_video_view frame] display:NO]; frame.size.height = videoFrame.size.height + [o_detached_bottombar_view frame].size.height + [o_titlebar_view frame].size.height;
[o_nonembedded_window setBackgroundColor: [NSColor blackColor]]; [o_detached_video_window setFrame: frame display: NO];
[o_nonembedded_window setMovableByWindowBackground: YES]; [[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
[o_nonembedded_window setCanBecomeKeyWindow: YES]; [o_detached_video_window setLevel:NSNormalWindowLevel];
[o_nonembedded_window setHasShadow:YES]; [o_detached_video_window useOptimizedDrawing: YES];
[o_nonembedded_window setContentView: o_video_view]; [o_detached_video_window center];
[o_nonembedded_window setLevel:NSNormalWindowLevel]; [o_detached_video_window makeKeyAndOrderFront:self];
[o_nonembedded_window useOptimizedDrawing: YES];
[o_nonembedded_window center];
[o_nonembedded_window makeKeyAndOrderFront:self];
[o_nonembedded_window orderFront:self animate:YES];
[o_nonembedded_window setReleasedWhenClosed:NO];
b_nonembedded = YES; b_nonembedded = YES;
} }
...@@ -1330,7 +1394,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1330,7 +1394,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback]; BOOL b_videoPlayback = [[VLCMain sharedInstance] activeVideoPlayback];
if (!b_videoPlayback) if (!b_videoPlayback)
[o_nonembedded_window orderOut: nil]; [o_detached_video_window orderOut: nil];
if( OSX_LION && b_nativeFullscreenMode ) if( OSX_LION && b_nativeFullscreenMode )
{ {
if( [NSApp presentationOptions] & NSApplicationPresentationFullScreen ) if( [NSApp presentationOptions] & NSApplicationPresentationFullScreen )
...@@ -1444,7 +1508,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1444,7 +1508,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
NSRect rect; NSRect rect;
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" ); BOOL blackout_other_displays = config_GetInt( VLCIntf, "macosx-black" );
id o_videoWindow = b_nonembedded ? o_nonembedded_window : self; id o_videoWindow = b_nonembedded ? o_detached_video_window : self;
if( p_vout ) if( p_vout )
screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)config_GetInt( VLCIntf, "macosx-vdev" )]; screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)config_GetInt( VLCIntf, "macosx-vdev" )];
...@@ -1547,7 +1611,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1547,7 +1611,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
{ {
/* Make sure we are hidden */ /* Make sure we are hidden */
if( b_nonembedded ) if( b_nonembedded )
[o_nonembedded_window orderOut: self]; [o_detached_video_window orderOut: self];
else else
[super orderOut: self]; [super orderOut: self];
...@@ -1622,8 +1686,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1622,8 +1686,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( !b_nonembedded && [self isVisible] ) if( !b_nonembedded && [self isVisible] )
[super orderOut: self]; [super orderOut: self];
if( b_nonembedded && [o_nonembedded_window isVisible] ) if( b_nonembedded && [o_detached_video_window isVisible] )
[o_nonembedded_window orderOut: self]; [o_detached_video_window orderOut: self];
[o_fspanel setActive: nil]; [o_fspanel setActive: nil];
...@@ -1702,7 +1766,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1702,7 +1766,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
return; return;
} }
id o_videoWindow = b_nonembedded ? o_nonembedded_window : self; id o_videoWindow = b_nonembedded ? o_detached_video_window : self;
[o_videoWindow setAlphaValue: 0.0]; [o_videoWindow setAlphaValue: 0.0];
[o_videoWindow orderFront: self]; [o_videoWindow orderFront: self];
...@@ -1790,7 +1854,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1790,7 +1854,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
// if we quit fullscreen because there is no video anymore, make sure non-embedded window is not visible // if we quit fullscreen because there is no video anymore, make sure non-embedded window is not visible
if( ![[VLCMain sharedInstance] activeVideoPlayback] && b_nonembedded ) if( ![[VLCMain sharedInstance] activeVideoPlayback] && b_nonembedded )
[o_nonembedded_window orderOut: self]; [o_detached_video_window orderOut: self];
[self unlockFullscreenAnimation]; [self unlockFullscreenAnimation];
} }
...@@ -2162,3 +2226,42 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2162,3 +2226,42 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
@end @end
@implementation VLCDetachedVideoWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)backingType defer:(BOOL)flag
{
BOOL b_dark_interface = config_GetInt( VLCIntf, "macosx-interfacestyle" );
if (b_dark_interface)
{
#ifdef MAC_OS_X_VERSION_10_7
if (OSX_LION)
styleMask = NSBorderlessWindowMask | NSResizableWindowMask;
else
styleMask = NSBorderlessWindowMask;
#else
styleMask = NSBorderlessWindowMask;
#endif
}
self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag];
/* we want to be moveable regardless of our style */
[self setMovableByWindowBackground: YES];
/* we don't want this window to be restored on relaunch */
if (OSX_LION)
[self setRestorable:NO];
return self;
}
- (BOOL)isFullscreen
{
return [[VLCMainWindow sharedInstance] isFullscreen];
}
@end
...@@ -154,6 +154,7 @@ struct intf_sys_t ...@@ -154,6 +154,7 @@ struct intf_sys_t
- (void)setIntf:(intf_thread_t *)p_mainintf; - (void)setIntf:(intf_thread_t *)p_mainintf;
- (id)mainMenu; - (id)mainMenu;
- (id)mainWindow;
- (id)controls; - (id)controls;
- (id)bookmarks; - (id)bookmarks;
- (id)open; - (id)open;
......
...@@ -1563,6 +1563,11 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1563,6 +1563,11 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return o_mainmenu; return o_mainmenu;
} }
- (id)mainWindow
{
return o_mainwindow;
}
- (id)controls - (id)controls
{ {
if( o_controls ) if( o_controls )
......
...@@ -669,7 +669,7 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -669,7 +669,7 @@ void _drawFrameInRect(NSRect frameRect)
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect
{ {
[(VLCMainWindow *)[self window] drawFancyGradientEffectForTimeSlider]; [[[VLCMain sharedInstance] mainWindow] drawFancyGradientEffectForTimeSlider];
msleep( 10000 ); //wait for the gradient to draw completely msleep( 10000 ); //wait for the gradient to draw completely
/* Draw default to make sure the slider behaves correctly */ /* Draw default to make sure the slider behaves correctly */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment