]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/intf.h
macosx: fixed potential crashes when localizing strings
[vlc] / modules / gui / macosx / intf.h
index 92dfba2b6ca51048596a6c175c632daea4efe63c..f79efbf6e5a500333900d29dd279a72e00d3a863 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * intf.h: MacOS X interface module
  *****************************************************************************
- * Copyright (C) 2002-2011 the VideoLAN team
+ * Copyright (C) 2002-2012 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
 #   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>
 
-#include <Cocoa/Cocoa.h>
+#import <Cocoa/Cocoa.h>
+#import "CompatibilityFixes.h"
 #import "SPMediaKeyTap.h"                   /* for the media key support */
+#import "misc.h"
+#import "MainWindow.h"
 
 /*****************************************************************************
  * Local prototypes.
@@ -45,7 +48,7 @@ unsigned int CocoaKeyToVLC( unichar i_key );
 
 #define VLCIntf [[VLCMain sharedInstance] intf]
 
-#define _NS(s) [[VLCMain sharedInstance] localizedString: _(s)]
+#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 */
@@ -59,26 +62,13 @@ unsigned int CocoaKeyToVLC( unichar i_key );
 // You need to release those objects after use
 input_thread_t *getInput(void);
 vout_thread_t *getVout(void);
-aout_instance_t *getAout(void);
+audio_output_t *getAout(void);
 
 /*****************************************************************************
  * intf_sys_t: description and status of the interface
  *****************************************************************************/
 struct intf_sys_t
 {
-    /* special actions */
-    bool b_mute;
-    int i_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_volume_update;
-    bool b_intf_show;
-
     /* menus handlers */
     bool b_input_update;
     bool b_aout_update;
@@ -93,11 +83,10 @@ struct intf_sys_t
  *****************************************************************************/
 @class AppleRemote;
 @class VLCInformation;
-@class VLCControllerWindow;
 @class VLCEmbeddedWindow;
 @class VLCControls;
 @class VLCPlaylist;
-@interface VLCMain : NSObject
+@interface VLCMain : NSObject <NSWindowDelegate>
 {
     intf_thread_t *p_intf;      /* The main intf object */
     id o_mainmenu;              /* VLCMainMenu */
@@ -107,9 +96,10 @@ struct intf_sys_t
     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 */
     BOOL nib_main_loaded;       /* main nibfile */
     BOOL nib_open_loaded;       /* open nibfile */
     BOOL nib_about_loaded;      /* about nibfile */
@@ -118,43 +108,22 @@ 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 VLCControllerWindow * o_window;                     /* main window */
-    IBOutlet id o_scrollfield;                                  /* info field */
-    IBOutlet NSTextField * o_timefield;                         /* time field */
-    IBOutlet NSSlider * o_timeslider;                                 /* time slider */
-    BOOL b_time_remaining;                                      /* show remaining time or playtime ? */
-    IBOutlet VLCEmbeddedWindow * o_embedded_window;             /* Embedded Vout Window */
-    float f_slider;                                             /* slider value */
-    float f_slider_old;                                         /* old slider val */
-    IBOutlet NSSlider * o_volumeslider;                         /* volume slider */
-
-    IBOutlet NSProgressIndicator * o_main_pgbar;   /* playlist window progress bar */
-    IBOutlet NSButton * o_btn_prev;     /* btn previous   */
-    IBOutlet NSButton * o_btn_rewind;   /* btn rewind     */
-    IBOutlet NSButton * o_btn_play;     /* btn play       */
-    IBOutlet NSButton * o_btn_stop;     /* btn stop       */
-    IBOutlet NSButton * o_btn_ff;       /* btn fast forward     */
-    IBOutlet NSButton * o_btn_next;     /* btn next       */
-    IBOutlet NSButton * o_btn_fullscreen;/* btn fullscreen (embedded vout window) */
-    IBOutlet NSButton * o_btn_playlist; /* btn playlist   */
-    IBOutlet NSButton * o_btn_audioEffects; /* AudioEffects btn */
-
-    NSImage * o_img_play;       /* btn play img   */
-    NSImage * o_img_pause;      /* btn pause img  */
-    NSImage * o_img_play_pressed;       /* btn play img   */
-    NSImage * o_img_pause_pressed;      /* btn pause img  */
+    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 */
+    IBOutlet NSButton * o_msgs_refresh_btn;     /* update the panel */
+    IBOutlet id o_msgs_table;
 
     /* CrashReporter panel */
     IBOutlet NSButton * o_crashrep_dontSend_btn;
@@ -165,19 +134,6 @@ struct intf_sys_t
     IBOutlet NSWindow * o_crashrep_win;
     IBOutlet NSButton * o_crashrep_includeEmail_ckb;
     IBOutlet NSTextField * o_crashrep_includeEmail_txt;
-
-    mtime_t i_end_scroll;
-
-    int     i_lastShownVolume;
-
-    input_state_e cachedInputState;
-
-    /* the manage thread */
-    pthread_t manage_thread;
-
-    /* The timer that update the interface */
-    NSTimer * interfaceTimer;
-
     NSURLConnection * crashLogURLConnection;
 
     AppleRemote * o_remote;
@@ -203,15 +159,16 @@ struct intf_sys_t
 - (id)simplePreferences;
 - (id)preferences;
 - (id)playlist;
-- (BOOL)isPlaylistCollapsed;
 - (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;
+- (void)setNativeVideoSize:(NSSize)size;
 - (id)coreDialogProvider;
-- (id)mainIntfPgbar;
-- (id)controllerWindow;
 - (id)eyeTVController;
 - (id)appleRemoteController;
+- (void)setActiveVideoPlayback:(BOOL)b_value;
+- (BOOL)activeVideoPlayback;
 - (void)applicationWillTerminate:(NSNotification *)notification;
 - (NSString *)localizedString:(const char *)psz;
 - (char *)delocalizeString:(NSString *)psz;
@@ -220,29 +177,32 @@ struct intf_sys_t
 - (NSString *)VLCKeyToString:(NSString *)theString;
 - (unsigned int)VLCModifiersToCocoa:(NSString *)theString;
 - (void)updateCurrentlyUsedHotkeys;
-
+- (void)fullscreenChanged;
+- (void)PlaylistItemChanged;
+- (void)playbackStatusUpdated;
+- (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)setScrollField:(NSString *)o_string stopAfter:(int )timeout;
-- (void)resetScrollField;
-
-- (void)updateMessageDisplay;
-- (void)playStatusUpdated:(int) i_status;
-- (void)manageVolumeSlider;
-- (IBAction)timesliderUpdate:(id)sender;
-- (IBAction)timeFieldWasClicked:(id)sender;
-- (IBAction)showController:(id)sender;
-
 - (IBAction)crashReporterAction:(id)sender;
 - (IBAction)openCrashLog:(id)sender;
 - (IBAction)saveDebugLog:(id)sender;
 - (IBAction)showMessagesPanel:(id)sender;
+- (IBAction)updateMessagesPanel:(id)sender;
+
+- (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)type withStr: (char *)str;
 
-- (IBAction)togglePlaylist:(id)sender;
 - (void)updateTogglePlaylistState;
 
 - (void)windowDidBecomeKey:(NSNotification *)o_notification;