* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.42 2003/01/31 02:53:52 jlj Exp $
+ * $Id: intf.m,v 1.57 2003/02/13 14:16:41 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
return( o_str );
}
+- (char *)delocalizeString:(NSString *)id
+{
+ NSData * o_data = [id dataUsingEncoding: i_encoding
+ allowLossyConversion: NO];
+ char * psz_string;
+
+ if ( o_data == nil )
+ {
+ o_data = [id dataUsingEncoding: i_encoding
+ allowLossyConversion: YES];
+ psz_string = malloc( [o_data length] + 1 );
+ [o_data getBytes: psz_string];
+ psz_string[ [o_data length] ] = '\0';
+ msg_Err( p_intf, "cannot convert to wanted encoding: %s",
+ psz_string );
+ }
+ else
+ {
+ psz_string = malloc( [o_data length] + 1 );
+ [o_data getBytes: psz_string];
+ psz_string[ [o_data length] ] = '\0';
+ }
+
+ return psz_string;
+}
+
- (void)setIntf:(intf_thread_t *)_p_intf
{
p_intf = _p_intf;
[o_msgs_panel setTitle: _NS("Messages")];
[o_msgs_panel setExcludedFromWindowsMenu: TRUE];
[o_msgs_btn_ok setTitle: _NS("Close")];
+ [o_msgs_btn_crashlog setTitle: _NS("Open CrashLog")];
/* main menu */
- [o_mi_about setTitle: _NS("About VLC Media Player")];
- [o_mi_prefs setTitle: _NS("Preferences")];
+ [o_mi_about setTitle: _NS("About VLC media player")];
+ [o_mi_prefs setTitle: _NS("Preferences...")];
[o_mi_hide setTitle: _NS("Hide VLC")];
[o_mi_hide_others setTitle: _NS("Hide Others")];
[o_mi_show_all setTitle: _NS("Show All")];
[o_mi_previous setTitle: _NS("Previous")];
[o_mi_next setTitle: _NS("Next")];
[o_mi_loop setTitle: _NS("Loop")];
+ [o_mi_fwd setTitle: _NS("Step Forward")];
+ [o_mi_bwd setTitle: _NS("Step Backward")];
[o_mi_program setTitle: _NS("Program")];
[o_mi_title setTitle: _NS("Title")];
[o_mi_chapter setTitle: _NS("Chapter")];
[o_mi_device setTitle: _NS("Device")];
[o_mu_video setTitle: _NS("Video")];
+ [o_mi_half_window setTitle: _NS("Half Size")];
+ [o_mi_normal_window setTitle: _NS("Normal Size")];
+ [o_mi_double_window setTitle: _NS("Double Size")];
[o_mi_fullscreen setTitle: _NS("Fullscreen")];
[o_mi_screen setTitle: _NS("Screen")];
[o_mi_deinterlace setTitle: _NS("Deinterlace")];
[o_mu_help setTitle: _NS("Help")];
[o_mi_readme setTitle: _NS("ReadMe...")];
- [o_mi_reportabug setTitle: _NS("Report A Bug")];
+ [o_mi_reportabug setTitle: _NS("Report a Bug")];
[o_mi_website setTitle: _NS("VideoLAN Website")];
[o_mi_license setTitle: _NS("License")];
/* dock menu */
[o_dmi_play setTitle: _NS("Play")];
[o_dmi_stop setTitle: _NS("Stop")];
+ [o_dmi_next setTitle: _NS("Next")];
+ [o_dmi_previous setTitle: _NS("Previous")];
/* error panel */
[o_error setTitle: _NS("Error")];
addPort: p_intf->p_sys->o_sendport
forMode: NSDefaultRunLoopMode];
- [NSTimer scheduledTimerWithTimeInterval: 0.1
+ [NSTimer scheduledTimerWithTimeInterval: 0.5
target: self selector: @selector(manageIntf:)
userInfo: nil repeats: TRUE];
if( p_playlist != NULL )
{
- vlc_mutex_lock( &p_playlist->object_lock );
+ vlc_value_t val;
+ if( var_Get( (vlc_object_t *)p_playlist, "intf-change", &val )
+ >= 0 && val.b_bool )
+ {
+ p_intf->p_sys->b_playlist_update = 1;
+ p_intf->p_sys->b_intf_update = VLC_TRUE;
+ }
+
+ vlc_mutex_lock( &p_playlist->object_lock );
+
[self manage: p_playlist];
-
+
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
}
vlc_mutex_unlock( &p_intf->change_lock );
- o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: 0.1];
+ o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: .5];
[NSThread sleepUntilDate: o_sleep_date];
}
if( !p_input->b_die )
{
+ audio_volume_t i_volume;
+
/* New input or stream map change */
if( p_input->stream.b_changed )
{
if( p_aout != NULL )
{
vlc_value_t val;
- audio_volume_t i_volume;
if( var_Get( (vlc_object_t *)p_aout, "intf-change", &val )
>= 0 && val.b_bool )
p_intf->p_sys->b_aout_update = 1;
b_need_menus = VLC_TRUE;
}
-
- aout_VolumeGet( p_aout, &i_volume );
vlc_object_release( (vlc_object_t *)p_aout );
-
- p_intf->p_sys->b_mute = ( i_volume == 0 );
}
+ aout_VolumeGet( p_intf, &i_volume );
+ p_intf->p_sys->b_mute = ( i_volume == 0 );
p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
p_intf->p_sys->b_chapter_update = 1;
p_intf->p_sys->b_audio_update = 1;
p_intf->p_sys->b_spu_update = 1;
+ p_intf->p_sys->b_current_title_update = 1;
p_intf->p_sys->i_part = 0;
p_playlist->p_input->stream.b_changed = 0;
+
msg_Dbg( p_intf, "stream has changed, refreshing interface" );
}
else
}
vlc_mutex_lock( &p_playlist->object_lock );
+
+ if ( p_intf->p_sys->b_playlist_update )
+ {
+ vlc_value_t val;
+ val.b_bool = 0;
+
+ var_Set( (vlc_object_t *)p_playlist, "intf-change", val );
+ [o_playlist playlistUpdated];
+ p_intf->p_sys->b_playlist_update = VLC_FALSE;
+ }
#define p_input p_playlist->p_input
{
vlc_mutex_lock( &p_input->stream.stream_lock );
}
+
+ if( p_intf->p_sys->b_current_title_update )
+ {
+ id o_awindow = [NSApp keyWindow];
+ NSArray *o_windows = [NSApp windows];
+ NSEnumerator *o_enumerator = [o_windows objectEnumerator];
+
+ while ((o_awindow = [o_enumerator nextObject]))
+ {
+ if( [[o_awindow className] isEqualToString: @"VLCWindow"] )
+ {
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ [o_awindow updateTitle];
+ vlc_mutex_lock( &p_playlist->object_lock );
+ }
+ }
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ [o_playlist updateState];
+ vlc_mutex_lock( &p_playlist->object_lock );
+ p_intf->p_sys->b_current_title_update = FALSE;
+ }
if( p_intf->p_sys->b_intf_update )
{
- (void)manageVolumeSlider
{
audio_volume_t i_volume;
- vlc_bool_t b_audio = VLC_FALSE;
intf_thread_t * p_intf = [NSApp getIntf];
- aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
- FIND_ANYWHERE );
- if( p_aout != NULL )
- {
- b_audio = VLC_TRUE;
-
- aout_VolumeGet( p_aout, &i_volume );
- vlc_object_release( (vlc_object_t *)p_aout );
- }
- else
- {
- i_volume = (audio_volume_t)config_GetInt( p_intf, "volume" );
- }
+ aout_VolumeGet( p_intf, &i_volume );
[o_volumeslider setFloatValue: (float)i_volume / AOUT_VOLUME_STEP];
- [o_volumeslider setEnabled: b_audio];
+ [o_volumeslider setEnabled: 1];
p_intf->p_sys->b_mute = ( i_volume == 0 );
}
p_input->stream.pp_programs[i]->i_number );
psz_title[sizeof(psz_title) - 1] = '\0';
- o_menu_title = [NSString stringWithCString: psz_title];
+ o_menu_title = [NSApp localizedString: psz_title];
o_item = [o_program addItemWithTitle: o_menu_title
action: pf_toggle_program keyEquivalent: @""];
p_input->stream.pp_areas[i]->i_part_nb );
psz_title[sizeof(psz_title) - 1] = '\0';
- o_menu_title = [NSString stringWithCString: psz_title];
+ o_menu_title = [NSApp localizedString: psz_title];
o_item = [o_title addItemWithTitle: o_menu_title
action: pf_toggle_title keyEquivalent: @""];
snprintf( psz_title, sizeof(psz_title), "Chapter %d", i + 1 );
psz_title[sizeof(psz_title) - 1] = '\0';
- o_menu_title = [NSString stringWithCString: psz_title];
+ o_menu_title = [NSApp localizedString: psz_title];
o_item = [o_chapter addItemWithTitle: o_menu_title
action: pf_toggle_chapter keyEquivalent: @""];
if( *ES->psz_desc )
{
- o_title = [NSString stringWithCString: ES->psz_desc];
+ o_title = [NSApp localizedString: ES->psz_desc];
}
else
{
char psz_title[ 256 ];
- snprintf( psz_title, sizeof(psz_title), "Language 0x%x",
+ snprintf( psz_title, sizeof(psz_title), _("Language 0x%x"),
ES->i_id );
psz_title[sizeof(psz_title) - 1] = '\0';
- o_title = [NSString stringWithCString: psz_title];
+ o_title = [NSApp localizedString: psz_title];
}
o_lmi = [o_menu addItemWithTitle: o_title
NSMenuItem * o_lmi;
NSString * o_title;
- o_title = [NSString stringWithCString:
- val.p_list->p_values[i].psz_string];
+ o_title = [NSApp localizedString: val.p_list->p_values[i].psz_string];
o_lmi = [o_menu addItemWithTitle: o_title
action: pf_callback keyEquivalent: @""];
/* FIXME: this isn't 64-bit clean ! */
withApplication: @"TextEdit"];
}
+- (IBAction)openCrashLog:(id)sender
+{
+ NSString * o_path = [@"~/Library/Logs/CrashReporter/VLC.crash.log"
+ stringByExpandingTildeInPath];
+
+
+ if ( [[NSFileManager defaultManager] fileExistsAtPath: o_path ] )
+ {
+ [[NSWorkspace sharedWorkspace] openFile: o_path
+ withApplication: @"Console"];
+ }
+ 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.") );
+
+ }
+}
+
- (void)windowDidBecomeKey:(NSNotification *)o_notification
{
if( [o_notification object] == o_msgs_panel )