]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
macosx: changed the data appearance in the info panel to the following behaviour...
[vlc] / modules / gui / macosx / intf.h
1 /*****************************************************************************
2  * intf.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <hartman at videolan dot org>
10  *          Felix Paul Kühne <fkuehne at videolan dot org>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25  *****************************************************************************/
26
27 #ifdef HAVE_CONFIG_H
28 #   include "config.h"
29 #endif
30
31 #include <vlc_common.h>
32 #include <vlc_interface.h>
33 #include <vlc_playlist.h>
34 #include <vlc_vout.h>
35 #include <vlc_aout.h>
36 #include <vlc_input.h>
37
38 #include <Cocoa/Cocoa.h>
39
40 /*****************************************************************************
41  * Local prototypes.
42  *****************************************************************************/
43 unsigned int CocoaKeyToVLC( unichar i_key );
44
45 #define VLCIntf [[VLCMain sharedInstance] getIntf]
46
47 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
48 /* Get an alternate version of the string.
49  * This string is stored as '1:string' but when displayed it only displays
50  * the translated string. the translation should be '1:translatedstring' though */
51 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
52
53 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
54             @"/System/Library/CoreServices/SystemVersion.plist"] \
55             objectForKey: @"ProductVersion"] floatValue]
56
57 /*****************************************************************************
58  * intf_sys_t: description and status of the interface
59  *****************************************************************************/
60 struct intf_sys_t
61 {
62     NSAutoreleasePool * o_pool;
63
64     /* special actions */
65     bool b_mute;
66     int i_play_status;
67
68     /* interface update */
69     bool b_intf_update;
70     bool b_playlist_update;
71     bool b_playmode_update;
72     bool b_current_title_update;
73     bool b_fullscreen_update;
74     bool b_volume_update;
75     bool b_intf_show;
76
77     /* menus handlers */
78     bool b_input_update;
79     bool b_aout_update;
80     bool b_vout_update;
81
82     /* The messages window */
83     msg_subscription_t * p_sub;
84 };
85
86 /*****************************************************************************
87  * VLCMain interface
88  *****************************************************************************/
89 @class AppleRemote;
90 @class VLCInformation;
91 @class VLControllerWindow;
92 @class VLCEmbeddedWindow;
93 @class VLCControls;
94 @class VLCPlaylist;
95 @interface VLCMain : NSObject
96 {
97     intf_thread_t *p_intf;      /* The main intf object */
98     id o_prefs;                 /* VLCPrefs       */
99     id o_sprefs;                /* VLCSimplePrefs */
100     id o_about;                 /* VLAboutBox     */
101     id o_open;                  /* VLCOpen        */
102     id o_wizard;                /* VLCWizard      */
103     id o_extended;              /* VLCExtended    */
104     id o_bookmarks;             /* VLCBookmarks   */
105     id o_vlm;                   /* VLCVLMController */
106     id o_embedded_list;         /* VLCEmbeddedList*/
107     id o_interaction_list;      /* VLCInteractionList*/
108     VLCInformation * o_info;                  /* VLCInformation */
109 #ifdef UPDATE_CHECK
110     id o_update;                /* VLCUpdate      */
111 #endif
112     id o_eyetv;                 /* VLCEyeTVController */
113     BOOL nib_main_loaded;       /* main nibfile */
114     BOOL nib_open_loaded;       /* open nibfile */
115     BOOL nib_about_loaded;      /* about nibfile */
116     BOOL nib_wizard_loaded;     /* wizard nibfile */
117     BOOL nib_extended_loaded;   /* extended nibfile */
118     BOOL nib_bookmarks_loaded;  /* bookmarks nibfile */
119     BOOL nib_prefs_loaded;      /* preferences nibfile */
120     BOOL nib_update_loaded;     /* update nibfile */
121     BOOL nib_info_loaded;       /* information panel nibfile */
122     BOOL nib_vlm_loaded;        /* VLM Panel nibfile */
123
124     IBOutlet VLControllerWindow * o_window;       /* main window    */
125     IBOutlet NSView * o_playlist_view;/* playlist view  */
126     IBOutlet id o_scrollfield;  /* info field     */
127     IBOutlet NSTextField * o_timefield;    /* time field     */
128     IBOutlet NSSlider * o_timeslider;   /* time slider    */
129     IBOutlet VLCEmbeddedWindow * o_embedded_window; /* Embedded Vout Window */
130     float f_slider;             /* slider value   */
131     float f_slider_old;         /* old slider val */
132     IBOutlet NSSlider * o_volumeslider; /* volume slider  */
133
134     IBOutlet NSView * toolbarMediaControl;   /* view with the controls */
135
136     IBOutlet NSProgressIndicator * o_main_pgbar;   /* playlist window progress bar */
137     IBOutlet NSButton * o_btn_prev;     /* btn previous   */
138     IBOutlet NSButton * o_btn_rewind;   /* btn rewind     */
139     IBOutlet NSButton * o_btn_play;     /* btn play       */
140     IBOutlet NSButton * o_btn_stop;     /* btn stop       */
141     IBOutlet NSButton * o_btn_ff;       /* btn fast forward     */
142     IBOutlet NSButton * o_btn_next;     /* btn next       */
143     IBOutlet NSButton * o_btn_fullscreen;/* btn fullscreen (embedded vout window) */
144     IBOutlet NSButton * o_btn_playlist; /* btn playlist   */
145     IBOutlet NSButton * o_btn_equalizer; /* eq btn */
146
147     NSImage * o_img_play;       /* btn play img   */
148     NSImage * o_img_pause;      /* btn pause img  */
149     NSImage * o_img_play_pressed;       /* btn play img   */
150     NSImage * o_img_pause_pressed;      /* btn pause img  */
151
152     IBOutlet VLCControls * o_controls;     /* VLCControls    */
153     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
154
155     IBOutlet id o_messages;     /* messages tv    */
156     IBOutlet id o_msgs_panel;   /* messages panel */
157     NSMutableArray * o_msg_arr; /* messages array */
158     NSLock * o_msg_lock;        /* messages lock  */
159     IBOutlet NSButton * o_msgs_btn_crashlog;    /* messages open crashlog */
160     
161     /* CrashReporter panel */
162     IBOutlet NSButton * o_crashrep_dontSend_btn;
163     IBOutlet NSButton * o_crashrep_send_btn;
164     IBOutlet NSTextView * o_crashrep_fld;
165     IBOutlet NSTextField * o_crashrep_title_txt;
166     IBOutlet NSTextField * o_crashrep_desc_txt;
167     IBOutlet NSWindow * o_crashrep_win;
168     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
169     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
170
171     /* main menu */
172
173     IBOutlet NSMenuItem * o_mi_about;
174     IBOutlet NSMenuItem * o_mi_prefs;
175     IBOutlet NSMenuItem * o_mi_sprefs;
176     IBOutlet NSMenuItem * o_mi_checkForUpdate;
177     IBOutlet NSMenuItem * o_mi_add_intf;
178     IBOutlet NSMenu * o_mu_add_intf;
179     IBOutlet NSMenuItem * o_mi_services;
180     IBOutlet NSMenuItem * o_mi_hide;
181     IBOutlet NSMenuItem * o_mi_hide_others;
182     IBOutlet NSMenuItem * o_mi_show_all;
183     IBOutlet NSMenuItem * o_mi_quit;
184
185     IBOutlet NSMenu * o_mu_file;
186     IBOutlet NSMenuItem * o_mi_open_file;
187     IBOutlet NSMenuItem * o_mi_open_generic;
188     IBOutlet NSMenuItem * o_mi_open_disc;
189     IBOutlet NSMenuItem * o_mi_open_net;
190     IBOutlet NSMenuItem * o_mi_open_capture;
191     IBOutlet NSMenuItem * o_mi_open_recent;
192     IBOutlet NSMenuItem * o_mi_open_recent_cm;
193     IBOutlet NSMenuItem * o_mi_open_wizard;
194     IBOutlet NSMenuItem * o_mi_open_vlm;
195
196     IBOutlet NSMenu * o_mu_edit;
197     IBOutlet NSMenuItem * o_mi_cut;
198     IBOutlet NSMenuItem * o_mi_copy;
199     IBOutlet NSMenuItem * o_mi_paste;
200     IBOutlet NSMenuItem * o_mi_clear;
201     IBOutlet NSMenuItem * o_mi_select_all;
202
203     IBOutlet NSMenu * o_mu_controls;
204     IBOutlet NSMenuItem * o_mi_play;
205     IBOutlet NSMenuItem * o_mi_stop;
206     IBOutlet NSMenuItem * o_mi_faster;
207     IBOutlet NSMenuItem * o_mi_slower;
208     IBOutlet NSMenuItem * o_mi_previous;
209     IBOutlet NSMenuItem * o_mi_next;
210     IBOutlet NSMenuItem * o_mi_random;
211     IBOutlet NSMenuItem * o_mi_repeat;
212     IBOutlet NSMenuItem * o_mi_loop;
213     IBOutlet NSMenuItem * o_mi_fwd;
214     IBOutlet NSMenuItem * o_mi_bwd;
215     IBOutlet NSMenuItem * o_mi_fwd1m;
216     IBOutlet NSMenuItem * o_mi_bwd1m;
217     IBOutlet NSMenuItem * o_mi_fwd5m;
218     IBOutlet NSMenuItem * o_mi_bwd5m;
219     IBOutlet NSMenuItem * o_mi_program;
220     IBOutlet NSMenuItem * o_mu_program;
221     IBOutlet NSMenuItem * o_mi_title;
222     IBOutlet NSMenu * o_mu_title;
223     IBOutlet NSMenuItem * o_mi_chapter;
224     IBOutlet NSMenu * o_mu_chapter;
225
226     IBOutlet NSMenu * o_mu_audio;
227     IBOutlet NSMenuItem * o_mi_vol_up;
228     IBOutlet NSMenuItem * o_mi_vol_down;
229     IBOutlet NSMenuItem * o_mi_mute;
230     IBOutlet NSMenuItem * o_mi_audiotrack;
231     IBOutlet NSMenu * o_mu_audiotrack;
232     IBOutlet NSMenuItem * o_mi_channels;
233     IBOutlet NSMenu * o_mu_channels;
234     IBOutlet NSMenuItem * o_mi_device;
235     IBOutlet NSMenu * o_mu_device;
236     IBOutlet NSMenuItem * o_mi_visual;
237     IBOutlet NSMenu * o_mu_visual;
238
239     IBOutlet NSMenu * o_mu_video;
240     IBOutlet NSMenuItem * o_mi_half_window;
241     IBOutlet NSMenuItem * o_mi_normal_window;
242     IBOutlet NSMenuItem * o_mi_double_window;
243     IBOutlet NSMenuItem * o_mi_fittoscreen;
244     IBOutlet NSMenuItem * o_mi_fullscreen;
245     IBOutlet NSMenuItem * o_mi_floatontop;
246     IBOutlet NSMenuItem * o_mi_snapshot;
247     IBOutlet NSMenuItem * o_mi_videotrack;
248     IBOutlet NSMenu * o_mu_videotrack;
249     IBOutlet NSMenuItem * o_mi_screen;
250     IBOutlet NSMenu * o_mu_screen;
251     IBOutlet NSMenuItem * o_mi_aspect_ratio;
252     IBOutlet NSMenu * o_mu_aspect_ratio;
253     IBOutlet NSMenuItem * o_mi_crop;
254     IBOutlet NSMenu * o_mu_crop;
255     IBOutlet NSMenuItem * o_mi_subtitle;
256     IBOutlet NSMenu * o_mu_subtitle;
257     IBOutlet NSMenuItem * o_mi_deinterlace;
258     IBOutlet NSMenu * o_mu_deinterlace;
259     IBOutlet NSMenuItem * o_mi_ffmpeg_pp;
260     IBOutlet NSMenuItem * o_mu_ffmpeg_pp;
261     IBOutlet NSMenuItem * o_mi_teletext;
262     IBOutlet NSMenuItem * o_mi_teletext_transparent;
263     IBOutlet NSMenuItem * o_mi_teletext_index;
264     IBOutlet NSMenuItem * o_mi_teletext_red;
265     IBOutlet NSMenuItem * o_mi_teletext_green;
266     IBOutlet NSMenuItem * o_mi_teletext_yellow;
267     IBOutlet NSMenuItem * o_mi_teletext_blue;
268
269     IBOutlet NSMenu * o_mu_window;
270     IBOutlet NSMenuItem * o_mi_minimize;
271     IBOutlet NSMenuItem * o_mi_close_window;
272     IBOutlet NSMenuItem * o_mi_controller;
273     IBOutlet NSMenuItem * o_mi_equalizer;
274     IBOutlet NSMenuItem * o_mi_extended;
275     IBOutlet NSMenuItem * o_mi_bookmarks;
276     IBOutlet NSMenuItem * o_mi_playlist;
277     IBOutlet NSMenuItem * o_mi_info;
278     IBOutlet NSMenuItem * o_mi_messages;
279     IBOutlet NSMenuItem * o_mi_bring_atf;
280
281     IBOutlet NSMenu * o_mu_help;
282     IBOutlet NSMenuItem * o_mi_help;
283     IBOutlet NSMenuItem * o_mi_readme;
284     IBOutlet NSMenuItem * o_mi_documentation;
285     IBOutlet NSMenuItem * o_mi_license;
286     IBOutlet NSMenuItem * o_mi_website;
287     IBOutlet NSMenuItem * o_mi_donation;
288     IBOutlet NSMenuItem * o_mi_forum;
289     IBOutlet NSMenuItem * o_mi_errorsAndWarnings;
290
291     /* dock menu */
292     IBOutlet NSMenuItem * o_dmi_play;
293     IBOutlet NSMenuItem * o_dmi_stop;
294     IBOutlet NSMenuItem * o_dmi_next;
295     IBOutlet NSMenuItem * o_dmi_previous;
296     IBOutlet NSMenuItem * o_dmi_mute;
297
298     /* vout menu */
299     IBOutlet NSMenu * o_vout_menu;
300     IBOutlet NSMenuItem * o_vmi_play;
301     IBOutlet NSMenuItem * o_vmi_stop;
302     IBOutlet NSMenuItem * o_vmi_prev;
303     IBOutlet NSMenuItem * o_vmi_next;
304     IBOutlet NSMenuItem * o_vmi_volup;
305     IBOutlet NSMenuItem * o_vmi_voldown;
306     IBOutlet NSMenuItem * o_vmi_mute;
307     IBOutlet NSMenuItem * o_vmi_fullscreen;
308     IBOutlet NSMenuItem * o_vmi_snapshot;
309
310     bool b_small_window;
311
312     bool b_restore_size;
313     NSRect o_restore_rect;
314
315     mtime_t i_end_scroll;
316
317     NSSize o_size_with_playlist;
318
319     int     i_lastShownVolume;
320
321     input_state_e cachedInputState;
322
323     /* the manage thread */
324     pthread_t manage_thread;
325
326     /* The timer that update the interface */
327     NSTimer * interfaceTimer;
328
329     NSURLConnection * crashLogURLConnection;
330
331     AppleRemote * o_remote;
332     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
333 }
334
335 + (VLCMain *)sharedInstance;
336
337 - (intf_thread_t *)getIntf;
338 - (void)setIntf:(intf_thread_t *)p_mainintf;
339
340 - (void)controlTintChanged;
341
342 - (id)getControls;
343 - (id)getSimplePreferences;
344 - (id)getPreferences;
345 - (id)getPlaylist;
346 - (BOOL)isPlaylistCollapsed;
347 - (id)getInfo;
348 - (id)getWizard;
349 - (id)getBookmarks;
350 - (id)getEmbeddedList;
351 - (id)getInteractionList;
352 - (id)getMainIntfPgbar;
353 - (id)getControllerWindow;
354 - (id)getVoutMenu;
355 - (id)getEyeTVController;
356 - (void)applicationWillTerminate:(NSNotification *)notification;
357 - (NSString *)localizedString:(const char *)psz;
358 - (char *)delocalizeString:(NSString *)psz;
359 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
360 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
361
362 - (void)initStrings;
363
364 - (void)manage;
365 - (void)manageIntf:(NSTimer *)o_timer;
366 - (void)setupMenus;
367 - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification;
368 - (void)setScrollField:(NSString *)o_string stopAfter:(int )timeout;
369 - (void)resetScrollField;
370
371 - (void)updateMessageArray;
372 - (void)playStatusUpdated:(int) i_status;
373 - (void)setSubmenusEnabled:(BOOL)b_enabled;
374 - (void)manageVolumeSlider;
375 - (IBAction)timesliderUpdate:(id)sender;
376
377 - (IBAction)clearRecentItems:(id)sender;
378 - (void)openRecentItem:(id)sender;
379
380 - (IBAction)intfOpenFile:(id)sender;
381 - (IBAction)intfOpenFileGeneric:(id)sender;
382 - (IBAction)intfOpenDisc:(id)sender;
383 - (IBAction)intfOpenNet:(id)sender;
384 - (IBAction)intfOpenCapture:(id)sender;
385
386 - (IBAction)showWizard:(id)sender;
387 - (IBAction)showVLM:(id)sender;
388 - (IBAction)showExtended:(id)sender;
389 - (IBAction)showBookmarks:(id)sender;
390
391 - (IBAction)viewAbout:(id)sender;
392 - (IBAction)showLicense:(id)sender;
393 - (IBAction)viewPreferences:(id)sender;
394 - (IBAction)checkForUpdate:(id)sender;
395 - (IBAction)viewHelp:(id)sender;
396 - (IBAction)openReadMe:(id)sender;
397 - (IBAction)openDocumentation:(id)sender;
398 - (IBAction)openWebsite:(id)sender;
399 - (IBAction)openForum:(id)sender;
400 - (IBAction)openDonate:(id)sender;
401 - (IBAction)openCrashLog:(id)sender;
402 - (IBAction)viewErrorsAndWarnings:(id)sender;
403 - (IBAction)showMessagesPanel:(id)sender;
404 - (IBAction)showInformationPanel:(id)sender;
405
406 - (IBAction)crashReporterAction:(id)sender;
407
408 - (IBAction)togglePlaylist:(id)sender;
409 - (void)updateTogglePlaylistState;
410
411 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
412
413 @end
414
415 @interface VLCMain (Internal)
416 - (void)handlePortMessage:(NSPortMessage *)o_msg;
417 @end