]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
macosx: removed explicit 10.5 compatibility code
[vlc] / modules / gui / macosx / intf.h
1 /*****************************************************************************
2  * intf.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2012 VLC authors and VideoLAN
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 #import <vlc_common.h>
32 #import <vlc_interface.h>
33 #import <vlc_playlist.h>
34 #import <vlc_vout.h>
35 #import <vlc_aout.h>
36 #import <vlc_input.h>
37
38 #import <Cocoa/Cocoa.h>
39 #import "CompatibilityFixes.h"
40 #import "SPMediaKeyTap.h"                   /* for the media key support */
41 #import "misc.h"
42 #import "MainWindow.h"
43
44 /*****************************************************************************
45  * Local prototypes.
46  *****************************************************************************/
47 unsigned int CocoaKeyToVLC( unichar i_key );
48
49 #define VLCIntf [[VLCMain sharedInstance] intf]
50
51 #define _NS(s) [[VLCMain sharedInstance] localizedString: s]
52 /* Get an alternate version of the string.
53  * This string is stored as '1:string' but when displayed it only displays
54  * the translated string. the translation should be '1:translatedstring' though */
55 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
56
57
58 // You need to release those objects after use
59 input_thread_t *getInput(void);
60 vout_thread_t *getVout(void);
61 audio_output_t *getAout(void);
62
63 /*****************************************************************************
64  * intf_sys_t: description and status of the interface
65  *****************************************************************************/
66 struct intf_sys_t
67 {
68     /* menus handlers */
69     bool b_input_update;
70     bool b_aout_update;
71     bool b_vout_update;
72
73     /* The messages window */
74     msg_subscription_t sub;
75 };
76
77 /*****************************************************************************
78  * VLCMain interface
79  *****************************************************************************/
80 @class AppleRemote;
81 @class VLCInformation;
82 @class VLCEmbeddedWindow;
83 @class VLCControls;
84 @class VLCPlaylist;
85 @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
86 {
87     intf_thread_t *p_intf;      /* The main intf object */
88     input_thread_t *p_current_input;
89     id o_mainmenu;              /* VLCMainMenu */
90     id o_prefs;                 /* VLCPrefs       */
91     id o_sprefs;                /* VLCSimplePrefs */
92     id o_open;                  /* VLCOpen        */
93     id o_wizard;                /* VLCWizard      */
94     id o_embedded_list;         /* VLCEmbeddedList*/
95     id o_coredialogs;           /* VLCCoreDialogProvider */
96     id o_info;                  /* VLCInformation */
97     id o_eyetv;                 /* VLCEyeTVController */
98     id o_bookmarks;             /* VLCBookmarks */
99     id o_coreinteraction;       /* VLCCoreInteraction */
100     BOOL nib_main_loaded;       /* main nibfile */
101     BOOL nib_open_loaded;       /* open nibfile */
102     BOOL nib_about_loaded;      /* about nibfile */
103     BOOL nib_wizard_loaded;     /* wizard nibfile */
104     BOOL nib_prefs_loaded;      /* preferences nibfile */
105     BOOL nib_info_loaded;       /* information panel nibfile */
106     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
107     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
108     BOOL b_active_videoplayback;
109     BOOL b_nativeFullscreenMode;
110
111     VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
112
113     IBOutlet VLCControls * o_controls;     /* VLCControls    */
114     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
115
116     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
117     NSMutableArray * o_msg_arr;                 /* messages array */
118     NSLock * o_msg_lock;                        /* messages lock */
119     BOOL b_msg_arr_changed;                     /* did the array change? */
120     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
121     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
122     IBOutlet NSButton * o_msgs_refresh_btn;     /* update the panel */
123     IBOutlet id o_msgs_table;
124
125     /* CrashReporter panel */
126     IBOutlet NSButton * o_crashrep_dontSend_btn;
127     IBOutlet NSButton * o_crashrep_send_btn;
128     IBOutlet NSTextView * o_crashrep_fld;
129     IBOutlet NSTextField * o_crashrep_title_txt;
130     IBOutlet NSTextField * o_crashrep_desc_txt;
131     IBOutlet NSWindow * o_crashrep_win;
132     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
133     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
134     NSURLConnection * crashLogURLConnection;
135
136     AppleRemote * o_remote;
137     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
138
139     /* media key support */
140     BOOL b_mediaKeySupport;
141     BOOL b_mediakeyJustJumped;
142     SPMediaKeyTap * o_mediaKeyController;
143
144     NSArray *o_usedHotkeys;
145 }
146
147 + (VLCMain *)sharedInstance;
148
149 - (intf_thread_t *)intf;
150 - (void)setIntf:(intf_thread_t *)p_mainintf;
151
152 - (id)mainMenu;
153 - (id)mainWindow;
154 - (id)controls;
155 - (id)bookmarks;
156 - (id)open;
157 - (id)simplePreferences;
158 - (id)preferences;
159 - (id)playlist;
160 - (id)info;
161 - (id)wizard;
162 - (id)embeddedList;
163 - (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
164 - (void)setNativeVideoSize:(NSSize)size;
165 - (id)coreDialogProvider;
166 - (id)eyeTVController;
167 - (id)appleRemoteController;
168 - (void)setActiveVideoPlayback:(BOOL)b_value;
169 - (BOOL)activeVideoPlayback;
170 - (void)applicationWillTerminate:(NSNotification *)notification;
171 - (NSString *)localizedString:(const char *)psz;
172 - (char *)delocalizeString:(NSString *)psz;
173 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
174 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
175 - (NSString *)VLCKeyToString:(NSString *)theString;
176 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
177 - (void)updateCurrentlyUsedHotkeys;
178 - (void)fullscreenChanged;
179 - (void)checkFullscreenChange:(NSNumber *)o_full;
180 - (void)PlaylistItemChanged;
181 - (void)playbackStatusUpdated;
182 - (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
183 - (void)playbackModeUpdated;
184 - (void)updateVolume;
185 - (void)updatePlaybackPosition;
186 - (void)updateName;
187 - (void)playlistUpdated;
188 - (void)updateRecordState: (BOOL)b_value;
189 - (void)updateInfoandMetaPanel;
190 - (void)updateMainMenu;
191 - (void)updateMainWindow;
192 - (void)showMainWindow;
193 - (void)showFullscreenController;
194 - (void)updateDelays;
195 - (void)initStrings;
196
197 - (IBAction)crashReporterAction:(id)sender;
198 - (IBAction)openCrashLog:(id)sender;
199 - (IBAction)saveDebugLog:(id)sender;
200 - (IBAction)showMessagesPanel:(id)sender;
201 - (IBAction)updateMessagesPanel:(id)sender;
202
203 - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
204
205 - (void)updateTogglePlaylistState;
206
207 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
208
209 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
210 @end
211
212 @interface VLCMain (Internal)
213 - (void)handlePortMessage:(NSPortMessage *)o_msg;
214 - (void)resetMediaKeyJump;
215 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
216 @end
217
218 /*****************************************************************************
219  * VLCApplication interface
220  *****************************************************************************/
221
222 @interface VLCApplication : NSApplication
223 {
224 }
225 @end