intf.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * intf.h: MacOS X interface module
00003  *****************************************************************************
00004  * Copyright (C) 2002-2009 the VideoLAN team
00005  * $Id: 56d293b268bb3d0d96d4d3efcb0b52e60c96c5e4 $
00006  *
00007  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
00008  *          Christophe Massiot <massiot@via.ecp.fr>
00009  *          Derk-Jan Hartman <hartman at videolan dot org>
00010  *          Felix Paul Kühne <fkuehne at videolan dot org>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00025  *****************************************************************************/
00026 
00027 #ifdef HAVE_CONFIG_H
00028 #   include "config.h"
00029 #endif
00030 
00031 #include <vlc_common.h>
00032 #include <vlc_interface.h>
00033 #include <vlc_playlist.h>
00034 #include <vlc_vout.h>
00035 #include <vlc_aout.h>
00036 #include <vlc_input.h>
00037 
00038 #include <Cocoa/Cocoa.h>
00039 
00040 /*****************************************************************************
00041  * Local prototypes.
00042  *****************************************************************************/
00043 unsigned int CocoaKeyToVLC( unichar i_key );
00044 
00045 #define VLCIntf [[VLCMain sharedInstance] intf]
00046 
00047 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
00048 /* Get an alternate version of the string.
00049  * This string is stored as '1:string' but when displayed it only displays
00050  * the translated string. the translation should be '1:translatedstring' though */
00051 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
00052 
00053 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
00054             @"/System/Library/CoreServices/SystemVersion.plist"] \
00055             objectForKey: @"ProductVersion"] floatValue]
00056 
00057 
00058 // You need to release those objects after use
00059 input_thread_t *getInput(void);
00060 vout_thread_t *getVout(void);
00061 aout_instance_t *getAout(void);
00062 
00063 /*****************************************************************************
00064  * intf_sys_t: description and status of the interface
00065  *****************************************************************************/
00066 struct intf_sys_t
00067 {
00068     /* special actions */
00069     bool b_mute;
00070     int i_play_status;
00071 
00072     /* interface update */
00073     bool b_intf_update;
00074     bool b_playlist_update;
00075     bool b_playmode_update;
00076     bool b_current_title_update;
00077     bool b_fullscreen_update;
00078     bool b_volume_update;
00079     bool b_intf_show;
00080 
00081     /* menus handlers */
00082     bool b_input_update;
00083     bool b_aout_update;
00084     bool b_vout_update;
00085 
00086     /* The messages window */
00087     msg_subscription_t * p_sub;
00088 };
00089 
00090 /*****************************************************************************
00091  * VLCMain interface
00092  *****************************************************************************/
00093 @class AppleRemote;
00094 @class VLCInformation;
00095 @class VLCControllerWindow;
00096 @class VLCEmbeddedWindow;
00097 @class VLCControls;
00098 @class VLCPlaylist;
00099 @interface VLCMain : NSObject
00100 {
00101     intf_thread_t *p_intf;      /* The main intf object */
00102     id o_prefs;                 /* VLCPrefs       */
00103     id o_sprefs;                /* VLCSimplePrefs */
00104     id o_about;                 /* VLAboutBox     */
00105     id o_open;                  /* VLCOpen        */
00106     id o_wizard;                /* VLCWizard      */
00107     id o_extended;              /* VLCExtended    */
00108     id o_bookmarks;             /* VLCBookmarks   */
00109     id o_embedded_list;         /* VLCEmbeddedList*/
00110     id o_coredialogs;           /* VLCCoreDialogProvider */
00111     VLCInformation * o_info;    /* VLCInformation */
00112     id o_eyetv;                 /* VLCEyeTVController */
00113     BOOL nib_main_loaded;       /* main nibfile */
00114     BOOL nib_open_loaded;       /* open nibfile */
00115     BOOL nib_about_loaded;      /* about nibfile */
00116     BOOL nib_wizard_loaded;     /* wizard nibfile */
00117     BOOL nib_extended_loaded;   /* extended nibfile */
00118     BOOL nib_bookmarks_loaded;  /* bookmarks nibfile */
00119     BOOL nib_prefs_loaded;      /* preferences nibfile */
00120     BOOL nib_info_loaded;       /* information panel nibfile */
00121     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
00122 
00123     IBOutlet VLCControllerWindow * o_window;                     /* main window */
00124     IBOutlet NSView * o_playlist_view;                          /* playlist view  */
00125     IBOutlet id o_scrollfield;                                  /* info field */
00126     IBOutlet NSTextField * o_timefield;                         /* time field */
00127     IBOutlet NSSlider * o_timeslider;                           /* time slider */
00128     BOOL b_time_remaining;                                      /* show remaining time or playtime ? */
00129     IBOutlet VLCEmbeddedWindow * o_embedded_window;             /* Embedded Vout Window */
00130     float f_slider;                                             /* slider value */
00131     float f_slider_old;                                         /* old slider val */
00132     IBOutlet NSSlider * o_volumeslider;                         /* volume slider */
00133 
00134     IBOutlet NSView * toolbarMediaControl;   /* view with the controls */
00135 
00136     IBOutlet NSProgressIndicator * o_main_pgbar;   /* playlist window progress bar */
00137     IBOutlet NSButton * o_btn_prev;     /* btn previous   */
00138     IBOutlet NSButton * o_btn_rewind;   /* btn rewind     */
00139     IBOutlet NSButton * o_btn_play;     /* btn play       */
00140     IBOutlet NSButton * o_btn_stop;     /* btn stop       */
00141     IBOutlet NSButton * o_btn_ff;       /* btn fast forward     */
00142     IBOutlet NSButton * o_btn_next;     /* btn next       */
00143     IBOutlet NSButton * o_btn_fullscreen;/* btn fullscreen (embedded vout window) */
00144     IBOutlet NSButton * o_btn_playlist; /* btn playlist   */
00145     IBOutlet NSButton * o_btn_equalizer; /* eq btn */
00146 
00147     NSImage * o_img_play;       /* btn play img   */
00148     NSImage * o_img_pause;      /* btn pause img  */
00149     NSImage * o_img_play_pressed;       /* btn play img   */
00150     NSImage * o_img_pause_pressed;      /* btn pause img  */
00151 
00152     IBOutlet VLCControls * o_controls;     /* VLCControls    */
00153     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
00154 
00155     IBOutlet NSTextView * o_messages;           /* messages tv    */
00156     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
00157     NSMutableArray * o_msg_arr;                 /* messages array */
00158     NSLock * o_msg_lock;                        /* messages lock */
00159     BOOL b_msg_arr_changed;                     /* did the array change? */
00160     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
00161     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
00162 
00163     /* CrashReporter panel */
00164     IBOutlet NSButton * o_crashrep_dontSend_btn;
00165     IBOutlet NSButton * o_crashrep_send_btn;
00166     IBOutlet NSTextView * o_crashrep_fld;
00167     IBOutlet NSTextField * o_crashrep_title_txt;
00168     IBOutlet NSTextField * o_crashrep_desc_txt;
00169     IBOutlet NSWindow * o_crashrep_win;
00170     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
00171     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
00172 
00173     /* main menu */
00174 
00175     IBOutlet NSMenuItem * o_mi_about;
00176     IBOutlet NSMenuItem * o_mi_prefs;
00177     IBOutlet NSMenuItem * o_mi_sprefs;
00178     IBOutlet NSMenuItem * o_mi_checkForUpdate;
00179     IBOutlet NSMenuItem * o_mi_add_intf;
00180     IBOutlet NSMenu * o_mu_add_intf;
00181     IBOutlet NSMenuItem * o_mi_services;
00182     IBOutlet NSMenuItem * o_mi_hide;
00183     IBOutlet NSMenuItem * o_mi_hide_others;
00184     IBOutlet NSMenuItem * o_mi_show_all;
00185     IBOutlet NSMenuItem * o_mi_quit;
00186 
00187     IBOutlet NSMenu * o_mu_file;
00188     IBOutlet NSMenuItem * o_mi_open_file;
00189     IBOutlet NSMenuItem * o_mi_open_generic;
00190     IBOutlet NSMenuItem * o_mi_open_disc;
00191     IBOutlet NSMenuItem * o_mi_open_net;
00192     IBOutlet NSMenuItem * o_mi_open_capture;
00193     IBOutlet NSMenuItem * o_mi_open_recent;
00194     IBOutlet NSMenuItem * o_mi_open_recent_cm;
00195     IBOutlet NSMenuItem * o_mi_open_wizard;
00196 
00197     IBOutlet NSMenu * o_mu_edit;
00198     IBOutlet NSMenuItem * o_mi_cut;
00199     IBOutlet NSMenuItem * o_mi_copy;
00200     IBOutlet NSMenuItem * o_mi_paste;
00201     IBOutlet NSMenuItem * o_mi_clear;
00202     IBOutlet NSMenuItem * o_mi_select_all;
00203 
00204     IBOutlet NSMenu * o_mu_controls;
00205     IBOutlet NSMenuItem * o_mi_play;
00206     IBOutlet NSMenuItem * o_mi_stop;
00207     IBOutlet NSMenuItem * o_mi_faster;
00208     IBOutlet NSMenuItem * o_mi_slower;
00209     IBOutlet NSMenuItem * o_mi_normalSpeed;
00210     IBOutlet NSMenuItem * o_mi_previous;
00211     IBOutlet NSMenuItem * o_mi_next;
00212     IBOutlet NSMenuItem * o_mi_random;
00213     IBOutlet NSMenuItem * o_mi_repeat;
00214     IBOutlet NSMenuItem * o_mi_loop;
00215     IBOutlet NSMenuItem * o_mi_quitAfterPB;
00216     IBOutlet NSMenuItem * o_mi_fwd;
00217     IBOutlet NSMenuItem * o_mi_bwd;
00218     IBOutlet NSMenuItem * o_mi_fwd1m;
00219     IBOutlet NSMenuItem * o_mi_bwd1m;
00220     IBOutlet NSMenuItem * o_mi_fwd5m;
00221     IBOutlet NSMenuItem * o_mi_bwd5m;
00222     IBOutlet NSMenuItem * o_mi_program;
00223     IBOutlet NSMenu * o_mu_program;
00224     IBOutlet NSMenuItem * o_mi_title;
00225     IBOutlet NSMenu * o_mu_title;
00226     IBOutlet NSMenuItem * o_mi_chapter;
00227     IBOutlet NSMenu * o_mu_chapter;
00228 
00229     IBOutlet NSMenu * o_mu_audio;
00230     IBOutlet NSMenuItem * o_mi_vol_up;
00231     IBOutlet NSMenuItem * o_mi_vol_down;
00232     IBOutlet NSMenuItem * o_mi_mute;
00233     IBOutlet NSMenuItem * o_mi_audiotrack;
00234     IBOutlet NSMenu * o_mu_audiotrack;
00235     IBOutlet NSMenuItem * o_mi_channels;
00236     IBOutlet NSMenu * o_mu_channels;
00237     IBOutlet NSMenuItem * o_mi_device;
00238     IBOutlet NSMenu * o_mu_device;
00239     IBOutlet NSMenuItem * o_mi_visual;
00240     IBOutlet NSMenu * o_mu_visual;
00241 
00242     IBOutlet NSMenu * o_mu_video;
00243     IBOutlet NSMenuItem * o_mi_half_window;
00244     IBOutlet NSMenuItem * o_mi_normal_window;
00245     IBOutlet NSMenuItem * o_mi_double_window;
00246     IBOutlet NSMenuItem * o_mi_fittoscreen;
00247     IBOutlet NSMenuItem * o_mi_fullscreen;
00248     IBOutlet NSMenuItem * o_mi_floatontop;
00249     IBOutlet NSMenuItem * o_mi_snapshot;
00250     IBOutlet NSMenuItem * o_mi_videotrack;
00251     IBOutlet NSMenu * o_mu_videotrack;
00252     IBOutlet NSMenuItem * o_mi_screen;
00253     IBOutlet NSMenu * o_mu_screen;
00254     IBOutlet NSMenuItem * o_mi_aspect_ratio;
00255     IBOutlet NSMenu * o_mu_aspect_ratio;
00256     IBOutlet NSMenuItem * o_mi_crop;
00257     IBOutlet NSMenu * o_mu_crop;
00258     IBOutlet NSMenuItem * o_mi_subtitle;
00259     IBOutlet NSMenu * o_mu_subtitle;
00260     IBOutlet NSMenuItem * o_mi_addSub;
00261     IBOutlet NSMenuItem * o_mi_deinterlace;
00262     IBOutlet NSMenu * o_mu_deinterlace;
00263     IBOutlet NSMenuItem * o_mi_ffmpeg_pp;
00264     IBOutlet NSMenu * o_mu_ffmpeg_pp;
00265     IBOutlet NSMenuItem * o_mi_teletext;
00266     IBOutlet NSMenuItem * o_mi_teletext_transparent;
00267     IBOutlet NSMenuItem * o_mi_teletext_index;
00268     IBOutlet NSMenuItem * o_mi_teletext_red;
00269     IBOutlet NSMenuItem * o_mi_teletext_green;
00270     IBOutlet NSMenuItem * o_mi_teletext_yellow;
00271     IBOutlet NSMenuItem * o_mi_teletext_blue;
00272 
00273     IBOutlet NSMenu * o_mu_window;
00274     IBOutlet NSMenuItem * o_mi_minimize;
00275     IBOutlet NSMenuItem * o_mi_close_window;
00276     IBOutlet NSMenuItem * o_mi_player;
00277     IBOutlet NSMenuItem * o_mi_controller;
00278     IBOutlet NSMenuItem * o_mi_equalizer;
00279     IBOutlet NSMenuItem * o_mi_extended;
00280     IBOutlet NSMenuItem * o_mi_bookmarks;
00281     IBOutlet NSMenuItem * o_mi_playlist;
00282     IBOutlet NSMenuItem * o_mi_info;
00283     IBOutlet NSMenuItem * o_mi_messages;
00284     IBOutlet NSMenuItem * o_mi_bring_atf;
00285 
00286     IBOutlet NSMenu * o_mu_help;
00287     IBOutlet NSMenuItem * o_mi_help;
00288     IBOutlet NSMenuItem * o_mi_readme;
00289     IBOutlet NSMenuItem * o_mi_documentation;
00290     IBOutlet NSMenuItem * o_mi_license;
00291     IBOutlet NSMenuItem * o_mi_website;
00292     IBOutlet NSMenuItem * o_mi_donation;
00293     IBOutlet NSMenuItem * o_mi_forum;
00294     IBOutlet NSMenuItem * o_mi_errorsAndWarnings;
00295 
00296     /* dock menu */
00297     IBOutlet NSMenuItem * o_dmi_play;
00298     IBOutlet NSMenuItem * o_dmi_stop;
00299     IBOutlet NSMenuItem * o_dmi_next;
00300     IBOutlet NSMenuItem * o_dmi_previous;
00301     IBOutlet NSMenuItem * o_dmi_mute;
00302 
00303     /* vout menu */
00304     IBOutlet NSMenu * o_vout_menu;
00305     IBOutlet NSMenuItem * o_vmi_play;
00306     IBOutlet NSMenuItem * o_vmi_stop;
00307     IBOutlet NSMenuItem * o_vmi_prev;
00308     IBOutlet NSMenuItem * o_vmi_next;
00309     IBOutlet NSMenuItem * o_vmi_volup;
00310     IBOutlet NSMenuItem * o_vmi_voldown;
00311     IBOutlet NSMenuItem * o_vmi_mute;
00312     IBOutlet NSMenuItem * o_vmi_fullscreen;
00313     IBOutlet NSMenuItem * o_vmi_snapshot;
00314 
00315     bool b_small_window;
00316 
00317     bool b_restore_size;
00318     NSRect o_restore_rect;
00319 
00320     mtime_t i_end_scroll;
00321 
00322     NSSize o_size_with_playlist;
00323 
00324     int     i_lastShownVolume;
00325 
00326     input_state_e cachedInputState;
00327 
00328     /* the manage thread */
00329     pthread_t manage_thread;
00330 
00331     /* The timer that update the interface */
00332     NSTimer * interfaceTimer;
00333 
00334     NSURLConnection * crashLogURLConnection;
00335 
00336     AppleRemote * o_remote;
00337     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
00338 }
00339 
00340 + (VLCMain *)sharedInstance;
00341 
00342 - (intf_thread_t *)intf;
00343 - (void)setIntf:(intf_thread_t *)p_mainintf;
00344 
00345 - (void)controlTintChanged;
00346 
00347 - (id)controls;
00348 - (id)simplePreferences;
00349 - (id)preferences;
00350 - (id)playlist;
00351 - (BOOL)isPlaylistCollapsed;
00352 - (id)info;
00353 - (id)wizard;
00354 - (id)bookmarks;
00355 - (id)embeddedList;
00356 - (id)coreDialogProvider;
00357 - (id)mainIntfPgbar;
00358 - (id)controllerWindow;
00359 - (id)voutMenu;
00360 - (id)eyeTVController;
00361 - (id)appleRemoteController;
00362 - (void)applicationWillTerminate:(NSNotification *)notification;
00363 - (NSString *)localizedString:(const char *)psz;
00364 - (char *)delocalizeString:(NSString *)psz;
00365 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
00366 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
00367 
00368 - (void)initStrings;
00369 
00370 - (void)manage;
00371 - (void)manageIntf:(NSTimer *)o_timer;
00372 - (void)setupMenus;
00373 - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification;
00374 - (void)setScrollField:(NSString *)o_string stopAfter:(int )timeout;
00375 - (void)resetScrollField;
00376 
00377 - (void)updateMessageDisplay;
00378 - (void)playStatusUpdated:(int) i_status;
00379 - (void)setSubmenusEnabled:(BOOL)b_enabled;
00380 - (void)manageVolumeSlider;
00381 - (IBAction)timesliderUpdate:(id)sender;
00382 - (IBAction)timeFieldWasClicked:(id)sender;
00383 
00384 - (IBAction)clearRecentItems:(id)sender;
00385 - (void)openRecentItem:(id)sender;
00386 
00387 - (IBAction)intfOpenFile:(id)sender;
00388 - (IBAction)intfOpenFileGeneric:(id)sender;
00389 - (IBAction)intfOpenDisc:(id)sender;
00390 - (IBAction)intfOpenNet:(id)sender;
00391 - (IBAction)intfOpenCapture:(id)sender;
00392 
00393 - (IBAction)showWizard:(id)sender;
00394 - (IBAction)showExtended:(id)sender;
00395 - (IBAction)showBookmarks:(id)sender;
00396 
00397 - (IBAction)viewAbout:(id)sender;
00398 - (IBAction)showLicense:(id)sender;
00399 - (IBAction)viewPreferences:(id)sender;
00400 - (IBAction)viewHelp:(id)sender;
00401 - (IBAction)openReadMe:(id)sender;
00402 - (IBAction)openDocumentation:(id)sender;
00403 - (IBAction)openWebsite:(id)sender;
00404 - (IBAction)openForum:(id)sender;
00405 - (IBAction)openDonate:(id)sender;
00406 - (IBAction)openCrashLog:(id)sender;
00407 - (IBAction)viewErrorsAndWarnings:(id)sender;
00408 - (IBAction)showMessagesPanel:(id)sender;
00409 - (IBAction)showInformationPanel:(id)sender;
00410 
00411 - (IBAction)crashReporterAction:(id)sender;
00412 - (IBAction)saveDebugLog:(id)sender;
00413 
00414 - (IBAction)togglePlaylist:(id)sender;
00415 - (void)updateTogglePlaylistState;
00416 
00417 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
00418 
00419 @end
00420 
00421 @interface VLCMain (Internal)
00422 - (void)handlePortMessage:(NSPortMessage *)o_msg;
00423 @end
00424 
00425 /*****************************************************************************
00426  * VLCApplication interface
00427  *****************************************************************************/
00428 
00429 @interface VLCApplication : NSApplication
00430 {
00431     BOOL b_justJumped;
00432     BOOL b_mediaKeySupport;
00433     BOOL b_activeInBackground;
00434     BOOL b_active;
00435 }
00436 
00437 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
00438 - (void)sendEvent: (NSEvent*)event;
00439 - (void)resetJump;
00440 
00441 @end

Generated on Tue May 25 08:04:56 2010 for VLC by  doxygen 1.5.6