#include "wizard.h"
#include "extended.h"
#include "bookmarks.h"
+#include "sfilters.h"
+#include "interaction.h"
+/*#include "update.h"*/
/*****************************************************************************
* Local prototypes.
* playlistChanged: Callback triggered by the intf-change playlist
* variable, to let the intf update the playlist.
*****************************************************************************/
-int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
+static int PlaylistChanged( 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;
* FullscreenChanged: Callback triggered by the fullscreen-change playlist
* variable, to let the intf update the controller.
*****************************************************************************/
-int FullscreenChanged( vlc_object_t *p_this, const char *psz_variable,
+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;
return VLC_SUCCESS;
}
+/*****************************************************************************
+ * InteractCallback: Callback triggered by the interaction
+ * variable, to let the intf display error and interaction dialogs
+ *****************************************************************************/
+static int InteractCallback( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+ NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
+ VLCMain *interface = (VLCMain *)param;
+ interaction_dialog_t *p_dialog = (interaction_dialog_t *)(new_val.p_address);
+ NSValue *o_value = [NSValue valueWithPointer:p_dialog];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"VLCNewInteractionEventNotification" object:[interface getInteractionList]
+ userInfo:[NSDictionary dictionaryWithObject:o_value forKey:@"VLCDialogPointer"]];
+
+ [o_pool release];
+ return VLC_SUCCESS;
+}
static struct
{
o_prefs = nil;
o_open = [[VLCOpen alloc] init];
o_wizard = [[VLCWizard alloc] init];
- o_extended = [[VLCExtended alloc] init];
+ o_extended = nil;
o_bookmarks = [[VLCBookmarks alloc] init];
+ o_embedded_list = [[VLCEmbeddedList alloc] init];
+ o_interaction_list = [[VLCInteractionList alloc] init];
+ o_sfilters = nil;
+ /*o_update = [[VLCUpdate alloc] init];*/
i_lastShownVolume = -1;
return _o_sharedMainInstance;
playlist_t *p_playlist;
vlc_value_t val;
+ /* Check if we already did this once. Opening the other nibs calls it too, because VLCMain is the owner */
+ if( nib_main_loaded ) return;
+
[self initStrings];
[o_window setExcludedFromWindowsMenu: TRUE];
[o_msgs_panel setExcludedFromWindowsMenu: TRUE];
i_key = config_GetInt( p_intf, "key-next" );
[o_mi_next setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_next setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump+10sec" );
+ i_key = config_GetInt( p_intf, "key-jump+short" );
[o_mi_fwd setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_fwd setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump-10sec" );
+ i_key = config_GetInt( p_intf, "key-jump-short" );
[o_mi_bwd setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_bwd setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump+1min" );
+ i_key = config_GetInt( p_intf, "key-jump+medium" );
[o_mi_fwd1m setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_fwd1m setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump-1min" );
+ i_key = config_GetInt( p_intf, "key-jump-medium" );
[o_mi_bwd1m setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_bwd1m setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump+5min" );
+ i_key = config_GetInt( p_intf, "key-jump+long" );
[o_mi_fwd5m setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_fwd5m setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
- i_key = config_GetInt( p_intf, "key-jump-5min" );
+ i_key = config_GetInt( p_intf, "key-jump-long" );
[o_mi_bwd5m setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_bwd5m setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
i_key = config_GetInt( p_intf, "key-vol-up" );
/* Check if we need to start playing */
if( p_intf->b_play )
{
- playlist_Play( p_playlist );
+ playlist_LockControl( p_playlist, PLAYLIST_AUTOPLAY );
}
var_Create( p_playlist, "fullscreen", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
val.b_bool = VLC_FALSE;
[o_btn_fullscreen setState: ( var_Get( p_playlist, "fullscreen", &val )>=0 && val.b_bool )];
vlc_object_release( p_playlist );
}
-}
-
-- (void)dealloc
-{
- [o_about release];
- [o_prefs release];
- [o_open release];
- [o_extended release];
- [o_bookmarks release];
- [super dealloc];
+ var_Create( p_intf, "interaction", VLC_VAR_ADDRESS );
+ var_AddCallback( p_intf, "interaction", InteractCallback, self );
+ p_intf->b_interaction = VLC_TRUE;
+
+ nib_main_loaded = TRUE;
}
- (void)initStrings
[o_msgs_btn_crashlog setTitle: _NS("Open CrashLog")];
/* main menu */
- [o_mi_about setTitle: _NS("About VLC media player...")];
+ [o_mi_about setTitle: [_NS("About VLC media player") \
+ stringByAppendingString: @"..."]];
+/* [o_mi_checkForUpdate setTitle: _NS("Check for Update...")];*/
[o_mi_prefs setTitle: _NS("Preferences...")];
[o_mi_add_intf setTitle: _NS("Add Interface")];
[o_mu_add_intf setTitle: _NS("Add Interface")];
[o_mi_open_net setTitle: _NS("Open Network...")];
[o_mi_open_recent setTitle: _NS("Open Recent")];
[o_mi_open_recent_cm setTitle: _NS("Clear Menu")];
- [o_mi_open_wizard setTitle: _NS("Wizard...")];
+ [o_mi_open_wizard setTitle: _NS("Streaming/Exporting Wizard...")];
[o_mu_edit setTitle: _NS("Edit")];
[o_mi_cut setTitle: _NS("Cut")];
[o_mi_clear setTitle: _NS("Clear")];
[o_mi_select_all setTitle: _NS("Select All")];
- [o_mu_controls setTitle: _NS("Controls")];
+ [o_mu_controls setTitle: _NS("Playback")];
[o_mi_play setTitle: _NS("Play")];
[o_mi_stop setTitle: _NS("Stop")];
[o_mi_faster setTitle: _NS("Faster")];
[o_mi_close_window setTitle: _NS("Close Window")];
[o_mi_controller setTitle: _NS("Controller")];
[o_mi_equalizer setTitle: _NS("Equalizer")];
- [o_mi_extended setTitle: _NS("Extended controls")];
+ [o_mi_extended setTitle: _NS("Extended Controls")];
[o_mi_bookmarks setTitle: _NS("Bookmarks")];
[o_mi_playlist setTitle: _NS("Playlist")];
[o_mi_info setTitle: _NS("Info")];
[o_mi_reportabug setTitle: _NS("Report a Bug")];
[o_mi_website setTitle: _NS("VideoLAN Website")];
[o_mi_license setTitle: _NS("License")];
+ [o_mi_donation setTitle: _NS("Make a donation")];
+ [o_mi_forum setTitle: _NS("Online Forum")];
/* dock menu */
[o_dmi_play setTitle: _NS("Play")];
return nil;
}
+- (id)getEmbeddedList
+{
+ if( o_embedded_list )
+ {
+ return o_embedded_list;
+ }
+ return nil;
+}
+
+- (id)getInteractionList
+{
+ if( o_interaction_list )
+ {
+ return o_interaction_list;
+ }
+ return nil;
+}
+
- (void)manage
{
- NSDate * o_sleep_date;
playlist_t * p_playlist;
/* new thread requires a new pool */
[self manageVolumeSlider];
vlc_mutex_unlock( &p_intf->change_lock );
-
- o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: .1];
- [NSThread sleepUntilDate: o_sleep_date];
+ msleep( 100000 );
}
-
- [self terminate];
[o_pool release];
}
}
msleep( 500000 );
+ /* save the prefs if they were changed in the extended panel */
+ if (o_extended && [o_extended getConfigChanged])
+ {
+ [o_extended savePrefs];
+ }
+
+ p_intf->b_interaction = VLC_FALSE;
+ var_DelCallback( p_intf, "interaction", InteractCallback, self );
+
+ /* release some other objects here, because it isn't sure whether dealloc
+ * will be called later on -- FK (10/6/05) */
+ if( nib_about_loaded && o_about )
+ [o_about release];
+
+ if( nib_open_loaded && o_open )
+ [o_open release];
+
+ if( nib_extended_loaded && o_extended )
+ {
+ [o_extended collapsAll];
+ [o_extended release];
+ }
+
+ if( nib_bookmarks_loaded && o_bookmarks )
+ [o_bookmarks release];
+
+ if( nib_wizard_loaded && o_wizard )
+ [o_wizard release];
+
+ if( o_embedded_list != nil )
+ [o_embedded_list release];
+
+ if( o_interaction_list != nil )
+ [o_interaction_list release];
+
if( o_img_pause_pressed != nil )
{
[o_img_pause_pressed release];
[[NSUserDefaults standardUserDefaults] synchronize];
p_intf->b_die = VLC_TRUE;
- [NSApp stop:NULL];
}
- (IBAction)clearRecentItems:(id)sender
- (IBAction)showExtended:(id)sender
{
+ if ( o_extended == nil )
+ {
+ o_extended = [[VLCExtended alloc] init];
+ }
if (!nib_extended_loaded)
{
nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self];
}
}
+- (IBAction)showSFilters:(id)sender
+{
+ if ( o_sfilters == nil )
+ {
+ o_sfilters = [[VLCsFilters alloc] init];
+ }
+ if (!nib_sfilters_loaded)
+ {
+ nib_sfilters_loaded = [NSBundle loadNibNamed:@"SFilters" owner:self];
+ [o_sfilters initStrings];
+ [o_sfilters showAsPanel];
+ } else {
+ [o_sfilters showAsPanel];
+ }
+}
+
- (IBAction)showBookmarks:(id)sender
{
/* we need the wizard-nib for the bookmarks's extract functionality */
if (!nib_wizard_loaded)
{
nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
+ [o_wizard initStrings];
}
if (!nib_bookmarks_loaded)
[o_prefs showPrefs];
}
+/*- (IBAction)checkForUpdate:(id)sender
+{
+ if (!nib_update_loaded)
+ {
+ nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner:self];
+ [o_update showUpdateWindow];
+ } else {
+ [o_update showUpdateWindow];
+ }
+}*/
+
- (IBAction)closeError:(id)sender
{
vlc_value_t val;