/*****************************************************************************
* intf.m: MacOS X interface module
*****************************************************************************
- * Copyright (C) 2002-2005 VideoLAN
+ * Copyright (C) 2002-2005 the VideoLAN team
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
#include "controls.h"
#include "about.h"
#include "open.h"
+#include "wizard.h"
+#include "extended.h"
+#include "bookmarks.h"
+#include "update.h"
/*****************************************************************************
* Local prototypes.
o_about = [[VLAboutBox alloc] init];
o_prefs = nil;
o_open = [[VLCOpen alloc] init];
+ o_wizard = [[VLCWizard alloc] init];
+ o_extended = [[VLCExtended alloc] init];
+ o_bookmarks = [[VLCBookmarks alloc] init];
+ 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];
[o_btn_fullscreen setState: ( var_Get( p_playlist, "fullscreen", &val )>=0 && val.b_bool )];
vlc_object_release( p_playlist );
}
+ nib_main_loaded = TRUE;
+}
+
+- (void)dealloc
+{
+ [o_about release];
+ [o_prefs release];
+ [o_open release];
+ [o_extended release];
+ [o_bookmarks release];
+
+ [super dealloc];
}
- (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...")];
+ [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_mu_edit setTitle: _NS("Edit")];
[o_mi_cut setTitle: _NS("Cut")];
[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_bookmarks setTitle: _NS("Bookmarks")];
[o_mi_playlist setTitle: _NS("Playlist")];
[o_mi_info setTitle: _NS("Info")];
[o_mi_messages setTitle: _NS("Messages")];
/* error panel */
[o_error setTitle: _NS("Error")];
- [o_err_lbl setStringValue: _NS("An error has occurred which probably prevented the execution of your request:")];
- [o_err_bug_lbl setStringValue: _NS("If you believe that it is a bug, please follow the instructions at:")];
+ [o_err_lbl setStringValue: _NS("An error has occurred which probably " \
+ "prevented the execution of your request:")];
+ [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("Suppress further errors")];
case NSDeleteFunctionKey:
case NSDeleteCharFunctionKey:
case NSBackspaceCharacter:
- return YES;
+ case NSUpArrowFunctionKey:
+ case NSDownArrowFunctionKey:
+ case NSRightArrowFunctionKey:
+ case NSLeftArrowFunctionKey:
+ case NSEnterCharacter:
+ case NSCarriageReturnCharacter:
+ return NO;
}
val.i_int |= CocoaKeyToVLC( key );
{
return o_info;
}
- return nil;
+ return nil;
+}
+
+- (id)getWizard
+{
+ if ( o_wizard )
+ {
+ return o_wizard;
+ }
+ return nil;
+}
+
+- (id)getBookmarks
+{
+ if ( o_bookmarks )
+ {
+ return o_bookmarks;
+ }
+ return nil;
}
- (void)manage
}
#undef p_input
+ /* Manage volume status */
+ [self manageVolumeSlider];
+
vlc_mutex_unlock( &p_intf->change_lock );
o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: .1];
(int) (i_seconds % 60)];
[o_timefield setStringValue: o_time];
}
+
+ if( p_intf->p_sys->b_volume_update )
+ {
+ NSString *o_text;
+ int i_volume_step = 0;
+ o_text = [NSString stringWithFormat: _NS("Volume: %d%%"), i_lastShownVolume * 400 / AOUT_VOLUME_MAX];
+ if( i_lastShownVolume != -1 )
+ [self setScrollField:o_text stopAfter:1000000];
+ i_volume_step = config_GetInt( p_intf->p_vlc, "volume-step" );
+ [o_volumeslider setFloatValue: (float)i_lastShownVolume / i_volume_step];
+ [o_volumeslider setEnabled: TRUE];
+ p_intf->p_sys->b_mute = ( i_lastShownVolume == 0 );
+ p_intf->p_sys->b_volume_update = FALSE;
+ }
/* Manage Playing status */
var_Get( p_input, "state", &val );
if( (i_end_scroll != -1) && (mdate() > i_end_scroll) )
[self resetScrollField];
- /* Manage volume status */
- [self manageVolumeSlider];
[NSTimer scheduledTimerWithTimeInterval: 0.3
target: self selector: @selector(manageIntf:)
if( i_volume != i_lastShownVolume )
{
- NSString *o_text;
- o_text = [NSString stringWithFormat: _NS("Volume: %d"), i_volume * 200 / AOUT_VOLUME_MAX];
- if( i_lastShownVolume != -1 )
- [self setScrollField:o_text stopAfter:1000000];
-
- [o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
- [o_volumeslider setEnabled: TRUE];
i_lastShownVolume = i_volume;
+ p_intf->p_sys->b_volume_update = TRUE;
}
-
- p_intf->p_sys->b_mute = ( i_volume == 0 );
}
- (IBAction)timesliderUpdate:(id)sender
playlist_t * p_playlist;
vout_thread_t * p_vout;
+#define p_input p_intf->p_sys->p_input
+ if( p_input )
+ {
+ vlc_object_release( p_input );
+ p_input = NULL;
+ }
+#undef p_input
+
/* Stop playback */
if( ( p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ) ) )
}
}
+- (IBAction)showWizard:(id)sender
+{
+ if (!nib_wizard_loaded)
+ {
+ nib_wizard_loaded = [NSBundle loadNibNamed:@"Wizard" owner:self];
+ [o_wizard initStrings];
+ [o_wizard resetWizard];
+ [o_wizard showWizard];
+ } else {
+ [o_wizard resetWizard];
+ [o_wizard showWizard];
+ }
+}
+
+- (IBAction)showExtended:(id)sender
+{
+ if (!nib_extended_loaded)
+ {
+ nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self];
+ [o_extended initStrings];
+ [o_extended showPanel];
+ } else {
+ [o_extended showPanel];
+ }
+}
+
+- (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];
+ }
+
+ if (!nib_bookmarks_loaded)
+ {
+ nib_bookmarks_loaded = [NSBundle loadNibNamed:@"Bookmarks" owner:self];
+ [o_bookmarks showBookmarks];
+ } else {
+ [o_bookmarks showBookmarks];
+ }
+}
+
- (IBAction)viewAbout:(id)sender
{
- [o_about showPanel];
+ if (!nib_about_loaded)
+ {
+ nib_about_loaded = [NSBundle loadNibNamed:@"About" owner:self];
+ [o_about showPanel];
+ } else {
+ [o_about showPanel];
+ }
}
- (IBAction)viewPreferences:(id)sender
[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;
}
else
{
- NSBeginInformationalAlertSheet(_NS("No CrashLog found"), @"Continue", nil, nil, o_msgs_panel, self, NULL, NULL, nil, _NS("Either you are running Mac OS X pre 10.2 or you haven't experienced any heavy crashes yet.") );
+ NSBeginInformationalAlertSheet(_NS("No CrashLog found"), @"Continue", nil, nil, o_msgs_panel, self, NULL, NULL, nil, _NS("You haven't experienced any heavy crashes yet.") );
}
}
if ( o_size_with_playlist.height > 200 )
{
o_rect.size.height = o_size_with_playlist.height;
+ } else {
+ o_rect.size.height = 500;
}
- else
+
+ if ( o_size_with_playlist.width > [o_window minSize].width )
{
- o_rect.size.height = 500;
- if ( o_rect.size.width == [o_window minSize].width )
- {
- o_rect.size.width = 500;
- }
-
+ o_rect.size.width = o_size_with_playlist.width;
+ } else {
+ o_rect.size.width = 500;
}
+
o_rect.size.height = (o_size_with_playlist.height > 200) ?
o_size_with_playlist.height : 500;
o_rect.origin.x = [o_window frame].origin.x;
{
/* make small */
o_rect.size.height = [o_window minSize].height;
+ o_rect.size.width = [o_window minSize].width;
o_rect.origin.x = [o_window frame].origin.x;
/* Calculate the position of the lower right corner after resize */
o_rect.origin.y = [o_window frame].origin.y +