📄 intf.m
字号:
[o_btn_fullscreen setToolTip: _NS("Fullscreen")]; [o_volumeslider setToolTip: _NS("Volume")]; [o_timeslider setToolTip: _NS("Position")]; [o_btn_playlist setToolTip: _NS("Playlist")]; /* messages panel */ [o_msgs_panel setTitle: _NS("Messages")]; [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_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_mi_quit setTitle: _NS("Quit VLC")]; [o_mu_file setTitle: _ANS("1:File")]; [o_mi_open_generic setTitle: _NS("Open File...")]; [o_mi_open_file setTitle: _NS("Quick Open File...")]; [o_mi_open_disc setTitle: _NS("Open Disc...")]; [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_mu_edit setTitle: _NS("Edit")]; [o_mi_cut setTitle: _NS("Cut")]; [o_mi_copy setTitle: _NS("Copy")]; [o_mi_paste setTitle: _NS("Paste")]; [o_mi_clear setTitle: _NS("Clear")]; [o_mi_select_all setTitle: _NS("Select All")]; [o_mu_controls setTitle: _NS("Controls")]; [o_mi_play setTitle: _NS("Play")]; [o_mi_stop setTitle: _NS("Stop")]; [o_mi_faster setTitle: _NS("Faster")]; [o_mi_slower setTitle: _NS("Slower")]; [o_mi_previous setTitle: _NS("Previous")]; [o_mi_next setTitle: _NS("Next")]; [o_mi_random setTitle: _NS("Random")]; [o_mi_repeat setTitle: _NS("Repeat One")]; [o_mi_loop setTitle: _NS("Repeat All")]; [o_mi_fwd setTitle: _NS("Step Forward")]; [o_mi_bwd setTitle: _NS("Step Backward")]; [o_mi_program setTitle: _NS("Program")]; [o_mu_program setTitle: _NS("Program")]; [o_mi_title setTitle: _NS("Title")]; [o_mu_title setTitle: _NS("Title")]; [o_mi_chapter setTitle: _NS("Chapter")]; [o_mu_chapter setTitle: _NS("Chapter")]; [o_mu_audio setTitle: _NS("Audio")]; [o_mi_vol_up setTitle: _NS("Volume Up")]; [o_mi_vol_down setTitle: _NS("Volume Down")]; [o_mi_mute setTitle: _NS("Mute")]; [o_mi_audiotrack setTitle: _NS("Audio Track")]; [o_mu_audiotrack setTitle: _NS("Audio Track")]; [o_mi_channels setTitle: _NS("Audio Channels")]; [o_mu_channels setTitle: _NS("Audio Channels")]; [o_mi_device setTitle: _NS("Audio Device")]; [o_mu_device setTitle: _NS("Audio Device")]; [o_mi_visual setTitle: _NS("Visualizations")]; [o_mu_visual setTitle: _NS("Visualizations")]; [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_fittoscreen setTitle: _NS("Fit to Screen")]; [o_mi_fullscreen setTitle: _NS("Fullscreen")]; [o_mi_floatontop setTitle: _NS("Float on Top")]; [o_mi_snapshot setTitle: _NS("Snapshot")]; [o_mi_videotrack setTitle: _NS("Video Track")]; [o_mu_videotrack setTitle: _NS("Video Track")]; [o_mi_screen setTitle: _NS("Video Device")]; [o_mu_screen setTitle: _NS("Video Device")]; [o_mi_subtitle setTitle: _NS("Subtitles Track")]; [o_mu_subtitle setTitle: _NS("Subtitles Track")]; [o_mi_deinterlace setTitle: _NS("Deinterlace")]; [o_mu_deinterlace setTitle: _NS("Deinterlace")]; [o_mi_ffmpeg_pp setTitle: _NS("Post processing")]; [o_mu_ffmpeg_pp setTitle: _NS("Post processing")]; [o_mu_window setTitle: _NS("Window")]; [o_mi_minimize setTitle: _NS("Minimize Window")]; [o_mi_close_window setTitle: _NS("Close Window")]; [o_mi_controller setTitle: _NS("Controller")]; [o_mi_equalizer setTitle: _NS("Equalizer")]; [o_mi_playlist setTitle: _NS("Playlist")]; [o_mi_info setTitle: _NS("Info")]; [o_mi_messages setTitle: _NS("Messages")]; [o_mi_bring_atf setTitle: _NS("Bring All to Front")]; [o_mu_help setTitle: _NS("Help")]; [o_mi_readme setTitle: _NS("ReadMe...")]; [o_mi_documentation setTitle: _NS("Online Documentation")]; [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")]; [o_dmi_mute setTitle: _NS("Mute")]; /* 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_btn_msgs setTitle: _NS("Open Messages Window")]; [o_err_btn_dismiss setTitle: _NS("Dismiss")]; [o_err_ckbk_surpress setTitle: _NS("Suppress further errors")]; [o_info_window setTitle: _NS("Info")];}- (void)applicationWillFinishLaunching:(NSNotification *)o_notification{ o_msg_lock = [[NSLock alloc] init]; o_msg_arr = [[NSMutableArray arrayWithCapacity: 200] retain]; o_img_play = [[NSImage imageNamed: @"play"] retain]; o_img_play_pressed = [[NSImage imageNamed: @"play_blue"] retain]; o_img_pause = [[NSImage imageNamed: @"pause"] retain]; o_img_pause_pressed = [[NSImage imageNamed: @"pause_blue"] retain]; [p_intf->p_sys->o_sendport setDelegate: self]; [[NSRunLoop currentRunLoop] addPort: p_intf->p_sys->o_sendport forMode: NSDefaultRunLoopMode]; [NSTimer scheduledTimerWithTimeInterval: 0.5 target: self selector: @selector(manageIntf:) userInfo: nil repeats: FALSE]; [NSThread detachNewThreadSelector: @selector(manage) toTarget: self withObject: nil]; [o_controls setupVarMenuItem: o_mi_add_intf target: (vlc_object_t *)p_intf var: "intf-add" selector: @selector(toggleVar:)]; vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW );}- (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename{ NSDictionary *o_dic = [NSDictionary dictionaryWithObjectsAndKeys: o_filename, @"ITEM_URL", nil]; [o_playlist appendArray: [NSArray arrayWithObject: o_dic] atPos: -1 enqueue: NO]; return( TRUE );}- (NSString *)localizedString:(char *)psz{ NSString * o_str = nil; if( psz != NULL ) { o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease]; } if ( o_str == NULL ) { msg_Err( VLCIntf, "could not translate: %s", psz ); } return( o_str );}- (char *)delocalizeString:(NSString *)id{ NSData * o_data = [id dataUsingEncoding: NSUTF8StringEncoding allowLossyConversion: NO]; char * psz_string; if ( o_data == nil ) { o_data = [id dataUsingEncoding: NSUTF8StringEncoding allowLossyConversion: YES]; psz_string = malloc( [o_data length] + 1 ); [o_data getBytes: psz_string]; psz_string[ [o_data length] ] = '\0'; msg_Err( VLCIntf, "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;}/* i_width is in pixels */- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int) i_width{ NSMutableString *o_wrapped; NSString *o_out_string; NSRange glyphRange, effectiveRange, charRange; NSRect lineFragmentRect; unsigned glyphIndex, breaksInserted = 0; NSTextStorage *o_storage = [[NSTextStorage alloc] initWithString: o_in_string attributes: [NSDictionary dictionaryWithObjectsAndKeys: [NSFont labelFontOfSize: 0.0], NSFontAttributeName, nil]]; NSLayoutManager *o_layout_manager = [[NSLayoutManager alloc] init]; NSTextContainer *o_container = [[NSTextContainer alloc] initWithContainerSize: NSMakeSize(i_width, 2000)]; [o_layout_manager addTextContainer: o_container]; [o_container release]; [o_storage addLayoutManager: o_layout_manager]; [o_layout_manager release]; o_wrapped = [o_in_string mutableCopy]; glyphRange = [o_layout_manager glyphRangeForTextContainer: o_container]; for( glyphIndex = glyphRange.location ; glyphIndex < NSMaxRange(glyphRange) ; glyphIndex += effectiveRange.length) { lineFragmentRect = [o_layout_manager lineFragmentRectForGlyphAtIndex: glyphIndex effectiveRange: &effectiveRange]; charRange = [o_layout_manager characterRangeForGlyphRange: effectiveRange actualGlyphRange: &effectiveRange]; if ([o_wrapped lineRangeForRange: NSMakeRange(charRange.location + breaksInserted, charRange.length)].length > charRange.length) { [o_wrapped insertString: @"\n" atIndex: NSMaxRange(charRange) + breaksInserted]; breaksInserted++; } } o_out_string = [NSString stringWithString: o_wrapped]; [o_wrapped release]; [o_storage release]; return o_out_string;}/***************************************************************************** * 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]; switch( key ) { case NSDeleteCharacter: 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 ); 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;}- (id)getControls{ if ( o_controls ) { return o_controls; } return nil;}- (id)getPlaylist{ if ( o_playlist ) { return o_playlist; } return nil;}- (id)getInfo{ if ( o_info ) { return o_info; } return nil;}- (void)manage{ NSDate * o_sleep_date; playlist_t * p_playlist; /* new thread requires a new pool */ NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); if( p_playlist != NULL ) { var_AddCallback( p_playlist, "intf-change", PlaylistChanged, self ); var_AddCallback( p_playlist, "item-change", PlaylistChanged, self ); var_AddCallback( p_playlist, "item-append", PlaylistChanged, self ); var_AddCallback( p_playlist, "item-deleted", PlaylistChanged, self ); var_AddCallback( p_playlist, "playlist-current", PlaylistChanged, self ); vlc_object_release( p_playlist ); } while( !p_intf->b_die ) { vlc_mutex_lock( &p_intf->change_lock );#define p_input p_intf->p_sys->p_input if( p_input == NULL ) { p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE ); /* Refresh the interface */ if( p_input ) { msg_Dbg( p_intf, "input has changed, refreshing interface" ); p_intf->p_sys->b_input_update = VLC_TRUE; } } else if( p_input->b_die || p_input->b_dead ) { /* input stopped */ p_intf->p_sys->b_intf_update = VLC_TRUE; p_intf->p_sys->i_play_status = END_S; [self setScrollField: _NS("VLC media player") stopAfter:-1]; vlc_object_release( p_input ); p_input = NULL; }#undef p_input /* Manage volume status */ [self manageVolumeSlider]; vlc_mutex_unlock( &p_intf->change_lock ); o_sleep_date = [NSDate dateWithTimeIntervalSinceNow: .1]; [NSThread sleepUntilDate: o_sleep_date]; } [self terminate]; [o_pool release];}- (void)manageIntf:(NSTimer *)o_timer{ vlc_value_t val; if( p_intf->p_vlc->b_die == VLC_TRUE ) { [o_timer invalidate]; return; }#define p_input p_intf->p_sys->p_input if( p_intf->p_sys->b_input_update ) { /* Called when new input is opened */ p_intf->p_sys->b_current_title_update = VLC_TRUE; p_intf->p_sys->b_intf_update = VLC_TRUE; p_intf->p_sys->b_input_update = VLC_FALSE; } if( p_intf->p_sys->b_intf_update ) { vlc_bool_t b_input = VLC_FALSE; vlc_bool_t b_plmul = VLC_FALSE; vlc_bool_t b_control = VLC_FALSE; vlc_bool_t b_seekable = VLC_FALSE; vlc_bool_t b_chapters = VLC_FALSE; playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); b_plmul = p_playlist->i_size > 1; vlc_object_release( p_playlist ); if( ( b_input = ( p_input != NULL ) ) ) { /* seekable streams */ var_Get( p_input, "seekable", &val);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -