[vlc-commits] macosx: unify functionality of fwd/bwd buttons in video window

David Fuhrmann git at videolan.org
Sun Nov 17 18:31:19 CET 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Nov 17 18:21:37 2013 +0100| [941cff445097b422455c333af47230b8dfe93283] | committer: David Fuhrmann

macosx: unify functionality of fwd/bwd buttons in video window

Behaviour is now the same as the buttons in main window

close #9512

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=941cff445097b422455c333af47230b8dfe93283
---

 modules/gui/macosx/ControlsBar.h |    1 +
 modules/gui/macosx/ControlsBar.m |   61 +++++++++++++++++++++++---------------
 modules/gui/macosx/MainMenu.m    |    5 ++++
 3 files changed, 43 insertions(+), 24 deletions(-)

diff --git a/modules/gui/macosx/ControlsBar.h b/modules/gui/macosx/ControlsBar.h
index d7637c2..c0fd5a1 100644
--- a/modules/gui/macosx/ControlsBar.h
+++ b/modules/gui/macosx/ControlsBar.h
@@ -71,6 +71,7 @@
 @property (readonly) id bottomBarView;
 
 - (CGFloat)height;
+- (void)toggleForwardBackwardMode:(BOOL)b_alt;
 
 - (IBAction)play:(id)sender;
 - (IBAction)bwd:(id)sender;
diff --git a/modules/gui/macosx/ControlsBar.m b/modules/gui/macosx/ControlsBar.m
index 8fec32a..7750623 100644
--- a/modules/gui/macosx/ControlsBar.m
+++ b/modules/gui/macosx/ControlsBar.m
@@ -156,6 +156,9 @@
         [o_fullscreen_btn removeFromSuperviewWithoutNeedingDisplay];
     }
 
+    if (config_GetInt(VLCIntf, "macosx-show-playback-buttons"))
+        [self toggleForwardBackwardMode: YES];
+
 }
 
 - (CGFloat)height
@@ -163,6 +166,26 @@
     return [o_bottombar_view frame].size.height;
 }
 
+- (void)toggleForwardBackwardMode:(BOOL)b_alt
+{
+    if (b_alt == YES) {
+        /* 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];
+
+        [o_fwd_btn setAction:@selector(alternateForward:)];
+        [o_bwd_btn setAction:@selector(alternateBackward:)];
+
+    } else {
+        /* 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];
+
+        [o_fwd_btn setAction:@selector(fwd:)];
+        [o_bwd_btn setAction:@selector(bwd:)];
+    }
+}
+
 #pragma mark -
 #pragma mark Button Actions
 
@@ -241,6 +264,17 @@
     }
 }
 
+// alternative actions for forward / backward buttons when next / prev are activated
+- (IBAction)alternateForward:(id)sender
+{
+    [[VLCCoreInteraction sharedInstance] forwardExtraShort];
+}
+
+- (IBAction)alternateBackward:(id)sender
+{
+    [[VLCCoreInteraction sharedInstance] backwardExtraShort];
+}
+
 - (IBAction)timeSliderAction:(id)sender
 {
     float f_updated;
@@ -740,10 +774,6 @@ else \
         [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--;
@@ -804,8 +834,7 @@ else \
         [o_bottombar_view performSelector:@selector(addSubview:) withObject:o_next_btn afterDelay:.2];
     }
 
-    [o_fwd_btn setAction:@selector(forward:)];
-    [o_bwd_btn setAction:@selector(backward:)];
+    [self toggleForwardBackwardMode: YES];
 }
 
 - (void)removeJumpButtons:(BOOL)b_fast
@@ -827,10 +856,6 @@ else \
     [o_next_btn release];
     o_next_btn = NULL;
 
-    /* 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++;
@@ -879,10 +904,9 @@ else \
         [[o_bwd_btn animator] setAlternateImage:[NSImage imageNamed:@"backward-3btns-pressed"]];
     }
 
-    [o_bottombar_view setNeedsDisplay:YES];
+    [self toggleForwardBackwardMode: NO];
 
-    [o_fwd_btn setAction:@selector(fwd:)];
-    [o_bwd_btn setAction:@selector(bwd:)];
+    [o_bottombar_view setNeedsDisplay:YES];
 }
 
 - (void)togglePlaymodeButtons
@@ -974,17 +998,6 @@ else \
     [[VLCCoreInteraction sharedInstance] next];
 }
 
-// alternative actions for forward / backward buttons when next / prev are activated
-- (IBAction)forward:(id)sender
-{
-    [[VLCCoreInteraction sharedInstance] forwardExtraShort];
-}
-
-- (IBAction)backward:(id)sender
-{
-    [[VLCCoreInteraction sharedInstance] backwardExtraShort];
-}
-
 - (void)setRepeatOne
 {
     [o_repeat_btn setImage: o_repeat_one_img];
diff --git a/modules/gui/macosx/MainMenu.m b/modules/gui/macosx/MainMenu.m
index d61893e..5ed377f 100644
--- a/modules/gui/macosx/MainMenu.m
+++ b/modules/gui/macosx/MainMenu.m
@@ -707,7 +707,12 @@ static VLCMainMenu *_o_sharedInstance = nil;
 {
     BOOL b_value = !config_GetInt(VLCIntf, "macosx-show-playback-buttons");
     config_PutInt(VLCIntf, "macosx-show-playback-buttons", b_value);
+
     [[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
+    [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
+        [[o_window controlsBar] toggleForwardBackwardMode: b_value];
+    }];
+
     [o_mi_toggleJumpButtons setState: b_value];
 }
 



More information about the vlc-commits mailing list