00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <vlc/vlc.h>
00027 #include <vlc/intf.h>
00028 #include <vlc/vout.h>
00029 #include <vlc/aout.h>
00030 #include <vlc/input.h>
00031
00032 #include <Cocoa/Cocoa.h>
00033
00034
00035
00036
00037 int ExecuteOnMainThread( id target, SEL sel, void * p_arg );
00038 unsigned int CocoaKeyToVLC( unichar i_key );
00039
00040 #define VLCIntf [[VLCMain sharedInstance] getIntf]
00041
00042 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
00043
00044
00045
00046 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
00047
00048 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
00049 @"/System/Library/CoreServices/SystemVersion.plist"] \
00050 objectForKey: @"ProductVersion"] floatValue]
00051
00052
00053
00054
00055 struct intf_sys_t
00056 {
00057 NSAutoreleasePool * o_pool;
00058 NSPort * o_sendport;
00059
00060
00061 input_thread_t * p_input;
00062
00063
00064 vlc_bool_t b_mute;
00065 int i_play_status;
00066
00067
00068 vlc_bool_t b_intf_update;
00069 vlc_bool_t b_playlist_update;
00070 vlc_bool_t b_playmode_update;
00071 vlc_bool_t b_current_title_update;
00072 vlc_bool_t b_fullscreen_update;
00073 vlc_bool_t b_volume_update;
00074
00075
00076 vlc_bool_t b_input_update;
00077 vlc_bool_t b_aout_update;
00078 vlc_bool_t b_vout_update;
00079
00080
00081 msg_subscription_t * p_sub;
00082 };
00083
00084
00085
00086
00087 @interface VLCMain : NSObject
00088 {
00089 intf_thread_t *p_intf;
00090 id o_prefs;
00091 id o_about;
00092 id o_open;
00093 id o_wizard;
00094 id o_extended;
00095 id o_bookmarks;
00096
00097 BOOL nib_main_loaded;
00098 BOOL nib_open_loaded;
00099 BOOL nib_about_loaded;
00100 BOOL nib_wizard_loaded;
00101 BOOL nib_extended_loaded;
00102 BOOL nib_bookmarks_loaded;
00103
00104
00105 IBOutlet id o_window;
00106 IBOutlet id o_playlist_view;
00107 IBOutlet id o_scrollfield;
00108 IBOutlet id o_timefield;
00109 IBOutlet id o_timeslider;
00110 float f_slider;
00111 float f_slider_old;
00112 IBOutlet id o_volumeslider;
00113
00114 IBOutlet id o_btn_prev;
00115 IBOutlet id o_btn_rewind;
00116 IBOutlet id o_btn_play;
00117 IBOutlet id o_btn_stop;
00118 IBOutlet id o_btn_ff;
00119 IBOutlet id o_btn_next;
00120 IBOutlet id o_btn_fullscreen;
00121 IBOutlet id o_btn_playlist;
00122
00123 NSImage * o_img_play;
00124 NSImage * o_img_pause;
00125 NSImage * o_img_play_pressed;
00126 NSImage * o_img_pause_pressed;
00127
00128 IBOutlet id o_controls;
00129 IBOutlet id o_playlist;
00130 IBOutlet id o_info;
00131
00132 IBOutlet id o_messages;
00133 IBOutlet id o_msgs_panel;
00134 NSMutableArray * o_msg_arr;
00135 NSLock * o_msg_lock;
00136 IBOutlet id o_msgs_btn_crashlog;
00137
00138 IBOutlet id o_error;
00139 IBOutlet id o_err_msg;
00140 IBOutlet id o_err_lbl;
00141 IBOutlet id o_err_bug_lbl;
00142 IBOutlet id o_err_btn_msgs;
00143 IBOutlet id o_err_btn_dismiss;
00144 IBOutlet id o_err_ckbk_surpress;
00145
00146 IBOutlet id o_info_window;
00147
00148
00149
00150 IBOutlet id o_mi_about;
00151 IBOutlet id o_mi_prefs;
00152
00153 IBOutlet id o_mi_add_intf;
00154 IBOutlet id o_mu_add_intf;
00155 IBOutlet id o_mi_services;
00156 IBOutlet id o_mi_hide;
00157 IBOutlet id o_mi_hide_others;
00158 IBOutlet id o_mi_show_all;
00159 IBOutlet id o_mi_quit;
00160
00161 IBOutlet id o_mu_file;
00162 IBOutlet id o_mi_open_file;
00163 IBOutlet id o_mi_open_generic;
00164 IBOutlet id o_mi_open_disc;
00165 IBOutlet id o_mi_open_net;
00166 IBOutlet id o_mi_open_recent;
00167 IBOutlet id o_mi_open_recent_cm;
00168 IBOutlet id o_mi_open_wizard;
00169
00170 IBOutlet id o_mu_edit;
00171 IBOutlet id o_mi_cut;
00172 IBOutlet id o_mi_copy;
00173 IBOutlet id o_mi_paste;
00174 IBOutlet id o_mi_clear;
00175 IBOutlet id o_mi_select_all;
00176
00177 IBOutlet id o_mu_controls;
00178 IBOutlet id o_mi_play;
00179 IBOutlet id o_mi_stop;
00180 IBOutlet id o_mi_faster;
00181 IBOutlet id o_mi_slower;
00182 IBOutlet id o_mi_previous;
00183 IBOutlet id o_mi_next;
00184 IBOutlet id o_mi_random;
00185 IBOutlet id o_mi_repeat;
00186 IBOutlet id o_mi_loop;
00187 IBOutlet id o_mi_fwd;
00188 IBOutlet id o_mi_bwd;
00189 IBOutlet id o_mi_fwd1m;
00190 IBOutlet id o_mi_bwd1m;
00191 IBOutlet id o_mi_fwd5m;
00192 IBOutlet id o_mi_bwd5m;
00193 IBOutlet id o_mi_program;
00194 IBOutlet id o_mu_program;
00195 IBOutlet id o_mi_title;
00196 IBOutlet id o_mu_title;
00197 IBOutlet id o_mi_chapter;
00198 IBOutlet id o_mu_chapter;
00199
00200 IBOutlet id o_mu_audio;
00201 IBOutlet id o_mi_vol_up;
00202 IBOutlet id o_mi_vol_down;
00203 IBOutlet id o_mi_mute;
00204 IBOutlet id o_mi_audiotrack;
00205 IBOutlet id o_mu_audiotrack;
00206 IBOutlet id o_mi_channels;
00207 IBOutlet id o_mu_channels;
00208 IBOutlet id o_mi_device;
00209 IBOutlet id o_mu_device;
00210 IBOutlet id o_mi_visual;
00211 IBOutlet id o_mu_visual;
00212
00213 IBOutlet id o_mu_video;
00214 IBOutlet id o_mi_half_window;
00215 IBOutlet id o_mi_normal_window;
00216 IBOutlet id o_mi_double_window;
00217 IBOutlet id o_mi_fittoscreen;
00218 IBOutlet id o_mi_fullscreen;
00219 IBOutlet id o_mi_floatontop;
00220 IBOutlet id o_mi_snapshot;
00221 IBOutlet id o_mi_videotrack;
00222 IBOutlet id o_mu_videotrack;
00223 IBOutlet id o_mi_screen;
00224 IBOutlet id o_mu_screen;
00225 IBOutlet id o_mi_subtitle;
00226 IBOutlet id o_mu_subtitle;
00227 IBOutlet id o_mi_deinterlace;
00228 IBOutlet id o_mu_deinterlace;
00229 IBOutlet id o_mi_ffmpeg_pp;
00230 IBOutlet id o_mu_ffmpeg_pp;
00231
00232 IBOutlet id o_mu_window;
00233 IBOutlet id o_mi_minimize;
00234 IBOutlet id o_mi_close_window;
00235 IBOutlet id o_mi_controller;
00236 IBOutlet id o_mi_equalizer;
00237 IBOutlet id o_mi_extended;
00238 IBOutlet id o_mi_bookmarks;
00239 IBOutlet id o_mi_playlist;
00240 IBOutlet id o_mi_info;
00241 IBOutlet id o_mi_messages;
00242 IBOutlet id o_mi_bring_atf;
00243
00244 IBOutlet id o_mu_help;
00245 IBOutlet id o_mi_readme;
00246 IBOutlet id o_mi_documentation;
00247 IBOutlet id o_mi_reportabug;
00248 IBOutlet id o_mi_website;
00249 IBOutlet id o_mi_license;
00250 IBOutlet id o_mi_donation;
00251 IBOutlet id o_mi_forum;
00252
00253
00254 IBOutlet id o_dmi_play;
00255 IBOutlet id o_dmi_stop;
00256 IBOutlet id o_dmi_next;
00257 IBOutlet id o_dmi_previous;
00258 IBOutlet id o_dmi_mute;
00259
00260 bool b_small_window;
00261
00262 mtime_t i_end_scroll;
00263
00264 NSSize o_size_with_playlist;
00265
00266 int i_lastShownVolume;
00267 }
00268
00269 + (VLCMain *)sharedInstance;
00270
00271 - (intf_thread_t *)getIntf;
00272 - (void)setIntf:(intf_thread_t *)p_mainintf;
00273
00274 - (id)getControls;
00275 - (id)getPlaylist;
00276 - (id)getInfo;
00277 - (id)getWizard;
00278 - (id)getBookmarks;
00279 - (void)terminate;
00280 - (NSString *)localizedString:(char *)psz;
00281 - (char *)delocalizeString:(NSString *)psz;
00282 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
00283 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
00284
00285 - (void)initStrings;
00286
00287 - (void)manage;
00288 - (void)manageIntf:(NSTimer *)o_timer;
00289 - (void)setupMenus;
00290 - (void)setScrollField:(NSString *)o_string stopAfter:(int )timeout;
00291 - (void)resetScrollField;
00292
00293 - (void)updateMessageArray;
00294 - (void)playStatusUpdated:(int) i_status;
00295 - (void)setSubmenusEnabled:(BOOL)b_enabled;
00296 - (void)manageVolumeSlider;
00297 - (IBAction)timesliderUpdate:(id)sender;
00298
00299 - (IBAction)clearRecentItems:(id)sender;
00300 - (void)openRecentItem:(id)sender;
00301
00302 - (IBAction)intfOpenFile:(id)sender;
00303 - (IBAction)intfOpenFileGeneric:(id)sender;
00304 - (IBAction)intfOpenDisc:(id)sender;
00305 - (IBAction)intfOpenNet:(id)sender;
00306
00307 - (IBAction)showWizard:(id)sender;
00308 - (IBAction)showExtended:(id)sender;
00309 - (IBAction)showBookmarks:(id)sender;
00310
00311 - (IBAction)viewAbout:(id)sender;
00312 - (IBAction)viewPreferences:(id)sender;
00313
00314 - (IBAction)closeError:(id)sender;
00315 - (IBAction)openReadMe:(id)sender;
00316 - (IBAction)openDocumentation:(id)sender;
00317 - (IBAction)reportABug:(id)sender;
00318 - (IBAction)openWebsite:(id)sender;
00319 - (IBAction)openLicense:(id)sender;
00320 - (IBAction)openForum:(id)sender;
00321 - (IBAction)openDonate:(id)sender;
00322 - (IBAction)openCrashLog:(id)sender;
00323
00324 - (IBAction)togglePlaylist:(id)sender;
00325 - (void)updateTogglePlaylistState;
00326
00327 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
00328
00329 @end
00330
00331 @interface VLCMain (Internal)
00332 - (void)handlePortMessage:(NSPortMessage *)o_msg;
00333 @end