[vlc-commits] macosx: main window: Hide prev and next button like all the others

David Fuhrmann git at videolan.org
Sat Apr 22 16:35:57 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Apr 22 16:29:49 2017 +0200| [3fbcb41a108211722b98f2be128a9c19a4c45003] | committer: David Fuhrmann

macosx: main window: Hide prev and next button like all the others

Add those buttons in interface builder, and hide them like the
others. Remove custom creation code for these buttons.

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

 modules/gui/macosx/UI/MainWindow.xib          |  76 ++++++++---
 modules/gui/macosx/VLCMainWindowControlsBar.h |   3 +
 modules/gui/macosx/VLCMainWindowControlsBar.m | 188 ++++++--------------------
 3 files changed, 103 insertions(+), 164 deletions(-)

diff --git a/modules/gui/macosx/UI/MainWindow.xib b/modules/gui/macosx/UI/MainWindow.xib
index 6ca60d45bb..13f1e82d58 100644
--- a/modules/gui/macosx/UI/MainWindow.xib
+++ b/modules/gui/macosx/UI/MainWindow.xib
@@ -49,7 +49,7 @@
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <subviews>
                                                         <outlineView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="sourceList" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="20" indentationPerLevel="14" autoresizesOutlineColumn="YES" outlineTableColumn="4717" id="4714" customClass="PXSourceList">
-                                                            <rect key="frame" x="0.0" y="0.0" width="236" height="295"/>
+                                                            <rect key="frame" x="0.0" y="0.0" width="203" height="20"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
                                                             <size key="intercellSpacing" width="3" height="0.0"/>
                                                             <color key="backgroundColor" name="_sourceListBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -312,14 +312,27 @@
                                 <rect key="frame" x="0.0" y="0.0" width="716" height="36"/>
                                 <subviews>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="jlp-Z2-Qdl" userLabel="Playback Buttons">
-                                        <rect key="frame" x="6" y="7" width="85" height="23"/>
+                                        <rect key="frame" x="6" y="7" width="141" height="23"/>
                                         <subviews>
-                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="3651">
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="qfh-30-nky" userLabel="Previous Button">
                                                 <rect key="frame" x="0.0" y="0.0" width="29" height="23"/>
                                                 <constraints>
+                                                    <constraint firstAttribute="height" constant="23" id="bsS-LC-mxp"/>
+                                                </constraints>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="previous-6btns" imagePosition="only" alignment="center" alternateImage="previous-6btns-pressed" continuous="YES" enabled="NO" id="KXm-ys-zEA">
+                                                    <behavior key="behavior" lightByContents="YES"/>
+                                                    <font key="font" metaFont="label"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="prev:" target="5339" id="u4U-W5-1Is"/>
+                                                </connections>
+                                            </button>
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="3651">
+                                                <rect key="frame" x="29" y="0.0" width="28" height="23"/>
+                                                <constraints>
                                                     <constraint firstAttribute="height" constant="23" id="Z0f-cm-vnG"/>
                                                 </constraints>
-                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-3btns" imagePosition="only" alignment="center" alternateImage="backward-3btns-pressed" continuous="YES" enabled="NO" id="4278">
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="backward-6btns" imagePosition="only" alignment="center" alternateImage="backward-6btns-pressed" continuous="YES" enabled="NO" id="4278">
                                                     <behavior key="behavior" lightByContents="YES"/>
                                                     <font key="font" metaFont="label"/>
                                                 </buttonCell>
@@ -328,7 +341,7 @@
                                                 </connections>
                                             </button>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="3571">
-                                                <rect key="frame" x="29" y="0.0" width="27" height="23"/>
+                                                <rect key="frame" x="57" y="0.0" width="27" height="23"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="23" id="Xgs-ps-uT9"/>
                                                 </constraints>
@@ -341,11 +354,11 @@
                                                 </connections>
                                             </button>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="3648">
-                                                <rect key="frame" x="56" y="0.0" width="29" height="23"/>
+                                                <rect key="frame" x="84" y="0.0" width="28" height="23"/>
                                                 <constraints>
                                                     <constraint firstAttribute="height" constant="23" id="4yC-kJ-7V9"/>
                                                 </constraints>
-                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-3btns-dark" imagePosition="only" alignment="center" alternateImage="forward-3btns-dark-pressed" continuous="YES" enabled="NO" id="4275">
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="forward-6btns" imagePosition="only" alignment="center" alternateImage="forward-6btns-pressed" continuous="YES" enabled="NO" id="4275">
                                                     <behavior key="behavior" lightByContents="YES"/>
                                                     <font key="font" metaFont="label"/>
                                                 </buttonCell>
@@ -353,20 +366,37 @@
                                                     <action selector="fwd:" target="5339" id="5345"/>
                                                 </connections>
                                             </button>
+                                            <button translatesAutoresizingMaskIntoConstraints="NO" id="HBS-xq-EkN" userLabel="Next Button">
+                                                <rect key="frame" x="112" y="0.0" width="29" height="23"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="23" id="Icc-CC-PIU"/>
+                                                </constraints>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" image="next-6btns" imagePosition="only" alignment="center" alternateImage="next-6btns-pressed" continuous="YES" enabled="NO" id="tLR-jN-43M">
+                                                    <behavior key="behavior" lightByContents="YES"/>
+                                                    <font key="font" metaFont="label"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="next:" target="5339" id="pTZ-vt-eta"/>
+                                                </connections>
+                                            </button>
                                         </subviews>
                                         <constraints>
                                             <constraint firstAttribute="bottom" secondItem="3648" secondAttribute="bottom" id="5pF-b1-jk1"/>
+                                            <constraint firstAttribute="bottom" secondItem="qfh-30-nky" secondAttribute="bottom" id="77t-B8-HS7"/>
                                             <constraint firstAttribute="height" constant="23" id="7WQ-sL-o5r"/>
+                                            <constraint firstItem="qfh-30-nky" firstAttribute="left" secondItem="jlp-Z2-Qdl" secondAttribute="left" id="CFe-7h-rbP"/>
                                             <constraint firstAttribute="bottom" secondItem="3651" secondAttribute="bottom" id="Ch4-MH-qNm"/>
-                                            <constraint firstAttribute="right" secondItem="3648" secondAttribute="right" id="GkW-SV-0Wa"/>
+                                            <constraint firstAttribute="bottom" secondItem="HBS-xq-EkN" secondAttribute="bottom" id="KPu-7N-4el"/>
+                                            <constraint firstItem="qfh-30-nky" firstAttribute="right" secondItem="3651" secondAttribute="left" id="iH0-kR-WOU"/>
+                                            <constraint firstItem="3648" firstAttribute="right" secondItem="HBS-xq-EkN" secondAttribute="left" id="jwm-qd-Ded"/>
                                             <constraint firstItem="3571" firstAttribute="left" secondItem="3651" secondAttribute="right" id="pes-MD-nr6"/>
-                                            <constraint firstItem="3651" firstAttribute="left" secondItem="jlp-Z2-Qdl" secondAttribute="left" id="sFB-pd-bnP"/>
+                                            <constraint firstAttribute="right" secondItem="HBS-xq-EkN" secondAttribute="right" id="skO-xe-5v0"/>
                                             <constraint firstAttribute="bottom" secondItem="3571" secondAttribute="bottom" id="vqb-wZ-Gyb"/>
                                             <constraint firstItem="3648" firstAttribute="left" secondItem="3571" secondAttribute="right" id="ysd-SC-AeK"/>
                                         </constraints>
                                     </customView>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="3647">
-                                        <rect key="frame" x="93" y="6" width="29" height="23"/>
+                                        <rect key="frame" x="149" y="6" width="29" height="23"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="23" id="m6O-Hj-xpC"/>
                                         </constraints>
@@ -379,7 +409,7 @@
                                         </connections>
                                     </button>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="mrr-Bw-co0" userLabel="Left Control Buttons">
-                                        <rect key="frame" x="124" y="6" width="85" height="23"/>
+                                        <rect key="frame" x="180" y="6" width="85" height="23"/>
                                         <subviews>
                                             <button translatesAutoresizingMaskIntoConstraints="NO" id="4671">
                                                 <rect key="frame" x="0.0" y="0.0" width="28" height="23"/>
@@ -433,19 +463,19 @@
                                         </constraints>
                                     </customView>
                                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="5335" customClass="VLCProgressView">
-                                        <rect key="frame" x="215" y="11" width="303" height="14"/>
+                                        <rect key="frame" x="271" y="11" width="247" height="14"/>
                                         <subviews>
                                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="4919" customClass="VLCThreePartImageView">
-                                                <rect key="frame" x="0.0" y="0.0" width="303" height="14"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="247" height="14"/>
                                             </customView>
                                             <customView hidden="YES" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4701" customClass="VLCThreePartImageView">
-                                                <rect key="frame" x="124" y="-191" width="101" height="54"/>
+                                                <rect key="frame" x="-153" y="196" width="188" height="159"/>
                                             </customView>
                                             <progressIndicator hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" controlSize="small" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="3584" userLabel="Buffering Bar">
-                                                <rect key="frame" x="0.0" y="1" width="303" height="12"/>
+                                                <rect key="frame" x="0.0" y="1" width="247" height="12"/>
                                             </progressIndicator>
                                             <slider hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4422" customClass="TimeLineSlider">
-                                                <rect key="frame" x="0.0" y="0.0" width="303" height="17"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="247" height="17"/>
                                                 <sliderCell key="cell" controlSize="small" continuous="YES" state="on" alignment="left" maxValue="10000" doubleValue="3204.0777439024391" tickMarkPosition="above" sliderType="linear" id="4425">
                                                     <font key="font" size="12" name="Helvetica"/>
                                                 </sliderCell>
@@ -681,8 +711,10 @@
                 <outlet property="effectsButton" destination="3654" id="VfE-Hs-5Ni"/>
                 <outlet property="forwardButton" destination="3648" id="0bA-YS-tkr"/>
                 <outlet property="fullscreenButton" destination="4419" id="hgS-Tk-jle"/>
+                <outlet property="nextButton" destination="HBS-xq-EkN" id="MIO-Ba-jDH"/>
                 <outlet property="playButton" destination="3571" id="5Mf-48-Ga9"/>
                 <outlet property="playlistButton" destination="4671" id="AZd-5b-MrA"/>
+                <outlet property="prevButton" destination="qfh-30-nky" id="uN2-nC-7Mt"/>
                 <outlet property="progressBar" destination="3584" id="d57-az-Grm"/>
                 <outlet property="progressView" destination="5335" id="dBT-U1-rmL"/>
                 <outlet property="repeatButton" destination="2789" id="lRj-JN-Yry"/>
@@ -959,20 +991,24 @@ Gw
         </window>
     </objects>
     <resources>
-        <image name="backward-3btns" width="29" height="23"/>
-        <image name="backward-3btns-pressed" width="29" height="23"/>
+        <image name="backward-6btns" width="28" height="23"/>
+        <image name="backward-6btns-pressed" width="28" height="23"/>
         <image name="dropzone" width="112" height="112"/>
         <image name="dropzone-background" width="4" height="4"/>
         <image name="effects-double-buttons" width="29" height="23"/>
         <image name="effects-double-buttons-pressed" width="29" height="23"/>
-        <image name="forward-3btns-dark" width="29" height="23"/>
-        <image name="forward-3btns-dark-pressed" width="29" height="23"/>
+        <image name="forward-6btns" width="28" height="23"/>
+        <image name="forward-6btns-pressed" width="28" height="23"/>
         <image name="fullscreen-double-buttons" width="29" height="23"/>
         <image name="fullscreen-double-buttons-pressed" width="29" height="23"/>
+        <image name="next-6btns" width="29" height="23"/>
+        <image name="next-6btns-pressed" width="29" height="23"/>
         <image name="play" width="27" height="23"/>
         <image name="play-pressed" width="27" height="23"/>
         <image name="playlist-btn" width="28" height="23"/>
         <image name="playlist-btn-pressed" width="28" height="23"/>
+        <image name="previous-6btns" width="29" height="23"/>
+        <image name="previous-6btns-pressed" width="29" height="23"/>
         <image name="repeat" width="28" height="23"/>
         <image name="repeat-pressed" width="28" height="23"/>
         <image name="shuffle" width="29" height="23"/>
diff --git a/modules/gui/macosx/VLCMainWindowControlsBar.h b/modules/gui/macosx/VLCMainWindowControlsBar.h
index 09257e2134..e94d12fd38 100644
--- a/modules/gui/macosx/VLCMainWindowControlsBar.h
+++ b/modules/gui/macosx/VLCMainWindowControlsBar.h
@@ -38,6 +38,9 @@
 
 @property (readwrite, strong) IBOutlet NSButton *stopButton;
 
