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