intf.h 7.88 KB
Newer Older
1
/*****************************************************************************
2
 * intf.h: MacOS X interface module
3
 *****************************************************************************
4
 * Copyright (C) 2002-2012 VLC authors and VideoLAN
5
 * $Id$
6 7 8
 *
 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
 *          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 13 14 15
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
16
 *
17 18 19 20 21 22 23
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
dionoea's avatar
dionoea committed
24
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 26
 *****************************************************************************/

Rafaël Carré's avatar
Rafaël Carré committed
27 28 29 30
#ifdef HAVE_CONFIG_H
#   include "config.h"
#endif

31 32 33 34 35 36
#import <vlc_common.h>
#import <vlc_interface.h>
#import <vlc_playlist.h>
#import <vlc_vout.h>
#import <vlc_aout.h>
#import <vlc_input.h>
37
#import <vlc_vout_window.h>
38

39 40
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
41
#import "SPMediaKeyTap.h"                   /* for the media key support */
42
#import "misc.h"
43
#import "MainWindow.h"
44
#import "StringUtility.h"
45

46 47
#import <IOKit/pwr_mgt/IOPMLib.h>           /* for sleep prevention */

48
/*****************************************************************************
hartman's avatar
hartman committed
49
 * Local prototypes.
50
 *****************************************************************************/
51
#define VLCIntf [[VLCMain sharedInstance] intf]
52

53 54 55
// You need to release those objects after use
input_thread_t *getInput(void);
vout_thread_t *getVout(void);
56
audio_output_t *getAout(void);
57

58 59 60 61 62 63
/*****************************************************************************
 * intf_sys_t: description and status of the interface
 *****************************************************************************/
struct intf_sys_t
{
    /* menus handlers */
64 65 66
    bool b_input_update;
    bool b_aout_update;
    bool b_vout_update;
67 68

    /* The messages window */
69
    msg_subscription_t sub;
70 71 72
};

/*****************************************************************************
73
 * VLCMain interface
74
 *****************************************************************************/
75
@class AppleRemote;
76
@class VLCInformation;
77 78 79
@class VLCEmbeddedWindow;
@class VLCControls;
@class VLCPlaylist;
80 81
@class VLCVoutWindowController;

82
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
83
{
hartman's avatar
hartman committed
84
    intf_thread_t *p_intf;      /* The main intf object */
85
    input_thread_t *p_current_input;
86
    id o_mainmenu;              /* VLCMainMenu */
87
    id o_prefs;                 /* VLCPrefs       */
88
    id o_sprefs;                /* VLCSimplePrefs */
89
    id o_open;                  /* VLCOpen        */
90
    id o_wizard;                /* VLCWizard      */
91
    id o_coredialogs;           /* VLCCoreDialogProvider */
92
    id o_info;                  /* VLCInformation */
93
    id o_eyetv;                 /* VLCEyeTVController */
94
    id o_bookmarks;             /* VLCBookmarks */
95
    id o_coreinteraction;       /* VLCCoreInteraction */
96 97 98 99
    BOOL nib_main_loaded;       /* main nibfile */
    BOOL nib_open_loaded;       /* open nibfile */
    BOOL nib_about_loaded;      /* about nibfile */
    BOOL nib_wizard_loaded;     /* wizard nibfile */
100
    BOOL nib_prefs_loaded;      /* preferences nibfile */
101
    BOOL nib_info_loaded;       /* information panel nibfile */
102
    BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
103
    BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
104
    BOOL b_active_videoplayback;
105
    BOOL b_nativeFullscreenMode;
106

107
    VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
108

109 110
    IBOutlet VLCControls * o_controls;     /* VLCControls    */
    IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
111

112
    /* messages panel */
113 114 115 116
    IBOutlet NSWindow * o_msgs_panel;           /* messages panel */
    NSMutableArray * o_msg_arr;                 /* messages array */
    NSLock * o_msg_lock;                        /* messages lock */
    BOOL b_msg_arr_changed;                     /* did the array change? */
117 118
    IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
    IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
119 120
    IBOutlet NSButton * o_msgs_refresh_btn;     /* update the panel */
    IBOutlet id o_msgs_table;
121

122 123 124 125 126 127 128
    /* CrashReporter panel */
    IBOutlet NSButton * o_crashrep_dontSend_btn;
    IBOutlet NSButton * o_crashrep_send_btn;
    IBOutlet NSTextView * o_crashrep_fld;
    IBOutlet NSTextField * o_crashrep_title_txt;
    IBOutlet NSTextField * o_crashrep_desc_txt;
    IBOutlet NSWindow * o_crashrep_win;
129
    IBOutlet NSButton * o_crashrep_includeEmail_ckb;
130
    IBOutlet NSButton * o_crashrep_dontaskagain_ckb;
131
    IBOutlet NSTextField * o_crashrep_includeEmail_txt;
132 133
    NSURLConnection * crashLogURLConnection;

134
    AppleRemote * o_remote;
135
    BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
136

137 138 139 140 141
    /* media key support */
    BOOL b_mediaKeySupport;
    BOOL b_mediakeyJustJumped;
    SPMediaKeyTap * o_mediaKeyController;

142
    NSArray *o_usedHotkeys;
143 144 145

    /* sleep management */
    IOPMAssertionID systemSleepAssertionID;
146 147

    VLCVoutWindowController *o_vout_controller;
148 149
}

150 151
@property (readonly) VLCVoutWindowController* voutController;

hartman's avatar
hartman committed
152 153
+ (VLCMain *)sharedInstance;

154
- (intf_thread_t *)intf;
hartman's avatar
hartman committed
155 156
- (void)setIntf:(intf_thread_t *)p_mainintf;

157
- (id)mainMenu;
158
- (VLCMainWindow *)mainWindow;
159
- (id)controls;
160 161
- (id)bookmarks;
- (id)open;
162 163 164 165 166
- (id)simplePreferences;
- (id)preferences;
- (id)playlist;
- (id)info;
- (id)wizard;
167
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height forWindow:(vout_window_t *)p_wnd;
168 169
- (id)coreDialogProvider;
- (id)eyeTVController;
170
- (id)appleRemoteController;
171 172
- (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback;
173
- (void)applicationWillTerminate:(NSNotification *)notification;
174
- (void)updateCurrentlyUsedHotkeys;
175
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
176 177 178

- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd;

179 180
- (void)PlaylistItemChanged;
- (void)playbackStatusUpdated;
181
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
182 183 184
- (void)playbackModeUpdated;
- (void)updateVolume;
- (void)updatePlaybackPosition;
185
- (void)updateName;
186
- (void)playlistUpdated;
187
- (void)updateRecordState: (BOOL)b_value;
188
- (void)updateInfoandMetaPanel;
189
- (void)updateMainMenu;
190
- (void)updateMainWindow;
191
- (void)showMainWindow;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
192
- (void)showFullscreenController;
193
- (void)updateDelays;
194 195
- (void)initStrings;

196
- (IBAction)crashReporterAction:(id)sender;
197
- (IBAction)openCrashLog:(id)sender;
198
- (IBAction)saveDebugLog:(id)sender;
199
- (IBAction)showMessagesPanel:(id)sender;
200
- (IBAction)updateMessagesPanel:(id)sender;
201

202
- (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
203

204 205
- (void)updateTogglePlaylistState;

206 207
- (void)windowDidBecomeKey:(NSNotification *)o_notification;

208
- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
209 210 211 212
@end

@interface VLCMain (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg;
213 214
- (void)resetMediaKeyJump;
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
215
@end
216 217 218 219 220 221

/*****************************************************************************
 * VLCApplication interface
 *****************************************************************************/

@interface VLCApplication : NSApplication
Felix Paul Kühne's avatar
Felix Paul Kühne committed
222

223
@end