Commit afd55dea authored by Marvin Scholz's avatar 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.
parent 43cb4e10
......@@ -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];
......
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