[vlc-commits] macosx: Remove VLCHUDSegmentedCell class

Marvin Scholz git at videolan.org
Sun Feb 18 17:16:14 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Sun Feb 18 16:38:02 2018 +0100| [2bcf9464cb6ccd0639b1e4707f6515224e18fec6] | committer: Marvin Scholz

macosx: Remove VLCHUDSegmentedCell class

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

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   6 -
 modules/gui/macosx/Makefile.am                     |   1 -
 modules/gui/macosx/VLCHUDSegmentedCell.h           |  46 -----
 modules/gui/macosx/VLCHUDSegmentedCell.m           | 186 ---------------------
 4 files changed, 239 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 91fc007b18..202129a6a9 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -94,7 +94,6 @@
 		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 */; };
-		6BBB05E31EF08181003A1019 /* VLCHUDSegmentedCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB05E21EF08181003A1019 /* VLCHUDSegmentedCell.m */; };
 		6BBBF9851F7B257100B404CD /* VLCLogMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBBF9841F7B257100B404CD /* VLCLogMessage.m */; };
 		6BF093F91EE0182B0049D8B0 /* VLCTimeField.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BF093F81EE0182B0049D8B0 /* VLCTimeField.m */; };
 		6BF56C3E1FCF00AF004A411A /* audiotoolbox_midi.c in Sources */ = {isa = PBXBuildFile; fileRef = 6BF56C3D1FCF00AF004A411A /* audiotoolbox_midi.c */; };
@@ -634,8 +633,6 @@
 		6BBB05D91EEFEA29003A1019 /* VLCHUDOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDOutlineView.m; sourceTree = "<group>"; };
 		6BBB05DE1EEFF165003A1019 /* VLCHUDTableCornerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHUDTableCornerView.h; sourceTree = "<group>"; };
 		6BBB05DF1EEFF165003A1019 /* VLCHUDTableCornerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDTableCornerView.m; sourceTree = "<group>"; };
-		6BBB05E11EF08181003A1019 /* VLCHUDSegmentedCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCHUDSegmentedCell.h; sourceTree = "<group>"; };
-		6BBB05E21EF08181003A1019 /* VLCHUDSegmentedCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCHUDSegmentedCell.m; sourceTree = "<group>"; };
 		6BBBB8A71D108A17001BD9BA /* VLCRendererMenuController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCRendererMenuController.h; sourceTree = "<group>"; };
 		6BBBB8A81D108A17001BD9BA /* VLCRendererMenuController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCRendererMenuController.m; sourceTree = "<group>"; };
 		6BBBB8B01D10A994001BD9BA /* VLCRendererItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCRendererItem.h; sourceTree = "<group>"; };
@@ -1497,8 +1494,6 @@
 				6BBB05D91EEFEA29003A1019 /* VLCHUDOutlineView.m */,
 				6BBB05DE1EEFF165003A1019 /* VLCHUDTableCornerView.h */,
 				6BBB05DF1EEFF165003A1019 /* VLCHUDTableCornerView.m */,
-				6BBB05E11EF08181003A1019 /* VLCHUDSegmentedCell.h */,
-				6BBB05E21EF08181003A1019 /* VLCHUDSegmentedCell.m */,
 			);
 			name = "HUD UI Classes";
 			sourceTree = "<group>";
@@ -1847,7 +1842,6 @@
 				6B7F1FDF1F07DA920002BDD8 /* VLCHexNumberFormatter.m in Sources */,
 				1C3113E91E508C6900D4DD76 /* VLCScrollingClipView.m in Sources */,
 				1C3113EB1E508C6900D4DD76 /* VLCStatusBarIcon.m in Sources */,
-				6BBB05E31EF08181003A1019 /* VLCHUDSegmentedCell.m in Sources */,
 				1C3113ED1E508C6900D4DD76 /* VLCTimeSelectionPanelController.m in Sources */,
 				1C06F2A31F08F1250068846F /* osx_notifications.m in Sources */,
 			);
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 44abaaee34..1a4823883b 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -82,7 +82,6 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/VLCHUDOutlineView.h gui/macosx/VLCHUDOutlineView.m \
 	gui/macosx/VLCHUDTableView.h gui/macosx/VLCHUDTableView.m \
 	gui/macosx/VLCHUDTableCornerView.h gui/macosx/VLCHUDTableCornerView.m \
