#include "vout.h"
#include "prefs.h"
#include "playlist.h"
-#include "info.h"
#include "controls.h"
/*****************************************************************************
memset( p_intf->p_sys, 0, sizeof( *p_intf->p_sys ) );
p_intf->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
-
+
/* Put Cocoa into multithread mode as soon as possible.
* http://developer.apple.com/techpubs/macosx/Cocoa/
* TasksAndConcepts/ProgrammingTopics/Multithreading/index.html
p_intf->p_sys->o_sendport = [[NSPort port] retain];
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
+ p_intf->b_play = VLC_TRUE;
p_intf->pf_run = Run;
- [[VLCApplication sharedApplication] autorelease];
+ [VLCApplication sharedApplication];
[NSApp setIntf: p_intf];
-
[NSBundle loadNibNamed: @"MainMenu" owner: NSApp];
return( 0 );
- (void)terminate:(id)sender
{
p_intf->p_vlc->b_die = VLC_TRUE;
+ [super terminate:sender];
+}
+
+
+/*****************************************************************************
+ * hasDefinedShortcutKey: Check to see if the key press is a defined VLC
+ * shortcut key. If it is, pass it off to VLC for handling and return YES,
+ * otherwise ignore it and return NO (where it will get handled by Cocoa).
+ *****************************************************************************/
+- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event
+{
+ unichar key = 0;
+ vlc_value_t val;
+ unsigned int i_pressed_modifiers = 0;
+ struct hotkey *p_hotkeys;
+ int i;
+
+ val.i_int = 0;
+ p_hotkeys = p_intf->p_vlc->p_hotkeys;
+
+ i_pressed_modifiers = [o_event modifierFlags];
+
+ if( i_pressed_modifiers & NSShiftKeyMask )
+ val.i_int |= KEY_MODIFIER_SHIFT;
+ if( i_pressed_modifiers & NSControlKeyMask )
+ val.i_int |= KEY_MODIFIER_CTRL;
+ if( i_pressed_modifiers & NSAlternateKeyMask )
+ val.i_int |= KEY_MODIFIER_ALT;
+ if( i_pressed_modifiers & NSCommandKeyMask )
+ val.i_int |= KEY_MODIFIER_COMMAND;
+
+ key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
+
+ val.i_int |= CocoaKeyToVLC( key );
+
+ for( i = 0; p_hotkeys[i].psz_action != NULL; i++ )
+ {
+ if( p_hotkeys[i].i_key == val.i_int )
+ {
+ var_Set( p_intf->p_vlc, "key-pressed", val );
+ return YES;
+ }
+ }
+
+ return NO;
}
@end
{
unsigned int i_key = 0;
intf_thread_t * p_intf = [NSApp getIntf];
+ playlist_t *p_playlist;
vlc_value_t val;
[self initStrings];
[o_mi_fullscreen setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_fullscreen setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- var_Create (p_intf, "fullscreen", VLC_VAR_BOOL );
- var_Change (p_intf, "fullscreen", VLC_VAR_INHERITVALUE, &val, NULL );
- [o_btn_fullscreen setState: val.b_bool];
-
- var_Create(p_intf,"intf-change",VLC_VAR_BOOL );
+ var_Create( p_intf, "intf-change", VLC_VAR_BOOL );
[self setSubmenusEnabled: FALSE];
[self manageVolumeSlider];
+
+ p_playlist = (playlist_t *) vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if( p_playlist )
+ {
+ /* Check if we need to start playing */
+ if( p_intf->b_play )
+ {
+ playlist_Play( p_playlist );
+ }
+ [o_btn_fullscreen setState: ( var_Get( p_playlist, "fullscreen", &val )>=0 && val.b_bool )];
+ vlc_object_release( p_playlist );
+ }
}
- (void)initStrings
[o_mi_prefs setTitle: _NS("Preferences...")];
[o_mi_add_intf setTitle: _NS("Add Interface")];
[o_mu_add_intf setTitle: _NS("Add Interface")];
+ [o_mi_services setTitle: _NS("Services")];
[o_mi_hide setTitle: _NS("Hide VLC")];
[o_mi_hide_others setTitle: _NS("Hide Others")];
[o_mi_show_all setTitle: _NS("Show All")];
[o_err_bug_lbl setStringValue: _NS("If you believe that it is a bug, please follow the instructions at:")];
[o_err_btn_msgs setTitle: _NS("Open Messages Window")];
[o_err_btn_dismiss setTitle: _NS("Dismiss")];
- [o_err_ckbk_surpress setTitle: _NS("Surpress further errors")];
+ [o_err_ckbk_surpress setTitle: _NS("Suppress further errors")];
[o_info_window setTitle: _NS("Info")];
}
return nil;
}
+- (id)getInfo
+{
+ if ( o_info )
+ {
+ return o_info;
+ }
+ return nil;
+}
+
- (void)manage
{
NSDate * o_sleep_date;
vlc_object_release( (vlc_object_t *)p_vout );
}
[o_playlist updateRowSelection];
- [o_info updateInfo];
+// [o_info updateInfo];
p_intf->p_sys->b_current_title_update = FALSE;
}
p_intf->p_sys->b_intf_update = VLC_FALSE;
}
- if (p_intf->p_sys->b_fullscreen_update )
+ if( p_intf->p_sys->b_fullscreen_update )
{
vout_thread_t * p_vout;
vlc_value_t val;
- if (var_Change (p_intf, "fullscreen", VLC_VAR_INHERITVALUE, &val, NULL)>=0 && val.b_bool )
- {
- [o_btn_fullscreen setState:VLC_TRUE];
- }
- else
- {
- [o_btn_fullscreen setState:VLC_FALSE];
- }
- p_vout = vlc_object_find(p_intf,VLC_OBJECT_VOUT,FIND_ANYWHERE);
- if (p_vout != NULL)
+
+ [o_btn_fullscreen setState: ( var_Get( p_playlist, "fullscreen", &val )>=0 && val.b_bool ) ];
+
+ p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_vout != NULL )
{
[o_btn_fullscreen setEnabled: VLC_TRUE];
- vlc_object_release(p_vout);
+ vlc_object_release( p_vout );
}
else
{
o_msg_lock = nil;
}
+ [NSApp terminate: nil];
[NSApp stop: nil];
/* write cached user defaults to disk */