Commit 2f78783f authored by Benjamin Pracht's avatar Benjamin Pracht

* Add an controls to the vout (using the embedded vout framework)

  - There is some redundancy in the controls now...
  - This is just a proposal. If you don't like it, say so...
  - Hope I didn't forget any file (yell if you habe troubles)
* Add an option to disable the embedded window
parent 8b953e6d
......@@ -31,10 +31,29 @@
};
CLASS = VLCControls;
LANGUAGE = ObjC;
OUTLETS = {"o_btn_fullscreen" = id; "o_main" = id; "o_volumeslider" = id; };
OUTLETS = {"o_main" = id; "o_volumeslider" = id; };
SUPERCLASS = NSObject;
},
{
CLASS = VLCDetachedEmbeddedVoutView;
LANGUAGE = ObjC;
SUPERCLASS = VLCEmbeddedVoutView;
},
{CLASS = VLCEmbeddedVoutView; LANGUAGE = ObjC; SUPERCLASS = VLCVoutView; },
{
CLASS = VLCEmbeddedWindow;
LANGUAGE = ObjC;
OUTLETS = {
"o_btn_backward" = id;
"o_btn_forward" = id;
"o_btn_fullscreen" = id;
"o_btn_play" = id;
"o_slider" = id;
"o_time" = id;
"o_window" = id;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {
bandSliderUpdated = id;
......@@ -122,7 +141,6 @@
LANGUAGE = ObjC;
OUTLETS = {
"o_btn_ff" = id;
"o_btn_fullscreen" = id;
"o_btn_next" = id;
"o_btn_play" = id;
"o_btn_playlist" = id;
......@@ -135,6 +153,7 @@
"o_dmi_play" = id;
"o_dmi_previous" = id;
"o_dmi_stop" = id;
"o_embedded_window" = id;
"o_err_btn_dismiss" = id;
"o_err_btn_msgs" = id;
"o_err_bug_lbl" = id;
......@@ -292,4 +311,4 @@
{CLASS = VLCVoutView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
);
IBVersion = 1;
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>394 559 496 270 0 0 1280 1002 </string>
<string>134 289 496 270 0 0 1024 746 </string>
<key>IBEditorPositions</key>
<dict>
<key>1617</key>
......@@ -11,18 +11,17 @@
<key>2197</key>
<string>422 532 596 143 0 0 1440 878 </string>
<key>29</key>
<string>503 790 438 44 0 0 1440 878 </string>
<string>294 89 438 44 0 0 1024 746 </string>
<key>915</key>
<string>678 573 187 249 0 0 1280 1002 </string>
</dict>
<key>IBFramework Version</key>
<string>437.0</string>
<string>439.0</string>
<key>IBLockedObjects</key>
<array/>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
<integer>2029</integer>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -38,5 +38,7 @@ SOURCES_macosx = \
bookmarks.m \
sfilters.h \
sfilters.m \
embeddedwindow.h \
embeddedwindow.m \
$(NULL)
/*****************************************************************************
* embeddedwindow.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2004 the VideoLAN team
* $Id: playlistinfo.h 11664 2005-07-09 06:17:09Z courmisch $
*
* Authors: Benjamin Pracht <bigben 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* VLCEmbeddedWindow interface
*****************************************************************************/
@interface VLCEmbeddedWindow : NSObject
{
IBOutlet id o_btn_backward;
IBOutlet id o_btn_forward;
IBOutlet id o_btn_fullscreen;
IBOutlet id o_btn_play;
IBOutlet id o_slider;
IBOutlet id o_time;
IBOutlet id o_window;
NSImage * o_img_play;
NSImage * o_img_play_pressed;
NSImage * o_img_pause;
NSImage * o_img_pause_pressed;
}
- (void)setTime:(NSString *)o_arg_ime position:(float)f_position;
- (void)playStatusUpdated:(int)i_status;
- (void)setSeekable:(BOOL)b_seekable;
- (void)setFullscreen:(BOOL)b_fullscreen;
@end
/*****************************************************************************
* embeddedwindow.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2005 the VideoLAN team
* $Id: playlistinfo.m 12560 2005-09-15 14:21:38Z hartman $
*
* Authors: Benjamin Pracht <bigben 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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "intf.h"
#include "vout.h"
#include "embeddedwindow.h"
/*****************************************************************************
* VLCEmbeddedWindow Implementation
*****************************************************************************/
@implementation VLCEmbeddedWindow
- (void)awakeFromNib
{
[o_window setDelegate: self];
[o_btn_backward setToolTip: _NS("Rewind")];
[o_btn_forward setToolTip: _NS("Fast Forward")];
[o_btn_fullscreen setToolTip: _NS("Fullscreen")];
[o_btn_play setToolTip: _NS("Play")];
[o_slider setToolTip: _NS("Position")];
o_img_play = [NSImage imageNamed: @"play_embedded"];
o_img_play_pressed = [NSImage imageNamed: @"play_embedded_blue"];
o_img_pause = [NSImage imageNamed: @"pause_embedded"];
o_img_pause_pressed = [NSImage imageNamed: @"pause_embedded_blue"];
}
- (void)setTime:(NSString *)o_arg_time position:(float)f_position
{
[o_time setStringValue: o_arg_time];
[o_slider setFloatValue: f_position];
}
- (void)playStatusUpdated:(int)i_status
{
if( i_status == PLAYING_S )
{
[o_btn_play setImage: o_img_pause];
[o_btn_play setAlternateImage: o_img_pause_pressed];
[o_btn_play setToolTip: _NS("Pause")];
}
else
{
[o_btn_play setImage: o_img_play];
[o_btn_play setAlternateImage: o_img_play_pressed];
[o_btn_play setToolTip: _NS("Play")];
}
}
- (void)setSeekable:(BOOL)b_seekable
{
[o_btn_forward setEnabled: b_seekable];
[o_btn_backward setEnabled: b_seekable];
[o_slider setEnabled: b_seekable];
}
- (void)setFullscreen:(BOOL)b_fullscreen
{
[o_btn_fullscreen setState: b_fullscreen];
}
- (BOOL)windowShouldClose:(id)sender
{
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return NO;
}
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
return YES;
}
@end
......@@ -356,24 +356,20 @@ static VLCExtended *_o_sharedInstance = nil;
FIND_ANYWHERE );
vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
vout_thread_t *p_real_vout;
val.f_float = [o_sld_opaque floatValue] / 100;
if( p_vout != NULL )
{
if( p_vout->i_object_type == VLC_OBJECT_OPENGL )
{
p_real_vout = (vout_thread_t *) p_vout->p_parent;
}
else
{
p_real_vout = p_vout;
}
p_real_vout = [VLCVoutView getRealVout: p_vout];
var_Set( p_real_vout, "macosx-opaqueness", val );
while ((o_window = [o_enumerator nextObject]))
{
if( [[o_window className] isEqualToString: @"VLCWindow"] )
if( [[o_window className] isEqualToString: @"VLCWindow"] ||
[[[VLCMain sharedInstance] getEmbeddedList]
windowContainsEmbedded: o_window])
{
[o_window setAlphaValue: val.f_float];
}
......
......@@ -112,6 +112,7 @@ struct intf_sys_t
IBOutlet id o_scrollfield; /* info field */
IBOutlet id o_timefield; /* time field */
IBOutlet id o_timeslider; /* time slider */
IBOutlet id o_embedded_window; /* Embedded Vout Window */
float f_slider; /* slider value */
float f_slider_old; /* old slider val */
IBOutlet id o_volumeslider; /* volume slider */
......
......@@ -43,6 +43,7 @@
#include "bookmarks.h"
#include "sfilters.h"
#include "interaction.h"
#include "embeddedwindow.h"
/*#include "update.h"*/
/*****************************************************************************
......@@ -449,7 +450,8 @@ static VLCMain *_o_sharedMainInstance = nil;
var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self);
[o_btn_fullscreen setState: ( var_Get( p_playlist, "fullscreen", &val )>=0 && val.b_bool )];
[o_embedded_window setFullscreen: var_GetBool( p_playlist,
"fullscreen" )];
vlc_object_release( p_playlist );
}
......@@ -964,6 +966,8 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_timeslider setEnabled: b_seekable];
[o_timefield setStringValue: @"0:00:00"];
[o_embedded_window setSeekable: b_seekable];
p_intf->p_sys->b_intf_update = VLC_FALSE;
}
......@@ -983,7 +987,7 @@ static VLCMain *_o_sharedMainInstance = nil;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
var_Get( p_playlist, "fullscreen", &val );
[o_btn_fullscreen setState: val.b_bool];
[o_embedded_window setFullscreen: val.b_bool];
vlc_object_release( p_playlist );
p_intf->p_sys->b_fullscreen_update = VLC_FALSE;
......@@ -1020,9 +1024,11 @@ static VLCMain *_o_sharedMainInstance = nil;
while( ( o_vout_wnd = [o_enum nextObject] ) )
{
if( [[o_vout_wnd className] isEqualToString: @"VLCWindow"] )
if( [[o_vout_wnd className] isEqualToString: @"VLCWindow"]
|| [[[VLCMain sharedInstance] getEmbeddedList]
windowContainsEmbedded: o_vout_wnd])
{
[o_vout_wnd updateTitle];
[[o_vout_wnd getVoutView] updateTitle];
}
}
vlc_object_release( (vlc_object_t *)p_vout );
......@@ -1053,8 +1059,9 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
if( p_intf->p_sys->b_volume_update )
{
NSString *o_text;
......@@ -1075,6 +1082,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{
p_intf->p_sys->i_play_status = val.i_int;
[self playStatusUpdated: p_intf->p_sys->i_play_status];
[o_embedded_window playStatusUpdated: p_intf->p_sys->i_play_status];
}
}
else
......@@ -1082,6 +1090,7 @@ static VLCMain *_o_sharedMainInstance = nil;
p_intf->p_sys->i_play_status = END_S;
p_intf->p_sys->b_intf_update = VLC_TRUE;
[self playStatusUpdated: p_intf->p_sys->i_play_status];
[o_embedded_window playStatusUpdated: p_intf->p_sys->i_play_status];
[self setSubmenusEnabled: FALSE];
}
......@@ -1368,6 +1377,7 @@ static VLCMain *_o_sharedMainInstance = nil;
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
[o_embedded_window setTime: o_time position: f_updated];
}
#undef p_input
}
......
......@@ -47,6 +47,10 @@ void E_(CloseVideoGL) ( vlc_object_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define EMBEDDED_TEXT N_("Use embedded video output")
#define EMBEDDED_LONGTEXT N_("Disable this if you want the video output to " \
"be opened in a separate window instead of in the control window.")
#define VDEV_TEXT N_("Video device")
#define VDEV_LONGTEXT N_("Choose a number corresponding to " \
"a screen in you video device selection menu and this screen " \
......@@ -77,6 +81,8 @@ vlc_module_begin();
set_callbacks( E_(OpenIntf), E_(CloseIntf) );
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_GENERAL );
add_bool( "macosx-embedded", 1, NULL, EMBEDDED_TEXT, EMBEDDED_LONGTEXT,
VLC_FALSE );
add_submodule();
set_description( _("Quartz video") );
set_capability( "video output", 100 );
......
......@@ -56,6 +56,7 @@
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame;
- (void)closeVout;
- (void)updateTitle;
- (void)manage;
- (void)scaleWindowWithFactor: (float)factor;
- (void)setOnTop:(BOOL)b_on_top;
......@@ -98,6 +99,16 @@
@end
/*****************************************************************************
* VLCDetachedEmbeddedView interface
*****************************************************************************/
@interface VLCDetachedEmbeddedVoutView : VLCEmbeddedVoutView
{
}
@end
/*****************************************************************************
* VLCWindow interface
*****************************************************************************/
......@@ -119,7 +130,6 @@
- (void)closeWindow;
- (id)closeReal: (id) sender;
- (id)getVoutView;
- (void)updateTitle;
- (BOOL)windowShouldClose:(id)sender;
......
......@@ -248,6 +248,51 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
p_real_vout = NULL;
}
- (void)updateTitle
{
NSMutableString * o_title = nil, * o_mrl = nil;
input_thread_t * p_input;
if( p_vout == NULL )
{
return;
}
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input == NULL )
{
return;
}
if( p_input->input.p_item->psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_name];
if( p_input->input.p_item->psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_uri];
if( o_title == nil )
o_title = o_mrl;
if( o_mrl != nil )
{
if( p_input->input.p_access && !strcmp( p_input->input.p_access->p_module->psz_shortname, "File" ) )
{
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
[o_window setRepresentedFilename: o_mrl];
}
[o_window setTitle: o_title];
}
else
{
[o_window setTitle: [NSString stringWithCString: VOUT_TITLE]];
}
vlc_object_release( p_input );
}
- (void)setOnTop:(BOOL)b_on_top
{
if( b_on_top )
......@@ -650,6 +695,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-background", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "macosx-embedded", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* We only wait for NSApp to initialise if we're not embedded (as in the
......@@ -676,7 +722,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
else
{
if ( VLCIntf && !(p_vout->b_fullscreen) &&
!(var_GetBool( p_real_vout, "macosx-background" )) )
!(var_GetBool( p_real_vout, "macosx-background" )) &&
var_GetBool( p_vout, "macosx-embedded") )
{
o_return = [[[VLCMain sharedInstance] getEmbeddedList]
getEmbeddedVout];
......@@ -716,6 +763,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
i_time_mouse_last_moved = mdate();
o_window = [[VLCWindow alloc] initWithVout: p_arg_vout view: self
frame: s_arg_frame];
[self updateTitle];
[view setFrame: [self frame]];
[o_window setAcceptsMouseMovedEvents: TRUE];
return b_return;
......@@ -823,6 +871,30 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
@end
@implementation VLCDetachedEmbeddedVoutView
- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
frame: (NSRect *) s_arg_frame
{
BOOL b_return = [super setVout: p_arg_vout subView: view frame: s_arg_frame];
if( b_return )
{
[o_window setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
[self updateTitle];
[self scaleWindowWithFactor: 1.0];
[o_window makeKeyAndOrderFront: self];
}
return b_return;
}
- (void)closeVout
{
[o_window orderOut: self];
[super closeVout];
}
@end
/*****************************************************************************
* VLCWindow implementation
......@@ -847,7 +919,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
return self;
}
- (id) initReal: (id) sender
- (id)initReal: (id) sender
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
NSArray *o_screens = [NSScreen screens];
......@@ -943,7 +1015,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
}
}
[self updateTitle];
[self makeKeyAndOrderFront: nil];
[self setReleasedWhenClosed: YES];
......@@ -1001,50 +1072,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
/* This is actually the same as VLCControls::stop. */
- (void)updateTitle /*not modified yey ! */
{
NSMutableString * o_title = NULL, * o_mrl = NULL;
input_thread_t * p_input;
if( p_vout == NULL )
{
return;
}
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT );
if( p_input == NULL )
{
return;
}
if( p_input->input.p_item->psz_name != NULL )
o_title = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_name];
if( p_input->input.p_item->psz_uri != NULL )
o_mrl = [NSMutableString stringWithUTF8String:
p_input->input.p_item->psz_uri];
if( o_title == nil )
o_title = o_mrl;
if( o_mrl != nil )
{
if( p_input->input.p_access && !strcmp( p_input->input.p_access->p_module->psz_shortname, "File" ) )
{
NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range];
[self setRepresentedFilename: o_mrl];
}
[self setTitle: o_title];
}
else
{
[self setTitle: [NSString stringWithCString: VOUT_TITLE]];
}
vlc_object_release( p_input );
}
- (BOOL)windowShouldClose:(id)sender
{
playlist_t * p_playlist = vlc_object_find( p_vout, VLC_OBJECT_PLAYLIST,
......
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