[vlc-commits] macosx: Draw full bar for VLCHUDSliderCell with tick marks as active

Marvin Scholz git at videolan.org
Tue Jul 19 16:51:55 CEST 2016


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Jul 19 16:51:31 2016 +0200| [afd55dea67986cb5628052fd52b817f5a80c8b12] | committer: Marvin Scholz

macosx: Draw full bar for VLCHUDSliderCell with tick marks as active

The active/disabled bar should not be drawn for Sliders that have
tick marks, as it looks confusing. This commit will make the full
slider bar draw as active, if it has tick marks.

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

 modules/gui/macosx/VLCHUDSliderCell.m |   32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/modules/gui/macosx/VLCHUDSliderCell.m b/modules/gui/macosx/VLCHUDSliderCell.m
index 01fe5ca..06a11e6 100644
--- a/modules/gui/macosx/VLCHUDSliderCell.m
+++ b/modules/gui/macosx/VLCHUDSliderCell.m
@@ -35,7 +35,6 @@
         _strokeColor            = [NSColor colorWithCalibratedRed:0.749 green:0.761 blue:0.788 alpha:1.0];
         _disabledStrokeColor    = [NSColor colorWithCalibratedRed:0.749 green:0.761 blue:0.788 alpha:0.2];
 
-
         // Custom knob gradients
         _knobGradient           = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.251 green:0.251 blue:0.255 alpha:1.0]
                                                                 endingColor:[NSColor colorWithDeviceRed:0.118 green:0.118 blue:0.118 alpha:1.0]];
@@ -151,23 +150,26 @@ NSAffineTransform* RotationTransform(const CGFloat angle, const NSPoint point)
     // Copy rect
     NSRect activeRect = fullRect;
 
-    if (self.isVertical) {
-        // Calculate active rect (bottom part of slider)
-        if (flipped) {
-            activeRect.origin.y = (1 - knobPosition) * activeRect.size.height;
-            activeRect.size.height -= activeRect.origin.y - 1;
+    // Do not draw disabled part for sliders with tickmarks
+    if (self.numberOfTickMarks == 0) {
+        if (self.isVertical) {
+            // Calculate active rect (bottom part of slider)
+            if (flipped) {
+                activeRect.origin.y = (1 - knobPosition) * activeRect.size.height;
+                activeRect.size.height -= activeRect.origin.y - 1;
+            } else {
+                activeRect.size.height -= (1 - knobPosition) * activeRect.size.height - 1;
+            }
         } else {
-            activeRect.size.height -= (1 - knobPosition) * activeRect.size.height - 1;
+            // Calculate active rect (left part of slider)
+            activeRect.size.width = knobPosition * (self.controlView.frame.size.width - 1.0);
         }
-    } else {
-        // Calculate active rect (left part of slider)
-        activeRect.size.width = knobPosition * (self.controlView.frame.size.width - 1.0);
-    }
 
-    // Draw inactive bar
-    [_disabledSliderColor setFill];
-    path = [NSBezierPath bezierPathWithRoundedRect:fullRect xRadius:2.0 yRadius:2.0];
-    [path fill];
+        // Draw inactive bar
+        [_disabledSliderColor setFill];
+        path = [NSBezierPath bezierPathWithRoundedRect:fullRect xRadius:2.0 yRadius:2.0];
+        [path fill];
+    }
 
     // Draw active bar
     [_sliderColor setFill];



More information about the vlc-commits mailing list