Commit 2828486c authored by David Fuhrmann's avatar David Fuhrmann

macosx: add option to hide effects button in control bar

parent 534f8d2f
......@@ -141,6 +141,7 @@
- (void)setShuffle;
- (IBAction)shuffle:(id)sender;
- (void)toggleEffectsButton;
- (void)toggleJumpButtons;
- (void)togglePlaymodeButtons;
......
......@@ -140,7 +140,7 @@
if ([[o_bottombar_view window] styleMask] & NSResizableWindowMask)
[o_resize_view removeFromSuperviewWithoutNeedingDisplay];
// remove fullscreen button for lion fullscreen
if (b_nativeFullscreenMode) {
float f_width = [o_fullscreen_btn frame].size.width;
......@@ -531,7 +531,7 @@ frame.origin.x = f_width + frame.origin.x; \
// time field and progress bar are moved in super method!
}
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
if (b_show_jump_buttons)
......@@ -541,6 +541,9 @@ frame.origin.x = f_width + frame.origin.x; \
if (!b_show_playmode_buttons)
[self removePlaymodeButtons:YES];
if (!config_GetInt(VLCIntf, "macosx-show-effects-button"))
[self removeEffectsButton:YES];
[[VLCMain sharedInstance] playbackModeUpdated];
}
......@@ -548,6 +551,118 @@ frame.origin.x = f_width + frame.origin.x; \
#pragma mark -
#pragma mark interface customization
- (void)toggleEffectsButton
{
if (config_GetInt(VLCIntf, "macosx-show-effects-button"))
[self addEffectsButton:NO];
else
[self removeEffectsButton:NO];
}
- (void)addEffectsButton:(BOOL)b_fast
{
if (!o_effects_btn)
return;
if (b_fast) {
[o_effects_btn setHidden: NO];
} else {
[[o_effects_btn animator] setHidden: NO];
}
#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]
NSRect frame;
float f_space = [o_effects_btn frame].size.width;
// extra margin between button and volume up button
if (b_nativeFullscreenMode)
f_space += 2;
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 = frame.size.width - f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (!b_nativeFullscreenMode) {
if (b_dark_interface) {
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons_dark"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed_dark"]];
} else {
[o_fullscreen_btn setImage: [NSImage imageNamed:@"fullscreen-double-buttons"]];
[o_fullscreen_btn setAlternateImage: [NSImage imageNamed:@"fullscreen-double-buttons-pressed"]];
}
}
[o_bottombar_view setNeedsDisplay:YES];
}
- (void)removeEffectsButton:(BOOL)b_fast
{
if (!o_effects_btn)
return;
[o_effects_btn setHidden: YES];
#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]
NSRect frame;
float f_space = [o_effects_btn frame].size.width;
// extra margin between button and volume up button
if (b_nativeFullscreenMode)
f_space += 2;
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 = frame.size.width + f_space;
if (b_fast)
[o_progress_view setFrame: frame];
else
[[o_progress_view animator] setFrame: frame];
if (!b_nativeFullscreenMode) {
if (b_dark_interface) {
[[o_fullscreen_btn animator] setImage: [NSImage imageNamed:@"fullscreen-one-button_dark"]];
[[o_fullscreen_btn animator] setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed_dark"]];
} else {
[[o_fullscreen_btn animator] setImage: [NSImage imageNamed:@"fullscreen-one-button"]];
[[o_fullscreen_btn animator] setAlternateImage: [NSImage imageNamed:@"fullscreen-one-button-pressed"]];
}
}
[o_bottombar_view setNeedsDisplay:YES];
}
- (void)toggleJumpButtons
{
b_show_jump_buttons = config_GetInt(VLCIntf, "macosx-show-playback-buttons");
......@@ -616,7 +731,7 @@ if (b_fast) \
[item setFrame: frame]; \
else \
[[item animator] setFrame: frame]
float f_space = 29.;
moveItem(o_bwd_btn);
f_space = 28.;
......
......@@ -80,6 +80,7 @@
IBOutlet NSMenu * o_mu_view;
IBOutlet NSMenuItem * o_mi_toggleJumpButtons;
IBOutlet NSMenuItem * o_mi_togglePlaymodeButtons;
IBOutlet NSMenuItem * o_mi_toggleEffectsButton;
IBOutlet NSMenuItem * o_mi_toggleSidebar;
IBOutlet NSMenu * o_mu_playlistTableColumns;
NSMenu * o_mu_playlistTableColumnsContextMenu;
......@@ -226,6 +227,7 @@
- (IBAction)intfOpenNet:(id)sender;
- (IBAction)intfOpenCapture:(id)sender;
- (IBAction)toggleEffectsButton:(id)sender;
- (IBAction)toggleJumpButtons:(id)sender;
- (IBAction)togglePlaymodeButtons:(id)sender;
- (IBAction)toggleSidebar:(id)sender;
......
......@@ -300,6 +300,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_toggleJumpButtons setState: config_GetInt(VLCIntf, "macosx-show-playback-buttons")];
[o_mi_togglePlaymodeButtons setTitle: _NS("Show Shuffle & Repeat Buttons")];
[o_mi_togglePlaymodeButtons setState: config_GetInt(VLCIntf, "macosx-show-playmode-buttons")];
[o_mi_toggleEffectsButton setTitle: _NS("Show Audio Effects Button")];
[o_mi_toggleEffectsButton setState: config_GetInt(VLCIntf, "macosx-show-effects-button")];
[o_mi_toggleSidebar setTitle: _NS("Show Sidebar")];
[o_mi_toggleSidebar setState: config_GetInt(VLCIntf, "macosx-show-sidebar")];
[o_mu_playlistTableColumns setTitle: _NS("Playlist Table Columns")];
......@@ -635,6 +637,15 @@ static VLCMainMenu *_o_sharedInstance = nil;
#pragma mark -
#pragma mark View
- (IBAction)toggleEffectsButton:(id)sender
{
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-effects-button");
config_PutInt(VLCIntf, "macosx-show-effects-button", b_value);
[[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleEffectsButton];
[o_mi_toggleEffectsButton setState: b_value];
}
- (IBAction)toggleJumpButtons:(id)sender
{
BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playback-buttons");
......
......@@ -117,6 +117,9 @@ void WindowClose (vout_window_t *);
#define PLAYMODEBUTTONS_TEXT N_("Show play mode control buttons")
#define PLAYMODEBUTTONS_LONGTEXT N_("Shows the shuffle and repeat buttons in the main window.")
#define EFFECTSBUTTON_TEXT N_("Show audio effects button")
#define EFFECTSBUTTON_LONGTEXT N_("Shows the audio effects button in the main window.")
#define SIDEBAR_TEXT N_("Show sidebar")
#define SIDEBAR_LONGTEXT N_("Shows a sidebar in the main window listing media sources.")
......@@ -143,6 +146,8 @@ vlc_module_begin()
add_bool("macosx-icon-change", true, ICONCHANGE_TEXT, ICONCHANGE_LONGTEXT, true)
add_bool("macosx-show-playback-buttons", false, JUMPBUTTONS_TEXT, JUMPBUTTONS_LONGTEXT, false)
add_bool("macosx-show-playmode-buttons", true, PLAYMODEBUTTONS_TEXT, PLAYMODEBUTTONS_LONGTEXT, false)
add_bool("macosx-show-effects-button", false, EFFECTSBUTTON_TEXT, EFFECTSBUTTON_LONGTEXT, false)
add_bool("macosx-show-sidebar", true, SIDEBAR_TEXT, SIDEBAR_LONGTEXT, false)
set_section(N_("Behaviour"), 0)
......
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