]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.h
macosx: slightly de-uglify the VLC description in the about dialog by rendering it...
[vlc] / modules / gui / macosx / intf.h
index 57a4edc90ea8fc0829171f44b57b297a90cbb705..8afc5bb7483995d0ead8f957f4c678e9fec86a33 100644 (file)
@@ -1,13 +1,14 @@
 /*****************************************************************************
  * intf.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2011 the VideoLAN team
+ * Copyright (C) 2002-2014 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
- *          Christophe Massiot <massiot@via.ecp.fr>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *          Felix Paul Kühne <fkuehne at videolan dot org>
+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
+ *          Pierre d'Herbemont <pdherbemont # videolan org>
  *
  * 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
 #   include "config.h"
 #endif
 
-#include <vlc_common.h>
-#include <vlc_interface.h>
-#include <vlc_playlist.h>
-#include <vlc_vout.h>
-#include <vlc_aout.h>
-#include <vlc_input.h>
+#import <vlc_common.h>
+#import <vlc_interface.h>
+#import <vlc_playlist.h>
+#import <vlc_vout.h>
+#import <vlc_aout.h>
+#import <vlc_input.h>
+#import <vlc_vout_window.h>
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
 #import "SPMediaKeyTap.h"                   /* for the media key support */
+#import "misc.h"
+#import "MainWindow.h"
+#import "VLCVoutWindowController.h"
+#import "StringUtility.h"
+
+#import <IOKit/pwr_mgt/IOPMLib.h>           /* for sleep prevention */
 
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-unsigned int CocoaKeyToVLC( unichar i_key );
-
 #define VLCIntf [[VLCMain sharedInstance] intf]
 
-#define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
-/* 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 */
-#define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
-
-#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
-            @"/System/Library/CoreServices/SystemVersion.plist"] \
-            objectForKey: @"ProductVersion"] floatValue]
-
-
 // You need to release those objects after use
 input_thread_t *getInput(void);
 vout_thread_t *getVout(void);
-aout_instance_t *getAout(void);
+vout_thread_t *getVoutForActiveWindow(void);
+audio_output_t *getAout(void);
 
-/*****************************************************************************
- * intf_sys_t: description and status of the interface
- *****************************************************************************/
-struct intf_sys_t
-{
-    /* special actions */
-    int i_play_status;
-    int i_old_play_status;
-
-    /* interface update */
-    bool b_intf_update;
-    bool b_playlist_update;
-    bool b_playmode_update;
-    bool b_current_title_update;
-    bool b_fullscreen_update;
-    bool b_intf_show;
-
-    /* menus handlers */
-    bool b_input_update;
-    bool b_aout_update;
-    bool b_vout_update;
-
-    /* The messages window */
-    msg_subscription_t * p_sub;
-};
+static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
 
 /*****************************************************************************
  * VLCMain interface
  *****************************************************************************/
 @class AppleRemote;
-@class VLCInformation;
-@class VLCEmbeddedWindow;
 @class VLCControls;
 @class VLCPlaylist;
-@interface VLCMain : NSObject
+
+@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
 {
     intf_thread_t *p_intf;      /* The main intf object */
+    input_thread_t *p_current_input;
+    BOOL launched;              /* finishedLaunching */
+    int items_at_launch;        /* items in playlist after launch */
     id o_mainmenu;              /* VLCMainMenu */
     id o_prefs;                 /* VLCPrefs       */
     id o_sprefs;                /* VLCSimplePrefs */
     id o_open;                  /* VLCOpen        */
     id o_wizard;                /* VLCWizard      */
-    id o_embedded_list;         /* VLCEmbeddedList*/
     id o_coredialogs;           /* VLCCoreDialogProvider */
-    VLCInformation * o_info;    /* VLCInformation */
+    id o_info;                  /* VLCInformation */
     id o_eyetv;                 /* VLCEyeTVController */
     id o_bookmarks;             /* VLCBookmarks */
     id o_coreinteraction;       /* VLCCoreInteraction */
@@ -117,40 +90,14 @@ struct intf_sys_t
     BOOL nib_info_loaded;       /* information panel nibfile */
     BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
     BOOL nib_bookmarks_loaded;   /* Bookmarks nibfile */
+    BOOL b_active_videoplayback;
+    BOOL b_nativeFullscreenMode;
 
-    IBOutlet id o_mainwindow;            /* VLCMainWindow */
+    IBOutlet VLCMainWindow *o_mainwindow;            /* VLCMainWindow */
 
     IBOutlet VLCControls * o_controls;     /* VLCControls    */
     IBOutlet VLCPlaylist * o_playlist;     /* VLCPlaylist    */
 
-    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? */
-    IBOutlet NSButton * o_msgs_crashlog_btn;    /* messages open crashlog */
-    IBOutlet NSButton * o_msgs_save_btn;        /* save the log as rtf */
-
-    /* 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;
-    IBOutlet NSButton * o_crashrep_includeEmail_ckb;
-    IBOutlet NSTextField * o_crashrep_includeEmail_txt;
-
-    input_state_e cachedInputState;
-
-    /* the manage thread */
-    pthread_t manage_thread;
-
-    /* The timer that update the interface */
-    NSTimer * interfaceTimer;
-
-    NSURLConnection * crashLogURLConnection;
-
     AppleRemote * o_remote;
     BOOL b_remote_button_hold; /* true as long as the user holds the left,right,plus or minus on the remote control */
 
@@ -160,14 +107,33 @@ struct intf_sys_t
     SPMediaKeyTap * o_mediaKeyController;
 
     NSArray *o_usedHotkeys;
+
+    /* sleep management */
+    IOPMAssertionID systemSleepAssertionID;
+    IOPMAssertionID userActivityAssertionID;
+
+    VLCVoutWindowController *o_vout_controller;
+
+    /* iTunes/Spotify play/pause support */
+    BOOL b_has_itunes_paused;
+    BOOL b_has_spotify_paused;
+    NSTimer *o_itunes_play_timer;
+
+    BOOL b_playlist_updated_selector_in_queue;
+
+    dispatch_queue_t informInputChangedQueue;
 }
 
