Commit a0140fe5 authored by David Fuhrmann's avatar David Fuhrmann

macosx: create new classes for all controls bar related code

Now, we have two classes (instantiated from the xib file for each window)
with controls bar stuff:
- VLCControlsBarCommon holds all code common for main and detached window
- VLCMainWindowControlsBar adds code specific for the main window bar

With that, we can avoid all these redundant code for o_detached_*, furthermore
this decouples all detached window control bar stuff from MainWindow.m.

The objects can be accessed through the controlsBar method.
parent b219b338
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -977,6 +977,8 @@ ...@@ -977,6 +977,8 @@
DC769AB8085DF0DB001A838D /* wizard.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = wizard.h; path = ../../../modules/gui/macosx/wizard.h; sourceTree = SOURCE_ROOT; }; DC769AB8085DF0DB001A838D /* wizard.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; name = wizard.h; path = ../../../modules/gui/macosx/wizard.h; sourceTree = SOURCE_ROOT; };
DCE7BD0608A5724D007B10AE /* bookmarks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = bookmarks.m; path = ../../../modules/gui/macosx/bookmarks.m; sourceTree = SOURCE_ROOT; }; DCE7BD0608A5724D007B10AE /* bookmarks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = bookmarks.m; path = ../../../modules/gui/macosx/bookmarks.m; sourceTree = SOURCE_ROOT; };
DCE7BD0708A5724D007B10AE /* bookmarks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bookmarks.h; path = ../../../modules/gui/macosx/bookmarks.h; sourceTree = SOURCE_ROOT; }; DCE7BD0708A5724D007B10AE /* bookmarks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bookmarks.h; path = ../../../modules/gui/macosx/bookmarks.h; sourceTree = SOURCE_ROOT; };
E0382C00160BA09E0031D7FF /* ControlsBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ControlsBar.h; path = ../../../modules/gui/macosx/ControlsBar.h; sourceTree = SOURCE_ROOT; };
E0382C01160BA09E0031D7FF /* ControlsBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ControlsBar.m; path = ../../../modules/gui/macosx/ControlsBar.m; sourceTree = SOURCE_ROOT; };
E06CF7F416020F6200C698B7 /* Windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Windows.h; path = ../../../modules/gui/macosx/Windows.h; sourceTree = SOURCE_ROOT; }; E06CF7F416020F6200C698B7 /* Windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Windows.h; path = ../../../modules/gui/macosx/Windows.h; sourceTree = SOURCE_ROOT; };
E06CF7F516020F6200C698B7 /* Windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Windows.m; path = ../../../modules/gui/macosx/Windows.m; sourceTree = SOURCE_ROOT; }; E06CF7F516020F6200C698B7 /* Windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Windows.m; path = ../../../modules/gui/macosx/Windows.m; sourceTree = SOURCE_ROOT; };
F69B0CA702E24F6401A80112 /* English */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.strings; name = English; path = Resources/English.lproj/InfoPlist.strings; sourceTree = "<group>"; }; F69B0CA702E24F6401A80112 /* English */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.strings; name = English; path = Resources/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
...@@ -1056,6 +1058,8 @@ ...@@ -1056,6 +1058,8 @@
CC448A6113B68A0B009F72E0 /* CoreInteraction.m */, CC448A6113B68A0B009F72E0 /* CoreInteraction.m */,
CC448A6213B68A0B009F72E0 /* MainWindow.h */, CC448A6213B68A0B009F72E0 /* MainWindow.h */,
CC448A6313B68A0B009F72E0 /* MainWindow.m */, CC448A6313B68A0B009F72E0 /* MainWindow.m */,
E0382C00160BA09E0031D7FF /* ControlsBar.h */,
E0382C01160BA09E0031D7FF /* ControlsBar.m */,
CC4A33220F8CB017000FC4A7 /* coredialogs.h */, CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
CC4A33210F8CB017000FC4A7 /* coredialogs.m */, CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
5CCED71014C0D4A90057F8D1 /* ExtensionsDialogProvider.h */, 5CCED71014C0D4A90057F8D1 /* ExtensionsDialogProvider.h */,
......
/*****************************************************************************
* ControlsBar.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* 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.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
@class VLCFSPanel;
/*****************************************************************************
* VLCControlsBarCommon
*
* Holds all outlets, actions and code common for controls bar in detached
* and in main window.
*****************************************************************************/
@interface VLCControlsBarCommon : NSObject
{
IBOutlet id o_associated_window;
IBOutlet id o_bottombar_view;
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
IBOutlet id o_progress_view;
IBOutlet id o_time_sld;
IBOutlet id o_time_sld_fancygradient_view;
IBOutlet id o_time_sld_background;
IBOutlet id o_progress_bar;
IBOutlet id o_time_fld;
IBOutlet id o_fullscreen_btn;
IBOutlet id o_resize_view;
NSImage * o_pause_img;
NSImage * o_pause_pressed_img;
NSImage * o_play_img;
NSImage * o_play_pressed_img;
NSTimeInterval last_fwd_event;
NSTimeInterval last_bwd_event;
BOOL just_triggered_next;
BOOL just_triggered_previous;
BOOL b_nativeFullscreenMode;
BOOL b_dark_interface;
}
@property (readonly) id bottomBarView;
- (IBAction)play:(id)sender;
- (IBAction)bwd:(id)sender;
- (IBAction)fwd:(id)sender;
- (IBAction)timeSliderAction:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (void)updateTimeSlider;
- (void)drawFancyGradientEffectForTimeSlider;
- (void)updateControls;
- (void)setPause;
- (void)setPlay;
- (void)setFullscreenState:(BOOL)b_fullscreen;
@end
/*****************************************************************************
* VLCMainWindowControlsBar
*
* Holds all specific outlets, actions and code for the main window controls bar.
*****************************************************************************/
@interface VLCMainWindowControlsBar : VLCControlsBarCommon
{
IBOutlet id o_stop_btn;
IBOutlet id o_playlist_btn;
IBOutlet id o_repeat_btn;
IBOutlet id o_shuffle_btn;
IBOutlet id o_volume_sld;
IBOutlet id o_volume_track_view;
IBOutlet id o_volume_down_btn;
IBOutlet id o_volume_up_btn;
IBOutlet id o_effects_btn;
NSImage * o_repeat_img;
NSImage * o_repeat_pressed_img;
NSImage * o_repeat_all_img;
NSImage * o_repeat_all_pressed_img;
NSImage * o_repeat_one_img;
NSImage * o_repeat_one_pressed_img;
NSImage * o_shuffle_img;
NSImage * o_shuffle_pressed_img;
NSImage * o_shuffle_on_img;
NSImage * o_shuffle_on_pressed_img;
NSButton * o_prev_btn;
NSButton * o_next_btn;
BOOL b_show_jump_buttons;
BOOL b_show_playmode_buttons;
}
- (IBAction)stop:(id)sender;
- (IBAction)shuffle:(id)sender;
- (IBAction)volumeAction:(id)sender;
- (IBAction)effects:(id)sender;
- (void)setRepeatOne;
- (void)setRepeatAll;
- (void)setRepeatOff;
- (IBAction)repeat:(id)sender;
- (void)setShuffle;
- (IBAction)shuffle:(id)sender;
- (void)toggleJumpButtons;
- (void)togglePlaymodeButtons;
- (void)updateVolumeSlider;
- (void)updateControls;
- (void)updatePosAndTimeInFSPanel:(VLCFSPanel *)o_fspanel;
@end
/*****************************************************************************
* ControlsBar.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* 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.
*****************************************************************************/
#import "ControlsBar.h"
#import "intf.h"
#import "CoreInteraction.h"
#import "MainMenu.h"
#import "fspanel.h"
#import <vlc_aout_intf.h>
/*****************************************************************************
* VLCControlsBarCommon
*
* Holds all outlets, actions and code common for controls bar in detached
* and in main window.
*****************************************************************************/
@implementation VLCControlsBarCommon
@synthesize bottomBarView=o_bottombar_view;
- (void)awakeFromNib
{
b_dark_interface = config_GetInt(VLCIntf, "macosx-interfacestyle");
b_nativeFullscreenMode = NO;
#ifdef MAC_OS_X_VERSION_10_7
if (!OSX_SNOW_LEOPARD)
b_nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode");
#endif
[o_play_btn setToolTip: _NS("Play/Pause")];
[[o_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_bwd_btn setToolTip: _NS("Backward")];
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_bwd_btn cell] accessibilitySetOverrideValue:[o_bwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_fwd_btn setToolTip: _NS("Forward")];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:[o_fwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_time_sld setToolTip: _NS("Position")];
[[o_time_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change current playback position.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_time_sld cell] accessibilitySetOverrideValue:[o_time_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_fullscreen_btn setToolTip: _NS("Toggle Fullscreen mode")];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:_NS("Click to enable fullscreen video playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:[o_fullscreen_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
if (!b_dark_interface) {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-pressed"]];
o_play_img = [[NSImage imageNamed:@"play"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed"] retain];
o_pause_img = [[NSImage imageNamed:@"pause"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-pressed"]];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed"]];
} else {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns-dark"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-dark-pressed"]];
o_play_img = [[NSImage imageNamed:@"play_dark"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed_dark"] retain];
o_pause_img = [[NSImage imageNamed:@"pause_dark"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed_dark"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns-dark"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-dark-pressed"]];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]];
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
}
[o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img];
[o_time_fld setAlignment: NSCenterTextAlignment];
[o_time_fld setNeedsDisplay:YES];
// prepare time slider fance gradient view
if (!b_dark_interface) {
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
frame.size.height = frame.size.height - 1;
frame.origin.y = frame.origin.y + 1;
[o_time_sld_fancygradient_view setFrame: frame];
}
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame];
// hide resize view if necessary
if (!OSX_SNOW_LEOPARD)
[o_resize_view setImage: NULL];
if ([o_associated_window styleMask] & NSResizableWindowMask)
[o_resize_view removeFromSuperviewWithoutNeedingDisplay];
}
#pragma mark -
#pragma mark Button Actions
- (IBAction)play:(id)sender
{
[[VLCCoreInteraction sharedInstance] play];
}
- (void)resetPreviousButton
{
if (([NSDate timeIntervalSinceReferenceDate] - last_bwd_event) >= 0.35) {
// seems like no further event occurred, so let's switch the playback item
[[VLCCoreInteraction sharedInstance] previous];
just_triggered_previous = NO;
}
}
- (void)resetBackwardSkip
{
// the user stopped skipping, so let's allow him to change the item
if (([NSDate timeIntervalSinceReferenceDate] - last_bwd_event) >= 0.35)
just_triggered_previous = NO;
}
- (IBAction)bwd:(id)sender
{
if (!just_triggered_previous) {
just_triggered_previous = YES;
[self performSelector:@selector(resetPreviousButton)
withObject: NULL
afterDelay:0.40];
} else {
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) > 0.16) {
// we just skipped 4 "continous" events, otherwise we are too fast
[[VLCCoreInteraction sharedInstance] backwardExtraShort];
last_bwd_event = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(resetBackwardSkip)
withObject: NULL
afterDelay:0.40];
}
}
}
- (void)resetNextButton
{
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) >= 0.35) {
// seems like no further event occurred, so let's switch the playback item
[[VLCCoreInteraction sharedInstance] next];
just_triggered_next = NO;
}
}
- (void)resetForwardSkip
{
// the user stopped skipping, so let's allow him to change the item
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) >= 0.35)
just_triggered_next = NO;
}
- (IBAction)fwd:(id)sender
{
if (!just_triggered_next) {
just_triggered_next = YES;
[self performSelector:@selector(resetNextButton)
withObject: NULL
afterDelay:0.40];
} else {
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) > 0.16) {
// we just skipped 4 "continous" events, otherwise we are too fast
[[VLCCoreInteraction sharedInstance] forwardExtraShort];
last_fwd_event = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(resetForwardSkip)
withObject: NULL
afterDelay:0.40];
}
}
}
- (IBAction)timeSliderAction:(id)sender
{
float f_updated;
input_thread_t * p_input;
switch([[NSApp currentEvent] type]) {
case NSLeftMouseUp:
case NSLeftMouseDown:
case NSLeftMouseDragged:
f_updated = [sender floatValue];
break;
default:
return;
}
p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vlc_value_t pos;
NSString * o_time;
pos.f_float = f_updated / 10000.;
var_Set(p_input, "position", pos);
[o_time_sld setFloatValue: f_updated];
o_time = [[VLCStringUtility sharedInstance] getCurrentTimeAsString: p_input negative:[o_time_fld timeRemaining]];
[o_time_fld setStringValue: o_time];
vlc_object_release(p_input);
}
}
- (IBAction)fullscreen:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
#pragma mark -
#pragma mark Updaters
- (void)updateTimeSlider
{
input_thread_t * p_input;
p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
NSString * o_time;
vlc_value_t pos;
float f_updated;
var_Get(p_input, "position", &pos);
f_updated = 10000. * pos.f_float;
[o_time_sld setFloatValue: f_updated];
o_time = [[VLCStringUtility sharedInstance] getCurrentTimeAsString: p_input negative:[o_time_fld timeRemaining]];
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
if (dur == -1) {
[o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES];
} else {
[o_time_sld setEnabled: YES];
[o_time_sld setHidden: NO];
[o_time_sld_fancygradient_view setHidden: NO];
}
[o_time_fld setStringValue: o_time];
[o_time_fld setNeedsDisplay:YES];
vlc_object_release(p_input);
} else {
[o_time_sld setFloatValue: 0.0];
[o_time_fld setStringValue: @"00:00"];
[o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES];
}
}
- (void)drawFancyGradientEffectForTimeSlider
{
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
CGFloat f_value = [o_time_sld knobPosition];
if (f_value > 7.5) {
NSRect oldFrame = [o_time_sld_fancygradient_view frame];
if (f_value != oldFrame.size.width) {
if ([o_time_sld_fancygradient_view isHidden])
[o_time_sld_fancygradient_view setHidden: NO];
[o_time_sld_fancygradient_view setFrame: NSMakeRect(oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height)];
}
} else {
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
if (frame.size.width > 0) {
frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame];
}
[o_time_sld_fancygradient_view setHidden: YES];
}
[o_pool release];
}
- (void)updateControls
{
bool b_plmul = false;
bool b_seekable = false;
bool b_chapters = false;
playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
b_plmul = playlist_CurrentSize(p_playlist) > 1;
PL_UNLOCK;
input_thread_t * p_input = playlist_CurrentInput(p_playlist);
if (p_input) {
/* seekable streams */
b_seekable = var_GetBool(p_input, "can-seek");
/* chapters & titles */
//FIXME! b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release(p_input);
}
[o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
}
- (void)setPause
{
[o_play_btn setImage: o_pause_img];
[o_play_btn setAlternateImage: o_pause_pressed_img];
[o_play_btn setToolTip: _NS("Pause")];
}
- (void)setPlay
{
[o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img];
[o_play_btn setToolTip: _NS("Play")];
}
- (void)setFullscreenState:(BOOL)b_fullscreen
{
[o_fullscreen_btn setState:b_fullscreen];
}
@end
/*****************************************************************************
* VLCMainWindowControlsBar
*
* Holds all specific outlets, actions and code for the main window controls bar.
*****************************************************************************/
@implementation VLCMainWindowControlsBar
- (void)awakeFromNib
{
[super awakeFromNib];
[o_stop_btn setToolTip: _NS("Stop")];
[[o_stop_btn cell] accessibilitySetOverrideValue:_NS("Click to stop playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_stop_btn cell] accessibilitySetOverrideValue:[o_stop_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_playlist_btn setToolTip: _NS("Show/Hide Playlist")];
[[o_playlist_btn cell] accessibilitySetOverrideValue:_NS("Click to switch between video output and playlist. If no video is shown in the main window, this allows you to hide the playlist.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_playlist_btn cell] accessibilitySetOverrideValue:[o_playlist_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_repeat_btn setToolTip: _NS("Repeat")];
[[o_repeat_btn cell] accessibilitySetOverrideValue:_NS("Click to change repeat mode. There are 3 states: repeat one, repeat all and off.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_repeat_btn cell] accessibilitySetOverrideValue:[o_repeat_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_shuffle_btn setToolTip: _NS("Shuffle")];
[[o_shuffle_btn cell] accessibilitySetOverrideValue:[o_shuffle_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_shuffle_btn cell] accessibilitySetOverrideValue:_NS("Click to enable or disable random playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_volume_sld setToolTip: _NS("Volume")];
[[o_volume_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change the volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_sld cell] accessibilitySetOverrideValue:[o_volume_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_volume_down_btn setToolTip: _NS("Mute")];
[[o_volume_down_btn cell] accessibilitySetOverrideValue:_NS("Click to mute or unmute the audio.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_down_btn cell] accessibilitySetOverrideValue:[o_volume_down_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_volume_up_btn setToolTip: _NS("Full Volume")];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:_NS("Click to play the audio at maximum volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:[o_volume_up_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_effects_btn setToolTip: _NS("Effects")];
[[o_effects_btn cell] accessibilitySetOverrideValue:_NS("Click to show an Audio Effects panel featuring an equalizer and further filters.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_effects_btn cell] accessibilitySetOverrideValue:[o_effects_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
if (!b_dark_interface) {
[o_stop_btn setImage: [NSImage imageNamed:@"stop"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist-btn"]];
[o_playlist_btn setAlternateImage: [NSImage imageNamed:@"playlist-btn-pressed"]];
o_repeat_img = [[NSImage imageNamed:@"repeat"] retain];
o_repeat_pressed_img = [[NSImage imageNamed:@"repeat-pressed"] retain];
o_repeat_all_img = [[NSImage imageNamed:@"repeat-all"] retain];
o_repeat_all_pressed_img = [[NSImage imageNamed:@"repeat-all-pressed"] retain];
o_repeat_one_img = [[NSImage imageNamed:@"repeat-one"] retain];
o_repeat_one_pressed_img = [[NSImage imageNamed:@"repeat-one-pressed"] retain];
o_shuffle_img = [[NSImage imageNamed:@"shuffle"] retain];
o_shuffle_pressed_img = [[NSImage imageNamed:@"shuffle-pressed"] retain];
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed"] retain];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-pressed"]];
} else {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed"]];
}
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
} else {
[o_stop_btn setImage: [NSImage imageNamed:@"stop_dark"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed_dark"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist_dark"]];
[o_playlist_btn setAlternateImage: [NSImage imageNamed:@"playlist-pressed_dark"]];
o_repeat_img = [[NSImage imageNamed:@"repeat_dark"] retain];
o_repeat_pressed_img = [[NSImage imageNamed:@"repeat-pressed_dark"] retain];
o_repeat_all_img = [[NSImage imageNamed:@"repeat-all-blue_dark"] retain];
o_repeat_all_pressed_img = [[NSImage imageNamed:@"repeat-all-blue-pressed_dark"] retain];
o_repeat_one_img = [[NSImage imageNamed:@"repeat-one-blue_dark"] retain];
o_repeat_one_pressed_img = [[NSImage imageNamed:@"repeat-one-blue-pressed_dark"] retain];
o_shuffle_img = [[NSImage imageNamed:@"shuffle_dark"] retain];
o_shuffle_pressed_img = [[NSImage imageNamed:@"shuffle-pressed_dark"] retain];
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue_dark"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed_dark"] retain];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button_dark"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-blue_dark"]];
} else {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons_dark"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed_dark"]];
}
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
}
[o_repeat_btn setImage: o_repeat_img];
[o_repeat_btn setAlternateImage: o_repeat_pressed_img];
[o_shuffle_btn setImage: o_shuffle_img];
[o_shuffle_btn setAlternateImage: o_shuffle_pressed_img];
BOOL b_mute = ![[VLCCoreInteraction sharedInstance] mute];
[o_volume_sld setEnabled: b_mute];
[o_volume_up_btn setEnabled: b_mute];
// remove fullscreen button for lion fullscreen
if (b_nativeFullscreenMode) {
NSRect frame;
float f_width = [o_fullscreen_btn frame].size.width;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = f_width + frame.origin.x; \
[item setFrame: frame]
moveItem(o_effects_btn);
moveItem(o_volume_up_btn);
moveItem(o_volume_sld);
moveItem(o_volume_track_view);
moveItem(o_volume_down_btn);
moveItem(o_time_fld);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = f_width + frame.size.width;
[o_progress_view setFrame: frame];
[o_fullscreen_btn removeFromSuperviewWithoutNeedingDisplay];
}
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
if (b_show_jump_buttons)
[self addJumpButtons:YES];
b_show_playmode_buttons = config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
if (!b_show_playmode_buttons)
[self removePlaymodeButtons:YES];
[[VLCMain sharedInstance] playbackModeUpdated];
}
#pragma mark -
#pragma mark interface customization
- (void)toggleJumpButtons
{
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
if (b_show_jump_buttons)
[self addJumpButtons:NO];
else
[self removeJumpButtons:NO];
}
- (void)addJumpButtons:(BOOL)b_fast
{
NSRect preliminaryFrame = [o_bwd_btn frame];
BOOL b_enabled = [o_bwd_btn isEnabled];
preliminaryFrame.size.width = 29.;
o_prev_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_prev_btn setButtonType: NSMomentaryChangeButton];
[o_prev_btn setBezelStyle:NSRegularSquareBezelStyle];
[o_prev_btn setBordered:NO];
[o_prev_btn setTarget:self];
[o_prev_btn setAction:@selector(prev:)];
[o_prev_btn setToolTip: _NS("Previous")];
[[o_prev_btn cell] accessibilitySetOverrideValue:_NS("Previous") forAttribute:NSAccessibilityTitleAttribute];
[[o_prev_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_prev_btn setEnabled: b_enabled];
o_next_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_next_btn setButtonType: NSMomentaryChangeButton];
[o_next_btn setBezelStyle:NSRegularSquareBezelStyle];
[o_next_btn setBordered:NO];
[o_next_btn setTarget:self];
[o_next_btn setAction:@selector(next:)];
[o_next_btn setToolTip: _NS("Next")];
[[o_next_btn cell] accessibilitySetOverrideValue:_NS("Next") forAttribute:NSAccessibilityTitleAttribute];
[[o_next_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_next_btn setEnabled: b_enabled];
if (b_dark_interface) {
[o_prev_btn setImage: [NSImage imageNamed:@"previous-6btns-dark"]];
[o_prev_btn setAlternateImage: [NSImage imageNamed:@"previous-6btns-dark-pressed"]];
[o_next_btn setImage: [NSImage imageNamed:@"next-6btns-dark"]];
[o_next_btn setAlternateImage: [NSImage imageNamed:@"next-6btns-dark-pressed"]];
} else {
[o_prev_btn setImage: [NSImage imageNamed:@"previous-6btns"]];
[o_prev_btn setAlternateImage: [NSImage imageNamed:@"previous-6btns-pressed"]];
[o_next_btn setImage: [NSImage imageNamed:@"next-6btns"]];
[o_next_btn setAlternateImage: [NSImage imageNamed:@"next-6btns-pressed"]];
}
/* change the accessibility help for the backward/forward buttons accordingly */
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click and hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click and hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
NSRect frame;
frame = [o_bwd_btn frame];
frame.size.width++;
[o_bwd_btn setFrame:frame];
frame = [o_fwd_btn frame];
frame.size.width++;
[o_fwd_btn setFrame:frame];
float f_space = 29.;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = frame.origin.x + f_space; \
if (b_fast) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame]
moveItem(o_bwd_btn);
moveItem(o_play_btn);
f_space = 28.;
moveItem(o_fwd_btn);
f_space = 57.;
moveItem(o_stop_btn);
moveItem(o_playlist_btn);
moveItem(o_repeat_btn);
moveItem(o_shuffle_btn);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = frame.size.width - f_space;
frame.origin.x = frame.origin.x + f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (b_dark_interface) {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-6btns-dark"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-6btns-dark-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-6btns-dark"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-6btns-dark-pressed"]];
} else {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-6btns"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-6btns-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-6btns"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-6btns-pressed"]];
}
preliminaryFrame.origin.x = [o_next_btn frame].origin.x + 82. + [o_fwd_btn frame].size.width;
[o_next_btn setFrame: preliminaryFrame];
// wait until the animation is done, if displayed
if (b_fast) {
[o_bottombar_view addSubview:o_prev_btn];
[o_bottombar_view addSubview:o_next_btn];
} else {
[o_bottombar_view performSelector:@selector(addSubview:) withObject:o_prev_btn afterDelay:.2];
[o_bottombar_view performSelector:@selector(addSubview:) withObject:o_next_btn afterDelay:.2];
}
[o_fwd_btn setAction:@selector(forward:)];
[o_bwd_btn setAction:@selector(backward:)];
}
- (void)removeJumpButtons:(BOOL)b_fast
{
if (!o_prev_btn || !o_next_btn)
return;
if (b_fast) {
[o_prev_btn setHidden: YES];
[o_next_btn setHidden: YES];
} else {
[[o_prev_btn animator] setHidden: YES];
[[o_next_btn animator] setHidden: YES];
}
[o_prev_btn removeFromSuperviewWithoutNeedingDisplay];
[o_next_btn removeFromSuperviewWithoutNeedingDisplay];
[o_prev_btn release];
[o_next_btn release];
/* change the accessibility help for the backward/forward buttons accordingly */
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
NSRect frame;
frame = [o_bwd_btn frame];
frame.size.width--;
[o_bwd_btn setFrame:frame];
frame = [o_fwd_btn frame];
frame.size.width--;
[o_fwd_btn setFrame:frame];
float f_space = 29.;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = frame.origin.x - f_space; \
if (b_fast) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame]
moveItem(o_bwd_btn);
moveItem(o_play_btn);
f_space = 28.;
moveItem(o_fwd_btn);
f_space = 57.;
moveItem(o_stop_btn);
moveItem(o_playlist_btn);
moveItem(o_repeat_btn);
moveItem(o_shuffle_btn);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = frame.size.width + f_space;
frame.origin.x = frame.origin.x - f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (b_dark_interface) {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-3btns-dark"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-3btns-dark-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-3btns-dark"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-3btns-dark-pressed"]];
} else {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-3btns"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-3btns-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-3btns"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-3btns-pressed"]];
}
[o_bottombar_view setNeedsDisplay:YES];
[o_fwd_btn setAction:@selector(fwd:)];
[o_bwd_btn setAction:@selector(bwd:)];
}
- (void)togglePlaymodeButtons
{
b_show_playmode_buttons = config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
if (b_show_playmode_buttons)
[self addPlaymodeButtons:NO];
else
[self removePlaymodeButtons:NO];
}
- (void)addPlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
if (b_dark_interface) {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist_dark"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-pressed_dark"]];
} else {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-btn"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-btn-pressed"]];
}
frame = [o_playlist_btn frame];
frame.size.width--;
[o_playlist_btn setFrame:frame];
if (b_fast) {
[o_repeat_btn setHidden: NO];
[o_shuffle_btn setHidden: NO];
} else {
[[o_repeat_btn animator] setHidden: NO];
[[o_shuffle_btn animator] setHidden: NO];
}
frame = [o_progress_view frame];
frame.size.width = frame.size.width - f_space;
frame.origin.x = frame.origin.x + f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
}
- (void)removePlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
[o_repeat_btn setHidden: YES];
[o_shuffle_btn setHidden: YES];
if (b_dark_interface) {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-1btn-dark"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-1btn-dark-pressed"]];
} else {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-1btn"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-1btn-pressed"]];
}
frame = [o_playlist_btn frame];
frame.size.width++;
[o_playlist_btn setFrame:frame];
frame = [o_progress_view frame];
frame.size.width = frame.size.width + f_space;
frame.origin.x = frame.origin.x - f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
}
#pragma mark -
#pragma mark Extra button actions
- (IBAction)stop:(id)sender
{
[[VLCCoreInteraction sharedInstance] stop];
}
// dynamically created next / prev buttons
- (IBAction)prev:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)next:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (void)setRepeatOne
{
[o_repeat_btn setImage: o_repeat_one_img];
[o_repeat_btn setAlternateImage: o_repeat_one_pressed_img];
}
- (void)setRepeatAll
{
[o_repeat_btn setImage: o_repeat_all_img];
[o_repeat_btn setAlternateImage: o_repeat_all_pressed_img];
}
- (void)setRepeatOff
{
[o_repeat_btn setImage: o_repeat_img];
[o_repeat_btn setAlternateImage: o_repeat_pressed_img];
}
- (IBAction)repeat:(id)sender
{
vlc_value_t looping,repeating;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "repeat", &repeating);
var_Get(p_playlist, "loop", &looping);
if (!repeating.b_bool && !looping.b_bool) {
/* was: no repeating at all, switching to Repeat One */
[[VLCCoreInteraction sharedInstance] repeatOne];
[self setRepeatOne];
}
else if (repeating.b_bool && !looping.b_bool) {
/* was: Repeat One, switching to Repeat All */
[[VLCCoreInteraction sharedInstance] repeatAll];
[self setRepeatAll];
} else {
/* was: Repeat All or bug in VLC, switching to Repeat Off */
[[VLCCoreInteraction sharedInstance] repeatOff];
[self setRepeatOff];
}
}
- (void)setShuffle
{
bool b_value;
playlist_t *p_playlist = pl_Get(VLCIntf);
b_value = var_GetBool(p_playlist, "random");
if (b_value) {
[o_shuffle_btn setImage: o_shuffle_on_img];
[o_shuffle_btn setAlternateImage: o_shuffle_on_pressed_img];
} else {
[o_shuffle_btn setImage: o_shuffle_img];
[o_shuffle_btn setAlternateImage: o_shuffle_pressed_img];
}
}
- (IBAction)shuffle:(id)sender
{
[[VLCCoreInteraction sharedInstance] shuffle];
[self setShuffle];
}
- (IBAction)volumeAction:(id)sender
{
if (sender == o_volume_sld)
[[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
else if (sender == o_volume_down_btn)
[[VLCCoreInteraction sharedInstance] toggleMute];
else
[[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
}
- (IBAction)effects:(id)sender
{
[[VLCMainMenu sharedInstance] showAudioEffects: sender];
}
#pragma mark -
#pragma mark Extra updaters
- (void)updateVolumeSlider
{
int i_volume = [[VLCCoreInteraction sharedInstance] volume];
BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
if (!b_muted) {
[o_volume_sld setIntValue: i_volume];
} else
[o_volume_sld setIntValue: 0];
[o_volume_sld setEnabled: !b_muted];
[o_volume_up_btn setEnabled: !b_muted];
}
- (void)updateControls
{
[super updateControls];
bool b_input = false;
bool b_plmul = false;
bool b_control = false;
bool b_seekable = false;
bool b_chapters = false;
playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
b_plmul = playlist_CurrentSize(p_playlist) > 1;
PL_UNLOCK;
input_thread_t * p_input = playlist_CurrentInput(p_playlist);
bool b_buffering = NO;
if ((b_input = (p_input != NULL))) {
/* seekable streams */
input_state_e inputState = input_GetState(p_input);
if (inputState == INIT_S || inputState == OPENING_S)
b_buffering = YES;
/* seekable streams */
b_seekable = var_GetBool(p_input, "can-seek");
/* check whether slow/fast motion is possible */
b_control = var_GetBool(p_input, "can-rate");
/* chapters & titles */
//FIXME! b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release(p_input);
}
if (b_buffering) {
[o_progress_bar startAnimation:self];
[o_progress_bar setIndeterminate:YES];
[o_progress_bar setHidden:NO];
} else {
[o_progress_bar stopAnimation:self];
[o_progress_bar setHidden:YES];
}
[o_stop_btn setEnabled: b_input];
if (b_show_jump_buttons) {
[o_prev_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_next_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
}
[o_time_sld setEnabled: b_seekable];
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
}
- (void)updatePosAndTimeInFSPanel:(VLCFSPanel *)o_fspanel
{
[o_fspanel setStreamPos:[o_time_sld floatValue] andTime: [o_time_fld stringValue]];
}
@end
\ No newline at end of file
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#import "VideoView.h" #import "VideoView.h"
#import "CoreInteraction.h" #import "CoreInteraction.h"
#import "MainWindow.h" #import "MainWindow.h"
#import "ControlsBar.h"
#import "ExtensionsManager.h" #import "ExtensionsManager.h"
#import "ConvertAndSave.h" #import "ConvertAndSave.h"
...@@ -633,7 +634,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -633,7 +634,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
{ {
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playback-buttons"); BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playback-buttons");
config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value); config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value);
[[[VLCMain sharedInstance] mainWindow] toggleJumpButtons]; [[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
[o_mi_toggleJumpButtons setState: b_value]; [o_mi_toggleJumpButtons setState: b_value];
} }
...@@ -641,7 +642,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -641,7 +642,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
{ {
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playmode-buttons"); BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
config_PutInt(VLCIntf, "macosx-show-playmode-buttons", b_value); config_PutInt(VLCIntf, "macosx-show-playmode-buttons", b_value);
[[[VLCMain sharedInstance] mainWindow] togglePlaymodeButtons]; [[[[VLCMain sharedInstance] mainWindow] controlsBar] togglePlaymodeButtons];
[o_mi_togglePlaymodeButtons setState: b_value]; [o_mi_togglePlaymodeButtons setState: b_value];
} }
......
...@@ -34,29 +34,12 @@ ...@@ -34,29 +34,12 @@
#import "fspanel.h" #import "fspanel.h"
#import "MainWindowTitle.h" #import "MainWindowTitle.h"
@class VLCMainWindowControlsBar;
@interface VLCMainWindow : VLCVideoWindowCommon <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> { @interface VLCMainWindow : VLCVideoWindowCommon <PXSourceListDataSource, PXSourceListDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate> {
IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn;
IBOutlet id o_fwd_btn;
IBOutlet id o_stop_btn;
IBOutlet id o_playlist_btn;
IBOutlet id o_repeat_btn;
IBOutlet id o_shuffle_btn;
IBOutlet id o_effects_btn;
IBOutlet id o_fullscreen_btn;
IBOutlet id o_search_fld; IBOutlet id o_search_fld;
IBOutlet id o_topbar_view;
IBOutlet id o_volume_sld;
IBOutlet id o_volume_track_view;
IBOutlet id o_volume_down_btn;
IBOutlet id o_volume_up_btn;
IBOutlet id o_progress_view;
IBOutlet id o_time_sld;
IBOutlet id o_time_sld_fancygradient_view;
IBOutlet id o_time_fld;
IBOutlet id o_progress_bar;
IBOutlet id o_bottombar_view;
IBOutlet id o_time_sld_background;
IBOutlet id o_playlist_table; IBOutlet id o_playlist_table;
IBOutlet id o_video_view; IBOutlet id o_video_view;
IBOutlet id o_split_view; IBOutlet id o_split_view;
...@@ -72,19 +55,7 @@ ...@@ -72,19 +55,7 @@
IBOutlet id o_dropzone_box; IBOutlet id o_dropzone_box;
IBOutlet VLCFSPanel *o_fspanel; IBOutlet VLCFSPanel *o_fspanel;
IBOutlet id o_resize_view;
IBOutlet id o_detached_resize_view;
IBOutlet id o_detached_play_btn;
IBOutlet id o_detached_fwd_btn;
IBOutlet id o_detached_bwd_btn;
IBOutlet id o_detached_fullscreen_btn;
IBOutlet id o_detached_time_fld;
IBOutlet id o_detached_time_sld;
IBOutlet id o_detached_time_sld_background;
IBOutlet id o_detached_progress_bar;
IBOutlet id o_detached_time_sld_fancygradient_view;
IBOutlet id o_detached_bottombar_view;
IBOutlet id o_detached_video_window; IBOutlet id o_detached_video_window;
IBOutlet id o_podcast_view; IBOutlet id o_podcast_view;
...@@ -108,32 +79,8 @@ ...@@ -108,32 +79,8 @@
BOOL b_dropzone_active; BOOL b_dropzone_active;
BOOL b_splitview_removed; BOOL b_splitview_removed;
BOOL b_minimized_view; BOOL b_minimized_view;
BOOL b_show_jump_buttons;
BOOL b_show_playmode_buttons;
int i_lastSplitViewHeight; int i_lastSplitViewHeight;
input_state_e cachedInputState;
NSImage * o_pause_img;
NSImage * o_pause_pressed_img;
NSImage * o_play_img;
NSImage * o_play_pressed_img;
NSImage * o_repeat_img;
NSImage * o_repeat_pressed_img;
NSImage * o_repeat_all_img;
NSImage * o_repeat_all_pressed_img;
NSImage * o_repeat_one_img;
NSImage * o_repeat_one_pressed_img;
NSImage * o_shuffle_img;
NSImage * o_shuffle_pressed_img;
NSImage * o_shuffle_on_img;
NSImage * o_shuffle_on_pressed_img;
NSTimeInterval last_fwd_event;
NSTimeInterval last_bwd_event;
BOOL just_triggered_next;
BOOL just_triggered_previous;
NSButton * o_prev_btn;
NSButton * o_next_btn;
NSMutableArray *o_sidebaritems; NSMutableArray *o_sidebaritems;
...@@ -164,21 +111,10 @@ ...@@ -164,21 +111,10 @@
+ (VLCMainWindow *)sharedInstance; + (VLCMainWindow *)sharedInstance;
@property (readonly) BOOL fullscreen; @property (readonly) BOOL fullscreen;
- (IBAction)play:(id)sender; - (VLCMainWindowControlsBar *)controlsBar;
- (IBAction)prev:(id)sender;
- (IBAction)backward:(id)sender;
- (IBAction)bwd:(id)sender;
- (IBAction)next:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)fwd:(id)sender;
- (IBAction)stop:(id)sender;
- (IBAction)togglePlaylist:(id)sender; - (IBAction)togglePlaylist:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)shuffle:(id)sender;
- (IBAction)timeSliderAction:(id)sender;
- (IBAction)volumeAction:(id)sender;
- (IBAction)effects:(id)sender;
- (IBAction)fullscreen:(id)sender;
- (IBAction)dropzoneButtonAction:(id)sender; - (IBAction)dropzoneButtonAction:(id)sender;
- (IBAction)addPodcast:(id)sender; - (IBAction)addPodcast:(id)sender;
...@@ -193,19 +129,11 @@ ...@@ -193,19 +129,11 @@
- (void)showSplitView; - (void)showSplitView;
- (void)hideSplitView; - (void)hideSplitView;
- (void)updateTimeSlider; - (void)updateTimeSlider;
- (void)updateVolumeSlider;
- (void)updateWindow; - (void)updateWindow;
- (void)updateName; - (void)updateName;
- (void)setPause; - (void)setPause;
- (void)setPlay; - (void)setPlay;
- (void)setRepeatOne; - (void)updateVolumeSlider;
- (void)setRepeatAll;
- (void)setRepeatOff;
- (void)setShuffle;
- (void)toggleJumpButtons;
- (void)togglePlaymodeButtons;
- (void)drawFancyGradientEffectForTimeSlider;
- (id)videoView; - (id)videoView;
- (void)setupVideoView; - (void)setupVideoView;
......
...@@ -42,16 +42,10 @@ ...@@ -42,16 +42,10 @@
#import <vlc_services_discovery.h> #import <vlc_services_discovery.h>
#import <vlc_aout_intf.h> #import <vlc_aout_intf.h>
#import "ControlsBar.h"
@interface VLCMainWindow () @interface VLCMainWindow ()
- (void)addJumpButtons:(BOOL)b_fast;
- (void)removeJumpButtons:(BOOL)b_fast;
- (void)addPlaymodeButtons:(BOOL)b_fast;
- (void)removePlaymodeButtons:(BOOL)b_fast;
- (void)resetPreviousButton;
- (void)resetBackwardSkip;
- (void)resetNextButton;
- (void)resetForwardSkip;
- (void)resizePlaylistAfterCollapse; - (void)resizePlaylistAfterCollapse;
- (void)makeSplitViewVisible; - (void)makeSplitViewVisible;
- (void)makeSplitViewHidden; - (void)makeSplitViewHidden;
...@@ -164,63 +158,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -164,63 +158,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
t_hide_mouse_timer = nil; t_hide_mouse_timer = nil;
[o_detached_video_window setDelegate: self]; [o_detached_video_window setDelegate: self];
[self useOptimizedDrawing: YES]; [self useOptimizedDrawing: YES];
[o_play_btn setToolTip: _NS("Play/Pause")];
[[o_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_detached_play_btn setToolTip: [o_play_btn toolTip]];
[[o_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_bwd_btn setToolTip: _NS("Backward")];
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_detached_bwd_btn setToolTip: [o_bwd_btn toolTip]];
[[o_bwd_btn cell] accessibilitySetOverrideValue:[o_bwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_bwd_btn cell] accessibilitySetOverrideValue:[o_bwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_fwd_btn setToolTip: _NS("Forward")];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_detached_fwd_btn setToolTip: [o_fwd_btn toolTip]];
[[o_detached_fwd_btn cell] accessibilitySetOverrideValue:[o_fwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_fwd_btn cell] accessibilitySetOverrideValue:[o_fwd_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_stop_btn setToolTip: _NS("Stop")];
[[o_stop_btn cell] accessibilitySetOverrideValue:_NS("Click to stop playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_stop_btn cell] accessibilitySetOverrideValue:[o_stop_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_playlist_btn setToolTip: _NS("Show/Hide Playlist")];
[[o_playlist_btn cell] accessibilitySetOverrideValue:_NS("Click to switch between video output and playlist. If no video is shown in the main window, this allows you to hide the playlist.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_playlist_btn cell] accessibilitySetOverrideValue:[o_playlist_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_repeat_btn setToolTip: _NS("Repeat")];
[[o_repeat_btn cell] accessibilitySetOverrideValue:_NS("Click to change repeat mode. There are 3 states: repeat one, repeat all and off.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_repeat_btn cell] accessibilitySetOverrideValue:[o_repeat_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_shuffle_btn setToolTip: _NS("Shuffle")];
[[o_shuffle_btn cell] accessibilitySetOverrideValue:[o_shuffle_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_shuffle_btn cell] accessibilitySetOverrideValue:_NS("Click to enable or disable random playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_effects_btn setToolTip: _NS("Effects")];
[[o_effects_btn cell] accessibilitySetOverrideValue:_NS("Click to show an Audio Effects panel featuring an equalizer and further filters.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_effects_btn cell] accessibilitySetOverrideValue:[o_effects_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_fullscreen_btn setToolTip: _NS("Toggle Fullscreen mode")];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:_NS("Click to enable fullscreen video playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_detached_fullscreen_btn setToolTip: [o_fullscreen_btn toolTip]];
[[o_fullscreen_btn cell] accessibilitySetOverrideValue:[o_fullscreen_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_fullscreen_btn cell] accessibilitySetOverrideValue:[o_fullscreen_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[[o_detached_fullscreen_btn cell] accessibilitySetOverrideValue:_NS("Click to enable fullscreen video playback.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_search_fld cell] setPlaceholderString: _NS("Search")]; [[o_search_fld cell] setPlaceholderString: _NS("Search")];
[[o_search_fld cell] accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.") forAttribute:NSAccessibilityDescriptionAttribute]; [[o_search_fld cell] accessibilitySetOverrideValue:_NS("Enter a term to search the playlist. Results will be selected in the table.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_volume_sld setToolTip: _NS("Volume")];
[[o_volume_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change the volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_sld cell] accessibilitySetOverrideValue:[o_volume_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_volume_down_btn setToolTip: _NS("Mute")];
[[o_volume_down_btn cell] accessibilitySetOverrideValue:_NS("Click to mute or unmute the audio.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_down_btn cell] accessibilitySetOverrideValue:[o_volume_down_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_volume_up_btn setToolTip: _NS("Full Volume")];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:_NS("Click to play the audio at maximum volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_volume_up_btn cell] accessibilitySetOverrideValue:[o_volume_up_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_time_sld setToolTip: _NS("Position")];
[[o_time_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change current playback position.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_time_sld cell] accessibilitySetOverrideValue:[o_time_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_detached_time_sld setToolTip: [o_time_sld toolTip]];
[[o_detached_time_sld cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change current playback position.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_detached_time_sld cell] accessibilitySetOverrideValue:[o_time_sld toolTip] forAttribute:NSAccessibilityTitleAttribute];
[o_dropzone_btn setTitle: _NS("Open media...")]; [o_dropzone_btn setTitle: _NS("Open media...")];
[[o_dropzone_btn cell] accessibilitySetOverrideValue:_NS("Click to open an advanced dialog to select the media to play. You can also drop files here to play.") forAttribute:NSAccessibilityDescriptionAttribute]; [[o_dropzone_btn cell] accessibilitySetOverrideValue:_NS("Click to open an advanced dialog to select the media to play. You can also drop files here to play.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_dropzone_lbl setStringValue: _NS("Drop media here")]; [o_dropzone_lbl setStringValue: _NS("Drop media here")];
...@@ -236,123 +177,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -236,123 +177,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_podcast_unsubscribe_ok_btn setTitle: _NS("Unsubscribe")]; [o_podcast_unsubscribe_ok_btn setTitle: _NS("Unsubscribe")];
[o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")]; [o_podcast_unsubscribe_cancel_btn setTitle: _NS("Cancel")];
if (!b_dark_interface) {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
[o_detached_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottom-background"] middle: [NSImage imageNamed:@"bottom-background"] right: [NSImage imageNamed:@"bottom-background"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-pressed"]];
[o_detached_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns"]];
[o_detached_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-pressed"]];
o_play_img = [[NSImage imageNamed:@"play"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed"] retain];
o_pause_img = [[NSImage imageNamed:@"pause"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-pressed"]];
[o_detached_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns"]];
[o_detached_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-pressed"]];
[o_stop_btn setImage: [NSImage imageNamed:@"stop"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist-btn"]];
[o_playlist_btn setAlternateImage: [NSImage imageNamed:@"playlist-btn-pressed"]];
o_repeat_img = [[NSImage imageNamed:@"repeat"] retain];
o_repeat_pressed_img = [[NSImage imageNamed:@"repeat-pressed"] retain];
o_repeat_all_img = [[NSImage imageNamed:@"repeat-all"] retain];
o_repeat_all_pressed_img = [[NSImage imageNamed:@"repeat-all-pressed"] retain];
o_repeat_one_img = [[NSImage imageNamed:@"repeat-one"] retain];
o_repeat_one_pressed_img = [[NSImage imageNamed:@"repeat-one-pressed"] retain];
o_shuffle_img = [[NSImage imageNamed:@"shuffle"] retain];
o_shuffle_pressed_img = [[NSImage imageNamed:@"shuffle-pressed"] retain];
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed"] retain];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_detached_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle"] right: [NSImage imageNamed:@"progression-track-wrapper-right"]];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-pressed"]];
} else {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed"]];
}
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
[o_detached_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button"]];
[o_detached_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
[o_detached_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progression-fill-left"] middle:[NSImage imageNamed:@"progression-fill-middle"] right:[NSImage imageNamed:@"progression-fill-right"]];
} else {
[o_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
[o_detached_bottombar_view setImagesLeft: [NSImage imageNamed:@"bottomdark-left"] middle: [NSImage imageNamed:@"bottom-background_dark"] right: [NSImage imageNamed:@"bottomdark-right"]];
[o_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns-dark"]];
[o_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-dark-pressed"]];
[o_detached_bwd_btn setImage: [NSImage imageNamed:@"backward-3btns-dark"]];
[o_detached_bwd_btn setAlternateImage: [NSImage imageNamed:@"backward-3btns-dark-pressed"]];
o_play_img = [[NSImage imageNamed:@"play_dark"] retain];
o_play_pressed_img = [[NSImage imageNamed:@"play-pressed_dark"] retain];
o_pause_img = [[NSImage imageNamed:@"pause_dark"] retain];
o_pause_pressed_img = [[NSImage imageNamed:@"pause-pressed_dark"] retain];
[o_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns-dark"]];
[o_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-dark-pressed"]];
[o_detached_fwd_btn setImage: [NSImage imageNamed:@"forward-3btns-dark"]];
[o_detached_fwd_btn setAlternateImage: [NSImage imageNamed:@"forward-3btns-dark-pressed"]];
[o_stop_btn setImage: [NSImage imageNamed:@"stop_dark"]];
[o_stop_btn setAlternateImage: [NSImage imageNamed:@"stop-pressed_dark"]];
[o_playlist_btn setImage: [NSImage imageNamed:@"playlist_dark"]];
[o_playlist_btn setAlternateImage: [NSImage imageNamed:@"playlist-pressed_dark"]];
o_repeat_img = [[NSImage imageNamed:@"repeat_dark"] retain];
o_repeat_pressed_img = [[NSImage imageNamed:@"repeat-pressed_dark"] retain];
o_repeat_all_img = [[NSImage imageNamed:@"repeat-all-blue_dark"] retain];
o_repeat_all_pressed_img = [[NSImage imageNamed:@"repeat-all-blue-pressed_dark"] retain];
o_repeat_one_img = [[NSImage imageNamed:@"repeat-one-blue_dark"] retain];
o_repeat_one_pressed_img = [[NSImage imageNamed:@"repeat-one-blue-pressed_dark"] retain];
o_shuffle_img = [[NSImage imageNamed:@"shuffle_dark"] retain];
o_shuffle_pressed_img = [[NSImage imageNamed:@"shuffle-pressed_dark"] retain];
o_shuffle_on_img = [[NSImage imageNamed:@"shuffle-blue_dark"] retain];
o_shuffle_on_pressed_img = [[NSImage imageNamed:@"shuffle-blue-pressed_dark"] retain];
[o_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
[o_detached_time_sld_background setImagesLeft: [NSImage imageNamed:@"progression-track-wrapper-left_dark"] middle: [NSImage imageNamed:@"progression-track-wrapper-middle_dark"] right: [NSImage imageNamed:@"progression-track-wrapper-right_dark"]];
[o_volume_down_btn setImage: [NSImage imageNamed:@"volume-low_dark"]];
[o_volume_track_view setImage: [NSImage imageNamed:@"volume-slider-track_dark"]];
[o_volume_up_btn setImage: [NSImage imageNamed:@"volume-high_dark"]];
if (b_nativeFullscreenMode) {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-one-button_dark"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-one-button-blue_dark"]];
} else {
[o_effects_btn setImage: [NSImage imageNamed:@"effects-double-buttons_dark"]];
[o_effects_btn setAlternateImage: [NSImage imageNamed:@"effects-double-buttons-pressed_dark"]];
}
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
[o_detached_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-one-button_dark"]];
[o_detached_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
[o_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]];
[o_detached_time_sld_fancygradient_view setImagesLeft:[NSImage imageNamed:@"progressbar-fill-left_dark"] middle:[NSImage imageNamed:@"progressbar-fill-middle_dark"] right:[NSImage imageNamed:@"progressbar-fill-right_dark"]];
}
[o_repeat_btn setImage: o_repeat_img];
[o_repeat_btn setAlternateImage: o_repeat_pressed_img];
[o_shuffle_btn setImage: o_shuffle_img];
[o_shuffle_btn setAlternateImage: o_shuffle_pressed_img];
[o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img];
[o_detached_play_btn setImage: o_play_img];
[o_detached_play_btn setAlternateImage: o_play_pressed_img];
BOOL b_mute = ![[VLCCoreInteraction sharedInstance] mute];
[o_volume_sld setEnabled: b_mute];
[o_volume_up_btn setEnabled: b_mute];
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
if (b_show_jump_buttons)
[self addJumpButtons:YES];
b_show_playmode_buttons = config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
if (!b_show_playmode_buttons)
[self removePlaymodeButtons:YES];
/* interface builder action */ /* interface builder action */
float f_threshold_height = f_min_video_height + [o_bottombar_view frame].size.height; float f_threshold_height = f_min_video_height + [[o_controls_bar bottomBarView] frame].size.height;
if (b_dark_interface) if (b_dark_interface)
f_threshold_height += [o_titlebar_view frame].size.height; f_threshold_height += [o_titlebar_view frame].size.height;
if ([[self contentView] frame].size.height < f_threshold_height) if ([[self contentView] frame].size.height < f_threshold_height)
...@@ -364,43 +190,22 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -364,43 +190,22 @@ static VLCMainWindow *_o_sharedInstance = nil;
// Set that here as IB seems to be buggy // Set that here as IB seems to be buggy
if (b_dark_interface) { if (b_dark_interface) {
[self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)]; [self setContentMinSize:NSMakeSize(604., 288. + [o_titlebar_view frame].size.height)];
[o_detached_video_window setContentMinSize: NSMakeSize(363., f_min_video_height + [o_detached_bottombar_view frame].size.height + [o_titlebar_view frame].size.height)]; [o_detached_video_window setContentMinSize: NSMakeSize(363., f_min_video_height + [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
} else { } else {
[self setContentMinSize:NSMakeSize(604., 288.)]; [self setContentMinSize:NSMakeSize(604., 288.)];
[o_detached_video_window setContentMinSize: NSMakeSize(363., f_min_video_height + [o_detached_bottombar_view frame].size.height)]; [o_detached_video_window setContentMinSize: NSMakeSize(363., f_min_video_height + [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height)];
} }
[self setTitle: _NS("VLC media player")]; [self setTitle: _NS("VLC media player")];
[o_time_fld setAlignment: NSCenterTextAlignment];
[o_time_fld setNeedsDisplay:YES];
b_dropzone_active = YES; b_dropzone_active = YES;
o_temp_view = [[NSView alloc] init]; o_temp_view = [[NSView alloc] init];
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable]; [o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
[o_dropzone_view setFrame: [o_playlist_table frame]]; [o_dropzone_view setFrame: [o_playlist_table frame]];
[o_left_split_view setFrame: [o_sidebar_view frame]]; [o_left_split_view setFrame: [o_sidebar_view frame]];
if (b_nativeFullscreenMode) { if (b_nativeFullscreenMode) {
NSRect frame;
[self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary]; [self setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary];
float f_width = [o_fullscreen_btn frame].size.width;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = f_width + frame.origin.x; \
[item setFrame: frame]
moveItem(o_effects_btn);
moveItem(o_volume_up_btn);
moveItem(o_volume_sld);
moveItem(o_volume_track_view);
moveItem(o_volume_down_btn);
moveItem(o_time_fld);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = f_width + frame.size.width;
[o_progress_view setFrame: frame];
[o_fullscreen_btn removeFromSuperviewWithoutNeedingDisplay];
} else { } else {
[o_titlebar_view setFullscreenButtonHidden: YES]; [o_titlebar_view setFullscreenButtonHidden: YES];
} }
...@@ -559,46 +364,16 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -559,46 +364,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]]; o_color_backdrop = [[VLCColorView alloc] initWithFrame: [o_split_view frame]];
[[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view]; [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: o_split_view];
[o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable]; [o_color_backdrop setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
} else { } else {
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
frame.size.height = frame.size.height - 1;
frame.origin.y = frame.origin.y + 1;
[o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.height = frame.size.height - 1;
frame.origin.y = frame.origin.y + 1;
[o_detached_time_sld_fancygradient_view setFrame: frame];
[o_video_view setFrame: [o_split_view frame]]; [o_video_view setFrame: [o_split_view frame]];
[o_playlist_table setBorderType: NSNoBorder]; [o_playlist_table setBorderType: NSNoBorder];
[o_sidebar_scrollview setBorderType: NSNoBorder]; [o_sidebar_scrollview setBorderType: NSNoBorder];
} }
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_detached_time_sld_fancygradient_view setFrame: frame];
if (!OSX_SNOW_LEOPARD) {
[o_resize_view setImage: NULL];
[o_detached_resize_view setImage: NULL];
}
if ([self styleMask] & NSResizableWindowMask) {
[o_resize_view removeFromSuperviewWithoutNeedingDisplay];
[o_detached_resize_view removeFromSuperviewWithoutNeedingDisplay];
}
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillClose:) name: NSWindowWillCloseNotification object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(someWindowWillMiniaturize:) name: NSWindowWillMiniaturizeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(applicationWillTerminate:) name: NSApplicationWillTerminateNotification object: nil];
[[VLCMain sharedInstance] playbackModeUpdated];
[o_split_view setAutosaveName:@"10thanniversary-splitview"]; [o_split_view setAutosaveName:@"10thanniversary-splitview"];
if (b_splitviewShouldBeHidden) { if (b_splitviewShouldBeHidden) {
...@@ -607,7 +382,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -607,7 +382,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
/* sanity check for the window size */ /* sanity check for the window size */
frame = [self frame]; NSRect frame = [self frame];
NSSize screenSize = [[self screen] frame].size; NSSize screenSize = [[self screen] frame].size;
if (screenSize.width <= frame.size.width || screenSize.height <= frame.size.height) { if (screenSize.width <= frame.size.width || screenSize.height <= frame.size.height) {
nativeVideoSize = screenSize; nativeVideoSize = screenSize;
...@@ -616,370 +391,10 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -616,370 +391,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
#pragma mark - #pragma mark -
#pragma mark interface customization
- (void)toggleJumpButtons
{
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
if (b_show_jump_buttons)
[self addJumpButtons:NO];
else
[self removeJumpButtons:NO];
}
- (void)addJumpButtons:(BOOL)b_fast
{
NSRect preliminaryFrame = [o_bwd_btn frame];
BOOL b_enabled = [o_bwd_btn isEnabled];
preliminaryFrame.size.width = 29.;
o_prev_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_prev_btn setButtonType: NSMomentaryChangeButton];
[o_prev_btn setBezelStyle:NSRegularSquareBezelStyle];
[o_prev_btn setBordered:NO];
[o_prev_btn setTarget:self];
[o_prev_btn setAction:@selector(prev:)];
[o_prev_btn setToolTip: _NS("Previous")];
[[o_prev_btn cell] accessibilitySetOverrideValue:_NS("Previous") forAttribute:NSAccessibilityTitleAttribute];
[[o_prev_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_prev_btn setEnabled: b_enabled];
o_next_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_next_btn setButtonType: NSMomentaryChangeButton];
[o_next_btn setBezelStyle:NSRegularSquareBezelStyle];
[o_next_btn setBordered:NO];
[o_next_btn setTarget:self];
[o_next_btn setAction:@selector(next:)];
[o_next_btn setToolTip: _NS("Next")];
[[o_next_btn cell] accessibilitySetOverrideValue:_NS("Next") forAttribute:NSAccessibilityTitleAttribute];
[[o_next_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
[o_next_btn setEnabled: b_enabled];
if (b_dark_interface) {
[o_prev_btn setImage: [NSImage imageNamed:@"previous-6btns-dark"]];
[o_prev_btn setAlternateImage: [NSImage imageNamed:@"previous-6btns-dark-pressed"]];
[o_next_btn setImage: [NSImage imageNamed:@"next-6btns-dark"]];
[o_next_btn setAlternateImage: [NSImage imageNamed:@"next-6btns-dark-pressed"]];
} else {
[o_prev_btn setImage: [NSImage imageNamed:@"previous-6btns"]];
[o_prev_btn setAlternateImage: [NSImage imageNamed:@"previous-6btns-pressed"]];
[o_next_btn setImage: [NSImage imageNamed:@"next-6btns"]];
[o_next_btn setAlternateImage: [NSImage imageNamed:@"next-6btns-pressed"]];
}
/* change the accessibility help for the backward/forward buttons accordingly */
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click and hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click and hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
NSRect frame;
frame = [o_bwd_btn frame];
frame.size.width++;
[o_bwd_btn setFrame:frame];
frame = [o_fwd_btn frame];
frame.size.width++;
[o_fwd_btn setFrame:frame];
float f_space = 29.;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = frame.origin.x + f_space; \
if (b_fast) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame]
moveItem(o_bwd_btn);
moveItem(o_play_btn);
f_space = 28.;
moveItem(o_fwd_btn);
f_space = 57.;
moveItem(o_stop_btn);
moveItem(o_playlist_btn);
moveItem(o_repeat_btn);
moveItem(o_shuffle_btn);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = frame.size.width - f_space;
frame.origin.x = frame.origin.x + f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (b_dark_interface) {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-6btns-dark"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-6btns-dark-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-6btns-dark"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-6btns-dark-pressed"]];
} else {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-6btns"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-6btns-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-6btns"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-6btns-pressed"]];
}
preliminaryFrame.origin.x = [o_next_btn frame].origin.x + 82. + [o_fwd_btn frame].size.width;
[o_next_btn setFrame: preliminaryFrame];
// wait until the animation is done, if displayed
if (b_fast) {
[[self contentView] addSubview:o_prev_btn];
[[self contentView] addSubview:o_next_btn];
} else {
[[self contentView] performSelector:@selector(addSubview:) withObject:o_prev_btn afterDelay:.2];
[[self contentView] performSelector:@selector(addSubview:) withObject:o_next_btn afterDelay:.2];
}
[o_fwd_btn setAction:@selector(forward:)];
[o_bwd_btn setAction:@selector(backward:)];
}
- (void)removeJumpButtons:(BOOL)b_fast
{
if (!o_prev_btn || !o_next_btn)
return;
if (b_fast) {
[o_prev_btn setHidden: YES];
[o_next_btn setHidden: YES];
} else {
[[o_prev_btn animator] setHidden: YES];
[[o_next_btn animator] setHidden: YES];
}
[o_prev_btn removeFromSuperviewWithoutNeedingDisplay];
[o_next_btn removeFromSuperviewWithoutNeedingDisplay];
[o_prev_btn release];
[o_next_btn release];
/* change the accessibility help for the backward/forward buttons accordingly */
[[o_bwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item. Hold to skip backward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_fwd_btn cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item. Hold to skip forward through the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
NSRect frame;
frame = [o_bwd_btn frame];
frame.size.width--;
[o_bwd_btn setFrame:frame];
frame = [o_fwd_btn frame];
frame.size.width--;
[o_fwd_btn setFrame:frame];
float f_space = 29.;
#define moveItem(item) \
frame = [item frame]; \
frame.origin.x = frame.origin.x - f_space; \
if (b_fast) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame]
moveItem(o_bwd_btn);
moveItem(o_play_btn);
f_space = 28.;
moveItem(o_fwd_btn);
f_space = 57.;
moveItem(o_stop_btn);
moveItem(o_playlist_btn);
moveItem(o_repeat_btn);
moveItem(o_shuffle_btn);
#undef moveItem
frame = [o_progress_view frame];
frame.size.width = frame.size.width + f_space;
frame.origin.x = frame.origin.x - f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (b_dark_interface) {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-3btns-dark"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-3btns-dark-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-3btns-dark"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-3btns-dark-pressed"]];
} else {
[[o_fwd_btn animator] setImage:[NSImage imageNamed:@"forward-3btns"]];
[[o_fwd_btn animator] setAlternateImage:[NSImage imageNamed:@"forward-3btns-pressed"]];
[[o_bwd_btn animator] setImage:[NSImage imageNamed:@"backward-3btns"]];
[[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-3btns-pressed"]];
}
[o_bottombar_view setNeedsDisplay:YES];
[o_fwd_btn setAction:@selector(fwd:)];
[o_bwd_btn setAction:@selector(bwd:)];
}
- (void)togglePlaymodeButtons
{
b_show_playmode_buttons = config_GetInt(VLCIntf, "macosx-show-playmode-buttons");
if (b_show_playmode_buttons)
[self addPlaymodeButtons:NO];
else
[self removePlaymodeButtons:NO];
}
- (void)addPlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
if (b_dark_interface) {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist_dark"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-pressed_dark"]];
} else {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-btn"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-btn-pressed"]];
}
frame = [o_playlist_btn frame];
frame.size.width--;
[o_playlist_btn setFrame:frame];
if (b_fast) {
[o_repeat_btn setHidden: NO];
[o_shuffle_btn setHidden: NO];
} else {
[[o_repeat_btn animator] setHidden: NO];
[[o_shuffle_btn animator] setHidden: NO];
}
frame = [o_progress_view frame];
frame.size.width = frame.size.width - f_space;
frame.origin.x = frame.origin.x + f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
}
- (void)removePlaymodeButtons:(BOOL)b_fast
{
NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
[o_repeat_btn setHidden: YES];
[o_shuffle_btn setHidden: YES];
if (b_dark_interface) {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-1btn-dark"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-1btn-dark-pressed"]];
} else {
[[o_playlist_btn animator] setImage:[NSImage imageNamed:@"playlist-1btn"]];
[[o_playlist_btn animator] setAlternateImage:[NSImage imageNamed:@"playlist-1btn-pressed"]];
}
frame = [o_playlist_btn frame];
frame.size.width++;
[o_playlist_btn setFrame:frame];
frame = [o_progress_view frame];
frame.size.width = frame.size.width + f_space;
frame.origin.x = frame.origin.x - f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
}
#pragma mark -
#pragma mark Button Actions
- (IBAction)play:(id)sender
{
[[VLCCoreInteraction sharedInstance] play];
}
- (void)resetPreviousButton
{
if (([NSDate timeIntervalSinceReferenceDate] - last_bwd_event) >= 0.35) {
// seems like no further event occurred, so let's switch the playback item
[[VLCCoreInteraction sharedInstance] previous];
just_triggered_previous = NO;
}
}
- (void)resetBackwardSkip
{
// the user stopped skipping, so let's allow him to change the item
if (([NSDate timeIntervalSinceReferenceDate] - last_bwd_event) >= 0.35)
just_triggered_previous = NO;
}
- (IBAction)prev:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)bwd:(id)sender
{
if (!just_triggered_previous) {
just_triggered_previous = YES;
[self performSelector:@selector(resetPreviousButton)
withObject: NULL
afterDelay:0.40];
} else {
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) > 0.16) {
// we just skipped 4 "continous" events, otherwise we are too fast
[[VLCCoreInteraction sharedInstance] backwardExtraShort];
last_bwd_event = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(resetBackwardSkip)
withObject: NULL
afterDelay:0.40];
}
}
}
- (IBAction)backward:(id)sender
{
[[VLCCoreInteraction sharedInstance] backwardShort];
}
- (void)resetNextButton
{
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) >= 0.35) {
// seems like no further event occurred, so let's switch the playback item
[[VLCCoreInteraction sharedInstance] next];
just_triggered_next = NO;
}
}
- (void)resetForwardSkip
{
// the user stopped skipping, so let's allow him to change the item
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) >= 0.35)
just_triggered_next = NO;
}
- (IBAction)next:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (IBAction)forward:(id)sender - (VLCMainWindowControlsBar *)controlsBar;
{ {
[[VLCCoreInteraction sharedInstance] forwardShort]; return (VLCMainWindowControlsBar *)o_controls_bar;
}
- (IBAction)fwd:(id)sender
{
if (!just_triggered_next) {
just_triggered_next = YES;
[self performSelector:@selector(resetNextButton)
withObject: NULL
afterDelay:0.40];
} else {
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) > 0.16) {
// we just skipped 4 "continous" events, otherwise we are too fast
[[VLCCoreInteraction sharedInstance] forwardExtraShort];
last_fwd_event = [NSDate timeIntervalSinceReferenceDate];
[self performSelector:@selector(resetForwardSkip)
withObject: NULL
afterDelay:0.40];
}
}
}
- (IBAction)stop:(id)sender
{
[[VLCCoreInteraction sharedInstance] stop];
} }
- (void)resizePlaylistAfterCollapse - (void)resizePlaylistAfterCollapse
...@@ -1034,6 +449,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1034,6 +449,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]]; [self makeFirstResponder: [[o_video_view subviews] objectAtIndex:0]];
} }
// only exception for an controls bar button action
- (IBAction)togglePlaylist:(id)sender - (IBAction)togglePlaylist:(id)sender
{ {
if (![self isVisible] && sender != nil) { if (![self isVisible] && sender != nil) {
...@@ -1088,121 +504,6 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1088,121 +504,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
} }
- (void)setRepeatOne
{
[o_repeat_btn setImage: o_repeat_one_img];
[o_repeat_btn setAlternateImage: o_repeat_one_pressed_img];
}
- (void)setRepeatAll
{
[o_repeat_btn setImage: o_repeat_all_img];
[o_repeat_btn setAlternateImage: o_repeat_all_pressed_img];
}
- (void)setRepeatOff
{
[o_repeat_btn setImage: o_repeat_img];
[o_repeat_btn setAlternateImage: o_repeat_pressed_img];
}
- (IBAction)repeat:(id)sender
{
vlc_value_t looping,repeating;
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get(p_intf);
var_Get(p_playlist, "repeat", &repeating);
var_Get(p_playlist, "loop", &looping);
if (!repeating.b_bool && !looping.b_bool) {
/* was: no repeating at all, switching to Repeat One */
[[VLCCoreInteraction sharedInstance] repeatOne];
[self setRepeatOne];
}
else if (repeating.b_bool && !looping.b_bool) {
/* was: Repeat One, switching to Repeat All */
[[VLCCoreInteraction sharedInstance] repeatAll];
[self setRepeatAll];
} else {
/* was: Repeat All or bug in VLC, switching to Repeat Off */
[[VLCCoreInteraction sharedInstance] repeatOff];
[self setRepeatOff];
}
}
- (void)setShuffle
{
bool b_value;
playlist_t *p_playlist = pl_Get(VLCIntf);
b_value = var_GetBool(p_playlist, "random");
if (b_value) {
[o_shuffle_btn setImage: o_shuffle_on_img];
[o_shuffle_btn setAlternateImage: o_shuffle_on_pressed_img];
} else {
[o_shuffle_btn setImage: o_shuffle_img];
[o_shuffle_btn setAlternateImage: o_shuffle_pressed_img];
}
}
- (IBAction)shuffle:(id)sender
{
[[VLCCoreInteraction sharedInstance] shuffle];
[self setShuffle];
}
- (IBAction)timeSliderAction:(id)sender
{
float f_updated;
input_thread_t * p_input;
switch([[NSApp currentEvent] type]) {
case NSLeftMouseUp:
case NSLeftMouseDown:
case NSLeftMouseDragged:
f_updated = [sender floatValue];
break;
default:
return;
}
p_input = pl_CurrentInput(VLCIntf);
if (p_input != NULL) {
vlc_value_t pos;
NSString * o_time;
pos.f_float = f_updated / 10000.;
var_Set(p_input, "position", pos);
[o_time_sld setFloatValue: f_updated];
o_time = [[VLCStringUtility sharedInstance] getCurrentTimeAsString: p_input negative:[o_time_fld timeRemaining]];
[o_time_fld setStringValue: o_time];
[o_fspanel setStreamPos: f_updated andTime: o_time];
vlc_object_release(p_input);
}
}
- (IBAction)volumeAction:(id)sender
{
if (sender == o_volume_sld)
[[VLCCoreInteraction sharedInstance] setVolume: [sender intValue]];
else if (sender == o_volume_down_btn)
[[VLCCoreInteraction sharedInstance] toggleMute];
else
[[VLCCoreInteraction sharedInstance] setVolume: AOUT_VOLUME_MAX];
}
- (IBAction)effects:(id)sender
{
[[VLCMainMenu sharedInstance] showAudioEffects: sender];
}
- (IBAction)fullscreen:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
}
- (IBAction)dropzoneButtonAction:(id)sender - (IBAction)dropzoneButtonAction:(id)sender
{ {
[[[VLCMain sharedInstance] open] openFileGeneric]; [[[VLCMain sharedInstance] open] openFileGeneric];
...@@ -1297,11 +598,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1297,11 +598,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self setFrame: winrect display: YES animate: YES]; [self setFrame: winrect display: YES animate: YES];
[self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1]; [self performSelector:@selector(hideDropZone) withObject:nil afterDelay:0.1];
if (b_dark_interface) { if (b_dark_interface) {
[self setContentMinSize: NSMakeSize(604., [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height)]; [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
[self setContentMaxSize: NSMakeSize(FLT_MAX, [o_bottombar_view frame].size.height + [o_titlebar_view frame].size.height)]; [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height + [o_titlebar_view frame].size.height)];
} else { } else {
[self setContentMinSize: NSMakeSize(604., [o_bottombar_view frame].size.height)]; [self setContentMinSize: NSMakeSize(604., [[o_controls_bar bottomBarView] frame].size.height)];
[self setContentMaxSize: NSMakeSize(FLT_MAX, [o_bottombar_view frame].size.height)]; [self setContentMaxSize: NSMakeSize(FLT_MAX, [[o_controls_bar bottomBarView] frame].size.height)];
} }
b_splitview_removed = YES; b_splitview_removed = YES;
...@@ -1329,62 +630,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1329,62 +630,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)updateTimeSlider - (void)updateTimeSlider
{ {
input_thread_t * p_input; [o_controls_bar updateTimeSlider];
p_input = pl_CurrentInput(VLCIntf); [[self controlsBar] updatePosAndTimeInFSPanel:o_fspanel];
if (p_input) { [[o_detached_video_window controlsBar] updateTimeSlider];
NSString * o_time;
vlc_value_t pos;
float f_updated;
var_Get(p_input, "position", &pos);
f_updated = 10000. * pos.f_float;
[o_time_sld setFloatValue: f_updated];
o_time = [[VLCStringUtility sharedInstance] getCurrentTimeAsString: p_input negative:[o_time_fld timeRemaining]];
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
if (dur == -1) {
[o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES];
} else {
[o_time_sld setEnabled: YES];
[o_time_sld setHidden: NO];
[o_time_sld_fancygradient_view setHidden: NO];
}
[o_time_fld setStringValue: o_time];
[o_time_fld setNeedsDisplay:YES];
[o_fspanel setStreamPos: f_updated andTime: o_time];
vlc_object_release(p_input);
} else {
[o_time_sld setFloatValue: 0.0];
[o_time_fld setStringValue: @"00:00"];
[o_time_sld setEnabled: NO];
[o_time_sld setHidden: YES];
[o_time_sld_fancygradient_view setHidden: YES];
[o_detached_time_sld_fancygradient_view setHidden: YES];
}
[o_detached_time_sld setFloatValue: [o_time_sld floatValue]];
[o_detached_time_sld setEnabled: [o_time_sld isEnabled]];
[o_detached_time_fld setStringValue: [o_time_fld stringValue]];
[o_detached_time_sld setHidden: [o_time_sld isHidden]];
}
- (void)updateVolumeSlider
{
int i_volume = [[VLCCoreInteraction sharedInstance] volume];
BOOL b_muted = [[VLCCoreInteraction sharedInstance] mute];
if (!b_muted) {
[o_volume_sld setIntValue: i_volume];
[o_fspanel setVolumeLevel: i_volume];
} else
[o_volume_sld setIntValue: 0];
[o_volume_sld setEnabled: !b_muted];
[o_volume_up_btn setEnabled: !b_muted];
} }
- (void)updateName - (void)updateName
...@@ -1432,61 +680,20 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1432,61 +680,20 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)updateWindow - (void)updateWindow
{ {
bool b_input = false; [o_controls_bar updateControls];
bool b_plmul = false; [[o_detached_video_window controlsBar] updateControls];
bool b_control = false;
bool b_seekable = false; bool b_seekable = false;
bool b_chapters = false;
playlist_t * p_playlist = pl_Get(VLCIntf); playlist_t * p_playlist = pl_Get(VLCIntf);
PL_LOCK;
b_plmul = playlist_CurrentSize(p_playlist) > 1;
PL_UNLOCK;
input_thread_t * p_input = playlist_CurrentInput(p_playlist); input_thread_t * p_input = playlist_CurrentInput(p_playlist);
if (p_input) {
bool b_buffering = NO;
if ((b_input = (p_input != NULL))) {
/* seekable streams */
cachedInputState = input_GetState(p_input);
if (cachedInputState == INIT_S || cachedInputState == OPENING_S)
b_buffering = YES;
/* seekable streams */ /* seekable streams */
b_seekable = var_GetBool(p_input, "can-seek"); b_seekable = var_GetBool(p_input, "can-seek");
/* check whether slow/fast motion is possible */
b_control = var_GetBool(p_input, "can-rate");
/* chapters & titles */
//FIXME! b_chapters = p_input->stream.i_area_nb > 1;
vlc_object_release(p_input); vlc_object_release(p_input);
} }
if (b_buffering) {
[o_progress_bar startAnimation:self];
[o_progress_bar setIndeterminate:YES];
[o_progress_bar setHidden:NO];
} else {
[o_progress_bar stopAnimation:self];
[o_progress_bar setHidden:YES];
}
[o_stop_btn setEnabled: b_input];
[o_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
if (b_show_jump_buttons) {
[o_prev_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_next_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
}
[o_detached_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[o_detached_bwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
[o_time_sld setEnabled: b_seekable];
[self updateTimeSlider]; [self updateTimeSlider];
[o_fspanel setSeekable: b_seekable]; [o_fspanel setSeekable: b_seekable];
...@@ -1501,63 +708,22 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1501,63 +708,22 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)setPause - (void)setPause
{ {
[o_play_btn setImage: o_pause_img]; [o_controls_bar setPause];
[o_play_btn setAlternateImage: o_pause_pressed_img]; [[o_detached_video_window controlsBar] setPause];
[o_play_btn setToolTip: _NS("Pause")];
[o_detached_play_btn setImage: o_pause_img];
[o_detached_play_btn setAlternateImage: o_pause_pressed_img];
[o_detached_play_btn setToolTip: _NS("Pause")];
[o_fspanel setPause]; [o_fspanel setPause];
} }
- (void)setPlay - (void)setPlay
{ {
[o_play_btn setImage: o_play_img]; [o_controls_bar setPlay];
[o_play_btn setAlternateImage: o_play_pressed_img]; [[o_detached_video_window controlsBar] setPlay];
[o_play_btn setToolTip: _NS("Play")];
[o_detached_play_btn setImage: o_play_img];
[o_detached_play_btn setAlternateImage: o_play_pressed_img];
[o_detached_play_btn setToolTip: _NS("Play")];
[o_fspanel setPlay]; [o_fspanel setPlay];
} }
- (void)drawFancyGradientEffectForTimeSlider - (void)updateVolumeSlider
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; [[self controlsBar] updateVolumeSlider];
CGFloat f_value = [o_time_sld knobPosition]; [o_fspanel setVolumeLevel: [[VLCCoreInteraction sharedInstance] volume]];
if (f_value > 7.5) {
NSRect oldFrame = [o_time_sld_fancygradient_view frame];
if (f_value != oldFrame.size.width) {
if ([o_time_sld_fancygradient_view isHidden])
[o_time_sld_fancygradient_view setHidden: NO];
[o_time_sld_fancygradient_view setFrame: NSMakeRect(oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height)];
}
if (b_nonembedded) {
f_value = [o_detached_time_sld knobPosition];
oldFrame = [o_detached_time_sld_fancygradient_view frame];
if (f_value != oldFrame.size.width)
{
if ([o_detached_time_sld_fancygradient_view isHidden])
[o_detached_time_sld_fancygradient_view setHidden: NO];
[o_detached_time_sld_fancygradient_view setFrame: NSMakeRect(oldFrame.origin.x, oldFrame.origin.y, f_value, oldFrame.size.height)];
}
}
} else {
NSRect frame;
frame = [o_time_sld_fancygradient_view frame];
if (frame.size.width > 0) {
frame.size.width = 0;
[o_time_sld_fancygradient_view setFrame: frame];
frame = [o_detached_time_sld_fancygradient_view frame];
frame.size.width = 0;
[o_detached_time_sld_fancygradient_view setFrame: frame];
}
[o_time_sld_fancygradient_view setHidden: YES];
[o_detached_time_sld_fancygradient_view setHidden: YES];
}
[o_pool release];
} }
#pragma mark - #pragma mark -
...@@ -1639,12 +805,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1639,12 +805,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
NSRect videoFrame; NSRect videoFrame;
videoFrame.size = [[o_detached_video_window contentView] frame].size; videoFrame.size = [[o_detached_video_window contentView] frame].size;
videoFrame.size.height -= [o_detached_bottombar_view frame].size.height; videoFrame.size.height -= [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height;
if (b_dark_interface) if (b_dark_interface)
videoFrame.size.height -= [o_titlebar_view frame].size.height; videoFrame.size.height -= [o_titlebar_view frame].size.height;
videoFrame.origin.x = .0; videoFrame.origin.x = .0;
videoFrame.origin.y = [o_detached_bottombar_view frame].size.height; videoFrame.origin.y = [[[o_detached_video_window controlsBar] bottomBarView] frame].size.height;
[o_video_view setFrame: videoFrame]; [o_video_view setFrame: videoFrame];
[[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil]; [[o_detached_video_window contentView] addSubview: o_video_view positioned:NSWindowAbove relativeTo:nil];
...@@ -1699,9 +865,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1699,9 +865,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
if (b_nativeFullscreenMode) { if (b_nativeFullscreenMode) {
if ([NSApp presentationOptions] & NSApplicationPresentationFullScreen) if ([NSApp presentationOptions] & NSApplicationPresentationFullScreen)
[o_bottombar_view setHidden: b_videoPlayback]; [[o_controls_bar bottomBarView] setHidden: b_videoPlayback];
else else
[o_bottombar_view setHidden: NO]; [[o_controls_bar bottomBarView] setHidden: NO];
if (b_videoPlayback && b_fullscreen) if (b_videoPlayback && b_fullscreen)
[o_fspanel setActive: nil]; [o_fspanel setActive: nil];
if (!b_videoPlayback) if (!b_videoPlayback)
...@@ -1844,8 +1010,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1844,8 +1010,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
screen_rect = [screen frame]; screen_rect = [screen frame];
[o_fullscreen_btn setState: YES]; [o_controls_bar setFullscreenState:YES];
[o_detached_fullscreen_btn setState: YES]; [[o_detached_video_window controlsBar] setFullscreenState:YES];
[self recreateHideMouseTimer]; [self recreateHideMouseTimer];
...@@ -2001,8 +1167,8 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2001,8 +1167,8 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self lockFullscreenAnimation]; [self lockFullscreenAnimation];
[o_fullscreen_btn setState: NO]; [o_controls_bar setFullscreenState:NO];
[o_detached_fullscreen_btn setState: NO]; [[o_detached_video_window controlsBar] setFullscreenState:NO];
/* We always try to do so */ /* We always try to do so */
[NSScreen unblackoutScreens]; [NSScreen unblackoutScreens];
...@@ -2231,7 +1397,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2231,7 +1397,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[o_bottombar_view setHidden: YES]; [[o_controls_bar bottomBarView] setHidden: YES];
[self setMovableByWindowBackground: NO]; [self setMovableByWindowBackground: NO];
} }
...@@ -2281,7 +1447,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2281,7 +1447,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
if ([[VLCMain sharedInstance] activeVideoPlayback]) if ([[VLCMain sharedInstance] activeVideoPlayback])
[o_bottombar_view setHidden: NO]; [[o_controls_bar bottomBarView] setHidden: NO];
[self setMovableByWindowBackground: YES]; [self setMovableByWindowBackground: YES];
} }
......
...@@ -82,4 +82,6 @@ SOURCES_macosx = \ ...@@ -82,4 +82,6 @@ SOURCES_macosx = \
SharedDialogs.m \ SharedDialogs.m \
Windows.h \ Windows.h \
Windows.m \ Windows.m \
ControlsBar.m \
ControlsBar.h \
$(NULL) $(NULL)
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h" #import "CompatibilityFixes.h"
/***************************************************************************** /*****************************************************************************
* VLCWindow * VLCWindow
* *
...@@ -56,6 +57,7 @@ ...@@ -56,6 +57,7 @@
@end @end
@class VLCControlsBarCommon;
/***************************************************************************** /*****************************************************************************
* VLCVideoWindowCommon * VLCVideoWindowCommon
...@@ -69,8 +71,12 @@ ...@@ -69,8 +71,12 @@
BOOL b_dark_interface; BOOL b_dark_interface;
IBOutlet id o_titlebar_view; // only set in main or detached window IBOutlet id o_titlebar_view; // only set in main or detached window
IBOutlet VLCControlsBarCommon* o_controls_bar;
} }
@property (readonly) VLCControlsBarCommon* controlsBar;
- (void)setTitle:(NSString *)title; - (void)setTitle:(NSString *)title;
@end @end
\ No newline at end of file
...@@ -219,6 +219,8 @@ ...@@ -219,6 +219,8 @@
@implementation VLCVideoWindowCommon @implementation VLCVideoWindowCommon
@synthesize controlsBar=o_controls_bar;
#pragma mark - #pragma mark -
#pragma mark Init #pragma mark Init
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
@interface VLCFSPanel : NSWindow @interface VLCFSPanel : NSWindow
{ {
NSTimer *fadeTimer,*hideAgainTimer; NSTimer *fadeTimer,*hideAgainTimer;
......
...@@ -148,7 +148,7 @@ struct intf_sys_t ...@@ -148,7 +148,7 @@ struct intf_sys_t
- (void)setIntf:(intf_thread_t *)p_mainintf; - (void)setIntf:(intf_thread_t *)p_mainintf;
- (id)mainMenu; - (id)mainMenu;
- (id)mainWindow; - (VLCMainWindow *)mainWindow;
- (id)controls; - (id)controls;
- (id)bookmarks; - (id)bookmarks;
- (id)open; - (id)open;
......
...@@ -1351,17 +1351,17 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1351,17 +1351,17 @@ static VLCMain *_o_sharedMainInstance = nil;
bool loop = var_GetBool(p_playlist, "loop"); bool loop = var_GetBool(p_playlist, "loop");
bool repeat = var_GetBool(p_playlist, "repeat"); bool repeat = var_GetBool(p_playlist, "repeat");
if (repeat) { if (repeat) {
[o_mainwindow setRepeatOne]; [[o_mainwindow controlsBar] setRepeatOne];
[o_mainmenu setRepeatOne]; [o_mainmenu setRepeatOne];
} else if (loop) { } else if (loop) {
[o_mainwindow setRepeatAll]; [[o_mainwindow controlsBar] setRepeatAll];
[o_mainmenu setRepeatAll]; [o_mainmenu setRepeatAll];
} else { } else {
[o_mainwindow setRepeatOff]; [[o_mainwindow controlsBar] setRepeatOff];
[o_mainmenu setRepeatOff]; [o_mainmenu setRepeatOff];
} }
[o_mainwindow setShuffle]; [[o_mainwindow controlsBar] setShuffle];
[o_mainmenu setShuffle]; [o_mainmenu setShuffle];
} }
...@@ -1402,7 +1402,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -1402,7 +1402,7 @@ static VLCMain *_o_sharedMainInstance = nil;
return o_mainmenu; return o_mainmenu;
} }
- (id)mainWindow - (VLCMainWindow *)mainWindow
{ {
return o_mainwindow; return o_mainwindow;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#import "misc.h" #import "misc.h"
#import "intf.h" /* VLCApplication */ #import "intf.h" /* VLCApplication */
#import "MainWindow.h" #import "MainWindow.h"
#import "ControlsBar.h"
#import "controls.h" #import "controls.h"
#import "CoreInteraction.h" #import "CoreInteraction.h"
#import <CoreAudio/CoreAudio.h> #import <CoreAudio/CoreAudio.h>
...@@ -452,7 +453,7 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -452,7 +453,7 @@ void _drawFrameInRect(NSRect frameRect)
- (void)drawRect:(NSRect)rect - (void)drawRect:(NSRect)rect
{ {
[[[VLCMain sharedInstance] mainWindow] drawFancyGradientEffectForTimeSlider]; [[[[VLCMain sharedInstance] mainWindow] controlsBar] drawFancyGradientEffectForTimeSlider];
msleep( 10000 ); //wait for the gradient to draw completely msleep( 10000 ); //wait for the gradient to draw completely
/* Draw default to make sure the slider behaves correctly */ /* Draw default to make sure the slider behaves correctly */
......
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