[vlc-commits] macosx: Remove VLCHUDScroller class

Marvin Scholz git at videolan.org
Sun Feb 18 17:45:40 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Sun Feb 18 17:44:47 2018 +0100| [ad6f88a250253ef52e489f814864fb0733d469cf] | committer: Marvin Scholz

macosx: Remove VLCHUDScroller class

This was used on macOS versions lower than 10.10 to draw custom
HUD-style controls and is not necessary anymore.

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   6 -
 modules/gui/macosx/Makefile.am                     |   1 -
 modules/gui/macosx/VLCHUDScroller.h                |  55 --
 modules/gui/macosx/VLCHUDScroller.m                | 754 ---------------------
 4 files changed, 816 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index e2e9fbdb1c..1d99d8a6b3 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -85,7 +85,6 @@
 		6B81662A1EBFC34300C26F1B /* VLCDefaultValueSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6A499D1DFD9B23009128AC /* VLCDefaultValueSliderCell.m */; };
 		6B81662B1EBFC35D00C26F1B /* VLCVoutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */; };
 		6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CCED71514C0D4A90057F8D1 /* VLCUIWidgets.m */; };
-		6B9FD0391EEB5D8A0085151F /* VLCHUDScroller.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B9FD0381EEB5D8A0085151F /* VLCHUDScroller.m */; };
 		6BA1A0642038D93D005EA18A /* ci_filters.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA1A0632038D93D005EA18A /* ci_filters.m */; };
 		6BBB05DA1EEFEA29003A1019 /* VLCHUDOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB05D91EEFEA29003A1019 /* VLCHUDOutlineView.m */; };
 		6BBB05E01EEFF165003A1019 /* VLCHUDTableCornerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB05DF1EEFF165003A1019 /* VLCHUDTableCornerView.m */; };
@@ -610,8 +609,6 @@
 		6B8229FF1E4D2DD100833BE1 /* vlc.scriptSuite */ = {isa = PBXFileReference; lastKnownFileType = text.plist.scriptSuite; path = vlc.scriptSuite; sourceTree = "<group>"; };
 		6B822A001E4D2DD100833BE1 /* vlc.scriptTerminology */ = {isa = PBXFileReference; lastKnownFileType = text.plist.scriptTerminology; path = vlc.scriptTerminology; sourceTree = "<group>"; };
 		6B822A031E4D2DEB00833BE1 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
