[vlc-commits] macosx: cleanup previous commit and fix position of tick, tweak appearance

David Fuhrmann git at videolan.org
Tue Jul 23 23:06:50 CEST 2013


vlc/vlc-2.1 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Jul 22 21:59:40 2013 +0200| [3d92a8587ece66bd93691e1019e055f53c09763a] | committer: David Fuhrmann

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

refs #8628
(cherry picked from commit e61c78e65d15e796a6136128d74ea32102890663)

Signed-off-by: David Fuhrmann <david.fuhrmann at googlemail.com>

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

 modules/gui/macosx/CoreInteraction.m |    2 --
 modules/gui/macosx/fspanel.m         |    4 ++--
 modules/gui/macosx/misc.h            |    1 -
 modules/gui/macosx/misc.m            |   18 +++++++++++-------
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/gui/macosx/CoreInteraction.m b/modules/gui/macosx/CoreInteraction.m
index 561c255..e1e2aae 100644
--- a/modules/gui/macosx/CoreInteraction.m
+++ b/modules/gui/macosx/CoreInteraction.m
@@ -538,7 +538,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         return 0;
 
     float volume = playlist_VolumeGet(pl_Get(p_intf));
-    NSLog(@"return vol %f", volume);
 
     return lroundf(volume * AOUT_VOLUME_DEFAULT);
 }
@@ -553,7 +552,6 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
         i_value = self.maxVolume;
 
     float f_value = i_value / (float)AOUT_VOLUME_DEFAULT;
-    NSLog( @"set vol %f", f_value);
 
     playlist_VolumeSet(pl_Get(p_intf), f_value);
 }
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index a64d2ad..de79fa8 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -454,12 +454,12 @@
     s_rc.size.height = 12;
     o_fs_volumeSlider = [[VLCFSVolumeSlider alloc] initWithFrame: s_rc];
     [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 setContinuous: YES];
     [o_fs_volumeSlider setTarget: self];
     [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("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];
diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h
index 81c81ab..366d0e9 100644
--- a/modules/gui/macosx/misc.h
+++ b/modules/gui/macosx/misc.h
@@ -123,7 +123,6 @@
 @interface VLCVolumeSliderCommon : NSSlider
 {
     BOOL _usesBrightArtwork;
-    CGFloat _maximumVolume;
 }
 @property (readwrite, nonatomic) BOOL usesBrightArtwork;
 
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index a24d8f6..7e7e54f 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -547,24 +547,28 @@ void _drawFrameInRect(NSRect frameRect)
 
 - (void)drawFullVolumeMarker
 {
+    CGFloat maxAudioVol = self.maxValue / AOUT_VOLUME_DEFAULT;
+    if (maxAudioVol < 1.)
+        return;
+
     NSRect frame = [self frame];
 
     NSColor *drawingColor;
+    // for bright artwork, a black color is used and vice versa
     if (_usesBrightArtwork)
-        drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.8];
+        drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.4];
     else
-        drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.6];
+        drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.4];
 
     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)
-        fullVolPos += ((maxAudioVol - 1.) * 2000) / fullVolPos;
+    CGFloat fullVolPos = 1. / maxAudioVol * sliderRange + sliderOrigin;
 
     [bezierPath moveToPoint:NSMakePoint(fullVolPos, frame.size.height - 3.)];
-    [bezierPath lineToPoint:NSMakePoint(fullVolPos, 3.)];
+    [bezierPath lineToPoint:NSMakePoint(fullVolPos, 2.)];
     [bezierPath closePath];
 
     bezierPath.lineWidth = 1.;



More information about the vlc-commits mailing list