+ at property (readwrite, strong) IBOutlet NSButton *prevButton;
+ at property (readwrite, strong) IBOutlet NSButton *nextButton;
+
 @property (readwrite, strong) IBOutlet NSButton *playlistButton;
 @property (readwrite, strong) IBOutlet NSButton *repeatButton;
 @property (readwrite, strong) IBOutlet NSButton *shuffleButton;
diff --git a/modules/gui/macosx/VLCMainWindowControlsBar.m b/modules/gui/macosx/VLCMainWindowControlsBar.m
index 1db19eae19..d6ac135361 100644
--- a/modules/gui/macosx/VLCMainWindowControlsBar.m
+++ b/modules/gui/macosx/VLCMainWindowControlsBar.m
@@ -49,12 +49,12 @@
     NSImage * _shuffleOnImage;
     NSImage * _pressedShuffleOnImage;
 
-    NSButton * _previousButton;
-    NSButton * _nextButton;
-
     BOOL b_show_jump_buttons;
     BOOL b_show_playmode_buttons;
 
+    NSLayoutConstraint *_hidePrevButtonConstraint;
+    NSLayoutConstraint *_hideNextButtonConstraint;
+
     NSLayoutConstraint *_hideEffectsButtonConstraint;
 
     NSLayoutConstraint *_hideRepeatButtonConstraint;
@@ -105,6 +105,13 @@
     [[self.effectsButton cell] accessibilitySetOverrideValue:_NS("Click to show an Audio Effects panel featuring an equalizer and further filters.") forAttribute:NSAccessibilityDescriptionAttribute];
     [[self.effectsButton cell] accessibilitySetOverrideValue:[self.effectsButton toolTip] forAttribute:NSAccessibilityTitleAttribute];
 
+    [self.prevButton setToolTip: _NS("Previous")];
+    [[self.prevButton cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
+    [[self.prevButton cell] accessibilitySetOverrideValue:[self.prevButton toolTip] forAttribute:NSAccessibilityTitleAttribute];
+    [self.nextButton setToolTip: _NS("Next")];
+    [[self.nextButton cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
+    [[self.nextButton cell] accessibilitySetOverrideValue:[self.nextButton toolTip] forAttribute:NSAccessibilityTitleAttribute];
+
     if (!self.darkInterface) {
         [self.stopButton setImage: imageFromRes(@"stop")];
         [self.stopButton setAlternateImage: imageFromRes(@"stop-pressed")];
@@ -137,6 +144,11 @@
 
         [self.fullscreenButton setImage: imageFromRes(@"fullscreen-double-buttons")];
         [self.fullscreenButton setAlternateImage: imageFromRes(@"fullscreen-double-buttons-pressed")];
+
+        [self.prevButton setImage: imageFromRes(@"previous-6btns")];
+        [self.prevButton setAlternateImage: imageFromRes(@"previous-6btns-pressed")];
+        [self.nextButton setImage: imageFromRes(@"next-6btns")];
+        [self.nextButton setAlternateImage: imageFromRes(@"next-6btns-pressed")];
     } else {
         [self.stopButton setImage: imageFromRes(@"stop_dark")];
         [self.stopButton setAlternateImage: imageFromRes(@"stop-pressed_dark")];
@@ -169,6 +181,11 @@
 
         [self.fullscreenButton setImage: imageFromRes(@"fullscreen-double-buttons_dark")];
         [self.fullscreenButton setAlternateImage: imageFromRes(@"fullscreen-double-buttons-pressed_dark")];
+
+        [self.prevButton setImage: imageFromRes(@"previous-6btns-dark")];
+        [self.prevButton setAlternateImage: imageFromRes(@"previous-6btns-dark-pressed")];
+        [self.nextButton setImage: imageFromRes(@"next-6btns-dark")];
+        [self.nextButton setAlternateImage: imageFromRes(@"next-6btns-dark-pressed")];
     }
     [self.repeatButton setImage: _repeatImage];
     [self.repeatButton setAlternateImage: _pressedRepeatImage];
@@ -209,11 +226,23 @@
     if (!b_show_playmode_buttons)
         [self removePlaymodeButtons:YES];
 
-    b_show_jump_buttons = config_GetInt(getIntf(), "macosx-show-playback-buttons");
-    if (b_show_jump_buttons)
-        [self addJumpButtons:YES];
-
-
+    _hidePrevButtonConstraint = [NSLayoutConstraint constraintWithItem:self.prevButton
+                                                               attribute:NSLayoutAttributeWidth
+                                                               relatedBy:NSLayoutRelationEqual
+                                                                  toItem:nil
+                                                               attribute:NSLayoutAttributeNotAnAttribute
+                                                              multiplier:1
+                                                                constant:0];
+    _hideNextButtonConstraint = [NSLayoutConstraint constraintWithItem:self.nextButton
+                                                             attribute:NSLayoutAttributeWidth
+                                                             relatedBy:NSLayoutRelationEqual
+                                                                toItem:nil
+                                                             attribute:NSLayoutAttributeNotAnAttribute
+                                                            multiplier:1
+                                                              constant:0];
+    b_show_jump_buttons = var_InheritBool(getIntf(), "macosx-show-playback-buttons");
+    if (!b_show_jump_buttons)
+        [self removeJumpButtons:YES];
 
     [[[VLCMain sharedInstance] playlist] playbackModeUpdated];
 
@@ -281,78 +310,8 @@
 
 - (void)addJumpButtons:(BOOL)b_fast
 {
-    NSRect preliminaryFrame = [self.backwardButton frame];
-    BOOL b_enabled = [self.backwardButton isEnabled];
-    preliminaryFrame.size.width = 29.;
-    _previousButton = [[NSButton alloc] initWithFrame:preliminaryFrame];
-    [_previousButton setButtonType: NSMomentaryChangeButton];
-    [_previousButton setBezelStyle:NSRegularSquareBezelStyle];
-    [_previousButton setBordered:NO];
-    [_previousButton setTarget:self];
-    [_previousButton setAction:@selector(prev:)];
-    [_previousButton setToolTip: _NS("Previous")];
-    [[_previousButton cell] accessibilitySetOverrideValue:_NS("Previous") forAttribute:NSAccessibilityTitleAttribute];
-    [[_previousButton cell] accessibilitySetOverrideValue:_NS("Click to go to the previous playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
-    [_previousButton setEnabled: b_enabled];
-
-    _nextButton = [[NSButton alloc] initWithFrame:preliminaryFrame];
-    [_nextButton setButtonType: NSMomentaryChangeButton];
-    [_nextButton setBezelStyle:NSRegularSquareBezelStyle];
-    [_nextButton setBordered:NO];
-    [_nextButton setTarget:self];
-    [_nextButton setAction:@selector(next:)];
-    [_nextButton setToolTip: _NS("Next")];
-    [[_nextButton cell] accessibilitySetOverrideValue:_NS("Next") forAttribute:NSAccessibilityTitleAttribute];
-    [[_nextButton cell] accessibilitySetOverrideValue:_NS("Click to go to the next playlist item.") forAttribute:NSAccessibilityDescriptionAttribute];
-    [_nextButton setEnabled: b_enabled];
-
-    if (self.darkInterface) {
-        [_previousButton setImage: imageFromRes(@"previous-6btns-dark")];
-        [_previousButton setAlternateImage: imageFromRes(@"previous-6btns-dark-pressed")];
-        [_nextButton setImage: imageFromRes(@"next-6btns-dark")];
-        [_nextButton setAlternateImage: imageFromRes(@"next-6btns-dark-pressed")];
-    } else {
-        [_previousButton setImage: imageFromRes(@"previous-6btns")];
-        [_previousButton setAlternateImage: imageFromRes(@"previous-6btns-pressed")];
-        [_nextButton setImage: imageFromRes(@"next-6btns")];
-        [_nextButton setAlternateImage: imageFromRes(@"next-6btns-pressed")];
-    }
-
-    NSRect frame;
-    frame = [self.backwardButton frame];
-    frame.size.width--;
-    [self.backwardButton setFrame:frame];
-    frame = [self.forwardButton frame];
-    frame.size.width--;
-    [self.forwardButton setFrame:frame];
-
-#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]
-
-    float f_space = 29.;
-    moveItem(self.backwardButton);
-    f_space = 28.;
-    moveItem(self.playButton);
-    moveItem(self.forwardButton);
-    f_space = 28. * 2;
-    moveItem(self.stopButton);
-    moveItem(self.playlistButton);
-    moveItem(self.repeatButton);
-    moveItem(self.shuffleButton);
-#undef moveItem
-
-    frame = [self.progressView frame];
-    frame.size.width = frame.size.width - f_space;
-    frame.origin.x = frame.origin.x + f_space;
-    if (b_fast)
-        [self.progressView setFrame: frame];
-    else
-        [[self.progressView animator] setFrame: frame];
+    [self.prevButton removeConstraint:_hidePrevButtonConstraint];
+    [self.nextButton removeConstraint:_hideNextButtonConstraint];
 
     if (self.darkInterface) {
         [[self.forwardButton animator] setImage:imageFromRes(@"forward-6btns-dark")];
@@ -366,73 +325,16 @@ else \
         [[self.backwardButton animator] setAlternateImage:imageFromRes(@"backward-6btns-pressed")];
     }
 
-    preliminaryFrame.origin.x = [_previousButton frame].origin.x + [_previousButton frame].size.width + [self.backwardButton frame].size.width + [self.playButton frame].size.width + [self.forwardButton frame].size.width;
-    [_nextButton setFrame: preliminaryFrame];
-
-    // wait until the animation is done, if displayed
-    if (b_fast) {
-        [self.bottomBarView addSubview:_previousButton];
-        [self.bottomBarView addSubview:_nextButton];
-    } else {
-        [self.bottomBarView performSelector:@selector(addSubview:) withObject:_previousButton afterDelay:.2];
-        [self.bottomBarView performSelector:@selector(addSubview:) withObject:_nextButton afterDelay:.2];
-    }
-
     [self toggleForwardBackwardMode: YES];
 }
 
 - (void)removeJumpButtons:(BOOL)b_fast
 {
-    if (!_previousButton || !_nextButton)
+    if (!self.prevButton || !self.nextButton)
         return;
 
-    if (b_fast) {
-        [_previousButton setHidden: YES];
-        [_nextButton setHidden: YES];
-    } else {
-        [[_previousButton animator] setHidden: YES];
-        [[_nextButton animator] setHidden: YES];
-    }
-    [_previousButton removeFromSuperviewWithoutNeedingDisplay];
-    [_nextButton removeFromSuperviewWithoutNeedingDisplay];
-    _previousButton = nil;
-    _nextButton = nil;
-
-    NSRect frame;
-    frame = [self.backwardButton frame];
-    frame.size.width++;
-    [self.backwardButton setFrame:frame];
-    frame = [self.forwardButton frame];
-    frame.size.width++;
-    [self.forwardButton setFrame:frame];
-
-#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]
-
-    float f_space = 29.;
-    moveItem(self.backwardButton);
-    f_space = 28.;
-    moveItem(self.playButton);
-    moveItem(self.forwardButton);
-    f_space = 28. * 2;
-    moveItem(self.stopButton);
-    moveItem(self.playlistButton);
-    moveItem(self.repeatButton);
-    moveItem(self.shuffleButton);
-#undef moveItem
-
-    frame = [self.progressView frame];
-    frame.size.width = frame.size.width + f_space;
-    frame.origin.x = frame.origin.x - f_space;
-    if (b_fast)
-        [self.progressView setFrame: frame];
-    else
-        [[self.progressView animator] setFrame: frame];
+    [self.prevButton addConstraint:_hidePrevButtonConstraint];
+    [self.nextButton addConstraint:_hideNextButtonConstraint];
 
     if (self.darkInterface) {
         [[self.forwardButton animator] setImage:imageFromRes(@"forward-3btns-dark")];
@@ -447,8 +349,6 @@ else \
     }
 
     [self toggleForwardBackwardMode: NO];
-
-    [self.bottomBarView setNeedsDisplay:YES];
 }
 
 - (void)togglePlaymodeButtons
@@ -646,8 +546,8 @@ else \
     [self.stopButton setEnabled: b_input];
 
     if (b_show_jump_buttons) {
-        [_previousButton setEnabled: (b_seekable || b_plmul || b_chapters)];
-        [_nextButton setEnabled: (b_seekable || b_plmul || b_chapters)];
+        [self.prevButton setEnabled: (b_seekable || b_plmul || b_chapters)];
+        [self.nextButton setEnabled: (b_seekable || b_plmul || b_chapters)];
     }
 
     [[[VLCMain sharedInstance] mainMenu] setRateControlsEnabled: b_control];



More information about the vlc-commits mailing list