-		6B9FD0371EEB5D8A0085151F /* VLCHUDScroller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCHUDScroller.h; sourceTree = "<group>"; };
-		6B9FD0381EEB5D8A0085151F /* VLCHUDScroller.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCHUDScroller.m; sourceTree = "<group>"; };
 		6BA1A0632038D93D005EA18A /* ci_filters.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ci_filters.m; path = ../../../modules/video_filter/ci_filters.m; sourceTree = "<group>"; };
 		6BBB05D81EEFEA29003A1019 /* VLCHUDOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHUDOutlineView.h; sourceTree = "<group>"; };
 		6BBB05D91EEFEA29003A1019 /* VLCHUDOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDOutlineView.m; sourceTree = "<group>"; };
@@ -1456,8 +1453,6 @@
 		6B846FE81CF5D89500112E54 /* HUD UI Classes */ = {
 			isa = PBXGroup;
 			children = (
-				6B9FD0371EEB5D8A0085151F /* VLCHUDScroller.h */,
-				6B9FD0381EEB5D8A0085151F /* VLCHUDScroller.m */,
 				6BF5C5021EFE66EF008A9C12 /* VLCHUDTableView.h */,
 				6BF5C5031EFE66EF008A9C12 /* VLCHUDTableView.m */,
 				6BBB05D81EEFEA29003A1019 /* VLCHUDOutlineView.h */,
@@ -1766,7 +1761,6 @@
 				1C3113AB1E508C6900D4DD76 /* VLCExtensionsDialogProvider.m in Sources */,
 				1C3113AD1E508C6900D4DD76 /* VLCExtensionsManager.m in Sources */,
 				1C3113AF1E508C6900D4DD76 /* VLCFSPanelController.m in Sources */,
-				6B9FD0391EEB5D8A0085151F /* VLCHUDScroller.m in Sources */,
 				1C3113B11E508C6900D4DD76 /* VLCFSPanelDraggableView.m in Sources */,
 				1C3113B41E508C6900D4DD76 /* VLCInputManager.m in Sources */,
 				1C3113B61E508C6900D4DD76 /* VLCMain+OldPrefs.m in Sources */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 058089d6fd..d5408a21fa 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -74,7 +74,6 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/VLCCoreDialogProvider.h gui/macosx/VLCCoreDialogProvider.m \
 	gui/macosx/VLCLogMessage.h gui/macosx/VLCLogMessage.m \
 	gui/macosx/VLCLogWindowController.h gui/macosx/VLCLogWindowController.m \
-	gui/macosx/VLCHUDScroller.h gui/macosx/VLCHUDScroller.m \
 	gui/macosx/VLCHUDOutlineView.h gui/macosx/VLCHUDOutlineView.m \
 	gui/macosx/VLCHUDTableView.h gui/macosx/VLCHUDTableView.m \
 	gui/macosx/VLCHUDTableCornerView.h gui/macosx/VLCHUDTableCornerView.m \
diff --git a/modules/gui/macosx/VLCHUDScroller.h b/modules/gui/macosx/VLCHUDScroller.h
deleted file mode 100644
index 9256b14ade..0000000000
--- a/modules/gui/macosx/VLCHUDScroller.h
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-//  VLCHUDScroller.h
-//  HUDScroller
-//
-//  Created by BinaryGod on 5/22/08.
-//
-//  Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god at gmail.com)
-//  All rights reserved.
-//
-//  Redistribution and use in source and binary forms, with or without modification,
-//  are permitted provided that the following conditions are met:
-//
-//        Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-//        Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation and/or
-//    other materials provided with the distribution.
-//
-//        Neither the name of the BinaryMethod.com nor the names of its contributors
-//    may be used to endorse or promote products derived from this software without
-//    specific prior written permission.
-//
-//    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
-//    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-//    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-//    IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-//    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-//    OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-//    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-//    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//    POSSIBILITY OF SUCH DAMAGE.
-
-// Special thanks to Matt Gemmell (http://mattgemmell.com/) for helping me solve the
-// transparent drawing issues.  Your awesome man!!!
-
-#import <Cocoa/Cocoa.h>
-
- at interface VLCHUDScroller : NSScroller {
-    NSString *arrowPosition;
-}
-
- at property (strong) NSColor *scrollerStroke;
- at property (strong) NSGradient *scrollerKnobGradient;
- at property (strong) NSGradient *scrollerTrackGradient;
- at property (strong) NSGradient *scrollerArrowNormalGradient;
- at property (strong) NSGradient *scrollerArrowPushedGradient;
-
-- (void)drawDecrementArrow:(bool)highlighted;
-- (void)drawIncrementArrow:(bool)highlighted;
-
-- (bool)isHoriz;
-
- at end
diff --git a/modules/gui/macosx/VLCHUDScroller.m b/modules/gui/macosx/VLCHUDScroller.m
deleted file mode 100644
index 5fdfd2b7fd..0000000000
--- a/modules/gui/macosx/VLCHUDScroller.m
+++ /dev/null
@@ -1,754 +0,0 @@
-//
-//  VLCHUDScroller.m
-//  HUDScroller
-//
-//  Created by BinaryGod on 5/22/08.
-//
-//  Copyright (c) 2008, Tim Davis (BinaryMethod.com, binary.god at gmail.com)
-//  All rights reserved.
-//
-//  Redistribution and use in source and binary forms, with or without modification,
-//  are permitted provided that the following conditions are met:
-//
-//        Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-//
-//        Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation and/or
-//    other materials provided with the distribution.
-//
-//        Neither the name of the BinaryMethod.com nor the names of its contributors
-//    may be used to endorse or promote products derived from this software without
-//    specific prior written permission.
-//
-//    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND
-//    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-//    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-//    IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-//    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-//    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
-//    OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-//    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-//    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-//    POSSIBILITY OF SUCH DAMAGE.
-
-// Special thanks to Matt Gemmell (http://mattgemmell.com/) for helping me solve the
-// transparent drawing issues.  Your awesome man!!!
-
-#import "VLCHUDScroller.h"
-#import "CompatibilityFixes.h"
-
- at implementation VLCHUDScroller
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
-    self = [super initWithCoder:coder];
-    if (self) {
-        _scrollerStroke = [NSColor colorWithDeviceRed: 0.749f green: 0.761f blue: 0.788f alpha: 1.0f];
-        _scrollerKnobGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.631f green:0.639f blue:0.655f alpha:1.0f]
-                                                              endingColor:[NSColor colorWithDeviceRed:0.439f green:0.447f blue:0.471f alpha:1.0f]];
-        _scrollerTrackGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.137f green:0.137f blue:0.137f alpha:.75f]
-                                                               endingColor:[NSColor colorWithDeviceRed:0.278f green:0.278f blue:0.278f alpha:.75f]];
-        _scrollerArrowNormalGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.251f green:0.251f blue:0.255f alpha:0.5f]
-                                                                     endingColor:[NSColor colorWithDeviceRed:0.118f green:0.118f blue:0.118f alpha:0.5f]];
-        _scrollerArrowPushedGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithDeviceRed:0.451f green:0.451f blue:0.455f alpha:0.5f]
-                                                                                                 endingColor:[NSColor colorWithDeviceRed:0.318f green:0.318f blue:0.318f alpha:0.5f]];
-    }
-    return self;
-}
-
-#pragma mark Drawing Functions
-
-- (void)drawRect:(NSRect)rect {
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawRect:rect];
-    }
-    // See if we should use system default or supplied value
-    if ([self arrowsPosition] == NSScrollerArrowsDefaultSetting) {
-        arrowPosition = [[[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain] valueForKey: @"AppleScrollBarVariant"];
-        if (arrowPosition == nil) {
-            arrowPosition = @"DoubleMax";
-        }
-    } else {
-        if ([self arrowsPosition] == NSScrollerArrowsNone) {
-            arrowPosition = @"None";
-        }
-    }
-
-    NSDisableScreenUpdates();
-
-    [[NSColor colorWithCalibratedWhite:0.0f alpha:0.7f] set];
-    NSRectFill([self bounds]);
-
-    // Draw knob-slot.
-    [self drawKnobSlotInRect:[self bounds] highlight:YES];
-
-    // Draw knob
-    [self drawKnob];
-
-    // Draw arrows
-    [self drawArrow:NSScrollerIncrementArrow highlight:([self hitPart] == NSScrollerIncrementLine)];
-    [self drawArrow:NSScrollerDecrementArrow highlight:([self hitPart] == NSScrollerDecrementLine)];
-
-    [[self window] invalidateShadow];
-
-    NSEnableScreenUpdates();
-}
-
-- (void)drawKnob {
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawKnob];
-    }
-
-    if(![self isHoriz]) {
-
-        //Draw Knob
-        NSBezierPath *knob = [[NSBezierPath alloc] init];
-        NSRect knobRect = [self rectForPart:NSScrollerKnob];
-
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.width - .5f) /2), (knobRect.origin.y + ((knobRect.size.width -2) /2)))
-                                         radius:(knobRect.size.width -2) /2
-                                     startAngle:180
-                                       endAngle:0];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.width - .5f) /2), ((knobRect.origin.y + knobRect.size.height) - ((knobRect.size.width -2) /2)))
-                                         radius:(knobRect.size.width -2) /2
-                                     startAngle:0
-                                       endAngle:180];
-
-        [_scrollerStroke set];
-        [knob fill];
-
-        knobRect.origin.x += 1;
-        knobRect.origin.y += 1;
-        knobRect.size.width -= 2;
-        knobRect.size.height -= 2;
-
-        knob = [[NSBezierPath alloc] init];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.width - .5f) /2), (knobRect.origin.y + ((knobRect.size.width -2) /2)))
-                                         radius:(knobRect.size.width -2) /2
-                                     startAngle:180
-                                       endAngle:0];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.width - .5f) /2), ((knobRect.origin.y + knobRect.size.height) - ((knobRect.size.width -2) /2)))
-                                         radius:(knobRect.size.width -2) /2
-                                     startAngle:0
-                                       endAngle:180];
-
-        [_scrollerKnobGradient drawInBezierPath:knob angle:0];
-
-    } else {
-
-        //Draw Knob
-        NSBezierPath *knob = [[NSBezierPath alloc] init];
-        NSRect knobRect = [self rectForPart:NSScrollerKnob];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.height - .5f) /2), (knobRect.origin.y + ((knobRect.size.height -1) /2)))
-                                         radius:(knobRect.size.height -1) /2
-                                     startAngle:90
-                                       endAngle:270];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint((knobRect.origin.x + knobRect.size.width) - ((knobRect.size.height - .5f) /2), (knobRect.origin.y + ((knobRect.size.height -1) /2)))
-                                         radius:(knobRect.size.height -1) /2
-                                     startAngle:270
-                                       endAngle:90];
-
-        [_scrollerStroke set];
-        [knob fill];
-
-        knobRect.origin.x += 1;
-        knobRect.origin.y += 1;
-        knobRect.size.width -= 2;
-        knobRect.size.height -= 2;
-
-        knob = [[NSBezierPath alloc] init];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint(knobRect.origin.x + ((knobRect.size.height - .5f) /2), (knobRect.origin.y + ((knobRect.size.height -1) /2)))
-                                         radius:(knobRect.size.height -1) /2
-                                     startAngle:90
-                                       endAngle:270];
-
-        [knob appendBezierPathWithArcWithCenter:NSMakePoint((knobRect.origin.x + knobRect.size.width) - ((knobRect.size.height - .5f) /2), (knobRect.origin.y + ((knobRect.size.height -1) /2)))
-                                         radius:(knobRect.size.height -1) /2
-                                     startAngle:270
-                                       endAngle:90];
-
-        [_scrollerKnobGradient drawInBezierPath:knob angle:90];
-
-    }
-}
-
-- (void)drawArrow:(NSScrollerArrow)arrow highlightPart:(NSUInteger)part {
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawArrow:arrow highlight:part];
-    }
-
-    if (arrow == NSScrollerDecrementArrow) {
-
-        if (part == (NSUInteger)-1 || part == 0) {
-            [self drawDecrementArrow: NO];
-        } else {
-            [self drawDecrementArrow: YES];
-        }
-    }
-
-    if (arrow == NSScrollerIncrementArrow) {
-
-        if(part == 1 || part == (NSUInteger)-1) {
-
-            [self drawIncrementArrow: NO];
-        } else {
-
-            [self drawIncrementArrow: YES];
-        }
-    }
-}
-
-- (void)drawKnobSlotInRect:(NSRect)rect highlight:(BOOL)highlight {
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawKnobSlotInRect:rect highlight:highlight];
-    }
-
-    if (![self isHoriz]) {
-
-        // Draw Knob Slot
-        [_scrollerTrackGradient drawInRect:rect angle:0];
-
-        if ([arrowPosition isEqualToString:@"DoubleMax"]) {
-
-            // Adjust rect height for top base
-            rect.size.height = 8;
-
-            // Draw Top Base
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(rect.size.width /2, rect.size.height + (rect.size.width /2) -5)
-                                             radius:(rect.size.width ) /2
-                                         startAngle:180
-                                           endAngle:0];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[1] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-
-        } else if ([arrowPosition isEqualToString:@"None"]) {
-
-            // Adjust rect height for top base
-            NSRect topRect = rect;
-            topRect.size.height = 8;
-
-            // Draw Top Base
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(topRect.size.width /2, topRect.size.height + (topRect.size.width /2) -5)
-                                             radius:(topRect.size.width ) /2
-                                         startAngle:180
-                                           endAngle:0];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( topRect.origin.x, topRect.origin.y + topRect.size.height);
-            basePoints[2] = NSMakePoint( topRect.origin.x, topRect.origin.y);
-            basePoints[1] = NSMakePoint( topRect.origin.x + topRect.size.width, topRect.origin.y);
-            basePoints[0] = NSMakePoint( topRect.origin.x + topRect.size.width, topRect.origin.y + topRect.size.height);
-
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-
-
-            // Draw Decrement Button
-            NSRect bottomRect = rect;
-            bottomRect.origin.y = rect.size.height - 4;
-            bottomRect.size.height = 4;
-
-            path = [[NSBezierPath alloc] init];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint((bottomRect.size.width ) /2, (bottomRect.origin.y  - ((bottomRect.size.width ) /2) + 1))
-                                             radius:(bottomRect.size.width ) /2
-                                         startAngle:0
-                                           endAngle:180];
-
-            // Add the rest of the points
-            basePoints[0] = NSMakePoint( bottomRect.origin.x, bottomRect.origin.y);
-            basePoints[1] = NSMakePoint( bottomRect.origin.x, bottomRect.origin.y + bottomRect.size.height);
-            basePoints[2] = NSMakePoint( bottomRect.origin.x + bottomRect.size.width, bottomRect.origin.y + bottomRect.size.height);
-            basePoints[3] = NSMakePoint( bottomRect.origin.x + bottomRect.size.width, bottomRect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-        }
-    } else {
-
-        // Draw Knob Slot
-        [_scrollerTrackGradient drawInRect:rect angle:90];
-
-        if ([arrowPosition isEqualToString:@"DoubleMax"]) {
-
-            // Adjust rect height for top base
-            rect.size.width = 8;
-
-            // Draw Top Base
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint((rect.size.height /2) +5, rect.origin.y + (rect.size.height /2) )
-                                             radius:(rect.size.height ) /2
-                                         startAngle:90
-                                           endAngle:270];
-
-            // Add the rest of the points
-            basePoints[2] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[1] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-            basePoints[3] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-        } else if ([arrowPosition isEqualToString:@"None"]) {
-
-            // Adjust rect height for top base
-            NSRect topRect = rect;
-            topRect.size.width = 8;
-
-            // Draw Top Base
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint((topRect.size.height /2) +5, topRect.origin.y + (topRect.size.height /2) )
-                                             radius:(topRect.size.height ) /2
-                                         startAngle:90
-                                           endAngle:270];
-
-            // Add the rest of the points
-            basePoints[2] = NSMakePoint( topRect.origin.x, topRect.origin.y + topRect.size.height);
-            basePoints[1] = NSMakePoint( topRect.origin.x, topRect.origin.y);
-            basePoints[0] = NSMakePoint( topRect.origin.x + topRect.size.width, topRect.origin.y);
-            basePoints[3] = NSMakePoint( topRect.origin.x + topRect.size.width, topRect.origin.y + topRect.size.height);
-
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-
-            // Bottom Base
-            // Draw Decrement Button
-            NSRect bottomRect = rect;
-            bottomRect.origin.x = rect.size.width - 4;
-            bottomRect.size.width = 4;
-
-            path = [[NSBezierPath alloc] init];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(bottomRect.origin.x - ((bottomRect.size.height ) /2), (bottomRect.origin.y  + ((bottomRect.size.height ) /2) ))
-                                             radius:(bottomRect.size.height ) /2
-                                         startAngle:270
-                                           endAngle:90];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( bottomRect.origin.x - (((bottomRect.size.height ) /2) -1), bottomRect.origin.y);
-            basePoints[0] = NSMakePoint( bottomRect.origin.x - (((bottomRect.size.height ) /2) -1), bottomRect.origin.y + bottomRect.size.height);
-            basePoints[1] = NSMakePoint( bottomRect.origin.x + bottomRect.size.width, bottomRect.origin.y + bottomRect.size.height);
-            basePoints[2] = NSMakePoint( bottomRect.origin.x + bottomRect.size.width, bottomRect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            [_scrollerArrowNormalGradient drawInBezierPath:path angle:90];
-        }
-    }
-}
-
-- (void)drawDecrementArrow:(bool)highlighted {
-
-    if (![self isHoriz]) {
-
-        if ([arrowPosition isEqualToString:@"DoubleMax"]) {
-
-            // Draw Decrement Button
-            NSRect rect = [self rectForPart: NSScrollerDecrementLine];
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint((rect.size.width ) /2, (rect.origin.y  - ((rect.size.width ) /2) + 1))
-                                             radius:(rect.size.width ) /2
-                                         startAngle:0
-                                           endAngle:180];
-
-            // Add the rest of the points
-            basePoints[0] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[1] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-            basePoints[3] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-            } else {
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:0];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.size.width /2, rect.origin.y + (rect.size.height /2) -3);
-            points[1] = NSMakePoint( (rect.size.width /2) +3.5f, rect.origin.y + (rect.size.height /2) +3);
-            points[2] = NSMakePoint( (rect.size.width /2) -3.5f, rect.origin.y + (rect.size.height /2) +3);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-
-            // Create Devider Line
-            [_scrollerStroke set];
-
-            [NSBezierPath strokeLineFromPoint:NSMakePoint(0, (rect.origin.y + rect.size.height) +.5f)
-                                      toPoint:NSMakePoint(rect.size.width, (rect.origin.y + rect.size.height) +.5f)];
-
-        } else if ([arrowPosition isEqualToString: @"Single"]) {
-
-            NSRect rect = [self rectForPart: NSScrollerDecrementLine];
-
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(rect.size.width /2, rect.size.height + (rect.size.width /2) -3)
-                                             radius:(rect.size.width ) /2
-                                         startAngle:180
-                                           endAngle:0];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[1] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-
-            [path appendBezierPathWithPoints: basePoints count: 4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-            } else {
-
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:0];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.size.width /2, rect.origin.y + (rect.size.height /2) -3);
-            points[1] = NSMakePoint( (rect.size.width /2) +3.5f, rect.origin.y + (rect.size.height /2) +3);
-            points[2] = NSMakePoint( (rect.size.width /2) -3.5f, rect.origin.y + (rect.size.height /2) +3);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        }
-    } else {
-
-        if ([arrowPosition isEqualToString: @"DoubleMax"]) {
-
-            // Draw Decrement Button
-            NSRect rect = [self rectForPart:NSScrollerDecrementLine];
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(rect.origin.x - ((rect.size.height ) /2), (rect.origin.y  + ((rect.size.height ) /2) ))
-                                             radius:(rect.size.height ) /2
-                                         startAngle:270
-                                           endAngle:90];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( rect.origin.x - (((rect.size.height ) /2) -1), rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x - (((rect.size.height ) /2) -1), rect.origin.y + rect.size.height);
-            basePoints[1] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:90];
-            } else {
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:90];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.origin.x + (rect.size.width /2) -3, rect.size.height /2);
-            points[1] = NSMakePoint( rect.origin.x + (rect.size.height /2) +3, (rect.size.height /2) +3.5f);
-            points[2] = NSMakePoint( rect.origin.x + (rect.size.height /2) +3, (rect.size.height /2) -3.5f);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-
-            // Create Devider Line
-            [_scrollerStroke set];
-
-            [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x + rect.size.width -.5f, rect.origin.y)
-                                      toPoint:NSMakePoint(rect.origin.x + rect.size.width -.5f, rect.origin.y + rect.size.height)];
-
-        } else if ([arrowPosition isEqualToString: @"Single"]) {
-
-            NSRect rect = [self rectForPart: NSScrollerDecrementLine];
-
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(rect.origin.x + (rect.size.width -2) + ((rect.size.height ) /2), (rect.origin.y  + ((rect.size.height ) /2) ))
-                                             radius:(rect.size.height ) /2
-                                         startAngle:90
-                                           endAngle:270];
-
-            // Add the rest of the points
-            basePoints[2] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[1] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-            basePoints[3] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-
-            [path appendBezierPathWithPoints: basePoints count: 4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:90];
-            } else {
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:90];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.origin.x + (rect.size.width /2) -3, rect.size.height /2);
-            points[1] = NSMakePoint( rect.origin.x + (rect.size.height /2) +3, (rect.size.height /2) +3.5f);
-            points[2] = NSMakePoint( rect.origin.x + (rect.size.height /2) +3, (rect.size.height /2) -3.5f);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        }
-    }
-}
-
-- (void)drawIncrementArrow:(bool)highlighted {
-
-    if (![self isHoriz]) {
-
-        if ([arrowPosition isEqualToString:@"DoubleMax"]) {
-
-            // Draw Increment Button
-            NSRect rect = [self rectForPart: NSScrollerIncrementLine];
-
-            if(!highlighted) {
-
-                [_scrollerArrowNormalGradient drawInRect:rect angle:0];
-            } else {
-
-                [_scrollerArrowPushedGradient drawInRect:rect angle:0];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.size.width /2, rect.origin.y + (rect.size.height /2) +3);
-            points[1] = NSMakePoint( (rect.size.width /2) +3.5f, rect.origin.y + (rect.size.height /2) -3);
-            points[2] = NSMakePoint( (rect.size.width /2) -3.5f, rect.origin.y + (rect.size.height /2) -3);
-
-            [arrow appendBezierPathWithPoints: points count: 3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        } else if ([arrowPosition isEqualToString:@"Single"]) {
-
-            // Draw Decrement Button
-            NSRect rect = [self rectForPart: NSScrollerIncrementLine];
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint((rect.size.width ) /2, (rect.origin.y  - ((rect.size.width ) /2) + 2))
-                                             radius:(rect.size.width ) /2
-                                         startAngle:0
-                                           endAngle:180];
-
-            // Add the rest of the points
-            basePoints[0] = NSMakePoint( rect.origin.x, rect.origin.y);
-            basePoints[1] = NSMakePoint( rect.origin.x, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-            basePoints[3] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-            } else {
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:0];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.size.width /2, rect.origin.y + (rect.size.height /2) +3);
-            points[1] = NSMakePoint( (rect.size.width /2) +3.5f, rect.origin.y + (rect.size.height /2) -3);
-            points[2] = NSMakePoint( (rect.size.width /2) -3.5f, rect.origin.y + (rect.size.height /2) -3);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        }
-    } else {
-
-        if ([arrowPosition isEqualToString:@"DoubleMax"]) {
-
-            // Draw Increment Button
-            NSRect rect = [self rectForPart:NSScrollerIncrementLine];
-
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInRect:rect angle:90];
-            } else {
-                [_scrollerArrowPushedGradient drawInRect:rect angle:90];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.origin.x + (rect.size.width /2) +3, rect.size.height /2);
-            points[1] = NSMakePoint( rect.origin.x + (rect.size.height /2) -3, (rect.size.height /2) +3.5f);
-            points[2] = NSMakePoint( rect.origin.x + (rect.size.height /2) -3, (rect.size.height /2) -3.5f);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        } else if ([arrowPosition isEqualToString:@"Single"]) {
-
-            // Draw Decrement Button
-            NSRect rect = [self rectForPart:NSScrollerIncrementLine];
-            NSBezierPath *path = [[NSBezierPath alloc] init];
-            NSPoint basePoints[4];
-
-            // Add Notch
-            [path appendBezierPathWithArcWithCenter:NSMakePoint(rect.origin.x - (((rect.size.height ) /2) -2), (rect.origin.y  + ((rect.size.height ) /2) ))
-                                             radius:(rect.size.height ) /2
-                                         startAngle:270
-                                           endAngle:90];
-
-            // Add the rest of the points
-            basePoints[3] = NSMakePoint( rect.origin.x - (((rect.size.height ) /2) -1), rect.origin.y);
-            basePoints[0] = NSMakePoint( rect.origin.x - (((rect.size.height ) /2) -1), rect.origin.y + rect.size.height);
-            basePoints[1] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y + rect.size.height);
-            basePoints[2] = NSMakePoint( rect.origin.x + rect.size.width, rect.origin.y);
-
-            // Add Points to Path
-            [path appendBezierPathWithPoints:basePoints count:4];
-
-            // Fill Path
-            if (!highlighted) {
-                [_scrollerArrowNormalGradient drawInBezierPath:path angle:0];
-            } else {
-                [_scrollerArrowPushedGradient drawInBezierPath:path angle:0];
-            }
-
-            // Create Arrow Glyph
-            NSBezierPath *arrow = [[NSBezierPath alloc] init];
-
-            NSPoint points[3];
-            points[0] = NSMakePoint( rect.origin.x + (rect.size.width /2) +3, rect.size.height /2);
-            points[1] = NSMakePoint( rect.origin.x + (rect.size.height /2) -3, (rect.size.height /2) +3.5f);
-            points[2] = NSMakePoint( rect.origin.x + (rect.size.height /2) -3, (rect.size.height /2) -3.5f);
-
-            [arrow appendBezierPathWithPoints:points count:3];
-
-            [_scrollerStroke set];
-            [arrow fill];
-        }
-    }
-}
-
-#pragma mark -
-#pragma mark Helper Methods
-- (NSUsableScrollerParts)usableParts {
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super usableParts];
-    }
-
-    if ([self arrowsPosition] != NSScrollerArrowsNone) {
-
-        if ([self isHoriz]) {
-
-            // Now Figure out if we can actually show all parts
-            CGFloat arrowSpace = NSWidth([self rectForPart: NSScrollerIncrementLine]) + NSWidth([self rectForPart: NSScrollerDecrementLine]) +
-                NSMidY([self rectForPart: NSScrollerIncrementLine]);
-            CGFloat knobSpace = NSWidth([self rectForPart: NSScrollerKnob]);
-
-            if ((arrowSpace + knobSpace) > NSWidth([self bounds])) {
-
-                if (arrowSpace > NSWidth([self bounds])) {
-                    return NSNoScrollerParts;
-                } else {
-                    return NSOnlyScrollerArrows;
-                }
-            }
-
-        } else {
-
-            // Now Figure out if we can actually show all parts
-            CGFloat arrowSpace = NSHeight([self rectForPart: NSScrollerIncrementLine]) + NSHeight([self rectForPart: NSScrollerDecrementLine]) +
-                NSMidX([self rectForPart: NSScrollerIncrementLine]);
-            CGFloat knobSpace = NSHeight([self rectForPart: NSScrollerKnob]);
-
-            if ((arrowSpace + knobSpace) > NSHeight([self bounds])) {
-
-                if (arrowSpace > NSHeight([self bounds])) {
-                    return NSNoScrollerParts;
-                } else {
-                    return NSOnlyScrollerArrows;
-                }
-            }
-        }
-    }
-
-    return NSAllScrollerParts;
-}
-
-- (bool)isHoriz {
-    if ([self bounds].size.width > [self bounds].size.height) {
-        return YES;
-    }
-    return NO;
-}
-
- at end




More information about the vlc-commits mailing list