+@property (readonly) VLCVoutWindowController* voutController;
+@property (readonly) BOOL nativeFullscreenMode;
+@property (nonatomic, readwrite) BOOL playlistUpdatedSelectorInQueue;
 + (VLCMain *)sharedInstance;
 
 - (intf_thread_t *)intf;
 - (void)setIntf:(intf_thread_t *)p_mainintf;
 
 - (id)mainMenu;
+- (VLCMainWindow *)mainWindow;
 - (id)controls;
 - (id)bookmarks;
 - (id)open;
@@ -176,56 +142,46 @@ struct intf_sys_t
 - (id)playlist;
 - (id)info;
 - (id)wizard;
-- (id)embeddedList;
-- (id)getVideoViewAtPositionX: (int *)pi_x Y: (int *)pi_y withWidth: (unsigned int*)pi_width andHeight: (unsigned int*)pi_height;
 - (id)coreDialogProvider;
 - (id)eyeTVController;
 - (id)appleRemoteController;
+- (void)setActiveVideoPlayback:(BOOL)b_value;
+- (BOOL)activeVideoPlayback;
 - (void)applicationWillTerminate:(NSNotification *)notification;
-- (NSString *)localizedString:(const char *)psz;
-- (char *)delocalizeString:(NSString *)psz;
-- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
-- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event;
-- (NSString *)VLCKeyToString:(NSString *)theString;
-- (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
 - (void)updateCurrentlyUsedHotkeys;
+- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
+
+- (void)PlaylistItemChanged;
+- (void)playbackStatusUpdated;
+- (void)sendDistributedNotificationWithUpdatedPlaybackStatus;
+- (void)playbackModeUpdated;
+- (void)updateVolume;
+- (void)updatePlaybackPosition;
+- (void)updateName;
+- (void)playlistUpdated;
+- (void)updateRecordState: (BOOL)b_value;
+- (void)updateInfoandMetaPanel;
+- (void)updateMainMenu;
+- (void)updateMainWindow;
+- (void)showMainWindow;
+- (void)showFullscreenController;
+- (void)updateDelays;
 
-- (void)initStrings;
-- (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename;
-
-- (void)manage;
-- (void)manageIntf:(NSTimer *)o_timer;
-
-- (void)updateMessageDisplay;
-- (void)playStatusUpdated:(int) i_status;
-- (IBAction)showController:(id)sender;
-
-- (IBAction)crashReporterAction:(id)sender;
-- (IBAction)openCrashLog:(id)sender;
-- (IBAction)saveDebugLog:(id)sender;
-- (IBAction)showMessagesPanel:(id)sender;
+- (void)updateTogglePlaylistState;
 
-- (void)processReceivedlibvlcMessage:(const msg_item_t *)item;
+- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
 
-- (IBAction)togglePlaylist:(id)sender;
-- (void)updateTogglePlaylistState;
+- (void)resetAndReinitializeUserDefaults;
 
-- (void)windowDidBecomeKey:(NSNotification *)o_notification;
+- (BOOL)isTerminating;
 
-- (void)mediaKeyTap:(SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
 @end
 
-@interface VLCMain (Internal)
-- (void)handlePortMessage:(NSPortMessage *)o_msg;
-- (void)resetMediaKeyJump;
-- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
-@end
 
 /*****************************************************************************
  * VLCApplication interface
  *****************************************************************************/
 
 @interface VLCApplication : NSApplication
-{
-}
+
 @end