1 /*****************************************************************************
2 * intf.h: MacOS X interface module
3 *****************************************************************************
4 * Copyright (C) 2002-2012 VLC authors and VideoLAN
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 * David Fuhrmann <david dot fuhrmann at googlemail dot com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
32 #import <vlc_common.h>
33 #import <vlc_interface.h>
34 #import <vlc_playlist.h>
38 #import <vlc_vout_window.h>
40 #import <Cocoa/Cocoa.h>
41 #import "CompatibilityFixes.h"
42 #import "SPMediaKeyTap.h" /* for the media key support */
44 #import "MainWindow.h"
45 #import "VLCVoutWindowController.h"
46 #import "StringUtility.h"
48 #import <IOKit/pwr_mgt/IOPMLib.h> /* for sleep prevention */
50 /*****************************************************************************
52 *****************************************************************************/
53 #define VLCIntf [[VLCMain sharedInstance] intf]
55 // You need to release those objects after use
56 input_thread_t *getInput(void);
57 vout_thread_t *getVout(void);
58 vout_thread_t *getVoutForActiveWindow(void);
59 audio_output_t *getAout(void);
61 /*****************************************************************************
62 * intf_sys_t: description and status of the interface
63 *****************************************************************************/
71 /* The messages window */
72 msg_subscription_t sub;
75 /*****************************************************************************
77 *****************************************************************************/
79 @class VLCInformation;
80 @class VLCEmbeddedWindow;
84 @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
86 intf_thread_t *p_intf; /* The main intf object */
87 input_thread_t *p_current_input, *p_input_changed;
88 id o_mainmenu; /* VLCMainMenu */
89 id o_prefs; /* VLCPrefs */
90 id o_sprefs; /* VLCSimplePrefs */
91 id o_open; /* VLCOpen */
92 id o_wizard; /* VLCWizard */
93 id o_coredialogs; /* VLCCoreDialogProvider */
94 id o_info; /* VLCInformation */
95 id o_eyetv; /* VLCEyeTVController */
96 id o_bookmarks; /* VLCBookmarks */
97 id o_coreinteraction; /* VLCCoreInteraction */
98 BOOL nib_main_loaded; /* main nibfile */
99 BOOL nib_open_loaded; /* open nibfile */
100 BOOL nib_about_loaded; /* about nibfile */
101 BOOL nib_wizard_loaded; /* wizard nibfile */
102 BOOL nib_prefs_loaded; /* preferences nibfile */
103 BOOL nib_info_loaded; /* information panel nibfile */
104 BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
105 BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */
106 BOOL b_active_videoplayback;
107 BOOL b_nativeFullscreenMode;
109 VLCMainWindow *o_mainwindow; /* VLCMainWindow */
111 IBOutlet VLCControls * o_controls; /* VLCControls */
112 IBOutlet VLCPlaylist * o_playlist; /* VLCPlaylist */
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 IBOutlet NSButton * o_msgs_refresh_btn; /* update the panel */
122 IBOutlet id o_msgs_table;
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 NSButton * o_crashrep_dontaskagain_ckb;
133 IBOutlet NSTextField * o_crashrep_includeEmail_txt;
134 NSURLConnection * crashLogURLConnection;
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 */
139 /* media key support */
140 BOOL b_mediaKeySupport;
141 BOOL b_mediakeyJustJumped;
142 SPMediaKeyTap * o_mediaKeyController;
144 NSArray *o_usedHotkeys;
146 /* sleep management */
147 IOPMAssertionID systemSleepAssertionID;
148 IOPMAssertionID userActivityAssertionID;
150 VLCVoutWindowController *o_vout_controller;
153 @property (readonly) VLCVoutWindowController* voutController;
154 @property (readonly) BOOL nativeFullscreenMode;
156 + (VLCMain *)sharedInstance;
158 - (intf_thread_t *)intf;
159 - (void)setIntf:(intf_thread_t *)p_mainintf;
162 - (VLCMainWindow *)mainWindow;
166 - (id)simplePreferences;
171 - (id)coreDialogProvider;
172 - (id)eyeTVController;
173 - (id)appleRemoteController;
174 - (void)setActiveVideoPlayback:(BOOL)b_value;
175 - (BOOL)activeVideoPlayback;
176 - (void)applicationWillTerminate:(NSNotification *)notification;
177 - (void)updateCurrentlyUsedHotkeys;
178 - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
180 - (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd;
182 - (void)PlaylistItemChanged;
183 - (void)playbackStatusUpdated;
184 - (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
185 - (void)playbackModeUpdated;
186 - (void)updateVolume;
187 - (void)updatePlaybackPosition;
189 - (void)playlistUpdated;
190 - (void)updateRecordState: (BOOL)b_value;
191 - (void)updateInfoandMetaPanel;
192 - (void)updateMainMenu;
193 - (void)updateMainWindow;
194 - (void)showMainWindow;
195 - (void)showFullscreenController;
196 - (void)updateDelays;
199 - (IBAction)crashReporterAction:(id)sender;
200 - (IBAction)openCrashLog:(id)sender;
201 - (IBAction)saveDebugLog:(id)sender;
202 - (IBAction)showMessagesPanel:(id)sender;
203 - (IBAction)updateMessagesPanel:(id)sender;
205 - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
207 - (void)updateTogglePlaylistState;
209 - (void)windowDidBecomeKey:(NSNotification *)o_notification;
211 - (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
215 /*****************************************************************************
216 * VLCApplication interface
217 *****************************************************************************/
219 @interface VLCApplication : NSApplication