-	gui/macosx/VLCHUDSegmentedCell.h gui/macosx/VLCHUDSegmentedCell.m \
 	gui/macosx/VLCHUDStepperCell.h gui/macosx/VLCHUDStepperCell.m \
 	gui/macosx/VLCHUDPopUpButtonCell.h gui/macosx/VLCHUDPopUpButtonCell.m \
 	gui/macosx/VLCInputManager.h gui/macosx/VLCInputManager.m \
diff --git a/modules/gui/macosx/VLCHUDSegmentedCell.h b/modules/gui/macosx/VLCHUDSegmentedCell.h
deleted file mode 100644
index 8bddb58c41..0000000000
--- a/modules/gui/macosx/VLCHUDSegmentedCell.h
+++ /dev/null
@@ -1,46 +0,0 @@
-//
-//  VLCHUDSegmentedCell.h
-//  BGHUDAppKit
-//
-//  Created by BinaryGod on 7/1/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.
-
-#import <Cocoa/Cocoa.h>
-
- at interface VLCHUDSegmentedCell : NSSegmentedCell
-
- at property (strong) NSColor *strokeColor;
- at property (strong) NSGradient *highlightGradient;
- at property (strong) NSGradient *normalGradient;
- at property (strong) NSGradient *disabledNormalGradient;
- at property (strong) NSColor *cellTextColor;
- at property (strong) NSColor *disabledCellTextColor;
-
- at end
diff --git a/modules/gui/macosx/VLCHUDSegmentedCell.m b/modules/gui/macosx/VLCHUDSegmentedCell.m
deleted file mode 100644
index ee44485190..0000000000
--- a/modules/gui/macosx/VLCHUDSegmentedCell.m
+++ /dev/null
@@ -1,186 +0,0 @@
-//
-//  VLCHUDSegmentedCell.m
-//  BGHUDAppKit
-//
-//  Created by BinaryGod on 7/1/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.
-
-#import "VLCHUDSegmentedCell.h"
-#import "CompatibilityFixes.h"
-
- at interface NSSegmentedCell (Private)
-
-- (NSRect)rectForSegment:(NSInteger)segment inFrame:(NSRect)frame;
-- (NSInteger)_keySegment;
-
- at end
-
-
- at implementation VLCHUDSegmentedCell
-
-- (instancetype)initWithCoder:(NSCoder *)decoder
-{
-
-    self = [super initWithCoder:decoder];
-
-    if (self) {
-        _strokeColor = [NSColor colorWithDeviceRed:0.749f green:0.761f blue:0.788f alpha:1.0f];
-        _highlightGradient = [[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]];
-        _normalGradient = [[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]];
-        _disabledNormalGradient = [[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]];
-        _cellTextColor = [NSColor whiteColor];
-        _disabledCellTextColor = [NSColor colorWithDeviceRed:1 green:1 blue:1 alpha:0.5f];
-    }
-
-    return self;
-}
-
-- (void)drawWithFrame:(NSRect)frame inView:(NSView *)view
-{
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawWithFrame:frame inView:view];
-    }
-
-    for (NSInteger segment = 0; segment < self.segmentCount; segment++) {
-        NSRect segmentRect = [self rectForSegment:segment inFrame:frame];
-        [self drawBackgroundForSegment:segment inFrame:segmentRect];
-        [self drawSegment:segment inFrame:segmentRect withView:view];
-        [self drawDividerForSegment:segment inFrame:segmentRect];
-    }
-
-    NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 0.55, 0.55) xRadius:3.0 yRadius:3.0];
-    [_strokeColor setStroke];
-    [rectanglePath setLineWidth:1.0];
-    [rectanglePath stroke];
-}
-
-- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *)view
-{
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        return [super drawSegment:segment inFrame:frame withView:view];
-    }
-
-    NSString *segmentText = [self labelForSegment:segment];
-
-    NSSize textSize = [segmentText sizeWithAttributes:nil];
-
-    frame.origin.y += (frame.size.height - textSize.height) / 2;
-    frame.size.height -= (frame.size.height - textSize.height) / 2;
-
-    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init] ;
-    [paragraphStyle setAlignment:NSTextAlignmentCenter];
-
-    NSDictionary *attributes = @{ NSForegroundColorAttributeName : (self.isEnabled) ? _cellTextColor : _disabledCellTextColor,
-                                  NSParagraphStyleAttributeName  : paragraphStyle };
-    [segmentText drawInRect:frame withAttributes:attributes];
-}
-
-- (void)drawBackgroundForSegment:(NSInteger)segment inFrame:(NSRect)frame
-{
-    NSGradient *gradient;
-
-    if (self.isEnabled) {
-        gradient = (segment == self.selectedSegment) ? _highlightGradient : _normalGradient;
-    } else {
-        gradient = _disabledNormalGradient;
-    }
-
-    if (segment > 0 && segment < (self.segmentCount - 1)) {
-        // Middle segments
-        [NSGraphicsContext saveGraphicsState];
-        if ([super showsFirstResponder] && [[[self controlView] window] isKeyWindow] &&
-            ([self focusRingType] == NSFocusRingTypeDefault ||
-             [self focusRingType] == NSFocusRingTypeExterior) &&
-            [self respondsToSelector:@selector(_keySegment)] && self._keySegment == segment) {
-            NSSetFocusRingStyle(NSFocusRingOnly);
-            NSRectFill(frame);
-        }
-        [NSGraphicsContext restoreGraphicsState];
-        [gradient drawInRect:frame angle:90];
-        return;
-    }
-
-    CGFloat radius = 3.0;
-    NSBezierPath* fillPath = [NSBezierPath bezierPath];
-
-    if (segment == 0) {
-        // First segment
-        [fillPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(frame) + radius, NSMinY(frame) + radius) radius:radius startAngle:180 endAngle:270];
-        [fillPath lineToPoint: NSMakePoint(NSMaxX(frame), NSMinY(frame))];
-        [fillPath lineToPoint: NSMakePoint(NSMaxX(frame), NSMaxY(frame))];
-        [fillPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMinX(frame) + radius, NSMaxY(frame) - radius) radius:radius startAngle:90 endAngle:180];
-    } else {
-        // Last segment
-        [fillPath moveToPoint: NSMakePoint(NSMinX(frame), NSMinY(frame))];
-        [fillPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(frame) - radius, NSMinY(frame) + radius) radius:radius startAngle:270 endAngle:360];
-        [fillPath appendBezierPathWithArcWithCenter: NSMakePoint(NSMaxX(frame) - radius, NSMaxY(frame) - radius) radius:radius startAngle:0 endAngle:90];
-        [fillPath lineToPoint: NSMakePoint(NSMinX(frame), NSMaxY(frame))];
-    }
-    [fillPath closePath];
-    [NSGraphicsContext saveGraphicsState];
-    if ([super showsFirstResponder] && [[[self controlView] window] isKeyWindow] &&
-        ([self focusRingType] == NSFocusRingTypeDefault ||
-         [self focusRingType] == NSFocusRingTypeExterior) &&
-        [self respondsToSelector:@selector(_keySegment)] && self._keySegment == segment) {
-        NSSetFocusRingStyle(NSFocusRingOnly);
-        [fillPath fill];
-    }
-    [NSGraphicsContext restoreGraphicsState];
-    [gradient drawInBezierPath:fillPath angle:90];
-}
-
-- (void)drawDividerForSegment:(NSInteger)segment inFrame:(NSRect)frame
-{
-    if (segment == 0) {
-        // Do not draw for first segment
-        return;
-    }
-
-    // Draw divider on the left of the segment
-    NSBezierPath* dividerPath = [NSBezierPath bezierPath];
-    [dividerPath moveToPoint:NSMakePoint(NSMinX(frame), NSMinY(frame))];
-    [dividerPath lineToPoint:NSMakePoint(NSMinX(frame), NSMaxY(frame))];
-    [_strokeColor setStroke];
-    [dividerPath setLineWidth:1.0];
-    [dividerPath stroke];
-}
-
-- (BOOL)_canAnimate {
-    return NO;
-}
-
-- (BOOL)_isSliderStyle {
-    return NO;
-}
-
- at end



More information about the vlc-commits mailing list