macosx: Draw full bar for VLCHUDSliderCell with tick marks as active
authorMarvin Scholz <epirat07@gmail.com>
Tue, 19 Jul 2016 14:51:31 +0000 (16:51 +0200)
committerMarvin Scholz <epirat07@gmail.com>
Tue, 19 Jul 2016 14:51:31 +0000 (16:51 +0200)
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.

modules/gui/macosx/VLCHUDSliderCell.m

index 01fe5ca..06a11e6 100644 (file)
@@ -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];