]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
162e593380e243c4d8509c446ab0588986589ecf
[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 #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 #define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
58             @"/System/Library/CoreServices/SystemVersion.plist"] \
59             objectForKey: @"ProductVersion"] floatValue]
60
61
62 // You need to release those objects after use
63 input_thread_t *getInput(void);
64 vout_thread_t *getVout(void);
65 audio_output_t *getAout(void);
66
67 /*****************************************************************************
68  * intf_sys_t: description and status of the interface
69  *****************************************************************************/
70 struct intf_sys_t
71 {
72     /* menus handlers */
73     bool b_input_update;
74     bool b_aout_update;
75     bool b_vout_update;
76
77     /* The messages window */
78     msg_subscription_t * p_sub;
79 };
80
81 /*****************************************************************************
82  * VLCMain interface
83  *****************************************************************************/
84 @class AppleRemote;
85 @class VLCInformation;
86 @class VLCEmbeddedWindow;
87 @class VLCControls;
88 @class VLCPlaylist;
89 @interface VLCMain : NSObject <NSWindowDelegate>
90 {
91     intf_thread_t *p_intf;      /* The main intf object */
92     id o_mainmenu;              /* VLCMainMenu */
93     id o_prefs;                 /* VLCPrefs       */
94     id o_sprefs;                /* VLCSimplePrefs */
95     id o_open;                  /* VLCOpen        */
96     id o_wizard;                /* VLCWizard      */
97     id o_embedded_list;         /* VLCEmbeddedList*/
98     id o_coredialogs;           /* VLCCoreDialogProvider */
99     id o_info;                  /* VLCInformation */
100     id o_eyetv;                 /* VLCEyeTVController */
101     id o_bookmarks;             /* VLCBookmarks */
102     id o_coreinteraction;       /* VLCCoreInteraction */
103     BOOL nib_main_loaded;       /* main nibfile */
104     BOOL nib_open_loaded;       /* open nibfile */
105     BOOL nib_about_loaded;      /* about nibfile */
106     BOOL nib_wizard_loaded;     /* wizard nibfile */
107     BOOL nib_prefs_loaded;      /* preferences nibfile */
108     BOOL nib_info_loaded;       /* information panel nibfile */
109     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
110     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
111     BOOL b_active_videoplayback;
112
113     VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
114
115     IBOutlet VLCControls * o_controls;     /* VLCControls    */
116     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
117
118     IBOutlet NSTextView * o_messages;           /* messages tv    */
119     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
120     NSMutableArray * o_msg_arr;                 /* messages array */
121     NSLock * o_msg_lock;                        /* messages lock */
122     BOOL b_msg_arr_changed;                     /* did the array change? */
123     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
124     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
125
126     /* CrashReporter panel */
127     IBOutlet NSButton * o_crashrep_dontSend_btn;
128     IBOutlet NSButton * o_crashrep_send_btn;
129     IBOutlet NSTextView * o_crashrep_fld;
130     IBOutlet NSTextField * o_crashrep_title_txt;
131     IBOutlet NSTextField * o_crashrep_desc_txt;
132     IBOutlet NSWindow * o_crashrep_win;
133     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
134     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
135     NSURLConnection * crashLogURLConnection;
136
137     AppleRemote * o_remote;
138     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
139
140     /* media key support */
141     BOOL b_mediaKeySupport;
142     BOOL b_mediakeyJustJumped;
143     SPMediaKeyTap * o_mediaKeyController;
144
145     NSArray *o_usedHotkeys;
146 }
147
148 + (VLCMain *)sharedInstance;
149
150 - (intf_thread_t *)intf;
151 - (void)setIntf:(intf_thread_t *)p_mainintf;
152
153 - (id)mainMenu;
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;
175 - (NSString *)VLCKeyToString:(NSString *)theString;
176 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
177 - (void)updateCurrentlyUsedHotkeys;
178 - (void)fullscreenChanged;
179 - (void)PlaylistItemChanged;
180 - (void)playbackStatusUpdated;
181 - (void)playbackModeUpdated;
182 - (void)updateVolume;
183 - (void)updatePlaybackPosition;
184 - (void)updateName;
185 - (void)playlistUpdated;
186 - (void)updateRecordState: (BOOL)b_value;
187 - (void)updateInfoandMetaPanel;
188 - (void)updateMainMenu;
189 - (void)updateMainWindow;
190 - (void)showFullscreenController;
191 - (void)updateDelays;
192 - (void)initStrings;
193 - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
194
195 - (void)updateMessageDisplay;
196
197 - (IBAction)crashReporterAction:(id)sender;
198 - (IBAction)openCrashLog:(id)sender;
199 - (IBAction)saveDebugLog:(id)sender;
200 - (IBAction)showMessagesPanel:(id)sender;
201
202 - (void)processReceivedlibvlcMessage:(const msg_item_t *)item;
203
204 - (void)updateTogglePlaylistState;
205
206 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
207
208 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
209 @end
210
211 @interface VLCMain (Internal)
212 - (void)handlePortMessage:(NSPortMessage *)o_msg;
213 - (void)resetMediaKeyJump;
214 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
215 @end
216
217 /*****************************************************************************
218  * VLCApplication interface
219  *****************************************************************************/
220
221 @interface VLCApplication : NSApplication
222 {
223 }
224 @end