Commit f4504578 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: refactor main class object life management and main menu

parent db62975c
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -374,8 +374,6 @@ ...@@ -374,8 +374,6 @@
1CCB5F5B1A62A724004C3E90 /* bookmarks.h in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0708A5724D007B10AE /* bookmarks.h */; }; 1CCB5F5B1A62A724004C3E90 /* bookmarks.h in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0708A5724D007B10AE /* bookmarks.h */; };
1CCB5F5C1A62A724004C3E90 /* bookmarks.m in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0608A5724D007B10AE /* bookmarks.m */; }; 1CCB5F5C1A62A724004C3E90 /* bookmarks.m in Sources */ = {isa = PBXBuildFile; fileRef = DCE7BD0608A5724D007B10AE /* bookmarks.m */; };
1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */ = {isa = PBXBuildFile; fileRef = CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */; }; 1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */ = {isa = PBXBuildFile; fileRef = CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */; };
1CCB5F5E1A62A724004C3E90 /* controls.h in Sources */ = {isa = PBXBuildFile; fileRef = 8E6BC6FA041684EC0059A3A7 /* controls.h */; };
1CCB5F5F1A62A724004C3E90 /* controls.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ED6C27B03E2EB1C0059A3A7 /* controls.m */; };
1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */ = {isa = PBXBuildFile; fileRef = E0382C00160BA09E0031D7FF /* ControlsBar.h */; }; 1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */ = {isa = PBXBuildFile; fileRef = E0382C00160BA09E0031D7FF /* ControlsBar.h */; };
1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */ = {isa = PBXBuildFile; fileRef = E0382C01160BA09E0031D7FF /* ControlsBar.m */; }; 1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */ = {isa = PBXBuildFile; fileRef = E0382C01160BA09E0031D7FF /* ControlsBar.m */; };
1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */ = {isa = PBXBuildFile; fileRef = CC0663341566C34C003A411C /* ConvertAndSave.h */; }; 1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */ = {isa = PBXBuildFile; fileRef = CC0663341566C34C003A411C /* ConvertAndSave.h */; };
...@@ -1272,12 +1270,10 @@ ...@@ -1272,12 +1270,10 @@
8E55FB800459B0FD00FB3317 /* output.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = output.m; path = ../../../modules/gui/macosx/output.m; sourceTree = SOURCE_ROOT; }; 8E55FB800459B0FD00FB3317 /* output.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = output.m; path = ../../../modules/gui/macosx/output.m; sourceTree = SOURCE_ROOT; };
8E6BC6F6041643860059A3A7 /* applescript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = applescript.h; path = ../../../modules/gui/macosx/applescript.h; sourceTree = SOURCE_ROOT; }; 8E6BC6F6041643860059A3A7 /* applescript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = applescript.h; path = ../../../modules/gui/macosx/applescript.h; sourceTree = SOURCE_ROOT; };
8E6BC6F7041643860059A3A7 /* applescript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = applescript.m; path = ../../../modules/gui/macosx/applescript.m; sourceTree = SOURCE_ROOT; }; 8E6BC6F7041643860059A3A7 /* applescript.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = applescript.m; path = ../../../modules/gui/macosx/applescript.m; sourceTree = SOURCE_ROOT; };
8E6BC6FA041684EC0059A3A7 /* controls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = controls.h; path = ../../../modules/gui/macosx/controls.h; sourceTree = SOURCE_ROOT; };
8E9CA1A306D7DEE800B7186C /* prefs_widgets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prefs_widgets.h; path = ../../../modules/gui/macosx/prefs_widgets.h; sourceTree = SOURCE_ROOT; }; 8E9CA1A306D7DEE800B7186C /* prefs_widgets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prefs_widgets.h; path = ../../../modules/gui/macosx/prefs_widgets.h; sourceTree = SOURCE_ROOT; };
8E9CA1A406D7DEE800B7186C /* prefs_widgets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = prefs_widgets.m; path = ../../../modules/gui/macosx/prefs_widgets.m; sourceTree = SOURCE_ROOT; }; 8E9CA1A406D7DEE800B7186C /* prefs_widgets.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = prefs_widgets.m; path = ../../../modules/gui/macosx/prefs_widgets.m; sourceTree = SOURCE_ROOT; };
8EBF3FA303F13FFB0059A3A7 /* vlc.scriptSuite */ = {isa = PBXFileReference; lastKnownFileType = text; name = vlc.scriptSuite; path = Resources/vlc.scriptSuite; sourceTree = SOURCE_ROOT; }; 8EBF3FA303F13FFB0059A3A7 /* vlc.scriptSuite */ = {isa = PBXFileReference; lastKnownFileType = text; name = vlc.scriptSuite; path = Resources/vlc.scriptSuite; sourceTree = SOURCE_ROOT; };
8EBF3FA503F140960059A3A7 /* vlc.scriptTerminology */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = vlc.scriptTerminology; path = Resources/vlc.scriptTerminology; sourceTree = SOURCE_ROOT; }; 8EBF3FA503F140960059A3A7 /* vlc.scriptTerminology */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = vlc.scriptTerminology; path = Resources/vlc.scriptTerminology; sourceTree = SOURCE_ROOT; };
8ED6C27B03E2EB1C0059A3A7 /* controls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = controls.m; path = ../../../modules/gui/macosx/controls.m; sourceTree = SOURCE_ROOT; };
8ED6C27C03E2EB1C0059A3A7 /* intf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intf.h; path = ../../../modules/gui/macosx/intf.h; sourceTree = SOURCE_ROOT; }; 8ED6C27C03E2EB1C0059A3A7 /* intf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = intf.h; path = ../../../modules/gui/macosx/intf.h; sourceTree = SOURCE_ROOT; };
8ED6C27D03E2EB1C0059A3A7 /* intf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = intf.m; path = ../../../modules/gui/macosx/intf.m; sourceTree = SOURCE_ROOT; }; 8ED6C27D03E2EB1C0059A3A7 /* intf.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = intf.m; path = ../../../modules/gui/macosx/intf.m; sourceTree = SOURCE_ROOT; };
8ED6C27E03E2EB1C0059A3A7 /* macosx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = macosx.m; path = ../../../modules/gui/macosx/macosx.m; sourceTree = SOURCE_ROOT; }; 8ED6C27E03E2EB1C0059A3A7 /* macosx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = macosx.m; path = ../../../modules/gui/macosx/macosx.m; sourceTree = SOURCE_ROOT; };
...@@ -1827,8 +1823,6 @@ ...@@ -1827,8 +1823,6 @@
DCE7BD0708A5724D007B10AE /* bookmarks.h */, DCE7BD0708A5724D007B10AE /* bookmarks.h */,
DCE7BD0608A5724D007B10AE /* bookmarks.m */, DCE7BD0608A5724D007B10AE /* bookmarks.m */,
CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */, CCB0BB3013FAC9F40095BD0A /* CompatibilityFixes.h */,
8E6BC6FA041684EC0059A3A7 /* controls.h */,
8ED6C27B03E2EB1C0059A3A7 /* controls.m */,
E0382C00160BA09E0031D7FF /* ControlsBar.h */, E0382C00160BA09E0031D7FF /* ControlsBar.h */,
E0382C01160BA09E0031D7FF /* ControlsBar.m */, E0382C01160BA09E0031D7FF /* ControlsBar.m */,
CC0663341566C34C003A411C /* ConvertAndSave.h */, CC0663341566C34C003A411C /* ConvertAndSave.h */,
...@@ -3854,8 +3848,6 @@ ...@@ -3854,8 +3848,6 @@
1CCB5F5B1A62A724004C3E90 /* bookmarks.h in Sources */, 1CCB5F5B1A62A724004C3E90 /* bookmarks.h in Sources */,
1CCB5F5C1A62A724004C3E90 /* bookmarks.m in Sources */, 1CCB5F5C1A62A724004C3E90 /* bookmarks.m in Sources */,
1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */, 1CCB5F5D1A62A724004C3E90 /* CompatibilityFixes.h in Sources */,
1CCB5F5E1A62A724004C3E90 /* controls.h in Sources */,
1CCB5F5F1A62A724004C3E90 /* controls.m in Sources */,
1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */, 1CCB5F601A62A724004C3E90 /* ControlsBar.h in Sources */,
1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */, 1CCB5F611A62A724004C3E90 /* ControlsBar.m in Sources */,
1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */, 1CCB5F621A62A724004C3E90 /* ConvertAndSave.h in Sources */,
......
...@@ -1104,7 +1104,7 @@ else \ ...@@ -1104,7 +1104,7 @@ else \
- (IBAction)effects:(id)sender - (IBAction)effects:(id)sender
{ {
[[VLCMainMenu sharedInstance] showAudioEffects: sender]; [[[VLCMain sharedInstance] mainMenu] showAudioEffects: sender];
} }
#pragma mark - #pragma mark -
...@@ -1161,7 +1161,7 @@ else \ ...@@ -1161,7 +1161,7 @@ else \
[o_next_btn setEnabled: (b_seekable || b_plmul || b_chapters)]; [o_next_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
} }
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control]; [[[VLCMain sharedInstance] mainMenu] setRateControlsEnabled: b_control];
} }
@end @end
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
- (void)volumeUp; - (void)volumeUp;
- (void)volumeDown; - (void)volumeDown;
- (void)toggleMute; - (void)toggleMute;
- (void)showPosition;
- (void)startListeningWithAppleRemote; - (void)startListeningWithAppleRemote;
- (void)stopListeningWithAppleRemote; - (void)stopListeningWithAppleRemote;
...@@ -82,6 +83,7 @@ ...@@ -82,6 +83,7 @@
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter string: (const char *)psz_value; - (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter string: (const char *)psz_value;
- (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter boolean: (BOOL)b_value; - (void)setVideoFilterProperty: (const char *)psz_name forFilter: (const char *)psz_filter boolean: (BOOL)b_value;
- (BOOL)keyEvent:(NSEvent *)o_event;
- (void)updateCurrentlyUsedHotkeys; - (void)updateCurrentlyUsedHotkeys;
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force; - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force;
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#import "SPMediaKeyTap.h" #import "SPMediaKeyTap.h"
#import "AppleRemote.h" #import "AppleRemote.h"
#import "InputManager.h" #import "InputManager.h"
#import "controls.h"
static int BossCallback(vlc_object_t *p_this, const char *psz_var, static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t new_val, void *param) vlc_value_t oldval, vlc_value_t new_val, void *param)
...@@ -616,6 +615,19 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var, ...@@ -616,6 +615,19 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vlc_object_release(p_input); vlc_object_release(p_input);
} }
- (void)showPosition
{
input_thread_t *p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vout_thread_t *p_vout = input_GetVout(p_input);
if (p_vout != NULL) {
var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION);
vlc_object_release(p_vout);
}
vlc_object_release(p_input);
}
}
#pragma mark - drag and drop support for VLCVoutView, VLCDragDropView and VLCThreePartDropView #pragma mark - drag and drop support for VLCVoutView, VLCDragDropView and VLCThreePartDropView
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{ {
...@@ -1152,7 +1164,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var, ...@@ -1152,7 +1164,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
} }
break; break;
case kRemoteButtonMenu: case kRemoteButtonMenu:
[[[VLCMain sharedInstance] controls] showPosition: self]; //FIXME [self showPosition];
break; break;
case kRemoteButtonPlay_Sleep: case kRemoteButtonPlay_Sleep:
{ {
...@@ -1174,6 +1186,36 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var, ...@@ -1174,6 +1186,36 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
* shortcut key. If it is, pass it off to VLC for handling and return YES, * shortcut key. If it is, pass it off to VLC for handling and return YES,
* otherwise ignore it and return NO (where it will get handled by Cocoa). * otherwise ignore it and return NO (where it will get handled by Cocoa).
*****************************************************************************/ *****************************************************************************/
- (BOOL)keyEvent:(NSEvent *)o_event
{
BOOL eventHandled = NO;
NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0) {
unichar key = [characters characterAtIndex: 0];
if (key) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vout_thread_t *p_vout = input_GetVout(p_input);
if (p_vout != NULL) {
/* Escape */
if (key == (unichar) 0x1b) {
if (var_GetBool(p_vout, "fullscreen")) {
[self toggleFullscreen];
eventHandled = YES;
}
}
vlc_object_release(p_vout);
}
vlc_object_release(p_input);
}
}
}
return eventHandled;
}
- (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force - (BOOL)hasDefinedShortcutKey:(NSEvent *)o_event force:(BOOL)b_force
{ {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
......
/***************************************************************************** /*****************************************************************************
* MainMenu.h: MacOS X interface module *MainMenu.h: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2011-2014 Felix Paul Kühne *Copyright (C) 2011-2015 Felix Paul Kühne
* $Id$ *$Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> *Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* *
* This program is free software; you can redistribute it and/or modify *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 *it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or *the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. *(at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, *This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of *but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License *You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software *along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import <vlc_common.h> #import <vlc_common.h>
#import <vlc_interface.h> #import <vlc_interface.h>
@class AboutWindowController;
@class AddonsWindowController;
@class HelpWindowController;
@interface VLCMainMenu : NSObject @interface VLCMainMenu : NSObject
{
/* main menu */ /* main menu */
@property (readwrite, weak) IBOutlet NSMenuItem *about;
IBOutlet NSMenuItem * o_mi_about; @property (readwrite, weak) IBOutlet NSMenuItem *prefs;
IBOutlet NSMenuItem * o_mi_prefs; @property (readwrite, weak) IBOutlet NSMenuItem *checkForUpdate;
IBOutlet NSMenuItem * o_mi_checkForUpdate; @property (readwrite, weak) IBOutlet NSMenuItem *extensions;
IBOutlet NSMenuItem * o_mi_extensions; @property (readwrite, weak) IBOutlet NSMenu *extensionsMenu;
IBOutlet NSMenu * o_mu_extensions; @property (readwrite, weak) IBOutlet NSMenuItem *addonManager;
IBOutlet NSMenuItem * o_mi_addonManager; @property (readwrite, weak) IBOutlet NSMenuItem *add_intf;
IBOutlet NSMenuItem * o_mi_add_intf; @property (readwrite, weak) IBOutlet NSMenu *add_intfMenu;
IBOutlet NSMenu * o_mu_add_intf; @property (readwrite, weak) IBOutlet NSMenuItem *services;
IBOutlet NSMenuItem * o_mi_services; @property (readwrite, weak) IBOutlet NSMenuItem *hide;
IBOutlet NSMenuItem * o_mi_hide; @property (readwrite, weak) IBOutlet NSMenuItem *hide_others;
IBOutlet NSMenuItem * o_mi_hide_others; @property (readwrite, weak) IBOutlet NSMenuItem *show_all;
IBOutlet NSMenuItem * o_mi_show_all; @property (readwrite, weak) IBOutlet NSMenuItem *quit;
IBOutlet NSMenuItem * o_mi_quit;
@property (readwrite, weak) IBOutlet NSMenu *fileMenu;
IBOutlet NSMenu * o_mu_file; @property (readwrite, weak) IBOutlet NSMenuItem *open_file;
IBOutlet NSMenuItem * o_mi_open_file; @property (readwrite, weak) IBOutlet NSMenuItem *open_generic;
IBOutlet NSMenuItem * o_mi_open_generic; @property (readwrite, weak) IBOutlet NSMenuItem *open_disc;
IBOutlet NSMenuItem * o_mi_open_disc; @property (readwrite, weak) IBOutlet NSMenuItem *open_net;
IBOutlet NSMenuItem * o_mi_open_net; @property (readwrite, weak) IBOutlet NSMenuItem *open_capture;
IBOutlet NSMenuItem * o_mi_open_capture; @property (readwrite, weak) IBOutlet NSMenuItem *open_recent;
IBOutlet NSMenuItem * o_mi_open_recent; @property (readwrite, weak) IBOutlet NSMenuItem *close_window;
IBOutlet NSMenuItem * o_mi_close_window; @property (readwrite, weak) IBOutlet NSMenuItem *convertandsave;
IBOutlet NSMenuItem * o_mi_convertandsave; @property (readwrite, weak) IBOutlet NSMenuItem *save_playlist;
IBOutlet NSMenuItem * o_mi_save_playlist; @property (readwrite, weak) IBOutlet NSMenuItem *revealInFinder;
IBOutlet NSMenuItem * o_mi_revealInFinder;
@property (readwrite, weak) IBOutlet NSMenu *editMenu;
IBOutlet NSMenu * o_mu_edit; @property (readwrite, weak) IBOutlet NSMenuItem *cutItem;
IBOutlet NSMenuItem * o_mi_cut; @property (readwrite, weak) IBOutlet NSMenuItem *mcopyItem;
IBOutlet NSMenuItem * o_mi_copy; @property (readwrite, weak) IBOutlet NSMenuItem *pasteItem;
IBOutlet NSMenuItem * o_mi_paste; @property (readwrite, weak) IBOutlet NSMenuItem *clearItem;
IBOutlet NSMenuItem * o_mi_clear; @property (readwrite, weak) IBOutlet NSMenuItem *select_all;
IBOutlet NSMenuItem * o_mi_select_all;
@property (readwrite, weak) IBOutlet NSMenu *viewMenu;
IBOutlet NSMenu * o_mu_view; @property (readwrite, weak) IBOutlet NSMenuItem *toggleJumpButtons;
IBOutlet NSMenuItem * o_mi_toggleJumpButtons; @property (readwrite, weak) IBOutlet NSMenuItem *togglePlaymodeButtons;
IBOutlet NSMenuItem * o_mi_togglePlaymodeButtons; @property (readwrite, weak) IBOutlet NSMenuItem *toggleEffectsButton;
IBOutlet NSMenuItem * o_mi_toggleEffectsButton; @property (readwrite, weak) IBOutlet NSMenuItem *toggleSidebar;
IBOutlet NSMenuItem * o_mi_toggleSidebar; @property (readwrite, weak) IBOutlet NSMenu *playlistTableColumnsMenu;
IBOutlet NSMenu * o_mu_playlistTableColumns; @property (readwrite, weak) IBOutlet NSMenuItem *playlistTableColumns;
IBOutlet NSMenuItem * o_mi_playlistTableColumns;
NSMenu * o_mu_playlistTableColumnsContextMenu; @property (readwrite, weak) IBOutlet NSMenu *controlsMenu;
@property (readwrite, weak) IBOutlet NSMenuItem *play;
IBOutlet NSMenu * o_mu_controls; @property (readwrite, weak) IBOutlet NSMenuItem *stop;
IBOutlet NSMenuItem * o_mi_play; @property (readwrite, weak) IBOutlet NSMenuItem *record;
IBOutlet NSMenuItem * o_mi_stop; @property (readwrite, weak) IBOutlet NSMenuItem *rate;
IBOutlet NSMenuItem * o_mi_record; @property (readwrite, weak) IBOutlet NSView *rate_view;
IBOutlet NSMenuItem * o_mi_rate; @property (readwrite, weak) IBOutlet NSTextField *rateLabel;
IBOutlet NSView * o_mi_rate_view; @property (readwrite, weak) IBOutlet NSTextField *rate_slowerLabel;
IBOutlet id o_mi_rate_lbl; @property (readwrite, weak) IBOutlet NSTextField *rate_normalLabel;
IBOutlet id o_mi_rate_slower_lbl; @property (readwrite, weak) IBOutlet NSTextField *rate_fasterLabel;
IBOutlet id o_mi_rate_normal_lbl; @property (readwrite, weak) IBOutlet NSSlider *rate_sld;
IBOutlet id o_mi_rate_faster_lbl; @property (readwrite, weak) IBOutlet NSTextField *rateTextField;
IBOutlet id o_mi_rate_sld; @property (readwrite, weak) IBOutlet NSMenuItem *trackSynchronization;
IBOutlet id o_mi_rate_fld; @property (readwrite, weak) IBOutlet NSMenuItem *previous;
IBOutlet NSMenuItem * o_mi_trackSynchronization; @property (readwrite, weak) IBOutlet NSMenuItem *next;
IBOutlet NSMenuItem * o_mi_previous; @property (readwrite, weak) IBOutlet NSMenuItem *random;
IBOutlet NSMenuItem * o_mi_next; @property (readwrite, weak) IBOutlet NSMenuItem *repeat;
IBOutlet NSMenuItem * o_mi_random; @property (readwrite, weak) IBOutlet NSMenuItem *loop;
IBOutlet NSMenuItem * o_mi_repeat; @property (readwrite, weak) IBOutlet NSMenuItem *AtoBloop;
IBOutlet NSMenuItem * o_mi_loop; @property (readwrite, weak) IBOutlet NSMenuItem *quitAfterPB;
IBOutlet NSMenuItem * o_mi_AtoBloop; @property (readwrite, weak) IBOutlet NSMenuItem *fwd;
IBOutlet NSMenuItem * o_mi_quitAfterPB; @property (readwrite, weak) IBOutlet NSMenuItem *bwd;
IBOutlet NSMenuItem * o_mi_fwd; @property (readwrite, weak) IBOutlet NSMenuItem *jumpToTime;
IBOutlet NSMenuItem * o_mi_bwd; @property (readwrite, weak) IBOutlet NSMenuItem *program;
IBOutlet NSMenuItem * o_mi_program; @property (readwrite, weak) IBOutlet NSMenu *programMenu;
IBOutlet NSMenu * o_mu_program; @property (readwrite, weak) IBOutlet NSMenuItem *title;
IBOutlet NSMenuItem * o_mi_title; @property (readwrite, weak) IBOutlet NSMenu *titleMenu;
IBOutlet NSMenu * o_mu_title; @property (readwrite, weak) IBOutlet NSMenuItem *chapter;
IBOutlet NSMenuItem * o_mi_chapter; @property (readwrite, weak) IBOutlet NSMenu *chapterMenu;
IBOutlet NSMenu * o_mu_chapter;
@property (readwrite, weak) IBOutlet NSMenu *audioMenu;
IBOutlet NSMenu * o_mu_audio; @property (readwrite, weak) IBOutlet NSMenuItem *vol_up;
IBOutlet NSMenuItem * o_mi_vol_up; @property (readwrite, weak) IBOutlet NSMenuItem *vol_down;
IBOutlet NSMenuItem * o_mi_vol_down; @property (readwrite, weak) IBOutlet NSMenuItem *mute;
IBOutlet NSMenuItem * o_mi_mute; @property (readwrite, weak) IBOutlet NSMenuItem *audiotrack;
IBOutlet NSMenuItem * o_mi_audiotrack; @property (readwrite, weak) IBOutlet NSMenu *audiotrackMenu;
IBOutlet NSMenu * o_mu_audiotrack; @property (readwrite, weak) IBOutlet NSMenuItem *channels;
IBOutlet NSMenuItem * o_mi_channels; @property (readwrite, weak) IBOutlet NSMenu *channelsMenu;
IBOutlet NSMenu * o_mu_channels; @property (readwrite, weak) IBOutlet NSMenuItem *audioDevice;
IBOutlet NSMenuItem * o_mi_device; @property (readwrite, weak) IBOutlet NSMenu *audioDeviceMenu;
IBOutlet NSMenu * o_mu_device; @property (readwrite, weak) IBOutlet NSMenuItem *visual;
IBOutlet NSMenuItem * o_mi_visual; @property (readwrite, weak) IBOutlet NSMenu *visualMenu;
IBOutlet NSMenu * o_mu_visual;
@property (readwrite, weak) IBOutlet NSMenu *videoMenu;
IBOutlet NSMenu * o_mu_video; @property (readwrite, weak) IBOutlet NSMenuItem *half_window;
IBOutlet NSMenuItem * o_mi_half_window; @property (readwrite, weak) IBOutlet NSMenuItem *normal_window;
IBOutlet NSMenuItem * o_mi_normal_window; @property (readwrite, weak) IBOutlet NSMenuItem *double_window;
IBOutlet NSMenuItem * o_mi_double_window; @property (readwrite, weak) IBOutlet NSMenuItem *fittoscreen;
IBOutlet NSMenuItem * o_mi_fittoscreen; @property (readwrite, weak) IBOutlet NSMenuItem *fullscreenItem;
IBOutlet NSMenuItem * o_mi_fullscreen; @property (readwrite, weak) IBOutlet NSMenuItem *floatontop;
IBOutlet NSMenuItem * o_mi_floatontop; @property (readwrite, weak) IBOutlet NSMenuItem *snapshot;
IBOutlet NSMenuItem * o_mi_snapshot; @property (readwrite, weak) IBOutlet NSMenuItem *videotrack;
IBOutlet NSMenuItem * o_mi_videotrack; @property (readwrite, weak) IBOutlet NSMenu *videotrackMenu;
IBOutlet NSMenu * o_mu_videotrack; @property (readwrite, weak) IBOutlet NSMenuItem *screen;
IBOutlet NSMenuItem * o_mi_screen; @property (readwrite, weak) IBOutlet NSMenu *screenMenu;
IBOutlet NSMenu * o_mu_screen; @property (readwrite, weak) IBOutlet NSMenuItem *aspect_ratio;
IBOutlet NSMenuItem * o_mi_aspect_ratio; @property (readwrite, weak) IBOutlet NSMenu *aspect_ratioMenu;
IBOutlet NSMenu * o_mu_aspect_ratio; @property (readwrite, weak) IBOutlet NSMenuItem *crop;
IBOutlet NSMenuItem * o_mi_crop; @property (readwrite, weak) IBOutlet NSMenu *cropMenu;
IBOutlet NSMenu * o_mu_crop; @property (readwrite, weak) IBOutlet NSMenuItem *deinterlace;
IBOutlet NSMenuItem * o_mi_deinterlace; @property (readwrite, weak) IBOutlet NSMenu *deinterlaceMenu;
IBOutlet NSMenu * o_mu_deinterlace; @property (readwrite, weak) IBOutlet NSMenuItem *deinterlace_mode;
IBOutlet NSMenuItem * o_mi_deinterlace_mode; @property (readwrite, weak) IBOutlet NSMenu *deinterlace_modeMenu;
IBOutlet NSMenu * o_mu_deinterlace_mode; @property (readwrite, weak) IBOutlet NSMenuItem *postprocessing;
IBOutlet NSMenuItem * o_mi_ffmpeg_pp; @property (readwrite, weak) IBOutlet NSMenu *postprocessingMenu;
IBOutlet NSMenu * o_mu_ffmpeg_pp;
@property (readwrite, weak) IBOutlet NSMenu *subtitlesMenu;
IBOutlet NSMenu * o_mu_subtitles; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_track;
IBOutlet NSMenuItem * o_mi_subtitle_track; @property (readwrite, weak) IBOutlet NSMenu *subtitle_tracksMenu;
IBOutlet NSMenu * o_mu_subtitle_tracks; @property (readwrite, weak) IBOutlet NSMenuItem *openSubtitleFile;
IBOutlet NSMenuItem * o_mi_openSubtitleFile; @property (readwrite, weak) IBOutlet NSMenu *subtitle_sizeMenu;
IBOutlet NSMenu * o_mu_subtitle_size; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_size;
IBOutlet NSMenuItem *o_mi_subtitle_size; @property (readwrite, weak) IBOutlet NSMenu *subtitle_textcolorMenu;
IBOutlet NSMenu * o_mu_subtitle_textcolor; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_textcolor;
IBOutlet NSMenuItem *o_mi_subtitle_textcolor; @property (readwrite, weak) IBOutlet NSMenu *subtitle_bgcolorMenu;
IBOutlet NSMenu * o_mu_subtitle_bgcolor; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_bgcolor;
IBOutlet NSMenuItem * o_mi_subtitle_bgcolor; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_bgopacity;
IBOutlet NSMenuItem * o_mi_subtitle_bgopacity; @property (readwrite, weak) IBOutlet NSView *subtitle_bgopacity_view;
IBOutlet NSView * o_mi_subtitle_bgopacity_view; @property (readwrite, weak) IBOutlet NSTextField *subtitle_bgopacityLabel;
IBOutlet id o_mi_subtitle_bgopacity_lbl; @property (readwrite, weak) IBOutlet NSTextField *subtitle_bgopacityLabel_gray;
IBOutlet id o_mi_subtitle_bgopacity_lbl_gray; @property (readwrite, weak) IBOutlet NSSlider *subtitle_bgopacity_sld;
IBOutlet id o_mi_subtitle_bgopacity_sld; @property (readwrite, weak) IBOutlet NSMenu *subtitle_outlinethicknessMenu;
IBOutlet NSMenu * o_mu_subtitle_outlinethickness; @property (readwrite, weak) IBOutlet NSMenuItem *subtitle_outlinethickness;
IBOutlet NSMenuItem * o_mi_subtitle_outlinethickness; @property (readwrite, weak) IBOutlet NSMenuItem *teletext;
IBOutlet NSMenuItem * o_mi_teletext; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_transparent;
IBOutlet NSMenuItem * o_mi_teletext_transparent; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_index;
IBOutlet NSMenuItem * o_mi_teletext_index; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_red;
IBOutlet NSMenuItem * o_mi_teletext_red; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_green;
IBOutlet NSMenuItem * o_mi_teletext_green; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_yellow;
IBOutlet NSMenuItem * o_mi_teletext_yellow; @property (readwrite, weak) IBOutlet NSMenuItem *teletext_blue;
IBOutlet NSMenuItem * o_mi_teletext_blue;
@property (readwrite, weak) IBOutlet NSMenu *windowMenu;
IBOutlet NSMenu * o_mu_window; @property (readwrite, weak) IBOutlet NSMenuItem *minimize;
IBOutlet NSMenuItem * o_mi_minimize; @property (readwrite, weak) IBOutlet NSMenuItem *zoom_window;
IBOutlet NSMenuItem * o_mi_zoom_window; @property (readwrite, weak) IBOutlet NSMenuItem *player;
IBOutlet NSMenuItem * o_mi_player; @property (readwrite, weak) IBOutlet NSMenuItem *controller;
IBOutlet NSMenuItem * o_mi_controller; @property (readwrite, weak) IBOutlet NSMenuItem *audioeffects;
IBOutlet NSMenuItem * o_mi_audioeffects; @property (readwrite, weak) IBOutlet NSMenuItem *videoeffects;
IBOutlet NSMenuItem * o_mi_videoeffects; @property (readwrite, weak) IBOutlet NSMenuItem *bookmarks;
IBOutlet NSMenuItem * o_mi_bookmarks; @property (readwrite, weak) IBOutlet NSMenuItem *playlist;
IBOutlet NSMenuItem * o_mi_playlist; @property (readwrite, weak) IBOutlet NSMenuItem *info;
IBOutlet NSMenuItem * o_mi_info; @property (readwrite, weak) IBOutlet NSMenuItem *messages;
IBOutlet NSMenuItem * o_mi_messages; @property (readwrite, weak) IBOutlet NSMenuItem *bring_atf;
IBOutlet NSMenuItem * o_mi_bring_atf;
@property (readwrite, weak) IBOutlet NSMenu *helpMenu;
IBOutlet NSMenu * o_mu_help; @property (readwrite, weak) IBOutlet NSMenuItem *help;
IBOutlet NSMenuItem * o_mi_help; @property (readwrite, weak) IBOutlet NSMenuItem *readme;
IBOutlet NSMenuItem * o_mi_readme; @property (readwrite, weak) IBOutlet NSMenuItem *documentation;
IBOutlet NSMenuItem * o_mi_documentation; @property (readwrite, weak) IBOutlet NSMenuItem *license;
IBOutlet NSMenuItem * o_mi_license; @property (readwrite, weak) IBOutlet NSMenuItem *website;
IBOutlet NSMenuItem * o_mi_website; @property (readwrite, weak) IBOutlet NSMenuItem *donation;
IBOutlet NSMenuItem * o_mi_donation; @property (readwrite, weak) IBOutlet NSMenuItem *forum;
IBOutlet NSMenuItem * o_mi_forum; @property (readwrite, weak) IBOutlet NSMenuItem *errorsAndWarnings;
IBOutlet NSMenuItem * o_mi_errorsAndWarnings;
/* dock menu */
/* dock menu */ @property (readwrite, weak) IBOutlet NSMenuItem *dockMenuplay;
IBOutlet NSMenuItem * o_dmi_play; @property (readwrite, weak) IBOutlet NSMenuItem *dockMenustop;
IBOutlet NSMenuItem * o_dmi_stop; @property (readwrite, weak) IBOutlet NSMenuItem *dockMenunext;
IBOutlet NSMenuItem * o_dmi_next; @property (readwrite, weak) IBOutlet NSMenuItem *dockMenuprevious;
IBOutlet NSMenuItem * o_dmi_previous; @property (readwrite, weak) IBOutlet NSMenuItem *dockMenumute;
IBOutlet NSMenuItem * o_dmi_mute;
/* vout menu */
/* vout menu */ @property (readwrite, weak) IBOutlet NSMenu *voutMenu;
IBOutlet NSMenu * o_vout_menu; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenuplay;
IBOutlet NSMenuItem * o_vmi_play; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenustop;
IBOutlet NSMenuItem * o_vmi_stop; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenuprev;
IBOutlet NSMenuItem * o_vmi_prev; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenunext;
IBOutlet NSMenuItem * o_vmi_next; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenuvolup;
IBOutlet NSMenuItem * o_vmi_volup; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenuvoldown;
IBOutlet NSMenuItem * o_vmi_voldown; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenumute;
IBOutlet NSMenuItem * o_vmi_mute; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenufullscreen;
IBOutlet NSMenuItem * o_vmi_fullscreen; @property (readwrite, weak) IBOutlet NSMenuItem *voutMenusnapshot;
IBOutlet NSMenuItem * o_vmi_snapshot;
} @property (readwrite, weak) IBOutlet NSButton *specificTime_cancelButton;
+ (VLCMainMenu *)sharedInstance; @property (readwrite, weak) IBOutlet NSTextField *specificTime_enterTextField;
@property (readwrite, weak) IBOutlet NSTextField *specificTime_goToLabel;
- (void)initStrings; @property (readwrite, weak) IBOutlet NSButton *specificTime_okButton;
@property (readwrite, weak) IBOutlet NSWindow *specificTimeWindow;
@property (readwrite, weak) IBOutlet NSTextField *specificTime_secLabel;
@property (readwrite, weak) IBOutlet NSStepper *specificTime_stepper;
@property (nonatomic) int jumpTimeValue;
- (void)releaseRepresentedObjects:(NSMenu *)the_menu; - (void)releaseRepresentedObjects:(NSMenu *)the_menu;
- (void)setupMenus; - (void)setupMenus;
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification;
- (void)setSubmenusEnabled:(BOOL)b_enabled; - (void)setSubmenusEnabled:(BOOL)b_enabled;
- (void)setRateControlsEnabled:(BOOL)b_enabled; - (void)setRateControlsEnabled:(BOOL)b_enabled;
- (void)updateSidebarMenuItem; - (void)updateSidebarMenuItem;
...@@ -232,10 +232,27 @@ ...@@ -232,10 +232,27 @@
- (IBAction)toggleJumpButtons:(id)sender; - (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)togglePlaymodeButtons:(id)sender; - (IBAction)togglePlaymodeButtons:(id)sender;
- (IBAction)toggleSidebar:(id)sender; - (IBAction)toggleSidebar:(id)sender;
- (IBAction)togglePlaylistColumnTable:(id)sender;
- (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column; - (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column;
- (NSMenu *)setupPlaylistTableColumnsMenu; - (NSMenu *)setupPlaylistTableColumnsMenu;
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)random:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)goToSpecificTime:(id)sender;
- (IBAction)quitAfterPlayback:(id)sender; - (IBAction)quitAfterPlayback:(id)sender;
- (IBAction)toggleRecord:(id)sender; - (IBAction)toggleRecord:(id)sender;
- (void)updateRecordState:(BOOL)b_value; - (void)updateRecordState:(BOOL)b_value;
...@@ -243,20 +260,15 @@ ...@@ -243,20 +260,15 @@
- (void)updatePlaybackRate; - (void)updatePlaybackRate;
- (IBAction)toggleAtoBloop:(id)sender; - (IBAction)toggleAtoBloop:(id)sender;
- (IBAction)toggleAudioDevice:(id)sender;
- (IBAction)toggleFullscreen:(id)sender; - (IBAction)toggleFullscreen:(id)sender;
- (IBAction)resizeVideoWindow:(id)sender; - (IBAction)resizeVideoWindow:(id)sender;
- (IBAction)floatOnTop:(id)sender; - (IBAction)floatOnTop:(id)sender;
- (IBAction)createVideoSnapshot:(id)sender; - (IBAction)createVideoSnapshot:(id)sender;
- (IBAction)toggleFullscreenDevice:(id)sender;
- (IBAction)addSubtitleFile:(id)sender; - (IBAction)addSubtitleFile:(id)sender;
- (IBAction)switchSubtitleOption:(id)sender;
- (IBAction)switchSubtitleBackgroundOpacity:(id)sender; - (IBAction)switchSubtitleBackgroundOpacity:(id)sender;
- (IBAction)telxTransparent:(id)sender; - (IBAction)telxTransparent:(id)sender;
- (IBAction)telxNavLink:(id)sender; - (IBAction)telxNavLink:(id)sender;
- (IBAction)togglePostProcessing:(id)sender;
- (IBAction)showConvertAndSave:(id)sender; - (IBAction)showConvertAndSave:(id)sender;
- (IBAction)showVideoEffects:(id)sender; - (IBAction)showVideoEffects:(id)sender;
...@@ -265,16 +277,16 @@ ...@@ -265,16 +277,16 @@
- (IBAction)showBookmarks:(id)sender; - (IBAction)showBookmarks:(id)sender;
- (IBAction)showInformationPanel:(id)sender; - (IBAction)showInformationPanel:(id)sender;
- (IBAction)viewAbout:(id)sender; - (IBAction)showAbout:(id)sender;
- (IBAction)showLicense:(id)sender; - (IBAction)showLicense:(id)sender;
- (IBAction)viewPreferences:(id)sender; - (IBAction)showPreferences:(id)sender;
- (IBAction)viewHelp:(id)sender; - (IBAction)showHelp:(id)sender;
- (IBAction)openReadMe:(id)sender; - (IBAction)openReadMe:(id)sender;
- (IBAction)openDocumentation:(id)sender; - (IBAction)openDocumentation:(id)sender;
- (IBAction)openWebsite:(id)sender; - (IBAction)openWebsite:(id)sender;
- (IBAction)openForum:(id)sender; - (IBAction)openForum:(id)sender;
- (IBAction)openDonate:(id)sender; - (IBAction)openDonate:(id)sender;
- (IBAction)viewErrorsAndWarnings:(id)sender; - (IBAction)showErrorsAndWarnings:(id)sender;
- (IBAction)showMessagesPanel:(id)showMessagesPanel; - (IBAction)showMessagesPanel:(id)showMessagesPanel;
- (IBAction)showMainWindow:(id)sender; - (IBAction)showMainWindow:(id)sender;
- (IBAction)showPlaylist:(id)sender; - (IBAction)showPlaylist:(id)sender;
...@@ -285,34 +297,14 @@ ...@@ -285,34 +297,14 @@
- (void)setRepeatAll; - (void)setRepeatAll;
- (void)setRepeatOff; - (void)setRepeatOff;
- (void)setShuffle; - (void)setShuffle;
- (IBAction)toggleVar:(id)sender;
- (int)toggleVarThread:(id)_o_data;
- (void)setupVarMenuItem:(NSMenuItem *)o_mi
target:(vlc_object_t *)p_object
var:(const char *)psz_variable
selector:(SEL)pf_callback;
- (void)setupVarMenu:(NSMenu *)o_menu
forMenuItem: (NSMenuItem *)o_parent
target:(vlc_object_t *)p_object
var:(const char *)psz_variable
selector:(SEL)pf_callback;
- (id)voutMenu;
@end @end
/***************************************************************************** /*****************************************************************************
* VLCAutoGeneratedMenuContent interface *VLCAutoGeneratedMenuContent interface
***************************************************************************** *****************************************************************************
* This holds our data for autogenerated menus *This holds our data for autogenerated menus
*****************************************************************************/ *****************************************************************************/
@interface VLCAutoGeneratedMenuContent : NSObject @interface VLCAutoGeneratedMenuContent : NSObject
{
char *psz_name;
vlc_object_t * _vlc_object;
vlc_value_t value;
int i_type;
}
- (id)initWithVariableName: (const char *)name - (id)initWithVariableName: (const char *)name
ofObject: (vlc_object_t *)object ofObject: (vlc_object_t *)object
......
/***************************************************************************** /*****************************************************************************
* MainMenu.m: MacOS X interface module *MainMenu.m: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2011-2014 Felix Paul Kühne *Copyright (C) 2011-2015 Felix Paul Kühne
* $Id$ *$Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> *Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* *
* This program is free software; you can redistribute it and/or modify *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 *it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or *the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. *(at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, *This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of *but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. *GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License *You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software *along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#import "MainMenu.h" #import "MainMenu.h"
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#import "bookmarks.h" #import "bookmarks.h"
#import "simple_prefs.h" #import "simple_prefs.h"
#import "coredialogs.h" #import "coredialogs.h"
#import "controls.h"
#import "playlist.h" #import "playlist.h"
#import "playlistinfo.h" #import "playlistinfo.h"
#import "VideoView.h" #import "VideoView.h"
...@@ -57,48 +56,38 @@ ...@@ -57,48 +56,38 @@
BOOL b_mainMenu_setup; BOOL b_mainMenu_setup;
BOOL b_nib_videoeffects_loaded; BOOL b_nib_videoeffects_loaded;
BOOL b_nib_audioeffects_loaded; BOOL b_nib_audioeffects_loaded;
BOOL b_nib_tracksynchro_loaded; BOOL b_nib_tracksynchrloaded;
BOOL b_nib_bookmarks_loaded; BOOL b_nib_bookmarks_loaded;
BOOL b_nib_convertandsave_loaded; BOOL b_nib_convertandsave_loaded;
AboutWindowController *o_about; AboutWindowController *_aboutWindowController;
HelpWindowController *o_helpWin; HelpWindowController *_helpWindowController;
id o_videoeffects; /* VLCVideoEffects */ VLCVideoEffects *_videoEffectsWindowController;
id o_audioeffects; /* VLCAudioEffects */ VLCAudioEffects *_audioEffectsWindowController;
id o_trackSynchronization; /* VLCTrackSynchronization */ VLCTrackSynchronization *_trackSynchronizationWindowController;
id o_bookmarks; /* VLCBookmarks */ VLCBookmarks *_bookmarksWindowController;
id o_convertandsave; /* VLCConvertAndSave */ VLCConvertAndSave *_convertAndSaveWindowController;
AddonsWindowController *o_addonsController; AddonsWindowController *_addonsController;
id o_extMgr; /* Extensions Manager */ ExtensionsManager *_extensionManager;
// information for playlist table columns menu // information for playlist table columns menu
NSDictionary * o_ptc_translation_dict; NSDictionary *_translationsForPlaylistTableColumns;
NSArray * o_ptc_menuorder; NSArray *_menuOrderOfPlaylistTableColumns;
NSMenu *_playlistTableColumnsContextMenu;
} }
@end @end
@implementation VLCMainMenu @implementation VLCMainMenu
+ (VLCMainMenu *)sharedInstance
{
static VLCMainMenu *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCMainMenu new];
});
return sharedInstance;
}
#pragma mark - Initialization #pragma mark - Initialization
- (id)init - (id)init
{ {
self = [super init]; self = [super init];
if (self) { if (self) {
o_ptc_translation_dict = [[NSDictionary alloc] initWithObjectsAndKeys: _translationsForPlaylistTableColumns = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN, _NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN, _NS("Title"), TITLE_COLUMN,
_NS("Author"), ARTIST_COLUMN, _NS("Author"), ARTIST_COLUMN,
...@@ -112,7 +101,7 @@ ...@@ -112,7 +101,7 @@
_NS("File Size"), FILESIZE_COLUMN, _NS("File Size"), FILESIZE_COLUMN,
nil]; nil];
// this array also assigns tags (index) to type of menu item // this array also assigns tags (index) to type of menu item
o_ptc_menuorder = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN, _menuOrderOfPlaylistTableColumns = [[NSArray alloc] initWithObjects: TRACKNUM_COLUMN, TITLE_COLUMN,
ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN, ARTIST_COLUMN, DURATION_COLUMN, GENRE_COLUMN, ALBUM_COLUMN,
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN, DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil]; FILESIZE_COLUMN,nil];
...@@ -140,26 +129,26 @@ ...@@ -140,26 +129,26 @@
if ([NSLocale characterDirectionForLanguage:preferredLanguage] == NSLocaleLanguageDirectionRightToLeft) { if ([NSLocale characterDirectionForLanguage:preferredLanguage] == NSLocaleLanguageDirectionRightToLeft) {
msg_Dbg(VLCIntf, "adapting interface since '%s' is a RTL language", [preferredLanguage UTF8String]); msg_Dbg(VLCIntf, "adapting interface since '%s' is a RTL language", [preferredLanguage UTF8String]);
[o_mi_rate_fld setAlignment: NSLeftTextAlignment]; [_rateTextField setAlignment: NSLeftTextAlignment];
} }
}
- (void)applicationWillFinishLaunching:(NSNotification *)notification
{
[self setRateControlsEnabled:NO]; [self setRateControlsEnabled:NO];
#ifdef HAVE_SPARKLE #ifdef HAVE_SPARKLE
[o_mi_checkForUpdate setAction:@selector(checkForUpdates:)]; [_checkForUpdate setAction:@selector(checkForUpdates:)];
[o_mi_checkForUpdate setTarget:[SUUpdater sharedUpdater]]; [_checkForUpdate setTarget:[SUUpdater sharedUpdater]];
#else #else
[o_mi_checkForUpdate setEnabled:NO]; [_checkForUpdate setEnabled:NO];
#endif #endif
}
- (void)applicationWillFinishLaunching:(NSNotification *)o_notification NSString* keyString;
{
NSString* o_key;
playlist_t *p_playlist; playlist_t *p_playlist;
vlc_value_t val; vlc_value_t val;
id o_vlcstringutility = [VLCStringUtility sharedInstance]; VLCStringUtility *stringUtility = [VLCStringUtility sharedInstance];
char * key; char *key;
/* Check if we already did this once. Opening the other nibs calls it too, /* Check if we already did this once. Opening the other nibs calls it too,
because VLCMain is the owner */ because VLCMain is the owner */
...@@ -168,100 +157,100 @@ ...@@ -168,100 +157,100 @@
/* Get ExtensionsManager */ /* Get ExtensionsManager */
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
o_extMgr = [ExtensionsManager getInstance:p_intf]; _extensionManager = [ExtensionsManager getInstance:p_intf];
[self initStrings]; [self initStrings];
key = config_GetPsz(p_intf, "key-quit"); key = config_GetPsz(p_intf, "key-quit");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_quit setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_quit setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_quit setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_quit setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
// do not assign play/pause key // do not assign play/pause key
key = config_GetPsz(p_intf, "key-stop"); key = config_GetPsz(p_intf, "key-stop");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_stop setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_stop setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_stop setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_stop setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-prev"); key = config_GetPsz(p_intf, "key-prev");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_previous setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_previous setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_previous setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_previous setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-next"); key = config_GetPsz(p_intf, "key-next");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_next setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_next setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_next setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_next setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-jump+short"); key = config_GetPsz(p_intf, "key-jump+short");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_fwd setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_fwd setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_fwd setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_fwd setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-jump-short"); key = config_GetPsz(p_intf, "key-jump-short");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_bwd setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_bwd setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_bwd setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_bwd setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-vol-up"); key = config_GetPsz(p_intf, "key-vol-up");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_vol_up setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_vol_up setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_vol_up setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_vol_up setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-vol-down"); key = config_GetPsz(p_intf, "key-vol-down");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_vol_down setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_vol_down setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_vol_down setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_vol_down setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-vol-mute"); key = config_GetPsz(p_intf, "key-vol-mute");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_mute setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_mute setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_mute setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_mute setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-toggle-fullscreen"); key = config_GetPsz(p_intf, "key-toggle-fullscreen");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_fullscreen setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_fullscreenItem setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_fullscreen setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_fullscreenItem setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-snapshot"); key = config_GetPsz(p_intf, "key-snapshot");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_snapshot setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_snapshot setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_snapshot setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_snapshot setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-random"); key = config_GetPsz(p_intf, "key-random");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_random setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_random setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_random setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_random setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-zoom-half"); key = config_GetPsz(p_intf, "key-zoom-half");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_half_window setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_half_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_half_window setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_half_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-zoom-original"); key = config_GetPsz(p_intf, "key-zoom-original");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_normal_window setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_normal_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_normal_window setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_normal_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
key = config_GetPsz(p_intf, "key-zoom-double"); key = config_GetPsz(p_intf, "key-zoom-double");
o_key = [NSString stringWithFormat:@"%s", key]; keyString = [NSString stringWithFormat:@"%s", key];
[o_mi_double_window setKeyEquivalent: [o_vlcstringutility VLCKeyToString: o_key]]; [_double_window setKeyEquivalent: [stringUtility VLCKeyToString: keyString]];
[o_mi_double_window setKeyEquivalentModifierMask: [o_vlcstringutility VLCModifiersToCocoa:o_key]]; [_double_window setKeyEquivalentModifierMask: [stringUtility VLCModifiersToCocoa:keyString]];
FREENULL(key); FREENULL(key);
[self setSubmenusEnabled: FALSE]; [self setSubmenusEnabled: FALSE];
...@@ -274,58 +263,58 @@ ...@@ -274,58 +263,58 @@
/* we're done */ /* we're done */
b_mainMenu_setup = YES; b_mainMenu_setup = YES;
[self setupVarMenuItem: o_mi_add_intf target: (vlc_object_t *)p_intf [self setupVarMenuItem:_add_intf target: (vlc_object_t *)p_intf
var: "intf-add" selector: @selector(toggleVar:)]; var:"intf-add" selector: @selector(toggleVar:)];
/* setup extensions menu */ /* setup extensions menu */
// FIXME: Implement preference for autoloading extensions on mac // FIXME: Implement preference for autoloading extensions on mac
if (![o_extMgr isLoaded] && ![o_extMgr cannotLoad]) if (![_extensionManager isLoaded] && ![_extensionManager cannotLoad])
[o_extMgr loadExtensions]; [_extensionManager loadExtensions];
/* Let the ExtensionsManager itself build the menu */ /* Let the ExtensionsManager itself build the menu */
[o_extMgr buildMenu:o_mu_extensions]; [_extensionManager buildMenu:_extensionsMenu];
[o_mi_extensions setEnabled: ([o_mu_extensions numberOfItems] > 0)]; [_extensions setEnabled: ([_extensionsMenu numberOfItems] > 0)];
/* setup post-proc menu */ /* setup post-proc menu */
NSUInteger count = (NSUInteger) [o_mu_ffmpeg_pp numberOfItems]; NSUInteger count = (NSUInteger) [_postprocessingMenu numberOfItems];
if (count > 0) if (count > 0)
[o_mu_ffmpeg_pp removeAllItems]; [_postprocessingMenu removeAllItems];
NSMenuItem * o_mitem; NSMenuItem *mitem;
[o_mu_ffmpeg_pp setAutoenablesItems: YES]; [_postprocessingMenu setAutoenablesItems: YES];
[o_mu_ffmpeg_pp addItemWithTitle: _NS("Disable") action:@selector(togglePostProcessing:) keyEquivalent:@""]; [_postprocessingMenu addItemWithTitle: _NS("Disable") action:@selector(togglePostProcessing:) keyEquivalent:@""];
o_mitem = [o_mu_ffmpeg_pp itemAtIndex: 0]; mitem = [_postprocessingMenu itemAtIndex: 0];
[o_mitem setTag: -1]; [mitem setTag: -1];
[o_mitem setEnabled: YES]; [mitem setEnabled: YES];
[o_mitem setTarget: self]; [mitem setTarget: self];
for (NSUInteger x = 1; x < 7; x++) { for (NSUInteger x = 1; x < 7; x++) {
[o_mu_ffmpeg_pp addItemWithTitle:[NSString stringWithFormat:_NS("Level %i"), x] [_postprocessingMenu addItemWithTitle:[NSString stringWithFormat:_NS("Level %i"), x]
action:@selector(togglePostProcessing:) action:@selector(togglePostProcessing:)
keyEquivalent:@""]; keyEquivalent:@""];
o_mitem = [o_mu_ffmpeg_pp itemAtIndex:x]; mitem = [_postprocessingMenu itemAtIndex:x];
[o_mitem setEnabled:YES]; [mitem setEnabled:YES];
[o_mitem setTag:x]; [mitem setTag:x];
[o_mitem setTarget:self]; [mitem setTarget:self];
} }
char *psz_config = config_GetPsz(p_intf, "video-filter"); char *psz_config = config_GetPsz(p_intf, "video-filter");
if (psz_config) { if (psz_config) {
if (!strstr(psz_config, "postproc")) if (!strstr(psz_config, "postproc"))
[[o_mu_ffmpeg_pp itemAtIndex:0] setState:NSOnState]; [[_postprocessingMenu itemAtIndex:0] setState:NSOnState];
else else
[[o_mu_ffmpeg_pp itemWithTag:config_GetInt(p_intf, "postproc-q")] setState:NSOnState]; [[_postprocessingMenu itemWithTag:config_GetInt(p_intf, "postproc-q")] setState:NSOnState];
free(psz_config); free(psz_config);
} else } else
[[o_mu_ffmpeg_pp itemAtIndex:0] setState:NSOnState]; [[_postprocessingMenu itemAtIndex:0] setState:NSOnState];
[o_mi_ffmpeg_pp setEnabled: NO]; [_postprocessing setEnabled: NO];
[self refreshAudioDeviceList]; [self refreshAudioDeviceList];
/* setup subtitles menu */ /* setup subtitles menu */
[self setupMenu: o_mu_subtitle_size withIntList:"freetype-rel-fontsize" andSelector:@selector(switchSubtitleOption:)]; [self setupMenu: _subtitle_sizeMenu withIntList:"freetype-rel-fontsize" andSelector:@selector(switchSubtitleOption:)];
[self setupMenu: o_mu_subtitle_textcolor withIntList:"freetype-color" andSelector:@selector(switchSubtitleOption:)]; [self setupMenu: _subtitle_textcolorMenu withIntList:"freetype-color" andSelector:@selector(switchSubtitleOption:)];
[o_mi_subtitle_bgopacity_sld setIntValue: config_GetInt(VLC_OBJECT(p_intf), "freetype-background-opacity")]; [_subtitle_bgopacity_sld setIntValue: config_GetInt(VLC_OBJECT(p_intf), "freetype-background-opacity")];
[self setupMenu: o_mu_subtitle_bgcolor withIntList:"freetype-background-color" andSelector:@selector(switchSubtitleOption:)]; [self setupMenu: _subtitle_bgcolorMenu withIntList:"freetype-background-color" andSelector:@selector(switchSubtitleOption:)];
[self setupMenu: o_mu_subtitle_outlinethickness withIntList:"freetype-outline-thickness" andSelector:@selector(switchSubtitleOption:)]; [self setupMenu: _subtitle_outlinethicknessMenu withIntList:"freetype-outline-thickness" andSelector:@selector(switchSubtitleOption:)];
} }
- (void)setupMenu: (NSMenu*)menu withIntList: (char *)psz_name andSelector:(SEL)selector - (void)setupMenu: (NSMenu*)menu withIntList: (char *)psz_name andSelector:(SEL)selector
...@@ -362,204 +351,210 @@ ...@@ -362,204 +351,210 @@
- (void)initStrings - (void)initStrings
{ {
/* main menu */ /* main menu */
[o_mi_about setTitle: [_NS("About VLC media player") \ [_about setTitle: [_NS("About VLC media player") \
stringByAppendingString: @"..."]]; stringByAppendingString: @"..."]];
[o_mi_checkForUpdate setTitle: _NS("Check for Update...")]; [_checkForUpdate setTitle: _NS("Check for Update...")];
[o_mi_prefs setTitle: _NS("Preferences...")]; [_prefs setTitle: _NS("Preferences...")];
[o_mi_extensions setTitle: _NS("Extensions")]; [_extensions setTitle: _NS("Extensions")];
[o_mu_extensions setTitle: _NS("Extensions")]; [_extensionsMenu setTitle: _NS("Extensions")];
[o_mi_addonManager setTitle: _NS("Addons Manager")]; [_addonManager setTitle: _NS("Addons Manager")];
[o_mi_add_intf setTitle: _NS("Add Interface")]; [_add_intf setTitle: _NS("Add Interface")];
[o_mu_add_intf setTitle: _NS("Add Interface")]; [_add_intfMenu setTitle: _NS("Add Interface")];
[o_mi_services setTitle: _NS("Services")]; [_services setTitle: _NS("Services")];
[o_mi_hide setTitle: _NS("Hide VLC")]; [_hide setTitle: _NS("Hide VLC")];
[o_mi_hide_others setTitle: _NS("Hide Others")]; [_hide_others setTitle: _NS("Hide Others")];
[o_mi_show_all setTitle: _NS("Show All")]; [_show_all setTitle: _NS("Show All")];
[o_mi_quit setTitle: _NS("Quit VLC")]; [_quit setTitle: _NS("Quit VLC")];
[o_mu_file setTitle: _ANS("1:File")]; [_fileMenu setTitle: _ANS("1:File")];
[o_mi_open_generic setTitle: _NS("Advanced Open File...")]; [_open_generic setTitle: _NS("Advanced Open File...")];
[o_mi_open_file setTitle: _NS("Open File...")]; [_open_file setTitle: _NS("Open File...")];
[o_mi_open_disc setTitle: _NS("Open Disc...")]; [_open_disc setTitle: _NS("Open Disc...")];
[o_mi_open_net setTitle: _NS("Open Network...")]; [_open_net setTitle: _NS("Open Network...")];
[o_mi_open_capture setTitle: _NS("Open Capture Device...")]; [_open_capture setTitle: _NS("Open Capture Device...")];
[o_mi_open_recent setTitle: _NS("Open Recent")]; [_open_recent setTitle: _NS("Open Recent")];
[o_mi_close_window setTitle: _NS("Close Window")]; [_close_window setTitle: _NS("Close Window")];
[o_mi_convertandsave setTitle: _NS("Convert / Stream...")]; [_convertandsave setTitle: _NS("Convert / Stream...")];
[o_mi_save_playlist setTitle: _NS("Save Playlist...")]; [_save_playlist setTitle: _NS("Save Playlist...")];
[o_mi_revealInFinder setTitle: _NS("Reveal in Finder")]; [_revealInFinder setTitle: _NS("Reveal in Finder")];
[o_mu_edit setTitle: _NS("Edit")]; [_editMenu setTitle: _NS("Edit")];
[o_mi_cut setTitle: _NS("Cut")]; [_cutItem setTitle: _NS("Cut")];
[o_mi_copy setTitle: _NS("Copy")]; [_mcopyItem setTitle: _NS("Copy")];
[o_mi_paste setTitle: _NS("Paste")]; [_pasteItem setTitle: _NS("Paste")];
[o_mi_clear setTitle: _NS("Clear")]; [_clearItem setTitle: _NS("Clear")];
[o_mi_select_all setTitle: _NS("Select All")]; [_select_all setTitle: _NS("Select All")];
[o_mu_view setTitle: _NS("View")]; [_viewMenu setTitle: _NS("View")];
[o_mi_toggleJumpButtons setTitle: _NS("Show Previous & Next Buttons")]; [_toggleJumpButtons setTitle: _NS("Show Previous & Next Buttons")];
[o_mi_toggleJumpButtons setState: config_GetInt(VLCIntf, "macosx-show-playback-buttons")]; [_toggleJumpButtons setState: config_GetInt(VLCIntf, "macosx-show-playback-buttons")];
[o_mi_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")]; [_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")];
[o_mi_togglePlaymodeButtons setState: config_GetInt(VLCIntf, "macosx-show-playmode-buttons")]; [_togglePlaymodeButtons setState: config_GetInt(VLCIntf, "macosx-show-playmode-buttons")];
[o_mi_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")]; [_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
[o_mi_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")]; [_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")];
[o_mi_toggleSidebar setTitle: _NS("Show Sidebar")]; [_toggleSidebar setTitle: _NS("Show Sidebar")];
[o_mi_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")]; [_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
[o_mu_playlistTableColumns setTitle: _NS("Playlist Table Columns")]; [_playlistTableColumnsMenu setTitle: _NS("Playlist Table Columns")];
[o_mi_playlistTableColumns setTitle: _NS("Playlist Table Columns")]; [_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
[o_mu_controls setTitle: _NS("Playback")]; [_controlsMenu setTitle: _NS("Playback")];
[o_mi_play setTitle: _NS("Play")]; [_play setTitle: _NS("Play")];
[o_mi_stop setTitle: _NS("Stop")]; [_stop setTitle: _NS("Stop")];
[o_mi_record setTitle: _NS("Record")]; [_record setTitle: _NS("Record")];
[o_mi_rate setView: o_mi_rate_view]; [_rate setView: _rate_view];
[o_mi_rate_lbl setStringValue: _NS("Playback Speed")]; [_rateLabel setStringValue: _NS("Playback Speed")];
[o_mi_rate_slower_lbl setStringValue: _NS("Slower")]; [_rate_slowerLabel setStringValue: _NS("Slower")];
[o_mi_rate_normal_lbl setStringValue: _NS("Normal")]; [_rate_normalLabel setStringValue: _NS("Normal")];
[o_mi_rate_faster_lbl setStringValue: _NS("Faster")]; [_rate_fasterLabel setStringValue: _NS("Faster")];
[o_mi_trackSynchronization setTitle: _NS("Track Synchronization")]; [_trackSynchronization setTitle: _NS("Track Synchronization")];
[o_mi_previous setTitle: _NS("Previous")]; [_previous setTitle: _NS("Previous")];
[o_mi_next setTitle: _NS("Next")]; [_next setTitle: _NS("Next")];
[o_mi_random setTitle: _NS("Random")]; [_random setTitle: _NS("Random")];
[o_mi_repeat setTitle: _NS("Repeat One")]; [_repeat setTitle: _NS("Repeat One")];
[o_mi_loop setTitle: _NS("Repeat All")]; [_loop setTitle: _NS("Repeat All")];
[o_mi_AtoBloop setTitle: _NS("A→B Loop")]; [_AtoBloop setTitle: _NS("A→B Loop")];
[o_mi_quitAfterPB setTitle: _NS("Quit after Playback")]; [_quitAfterPB setTitle: _NS("Quit after Playback")];
[o_mi_fwd setTitle: _NS("Step Forward")]; [_fwd setTitle: _NS("Step Forward")];
[o_mi_bwd setTitle: _NS("Step Backward")]; [_bwd setTitle: _NS("Step Backward")];
[_jumpToTime setTitle: _NS("Jump to Time")];
[o_mi_program setTitle: _NS("Program")]; [_program setTitle: _NS("Program")];
[o_mu_program setTitle: _NS("Program")]; [_programMenu setTitle: _NS("Program")];
[o_mi_title setTitle: _NS("Title")]; [_title setTitle: _NS("Title")];
[o_mu_title setTitle: _NS("Title")]; [_titleMenu setTitle: _NS("Title")];
[o_mi_chapter setTitle: _NS("Chapter")]; [_chapter setTitle: _NS("Chapter")];
[o_mu_chapter setTitle: _NS("Chapter")]; [_chapterMenu setTitle: _NS("Chapter")];
[o_mu_audio setTitle: _NS("Audio")]; [_audioMenu setTitle: _NS("Audio")];
[o_mi_vol_up setTitle: _NS("Increase Volume")]; [_vol_up setTitle: _NS("Increase Volume")];
[o_mi_vol_down setTitle: _NS("Decrease Volume")]; [_vol_down setTitle: _NS("Decrease Volume")];
[o_mi_mute setTitle: _NS("Mute")]; [_mute setTitle: _NS("Mute")];
[o_mi_audiotrack setTitle: _NS("Audio Track")]; [_audiotrack setTitle: _NS("Audio Track")];
[o_mu_audiotrack setTitle: _NS("Audio Track")]; [_audiotrackMenu setTitle: _NS("Audio Track")];
[o_mi_channels setTitle: _NS("Stereo audio mode")]; [_channels setTitle: _NS("Stereo audio mode")];
[o_mu_channels setTitle: _NS("Stereo audio mode")]; [_channelsMenu setTitle: _NS("Stereo audio mode")];
[o_mi_device setTitle: _NS("Audio Device")]; [_audioDevice setTitle: _NS("Audio Device")];
[o_mu_device setTitle: _NS("Audio Device")]; [_audioDeviceMenu setTitle: _NS("Audio Device")];
[o_mi_visual setTitle: _NS("Visualizations")]; [_visual setTitle: _NS("Visualizations")];
[o_mu_visual setTitle: _NS("Visualizations")]; [_visualMenu setTitle: _NS("Visualizations")];
[o_mu_video setTitle: _NS("Video")]; [_videoMenu setTitle: _NS("Video")];
[o_mi_half_window setTitle: _NS("Half Size")]; [_half_window setTitle: _NS("Half Size")];
[o_mi_normal_window setTitle: _NS("Normal Size")]; [_normal_window setTitle: _NS("Normal Size")];
[o_mi_double_window setTitle: _NS("Double Size")]; [_double_window setTitle: _NS("Double Size")];
[o_mi_fittoscreen setTitle: _NS("Fit to Screen")]; [_fittoscreen setTitle: _NS("Fit to Screen")];
[o_mi_fullscreen setTitle: _NS("Fullscreen")]; [_fullscreenItem setTitle: _NS("Fullscreen")];
[o_mi_floatontop setTitle: _NS("Float on Top")]; [_floatontop setTitle: _NS("Float on Top")];
[o_mi_snapshot setTitle: _NS("Snapshot")]; [_snapshot setTitle: _NS("Snapshot")];
[o_mi_videotrack setTitle: _NS("Video Track")]; [_videotrack setTitle: _NS("Video Track")];
[o_mu_videotrack setTitle: _NS("Video Track")]; [_videotrackMenu setTitle: _NS("Video Track")];
[o_mi_aspect_ratio setTitle: _NS("Aspect ratio")]; [_aspect_ratio setTitle: _NS("Aspect ratio")];
[o_mu_aspect_ratio setTitle: _NS("Aspect ratio")]; [_aspect_ratioMenu setTitle: _NS("Aspect ratio")];
[o_mi_crop setTitle: _NS("Crop")]; [_crop setTitle: _NS("Crop")];
[o_mu_crop setTitle: _NS("Crop")]; [_cropMenu setTitle: _NS("Crop")];
[o_mi_screen setTitle: _NS("Fullscreen Video Device")]; [_screen setTitle: _NS("Fullscreen Video Device")];
[o_mu_screen setTitle: _NS("Fullscreen Video Device")]; [_screenMenu setTitle: _NS("Fullscreen Video Device")];
[o_mi_deinterlace setTitle: _NS("Deinterlace")]; [_deinterlace setTitle: _NS("Deinterlace")];
[o_mu_deinterlace setTitle: _NS("Deinterlace")]; [_deinterlaceMenu setTitle: _NS("Deinterlace")];
[o_mi_deinterlace_mode setTitle: _NS("Deinterlace mode")]; [_deinterlace_mode setTitle: _NS("Deinterlace mode")];
[o_mu_deinterlace_mode setTitle: _NS("Deinterlace mode")]; [_deinterlace_modeMenu setTitle: _NS("Deinterlace mode")];
[o_mi_ffmpeg_pp setTitle: _NS("Post processing")]; [_postprocessing setTitle: _NS("Post processing")];
[o_mu_ffmpeg_pp setTitle: _NS("Post processing")]; [_postprocessingMenu setTitle: _NS("Post processing")];
[o_mu_subtitles setTitle:_NS("Subtitles")]; [_subtitlesMenu setTitle:_NS("Subtitles")];
[o_mi_openSubtitleFile setTitle: _NS("Add Subtitle File...")]; [_openSubtitleFile setTitle: _NS("Add Subtitle File...")];
[o_mi_subtitle_track setTitle: _NS("Subtitles Track")]; [_subtitle_track setTitle: _NS("Subtitles Track")];
[o_mu_subtitle_tracks setTitle: _NS("Subtitles Track")]; [_subtitle_tracksMenu setTitle: _NS("Subtitles Track")];
[o_mi_subtitle_size setTitle: _NS("Text Size")]; [_subtitle_size setTitle: _NS("Text Size")];
[o_mi_subtitle_textcolor setTitle: _NS("Text Color")]; [_subtitle_textcolor setTitle: _NS("Text Color")];
[o_mi_subtitle_outlinethickness setTitle: _NS("Outline Thickness")]; [_subtitle_outlinethickness setTitle: _NS("Outline Thickness")];
[o_mi_subtitle_bgopacity setView: o_mi_subtitle_bgopacity_view]; [_subtitle_bgopacity setView: _subtitle_bgopacity_view];
[o_mi_subtitle_bgopacity_lbl setStringValue: _NS("Background Opacity")]; [_subtitle_bgopacityLabel setStringValue: _NS("Background Opacity")];
[o_mi_subtitle_bgopacity_lbl_gray setStringValue: _NS("Background Opacity")]; [_subtitle_bgopacityLabel_gray setStringValue: _NS("Background Opacity")];
[o_mi_subtitle_bgcolor setTitle: _NS("Background Color")]; [_subtitle_bgcolor setTitle: _NS("Background Color")];
[o_mi_teletext setTitle: _NS("Teletext")]; [_teletext setTitle: _NS("Teletext")];
[o_mi_teletext_transparent setTitle: _NS("Transparent")]; [_teletext_transparent setTitle: _NS("Transparent")];
[o_mi_teletext_index setTitle: _NS("Index")]; [_teletext_index setTitle: _NS("Index")];
[o_mi_teletext_red setTitle: _NS("Red")]; [_teletext_red setTitle: _NS("Red")];
[o_mi_teletext_green setTitle: _NS("Green")]; [_teletext_green setTitle: _NS("Green")];
[o_mi_teletext_yellow setTitle: _NS("Yellow")]; [_teletext_yellow setTitle: _NS("Yellow")];
[o_mi_teletext_blue setTitle: _NS("Blue")]; [_teletext_blue setTitle: _NS("Blue")];
[o_mu_window setTitle: _NS("Window")]; [_windowMenu setTitle: _NS("Window")];
[o_mi_minimize setTitle: _NS("Minimize")]; [_minimize setTitle: _NS("Minimize")];
[o_mi_zoom_window setTitle: _NS("Zoom")]; [_zoom_window setTitle: _NS("Zoom")];
[o_mi_player setTitle: _NS("Player...")]; [_player setTitle: _NS("Player...")];
[o_mi_controller setTitle: _NS("Main Window...")]; [_controller setTitle: _NS("Main Window...")];
[o_mi_audioeffects setTitle: _NS("Audio Effects...")]; [_audioeffects setTitle: _NS("Audio Effects...")];
[o_mi_videoeffects setTitle: _NS("Video Effects...")]; [_videoeffects setTitle: _NS("Video Effects...")];
[o_mi_bookmarks setTitle: _NS("Bookmarks...")]; [_bookmarks setTitle: _NS("Bookmarks...")];
[o_mi_playlist setTitle: _NS("Playlist...")]; [_playlist setTitle: _NS("Playlist...")];
[o_mi_info setTitle: _NS("Media Information...")]; [_info setTitle: _NS("Media Information...")];
[o_mi_messages setTitle: _NS("Messages...")]; [_messages setTitle: _NS("Messages...")];
[o_mi_errorsAndWarnings setTitle: _NS("Errors and Warnings...")]; [_errorsAndWarnings setTitle: _NS("Errors and Warnings...")];
[o_mi_bring_atf setTitle: _NS("Bring All to Front")]; [_bring_atf setTitle: _NS("Bring All to Front")];
[o_mu_help setTitle: _NS("Help")]; [_helpMenu setTitle: _NS("Help")];
[o_mi_help setTitle: _NS("VLC media player Help...")]; [_help setTitle: _NS("VLC media player Help...")];
[o_mi_readme setTitle: _NS("ReadMe / FAQ...")]; [_readme setTitle: _NS("ReadMe / FAQ...")];
[o_mi_license setTitle: _NS("License")]; [_license setTitle: _NS("License")];
[o_mi_documentation setTitle: _NS("Online Documentation...")]; [_documentation setTitle: _NS("Online Documentation...")];
[o_mi_website setTitle: _NS("VideoLAN Website...")]; [_website setTitle: _NS("VideoLAN Website...")];
[o_mi_donation setTitle: _NS("Make a donation...")]; [_donation setTitle: _NS("Make a donation...")];
[o_mi_forum setTitle: _NS("Online Forum...")]; [_forum setTitle: _NS("Online Forum...")];
/* dock menu */ /* dock menu */
[o_dmi_play setTitle: _NS("Play")]; [_dockMenuplay setTitle: _NS("Play")];
[o_dmi_stop setTitle: _NS("Stop")]; [_dockMenustop setTitle: _NS("Stop")];
[o_dmi_next setTitle: _NS("Next")]; [_dockMenunext setTitle: _NS("Next")];
[o_dmi_previous setTitle: _NS("Previous")]; [_dockMenuprevious setTitle: _NS("Previous")];
[o_dmi_mute setTitle: _NS("Mute")]; [_dockMenumute setTitle: _NS("Mute")];
/* vout menu */ /* vout menu */
[o_vmi_play setTitle: _NS("Play")]; [_voutMenuplay setTitle: _NS("Play")];
[o_vmi_stop setTitle: _NS("Stop")]; [_voutMenustop setTitle: _NS("Stop")];
[o_vmi_prev setTitle: _NS("Previous")]; [_voutMenuprev setTitle: _NS("Previous")];
[o_vmi_next setTitle: _NS("Next")]; [_voutMenunext setTitle: _NS("Next")];
[o_vmi_volup setTitle: _NS("Volume Up")]; [_voutMenuvolup setTitle: _NS("Volume Up")];
[o_vmi_voldown setTitle: _NS("Volume Down")]; [_voutMenuvoldown setTitle: _NS("Volume Down")];
[o_vmi_mute setTitle: _NS("Mute")]; [_voutMenumute setTitle: _NS("Mute")];
[o_vmi_fullscreen setTitle: _NS("Fullscreen")]; [_voutMenufullscreen setTitle: _NS("Fullscreen")];
[o_vmi_snapshot setTitle: _NS("Snapshot")]; [_voutMenusnapshot setTitle: _NS("Snapshot")];
[_specificTime_cancelButton setTitle: _NS("Cancel")];
[_specificTime_okButton setTitle: _NS("OK")];
[_specificTime_secLabel setStringValue: _NS("sec.")];
[_specificTime_goToLabel setStringValue: _NS("Jump to Time")];
[_specificTime_enterTextField setFormatter:[[PositionFormatter alloc] init]];
} }
- (NSMenu *)setupPlaylistTableColumnsMenu - (NSMenu *)setupPlaylistTableColumnsMenu
{ {
NSMenu *o_context_menu = [[NSMenu alloc] init]; NSMenu *contextMenu = [[NSMenu alloc] init];
NSMenuItem *o_mi_tmp; NSMenuItem *menuItem;
NSUInteger count = [o_ptc_menuorder count]; NSUInteger count = [_menuOrderOfPlaylistTableColumns count];
for (NSUInteger i = 0; i < count; i++) { for (NSUInteger i = 0; i < count; i++) {
NSString *o_title = [o_ptc_translation_dict objectForKey:[o_ptc_menuorder objectAtIndex:i]]; NSString *title = [_translationsForPlaylistTableColumns objectForKey:[_menuOrderOfPlaylistTableColumns objectAtIndex:i]];
o_mi_tmp = [o_mu_playlistTableColumns addItemWithTitle:o_title menuItem = [_playlistTableColumnsMenu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:) action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""]; keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */ /* don't set a valid target for the title column selector, since we want it to be disabled */
if (![[o_ptc_menuorder objectAtIndex:i] isEqualToString: TITLE_COLUMN]) if (![[_menuOrderOfPlaylistTableColumns objectAtIndex:i] isEqualToString: TITLE_COLUMN])
[o_mi_tmp setTarget:self]; [menuItem setTarget:self];
[o_mi_tmp setTag:i]; [menuItem setTag:i];
o_mi_tmp = [o_context_menu addItemWithTitle:o_title menuItem = [contextMenu addItemWithTitle:title
action:@selector(togglePlaylistColumnTable:) action:@selector(togglePlaylistColumnTable:)
keyEquivalent:@""]; keyEquivalent:@""];
/* don't set a valid target for the title column selector, since we want it to be disabled */ /* don't set a valid target for the title column selector, since we want it to be disabled */
if (![[o_ptc_menuorder objectAtIndex:i] isEqualToString: TITLE_COLUMN]) if (![[_menuOrderOfPlaylistTableColumns objectAtIndex:i] isEqualToString: TITLE_COLUMN])
[o_mi_tmp setTarget:self]; [menuItem setTarget:self];
[o_mi_tmp setTag:i]; [menuItem setTag:i];
} }
if (!o_mu_playlistTableColumnsContextMenu) if (!_playlistTableColumnsContextMenu)
o_mu_playlistTableColumnsContextMenu = o_context_menu; _playlistTableColumnsContextMenu = contextMenu;
return o_context_menu; return contextMenu;
} }
#pragma mark - Termination #pragma mark - Termination
...@@ -581,138 +576,138 @@ ...@@ -581,138 +576,138 @@
- (void)setupMenus - (void)setupMenus
{ {
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t *p_playlist = pl_Get(VLCIntf);
input_thread_t * p_input = playlist_CurrentInput(p_playlist); input_thread_t *p_input = playlist_CurrentInput(p_playlist);
if (p_input != NULL) { if (p_input != NULL) {
[self setupVarMenuItem: o_mi_program target: (vlc_object_t *)p_input [self setupVarMenuItem:_program target: (vlc_object_t *)p_input
var: "program" selector: @selector(toggleVar:)]; var:"program" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_title target: (vlc_object_t *)p_input [self setupVarMenuItem:_title target: (vlc_object_t *)p_input
var: "title" selector: @selector(toggleVar:)]; var:"title" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_chapter target: (vlc_object_t *)p_input [self setupVarMenuItem:_chapter target: (vlc_object_t *)p_input
var: "chapter" selector: @selector(toggleVar:)]; var:"chapter" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_audiotrack target: (vlc_object_t *)p_input [self setupVarMenuItem:_audiotrack target: (vlc_object_t *)p_input
var: "audio-es" selector: @selector(toggleVar:)]; var:"audio-es" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_videotrack target: (vlc_object_t *)p_input [self setupVarMenuItem:_videotrack target: (vlc_object_t *)p_input
var: "video-es" selector: @selector(toggleVar:)]; var:"video-es" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_subtitle_track target: (vlc_object_t *)p_input [self setupVarMenuItem:_subtitle_track target: (vlc_object_t *)p_input
var: "spu-es" selector: @selector(toggleVar:)]; var:"spu-es" selector: @selector(toggleVar:)];
audio_output_t * p_aout = playlist_GetAout(p_playlist); audio_output_t *p_aout = playlist_GetAout(p_playlist);
if (p_aout != NULL) { if (p_aout != NULL) {
[self setupVarMenuItem: o_mi_channels target: (vlc_object_t *)p_aout [self setupVarMenuItem:_channels target: (vlc_object_t *)p_aout
var: "stereo-mode" selector: @selector(toggleVar:)]; var:"stereo-mode" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_visual target: (vlc_object_t *)p_aout [self setupVarMenuItem:_visual target: (vlc_object_t *)p_aout
var: "visual" selector: @selector(toggleVar:)]; var:"visual" selector: @selector(toggleVar:)];
vlc_object_release(p_aout); vlc_object_release(p_aout);
} }
vout_thread_t * p_vout = getVoutForActiveWindow(); vout_thread_t *p_vout = getVoutForActiveWindow();
if (p_vout != NULL) { if (p_vout != NULL) {
[self setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)p_vout [self setupVarMenuItem:_aspect_ratio target: (vlc_object_t *)p_vout
var: "aspect-ratio" selector: @selector(toggleVar:)]; var:"aspect-ratio" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout [self setupVarMenuItem:_crop target: (vlc_object_t *) p_vout
var: "crop" selector: @selector(toggleVar:)]; var:"crop" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_deinterlace target: (vlc_object_t *)p_vout [self setupVarMenuItem:_deinterlace target: (vlc_object_t *)p_vout
var: "deinterlace" selector: @selector(toggleVar:)]; var:"deinterlace" selector: @selector(toggleVar:)];
[self setupVarMenuItem: o_mi_deinterlace_mode target: (vlc_object_t *)p_vout [self setupVarMenuItem:_deinterlace_mode target: (vlc_object_t *)p_vout
var: "deinterlace-mode" selector: @selector(toggleVar:)]; var:"deinterlace-mode" selector: @selector(toggleVar:)];
vlc_object_release(p_vout); vlc_object_release(p_vout);
[self refreshVoutDeviceMenu:nil]; [self refreshVoutDeviceMenu:nil];
} }
[o_mi_ffmpeg_pp setEnabled:YES]; [_postprocessing setEnabled:YES];
vlc_object_release(p_input); vlc_object_release(p_input);
} else { } else {
[o_mi_ffmpeg_pp setEnabled:NO]; [_postprocessing setEnabled:NO];
} }
} }
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification - (void)refreshVoutDeviceMenu:(NSNotification *)notification
{ {
NSUInteger count = (NSUInteger) [o_mu_screen numberOfItems]; NSUInteger count = (NSUInteger) [_screenMenu numberOfItems];
NSMenu * o_submenu = o_mu_screen; NSMenu *submenu = _screenMenu;
if (count > 0) if (count > 0)
[o_submenu removeAllItems]; [submenu removeAllItems];
NSArray * o_screens = [NSScreen screens]; NSArray *screens = [NSScreen screens];
NSMenuItem * o_mitem; NSMenuItem *mitem;
count = [o_screens count]; count = [screens count];
[o_mi_screen setEnabled: YES]; [_screen setEnabled: YES];
[o_submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""]; [submenu addItemWithTitle: _NS("Default") action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
o_mitem = [o_submenu itemAtIndex: 0]; mitem = [submenu itemAtIndex: 0];
[o_mitem setTag: 0]; [mitem setTag: 0];
[o_mitem setEnabled: YES]; [mitem setEnabled: YES];
[o_mitem setTarget: self]; [mitem setTarget: self];
NSRect s_rect; NSRect s_rect;
for (NSUInteger i = 0; i < count; i++) { for (NSUInteger i = 0; i < count; i++) {
s_rect = [[o_screens objectAtIndex:i] frame]; s_rect = [[screens objectAtIndex:i] frame];
[o_submenu addItemWithTitle: [NSString stringWithFormat: @"%@ %li (%ix%i)", _NS("Screen"), i+1, [submenu addItemWithTitle: [NSString stringWithFormat: @"%@ %li (%ix%i)", _NS("Screen"), i+1,
(int)s_rect.size.width, (int)s_rect.size.height] action:@selector(toggleFullscreenDevice:) keyEquivalent:@""]; (int)s_rect.size.width, (int)s_rect.size.height] action:@selector(toggleFullscreenDevice:) keyEquivalent:@""];
o_mitem = [o_submenu itemAtIndex:i+1]; mitem = [submenu itemAtIndex:i+1];
[o_mitem setTag: (int)[[o_screens objectAtIndex:i] displayID]]; [mitem setTag: (int)[[screens objectAtIndex:i] displayID]];
[o_mitem setEnabled: YES]; [mitem setEnabled: YES];
[o_mitem setTarget: self]; [mitem setTarget: self];
} }
[[o_submenu itemWithTag: var_InheritInteger(VLCIntf, "macosx-vdev")] setState: NSOnState]; [[submenu itemWithTag: var_InheritInteger(VLCIntf, "macosx-vdev")] setState: NSOnState];
} }
- (void)setSubmenusEnabled:(BOOL)b_enabled - (void)setSubmenusEnabled:(BOOL)b_enabled
{ {
[o_mi_program setEnabled: b_enabled]; [_program setEnabled: b_enabled];
[o_mi_title setEnabled: b_enabled]; [_title setEnabled: b_enabled];
[o_mi_chapter setEnabled: b_enabled]; [_chapter setEnabled: b_enabled];
[o_mi_audiotrack setEnabled: b_enabled]; [_audiotrack setEnabled: b_enabled];
[o_mi_visual setEnabled: b_enabled]; [_visual setEnabled: b_enabled];
[o_mi_videotrack setEnabled: b_enabled]; [_videotrack setEnabled: b_enabled];
[o_mi_subtitle_track setEnabled: b_enabled]; [_subtitle_track setEnabled: b_enabled];
[o_mi_channels setEnabled: b_enabled]; [_channels setEnabled: b_enabled];
[o_mi_deinterlace setEnabled: b_enabled]; [_deinterlace setEnabled: b_enabled];
[o_mi_deinterlace_mode setEnabled: b_enabled]; [_deinterlace_mode setEnabled: b_enabled];
[o_mi_screen setEnabled: b_enabled]; [_screen setEnabled: b_enabled];
[o_mi_aspect_ratio setEnabled: b_enabled]; [_aspect_ratio setEnabled: b_enabled];
[o_mi_crop setEnabled: b_enabled]; [_crop setEnabled: b_enabled];
} }
- (void)setSubtitleMenuEnabled:(BOOL)b_enabled - (void)setSubtitleMenuEnabled:(BOOL)b_enabled
{ {
[o_mi_openSubtitleFile setEnabled: b_enabled]; [_openSubtitleFile setEnabled: b_enabled];
if (b_enabled) { if (b_enabled) {
[o_mi_subtitle_bgopacity_lbl_gray setHidden: YES]; [_subtitle_bgopacityLabel_gray setHidden: YES];
[o_mi_subtitle_bgopacity_lbl setHidden: NO]; [_subtitle_bgopacityLabel setHidden: NO];
} else { } else {
[o_mi_subtitle_bgopacity_lbl_gray setHidden: NO]; [_subtitle_bgopacityLabel_gray setHidden: NO];
[o_mi_subtitle_bgopacity_lbl setHidden: YES]; [_subtitle_bgopacityLabel setHidden: YES];
} }
[o_mi_subtitle_bgopacity_sld setEnabled: b_enabled]; [_subtitle_bgopacity_sld setEnabled: b_enabled];
[o_mi_teletext setEnabled: b_enabled]; [_teletext setEnabled: b_enabled];
} }
- (void)setRateControlsEnabled:(BOOL)b_enabled - (void)setRateControlsEnabled:(BOOL)b_enabled
{ {
[o_mi_rate_sld setEnabled: b_enabled]; [_rate_sld setEnabled: b_enabled];
[o_mi_rate_sld setIntValue: [[VLCCoreInteraction sharedInstance] playbackRate]]; [_rate_sld setIntValue: [[VLCCoreInteraction sharedInstance] playbackRate]];
int i = [[VLCCoreInteraction sharedInstance] playbackRate]; int i = [[VLCCoreInteraction sharedInstance] playbackRate];
double speed = pow(2, (double)i / 17); double speed = pow(2, (double)i / 17);
[o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]]; [_rateTextField setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
NSColor *o_color = b_enabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]; NSColor *color = b_enabled ? [NSColor controlTextColor] : [NSColor disabledControlTextColor];
[o_mi_rate_lbl setTextColor:o_color]; [_rateLabel setTextColor:color];
[o_mi_rate_slower_lbl setTextColor:o_color]; [_rate_slowerLabel setTextColor:color];
[o_mi_rate_normal_lbl setTextColor:o_color]; [_rate_normalLabel setTextColor:color];
[o_mi_rate_faster_lbl setTextColor:o_color]; [_rate_fasterLabel setTextColor:color];
[o_mi_rate_fld setTextColor:o_color]; [_rateTextField setTextColor:color];
[self setSubtitleMenuEnabled: b_enabled]; [self setSubtitleMenuEnabled: b_enabled];
} }
...@@ -724,7 +719,7 @@ ...@@ -724,7 +719,7 @@
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-effects-button"); BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-effects-button");
config_PutInt(VLCIntf, "macosx-show-effects-button", b_value); config_PutInt(VLCIntf, "macosx-show-effects-button", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleEffectsButton]; [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleEffectsButton];
[o_mi_toggleEffectsButton setState: b_value]; [_toggleEffectsButton setState: b_value];
} }
- (IBAction)toggleJumpButtons:(id)sender - (IBAction)toggleJumpButtons:(id)sender
...@@ -733,11 +728,11 @@ ...@@ -733,11 +728,11 @@
config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value); config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons]; [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
[[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) { [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *window) {
[[o_window controlsBar] toggleForwardBackwardMode: b_value]; [[window controlsBar] toggleForwardBackwardMode: b_value];
}]; }];
[o_mi_toggleJumpButtons setState: b_value]; [_toggleJumpButtons setState: b_value];
} }
- (IBAction)togglePlaymodeButtons:(id)sender - (IBAction)togglePlaymodeButtons:(id)sender
...@@ -745,7 +740,7 @@ ...@@ -745,7 +740,7 @@
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playmode-buttons"); BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
config_PutInt(VLCIntf, "macosx-show-playmode-buttons", b_value); config_PutInt(VLCIntf, "macosx-show-playmode-buttons", b_value);
[(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] togglePlaymodeButtons]; [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] togglePlaymodeButtons];
[o_mi_togglePlaymodeButtons setState: b_value]; [_togglePlaymodeButtons setState: b_value];
} }
- (IBAction)toggleSidebar:(id)sender - (IBAction)toggleSidebar:(id)sender
...@@ -755,36 +750,118 @@ ...@@ -755,36 +750,118 @@
- (void)updateSidebarMenuItem - (void)updateSidebarMenuItem
{ {
[o_mi_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")]; [_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
} }
- (IBAction)togglePlaylistColumnTable:(id)sender - (void)togglePlaylistColumnTable:(id)sender
{ {
NSInteger i_new_state = ![sender state]; NSInteger i_new_state = ![sender state];
NSInteger i_tag = [sender tag]; NSInteger i_tag = [sender tag];
[[o_mu_playlistTableColumns itemWithTag: i_tag] setState: i_new_state]; [[_playlistTableColumnsMenu itemWithTag: i_tag] setState: i_new_state];
[[o_mu_playlistTableColumnsContextMenu itemWithTag: i_tag] setState: i_new_state]; [[_playlistTableColumnsContextMenu itemWithTag: i_tag] setState: i_new_state];
NSString *o_column = [o_ptc_menuorder objectAtIndex:i_tag]; NSString *column = [_menuOrderOfPlaylistTableColumns objectAtIndex:i_tag];
[[[VLCMain sharedInstance] playlist] setColumn: o_column state: i_new_state translationDict: o_ptc_translation_dict]; [[[VLCMain sharedInstance] playlist] setColumn: column state: i_new_state translationDict: _translationsForPlaylistTableColumns];
} }
- (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)o_column - (BOOL)setPlaylistColumnTableState:(NSInteger)i_state forColumn:(NSString *)column
{ {
NSUInteger i_tag = [o_ptc_menuorder indexOfObject: o_column]; NSUInteger i_tag = [_menuOrderOfPlaylistTableColumns indexOfObject: column];
// prevent setting unknown columns // prevent setting unknown columns
if(i_tag == NSNotFound) if(i_tag == NSNotFound)
return NO; return NO;
[[o_mu_playlistTableColumns itemWithTag: i_tag] setState: i_state]; [[_playlistTableColumnsMenu itemWithTag: i_tag] setState: i_state];
[[o_mu_playlistTableColumnsContextMenu itemWithTag: i_tag] setState: i_state]; [[_playlistTableColumnsContextMenu itemWithTag: i_tag] setState: i_state];
[[[VLCMain sharedInstance] playlist] setColumn: o_column state: i_state translationDict: o_ptc_translation_dict]; [[[VLCMain sharedInstance] playlist] setColumn: column state: i_state translationDict: _translationsForPlaylistTableColumns];
return YES; return YES;
} }
#pragma mark - Playback #pragma mark - Playback
- (IBAction)play:(id)sender
{
[[VLCCoreInteraction sharedInstance] playOrPause];
}
- (IBAction)stop:(id)sender
{
[[VLCCoreInteraction sharedInstance] stop];
}
- (IBAction)prev:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)next:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (IBAction)random:(id)sender
{
[[VLCCoreInteraction sharedInstance] shuffle];
}
- (IBAction)repeat:(id)sender
{
vlc_value_t val;
intf_thread_t *p_intf = VLCIntf;
playlist_t *p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "repeat", &val);
if (! val.b_bool)
[[VLCCoreInteraction sharedInstance] repeatOne];
else
[[VLCCoreInteraction sharedInstance] repeatOff];
}
- (IBAction)loop:(id)sender
{
vlc_value_t val;
intf_thread_t *p_intf = VLCIntf;
playlist_t *p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "loop", &val);
if (! val.b_bool)
[[VLCCoreInteraction sharedInstance] repeatAll];
else
[[VLCCoreInteraction sharedInstance] repeatOff];
}
- (IBAction)forward:(id)sender
{
[[VLCCoreInteraction sharedInstance] forward];
}
- (IBAction)backward:(id)sender
{
[[VLCCoreInteraction sharedInstance] backward];
}
- (IBAction)volumeUp:(id)sender
{
[[VLCCoreInteraction sharedInstance] volumeUp];
}
- (IBAction)volumeDown:(id)sender
{
[[VLCCoreInteraction sharedInstance] volumeDown];
}
- (IBAction)mute:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleMute];
}
- (void)lockVideosAspectRatio:(id)sender
{
[[VLCCoreInteraction sharedInstance] setAspectRatioIsLocked: ![sender state]];
[sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
}
- (IBAction)quitAfterPlayback:(id)sender - (IBAction)quitAfterPlayback:(id)sender
{ {
playlist_t *p_playlist = pl_Get(VLCIntf); playlist_t *p_playlist = pl_Get(VLCIntf);
...@@ -800,23 +877,23 @@ ...@@ -800,23 +877,23 @@
- (void)updateRecordState:(BOOL)b_value - (void)updateRecordState:(BOOL)b_value
{ {
[o_mi_record setState:b_value]; [_record setState:b_value];
} }
- (IBAction)setPlaybackRate:(id)sender - (IBAction)setPlaybackRate:(id)sender
{ {
[[VLCCoreInteraction sharedInstance] setPlaybackRate: [o_mi_rate_sld intValue]]; [[VLCCoreInteraction sharedInstance] setPlaybackRate: [_rate_sld intValue]];
int i = [[VLCCoreInteraction sharedInstance] playbackRate]; int i = [[VLCCoreInteraction sharedInstance] playbackRate];
double speed = pow(2, (double)i / 17); double speed = pow(2, (double)i / 17);
[o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]]; [_rateTextField setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
} }
- (void)updatePlaybackRate - (void)updatePlaybackRate
{ {
int i = [[VLCCoreInteraction sharedInstance] playbackRate]; int i = [[VLCCoreInteraction sharedInstance] playbackRate];
double speed = pow(2, (double)i / 17); double speed = pow(2, (double)i / 17);
[o_mi_rate_fld setStringValue: [NSString stringWithFormat:@"%.2fx", speed]]; [_rateTextField setStringValue: [NSString stringWithFormat:@"%.2fx", speed]];
[o_mi_rate_sld setIntValue: i]; [_rate_sld setIntValue: i];
} }
- (IBAction)toggleAtoBloop:(id)sender - (IBAction)toggleAtoBloop:(id)sender
...@@ -824,6 +901,58 @@ ...@@ -824,6 +901,58 @@
[[VLCCoreInteraction sharedInstance] setAtoB]; [[VLCCoreInteraction sharedInstance] setAtoB];
} }
- (IBAction)goToSpecificTime:(id)sender
{
if (sender == _specificTime_cancelButton)
{
[NSApp endSheet: _specificTimeWindow];
[_specificTimeWindow close];
} else if (sender == _specificTime_okButton) {
input_thread_t *p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
int64_t timeInSec = 0;
NSString *fieldContent = [_specificTime_enterTextField stringValue];
if ([[fieldContent componentsSeparatedByString: @":"] count] > 1 &&
[[fieldContent componentsSeparatedByString: @":"] count] <= 3) {
NSArray *ourTempArray = \
[fieldContent componentsSeparatedByString: @":"];
if ([[fieldContent componentsSeparatedByString: @":"] count] == 3) {
timeInSec += ([[ourTempArray firstObject] intValue] *3600); //h
timeInSec += ([[ourTempArray objectAtIndex:1] intValue] *60); //m
timeInSec += [[ourTempArray objectAtIndex:2] intValue]; //s
} else {
timeInSec += ([[ourTempArray firstObject] intValue] *60); //m
timeInSec += [[ourTempArray objectAtIndex:1] intValue]; //s
}
}
else
timeInSec = [fieldContent intValue];
input_Control(p_input, INPUT_SET_TIME, (int64_t)(timeInSec *1000000));
vlc_object_release(p_input);
}
[NSApp endSheet: _specificTimeWindow];
[_specificTimeWindow close];
} else {
input_thread_t *p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
/* we can obviously only do that if an input is available */
int64_t pos, length;
length = var_GetInteger(p_input, "length");
[_specificTime_stepper setMaxValue: (length / CLOCK_FREQ)];
pos = var_GetInteger(p_input, "time");
[self setJumpTimeValue: (pos / CLOCK_FREQ)];
[NSApp beginSheet: _specificTimeWindow modalForWindow: \
[NSApp mainWindow] modalDelegate: self didEndSelector: nil \
contextInfo: nil];
[_specificTimeWindow makeKeyWindow];
vlc_object_release(p_input);
}
}
}
#pragma mark - audio menu #pragma mark - audio menu
- (void)refreshAudioDeviceList - (void)refreshAudioDeviceList
...@@ -831,9 +960,9 @@ ...@@ -831,9 +960,9 @@
char **ids, **names; char **ids, **names;
char *currentDevice; char *currentDevice;
[o_mu_device removeAllItems]; [_audioDeviceMenu removeAllItems];
audio_output_t * p_aout = getAout(); audio_output_t *p_aout = getAout();
if (!p_aout) if (!p_aout)
return; return;
...@@ -844,16 +973,16 @@ ...@@ -844,16 +973,16 @@
} }
currentDevice = aout_DeviceGet(p_aout); currentDevice = aout_DeviceGet(p_aout);
NSMenuItem * o_mi_tmp; NSMenuItem *_tmp;
for (NSUInteger x = 0; x < n; x++) { for (NSUInteger x = 0; x < n; x++) {
o_mi_tmp = [o_mu_device addItemWithTitle:toNSStr(names[x]) action:@selector(toggleAudioDevice:) keyEquivalent:@""]; _tmp = [_audioDeviceMenu addItemWithTitle:toNSStr(names[x]) action:@selector(toggleAudioDevice:) keyEquivalent:@""];
[o_mi_tmp setTarget:self]; [_tmp setTarget:self];
[o_mi_tmp setTag:[[NSString stringWithFormat:@"%s", ids[x]] intValue]]; [_tmp setTag:[[NSString stringWithFormat:@"%s", ids[x]] intValue]];
} }
vlc_object_release(p_aout); vlc_object_release(p_aout);
[[o_mu_device itemWithTag:[[NSString stringWithFormat:@"%s", currentDevice] intValue]] setState:NSOnState]; [[_audioDeviceMenu itemWithTag:[[NSString stringWithFormat:@"%s", currentDevice] intValue]] setState:NSOnState];
free(currentDevice); free(currentDevice);
...@@ -864,13 +993,13 @@ ...@@ -864,13 +993,13 @@
free(ids); free(ids);
free(names); free(names);
[o_mu_device setAutoenablesItems:YES]; [_audioDeviceMenu setAutoenablesItems:YES];
[o_mi_device setEnabled:YES]; [_audioDevice setEnabled:YES];
} }
- (IBAction)toggleAudioDevice:(id)sender - (void)toggleAudioDevice:(id)sender
{ {
audio_output_t * p_aout = getAout(); audio_output_t *p_aout = getAout();
if (!p_aout) if (!p_aout)
return; return;
...@@ -901,11 +1030,11 @@ ...@@ -901,11 +1030,11 @@
if (p_input) { if (p_input) {
vout_thread_t *p_vout = getVoutForActiveWindow(); vout_thread_t *p_vout = getVoutForActiveWindow();
if (p_vout) { if (p_vout) {
if (sender == o_mi_half_window) if (sender == _half_window)
var_SetFloat(p_vout, "zoom", 0.5); var_SetFloat(p_vout, "zoom", 0.5);
else if (sender == o_mi_normal_window) else if (sender == _normal_window)
var_SetFloat(p_vout, "zoom", 1.0); var_SetFloat(p_vout, "zoom", 1.0);
else if (sender == o_mi_double_window) else if (sender == _double_window)
var_SetFloat(p_vout, "zoom", 2.0); var_SetFloat(p_vout, "zoom", 2.0);
else else
{ {
...@@ -955,12 +1084,12 @@ ...@@ -955,12 +1084,12 @@
[[VLCCoreInteraction sharedInstance] setVideoFilter:"postproc" on:true]; [[VLCCoreInteraction sharedInstance] setVideoFilter:"postproc" on:true];
} }
- (IBAction)togglePostProcessing:(id)sender - (void)togglePostProcessing:(id)sender
{ {
char *psz_name = "postproc"; char *psz_name = "postproc";
NSInteger count = [o_mu_ffmpeg_pp numberOfItems]; NSInteger count = [_postprocessingMenu numberOfItems];
for (NSUInteger x = 0; x < count; x++) for (NSUInteger x = 0; x < count; x++)
[[o_mu_ffmpeg_pp itemAtIndex:x] setState:NSOffState]; [[_postprocessingMenu itemAtIndex:x] setState:NSOffState];
if ([sender tag] == -1) { if ([sender tag] == -1) {
[self _disablePostProcessing]; [self _disablePostProcessing];
...@@ -973,23 +1102,18 @@ ...@@ -973,23 +1102,18 @@
} }
} }
- (IBAction)toggleFullscreenDevice:(id)sender - (void)toggleFullscreenDevice:(id)sender
{ {
config_PutInt(VLCIntf, "macosx-vdev", [sender tag]); config_PutInt(VLCIntf, "macosx-vdev", [sender tag]);
[self refreshVoutDeviceMenu: nil]; [self refreshVoutDeviceMenu: nil];
} }
- (id)voutMenu
{
return o_vout_menu;
}
#pragma mark - Subtitles Menu #pragma mark - Subtitles Menu
- (IBAction)addSubtitleFile:(id)sender - (IBAction)addSubtitleFile:(id)sender
{ {
NSInteger i_returnValue = 0; NSInteger i_returnValue = 0;
input_thread_t * p_input = pl_CurrentInput(VLCIntf); input_thread_t *p_input = pl_CurrentInput(VLCIntf);
if (!p_input) if (!p_input)
return; return;
...@@ -1004,16 +1128,16 @@ ...@@ -1004,16 +1128,16 @@
if (!path) if (!path)
path = strdup(""); path = strdup("");
NSOpenPanel * openPanel = [NSOpenPanel openPanel]; NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles: YES]; [openPanel setCanChooseFiles: YES];
[openPanel setCanChooseDirectories: NO]; [openPanel setCanChooseDirectories: NO];
[openPanel setAllowsMultipleSelection: YES]; [openPanel setAllowsMultipleSelection: YES];
[openPanel setAllowedFileTypes: [NSArray arrayWithObjects:@"cdg",@"idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil",nil]]; [openPanel setAllowedFileTypes: [NSArray arrayWithObjects:@"cdg",@"idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil",nil]];
NSURL *o_url = [NSURL URLWithString:[[NSString stringWithUTF8String:path] stringByExpandingTildeInPath]]; NSURL *url = [NSURL URLWithString:[[NSString stringWithUTF8String:path] stringByExpandingTildeInPath]];
o_url = [o_url URLByDeletingLastPathComponent]; url = [url URLByDeletingLastPathComponent];
[openPanel setDirectoryURL: o_url]; [openPanel setDirectoryURL: url];
free(path); free(path);
vlc_object_release(p_input); vlc_object_release(p_input);
...@@ -1023,7 +1147,7 @@ ...@@ -1023,7 +1147,7 @@
[[VLCCoreInteraction sharedInstance] addSubtitlesToCurrentInput:[openPanel URLs]]; [[VLCCoreInteraction sharedInstance] addSubtitlesToCurrentInput:[openPanel URLs]];
} }
- (IBAction)switchSubtitleOption:(id)sender - (void)switchSubtitleOption:(id)sender
{ {
int intValue = [sender tag]; int intValue = [sender tag];
NSString *representedObject = [sender representedObject]; NSString *representedObject = [sender representedObject];
...@@ -1116,46 +1240,46 @@ ...@@ -1116,46 +1240,46 @@
- (IBAction)showConvertAndSave:(id)sender - (IBAction)showConvertAndSave:(id)sender
{ {
if (o_convertandsave == nil) if (_convertAndSaveWindowController == nil)
o_convertandsave = [[VLCConvertAndSave alloc] init]; _convertAndSaveWindowController = [[VLCConvertAndSave alloc] init];
if (!b_nib_convertandsave_loaded) if (!b_nib_convertandsave_loaded)
b_nib_convertandsave_loaded = [NSBundle loadNibNamed:@"ConvertAndSave" owner: NSApp]; b_nib_convertandsave_loaded = [NSBundle loadNibNamed:@"ConvertAndSave" owner: NSApp];
[o_convertandsave toggleWindow]; [_convertAndSaveWindowController toggleWindow];
} }
- (IBAction)showVideoEffects:(id)sender - (IBAction)showVideoEffects:(id)sender
{ {
if (o_videoeffects == nil) if (_videoEffectsWindowController == nil)
o_videoeffects = [[VLCVideoEffects alloc] init]; _videoEffectsWindowController = [[VLCVideoEffects alloc] init];
if (!b_nib_videoeffects_loaded) if (!b_nib_videoeffects_loaded)
b_nib_videoeffects_loaded = [NSBundle loadNibNamed:@"VideoEffects" owner: o_videoeffects]; b_nib_videoeffects_loaded = [NSBundle loadNibNamed:@"VideoEffects" owner: _videoEffectsWindowController];
[o_videoeffects toggleWindow:sender]; [_videoEffectsWindowController toggleWindow:sender];
} }
- (IBAction)showTrackSynchronization:(id)sender - (IBAction)showTrackSynchronization:(id)sender
{ {
if (!o_trackSynchronization) if (!_trackSynchronizationWindowController)
o_trackSynchronization = [[VLCTrackSynchronization alloc] init]; _trackSynchronizationWindowController = [[VLCTrackSynchronization alloc] init];
if (!b_nib_tracksynchro_loaded) if (!b_nib_tracksynchrloaded)
b_nib_tracksynchro_loaded = [NSBundle loadNibNamed:@"SyncTracks" owner:o_trackSynchronization]; b_nib_tracksynchrloaded = [NSBundle loadNibNamed:@"SyncTracks" owner:_trackSynchronizationWindowController];
[o_trackSynchronization toggleWindow:sender]; [_trackSynchronizationWindowController toggleWindow:sender];
} }
- (IBAction)showAudioEffects:(id)sender - (IBAction)showAudioEffects:(id)sender
{ {
if (!o_audioeffects) if (!_audioEffectsWindowController)
o_audioeffects = [[VLCAudioEffects alloc] init]; _audioEffectsWindowController = [[VLCAudioEffects alloc] init];
if (!b_nib_audioeffects_loaded) if (!b_nib_audioeffects_loaded)
b_nib_audioeffects_loaded = [NSBundle loadNibNamed:@"AudioEffects" owner:o_audioeffects]; b_nib_audioeffects_loaded = [NSBundle loadNibNamed:@"AudioEffects" owner:_audioEffectsWindowController];
[o_audioeffects toggleWindow:sender]; [_audioEffectsWindowController toggleWindow:sender];
} }
- (IBAction)showBookmarks:(id)sender - (IBAction)showBookmarks:(id)sender
...@@ -1163,7 +1287,7 @@ ...@@ -1163,7 +1287,7 @@
[[[VLCMain sharedInstance] bookmarks] showBookmarks]; [[[VLCMain sharedInstance] bookmarks] showBookmarks];
} }
- (IBAction)viewPreferences:(id)sender - (IBAction)showPreferences:(id)sender
{ {
NSInteger i_level = [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]; NSInteger i_level = [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel];
[[[VLCMain sharedInstance] simplePreferences] showSimplePrefsWithLevel:i_level]; [[[VLCMain sharedInstance] simplePreferences] showSimplePrefsWithLevel:i_level];
...@@ -1171,10 +1295,10 @@ ...@@ -1171,10 +1295,10 @@
- (IBAction)openAddonManager:(id)sender - (IBAction)openAddonManager:(id)sender
{ {
if (!o_addonsController) if (!_addonsController)
o_addonsController = [[AddonsWindowController alloc] init]; _addonsController = [[AddonsWindowController alloc] init];
[o_addonsController showWindow:self]; [_addonsController showWindow:self];
} }
- (IBAction)showMessagesPanel:(id)showMessagesPanel - (IBAction)showMessagesPanel:(id)showMessagesPanel
...@@ -1194,70 +1318,68 @@ ...@@ -1194,70 +1318,68 @@
#pragma mark - Help and Docs #pragma mark - Help and Docs
- (void)initAbout - (IBAction)showAbout:(id)sender
{ {
if (!o_about) if (!_aboutWindowController)
o_about = [[AboutWindowController alloc] init]; _aboutWindowController = [[AboutWindowController alloc] init];
}
- (IBAction)viewAbout:(id)sender [_aboutWindowController showAbout];
{
[self initAbout];
[o_about showAbout];
} }
- (IBAction)showLicense:(id)sender - (IBAction)showLicense:(id)sender
{ {
[self initAbout]; if (!_aboutWindowController)
[o_about showGPL]; _aboutWindowController = [[AboutWindowController alloc] init];
[_aboutWindowController showGPL];
} }
- (IBAction)viewHelp:(id)sender - (IBAction)showHelp:(id)sender
{ {
if (!o_helpWin) if (!_helpWindowController)
o_helpWin = [[HelpWindowController alloc] init]; _helpWindowController = [[HelpWindowController alloc] init];
[o_helpWin showHelp]; [_helpWindowController showHelp];
} }
- (IBAction)openReadMe:(id)sender - (IBAction)openReadMe:(id)sender
{ {
NSString * o_path = [[NSBundle mainBundle] pathForResource: @"README.MacOSX" ofType: @"rtf"]; NSString *path = [[NSBundle mainBundle] pathForResource: @"README.MacOSX" ofType: @"rtf"];
[[NSWorkspace sharedWorkspace] openFile: o_path withApplication: @"TextEdit"]; [[NSWorkspace sharedWorkspace] openFile: path withApplication: @"TextEdit"];
} }
- (IBAction)openDocumentation:(id)sender - (IBAction)openDocumentation:(id)sender
{ {
NSURL * o_url = [NSURL URLWithString: @"http://www.videolan.org/doc/"]; NSURL *url = [NSURL URLWithString: @"http://www.videolan.org/doc/"];
[[NSWorkspace sharedWorkspace] openURL: o_url]; [[NSWorkspace sharedWorkspace] openURL: url];
} }
- (IBAction)openWebsite:(id)sender - (IBAction)openWebsite:(id)sender
{ {
NSURL * o_url = [NSURL URLWithString: @"http://www.videolan.org/"]; NSURL *url = [NSURL URLWithString: @"http://www.videolan.org/"];
[[NSWorkspace sharedWorkspace] openURL: o_url]; [[NSWorkspace sharedWorkspace] openURL: url];
} }
- (IBAction)openForum:(id)sender - (IBAction)openForum:(id)sender
{ {
NSURL * o_url = [NSURL URLWithString: @"http://forum.videolan.org/"]; NSURL *url = [NSURL URLWithString: @"http://forum.videolan.org/"];
[[NSWorkspace sharedWorkspace] openURL: o_url]; [[NSWorkspace sharedWorkspace] openURL: url];
} }
- (IBAction)openDonate:(id)sender - (IBAction)openDonate:(id)sender
{ {
NSURL * o_url = [NSURL URLWithString: @"http://www.videolan.org/contribute.html#paypal"]; NSURL *url = [NSURL URLWithString: @"http://www.videolan.org/contribute.html#paypal"];
[[NSWorkspace sharedWorkspace] openURL: o_url]; [[NSWorkspace sharedWorkspace] openURL: url];
} }
#pragma mark - Errors, warnings and messages #pragma mark - Errors, warnings and messages
- (IBAction)viewErrorsAndWarnings:(id)sender - (IBAction)showErrorsAndWarnings:(id)sender
{ {
[[[[VLCMain sharedInstance] coreDialogProvider] errorPanel] showWindow:self]; [[[[VLCMain sharedInstance] coreDialogProvider] errorPanel] showWindow:self];
} }
...@@ -1271,34 +1393,34 @@ ...@@ -1271,34 +1393,34 @@
- (void)setPlay - (void)setPlay
{ {
[o_mi_play setTitle: _NS("Play")]; [_play setTitle: _NS("Play")];
[o_dmi_play setTitle: _NS("Play")]; [_dockMenuplay setTitle: _NS("Play")];
[o_vmi_play setTitle: _NS("Play")]; [_voutMenuplay setTitle: _NS("Play")];
} }
- (void)setPause - (void)setPause
{ {
[o_mi_play setTitle: _NS("Pause")]; [_play setTitle: _NS("Pause")];
[o_dmi_play setTitle: _NS("Pause")]; [_dockMenuplay setTitle: _NS("Pause")];
[o_vmi_play setTitle: _NS("Pause")]; [_voutMenuplay setTitle: _NS("Pause")];
} }
- (void)setRepeatOne - (void)setRepeatOne
{ {
[o_mi_repeat setState: NSOnState]; [_repeat setState: NSOnState];
[o_mi_loop setState: NSOffState]; [_loop setState: NSOffState];
} }
- (void)setRepeatAll - (void)setRepeatAll
{ {
[o_mi_repeat setState: NSOffState]; [_repeat setState: NSOffState];
[o_mi_loop setState: NSOnState]; [_loop setState: NSOnState];
} }
- (void)setRepeatOff - (void)setRepeatOff
{ {
[o_mi_repeat setState: NSOffState]; [_repeat setState: NSOffState];
[o_mi_loop setState: NSOffState]; [_loop setState: NSOffState];
} }
- (void)setShuffle - (void)setShuffle
...@@ -1307,12 +1429,12 @@ ...@@ -1307,12 +1429,12 @@
playlist_t *p_playlist = pl_Get(VLCIntf); playlist_t *p_playlist = pl_Get(VLCIntf);
b_value = var_GetBool(p_playlist, "random"); b_value = var_GetBool(p_playlist, "random");
[o_mi_random setState: b_value]; [_random setState: b_value];
} }
#pragma mark - Dynamic menu creation and validation #pragma mark - Dynamic menu creation and validation
- (void)setupVarMenuItem:(NSMenuItem *)o_mi - (void)setupVarMenuItem:(NSMenuItem *)mi
target:(vlc_object_t *)p_object target:(vlc_object_t *)p_object
var:(const char *)psz_variable var:(const char *)psz_variable
selector:(SEL)pf_callback selector:(SEL)pf_callback
...@@ -1334,12 +1456,12 @@ ...@@ -1334,12 +1456,12 @@
/* Get the descriptive name of the variable */ /* Get the descriptive name of the variable */
var_Change(p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL); var_Change(p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL);
[o_mi setTitle: _NS(text.psz_string ? text.psz_string : psz_variable)]; [mi setTitle: _NS(text.psz_string ? text.psz_string : psz_variable)];
if (i_type & VLC_VAR_HASCHOICE) { if (i_type & VLC_VAR_HASCHOICE) {
NSMenu *o_menu = [o_mi submenu]; NSMenu *menu = [mi submenu];
[self setupVarMenu: o_menu forMenuItem: o_mi target:p_object [self setupVarMenu:menu forMenuItem:mi target:p_object
var:psz_variable selector:pf_callback]; var:psz_variable selector:pf_callback];
free(text.psz_string); free(text.psz_string);
...@@ -1349,20 +1471,20 @@ ...@@ -1349,20 +1471,20 @@
if (var_Get(p_object, psz_variable, &val) < 0) if (var_Get(p_object, psz_variable, &val) < 0)
return; return;
VLCAutoGeneratedMenuContent *o_data; VLCAutoGeneratedMenuContent *data;
switch(i_type & VLC_VAR_TYPE) { switch(i_type & VLC_VAR_TYPE) {
case VLC_VAR_VOID: case VLC_VAR_VOID:
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: val ofType: i_type]; andValue: val ofType: i_type];
[o_mi setRepresentedObject:o_data]; [mi setRepresentedObject:data];
break; break;
case VLC_VAR_BOOL: case VLC_VAR_BOOL:
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: val ofType: i_type]; andValue: val ofType: i_type];
[o_mi setRepresentedObject:o_data]; [mi setRepresentedObject:data];
if (!(i_type & VLC_VAR_ISCOMMAND)) if (!(i_type & VLC_VAR_ISCOMMAND))
[o_mi setState: val.b_bool ? TRUE : FALSE ]; [mi setState: val.b_bool ? TRUE : FALSE ];
break; break;
default: default:
...@@ -1374,8 +1496,8 @@ ...@@ -1374,8 +1496,8 @@
} }
- (void)setupVarMenu:(NSMenu *)o_menu - (void)setupVarMenu:(NSMenu *)menu
forMenuItem: (NSMenuItem *)o_parent forMenuItem: (NSMenuItem *)parent
target:(vlc_object_t *)p_object target:(vlc_object_t *)p_object
var:(const char *)psz_variable var:(const char *)psz_variable
selector:(SEL)pf_callback selector:(SEL)pf_callback
...@@ -1384,20 +1506,20 @@ ...@@ -1384,20 +1506,20 @@
int i_type, i; int i_type, i;
/* remove previous items */ /* remove previous items */
[o_menu removeAllItems]; [menu removeAllItems];
/* we disable everything here, and enable it again when needed, below */ /* we disable everything here, and enable it again when needed, below */
[o_parent setEnabled:NO]; [parent setEnabled:NO];
/* Aspect Ratio */ /* Aspect Ratio */
if ([[o_parent title] isEqualToString: _NS("Aspect ratio")] == YES) { if ([[parent title] isEqualToString: _NS("Aspect ratio")] == YES) {
NSMenuItem *o_lmi_tmp2; NSMenuItem *lmi_tmp2;
o_lmi_tmp2 = [o_menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""]; lmi_tmp2 = [menu addItemWithTitle: _NS("Lock Aspect Ratio") action: @selector(lockVideosAspectRatio:) keyEquivalent: @""];
[o_lmi_tmp2 setTarget: [[VLCMain sharedInstance] controls]]; [lmi_tmp2 setTarget: self];
[o_lmi_tmp2 setEnabled: YES]; [lmi_tmp2 setEnabled: YES];
[o_lmi_tmp2 setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]]; [lmi_tmp2 setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
[o_parent setEnabled: YES]; [parent setEnabled: YES];
[o_menu addItem: [NSMenuItem separatorItem]]; [menu addItem: [NSMenuItem separatorItem]];
} }
/* Check the type of the object variable */ /* Check the type of the object variable */
...@@ -1434,42 +1556,42 @@ ...@@ -1434,42 +1556,42 @@
} }
/* make (un)sensitive */ /* make (un)sensitive */
[o_parent setEnabled: (val_list.p_list->i_count > 1)]; [parent setEnabled: (val_list.p_list->i_count > 1)];
for (i = 0; i < val_list.p_list->i_count; i++) { for (i = 0; i < val_list.p_list->i_count; i++) {
NSMenuItem * o_lmi; NSMenuItem *lmi;
NSString *o_title = @""; NSString *title = @"";
VLCAutoGeneratedMenuContent *o_data; VLCAutoGeneratedMenuContent *data;
switch(i_type & VLC_VAR_TYPE) { switch(i_type & VLC_VAR_TYPE) {
case VLC_VAR_STRING: case VLC_VAR_STRING:
o_title = _NS(text_list.p_list->p_values[i].psz_string ? text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string); title = _NS(text_list.p_list->p_values[i].psz_string ? text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string);
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""]; lmi = [menu addItemWithTitle: title action: pf_callback keyEquivalent: @""];
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: val_list.p_list->p_values[i] ofType: i_type]; andValue: val_list.p_list->p_values[i] ofType: i_type];
[o_lmi setRepresentedObject:o_data]; [lmi setRepresentedObject:data];
[o_lmi setTarget: self]; [lmi setTarget: self];
if (!strcmp(val.psz_string, val_list.p_list->p_values[i].psz_string) && !(i_type & VLC_VAR_ISCOMMAND)) if (!strcmp(val.psz_string, val_list.p_list->p_values[i].psz_string) && !(i_type & VLC_VAR_ISCOMMAND))
[o_lmi setState: TRUE ]; [lmi setState: TRUE ];
break; break;
case VLC_VAR_INTEGER: case VLC_VAR_INTEGER:
o_title = text_list.p_list->p_values[i].psz_string ? title = text_list.p_list->p_values[i].psz_string ?
_NS(text_list.p_list->p_values[i].psz_string) : [NSString stringWithFormat: @"%"PRId64, val_list.p_list->p_values[i].i_int]; _NS(text_list.p_list->p_values[i].psz_string) : [NSString stringWithFormat: @"%"PRId64, val_list.p_list->p_values[i].i_int];
o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""]; lmi = [menu addItemWithTitle: title action: pf_callback keyEquivalent: @""];
o_data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object data = [[VLCAutoGeneratedMenuContent alloc] initWithVariableName: psz_variable ofObject: p_object
andValue: val_list.p_list->p_values[i] ofType: i_type]; andValue: val_list.p_list->p_values[i] ofType: i_type];
[o_lmi setRepresentedObject:o_data]; [lmi setRepresentedObject:data];
[o_lmi setTarget: self]; [lmi setTarget: self];
if (val_list.p_list->p_values[i].i_int == val.i_int && !(i_type & VLC_VAR_ISCOMMAND)) if (val_list.p_list->p_values[i].i_int == val.i_int && !(i_type & VLC_VAR_ISCOMMAND))
[o_lmi setState: TRUE ]; [lmi setState: TRUE ];
break; break;
default: default:
...@@ -1482,12 +1604,12 @@ ...@@ -1482,12 +1604,12 @@
var_FreeList(&val_list, &text_list); var_FreeList(&val_list, &text_list);
} }
- (IBAction)toggleVar:(id)sender - (void)toggleVar:(id)sender
{ {
NSMenuItem *o_mi = (NSMenuItem *)sender; NSMenuItem *mi = (NSMenuItem *)sender;
VLCAutoGeneratedMenuContent *o_data = [o_mi representedObject]; VLCAutoGeneratedMenuContent *data = [mi representedObject];
[NSThread detachNewThreadSelector: @selector(toggleVarThread:) [NSThread detachNewThreadSelector: @selector(toggleVarThread:)
toTarget: self withObject: o_data]; toTarget: self withObject: data];
return; return;
} }
...@@ -1515,76 +1637,76 @@ ...@@ -1515,76 +1637,76 @@
@implementation VLCMainMenu (NSMenuValidation) @implementation VLCMainMenu (NSMenuValidation)
- (BOOL)validateMenuItem:(NSMenuItem *)o_mi - (BOOL)validateMenuItem:(NSMenuItem *)mi
{ {
NSString *o_title = [o_mi title]; NSString *title = [mi title];
BOOL bEnabled = TRUE; BOOL bEnabled = TRUE;
vlc_value_t val; vlc_value_t val;
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t *p_playlist = pl_Get(VLCIntf);
input_thread_t * p_input = playlist_CurrentInput(p_playlist); input_thread_t *p_input = playlist_CurrentInput(p_playlist);
if ([o_title isEqualToString: _NS("Stop")]) { if ([title isEqualToString: _NS("Stop")]) {
if (!p_input) if (!p_input)
bEnabled = FALSE; bEnabled = FALSE;
[self setupMenus]; /* Make sure input menu is up to date */ [self setupMenus]; /* Make sure input menu is up to date */
} else if ([o_title isEqualToString: _NS("Record")]) { } else if ([title isEqualToString: _NS("Record")]) {
bEnabled = FALSE; bEnabled = FALSE;
if (p_input) if (p_input)
bEnabled = var_GetBool(p_input, "can-record"); bEnabled = var_GetBool(p_input, "can-record");
} else if ([o_title isEqualToString: _NS("Previous")] || } else if ([title isEqualToString: _NS("Previous")] ||
[o_title isEqualToString: _NS("Next")]) { [title isEqualToString: _NS("Next")]) {
PL_LOCK; PL_LOCK;
bEnabled = playlist_CurrentSize(p_playlist) > 1; bEnabled = playlist_CurrentSize(p_playlist) > 1;
PL_UNLOCK; PL_UNLOCK;
} else if ([o_title isEqualToString: _NS("Random")]) { } else if ([title isEqualToString: _NS("Random")]) {
int i_state; int i_state;
var_Get(p_playlist, "random", &val); var_Get(p_playlist, "random", &val);
i_state = val.b_bool ? NSOnState : NSOffState; i_state = val.b_bool ? NSOnState : NSOffState;
[o_mi setState: i_state]; [mi setState: i_state];
} else if ([o_title isEqualToString: _NS("Repeat One")]) { } else if ([title isEqualToString: _NS("Repeat One")]) {
int i_state; int i_state;
var_Get(p_playlist, "repeat", &val); var_Get(p_playlist, "repeat", &val);
i_state = val.b_bool ? NSOnState : NSOffState; i_state = val.b_bool ? NSOnState : NSOffState;
[o_mi setState: i_state]; [mi setState: i_state];
} else if ([o_title isEqualToString: _NS("Repeat All")]) { } else if ([title isEqualToString: _NS("Repeat All")]) {
int i_state; int i_state;
var_Get(p_playlist, "loop", &val); var_Get(p_playlist, "loop", &val);
i_state = val.b_bool ? NSOnState : NSOffState; i_state = val.b_bool ? NSOnState : NSOffState;
[o_mi setState: i_state]; [mi setState: i_state];
} else if ([o_title isEqualToString: _NS("Quit after Playback")]) { } else if ([title isEqualToString: _NS("Quit after Playback")]) {
int i_state; int i_state;
bool b_value = var_InheritBool(p_playlist, "play-and-exit"); bool b_value = var_InheritBool(p_playlist, "play-and-exit");
i_state = b_value ? NSOnState : NSOffState; i_state = b_value ? NSOnState : NSOffState;
[o_mi setState: i_state]; [mi setState: i_state];
} else if ([o_title isEqualToString: _NS("Step Forward")] || } else if ([title isEqualToString: _NS("Step Forward")] ||
[o_title isEqualToString: _NS("Step Backward")] || [title isEqualToString: _NS("Step Backward")] ||
[o_title isEqualToString: _NS("Jump to Time")]) { [title isEqualToString: _NS("Jump to Time")]) {
if (p_input != NULL) { if (p_input != NULL) {
var_Get(p_input, "can-seek", &val); var_Get(p_input, "can-seek", &val);
bEnabled = val.b_bool; bEnabled = val.b_bool;
} }
else bEnabled = FALSE; else bEnabled = FALSE;
} else if ([o_title isEqualToString: _NS("Mute")]) { } else if ([title isEqualToString: _NS("Mute")]) {
[o_mi setState: [[VLCCoreInteraction sharedInstance] mute] ? NSOnState : NSOffState]; [mi setState: [[VLCCoreInteraction sharedInstance] mute] ? NSOnState : NSOffState];
[self setupMenus]; /* Make sure audio menu is up to date */ [self setupMenus]; /* Make sure audio menu is up to date */
[self refreshAudioDeviceList]; [self refreshAudioDeviceList];
} else if ([o_title isEqualToString: _NS("Half Size")] || } else if ([title isEqualToString: _NS("Half Size")] ||
[o_title isEqualToString: _NS("Normal Size")] || [title isEqualToString: _NS("Normal Size")] ||
[o_title isEqualToString: _NS("Double Size")] || [title isEqualToString: _NS("Double Size")] ||
[o_title isEqualToString: _NS("Fit to Screen")] || [title isEqualToString: _NS("Fit to Screen")] ||
[o_title isEqualToString: _NS("Snapshot")] || [title isEqualToString: _NS("Snapshot")] ||
[o_title isEqualToString: _NS("Fullscreen")] || [title isEqualToString: _NS("Fullscreen")] ||
[o_title isEqualToString: _NS("Float on Top")]) { [title isEqualToString: _NS("Float on Top")]) {
bEnabled = FALSE; bEnabled = FALSE;
if (p_input != NULL) { if (p_input != NULL) {
vout_thread_t *p_vout = getVoutForActiveWindow(); vout_thread_t *p_vout = getVoutForActiveWindow();
if (p_vout != NULL) { if (p_vout != NULL) {
if ([o_title isEqualToString: _NS("Float on Top")]) if ([title isEqualToString: _NS("Float on Top")])
[o_mi setState: var_GetBool(p_vout, "video-on-top")]; [mi setState: var_GetBool(p_vout, "video-on-top")];
if ([o_title isEqualToString: _NS("Fullscreen")]) if ([title isEqualToString: _NS("Fullscreen")])
[o_mi setState: var_GetBool(p_vout, "fullscreen")]; [mi setState: var_GetBool(p_vout, "fullscreen")];
bEnabled = TRUE; bEnabled = TRUE;
vlc_object_release(p_vout); vlc_object_release(p_vout);
...@@ -1593,23 +1715,23 @@ ...@@ -1593,23 +1715,23 @@
[self setupMenus]; /* Make sure video menu is up to date */ [self setupMenus]; /* Make sure video menu is up to date */
} else if ([o_title isEqualToString: _NS("Add Subtitle File...")]) { } else if ([title isEqualToString: _NS("Add Subtitle File...")]) {
bEnabled = [o_mi isEnabled]; bEnabled = [mi isEnabled];
[self setupMenus]; /* Make sure subtitles menu is up to date */ [self setupMenus]; /* Make sure subtitles menu is up to date */
} else { } else {
NSMenuItem *o_mi_parent = [o_mi parentItem]; NSMenuItem *_parent = [mi parentItem];
if (o_mi_parent == o_mi_subtitle_size || o_mi == o_mi_subtitle_size || if (_parent == _subtitle_size || mi == _subtitle_size ||
o_mi_parent == o_mi_subtitle_textcolor || o_mi == o_mi_subtitle_textcolor || _parent == _subtitle_textcolor || mi == _subtitle_textcolor ||
o_mi_parent == o_mi_subtitle_bgcolor || o_mi == o_mi_subtitle_bgcolor || _parent == _subtitle_bgcolor || mi == _subtitle_bgcolor ||
o_mi_parent == o_mi_subtitle_bgopacity || o_mi == o_mi_subtitle_bgopacity || _parent == _subtitle_bgopacity || mi == _subtitle_bgopacity ||
o_mi_parent == o_mi_subtitle_outlinethickness || o_mi == o_mi_subtitle_outlinethickness || _parent == _subtitle_outlinethickness || mi == _subtitle_outlinethickness ||
o_mi_parent == o_mi_teletext || o_mi == o_mi_teletext) _parent == _teletext || mi == _teletext)
bEnabled = o_mi_openSubtitleFile.isEnabled; bEnabled = _openSubtitleFile.isEnabled;
} }
/* Special case for telx menu */ /* Special case for telx menu */
if ([o_title isEqualToString: _NS("Normal Size")]) { if ([title isEqualToString: _NS("Normal Size")]) {
NSMenuItem *item = [[o_mi menu] itemWithTitle:_NS("Teletext")]; NSMenuItem *item = [[mi menu] itemWithTitle:_NS("Teletext")];
bool b_telx = p_input && var_GetInteger(p_input, "teletext-es") >= 0; bool b_telx = p_input && var_GetInteger(p_input, "teletext-es") >= 0;
[[item submenu] setAutoenablesItems:NO]; [[item submenu] setAutoenablesItems:NO];
...@@ -1628,11 +1750,20 @@ ...@@ -1628,11 +1750,20 @@
/***************************************************************************** /*****************************************************************************
* VLCAutoGeneratedMenuContent implementation *VLCAutoGeneratedMenuContent implementation
***************************************************************************** *****************************************************************************
* Object connected to a playlistitem which remembers the data belonging to *Object connected to a playlistitem which remembers the data belonging to
* the variable of the autogenerated menu *the variable of the autogenerated menu
*****************************************************************************/ *****************************************************************************/
@interface VLCAutoGeneratedMenuContent ()
{
char *psz_name;
vlc_object_t *vlc_object;
vlc_value_t value;
int i_type;
}
@end
@implementation VLCAutoGeneratedMenuContent @implementation VLCAutoGeneratedMenuContent
-(id) initWithVariableName:(const char *)name ofObject:(vlc_object_t *)object -(id) initWithVariableName:(const char *)name ofObject:(vlc_object_t *)object
...@@ -1641,7 +1772,7 @@ ...@@ -1641,7 +1772,7 @@
self = [super init]; self = [super init];
if (self != nil) { if (self != nil) {
_vlc_object = vlc_object_hold(object); vlc_object = vlc_object_hold(object);
psz_name = strdup(name); psz_name = strdup(name);
i_type = type; i_type = type;
value = val; value = val;
...@@ -1654,8 +1785,8 @@ ...@@ -1654,8 +1785,8 @@
- (void)dealloc - (void)dealloc
{ {
if (_vlc_object) if (vlc_object)
vlc_object_release(_vlc_object); vlc_object_release(vlc_object);
if ((i_type & VLC_VAR_TYPE) == VLC_VAR_STRING) if ((i_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
free(value.psz_string); free(value.psz_string);
free(psz_name); free(psz_name);
...@@ -1673,10 +1804,9 @@ ...@@ -1673,10 +1804,9 @@
- (vlc_object_t *)vlcObject - (vlc_object_t *)vlcObject
{ {
return vlc_object_hold(_vlc_object); return vlc_object_hold(vlc_object);
} }
- (int)type - (int)type
{ {
return i_type; return i_type;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#import "AudioEffects.h" #import "AudioEffects.h"
#import "MainMenu.h" #import "MainMenu.h"
#import "open.h" #import "open.h"
#import "controls.h" // TODO: remove me
#import "playlist.h" #import "playlist.h"
#import "SideBarItem.h" #import "SideBarItem.h"
#import <math.h> #import <math.h>
...@@ -146,8 +145,9 @@ static VLCMainWindow *sharedInstance = nil; ...@@ -146,8 +145,9 @@ static VLCMainWindow *sharedInstance = nil;
else else
b_force = YES; b_force = YES;
return [[VLCCoreInteraction sharedInstance] hasDefinedShortcutKey:o_event force:b_force] || VLCCoreInteraction *coreInteraction = [VLCCoreInteraction sharedInstance];
[(VLCControls *)[[VLCMain sharedInstance] controls] keyEvent:o_event]; return [coreInteraction hasDefinedShortcutKey:o_event force:b_force] ||
[coreInteraction keyEvent:o_event];
} }
- (void)dealloc - (void)dealloc
......
...@@ -29,7 +29,6 @@ libmacosx_plugin_la_SOURCES = \ ...@@ -29,7 +29,6 @@ libmacosx_plugin_la_SOURCES = \
BWQuincyManager.h BWQuincyManager.m \ BWQuincyManager.h BWQuincyManager.m \
BWQuincyUI.h BWQuincyUI.m \ BWQuincyUI.h BWQuincyUI.m \
CompatibilityFixes.h \ CompatibilityFixes.h \
controls.h controls.m \
ControlsBar.m ControlsBar.h \ ControlsBar.m ControlsBar.h \
ConvertAndSave.h ConvertAndSave.m \ ConvertAndSave.h ConvertAndSave.m \
coredialogs.h coredialogs.m \ coredialogs.h coredialogs.m \
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
} else if (([o_event type] == NSRightMouseDown) || } else if (([o_event type] == NSRightMouseDown) ||
(([o_event type] == NSLeftMouseDown) && (([o_event type] == NSLeftMouseDown) &&
([o_event modifierFlags] & NSControlKeyMask))) ([o_event modifierFlags] & NSControlKeyMask)))
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[[VLCMain sharedInstance] mainMenu] voutMenu] withEvent: o_event forView: self];
[super mouseDown: o_event]; [super mouseDown: o_event];
} }
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
- (void)rightMouseDown:(NSEvent *)o_event - (void)rightMouseDown:(NSEvent *)o_event
{ {
if ([o_event type] == NSRightMouseDown) if ([o_event type] == NSRightMouseDown)
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[[VLCMain sharedInstance] mainMenu] voutMenu] withEvent: o_event forView: self];
[super mouseDown: o_event]; [super mouseDown: o_event];
} }
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
- (void)rightMouseUp:(NSEvent *)o_event - (void)rightMouseUp:(NSEvent *)o_event
{ {
if ([o_event type] == NSRightMouseUp) if ([o_event type] == NSRightMouseUp)
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[[VLCMain sharedInstance] mainMenu] voutMenu] withEvent: o_event forView: self];
[super mouseUp: o_event]; [super mouseUp: o_event];
} }
......
/*****************************************************************************
* controls.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net>
* Felix Paul Kühne <fkuehne at 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* VLCControls interface
*****************************************************************************/
@interface VLCControls : NSObject
{
IBOutlet id o_main;
IBOutlet id o_specificTime_cancel_btn;
IBOutlet id o_specificTime_enter_fld;
IBOutlet id o_specificTime_goTo_lbl;
IBOutlet id o_specificTime_ok_btn;
IBOutlet id o_specificTime_win;
IBOutlet id o_specificTime_sec_lbl;
IBOutlet id o_specificTime_stepper;
IBOutlet id o_specificTime_mi;
}
@property (nonatomic) int jumpTimeValue;
- (IBAction)play:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)prev:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)random:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)volumeUp:(id)sender;
- (IBAction)volumeDown:(id)sender;
- (IBAction)mute:(id)sender;
- (IBAction)volumeSliderUpdated:(id)sender;
- (IBAction)showPosition: (id)sender;
- (IBAction)lockVideosAspectRatio:(id)sender;
- (BOOL)keyEvent:(NSEvent *)o_event;
- (IBAction)goToSpecificTime:(id)sender;
@end
/*****************************************************************************
* controls.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2013 VLC authors and VideoLAN
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan dot org>
* Benjamin Pracht <bigben at videolan doit org>
* Felix Paul Kühne <fkuehne at videolan dot 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <sys/param.h> /* for MAXPATHLEN */
#include <string.h>
#import "intf.h"
#import "VideoView.h"
#import "open.h"
#import "controls.h"
#import "playlist.h"
#import "MainMenu.h"
#import "CoreInteraction.h"
#import "misc.h"
#import <vlc_keys.h>
#pragma mark -
/*****************************************************************************
* VLCControls implementation
*****************************************************************************/
@implementation VLCControls
- (void)awakeFromNib
{
[o_specificTime_mi setTitle: _NS("Jump to Time")];
[o_specificTime_cancel_btn setTitle: _NS("Cancel")];
[o_specificTime_ok_btn setTitle: _NS("OK")];
[o_specificTime_sec_lbl setStringValue: _NS("sec.")];
[o_specificTime_goTo_lbl setStringValue: _NS("Jump to Time")];
[o_specificTime_enter_fld setFormatter:[[PositionFormatter alloc] init]];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
}
- (IBAction)play:(id)sender
{
[[VLCCoreInteraction sharedInstance] playOrPause];
}
- (IBAction)stop:(id)sender
{
[[VLCCoreInteraction sharedInstance] stop];
}
- (IBAction)prev:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)next:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (IBAction)random:(id)sender
{
[[VLCCoreInteraction sharedInstance] shuffle];
}
- (IBAction)repeat:(id)sender
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "repeat", &val);
if (! val.b_bool)
[[VLCCoreInteraction sharedInstance] repeatOne];
else
[[VLCCoreInteraction sharedInstance] repeatOff];
}
- (IBAction)loop:(id)sender
{
vlc_value_t val;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "loop", &val);
if (! val.b_bool)
[[VLCCoreInteraction sharedInstance] repeatAll];
else
[[VLCCoreInteraction sharedInstance] repeatOff];
}
- (IBAction)forward:(id)sender
{
[[VLCCoreInteraction sharedInstance] forward];
}
- (IBAction)backward:(id)sender
{
[[VLCCoreInteraction sharedInstance] backward];
}
- (IBAction)volumeUp:(id)sender
{
[[VLCCoreInteraction sharedInstance] volumeUp];
}
- (IBAction)volumeDown:(id)sender
{
[[VLCCoreInteraction sharedInstance] volumeDown];
}
- (IBAction)mute:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleMute];
}
- (IBAction)volumeSliderUpdated:(id)sender
{
[[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
}
- (IBAction)showPosition: (id)sender
{
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vout_thread_t *p_vout = input_GetVout(p_input);
if (p_vout != NULL) {
var_SetInteger(VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION);
vlc_object_release(p_vout);
}
vlc_object_release(p_input);
}
}
- (IBAction)lockVideosAspectRatio:(id)sender
{
[[VLCCoreInteraction sharedInstance] setAspectRatioIsLocked: ![sender state]];
[sender setState: [[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]];
}
- (BOOL)keyEvent:(NSEvent *)o_event
{
BOOL eventHandled = NO;
NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0) {
unichar key = [characters characterAtIndex: 0];
if (key) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vout_thread_t *p_vout = input_GetVout(p_input);
if (p_vout != NULL) {
/* Escape */
if (key == (unichar) 0x1b) {
if (var_GetBool(p_vout, "fullscreen")) {
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
eventHandled = YES;
}
}
vlc_object_release(p_vout);
}
vlc_object_release(p_input);
}
}
}
return eventHandled;
}
- (IBAction)goToSpecificTime:(id)sender
{
if (sender == o_specificTime_cancel_btn)
{
[NSApp endSheet: o_specificTime_win];
[o_specificTime_win close];
} else if (sender == o_specificTime_ok_btn) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
int64_t timeInSec = 0;
NSString * fieldContent = [o_specificTime_enter_fld stringValue];
if ([[fieldContent componentsSeparatedByString: @":"] count] > 1 &&
[[fieldContent componentsSeparatedByString: @":"] count] <= 3) {
NSArray * ourTempArray = \
[fieldContent componentsSeparatedByString: @":"];
if ([[fieldContent componentsSeparatedByString: @":"] count] == 3) {
timeInSec += ([[ourTempArray firstObject] intValue] * 3600); //h
timeInSec += ([[ourTempArray objectAtIndex:1] intValue] * 60); //m
timeInSec += [[ourTempArray objectAtIndex:2] intValue]; //s
} else {
timeInSec += ([[ourTempArray firstObject] intValue] * 60); //m
timeInSec += [[ourTempArray objectAtIndex:1] intValue]; //s
}
}
else
timeInSec = [fieldContent intValue];
input_Control(p_input, INPUT_SET_TIME, (int64_t)(timeInSec * 1000000));
vlc_object_release(p_input);
}
[NSApp endSheet: o_specificTime_win];
[o_specificTime_win close];
} else {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
/* we can obviously only do that if an input is available */
int64_t pos, length;
length = var_GetInteger(p_input, "length");
[o_specificTime_stepper setMaxValue: (length / CLOCK_FREQ)];
pos = var_GetInteger(p_input, "time");
[self setJumpTimeValue: (pos / CLOCK_FREQ)];
[NSApp beginSheet: o_specificTime_win modalForWindow: \
[NSApp mainWindow] modalDelegate: self didEndSelector: nil \
contextInfo: nil];
[o_specificTime_win makeKeyWindow];
vlc_object_release(p_input);
}
}
}
@end
@implementation VLCControls (NSMenuValidation)
- (BOOL)validateMenuItem:(NSMenuItem *)o_mi
{
return [[VLCMainMenu sharedInstance] validateMenuItem:o_mi];
}
@end
...@@ -55,7 +55,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -55,7 +55,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
*****************************************************************************/ *****************************************************************************/
@class AppleRemote; @class AppleRemote;
@class VLCInfo; @class VLCInfo;
@class VLCControls;
@class VLCMainMenu; @class VLCMainMenu;
@class VLCPlaylist; @class VLCPlaylist;
@class VLCInputManager; @class VLCInputManager;
...@@ -70,8 +69,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -70,8 +69,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate> @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
{ {
IBOutlet VLCMainWindow *o_mainwindow; /* VLCMainWindow */ IBOutlet VLCMainWindow *o_mainwindow; /* VLCMainWindow */
IBOutlet VLCControls * o_controls; /* VLCControls */
IBOutlet VLCPlaylist * o_playlist; /* VLCPlaylist */ IBOutlet VLCPlaylist * o_playlist; /* VLCPlaylist */
} }
...@@ -85,7 +82,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification"; ...@@ -85,7 +82,6 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (VLCMainMenu *)mainMenu; - (VLCMainMenu *)mainMenu;
- (VLCMainWindow *)mainWindow; - (VLCMainWindow *)mainWindow;
- (VLCControls *)controls;
- (VLCBookmarks *)bookmarks; - (VLCBookmarks *)bookmarks;
- (VLCOpen *)open; - (VLCOpen *)open;
- (VLCSimplePrefs *)simplePreferences; - (VLCSimplePrefs *)simplePreferences;
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#import "prefs.h" #import "prefs.h"
#import "playlist.h" #import "playlist.h"
#import "playlistinfo.h" #import "playlistinfo.h"
#import "controls.h"
#import "open.h" #import "open.h"
#import "bookmarks.h" #import "bookmarks.h"
#import "coredialogs.h" #import "coredialogs.h"
...@@ -73,6 +72,8 @@ ...@@ -73,6 +72,8 @@
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
static VLCMain *sharedInstance = nil;
#pragma mark - #pragma mark -
#pragma mark VLC Interface Object Callbacks #pragma mark VLC Interface Object Callbacks
...@@ -91,11 +92,6 @@ int OpenIntf (vlc_object_t *p_this) ...@@ -91,11 +92,6 @@ int OpenIntf (vlc_object_t *p_this)
[VLCVoutWindowController sharedInstance]; [VLCVoutWindowController sharedInstance];
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
[NSBundle loadNibNamed:@"MainWindow" owner:[VLCMain sharedInstance]];
[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
} }
...@@ -105,6 +101,7 @@ void CloseIntf (vlc_object_t *p_this) ...@@ -105,6 +101,7 @@ void CloseIntf (vlc_object_t *p_this)
@autoreleasepool { @autoreleasepool {
msg_Dbg(p_this, "Closing macosx interface"); msg_Dbg(p_this, "Closing macosx interface");
[[VLCMain sharedInstance] applicationWillTerminate:nil]; [[VLCMain sharedInstance] applicationWillTerminate:nil];
sharedInstance = nil;
} }
} }
...@@ -151,8 +148,8 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -151,8 +148,8 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
BOOL nib_main_loaded; /* main nibfile */ BOOL nib_main_loaded; /* main nibfile */
BOOL nib_open_loaded; /* open nibfile */ BOOL nib_open_loaded; /* open nibfile */
BOOL nib_about_loaded; /* about nibfile */ BOOL nib_about_loaded; /* about nibfile */
BOOL nib_prefs_loaded; /* preferences nibfile */ BOOL nib_prefs_loaded; /* preferences xibfile */
BOOL nib_info_loaded; /* information panel nibfile */ BOOL nib_sprefs_loaded; /* simple preferences xibfile */
BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */ BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */ BOOL nib_bookmarks_loaded; /* Bookmarks nibfile */
BOOL b_active_videoplayback; BOOL b_active_videoplayback;
...@@ -162,7 +159,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -162,7 +159,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
VLCSimplePrefs *_sprefs; VLCSimplePrefs *_sprefs;
VLCOpen *_open; VLCOpen *_open;
VLCCoreDialogProvider *_coredialogs; VLCCoreDialogProvider *_coredialogs;
VLCInfo *_info;
VLCEyeTVController *_eyetv; VLCEyeTVController *_eyetv;
VLCBookmarks *_bookmarks; VLCBookmarks *_bookmarks;
VLCCoreInteraction *_coreinteraction; VLCCoreInteraction *_coreinteraction;
...@@ -185,7 +181,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -185,7 +181,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
+ (VLCMain *)sharedInstance + (VLCMain *)sharedInstance
{ {
static dispatch_once_t pred; static dispatch_once_t pred;
static VLCMain *sharedInstance = nil;
dispatch_once(&pred, ^{ dispatch_once(&pred, ^{
sharedInstance = [VLCMain new]; sharedInstance = [VLCMain new];
...@@ -200,9 +195,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -200,9 +195,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
p_intf = NULL; p_intf = NULL;
_open = [[VLCOpen alloc] init]; [VLCApplication sharedApplication].delegate = self;
_mainmenu = [VLCMainMenu sharedInstance];
_eyetv = [[VLCEyeTVController alloc] init];
/* announce our launch to a potential eyetv plugin */ /* announce our launch to a potential eyetv plugin */
[[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"VLCOSXGUIInit" [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"VLCOSXGUIInit"
...@@ -219,6 +212,20 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -219,6 +212,20 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return self; return self;
} }
- (void)dealloc
{
_mainmenu = nil;
_prefs = nil;
_sprefs = nil;
_open = nil;
_coredialogs = nil;
_eyetv = nil;
_bookmarks = nil;
_coreinteraction = nil;
_resume_dialog = nil;
_input_manager = nil;
}
- (void)setIntf: (intf_thread_t *)p_mainintf - (void)setIntf: (intf_thread_t *)p_mainintf
{ {
p_intf = p_mainintf; p_intf = p_mainintf;
...@@ -229,13 +236,35 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -229,13 +236,35 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return p_intf; return p_intf;
} }
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
_open = [[VLCOpen alloc] init];
_mainmenu = [[VLCMainMenu alloc] init];
[NSBundle loadNibNamed:@"MainMenu" owner:_mainmenu];
[NSBundle loadNibNamed:@"MainWindow" owner:[VLCMain sharedInstance]];
[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:nil];
_eyetv = [[VLCEyeTVController alloc] init];
_coreinteraction = [VLCCoreInteraction sharedInstance];
playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
items_at_launch = p_playlist->p_local_category->i_children;
PL_UNLOCK;
#ifdef HAVE_SPARKLE
[[SUUpdater sharedUpdater] setDelegate:self];
#endif
}
- (void)awakeFromNib - (void)awakeFromNib
{ {
if (!p_intf) return; if (!p_intf) return;
var_Create(p_intf, "intf-change", VLC_VAR_BOOL); var_Create(p_intf, "intf-change", VLC_VAR_BOOL);
/* Check if we already did this once. Opening the other nibs calls it too, /* Check if we already did this once */
because VLCMain is the owner */
if (nib_main_loaded) if (nib_main_loaded)
return; return;
...@@ -270,20 +299,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -270,20 +299,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
nib_main_loaded = TRUE; nib_main_loaded = TRUE;
} }
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
_coreinteraction = [VLCCoreInteraction sharedInstance];
playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
items_at_launch = p_playlist->p_local_category->i_children;
PL_UNLOCK;
#ifdef HAVE_SPARKLE
[[SUUpdater sharedUpdater] setDelegate:self];
#endif
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{ {
launched = YES; launched = YES;
...@@ -525,11 +540,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -525,11 +540,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return o_mainwindow; return o_mainwindow;
} }
- (VLCControls *)controls
{
return o_controls;
}
- (VLCInputManager *)inputManager - (VLCInputManager *)inputManager
{ {
return _input_manager; return _input_manager;
...@@ -559,8 +569,8 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable, ...@@ -559,8 +569,8 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
if (!_sprefs) if (!_sprefs)
_sprefs = [[VLCSimplePrefs alloc] init]; _sprefs = [[VLCSimplePrefs alloc] init];
if (!nib_prefs_loaded) if (!nib_sprefs_loaded)
nib_prefs_loaded = [NSBundle loadNibNamed:@"SimplePreferences" owner: _sprefs]; nib_sprefs_loaded = [NSBundle loadNibNamed:@"SimplePreferences" owner: _sprefs];
return _sprefs; return _sprefs;
} }
......
/***************************************************************************** /*****************************************************************************
* misc.m: code not specific to vlc * misc.m: code not specific to vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2003-2014 VLC authors and VideoLAN * Copyright (C) 2003-2015 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
#import "misc.h" #import "misc.h"
#import "intf.h" /* VLCApplication */ #import "intf.h" /* VLCApplication */
#import "MainWindow.h" #import "MainWindow.h"
#import "MainMenu.h"
#import "ControlsBar.h" #import "ControlsBar.h"
#import "controls.h"
#import "CoreInteraction.h" #import "CoreInteraction.h"
#import <CoreAudio/CoreAudio.h> #import <CoreAudio/CoreAudio.h>
#import <vlc_keys.h> #import <vlc_keys.h>
...@@ -791,7 +791,7 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -791,7 +791,7 @@ void _drawFrameInRect(NSRect frameRect)
- (void)mouseDown: (NSEvent *)ourEvent - (void)mouseDown: (NSEvent *)ourEvent
{ {
if ( [ourEvent clickCount] > 1 ) if ( [ourEvent clickCount] > 1 )
[[[VLCMain sharedInstance] controls] goToSpecificTime: nil]; [[[VLCMain sharedInstance] mainMenu] goToSpecificTime: nil];
else else
{ {
if (o_remaining_identifier) { if (o_remaining_identifier) {
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#import "bookmarks.h" #import "bookmarks.h"
#import "playlistinfo.h" #import "playlistinfo.h"
#import "playlist.h" #import "playlist.h"
#import "controls.h"
#import "misc.h" #import "misc.h"
#import "open.h" #import "open.h"
#import "MainMenu.h" #import "MainMenu.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment