Commit 6f54a530 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* New Fullscreen controller panel

- basically written by Jerome Decoodt <djc at videolan dot org> aka DiDjCodt
plus
- various patches, coding-style fixes, etc. here and there
- integration to VLCControls
- automagic fading-in and -out when in fullscreen mode

TODO:
- get and use native graphics. These are currently being prepared by Simon Damkjaer Andersen, who already donated new playback mode icons (to be committed soon)
- implement the volume slider
- fix seeking with the time slider
- check for memory leaks
- further clean-up

ATTENTION:
for the moment, you need certain images from Jerome's patch to get this running. Put them to extras/MacOSX/Resources/ and it'll work. Otherwise, VLC won't crash, but only show strings.
parent 277e9ab5
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
CLASS = VLCControls; CLASS = VLCControls;
LANGUAGE = ObjC; LANGUAGE = ObjC;
OUTLETS = { OUTLETS = {
"o_fs_panel" = id;
"o_main" = id; "o_main" = id;
"o_specificTime_cancel_btn" = id; "o_specificTime_cancel_btn" = id;
"o_specificTime_enter_fld" = id; "o_specificTime_enter_fld" = id;
...@@ -98,6 +99,14 @@ ...@@ -98,6 +99,14 @@
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
}, },
{CLASS = VLCFSPanel; LANGUAGE = ObjC; SUPERCLASS = NSWindow; },
{
ACTIONS = {faster = id; next = id; play = id; prev = id; slower = id; };
CLASS = VLCFSPanelView;
LANGUAGE = ObjC;
SUPERCLASS = NSView;
},
{CLASS = VLCFSTimeSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; },
{ {
ACTIONS = { ACTIONS = {
createOutlineGroup = id; createOutlineGroup = id;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <key>IBDocumentLocation</key>
<string>361 41 478 430 0 0 1440 878 </string> <string>443 64 478 430 0 0 1440 878 </string>
<key>IBEditorPositions</key> <key>IBEditorPositions</key>
<dict> <dict>
<key>1617</key> <key>1617</key>
...@@ -25,11 +25,12 @@ ...@@ -25,11 +25,12 @@
<array/> <array/>
<key>IBOpenObjects</key> <key>IBOpenObjects</key>
<array> <array>
<integer>2416</integer>
<integer>29</integer>
<integer>21</integer> <integer>21</integer>
<integer>2730</integer>
<integer>2197</integer> <integer>2197</integer>
<integer>2416</integer>
<integer>2730</integer>
<integer>29</integer>
<integer>2769</integer>
</array> </array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>8J135</string> <string>8J135</string>
......
This diff is collapsed.
...@@ -42,6 +42,8 @@ SOURCES_macosx = \ ...@@ -42,6 +42,8 @@ SOURCES_macosx = \
sfilters.m \ sfilters.m \
embeddedwindow.h \ embeddedwindow.h \
embeddedwindow.m \ embeddedwindow.m \
fspanel.m \
fspanel.h \
update.h \ update.h \
update.m \ update.m \
$(NULL) $(NULL)
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import "fspanel.h"
/***************************************************************************** /*****************************************************************************
* VLCControls interface * VLCControls interface
*****************************************************************************/ *****************************************************************************/
...@@ -41,6 +43,8 @@ ...@@ -41,6 +43,8 @@
IBOutlet id o_specificTime_sec_lbl; IBOutlet id o_specificTime_sec_lbl;
IBOutlet id o_specificTime_stepper; IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi; IBOutlet id o_specificTime_mi;
VLCFSPanel *o_fs_panel;
} }
- (IBAction)play:(id)sender; - (IBAction)play:(id)sender;
...@@ -79,6 +83,8 @@ ...@@ -79,6 +83,8 @@
- (IBAction)goToSpecificTime:(id)sender; - (IBAction)goToSpecificTime:(id)sender;
- (id)getFSPanel;
@end @end
/***************************************************************************** /*****************************************************************************
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <string.h> #include <string.h>
#include "intf.h" #include "intf.h"
#include "fspanel.h"
#include "vout.h" #include "vout.h"
#include "open.h" #include "open.h"
#include "controls.h" #include "controls.h"
...@@ -43,6 +44,13 @@ ...@@ -43,6 +44,13 @@
*****************************************************************************/ *****************************************************************************/
@implementation VLCControls @implementation VLCControls
- (id)init
{
[super init];
o_fs_panel = [[VLCFSPanel alloc] init];
return self;
}
- (void)awakeFromNib - (void)awakeFromNib
{ {
[o_specificTime_mi setTitle: _NS("Jump To Time")]; [o_specificTime_mi setTitle: _NS("Jump To Time")];
...@@ -670,6 +678,17 @@ ...@@ -670,6 +678,17 @@
} }
} }
- (id)getFSPanel
{
if( o_fs_panel )
return o_fs_panel;
else
{
msg_Err( VLCIntf, "FSPanel is nil" );
return NULL;
}
}
@end @end
@implementation VLCControls (NSMenuValidation) @implementation VLCControls (NSMenuValidation)
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
*****************************************************************************/ *****************************************************************************/
#include "intf.h" #include "intf.h"
#include "fspanel.h"
#include "vout.h" #include "vout.h"
#include "embeddedwindow.h" #include "embeddedwindow.h"
......
/*****************************************************************************
* fspanel.h: MacOS X full screen panel
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
*
* Authors: Jrme Decoodt <djc at videolan dot org>
* Felix Khne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
@interface VLCFSPanel : NSWindow
{
NSTimer *fadeTimer,*hideAgainTimer;
NSPoint mouseClic;
BOOL b_fadeQueued;
BOOL b_keptVisible;
BOOL b_alreadyCounting;
int i_timeToKeepVisibleInSec;
}
- (id)initWithContentRect: (NSRect)contentRect
styleMask: (unsigned int)aStyle
backing: (NSBackingStoreType)bufferingType
defer: (BOOL)flag;
- (void)awakeFromNib;
- (BOOL)canBecomeKeyWindow;
- (void)dealloc;
- (void)setPlay;
- (void)setPause;
- (void)setStreamTitle:(NSString *)o_title;
- (void)setStreamPos:(float) f_pos setSeconds:(int)i_seconds;
- (void)focus:(NSTimer *)timer;
- (void)unfocus:(NSTimer *)timer;
- (void)mouseEntered:(NSEvent *)theEvent;
- (void)mouseExited:(NSEvent *)theEvent;
- (void)fadeIn;
- (void)fadeOut;
- (NSTimer *)fadeTimer;
- (void)setFadeTimer:(NSTimer *)timer;
- (void)autoHide;
- (void)keepVisible:(NSTimer *)timer;
- (void)mouseDown:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
@end
@interface VLCFSPanelView : NSView
{
NSColor *fillColor;
NSButton *o_prev, *o_next, *o_slow, *o_fast, *o_play, *o_fullscreen;
NSTextField *o_textfield, *o_textPos;
NSSlider *o_time_slider;
}
- (id)initWithFrame:(NSRect)frameRect;
- (void)drawRect:(NSRect)rect;
- (void) setPlay;
- (void) setPause;
- (void) setStreamTitle: (NSString *)o_title;
- (void) setStreamPos:(float) f_pos setSeconds:(int)i_seconds;
- (IBAction)play:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)faster:(id)sender;
- (IBAction)slower:(id)sender;
@end
@interface VLCFSTimeSlider : NSSlider
{}
void drawKnobInRect(NSRect knobRect);
void drawFrameInRect(NSRect frameRect);
- (void)drawRect:(NSRect)rect;
@end
This diff is collapsed.
...@@ -146,6 +146,7 @@ struct intf_sys_t ...@@ -146,6 +146,7 @@ struct intf_sys_t
IBOutlet id o_msgs_btn_crashlog; /* messages open crashlog */ IBOutlet id o_msgs_btn_crashlog; /* messages open crashlog */
IBOutlet id o_info_window; /* Info panel */ IBOutlet id o_info_window; /* Info panel */
IBOutlet id o_fs_panel; /* Full screen panel*/
/* main menu */ /* main menu */
......
...@@ -32,21 +32,22 @@ ...@@ -32,21 +32,22 @@
#include <string.h> #include <string.h>
#include <vlc_keys.h> #include <vlc_keys.h>
#include "intf.h" #import "intf.h"
#include "vout.h" #import "fspanel.h"
#include "prefs.h" #import "vout.h"
#include "playlist.h" #import "prefs.h"
#include "controls.h" #import "playlist.h"
#include "about.h" #import "controls.h"
#include "open.h" #import "about.h"
#include "wizard.h" #import "open.h"
#include "extended.h" #import "wizard.h"
#include "bookmarks.h" #import "extended.h"
#include "sfilters.h" #import "bookmarks.h"
#include "interaction.h" #import "sfilters.h"
#include "embeddedwindow.h" #import "interaction.h"
#include "update.h" #import "embeddedwindow.h"
#include "AppleRemote.h" #import "update.h"
#import "AppleRemote.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
...@@ -479,6 +480,9 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -479,6 +480,9 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback( p_intf, "interaction", InteractCallback, self ); var_AddCallback( p_intf, "interaction", InteractCallback, self );
p_intf->b_interaction = VLC_TRUE; p_intf->b_interaction = VLC_TRUE;
// First we setup the blue selection box - another window that will be attached as a child window
// to this one, and will be moved by timers as needed.
nib_main_loaded = TRUE; nib_main_loaded = TRUE;
} }
...@@ -1064,6 +1068,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1064,6 +1068,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_timeslider setFloatValue: 0.0]; [o_timeslider setFloatValue: 0.0];
[o_timeslider setEnabled: b_seekable]; [o_timeslider setEnabled: b_seekable];
[o_timefield setStringValue: @"0:00:00"]; [o_timefield setStringValue: @"0:00:00"];
[[[self getControls] getFSPanel] setStreamPos: 0 setSeconds: 0];
[o_embedded_window setSeekable: b_seekable]; [o_embedded_window setSeekable: b_seekable];
...@@ -1120,6 +1125,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1120,6 +1125,7 @@ static VLCMain *_o_sharedMainInstance = nil;
o_temp = [NSString stringWithCString: o_temp = [NSString stringWithCString:
p_playlist->status.p_item->p_input->psz_name]; p_playlist->status.p_item->p_input->psz_name];
[self setScrollField: o_temp stopAfter:-1]; [self setScrollField: o_temp stopAfter:-1];
[[[self getControls] getFSPanel] setStreamTitle: o_temp];
p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT, p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT,
FIND_PARENT ); FIND_PARENT );
...@@ -1166,6 +1172,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1166,6 +1172,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60), (int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)]; (int) (i_seconds % 60)];
[o_timefield setStringValue: o_time]; [o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: pos.f_float setSeconds: i_seconds];
[o_embedded_window setTime: o_time position: f_updated]; [o_embedded_window setTime: o_time position: f_updated];
} }
...@@ -1389,6 +1396,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1389,6 +1396,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
if( i_status == PLAYING_S ) if( i_status == PLAYING_S )
{ {
[[[self getControls] getFSPanel] setPause];
[o_btn_play setImage: o_img_pause]; [o_btn_play setImage: o_img_pause];
[o_btn_play setAlternateImage: o_img_pause_pressed]; [o_btn_play setAlternateImage: o_img_pause_pressed];
[o_btn_play setToolTip: _NS("Pause")]; [o_btn_play setToolTip: _NS("Pause")];
...@@ -1398,6 +1406,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1398,6 +1406,7 @@ static VLCMain *_o_sharedMainInstance = nil;
} }
else else
{ {
[[[self getControls] getFSPanel] setPlay];
[o_btn_play setImage: o_img_play]; [o_btn_play setImage: o_img_play];
[o_btn_play setAlternateImage: o_img_play_pressed]; [o_btn_play setAlternateImage: o_img_play_pressed];
[o_btn_play setToolTip: _NS("Play")]; [o_btn_play setToolTip: _NS("Play")];
...@@ -1473,6 +1482,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1473,6 +1482,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60), (int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)]; (int) (i_seconds % 60)];
[o_timefield setStringValue: o_time]; [o_timefield setStringValue: o_time];
[[[self getControls] getFSPanel] setStreamPos: pos.f_float setSeconds: i_seconds];
[o_embedded_window setTime: o_time position: f_updated]; [o_embedded_window setTime: o_time position: f_updated];
} }
#undef p_input #undef p_input
......
...@@ -40,7 +40,9 @@ ...@@ -40,7 +40,9 @@
#include <vlc_keys.h> #include <vlc_keys.h>
#include "intf.h" #include "intf.h"
#include "fspanel.h"
#include "vout.h" #include "vout.h"
#import "controls.h"
/***************************************************************************** /*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed * DeviceCallback: Callback triggered when the video-device variable is changed
...@@ -377,6 +379,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -377,6 +379,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Get( p_real_vout, "fullscreen", &val ); var_Get( p_real_vout, "fullscreen", &val );
val.b_bool = !val.b_bool; val.b_bool = !val.b_bool;
var_Set( p_real_vout, "fullscreen", val ); var_Set( p_real_vout, "fullscreen", val );
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderFront: self];
else
[[[[VLCMain sharedInstance] getControls] getFSPanel] orderOut: self];
} }
- (BOOL)isFullscreen - (BOOL)isFullscreen
...@@ -609,6 +615,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -609,6 +615,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
var_Set( p_vout, "mouse-moved", val ); var_Set( p_vout, "mouse-moved", val );
} }
if( [self isFullscreen] )
[[[[VLCMain sharedInstance] getControls] getFSPanel] fadeIn];
} }
[super mouseMoved: o_event]; [super mouseMoved: o_event];
...@@ -943,7 +951,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -943,7 +951,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
styleMask: NSBorderlessWindowMask styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered backing: NSBackingStoreBuffered
defer: YES screen: o_screen]; defer: YES screen: o_screen];
if( var_GetBool( p_real_vout, "macosx-black" ) ) if( var_GetBool( p_real_vout, "macosx-black" ) )
if( b_black == VLC_TRUE ) if( b_black == VLC_TRUE )
{ {
......
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