intf.h 7.87 KB
Newer Older
1
/*****************************************************************************
2
 * intf.h: MacOS X interface module
3
 *****************************************************************************
4
 * Copyright (C) 2002-2011 the VideoLAN team
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
#include <vlc_common.h>
zorglub's avatar
zorglub committed
32
#include <vlc_interface.h>
33
#include <vlc_playlist.h>
zorglub's avatar
zorglub committed
34
35
36
#include <vlc_vout.h>
#include <vlc_aout.h>
#include <vlc_input.h>
37
38

#include <Cocoa/Cocoa.h>
39
#import "SPMediaKeyTap.h"                   /* for the media key support */
40

41
/*****************************************************************************
hartman's avatar
hartman committed
42
 * Local prototypes.
43
 *****************************************************************************/
hartman's avatar
hartman committed
44
unsigned int CocoaKeyToVLC( unichar i_key );
45

46
#define VLCIntf [[VLCMain sharedInstance] intf]
47

hartman's avatar
hartman committed
48
#define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
hartman's avatar
ALL:    
hartman committed
49
50
51
/* 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
52
#define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
53

54
55
56
57
#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
            @"/System/Library/CoreServices/SystemVersion.plist"] \
            objectForKey: @"ProductVersion"] floatValue]

58
59
60
61

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

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

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

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

109
    IBOutlet id o_mainwindow;            /* VLCMainWindow */
110

111
112
    IBOutlet VLCControls * o_controls;     /* VLCControls    */
    IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
113

114
115
116
117
118
    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? */
119
120
    IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
    IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
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
130
    IBOutlet NSButton * o_crashrep_includeEmail_ckb;
    IBOutlet NSTextField * o_crashrep_includeEmail_txt;
131

132
133
    input_state_e cachedInputState;

134
135
    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 */
138

139
140
141
142
143
    /* media key support */
    BOOL b_mediaKeySupport;
    BOOL b_mediakeyJustJumped;
    SPMediaKeyTap * o_mediaKeyController;

144
    NSArray *o_usedHotkeys;
145
146
}

hartman's avatar
hartman committed
147
148
+ (VLCMain *)sharedInstance;

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

152
- (id)mainMenu;
153
- (id)controls;
154
155
- (id)bookmarks;
- (id)open;
156
157
158
159
160
161
- (id)simplePreferences;
- (id)preferences;
- (id)playlist;
- (id)info;
- (id)wizard;
- (id)embeddedList;
162
- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
163
164
- (id)coreDialogProvider;
- (id)eyeTVController;
165
- (id)appleRemoteController;
166
- (void)applicationWillTerminate:(NSNotification *)notification;
167
- (NSString *)localizedString:(const char *)psz;
hartman's avatar
hartman committed
168
169
170
- (char *)delocalizeString:(NSString *)psz;
- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
171
172
- (NSString *)VLCKeyToString:(NSString *)theString;
- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
173
- (void)updateCurrentlyUsedHotkeys;
174
175
176
177
178
179
180
181
182
- (void)PlaylistItemChanged;
- (void)playbackStatusUpdated;
- (void)playbackModeUpdated;
- (void)updateVolume;
- (void)updatePlaybackPosition;
- (void)updateTitle;
- (void)playlistUpdated;
- (void)updateInfoandMetaPanel;
- (void)updateMainWindow;
183
- (void)initStrings;
184
- (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
185

186
- (void)updateMessageDisplay;
187

188
- (IBAction)showController:(id)sender;
189

190
- (IBAction)crashReporterAction:(id)sender;
191
- (IBAction)openCrashLog:(id)sender;
192
- (IBAction)saveDebugLog:(id)sender;
193
- (IBAction)showMessagesPanel:(id)sender;
194

195
196
- (void)processReceivedlibvlcMessage:(const msg_item_t *)item;

197
198
199
- (IBAction)togglePlaylist:(id)sender;
- (void)updateTogglePlaylistState;

200
201
- (void)windowDidBecomeKey:(NSNotification *)o_notification;

202
- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
203
204
205
206
@end

@interface VLCMain (Internal)
- (void)handlePortMessage:(NSPortMessage *)o_msg;
207
208
- (void)resetMediaKeyJump;
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
209
@end
210
211
212
213
214
215
216
217
218

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

@interface VLCApplication : NSApplication
{
}
@end