]> git.sesse.net Git - vlc/blob - modules/gui/macosx/intf.h
macosx: change handling of arrow keys slightly
[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 #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 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, NSApplicationDelegate>
90 {
91     intf_thread_t *p_intf;      /* The main intf object */
92     input_thread_t *p_current_input;
93     id o_mainmenu;              /* VLCMainMenu */
94     id o_prefs;                 /* VLCPrefs       */
95     id o_sprefs;                /* VLCSimplePrefs */
96     id o_open;                  /* VLCOpen        */
97     id o_wizard;                /* VLCWizard      */
98     id o_embedded_list;         /* VLCEmbeddedList*/
99     id o_coredialogs;           /* VLCCoreDialogProvider */
100     id o_info;                  /* VLCInformation */
101     id o_eyetv;                 /* VLCEyeTVController */
102     id o_bookmarks;             /* VLCBookmarks */
103     id o_coreinteraction;       /* VLCCoreInteraction */
104     BOOL nib_main_loaded;       /* main nibfile */
105     BOOL nib_open_loaded;       /* open nibfile */
106     BOOL nib_about_loaded;      /* about nibfile */
107     BOOL nib_wizard_loaded;     /* wizard nibfile */
108     BOOL nib_prefs_loaded;      /* preferences nibfile */
109     BOOL nib_info_loaded;       /* information panel nibfile */
110     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
111     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
112     BOOL b_active_videoplayback;
113     BOOL b_nativeFullscreenMode;
114
115     VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
116
117     IBOutlet VLCControls * o_controls;     /* VLCControls    */
118     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
119
120     IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
121     NSMutableArray * o_msg_arr;                 /* messages array */
122     NSLock * o_msg_lock;                        /* messages lock */
123     BOOL b_msg_arr_changed;                     /* did the array change? */
124     IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
125     IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
126     IBOutlet NSButton * o_msgs_refresh_btn;     /* update the panel */
127     IBOutlet id o_msgs_table;
128
129     /* CrashReporter panel */
130     IBOutlet NSButton * o_crashrep_dontSend_btn;
131     IBOutlet NSButton * o_crashrep_send_btn;
132     IBOutlet NSTextView * o_crashrep_fld;
133     IBOutlet NSTextField * o_crashrep_title_txt;
134     IBOutlet NSTextField * o_crashrep_desc_txt;
135     IBOutlet NSWindow * o_crashrep_win;
136     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
137     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
138     NSURLConnection * crashLogURLConnection;
139
140     AppleRemote * o_remote;
141     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
142
143     /* media key support */
144     BOOL b_mediaKeySupport;
145     BOOL b_mediakeyJustJumped;
146     SPMediaKeyTap * o_mediaKeyController;
147
148     NSArray *o_usedHotkeys;
149 }
150
151 + (VLCMain *)sharedInstance;
152
153 - (intf_thread_t *)intf;
154 - (void)setIntf:(intf_thread_t *)p_mainintf;
155
156 - (id)mainMenu;
157 - (id)mainWindow;
158 - (id)controls;
159 - (id)bookmarks;
160 - (id)open;
161 - (id)simplePreferences;
162 - (id)preferences;
163 - (id)playlist;
164 - (id)info;
165 - (id)wizard;
166 - (id)embeddedList;
167 - (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
168 - (void)setNativeVideoSize:(NSSize)size;
169 - (id)coreDialogProvider;
170 - (id)eyeTVController;
171 - (id)appleRemoteController;
172 - (void)setActiveVideoPlayback:(BOOL)b_value;
173 - (BOOL)activeVideoPlayback;
174 - (void)applicationWillTerminate:(NSNotification *)notification;
175 - (NSString *)localizedString:(const char *)psz;
176 - (char *)delocalizeString:(NSString *)psz;
177 - (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
178 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
179 - (NSString *)VLCKeyToString:(NSString *)theString;
180 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
181 - (void)updateCurrentlyUsedHotkeys;
182 - (void)fullscreenChanged;
183 - (void)PlaylistItemChanged;
184 - (void)playbackStatusUpdated;
185 - (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
186 - (void)playbackModeUpdated;
187 - (void)updateVolume;
188 - (void)updatePlaybackPosition;
189 - (void)updateName;
190 - (void)playlistUpdated;
191 - (void)updateRecordState: (BOOL)b_value;
192 - (void)updateInfoandMetaPanel;
193 - (void)updateMainMenu;
194 - (void)updateMainWindow;
195 - (void)showMainWindow;
196 - (void)showFullscreenController;
197 - (void)updateDelays;
198 - (void)initStrings;
199
200 - (IBAction)crashReporterAction:(id)sender;
201 - (IBAction)openCrashLog:(id)sender;
202 - (IBAction)saveDebugLog:(id)sender;
203 - (IBAction)showMessagesPanel:(id)sender;
204 - (IBAction)updateMessagesPanel:(id)sender;
205
206 - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
207
208 - (void)updateTogglePlaylistState;
209
210 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
211
212 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
213 @end
214
215 @interface VLCMain (Internal)
216 - (void)handlePortMessage:(NSPortMessage *)o_msg;
217 - (void)resetMediaKeyJump;
218 - (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
219 @end
220
221 /*****************************************************************************
222  * VLCApplication interface
223  *****************************************************************************/
224
225 @interface VLCApplication : NSApplication
226 {
227 }
228 @end