Commit 3131d924 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: added the prev/next buttons back (disabled by default) (close #6822)

you can enable them in the 'Playback' menu (since we got no 'View' menu so far) or in the advanced preferences

note that preliminary artwork is used at this point
parent 3b9f212d
......@@ -189,7 +189,9 @@ EXTRA_DIST += \
extras/package/macosx/Resources/icons/wav.icns \
extras/package/macosx/Resources/icons/wma.icns \
extras/package/macosx/Resources/icons/wmv.icns \
extras/package/macosx/Resources/mainwindow/back-pressed-single.png \
extras/package/macosx/Resources/mainwindow/back-pressed.png \
extras/package/macosx/Resources/mainwindow/back-single.png \
extras/package/macosx/Resources/mainwindow/back.png \
extras/package/macosx/Resources/mainwindow/bottom-background.png \
extras/package/macosx/Resources/mainwindow/bottombar-mini.png \
......@@ -200,7 +202,9 @@ EXTRA_DIST += \
extras/package/macosx/Resources/mainwindow/effects-double-buttons.png \
extras/package/macosx/Resources/mainwindow/effects-one-button-blue.png \
extras/package/macosx/Resources/mainwindow/effects-one-button.png \
extras/package/macosx/Resources/mainwindow/forward-pressed-single.png \
extras/package/macosx/Resources/mainwindow/forward-pressed.png \
extras/package/macosx/Resources/mainwindow/forward-single.png \
extras/package/macosx/Resources/mainwindow/forward.png \
extras/package/macosx/Resources/mainwindow/fullscreen-double-buttons-pressed.png \
extras/package/macosx/Resources/mainwindow/fullscreen-double-buttons.png \
......
......@@ -270,6 +270,10 @@
CCD83E4D13FEA143004F1652 /* VideoEffects.xib in Resources */ = {isa = PBXBuildFile; fileRef = CCD83E4013FEA143004F1652 /* VideoEffects.xib */; };
CCD83E4E13FEA143004F1652 /* Wizard.xib in Resources */ = {isa = PBXBuildFile; fileRef = CCD83E4213FEA143004F1652 /* Wizard.xib */; };
CCDB535D13E97D3500A1782F /* dropzone-background.png in Resources */ = {isa = PBXBuildFile; fileRef = CCDB535C13E97D3500A1782F /* dropzone-background.png */; };
CCE4057A15655B1900FA5CCA /* forward-pressed-single.png in Resources */ = {isa = PBXBuildFile; fileRef = CCE4057815655B1900FA5CCA /* forward-pressed-single.png */; };
CCE4057B15655B1900FA5CCA /* forward-single.png in Resources */ = {isa = PBXBuildFile; fileRef = CCE4057915655B1900FA5CCA /* forward-single.png */; };
CCE4057F15655B2100FA5CCA /* back-pressed-single.png in Resources */ = {isa = PBXBuildFile; fileRef = CCE4057D15655B2100FA5CCA /* back-pressed-single.png */; };
CCE4058215655B3300FA5CCA /* back-single.png in Resources */ = {isa = PBXBuildFile; fileRef = CCE4058115655B3300FA5CCA /* back-single.png */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
......@@ -637,6 +641,10 @@
CCD83E4313FEA143004F1652 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/Wizard.xib; sourceTree = "<group>"; };
CCDB535C13E97D3500A1782F /* dropzone-background.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "dropzone-background.png"; path = "Resources/mainwindow/dropzone-background.png"; sourceTree = "<group>"; };
CCDBA3B313D32E200006127B /* macosx.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = macosx.m; path = ../../../modules/video_output/macosx.m; sourceTree = "<group>"; };
CCE4057815655B1900FA5CCA /* forward-pressed-single.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "forward-pressed-single.png"; path = "Resources/mainwindow/forward-pressed-single.png"; sourceTree = "<group>"; };
CCE4057915655B1900FA5CCA /* forward-single.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "forward-single.png"; path = "Resources/mainwindow/forward-single.png"; sourceTree = "<group>"; };
CCE4057D15655B2100FA5CCA /* back-pressed-single.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "back-pressed-single.png"; path = "Resources/mainwindow/back-pressed-single.png"; sourceTree = "<group>"; };
CCE4058115655B3300FA5CCA /* back-single.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "back-single.png"; path = "Resources/mainwindow/back-single.png"; sourceTree = "<group>"; };
CCF0777913659A8000AF19FD /* SPInvocationGrabbing.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPInvocationGrabbing.h; path = ../../../modules/gui/macosx/SPInvocationGrabbing.h; sourceTree = "<group>"; };
CCF0777A13659A8000AF19FD /* SPInvocationGrabbing.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPInvocationGrabbing.m; path = ../../../modules/gui/macosx/SPInvocationGrabbing.m; sourceTree = "<group>"; };
CCF0777B13659A8000AF19FD /* SPMediaKeyTap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPMediaKeyTap.h; path = ../../../modules/gui/macosx/SPMediaKeyTap.h; sourceTree = "<group>"; };
......@@ -925,6 +933,8 @@
children = (
CC04332B13B28B8200D7D52E /* back-pressed.png */,
CC04332C13B28B8200D7D52E /* back.png */,
CCE4057D15655B2100FA5CCA /* back-pressed-single.png */,
CCE4058115655B3300FA5CCA /* back-single.png */,
CC9B43AE13B29C79000205AE /* bottom-background.png */,
CC5800F41423A80400166912 /* bottombar-mini.png */,
CC04332E13B28B8200D7D52E /* effects-double-buttons-blue.png */,
......@@ -934,6 +944,8 @@
CC04333213B28B8200D7D52E /* effects-one-button.png */,
CC04333513B28B8200D7D52E /* forward-pressed.png */,
CC04333613B28B8200D7D52E /* forward.png */,
CCE4057815655B1900FA5CCA /* forward-pressed-single.png */,
CCE4057915655B1900FA5CCA /* forward-single.png */,
CC04333713B28B8200D7D52E /* fullscreen-double-buttons-pressed.png */,
CC04333813B28B8200D7D52E /* fullscreen-double-buttons.png */,
CC0F725015063C820086B6A0 /* fullscreen-one-button-pressed.png */,
......@@ -1543,6 +1555,10 @@
CC0F725715063C980086B6A0 /* fullscreen-one-button_dark.png in Resources */,
CC0F725815063C980086B6A0 /* fullscreen-one-button-pressed_dark.png in Resources */,
CC68B0331544C1AE00FD9C7F /* vlc-xmas.png in Resources */,
CCE4057A15655B1900FA5CCA /* forward-pressed-single.png in Resources */,
CCE4057B15655B1900FA5CCA /* forward-single.png in Resources */,
CCE4057F15655B2100FA5CCA /* back-pressed-single.png in Resources */,
CCE4058215655B3300FA5CCA /* back-single.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
/*****************************************************************************
* MainMenu.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011 Felix Paul Kühne
* Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
......@@ -102,6 +102,7 @@
IBOutlet NSMenu * o_mu_title;
IBOutlet NSMenuItem * o_mi_chapter;
IBOutlet NSMenu * o_mu_chapter;
IBOutlet NSMenuItem * o_mi_toggleJumpButtons;
IBOutlet NSMenu * o_mu_audio;
IBOutlet NSMenuItem * o_mi_vol_up;
......@@ -212,6 +213,7 @@
- (void)updateRecordState:(BOOL)b_value;
- (IBAction)setPlaybackRate:(id)sender;
- (void)updatePlaybackRate;
- (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)toggleFullscreen:(id)sender;
- (IBAction)resizeVideoWindow:(id)sender;
......
/*****************************************************************************
* MainMenu.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2011 Felix Paul Kühne
* Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
......@@ -281,6 +281,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_quitAfterPB setTitle: _NS("Quit after Playback")];
[o_mi_fwd setTitle: _NS("Step Forward")];
[o_mi_bwd setTitle: _NS("Step Backward")];
[o_mi_toggleJumpButtons setTitle: _NS("Show Previous & Next Buttons")];
[o_mi_toggleJumpButtons setState: config_GetInt( VLCIntf, "macosx-show-playback-buttons")];
[o_mi_program setTitle: _NS("Program")];
[o_mu_program setTitle: _NS("Program")];
......@@ -609,8 +611,16 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_rate_sld setIntValue: i];
}
- (IBAction)toggleJumpButtons:(id)sender
{
BOOL b_value = !config_GetInt( VLCIntf, "macosx-show-playback-buttons" );
config_PutInt( VLCIntf, "macosx-show-playback-buttons", b_value );
[[[VLCMain sharedInstance] mainWindow] toggleJumpButtons];
[o_mi_toggleJumpButtons setState: b_value];
}
#pragma mark -
#pragma video menu
#pragma mark video menu
- (IBAction)toggleFullscreen:(id)sender
{
[[VLCCoreInteraction sharedInstance] toggleFullscreen];
......
......@@ -94,6 +94,7 @@
BOOL b_splitview_removed;
BOOL b_minimized_view;
BOOL b_video_deco;
BOOL b_show_jump_buttons;
int i_lastSplitViewHeight;
int i_lastShownVolume;
input_state_e cachedInputState;
......@@ -117,6 +118,9 @@
NSTimeInterval last_bwd_event;
BOOL just_triggered_next;
BOOL just_triggered_previous;
NSButton * o_prev_btn;
NSButton * o_next_btn;
NSMutableArray *o_sidebaritems;
BOOL b_nonembedded;
......@@ -171,6 +175,7 @@
- (void)setRepeatAll;
- (void)setRepeatOff;
- (void)setShuffle;
- (void)toggleJumpButtons;
- (void)drawFancyGradientEffectForTimeSlider;
......
......@@ -277,6 +277,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
[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];
/* interface builder action */
float f_threshold_height = f_min_video_height + [o_bottombar_view frame].size.height;
if( b_dark_interface )
......@@ -585,6 +589,130 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
}
#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];
else
[self removeJumpButtons];
}
- (void)addJumpButtons
{
NSRect preliminaryFrame = [o_bwd_btn frame];
BOOL b_enabled = [o_bwd_btn isEnabled];
preliminaryFrame.size.width = 26.;
o_prev_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_prev_btn setButtonType: NSMomentaryChangeButton];
[o_prev_btn setImage: [NSImage imageNamed:@"back-single"]];
[o_prev_btn setAlternateImage: [NSImage imageNamed:@"back-pressed-single"]];
[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 setEnabled: b_enabled];
o_next_btn = [[NSButton alloc] initWithFrame:preliminaryFrame];
[o_next_btn setButtonType: NSMomentaryChangeButton];
[o_next_btn setImage: [NSImage imageNamed:@"forward-single"]];
[o_next_btn setAlternateImage: [NSImage imageNamed:@"forward-pressed-single"]];
[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 setEnabled: b_enabled];
NSRect frame;
float f_space = 32.;
#define moveItem( item ) \
frame = [item frame]; \
frame.origin.x = frame.origin.x + f_space; \
[item setFrame: frame]
moveItem( o_bwd_btn );
moveItem( o_play_btn );
moveItem( o_fwd_btn );
f_space = 62.;
moveItem( o_stop_btn );
moveItem( o_playlist_btn );
moveItem( o_repeat_btn );
moveItem( o_shuffle_btn );
#undef moveItem
#define resizeItem( item ) \
frame = [item frame]; \
frame.size.width = frame.size.width - f_space; \
frame.origin.x = frame.origin.x + f_space; \
[item setFrame: frame]
resizeItem( o_time_sld );
resizeItem( o_progress_bar );
resizeItem( o_time_sld_background );
resizeItem( o_time_sld_fancygradient_view );
#undef resizeItem
preliminaryFrame.origin.x = [o_fwd_btn frame].origin.x + [o_fwd_btn frame].size.width + 4.;
[o_next_btn setFrame: preliminaryFrame];
[[self contentView] addSubview: o_prev_btn];
[[self contentView] addSubview: o_next_btn];
[o_fwd_btn setAction:@selector(forward:)];
[o_bwd_btn setAction:@selector(backward:)];
}
- (void)removeJumpButtons
{
if (!o_prev_btn || !o_next_btn )
return;
[[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];
NSRect frame;
float f_space = 32.;
#define moveItem( item ) \
frame = [item frame]; \
frame.origin.x = frame.origin.x - f_space; \
[item setFrame: frame]
moveItem( o_bwd_btn );
moveItem( o_play_btn );
moveItem( o_fwd_btn );
f_space = 62.;
moveItem( o_stop_btn );
moveItem( o_playlist_btn );
moveItem( o_repeat_btn );
moveItem( o_shuffle_btn );
#undef moveItem
#define resizeItem( item ) \
frame = [item frame]; \
frame.size.width = frame.size.width + f_space; \
frame.origin.x = frame.origin.x - f_space; \
[item setFrame: frame]
resizeItem( o_time_sld );
resizeItem( o_progress_bar );
resizeItem( o_time_sld_background );
resizeItem( o_time_sld_fancygradient_view );
#undef resizeItem
[o_bottombar_view setNeedsDisplay:YES];
[o_fwd_btn setAction:@selector(fwd:)];
[o_bwd_btn setAction:@selector(bwd:)];
}
#pragma mark -
#pragma mark Button Actions
......@@ -609,6 +737,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
just_triggered_previous = NO;
}
- (IBAction)prev:(id)sender
{
[[VLCCoreInteraction sharedInstance] previous];
}
- (IBAction)bwd:(id)sender
{
if(!just_triggered_previous)
......@@ -632,6 +765,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
}
- (IBAction)backward:(id)sender
{
[[VLCCoreInteraction sharedInstance] backwardShort];
}
- (void)resetNextButton
{
if (([NSDate timeIntervalSinceReferenceDate] - last_fwd_event) >= 0.35) {
......@@ -648,6 +786,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
just_triggered_next = NO;
}
- (IBAction)next:(id)sender
{
[[VLCCoreInteraction sharedInstance] next];
}
- (IBAction)forward:(id)sender
{
[[VLCCoreInteraction sharedInstance] forwardShort];
}
- (IBAction)fwd:(id)sender
{
if(!just_triggered_next)
......@@ -1402,6 +1550,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
[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)];
}
if (b_video_deco)
{
[o_detached_fwd_btn setEnabled: (b_seekable || b_plmul || b_chapters)];
......
......@@ -102,10 +102,13 @@ void WindowClose ( vout_window_t * );
#define PAUSE_MINIMIZED_LONGTEXT N_( \
"With this option enabled, the playback will be automatically paused when minimizing the window." )
#define ICONCHANGE_TEXT N_( "Allow automatic icon changes")
#define ICONCHANGE_LONGTEXT N_( "This option allows the interface to change its icon on various occasions.")
#define ICONCHANGE_TEXT N_( "Allow automatic icon changes" )
#define ICONCHANGE_LONGTEXT N_( "This option allows the interface to change its icon on various occasions." )
#define LOCK_ASPECT_RATIO_TEXT N_("Lock Aspect Ratio")
#define LOCK_ASPECT_RATIO_TEXT N_( "Lock Aspect Ratio" )
#define JUMPBUTTONS_TEXT N_( "Shows playlist item control buttons" )
#define JUMPBUTTONS_LONGTEXT N_("Shows the previous and next buttons in the main window" )
vlc_module_begin ()
set_description( N_("Mac OS X interface") )
......@@ -129,6 +132,7 @@ vlc_module_begin ()
add_bool( "macosx-pause-minimized", false, PAUSE_MINIMIZED_TEXT, PAUSE_MINIMIZED_LONGTEXT, false )
add_bool( "macosx-lock-aspect-ratio", true, LOCK_ASPECT_RATIO_TEXT, LOCK_ASPECT_RATIO_TEXT, true )
add_bool( "macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true )
add_bool( "macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false )
add_submodule ()
set_description( "Mac OS X Video Output Provider" )
......
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