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