intf.h 8.2 KB
Newer Older
1
/*****************************************************************************
2
 * intf.h: MacOS X interface module
3
 *****************************************************************************
Felix Paul Kühne's avatar
Felix Paul Kühne committed
4
 * Copyright (C) 2002-2011 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

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

44
/*****************************************************************************
hartman's avatar
hartman committed
45
 * Local prototypes.
46
 *****************************************************************************/
hartman's avatar
hartman committed
47
unsigned int CocoaKeyToVLC( unichar i_key );
48

49
#define VLCIntf [[VLCMain sharedInstance] intf]
50

hartman's avatar
hartman committed
51
#define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
hartman's avatar
ALL:    
hartman committed
52
53
54
/* Get an alternate version of the string.
 * This string is stored as '1:string' but when displayed it only displays
 * the translated string. the translation should be '1:translatedstring' though */
hartman's avatar
hartman committed
55
#define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
56

57
58
59
60
#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
            @"/System/Library/CoreServices/SystemVersion.plist"] \
            objectForKey: @"ProductVersion"] floatValue]

61
62
63
64

// You need to release those objects after use
input_thread_t *getInput(void);
vout_thread_t *getVout(void);
65
audio_output_t *getAout(void);
66

67
68
69
70
71
72
/*****************************************************************************
 * intf_sys_t: description and status of the interface
 *****************************************************************************/
struct intf_sys_t
{
    /* menus handlers */
73
74
75
    bool b_input_update;
    bool b_aout_update;
    bool b_vout_update;
76
77
78
79
80
81

    /* The messages window */
    msg_subscription_t * p_sub;
};

/*****************************************************************************
82
 * VLCMain interface
83
 *****************************************************************************/
84
@class AppleRemote;
85
@class VLCInformation;
86
87
88
@class VLCEmbeddedWindow;
@class VLCControls;
@class VLCPlaylist;
89
@interface VLCMain : NSObject <NSWindowDelegate>
90
{
hartman's avatar
hartman committed
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
104
105
106
    BOOL nib_main_loaded;       /* main nibfile */
    BOOL nib_open_loaded;       /* open nibfile */
    BOOL nib_about_loaded;      /* about nibfile */
    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
    BOOL b_nativeFullscreenMode;
113

114
    VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
115

116
117
    IBOutlet VLCControls * o_controls;     /* VLCControls    */
    IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
118

119
120
121
122
123
    IBOutlet NSTextView * o_messages;           /* messages tv    */
    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? */
124
125
    IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
    IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
126

127
128
129
130
131
132
133
    /* 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;
134
135
    IBOutlet NSButton * o_crashrep_includeEmail_ckb;
    IBOutlet NSTextField * o_crashrep_includeEmail_txt;
136
137
    NSURLConnection * crashLogURLConnection;

138
    AppleRemote * o_remote;
139
    BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
140

141
142
143
144
145
    /* media key support */
    BOOL b_mediaKeySupport;
    BOOL b_mediakeyJustJumped;
    SPMediaKeyTap * o_mediaKeyController;

146
    NSArray *o_usedHotkeys;
147
148
}

hartman's avatar
hartman committed
149
150
+ (VLCMain *)sharedInstance;

151
- (intf_thread_t *)intf;
hartman's avatar
hartman committed
152
153
- (void)setIntf:(intf_thread_t *)p_mainintf;

154
- (id)mainMenu;
155
- (id)controls;
156
157
- (id)bookmarks;
- (id)open;
158
159
160
161
162
163
- (id)simplePreferences;
- (id)preferences;
- (id)playlist;
- (id)info;
- (id)wizard;
- (id)embeddedList;
164
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
165
- (void)setNativeVideoSize:(NSSize)size;
166
167
- (id)coreDialogProvider;
- (id)eyeTVController;
168
- (id)appleRemoteController;
169
170
- (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback;
171
- (void)applicationWillTerminate:(NSNotification *)notification;
172
- (NSString *)localizedString:(const char *)psz;
hartman's avatar
hartman committed
173
174
175
- (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
176
177
- (NSString *)VLCKeyToString:(NSString *)theString;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
178
- (void)updateCurrentlyUsedHotkeys;
179
- (void)fullscreenChanged;
180
181
182
183
184
- (void)PlaylistItemChanged;
- (void)playbackStatusUpdated;
- (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;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
191
- (void)showFullscreenController;
192
- (void)updateDelays;
193
- (void)initStrings;
194
- (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
195

196
- (void)updateMessageDisplay;
197

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

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

205
206
- (void)updateTogglePlaylistState;

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

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

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

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

@interface VLCApplication : NSApplication
{
}
@end