intf.h 7.35 KB
Newer Older
1
/*****************************************************************************
2
 * intf.h: MacOS X interface module
3
 *****************************************************************************
4
 * Copyright (C) 2002-2013 VLC authors and VideoLAN
5
 * $Id$
6
7
 *
 * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
 *          Derk-Jan Hartman <hartman at videolan dot org>
9
 *          Felix Paul Kühne <fkuehne at videolan dot org>
10
 *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
11
 *          Pierre d'Herbemont <pdherbemont # videolan org>
12
13
14
15
16
 *
 * 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.
17
 *
18
19
20
21
22
23
24
 * 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
25
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26
27
 *****************************************************************************/

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

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

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

48
49
#import <IOKit/pwr_mgt/IOPMLib.h>           /* for sleep prevention */

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

55
56
57
// You need to release those objects after use
input_thread_t *getInput(void);
vout_thread_t *getVout(void);
58
vout_thread_t *getVoutForActiveWindow(void);
59
audio_output_t *getAout(void);
60

61
62
63
64
65
66
/*****************************************************************************
 * intf_sys_t: description and status of the interface
 *****************************************************************************/
struct intf_sys_t
{
    /* menus handlers */
67
68
69
    bool b_input_update;
    bool b_aout_update;
    bool b_vout_update;
70
71
72
};

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

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

108
    VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
109

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

113
    /* messages panel */
114
115
116
117
    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? */
118
    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
    AppleRemote * o_remote;
123
    BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
124

125
126
127
128
129
    /* media key support */
    BOOL b_mediaKeySupport;
    BOOL b_mediakeyJustJumped;
    SPMediaKeyTap * o_mediaKeyController;

130
    NSArray *o_usedHotkeys;
131
132
133

    /* sleep management */
    IOPMAssertionID systemSleepAssertionID;
134
    IOPMAssertionID userActivityAssertionID;
135
136

    VLCVoutWindowController *o_vout_controller;
137
138
139
140

    /* iTunes play/pause support */
    BOOL b_has_itunes_paused;
    NSTimer *o_itunes_play_timer;
141
142

    BOOL b_playlist_updated_selector_in_queue;
143
144
}

145
@property (readonly) VLCVoutWindowController* voutController;
146
@property (readonly) BOOL nativeFullscreenMode;
147
@property (nonatomic, readwrite) BOOL playlistUpdatedSelectorInQueue;
hartman's avatar
hartman committed
148
149
+ (VLCMain *)sharedInstance;

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

153
- (id)mainMenu;
154
- (VLCMainWindow *)mainWindow;
155
- (id)controls;
156
157
- (id)bookmarks;
- (id)open;
158
159
160
161
162
163
164
- (id)simplePreferences;
- (id)preferences;
- (id)playlist;
- (id)info;
- (id)wizard;
- (id)coreDialogProvider;
- (id)eyeTVController;
165
- (id)appleRemoteController;
166
167
- (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback;
168
- (void)applicationWillTerminate:(NSNotification *)notification;
169
- (void)updateCurrentlyUsedHotkeys;
170
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
171

172
- (void)PlaylistItemChanged;
173
- (void)informInputChanged;
174
- (void)playbackStatusUpdated;
175
- (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
176
177
178
- (void)playbackModeUpdated;
- (void)updateVolume;
- (void)updatePlaybackPosition;
179
- (void)updateName;
180
- (void)playlistUpdated;
181
- (void)updateRecordState: (BOOL)b_value;
182
- (void)updateInfoandMetaPanel;
183
- (void)updateMainMenu;
184
- (void)updateMainWindow;
185
- (void)showMainWindow;
Felix Paul Kühne's avatar
Felix Paul Kühne committed
186
- (void)showFullscreenController;
187
- (void)updateDelays;
188
189
- (void)initStrings;

190
- (IBAction)saveDebugLog:(id)sender;
191
- (IBAction)showMessagesPanel:(id)sender;
192
- (IBAction)updateMessagesPanel:(id)sender;
193

194
- (void)processReceivedlibvlcMessage:(const vlc_log_t *) item ofType: (int)type withStr: (char *)str;
195

196
197
- (void)updateTogglePlaylistState;

198
199
- (void)windowDidBecomeKey:(NSNotification *)o_notification;

200
- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
201
202
@end

203
204
205
206
207
208

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

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

210
@end