Commit cf37037f authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: prepared fullscreen support and clean-up

parent 4cfebf25
......@@ -261,22 +261,12 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
- (void)toggleFullscreen
{
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if( p_input != NULL )
{
vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout != NULL )
{
id o_vout_view = [self voutView];
if( o_vout_view )
[o_vout_view toggleFullscreen];
vlc_object_release( p_vout );
}
else
{
playlist_t * p_playlist = pl_Get( VLCIntf );
var_ToggleBool( p_playlist, "fullscreen" );
}
playlist_t * p_playlist = pl_Get( VLCIntf );
var_ToggleBool( p_playlist, "fullscreen" );
vlc_object_release( p_input );
}
}
......
......@@ -209,6 +209,11 @@
- (IBAction)setPlaybackRate:(id)sender;
- (void)updatePlaybackRate;
- (IBAction)toggleFullscreen:(id)sender;
- (IBAction)resizeVideoWindow:(id)sender;
- (IBAction)floatOnTop:(id)sender;
- (IBAction)createVideoSnapshot:(id)sender;
- (IBAction)showWizard:(id)sender;
- (IBAction)showVideoEffects:(id)sender;
- (IBAction)showAudioEffects:(id)sender;
......
......@@ -39,6 +39,7 @@
#import "playlistinfo.h"
#import "vout.h"
#import "CoreInteraction.h"
#import "MainWindow.h"
@implementation VLCMainMenu
static VLCMainMenu *_o_sharedInstance = nil;
......@@ -560,6 +561,68 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_rate_sld setIntValue: i];
}
#pragma mark -
#pragma video menu
- (IBAction)toggleFullscreen:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
- (IBAction)resizeVideoWindow:(id)sender
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
if (p_input)
{
vout_thread_t *p_vout = getVout();
if (p_vout)
{
if (sender == o_mi_half_window)
var_SetFloat( p_vout, "zoom", 0.5 );
else if (sender == o_mi_normal_window)
var_SetFloat( p_vout, "zoom", 1.0 );
else if (sender == o_mi_double_window)
var_SetFloat( p_vout, "zoom", 2.0 );
else
{
if (![[VLCMainWindow sharedInstance] isZoomed])
[[VLCMainWindow sharedInstance] performZoom: sender];
}
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
}
- (IBAction)floatOnTop:(id)sender
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
if (p_input)
{
vout_thread_t *p_vout = getVout();
if (p_vout)
{
var_ToggleBool( p_vout, "video-on-top" );
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
}
- (IBAction)createVideoSnapshot:(id)sender
{
input_thread_t *p_input = pl_CurrentInput( VLCIntf );
if (p_input)
{
vout_thread_t *p_vout = getVout();
if (p_vout)
{
var_TriggerCallback( p_vout, "video-snapshot" );
vlc_object_release( p_vout );
}
vlc_object_release( p_input );
}
}
#pragma mark -
#pragma mark Panels
......@@ -1132,9 +1195,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_title isEqualToString: _NS("Fullscreen")] ||
[o_title isEqualToString: _NS("Float on Top")] )
{
id o_window;
NSArray *o_windows = [NSApp orderedWindows];
NSEnumerator *o_enumerator = [o_windows objectEnumerator];
bEnabled = FALSE;
if( p_input != NULL )
......@@ -1148,16 +1208,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi setState: val.b_bool ? NSOnState : NSOffState];
}
while( (o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
[[[VLCMain sharedInstance] embeddedList]
windowContainsEmbedded: o_window])
{
bEnabled = TRUE;
break;
}
}
bEnabled = TRUE;
vlc_object_release( (vlc_object_t *)p_vout );
}
......
......@@ -29,7 +29,11 @@
#import <vlc_input.h>
#import "misc.h"
@interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate> {
#ifndef MAC_OS_X_VERSION_10_6
@protocol NSAnimationDelegate <NSObject> @end
#endif
@interface VLCMainWindow : NSWindow <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate> {
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
......@@ -90,6 +94,19 @@
BOOL just_triggered_next;
BOOL just_triggered_previous;
NSMutableArray *o_sidebaritems;
VLCWindow * o_fullscreen_window;
NSViewAnimation * o_fullscreen_anim1;
NSViewAnimation * o_fullscreen_anim2;
NSViewAnimation * o_makekey_anim;
NSView * o_temp_view;
/* set to yes if we are fullscreen and all animations are over */
BOOL b_fullscreen;
BOOL b_window_is_invisible;
NSRecursiveLock * o_animation_lock;
NSSize nativeVideoSize;
NSInteger i_originalLevel;
}
+ (VLCMainWindow *)sharedInstance;
......@@ -106,8 +123,6 @@
- (IBAction)fullscreen:(id)sender;
- (IBAction)dropzoneButtonAction:(id)sender;
- (id)videoView;
- (void)setVideoplayEnabled;
- (void)showDropZone;
- (void)hideDropZone;
- (void)updateTimeSlider;
......@@ -123,6 +138,22 @@
- (void)drawFancyGradientEffectForTimeSlider;
- (id)videoView;
- (void)setVideoplayEnabled;
- (void)resizeWindow;
- (void)setNativeVideoSize:(NSSize)size;
/* fullscreen handling */
- (BOOL)isFullscreen;
- (void)lockFullscreenAnimation;
- (void)unlockFullscreenAnimation;
- (void)enterFullscreen;
- (void)leaveFullscreen;
- (void)leaveFullscreenAndFadeOut: (BOOL)fadeout;
- (void)hasEndedFullscreen;
- (void)hasBecomeFullscreen;
- (void)setFrameOnMainThread:(NSData*)packedargs;
@end
@interface VLCProgressBarGradientEffect : NSView {
......
This diff is collapsed.
......@@ -63,9 +63,6 @@
- (IBAction)volumeSliderUpdated:(id)sender;
- (IBAction)showPosition: (id)sender;
- (IBAction)toogleFullscreen:(id)sender;
- (BOOL)isFullscreen;
- (IBAction)windowAction:(id)sender;
- (IBAction)telxTransparent:(id)sender;
- (IBAction)telxNavLink:(id)sender;
......
......@@ -186,52 +186,6 @@
return NO;
}
- (IBAction)windowAction:(id)sender
{
NSString *o_title = [sender title];
input_thread_t * p_input = pl_CurrentInput( VLCIntf );
if( p_input != NULL )
{
vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout != NULL )
{
id o_vout_view = [[VLCCoreInteraction sharedInstance] voutView];
if( o_vout_view )
{
if( [o_title isEqualToString: _NS("Half Size") ] )
[o_vout_view scaleWindowWithFactor: 0.5 animate: YES];
else if( [o_title isEqualToString: _NS("Normal Size") ] )
[o_vout_view scaleWindowWithFactor: 1.0 animate: YES];
else if( [o_title isEqualToString: _NS("Double Size") ] )
[o_vout_view scaleWindowWithFactor: 2.0 animate: YES];
else if( [o_title isEqualToString: _NS("Float on Top") ] )
[o_vout_view toggleFloatOnTop];
else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
{
id o_window = [o_vout_view voutWindow];
if( ![o_window isZoomed] )
[o_window performZoom:self];
}
else if( [o_title isEqualToString: _NS("Snapshot") ] )
{
[o_vout_view snapshot];
}
else
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
}
vlc_object_release( (vlc_object_t *)p_vout );
}
else
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
vlc_object_release( p_input );
}
}
- (IBAction)telxTransparent:(id)sender
{
vlc_object_t *p_vbi;
......
......@@ -108,7 +108,7 @@ struct intf_sys_t
BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */
BOOL b_active_videoplayback;
IBOutlet id o_mainwindow; /* VLCMainWindow */
id o_mainwindow; /* VLCMainWindow */
IBOutlet VLCControls * o_controls; /* VLCControls */
IBOutlet VLCPlaylist * o_playlist; /* VLCPlaylist */
......@@ -159,6 +159,7 @@ struct intf_sys_t
- (id)wizard;
- (id)embeddedList;
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
- (void)setNativeVideoSize:(NSSize)size;
- (id)coreDialogProvider;
- (id)eyeTVController;
- (id)appleRemoteController;
......@@ -172,6 +173,7 @@ struct intf_sys_t
- (NSString *)VLCKeyToString:(NSString *)theString;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
- (void)updateCurrentlyUsedHotkeys;
- (void)fullscreenChanged;
- (void)PlaylistItemChanged;
- (void)playbackStatusUpdated;
- (void)playbackModeUpdated;
......
......@@ -132,7 +132,6 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
return VLC_EGENERIC;
}
msg_Dbg( p_wnd, "looking for video view" );
int i_x = cfg->x;
int i_y = cfg->y;
unsigned i_width = cfg->width;
......@@ -145,6 +144,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
return VLC_EGENERIC;
}
[[VLCMain sharedInstance] setNativeVideoSize:NSMakeSize( cfg->width, cfg->height )];
[[VLCMain sharedInstance] setActiveVideoPlayback: YES];
p_wnd->control = WindowControl;
p_wnd->sys = (vout_window_sys_t *)VLCIntf;
......@@ -158,7 +158,12 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
if( i_query == VOUT_WINDOW_SET_STATE )
NSLog( @"WindowControl:VOUT_WINDOW_SET_STATE" );
else if( i_query == VOUT_WINDOW_SET_SIZE )
{
NSLog( @"WindowControl:VOUT_WINDOW_SET_SIZE" );
unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int );
[[VLCMain sharedInstance] setNativeVideoSize:NSMakeSize( i_width, i_height )];
}
else if( i_query == VOUT_WINDOW_SET_FULLSCREEN )
NSLog( @"WindowControl:VOUT_WINDOW_SET_FULLSCREEN" );
else
......@@ -340,7 +345,7 @@ static int VolumeUpdated( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param )
{
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] updateVolume];
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(updateVolume) withObject:nil waitUntilDone:NO];
[o_pool release];
return VLC_SUCCESS;
......@@ -357,12 +362,7 @@ static int ShowController( vlc_object_t *p_this, const char *psz_variable,
intf_thread_t * p_intf = VLCIntf;
if( p_intf && p_intf->p_sys )
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
if( [[[VLCCoreInteraction sharedInstance] voutView] isFullscreen] && config_GetInt( VLCIntf, "macosx-fspanel" ) )
[[[[VLCMain sharedInstance] controls] fspanel] fadeIn];
else
[[VLCMainWindow sharedInstance] makeKeyAndOrderFront: nil];
[o_pool release];
NSLog( @"fixme! we should implement ShowController here" );
}
return VLC_SUCCESS;
}
......@@ -375,8 +375,12 @@ static int FullscreenChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t * p_intf = VLCIntf;
if( p_intf && p_intf->p_sys )
NSLog( @"we should update fullscreen state" ); //FIXME
if (p_intf)
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] fullscreenChanged];
[o_pool release];
}
return VLC_SUCCESS;
}
......@@ -1229,6 +1233,14 @@ unsigned int CocoaKeyToVLC( unichar i_key )
#pragma mark -
#pragma mark Interface updaters
- (void)fullscreenChanged
{
if(! [o_mainwindow isFullscreen] )
[o_mainwindow performSelectorOnMainThread:@selector(enterFullscreen) withObject:nil waitUntilDone:NO];
else
[o_mainwindow performSelectorOnMainThread:@selector(leaveFullscreen) withObject:nil waitUntilDone:NO];
}
- (void)PlaylistItemChanged
{
input_thread_t * p_input;
......@@ -1240,7 +1252,8 @@ unsigned int CocoaKeyToVLC( unichar i_key )
[o_mainmenu setRateControlsEnabled: YES];
vlc_object_release( p_input );
}
else[o_mainmenu setRateControlsEnabled: NO];
else
[o_mainmenu setRateControlsEnabled: NO];
[o_playlist updateRowSelection];
[o_mainwindow updateWindow];
......@@ -1441,6 +1454,11 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return videoView;
}
- (void)setNativeVideoSize:(NSSize)size
{
[o_mainwindow setNativeVideoSize:size];
}
- (id)embeddedList
{
if( o_embedded_list )
......@@ -1748,10 +1766,8 @@ unsigned int CocoaKeyToVLC( unichar i_key )
- (IBAction)saveDebugLog:(id)sender
{
NSOpenPanel * saveFolderPanel = [[NSSavePanel alloc] init];
NSSavePanel * saveFolderPanel = [[NSSavePanel alloc] init];
[saveFolderPanel setCanChooseDirectories: NO];
[saveFolderPanel setCanChooseFiles: YES];
[saveFolderPanel setCanSelectHiddenExtension: NO];
[saveFolderPanel setCanCreateDirectories: YES];
[saveFolderPanel setAllowedFileTypes: [NSArray arrayWithObject:@"rtfd"]];
......
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