Commit c3259248 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: add visual markers for 100% of the volume (refs #8628)

parent 338846d9
......@@ -78,6 +78,7 @@
@end
@class VLCProgressView;
@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;
......
......@@ -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];
......
/*****************************************************************************
* 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@nanocrew.net>
......@@ -121,8 +121,13 @@
*****************************************************************************/
@interface VLCVolumeSliderCommon : NSSlider
{
BOOL _usesBrightArtwork;
}
@property (readwrite, nonatomic) BOOL usesBrightArtwork;
- (void)scrollWheel:(NSEvent *)o_event;
- (void)drawFullVolumeMarker;
@end
......
......@@ -511,6 +511,8 @@ void _drawFrameInRect(NSRect frameRect)
@implementation VLCVolumeSliderCommon : NSSlider
@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];
......
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