Commit b668735d authored by Marvin Scholz's avatar Marvin Scholz

macosx: Remove now unused ITSlider and VLCVolumeSliderCommon

parent 7265fc06
......@@ -49,31 +49,6 @@
@end
/*****************************************************************************
* VLCVolumeSliderCommon
*****************************************************************************/
@interface VLCVolumeSliderCommon : NSSlider
@property (readwrite, nonatomic) BOOL usesBrightArtwork;
- (void)scrollWheel:(NSEvent *)o_event;
- (void)drawFullVolumeMarker;
- (CGFloat)fullVolumePos;
@end
@interface VolumeSliderCell : NSSliderCell
@end
/*****************************************************************************
* ITSlider
*****************************************************************************/
@interface ITSlider : VLCVolumeSliderCommon
@end
/*****************************************************************************
* VLCMainWindowSplitView interface
......
......@@ -149,153 +149,6 @@
@end
/*****************************************************************************
* VLCVolumeSliderCommon
*****************************************************************************/
@implementation VLCVolumeSliderCommon : NSSlider
- (void)scrollWheel:(NSEvent *)o_event
{
BOOL b_up = NO;
CGFloat f_deltaY = [o_event deltaY];
CGFloat f_deltaX = [o_event deltaX];
if ([o_event isDirectionInvertedFromDevice])
f_deltaX = -f_deltaX; // optimisation, actually double invertion of f_deltaY here
else
f_deltaY = -f_deltaY;
// positive for left / down, negative otherwise
CGFloat f_delta = f_deltaX + f_deltaY;
CGFloat f_abs;
if (f_delta > 0.0f)
f_abs = f_delta;
else {
b_up = YES;
f_abs = -f_delta;
}
for (NSUInteger i = 0; i < (int)(f_abs/4.+1.) && f_abs > 0.05 ; i++) {
if (b_up)
[[VLCCoreInteraction sharedInstance] volumeUp];
else
[[VLCCoreInteraction sharedInstance] volumeDown];
}
}
- (void)drawFullVolumeMarker
{
CGFloat maxAudioVol = self.maxValue / AOUT_VOLUME_DEFAULT;
if (maxAudioVol < 1.)
return;
NSColor *drawingColor;
// for bright artwork, a black color is used and vice versa
if (_usesBrightArtwork)
drawingColor = [[NSColor blackColor] colorWithAlphaComponent:.4];
else
drawingColor = [[NSColor whiteColor] colorWithAlphaComponent:.4];
NSBezierPath* bezierPath = [NSBezierPath bezierPath];
[self drawFullVolBezierPath:bezierPath];
[bezierPath closePath];
bezierPath.lineWidth = 1.;
[drawingColor setStroke];
[bezierPath stroke];
}
- (CGFloat)fullVolumePos
{
CGFloat maxAudioVol = self.maxValue / AOUT_VOLUME_DEFAULT;
CGFloat sliderRange = [self frame].size.width - [self knobThickness];
CGFloat sliderOrigin = [self knobThickness] / 2.;
return 1. / maxAudioVol * sliderRange + sliderOrigin;
}
- (void)drawFullVolBezierPath:(NSBezierPath*)bezierPath
{
CGFloat fullVolPos = [self fullVolumePos];
[bezierPath moveToPoint:NSMakePoint(fullVolPos, [self frame].size.height - 3.)];
[bezierPath lineToPoint:NSMakePoint(fullVolPos, 2.)];
}
@end
@implementation VolumeSliderCell
- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
{
VLCVolumeSliderCommon *o_slider = (VLCVolumeSliderCommon *)controlView;
CGFloat fullVolumePos = [o_slider fullVolumePos] + 2.;
CGPoint snapToPoint = currentPoint;
if (ABS(fullVolumePos - currentPoint.x) <= 4.)
snapToPoint.x = fullVolumePos;
return [super continueTracking:lastPoint at:snapToPoint inView:controlView];
}
@end
/*****************************************************************************
* ITSlider
*****************************************************************************/
@interface ITSlider()
{
NSImage *img;
NSRect image_rect;
}
@end
@implementation ITSlider
- (void)awakeFromNib
{
BOOL b_dark = config_GetInt( getIntf(), "macosx-interfacestyle" );
if (b_dark)
img = imageFromRes(@"volume-slider-knob_dark");
else
img = imageFromRes(@"volume-slider-knob");
image_rect.size = [img size];
image_rect.origin.x = 0;
if (b_dark)
image_rect.origin.y = -1;
else
image_rect.origin.y = 0;
}
- (void)drawKnobInRect:(NSRect)knobRect
{
knobRect.origin.x += (knobRect.size.width - image_rect.size.width) / 2;
knobRect.size.width = image_rect.size.width;
knobRect.size.height = image_rect.size.height;
[img drawInRect:knobRect fromRect:image_rect operation:NSCompositeSourceOver fraction:1];
}
- (void)drawRect:(NSRect)rect
{
/* Draw default to make sure the slider behaves correctly */
[[NSGraphicsContext currentContext] saveGraphicsState];
NSRectClip(NSZeroRect);
[super drawRect:rect];
[[NSGraphicsContext currentContext] restoreGraphicsState];
[self drawFullVolumeMarker];
NSRect knobRect = [[self cell] knobRectFlipped:NO];
knobRect.origin.y+=2;
[self drawKnobInRect: knobRect];
}
@end
/*****************************************************************************
* VLCMainWindowSplitView implementation
*****************************************************************************/
......
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