Commit 9e62f5f7 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/MainWindow: added a fast-mode to show/hide the customizable buttons,...

macosx/MainWindow: added a fast-mode to show/hide the customizable buttons, since there is no need to do CoreAnimation stuff in a hidden window (close #7360)
parent 1674102a
...@@ -316,11 +316,11 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -316,11 +316,11 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_show_jump_buttons = config_GetInt( VLCIntf, "macosx-show-playback-buttons" ); b_show_jump_buttons = config_GetInt( VLCIntf, "macosx-show-playback-buttons" );
if (b_show_jump_buttons) if (b_show_jump_buttons)
[self addJumpButtons]; [self addJumpButtons:YES];
b_show_playmode_buttons = config_GetInt( VLCIntf, "macosx-show-playmode-buttons" ); b_show_playmode_buttons = config_GetInt( VLCIntf, "macosx-show-playmode-buttons" );
if (!b_show_playmode_buttons) if (!b_show_playmode_buttons)
[self removePlaymodeButtons]; [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_bottombar_view frame].size.height;
...@@ -645,12 +645,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -645,12 +645,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_show_jump_buttons = config_GetInt( VLCIntf, "macosx-show-playback-buttons" ); b_show_jump_buttons = config_GetInt( VLCIntf, "macosx-show-playback-buttons" );
if (b_show_jump_buttons) if (b_show_jump_buttons)
[self addJumpButtons]; [self addJumpButtons:NO];
else else
[self removeJumpButtons]; [self removeJumpButtons:NO];
} }
- (void)addJumpButtons - (void)addJumpButtons:(BOOL)b_fast
{ {
NSRect preliminaryFrame = [o_bwd_btn frame]; NSRect preliminaryFrame = [o_bwd_btn frame];
BOOL b_enabled = [o_bwd_btn isEnabled]; BOOL b_enabled = [o_bwd_btn isEnabled];
...@@ -682,6 +682,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -682,6 +682,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
#define moveItem( item ) \ #define moveItem( item ) \
frame = [item frame]; \ frame = [item frame]; \
frame.origin.x = frame.origin.x + f_space; \ frame.origin.x = frame.origin.x + f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
moveItem( o_bwd_btn ); moveItem( o_bwd_btn );
...@@ -698,6 +701,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -698,6 +701,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame = [item frame]; \ frame = [item frame]; \
frame.size.width = frame.size.width - f_space; \ frame.size.width = frame.size.width - f_space; \
frame.origin.x = frame.origin.x + f_space; \ frame.origin.x = frame.origin.x + f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
resizeItem( o_time_sld ); resizeItem( o_time_sld );
...@@ -709,21 +715,31 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -709,21 +715,31 @@ static VLCMainWindow *_o_sharedInstance = nil;
preliminaryFrame.origin.x = [o_next_btn frame].origin.x + 80. + [o_fwd_btn frame].size.width; preliminaryFrame.origin.x = [o_next_btn frame].origin.x + 80. + [o_fwd_btn frame].size.width;
[o_next_btn setFrame: preliminaryFrame]; [o_next_btn setFrame: preliminaryFrame];
// wait until the animation is done // 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_prev_btn afterDelay:.2];
[[self contentView] performSelector:@selector(addSubview:) withObject:o_next_btn afterDelay:.2]; [[self contentView] performSelector:@selector(addSubview:) withObject:o_next_btn afterDelay:.2];
}
[o_fwd_btn setAction:@selector(forward:)]; [o_fwd_btn setAction:@selector(forward:)];
[o_bwd_btn setAction:@selector(backward:)]; [o_bwd_btn setAction:@selector(backward:)];
} }
- (void)removeJumpButtons - (void)removeJumpButtons:(BOOL)b_fast
{ {
if (!o_prev_btn || !o_next_btn ) if (!o_prev_btn || !o_next_btn )
return; return;
if( b_fast ) {
[o_prev_btn setHidden: YES];
[o_next_btn setHidden: YES];
} else {
[[o_prev_btn animator] setHidden: YES]; [[o_prev_btn animator] setHidden: YES];
[[o_next_btn animator] setHidden: YES]; [[o_next_btn animator] setHidden: YES];
}
[o_prev_btn removeFromSuperviewWithoutNeedingDisplay]; [o_prev_btn removeFromSuperviewWithoutNeedingDisplay];
[o_next_btn removeFromSuperviewWithoutNeedingDisplay]; [o_next_btn removeFromSuperviewWithoutNeedingDisplay];
[o_prev_btn release]; [o_prev_btn release];
...@@ -734,6 +750,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -734,6 +750,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
#define moveItem( item ) \ #define moveItem( item ) \
frame = [item frame]; \ frame = [item frame]; \
frame.origin.x = frame.origin.x - f_space; \ frame.origin.x = frame.origin.x - f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
moveItem( o_bwd_btn ); moveItem( o_bwd_btn );
...@@ -750,6 +769,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -750,6 +769,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame = [item frame]; \ frame = [item frame]; \
frame.size.width = frame.size.width + f_space; \ frame.size.width = frame.size.width + f_space; \
frame.origin.x = frame.origin.x - f_space; \ frame.origin.x = frame.origin.x - f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
resizeItem( o_time_sld ); resizeItem( o_time_sld );
...@@ -769,12 +791,12 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -769,12 +791,12 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_show_playmode_buttons = config_GetInt( VLCIntf, "macosx-show-playmode-buttons" ); b_show_playmode_buttons = config_GetInt( VLCIntf, "macosx-show-playmode-buttons" );
if (b_show_playmode_buttons) if (b_show_playmode_buttons)
[self addPlaymodeButtons]; [self addPlaymodeButtons:NO];
else else
[self removePlaymodeButtons]; [self removePlaymodeButtons:NO];
} }
- (void)addPlaymodeButtons - (void)addPlaymodeButtons:(BOOL)b_fast
{ {
NSRect frame; NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.; float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
...@@ -785,6 +807,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -785,6 +807,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame = [item frame]; \ frame = [item frame]; \
frame.size.width = frame.size.width - f_space; \ frame.size.width = frame.size.width - f_space; \
frame.origin.x = frame.origin.x + f_space; \ frame.origin.x = frame.origin.x + f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
resizeItem( o_time_sld ); resizeItem( o_time_sld );
...@@ -793,11 +818,16 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -793,11 +818,16 @@ static VLCMainWindow *_o_sharedInstance = nil;
resizeItem( o_time_sld_fancygradient_view ); resizeItem( o_time_sld_fancygradient_view );
#undef resizeItem #undef resizeItem
if (b_fast) {
[o_repeat_btn setHidden: NO];
[o_shuffle_btn setHidden: NO];
} else {
[[o_repeat_btn animator] setHidden: NO]; [[o_repeat_btn animator] setHidden: NO];
[[o_shuffle_btn animator] setHidden: NO]; [[o_shuffle_btn animator] setHidden: NO];
}
} }
- (void)removePlaymodeButtons - (void)removePlaymodeButtons:(BOOL)b_fast
{ {
NSRect frame; NSRect frame;
float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.; float f_space = [o_repeat_btn frame].size.width + [o_shuffle_btn frame].size.width - 6.;
...@@ -810,6 +840,9 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -810,6 +840,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
frame = [item frame]; \ frame = [item frame]; \
frame.size.width = frame.size.width + f_space; \ frame.size.width = frame.size.width + f_space; \
frame.origin.x = frame.origin.x - f_space; \ frame.origin.x = frame.origin.x - f_space; \
if( b_fast ) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame] [[item animator] setFrame: frame]
resizeItem( o_time_sld ); resizeItem( o_time_sld );
......
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