diff --git a/modules/gui/macosx/UI/MainMenu.xib b/modules/gui/macosx/UI/MainMenu.xib index ee8d623a61..e543134225 100644 --- a/modules/gui/macosx/UI/MainMenu.xib +++ b/modules/gui/macosx/UI/MainMenu.xib @@ -145,9 +145,6 @@ - - - @@ -369,24 +366,6 @@ - - - - - - - - - - - - - - - - - - diff --git a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib index bf6fb3d446..7914071e39 100644 --- a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib +++ b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib @@ -28,9 +28,9 @@ - + - + + + + + + + + + + + + + + + + - + + + + + + - + + @@ -373,7 +430,7 @@ - + @@ -381,8 +438,12 @@ + + + + @@ -750,5 +811,9 @@ + + + + diff --git a/modules/gui/macosx/main/macosx.m b/modules/gui/macosx/main/macosx.m index cd5fef8ef3..7fc40b2318 100644 --- a/modules/gui/macosx/main/macosx.m +++ b/modules/gui/macosx/main/macosx.m @@ -108,15 +108,6 @@ int WindowOpen (vout_window_t *); #define DIM_KEYBOARD_PLAYBACK_TEXT N_("Dim keyboard backlight during fullscreen playback") #define DIM_KEYBOARD_PLAYBACK_LONGTEXT N_("Turn off the MacBook keyboard backlight while a video is playing in fullscreen. Automatic brightness adjustment should be disabled in System Preferences.") -#define JUMPBUTTONS_TEXT N_("Show Previous & Next Buttons") -#define JUMPBUTTONS_LONGTEXT N_("Shows the previous and next buttons in the main window.") - -#define PLAYMODEBUTTONS_TEXT N_("Show Shuffle & Repeat Buttons") -#define PLAYMODEBUTTONS_LONGTEXT N_("Shows the shuffle and repeat buttons in the main window.") - -#define EFFECTSBUTTON_TEXT N_("Show Audio Effects Button") -#define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main window.") - #define ITUNES_TEXT N_("Control external music players") #define ITUNES_LONGTEXT N_("VLC will pause and resume supported music players on playback.") @@ -152,9 +143,6 @@ vlc_module_begin() add_bool("macosx-nativefullscreenmode", false, NATIVE_FULLSCREEN_MODE_ON_LION_TEXT, NATIVE_FULLSCREEN_MODE_ON_LION_LONGTEXT, false) add_bool("macosx-statusicon", true, DISPLAY_STATUS_ICONMENU_TEXT, DISPLAY_STATUS_ICONMENU_LONGTEXT, false) add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true) - add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false) - add_bool("macosx-show-playmode-buttons", false, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false) - add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false) add_integer_with_range("macosx-max-volume", 125, 60, 200, VOLUME_MAX_TEXT, VOLUME_MAX_TEXT, true) add_bool("macosx-large-text", false, LARGE_LISTFONT_TEXT, LARGE_LISTFONT_TEXT, false) @@ -182,6 +170,9 @@ vlc_module_begin() add_obsolete_bool("macosx-autosave-volume") /* since 2.1.0 */ add_obsolete_bool("macosx-show-sidebar") /* since 3.0.1 */ add_obsolete_bool("macosx-interfacestyle") /* since 4.0.0 */ + add_obsolete_bool("macosx-show-playmode-buttons") /* since 4.0.0 */ + add_obsolete_bool("macosx-show-playback-buttons") /* since 4.0.0 */ + add_obsolete_bool("macosx-show-effects-button") /* since 4.0.0 */ add_submodule() set_description("Mac OS X Video Output Provider") diff --git a/modules/gui/macosx/menus/VLCMainMenu.h b/modules/gui/macosx/menus/VLCMainMenu.h index b7091c7bde..4b6ea5cfaf 100644 --- a/modules/gui/macosx/menus/VLCMainMenu.h +++ b/modules/gui/macosx/menus/VLCMainMenu.h @@ -211,8 +211,6 @@ - (void)releaseRepresentedObjects:(NSMenu *)the_menu; -- (void)setRateControlsEnabled:(BOOL)b_enabled; - - (IBAction)openAddonManager:(id)sender; - (IBAction)intfOpenFile:(id)sender; @@ -222,9 +220,6 @@ - (IBAction)intfOpenCapture:(id)sender; - (IBAction)savePlaylist:(id)sender; -- (IBAction)toggleEffectsButton:(id)sender; -- (IBAction)toggleJumpButtons:(id)sender; -- (IBAction)togglePlaymodeButtons:(id)sender; - (IBAction)showLibraryFolders:(id)sender; - (IBAction)play:(id)sender; diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m index 13b2be52f9..e2b67ec4e4 100644 --- a/modules/gui/macosx/menus/VLCMainMenu.m +++ b/modules/gui/macosx/menus/VLCMainMenu.m @@ -365,12 +365,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) { [_findItem setTitle: _NS("Find")]; [_viewMenu setTitle: _NS("View")]; - [_toggleJumpButtons setTitle: _NS("Show Previous & Next Buttons")]; - [_toggleJumpButtons setState: var_InheritBool(getIntf(), "macosx-show-playback-buttons")]; - [_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")]; - [_togglePlaymodeButtons setState: var_InheritBool(getIntf(), "macosx-show-playmode-buttons")]; - [_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")]; - [_toggleEffectsButton setState: var_InheritBool(getIntf(), "macosx-show-effects-button")]; [_showLibraryFolders setTitle: _NS("Show Library Folders...")]; [_playlistTableColumns setTitle: _NS("Playlist Table Columns")]; @@ -660,9 +654,12 @@ typedef NS_ENUM(NSInteger, VLCObjectType) { [_postprocessing setEnabled:YES]; [self setSubmenusEnabled:YES]; input_item_Release(p_mediaItem); + + [self setRateControlsEnabled:_playerController.rateChangable]; } else { [_postprocessing setEnabled:NO]; [self setSubmenusEnabled:NO]; + [self setRateControlsEnabled:NO]; } } @@ -736,35 +733,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) { #pragma mark - View -- (IBAction)toggleEffectsButton:(id)sender -{ - BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-effects-button"); - config_PutInt("macosx-show-effects-button", b_value); - [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] libraryWindow] controlsBar] toggleEffectsButton]; - [_toggleEffectsButton setState: b_value]; -} - -- (IBAction)toggleJumpButtons:(id)sender -{ - BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-playback-buttons"); - config_PutInt("macosx-show-playback-buttons", b_value); - - [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] libraryWindow] controlsBar] toggleJumpButtons]; - [[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *window) { - [[window controlsBar] toggleForwardBackwardMode: b_value]; - }]; - - [_toggleJumpButtons setState: b_value]; -} - -- (IBAction)togglePlaymodeButtons:(id)sender -{ - BOOL b_value = !var_InheritBool(getIntf(), "macosx-show-playmode-buttons"); - config_PutInt("macosx-show-playmode-buttons", b_value); - [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] libraryWindow] controlsBar] togglePlaymodeButtons]; - [_togglePlaymodeButtons setState: b_value]; -} - - (IBAction)showLibraryFolders:(id)sender { if (!_libraryFoldersController) { diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m b/modules/gui/macosx/playlist/VLCPlayerController.m index 50dd9f5339..fc97049fd3 100644 --- a/modules/gui/macosx/playlist/VLCPlayerController.m +++ b/modules/gui/macosx/playlist/VLCPlayerController.m @@ -1658,12 +1658,12 @@ static const struct vlc_player_aout_cbs player_aout_callbacks = { - (void)incrementVolume { - vlc_player_aout_SetVolume(_p_player, _volume + 0.05); + vlc_player_aout_IncrementVolume(_p_player, 1, NULL); } - (void)decrementVolume { - vlc_player_aout_SetVolume(_p_player, _volume - 0.05); + vlc_player_aout_DecrementVolume(_p_player, 1, NULL); } - (void)muteChanged:(BOOL)mute diff --git a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h index a5e3ce3637..3d8f801cf2 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h +++ b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.h @@ -54,7 +54,6 @@ @property (readonly) BOOL nativeFullscreenMode; - (CGFloat)height; -- (void)toggleForwardBackwardMode:(BOOL)b_alt; - (IBAction)play:(id)sender; - (IBAction)bwd:(id)sender; diff --git a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m index 2806825f46..1471454c59 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m +++ b/modules/gui/macosx/windows/mainwindow/VLCControlsBarCommon.m @@ -109,7 +109,10 @@ [self.playButton setImage: _playImage]; [self.playButton setAlternateImage: _pressedPlayImage]; - NSColor *timeFieldTextColor = [NSColor colorWithCalibratedRed:0.64 green:0.64 blue:0.64 alpha:100.0]; + [self.timeSlider setHidden:NO]; + [self updateTimeSlider:nil]; + + NSColor *timeFieldTextColor = [NSColor controlTextColor]; [self.timeField setTextColor: timeFieldTextColor]; [self.timeField setFont:[NSFont titleBarFontOfSize:10.0]]; [self.timeField setAlignment: NSCenterTextAlignment]; @@ -122,8 +125,14 @@ self.fullscreenButtonWidthConstraint.constant = 0; } - if (config_GetInt("macosx-show-playback-buttons")) - [self toggleForwardBackwardMode: YES]; + self.backwardButton.accessibilityTitle = _NS("Previous"); + self.backwardButton.accessibilityLabel = _NS("Go to previous item"); + + self.forwardButton.accessibilityTitle = _NS("Next"); + self.forwardButton.accessibilityLabel = _NS("Go to next item"); + + [self.forwardButton setAction:@selector(fwd:)]; + [self.backwardButton setAction:@selector(bwd:)]; [self playerStateUpdated:nil]; } @@ -138,32 +147,6 @@ return [self.bottomBarView frame].size.height; } -- (void)toggleForwardBackwardMode:(BOOL)b_alt -{ - if (b_alt == YES) { - /* change the accessibility help for the backward/forward buttons accordingly */ - self.backwardButton.accessibilityTitle = _NS("Backward"); - self.backwardButton.accessibilityLabel = _NS("Seek backward"); - - self.forwardButton.accessibilityTitle = _NS("Forward"); - self.forwardButton.accessibilityLabel = _NS("Seek forward"); - - [self.forwardButton setAction:@selector(alternateForward:)]; - [self.backwardButton setAction:@selector(alternateBackward:)]; - - } else { - /* change the accessibility help for the backward/forward buttons accordingly */ - self.backwardButton.accessibilityTitle = _NS("Previous"); - self.backwardButton.accessibilityLabel = _NS("Go to previous item"); - - self.forwardButton.accessibilityTitle = _NS("Next"); - self.forwardButton.accessibilityLabel = _NS("Go to next item"); - - [self.forwardButton setAction:@selector(fwd:)]; - [self.backwardButton setAction:@selector(bwd:)]; - } -} - #pragma mark - #pragma mark Button Actions @@ -242,17 +225,6 @@ } } -// alternative actions for forward / backward buttons when next / prev are activated -- (IBAction)alternateForward:(id)sender -{ - [_playerController jumpForwardExtraShort]; -} - -- (IBAction)alternateBackward:(id)sender -{ - [_playerController jumpBackwardExtraShort]; -} - - (IBAction)timeSliderAction:(id)sender { float f_updatedDelta; @@ -295,8 +267,6 @@ { input_item_t *p_item = _playerController.currentMedia; - [self.timeSlider setHidden:NO]; - if (!p_item) { // Nothing playing [self.timeSlider setKnobHidden:YES]; diff --git a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h index 2296e3b77f..14c9909a2d 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h +++ b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.h @@ -1,10 +1,10 @@ /***************************************************************************** - * ControlsBar.h: MacOS X interface module + * VLCMainWindowControlsBar.h: MacOS X interface module ***************************************************************************** * Copyright (C) 2012-2019 VLC authors and VideoLAN * - * Authors: Felix Paul Kühne - * David Fuhrmann + * Authors: Felix Paul Kühne + * David Fuhrmann * * 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 @@ -38,36 +38,15 @@ @property (readwrite, strong) IBOutlet NSButton *stopButton; @property (readwrite, strong) IBOutlet NSButton *prevButton; -@property (readwrite, strong) IBOutlet NSLayoutConstraint *prevButtonWidthConstraint; @property (readwrite, strong) IBOutlet NSButton *nextButton; -@property (readwrite, strong) IBOutlet NSLayoutConstraint *nextButtonWidthConstraint; - -@property (readwrite, strong) IBOutlet NSButton *playlistButton; -@property (readwrite, strong) IBOutlet NSButton *repeatButton; -@property (readwrite, strong) IBOutlet NSLayoutConstraint *repeatButtonWidthConstraint; - -@property (readwrite, strong) IBOutlet NSButton *shuffleButton; -@property (readwrite, strong) IBOutlet NSLayoutConstraint *shuffleButtonWidthConstraint; @property (readwrite, strong) IBOutlet VLCVolumeSlider *volumeSlider; @property (readwrite, strong) IBOutlet NSButton *volumeDownButton; @property (readwrite, strong) IBOutlet NSButton *volumeUpButton; -@property (readwrite, strong) IBOutlet NSButton *effectsButton; -@property (readwrite, strong) IBOutlet NSLayoutConstraint *effectsButtonWidthConstraint; - - (IBAction)stop:(id)sender; -- (IBAction)shuffle:(id)sender; - (IBAction)volumeAction:(id)sender; -- (IBAction)effects:(id)sender; - -- (IBAction)repeat:(id)sender; - -- (IBAction)togglePlaylist:(id)sender; - -- (void)toggleEffectsButton; -- (void)toggleJumpButtons; -- (void)togglePlaymodeButtons; @end + diff --git a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m index 5277d9ae62..e7a113e729 100644 --- a/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m +++ b/modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m @@ -1,10 +1,10 @@ /***************************************************************************** - * ControlsBar.m: MacOS X interface module + * VLCMainWindowControlsBar.m: MacOS X interface module ***************************************************************************** - * Copyright (C) 2012-2016 VLC authors and VideoLAN + * Copyright (C) 2012-2019 VLC authors and VideoLAN * - * Authors: Felix Paul Kühne - * David Fuhrmann + * Authors: Felix Paul Kühne + * David Fuhrmann * * 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 @@ -21,18 +21,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#import "VLCMainWindowControlsBar.h" #import "VLCControlsBarCommon.h" -#import - #import "extensions/NSString+Helpers.h" -#import "main/CompatibilityFixes.h" #import "main/VLCMain.h" -#import "menus/VLCMainMenu.h" -#import "windows/mainwindow/VLCMainWindowControlsBar.h" #import "playlist/VLCPlaylistController.h" #import "playlist/VLCPlayerController.h" -#import "library/VLCLibraryWindow.h" + +CGFloat VLCVolumeMaximum = 2.; +CGFloat VLCVolumeDefault = 1.; /***************************************************************************** * VLCMainWindowControlsBar @@ -42,20 +40,9 @@ @interface VLCMainWindowControlsBar() { - NSImage * _repeatImage; - NSImage * _pressedRepeatImage; - NSImage * _repeatAllImage; - NSImage * _pressedRepeatAllImage; - NSImage * _repeatOneImage; - NSImage * _pressedRepeatOneImage; - NSImage * _shuffleImage; - NSImage * _pressedShuffleImage; - NSImage * _shuffleOnImage; - NSImage * _pressedShuffleOnImage; VLCPlaylistController *_playlistController; VLCPlayerController *_playerController; } - @end @implementation VLCMainWindowControlsBar @@ -70,22 +57,11 @@ [notificationCenter addObserver:self selector:@selector(updatePlaybackControls:) name:VLCPlaylistCurrentItemChanged object:nil]; [notificationCenter addObserver:self selector:@selector(updateVolumeSlider:) name:VLCPlayerVolumeChanged object:nil]; [notificationCenter addObserver:self selector:@selector(updateVolumeSlider:) name:VLCPlayerMuteChanged object:nil]; - [notificationCenter addObserver:self selector:@selector(playbackOrderUpdated:) name:VLCPlaybackOrderChanged object:nil]; - [notificationCenter addObserver:self selector:@selector(playbackRepeatChanged:) name:VLCPlaybackRepeatChanged object:nil]; + [notificationCenter addObserver:self selector:@selector(playbackStateChanged:) name:VLCPlayerStateChanged object:nil]; [self.stopButton setToolTip: _NS("Stop")]; self.stopButton.accessibilityLabel = self.stopButton.toolTip; - [self.playlistButton setToolTip: _NS("Show/Hide Playlist")]; - self.playlistButton.accessibilityLabel = self.playlistButton.toolTip; - - [self.repeatButton setToolTip: _NS("Repeat")]; - self.repeatButton.accessibilityLabel = _NS("Change repeat mode. Modes: repeat one, repeat all and no repeat."); - self.repeatButton.accessibilityTitle = self.repeatButton.toolTip; - - [self.shuffleButton setToolTip: _NS("Shuffle")]; - self.shuffleButton.accessibilityLabel = self.shuffleButton.toolTip; - NSString *volumeTooltip = [NSString stringWithFormat:_NS("Volume: %i %%"), 100]; [self.volumeSlider setToolTip: volumeTooltip]; self.volumeSlider.accessibilityLabel = _NS("Volume"); @@ -96,37 +72,12 @@ [self.volumeUpButton setToolTip: _NS("Full Volume")]; self.volumeUpButton.accessibilityLabel = self.volumeUpButton.toolTip; - [self.effectsButton setToolTip: _NS("Audio Effects")]; - self.effectsButton.accessibilityTitle = _NS("Open Audio Effects window"); - self.effectsButton.accessibilityLabel = self.effectsButton.toolTip; - [self.stopButton setImage: imageFromRes(@"stop")]; [self.stopButton setAlternateImage: imageFromRes(@"stop-pressed")]; - [self.playlistButton setImage: imageFromRes(@"playlist-btn")]; - [self.playlistButton setAlternateImage: imageFromRes(@"playlist-btn-pressed")]; - _repeatImage = imageFromRes(@"repeat"); - _pressedRepeatImage = imageFromRes(@"repeat-pressed"); - _repeatAllImage = imageFromRes(@"repeat-all"); - _pressedRepeatAllImage = imageFromRes(@"repeat-all-pressed"); - _repeatOneImage = imageFromRes(@"repeat-one"); - _pressedRepeatOneImage = imageFromRes(@"repeat-one-pressed"); - _shuffleImage = imageFromRes(@"shuffle"); - _pressedShuffleImage = imageFromRes(@"shuffle-pressed"); - _shuffleOnImage = imageFromRes(@"shuffle-blue"); - _pressedShuffleOnImage = imageFromRes(@"shuffle-blue-pressed"); - [self.volumeDownButton setImage: imageFromRes(@"volume-low")]; [self.volumeUpButton setImage: imageFromRes(@"volume-high")]; - if (self.nativeFullscreenMode) { - [self.effectsButton setImage: imageFromRes(@"effects-one-button")]; - [self.effectsButton setAlternateImage: imageFromRes(@"effects-one-button-pressed")]; - } else { - [self.effectsButton setImage: imageFromRes(@"effects-double-buttons")]; - [self.effectsButton setAlternateImage: imageFromRes(@"effects-double-buttons-pressed")]; - } - [self.fullscreenButton setImage: imageFromRes(@"fullscreen-double-buttons")]; [self.fullscreenButton setAlternateImage: imageFromRes(@"fullscreen-double-buttons-pressed")]; @@ -134,158 +85,12 @@ [self.prevButton setAlternateImage: imageFromRes(@"previous-6btns-pressed")]; [self.nextButton setImage: imageFromRes(@"next-6btns")]; [self.nextButton setAlternateImage: imageFromRes(@"next-6btns-pressed")]; - [self.repeatButton setImage: _repeatImage]; - [self.repeatButton setAlternateImage: _pressedRepeatImage]; - [self.shuffleButton setImage: _shuffleImage]; - [self.shuffleButton setAlternateImage: _pressedShuffleImage]; - - BOOL b_mute = ![_playerController mute]; - [self.volumeSlider setEnabled: b_mute]; - [self.volumeSlider setMaxValue: AOUT_VOLUME_MAX]; - [self.volumeSlider setDefaultValue: AOUT_VOLUME_DEFAULT]; - [self.volumeUpButton setEnabled: b_mute]; - - // configure optional buttons - if (!var_InheritBool(getIntf(), "macosx-show-effects-button")) - [self removeEffectsButton:NO]; - if (!var_InheritBool(getIntf(), "macosx-show-playmode-buttons")) - [self removePlaymodeButtons:NO]; + [self.volumeSlider setMaxValue: VLCVolumeMaximum]; + [self.volumeSlider setDefaultValue: VLCVolumeDefault]; + [self updateVolumeSlider:nil]; - if (!var_InheritBool(getIntf(), "macosx-show-playback-buttons")) - [self removeJumpButtons:NO]; - - // FIXME: make sure that buttons appear in the correct state -} - -#pragma mark - -#pragma mark interface customization - - -- (void)hideButtonWithConstraint:(NSLayoutConstraint *)constraint animation:(BOOL)animation -{ - NSAssert([constraint.firstItem isKindOfClass:[NSButton class]], @"Constraint must be for NSButton object"); - - NSLayoutConstraint *animatedConstraint = animation ? constraint.animator : constraint; - animatedConstraint.constant = 0; -} - -- (void)showButtonWithConstraint:(NSLayoutConstraint *)constraint animation:(BOOL)animation -{ - NSAssert([constraint.firstItem isKindOfClass:[NSButton class]], @"Constraint must be for NSButton object"); - - NSLayoutConstraint *animatedConstraint = animation ? constraint.animator : constraint; - animatedConstraint.constant = ((NSButton *)constraint.firstItem).image.size.width; -} - -- (void)toggleEffectsButton -{ - if (var_InheritBool(getIntf(), "macosx-show-effects-button")) - [self addEffectsButton:YES]; - else - [self removeEffectsButton:YES]; -} - -- (void)addEffectsButton:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - [self showButtonWithConstraint:self.effectsButtonWidthConstraint animation:withAnimation]; - - id button = withAnimation ? self.fullscreenButton.animator : self.fullscreenButton; - if (!self.nativeFullscreenMode) { - [button setImage: imageFromRes(@"fullscreen-double-buttons")]; - [button setAlternateImage: imageFromRes(@"fullscreen-double-buttons-pressed")]; - } - [NSAnimationContext endGrouping]; -} - -- (void)removeEffectsButton:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - [self hideButtonWithConstraint:self.effectsButtonWidthConstraint animation:withAnimation]; - - id button = withAnimation ? self.fullscreenButton.animator : self.fullscreenButton; - if (!self.nativeFullscreenMode) { - [button setImage: imageFromRes(@"fullscreen-one-button")]; - [button setAlternateImage: imageFromRes(@"fullscreen-one-button-pressed")]; - } - [NSAnimationContext endGrouping]; -} - -- (void)toggleJumpButtons -{ - if (var_InheritBool(getIntf(), "macosx-show-playback-buttons")) - [self addJumpButtons:YES]; - else - [self removeJumpButtons:YES]; -} - -- (void)addJumpButtons:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - [self showButtonWithConstraint:self.prevButtonWidthConstraint animation:withAnimation]; - [self showButtonWithConstraint:self.nextButtonWidthConstraint animation:withAnimation]; - - id backwardButton = withAnimation ? self.backwardButton.animator : self.backwardButton; - id forwardButton = withAnimation ? self.forwardButton.animator : self.forwardButton; - [forwardButton setImage:imageFromRes(@"forward-6btns")]; - [forwardButton setAlternateImage:imageFromRes(@"forward-6btns-pressed")]; - [backwardButton setImage:imageFromRes(@"backward-6btns")]; - [backwardButton setAlternateImage:imageFromRes(@"backward-6btns-pressed")]; - - [NSAnimationContext endGrouping]; - - [self toggleForwardBackwardMode: YES]; -} - -- (void)removeJumpButtons:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - [self hideButtonWithConstraint:self.prevButtonWidthConstraint animation:withAnimation]; - [self hideButtonWithConstraint:self.nextButtonWidthConstraint animation:withAnimation]; - - id backwardButton = withAnimation ? self.backwardButton.animator : self.backwardButton; - id forwardButton = withAnimation ? self.forwardButton.animator : self.forwardButton; - [forwardButton setImage:imageFromRes(@"forward-3btns")]; - [forwardButton setAlternateImage:imageFromRes(@"forward-3btns-pressed")]; - [backwardButton setImage:imageFromRes(@"backward-3btns")]; - [backwardButton setAlternateImage:imageFromRes(@"backward-3btns-pressed")]; - [NSAnimationContext endGrouping]; - - [self toggleForwardBackwardMode: NO]; -} - -- (void)togglePlaymodeButtons -{ - if (var_InheritBool(getIntf(), "macosx-show-playmode-buttons")) - [self addPlaymodeButtons:YES]; - else - [self removePlaymodeButtons:YES]; -} - -- (void)addPlaymodeButtons:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - [self showButtonWithConstraint:self.repeatButtonWidthConstraint animation:withAnimation]; - [self showButtonWithConstraint:self.shuffleButtonWidthConstraint animation:withAnimation]; - - id button = withAnimation ? self.playlistButton.animator : self.playlistButton; - [button setImage:imageFromRes(@"playlist-btn")]; - [button setAlternateImage:imageFromRes(@"playlist-btn-pressed")]; - [NSAnimationContext endGrouping]; -} - -- (void)removePlaymodeButtons:(BOOL)withAnimation -{ - [NSAnimationContext beginGrouping]; - - [self hideButtonWithConstraint:self.repeatButtonWidthConstraint animation:withAnimation]; - [self hideButtonWithConstraint:self.shuffleButtonWidthConstraint animation:withAnimation]; - - id button = withAnimation ? self.playlistButton.animator : self.playlistButton; - [button setImage:imageFromRes(@"playlist-1btn")]; - [button setAlternateImage:imageFromRes(@"playlist-1btn-pressed")]; - [NSAnimationContext endGrouping]; + [self playbackStateChanged:nil]; } #pragma mark - @@ -307,100 +112,14 @@ [_playlistController playNextItem]; } -- (void)setRepeatOne -{ - [self.repeatButton setImage: _repeatOneImage]; - [self.repeatButton setAlternateImage: _pressedRepeatOneImage]; -} - -- (void)setRepeatAll -{ - [self.repeatButton setImage: _repeatAllImage]; - [self.repeatButton setAlternateImage: _pressedRepeatAllImage]; -} - -- (void)setRepeatOff -{ - [self.repeatButton setImage: _repeatImage]; - [self.repeatButton setAlternateImage: _pressedRepeatImage]; -} - -- (IBAction)repeat:(id)sender -{ - enum vlc_playlist_playback_repeat repeatState = _playlistController.playbackRepeat; - switch (repeatState) { - case VLC_PLAYLIST_PLAYBACK_REPEAT_NONE: - /* was: no repeating at all, switching to Repeat One */ - _playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT; - break; - case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT: - /* was: Repeat One, switching to Repeat All */ - _playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_ALL; - break; - - default: - /* was: Repeat All, switching to Repeat Off */ - _playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_NONE; - break; - } -} - -- (void)playbackOrderUpdated:(NSNotification *)aNotification -{ - if (_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL) { - [self.shuffleButton setImage: _shuffleImage]; - [self.shuffleButton setAlternateImage: _pressedShuffleImage]; - } else { - [self.shuffleButton setImage: _shuffleOnImage]; - [self.shuffleButton setAlternateImage: _pressedShuffleOnImage]; - } -} - -- (void)playbackRepeatChanged:(NSNotification *)aNotification -{ - enum vlc_playlist_playback_repeat repeatState = _playlistController.playbackRepeat; - switch (repeatState) { - case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL: - [self setRepeatAll]; - break; - - case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT: - [self setRepeatOne]; - break; - - default: - [self setRepeatOff]; - break; - } -} - -- (IBAction)shuffle:(id)sender -{ - if (_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL) { - _playlistController.playbackOrder = VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM; - } else { - _playlistController.playbackOrder = VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL; - } -} - -- (IBAction)togglePlaylist:(id)sender -{ - // FIXME: this is a NO-OP -} - - (IBAction)volumeAction:(id)sender { if (sender == self.volumeSlider) - [_playerController setVolume: [sender floatValue]]; + [_playerController setVolume:[sender floatValue]]; else if (sender == self.volumeDownButton) [_playerController toggleMute]; else - [_playerController setVolume: AOUT_VOLUME_MAX]; -} - -- (IBAction)effects:(id)sender -{ - [[[VLCMain sharedInstance] mainMenu] showAudioEffects: sender]; + [_playerController setVolume:VLCVolumeMaximum]; } #pragma mark - @@ -422,26 +141,28 @@ [self.volumeUpButton setEnabled: !b_muted]; } +- (void)playbackStateChanged:(NSNotification *)aNotification +{ + switch (_playerController.playerState) { + case VLC_PLAYER_STATE_STOPPING: + case VLC_PLAYER_STATE_STOPPED: + self.stopButton.enabled = NO; + break; + + default: + self.stopButton.enabled = YES; + break; + } +} + - (void)updatePlaybackControls:(NSNotification *)aNotification { - bool b_input = false; bool b_seekable = _playerController.seekable; - bool b_control = _playerController.rateChangable; // FIXME: re-add chapter navigation as needed bool b_chapters = false; - input_item_t *p_item = _playerController.currentMedia; - b_input = p_item != NULL; - if (p_item) { - b_input = YES; - input_item_Release(p_item); - } - - [self.stopButton setEnabled: b_input]; [self.prevButton setEnabled: (b_seekable || _playlistController.hasPreviousPlaylistItem || b_chapters)]; [self.nextButton setEnabled: (b_seekable || _playlistController.hasNextPlaylistItem || b_chapters)]; - - [[[VLCMain sharedInstance] mainMenu] setRateControlsEnabled: b_control]; } @end