Commit e61c78e6 authored by David Fuhrmann's avatar David Fuhrmann

macosx: cleanup previous commit and fix position of tick, tweak appearance

refs #8628
parent 66bf1c6e
...@@ -538,7 +538,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -538,7 +538,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
return 0; return 0;
float volume = playlist_VolumeGet(pl_Get(p_intf)); float volume = playlist_VolumeGet(pl_Get(p_intf));
NSLog(@"return vol %f", volume);
return lroundf(volume * AOUT_VOLUME_DEFAULT); return lroundf(volume * AOUT_VOLUME_DEFAULT);
} }
...@@ -553,7 +552,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -553,7 +552,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
i_value = self.maxVolume; i_value = self.maxVolume;
float f_value = i_value / (float)AOUT_VOLUME_DEFAULT; float f_value = i_value / (float)AOUT_VOLUME_DEFAULT;
NSLog( @"set vol %f", f_value);
playlist_VolumeSet(pl_Get(p_intf), f_value); playlist_VolumeSet(pl_Get(p_intf), f_value);
} }
......
...@@ -454,12 +454,12 @@ ...@@ -454,12 +454,12 @@
s_rc.size.height = 12; s_rc.size.height = 12;
o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc]; o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
[o_fs_volumeSlider setMinValue:0]; [o_fs_volumeSlider setMinValue:0];
[o_fs_volumeSlider setMaxValue:AOUT_VOLUME_MAX]; [o_fs_volumeSlider setMaxValue: [[VLCCoreInteraction sharedInstance] maxVolume]];
[o_fs_volumeSlider setIntValue:AOUT_VOLUME_DEFAULT]; [o_fs_volumeSlider setIntValue:AOUT_VOLUME_DEFAULT];
[o_fs_volumeSlider setContinuous: YES]; [o_fs_volumeSlider setContinuous: YES];
[o_fs_volumeSlider setTarget: self]; [o_fs_volumeSlider setTarget: self];
[o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)]; [o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];
[o_fs_volumeSlider setUsesBrightArtwork:YES]; [o_fs_volumeSlider setUsesBrightArtwork:NO];
[[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Volume") forAttribute:NSAccessibilityTitleAttribute]; [[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Volume") forAttribute:NSAccessibilityTitleAttribute];
[[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change the volume.") forAttribute:NSAccessibilityDescriptionAttribute]; [[o_fs_volumeSlider cell] accessibilitySetOverrideValue:_NS("Click and move the mouse while keeping the button pressed to use this slider to change the volume.") forAttribute:NSAccessibilityDescriptionAttribute];
[self addSubview: o_fs_volumeSlider]; [self addSubview: o_fs_volumeSlider];
......
...@@ -123,7 +123,6 @@ ...@@ -123,7 +123,6 @@
@interface VLCVolumeSliderCommon : NSSlider @interface VLCVolumeSliderCommon : NSSlider
{ {
BOOL _usesBrightArtwork; BOOL _usesBrightArtwork;
CGFloat _maximumVolume;
} }
@property (readwrite, nonatomic) BOOL usesBrightArtwork; @property (readwrite, nonatomic) BOOL usesBrightArtwork;
......
...@@ -547,24 +547,28 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -547,24 +547,28 @@ void _drawFrameInRect(NSRect frameRect)
- (void)drawFullVolumeMarker - (void)drawFullVolumeMarker
{ {
CGFloat maxAudioVol = self.maxValue / AOUT_VOLUME_DEFAULT;
if (maxAudioVol < 1.)
return;
NSRect frame = [self frame]; NSRect frame = [self frame];
NSColor *drawingColor; NSColor *drawingColor;
// for bright artwork, a black color is used and vice versa
if (_usesBrightArtwork) if (_usesBrightArtwork)
drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.8]; drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.4];
else else
drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.6]; drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.4];
NSBezierPath* bezierPath = [NSBezierPath bezierPath]; NSBezierPath* bezierPath = [NSBezierPath bezierPath];
float fullVolPos = frame.size.width / 2.;
CGFloat maxAudioVol = self.maxValue / AOUT_VOLUME_DEFAULT; CGFloat sliderRange = frame.size.width - [self knobThickness];
CGFloat sliderOrigin = [self knobThickness] / 2.;
if ((maxAudioVol - 1.) > 0) CGFloat fullVolPos = 1. / maxAudioVol * sliderRange + sliderOrigin;
fullVolPos += ((maxAudioVol - 1.) * 2000) / fullVolPos;
[bezierPath moveToPoint:NSMakePoint(fullVolPos, frame.size.height - 3.)]; [bezierPath moveToPoint:NSMakePoint(fullVolPos, frame.size.height - 3.)];
[bezierPath lineToPoint:NSMakePoint(fullVolPos, 3.)]; [bezierPath lineToPoint:NSMakePoint(fullVolPos, 2.)];
[bezierPath closePath]; [bezierPath closePath];
bezierPath.lineWidth = 1.; bezierPath.lineWidth = 1.;
......
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