]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
31e9572eb28a20636ed0d22ad3b32e832d0676e9
[vlc] / modules / gui / macosx / intf.h
1 /*****************************************************************************
2  * intf.h: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2011 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 #import "SPMediaKeyTap.h"                   /* for the media key support */
40
41 /*****************************************************************************
42  * Local prototypes.
43  *****************************************************************************/
44 unsigned int CocoaKeyToVLC( unichar i_key );
45
46 #define VLCIntf [[VLCMain sharedInstance] intf]
47
48 #define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
49 /* Get an alternate version of the string.
50  * This string is stored as '1:string' but when displayed it only displays
51  * the translated string. the translation should be '1:translatedstring' though */
52 #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
53
54 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
55             @"/System/Library/CoreServices/SystemVersion.plist"] \
56             objectForKey: @"ProductVersion"] floatValue]
57
58
59 // You need to release those objects after use
60 input_thread_t *getInput(void);
61 vout_thread_t *getVout(void);
62 aout_instance_t *getAout(void);
63
64 /*****************************************************************************
65  * intf_sys_t: description and status of the interface
66  *****************************************************************************/
67 struct intf_sys_t
68 {
69     /* menus handlers */
70     bool b_input_update;
71     bool b_aout_update;
72     bool b_vout_update;
73
74     /* The messages window */
75     msg_subscription_t * p_sub;
76 };
77
78 /*****************************************************************************
79  * VLCMain interface
80  *****************************************************************************/
81 @class AppleRemote;
82 @class VLCInformation;
83 @class VLCEmbeddedWindow;
84 @class VLCControls;
85 @class VLCPlaylist;
86 @interface VLCMain : NSObject
87 {
88     intf_thread_t *p_intf;      /* The main intf object */
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     VLCInformation * 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
109     IBOutlet id o_mainwindow;            /* VLCMainWindow */
110
111     IBOutlet VLCControls * o_controls;     /* VLCControls    */
112     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
113
114     IBOutlet NSTextView * o_messages;           /* messages tv    */
115     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
116     NSMutableArray * o_msg_arr;                 /* messages array */
117     NSLock * o_msg_lock;                        /* messages lock */
118     BOOL b_msg_arr_changed;                     /* did the array change? */
119     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
120     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
121
122     /* CrashReporter panel */
123     IBOutlet NSButton * o_crashrep_dontSend_btn;
124     IBOutlet NSButton * o_crashrep_send_btn;
125     IBOutlet NSTextView * o_crashrep_fld;
126     IBOutlet NSTextField * o_crashrep_title_txt;
127     IBOutlet NSTextField * o_crashrep_desc_txt;
128     IBOutlet NSWindow * o_crashrep_win;
129     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
130     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
131
132     input_state_e cachedInputState;
133
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)controls;
154 - (id)bookmarks;
155 - (id)open;
156 - (id)simplePreferences;
157 - (id)preferences;
158 - (id)playlist;
159 - (id)info;
160 - (id)wizard;
161 - (id)embeddedList;
162 - (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
163 - (id)coreDialogProvider;
164 - (id)eyeTVController;
165 - (id)appleRemoteController;
166 - (void)applicationWillTerminate:(NSNotification *)notification;
167 - (NSString *)localizedString:(const char *)psz;
168 - (char *)delocalizeString:(NSString *)psz;
169 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
170 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
171 - (NSString *)VLCKeyToString:(NSString *)theString;
172 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
173 - (void)updateCurrentlyUsedHotkeys;
174 - (void)PlaylistItemChanged;
175 - (void)playbackStatusUpdated;
176 - (void)playbackModeUpdated;
177 - (void)updateVolume;
178 - (void)updatePlaybackPosition;
179 - (void)updateTitle;
180 - (void)playlistUpdated;
181 - (void)updateInfoandMetaPanel;
182 - (void)updateMainWindow;
183 - (void)initStrings;
184 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
185
186 - (void)updateMessageDisplay;
187
188 - (IBAction)showController:(id)sender;
189
190 - (IBAction)crashReporterAction:(id)sender;
191 - (IBAction)openCrashLog:(id)sender;
192 - (IBAction)saveDebugLog:(id)sender;
193 - (IBAction)showMessagesPanel:(id)sender;
194
195 - (void)processReceivedlibvlcMessage:(const msg_item_t *)item;
196
197 - (IBAction)togglePlaylist:(id)sender;
198 - (void)updateTogglePlaylistState;
199
200 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
201
202 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
203 @end
204
205 @interface VLCMain (Internal)
206 - (void)handlePortMessage:(NSPortMessage *)o_msg;
207 - (void)resetMediaKeyJump;
208 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
209 @end
210
211 /*****************************************************************************
212  * VLCApplication interface
213  *****************************************************************************/
214
215 @interface VLCApplication : NSApplication
216 {
217 }
218 @end