[vlc-commits] macosx: add visual markers for 100% of the volume (refs #8628)
Felix Paul Kühne
git at videolan.org
Tue Jun 18 21:31:03 CEST 2013
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Jun 18 21:30:08 2013 +0200| [c325924886013d5aa8c9d7c46f787d244da082bf] | committer: Felix Paul Kühne
macosx: add visual markers for 100% of the volume (refs #8628)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c325924886013d5aa8c9d7c46f787d244da082bf
---
modules/gui/macosx/fspanel.h | 4 +++-
modules/gui/macosx/fspanel.m | 4 ++++
modules/gui/macosx/misc.h | 7 ++++++-
modules/gui/macosx/misc.m | 28 ++++++++++++++++++++++++++++
4 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx/fspanel.h b/modules/gui/macosx/fspanel.h
index 56bd4b0..636432c 100644
--- a/modules/gui/macosx/fspanel.h
+++ b/modules/gui/macosx/fspanel.h
@@ -78,6 +78,7 @@
@end
@class VLCProgressView;
+ at class VLCFSVolumeSlider;
@interface VLCFSPanelView : NSView
{
@@ -85,7 +86,8 @@
NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen;
NSTextField *o_streamTitle_txt;
VLCTimeField *o_streamPosition_txt, *o_streamLength_txt;
- NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
+ NSSlider *o_fs_timeSlider;
+ VLCFSVolumeSlider *o_fs_volumeSlider;
VLCProgressView *o_progress_view;
NSImage *o_background_img, *o_vol_sld_img, *o_vol_mute_img, *o_vol_max_img, *o_time_sld_img;
NSTimeInterval last_fwd_event;
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index b22ca7e..a64d2ad 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -459,6 +459,7 @@
[o_fs_volumeSlider setContinuous: YES];
[o_fs_volumeSlider setTarget: self];
[o_fs_volumeSlider setAction: @selector(fsVolumeSliderUpdate:)];
+ [o_fs_volumeSlider setUsesBrightArtwork:YES];
[[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];
@@ -708,6 +709,7 @@
* VLCFSVolumeSlider
*****************************************************************************/
@implementation VLCFSVolumeSlider
+
- (void)drawKnobInRect:(NSRect) knobRect
{
NSRect image_rect;
@@ -729,6 +731,8 @@
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
+ [self drawFullVolumeMarker];
+
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=7.5;
[[[NSColor blackColor] colorWithAlphaComponent:0.6] set];
diff --git a/modules/gui/macosx/misc.h b/modules/gui/macosx/misc.h
index 4859611..0bd839f 100644
--- a/modules/gui/macosx/misc.h
+++ b/modules/gui/macosx/misc.h
@@ -1,7 +1,7 @@
/*****************************************************************************
* misc.h: code not specific to vlc
*****************************************************************************
- * Copyright (C) 2003-2012 VLC authors and VideoLAN
+ * Copyright (C) 2003-2013 VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl at nanocrew.net>
@@ -121,8 +121,13 @@
*****************************************************************************/
@interface VLCVolumeSliderCommon : NSSlider
+{
+ BOOL _usesBrightArtwork;
+}
+ at property (readwrite, nonatomic) BOOL usesBrightArtwork;
- (void)scrollWheel:(NSEvent *)o_event;
+- (void)drawFullVolumeMarker;
@end
diff --git a/modules/gui/macosx/misc.m b/modules/gui/macosx/misc.m
index 7d055e9..875f4c5 100644
--- a/modules/gui/macosx/misc.m
+++ b/modules/gui/macosx/misc.m
@@ -511,6 +511,8 @@ void _drawFrameInRect(NSRect frameRect)
@implementation VLCVolumeSliderCommon : NSSlider
+ at synthesize usesBrightArtwork = _usesBrightArtwork;
+
- (void)scrollWheel:(NSEvent *)o_event
{
intf_thread_t * p_intf = VLCIntf;
@@ -543,6 +545,30 @@ void _drawFrameInRect(NSRect frameRect)
}
}
+- (void)drawFullVolumeMarker
+{
+ NSRect frame = [self frame];
+
+ NSColor *drawingColor;
+ if (_usesBrightArtwork)
+ drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.8];
+ else
+ drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.6];
+
+ NSBezierPath* bezierPath = [NSBezierPath bezierPath];
+
+ float fullVolPos = frame.size.width / 2.;
+ [bezierPath moveToPoint:NSMakePoint(fullVolPos, frame.size.height - 3.)];
+ [bezierPath lineToPoint:NSMakePoint(fullVolPos, 3.)];
+ [bezierPath closePath];
+
+ bezierPath.lineWidth = 1.;
+ [drawingColor setStroke];
+ [bezierPath stroke];
+ [drawingColor setFill];
+ [bezierPath fill];
+}
+
@end
/*****************************************************************************
@@ -584,6 +610,8 @@ void _drawFrameInRect(NSRect frameRect)
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
+ [self drawFullVolumeMarker];
+
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=2;
[self drawKnobInRect: knobRect];
More information about the vlc-commits
mailing list