diff --git a/Aural.xcodeproj/project.pbxproj b/Aural.xcodeproj/project.pbxproj index d70a83046..58e27de70 100644 --- a/Aural.xcodeproj/project.pbxproj +++ b/Aural.xcodeproj/project.pbxproj @@ -749,8 +749,6 @@ 3E6C131325CEBE8F00BF0D07 /* WindowLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6C105125CEB98600BF0D07 /* WindowLayout.swift */; }; 3E6C131425CEBE8F00BF0D07 /* AudioTrackInfoSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6C103E25CEB98600BF0D07 /* AudioTrackInfoSource.swift */; }; 3E6C136B25CEBFB900BF0D07 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3E6C0FE125CEB98600BF0D07 /* MainMenu.xib */; }; - 3E6C39F826AA110200AF5009 /* CutoffFrequencySliderPreviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6C39F726AA110200AF5009 /* CutoffFrequencySliderPreviewCell.swift */; }; - 3E6C39FC26AA169500AF5009 /* FilterPreviewChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6C39FB26AA169500AF5009 /* FilterPreviewChart.swift */; }; 3E6E6B792C84CFAD00B87FF6 /* Track+Metadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6E6B782C84CFAD00B87FF6 /* Track+Metadata.swift */; }; 3E6EFFA32815309500C813AC /* TextColorScheme.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3E6EFFA12815309500C813AC /* TextColorScheme.xib */; }; 3E6EFFA42815309500C813AC /* TextColorSchemeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6EFFA22815309500C813AC /* TextColorSchemeViewController.swift */; }; @@ -857,12 +855,10 @@ 3EAFB5F6267FEE9D00F0DC96 /* NSWindowExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB5F5267FEE9D00F0DC96 /* NSWindowExtensions.swift */; }; 3EAFB5F8267FEEC700F0DC96 /* NSBezierPathExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB5F7267FEEC700F0DC96 /* NSBezierPathExtensions.swift */; }; 3EAFB5FC267FEF1C00F0DC96 /* NSColorExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB5FB267FEF1C00F0DC96 /* NSColorExtensions.swift */; }; - 3EAFB5FE267FEF3700F0DC96 /* NSGradientExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB5FD267FEF3700F0DC96 /* NSGradientExtensions.swift */; }; 3EAFB600267FF0D400F0DC96 /* NoTitleBarWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB5FF267FF0D400F0DC96 /* NoTitleBarWindow.swift */; }; 3EAFB605267FF1E700F0DC96 /* NSRectExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB604267FF1E700F0DC96 /* NSRectExtensions.swift */; }; 3EAFB607267FF24900F0DC96 /* SeekSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB606267FF24900F0DC96 /* SeekSliderCell.swift */; }; 3EAFB609267FF29300F0DC96 /* VolumeSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB608267FF29300F0DC96 /* VolumeSliderCell.swift */; }; - 3EAFB60B267FF2B900F0DC96 /* PreferencesSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB60A267FF2B900F0DC96 /* PreferencesSliderCell.swift */; }; 3EAFB60F267FF35900F0DC96 /* EffectsUnitSliderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB60E267FF35900F0DC96 /* EffectsUnitSliderCell.swift */; }; 3EAFB615267FF47200F0DC96 /* FilterBandSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB614267FF47200F0DC96 /* FilterBandSlider.swift */; }; 3EAFB617267FF4C200F0DC96 /* EffectsSliderPreviewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EAFB616267FF4C200F0DC96 /* EffectsSliderPreviewCell.swift */; }; @@ -1857,8 +1853,6 @@ 3E6C105525CEB98600BF0D07 /* WindowLayoutPresets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowLayoutPresets.swift; sourceTree = ""; }; 3E6C113425CEB98700BF0D07 /* MediaKeyHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaKeyHandler.swift; sourceTree = ""; }; 3E6C115325CEB9C100BF0D07 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 3E6C39F726AA110200AF5009 /* CutoffFrequencySliderPreviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CutoffFrequencySliderPreviewCell.swift; sourceTree = ""; }; - 3E6C39FB26AA169500AF5009 /* FilterPreviewChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterPreviewChart.swift; sourceTree = ""; }; 3E6E6B782C84CFAD00B87FF6 /* Track+Metadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Track+Metadata.swift"; sourceTree = ""; }; 3E6EFFA12815309500C813AC /* TextColorScheme.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TextColorScheme.xib; sourceTree = ""; }; 3E6EFFA22815309500C813AC /* TextColorSchemeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextColorSchemeViewController.swift; sourceTree = ""; }; @@ -1967,12 +1961,10 @@ 3EAFB5F5267FEE9D00F0DC96 /* NSWindowExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSWindowExtensions.swift; sourceTree = ""; }; 3EAFB5F7267FEEC700F0DC96 /* NSBezierPathExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSBezierPathExtensions.swift; sourceTree = ""; }; 3EAFB5FB267FEF1C00F0DC96 /* NSColorExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSColorExtensions.swift; sourceTree = ""; }; - 3EAFB5FD267FEF3700F0DC96 /* NSGradientExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSGradientExtensions.swift; sourceTree = ""; }; 3EAFB5FF267FF0D400F0DC96 /* NoTitleBarWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoTitleBarWindow.swift; sourceTree = ""; }; 3EAFB604267FF1E700F0DC96 /* NSRectExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSRectExtensions.swift; sourceTree = ""; }; 3EAFB606267FF24900F0DC96 /* SeekSliderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeekSliderCell.swift; sourceTree = ""; }; 3EAFB608267FF29300F0DC96 /* VolumeSliderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VolumeSliderCell.swift; sourceTree = ""; }; - 3EAFB60A267FF2B900F0DC96 /* PreferencesSliderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesSliderCell.swift; sourceTree = ""; }; 3EAFB60E267FF35900F0DC96 /* EffectsUnitSliderCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EffectsUnitSliderCell.swift; sourceTree = ""; }; 3EAFB614267FF47200F0DC96 /* FilterBandSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterBandSlider.swift; sourceTree = ""; }; 3EAFB616267FF4C200F0DC96 /* EffectsSliderPreviewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EffectsSliderPreviewCell.swift; sourceTree = ""; }; @@ -4076,7 +4068,6 @@ children = ( 3E6C0F2C25CEB98500BF0D07 /* Preferences.xib */, 3E6C0F2B25CEB98500BF0D07 /* PreferencesWindowController.swift */, - 3EAFB60A267FF2B900F0DC96 /* PreferencesSliderCell.swift */, 3E6C0F2525CEB98500BF0D07 /* PlayQueue */, 3E6C0F2D25CEB98500BF0D07 /* Playback */, 3E6C0F3825CEB98600BF0D07 /* Sound */, @@ -4262,8 +4253,6 @@ 3E6C0F8125CEB98600BF0D07 /* FilterPresetsManager.xib */, 3E6C0F8325CEB98600BF0D07 /* FilterPresetsManagerViewController.swift */, 3E6C0F8225CEB98600BF0D07 /* FilterPresetBandsViewDelegate.swift */, - 3E6C39F726AA110200AF5009 /* CutoffFrequencySliderPreviewCell.swift */, - 3E6C39FB26AA169500AF5009 /* FilterPreviewChart.swift */, 3E7C35FD26AADD2A00B3552D /* FilterPresetView.swift */, ); path = Filter; @@ -4986,7 +4975,6 @@ 3E5F3DF226814C9700E826F0 /* NSAlertExtensions.swift */, 3EAFB5F7267FEEC700F0DC96 /* NSBezierPathExtensions.swift */, 3EAFB5FB267FEF1C00F0DC96 /* NSColorExtensions.swift */, - 3EAFB5FD267FEF3700F0DC96 /* NSGradientExtensions.swift */, 3EAFB604267FF1E700F0DC96 /* NSRectExtensions.swift */, 3EAFB618267FF68C00F0DC96 /* CGFloatExtensions.swift */, 3EE2CC3226811074002C1B29 /* NSTableViewExtensions.swift */, @@ -6151,7 +6139,6 @@ 3E0218072C23490E00865AC2 /* ReverbUnitProtocol.swift in Sources */, 3EC7425D2C41C6E300C100DE /* AVFScheduler+Gapless.swift in Sources */, 3E02191F2C23490E00865AC2 /* RemoteCommandManager.swift in Sources */, - 3E6C39FC26AA169500AF5009 /* FilterPreviewChart.swift in Sources */, 3E02199D2C23490E00865AC2 /* TimeUtils.swift in Sources */, 3E0217E82C23490E00865AC2 /* EffectsUnitDelegateProtocol.swift in Sources */, 3E8836172B6E0AC30009ABE2 /* TrackInfoViewController.swift in Sources */, @@ -6249,7 +6236,6 @@ 3EAFB5F2267FEE0400F0DC96 /* NSControlExtensions.swift in Sources */, 3E5F3DF126813F2400E826F0 /* NSEventExtensions.swift in Sources */, 3E0218642C23490E00865AC2 /* AppReopenedNotification.swift in Sources */, - 3EAFB5FE267FEF3700F0DC96 /* NSGradientExtensions.swift in Sources */, 3E7C978D268BB8BE00287158 /* NSLayoutConstraintExtensions.swift in Sources */, 3EAFB5F0267FEDD700F0DC96 /* NSMenuItemExtensions.swift in Sources */, 3E02187A2C23490E00865AC2 /* MenuBarPlayerNotifications.swift in Sources */, @@ -6344,7 +6330,6 @@ 3E0218552C23490E00865AC2 /* LastFM_WSClient.swift in Sources */, 3EBF293526869A1200D87021 /* PreferencesPopupMenuCell.swift in Sources */, 3E0218D92C23490E00865AC2 /* PlaybackSession.swift in Sources */, - 3EAFB60B267FF2B900F0DC96 /* PreferencesSliderCell.swift in Sources */, 3ED65A532C45BA3000859677 /* PlayerViewController+Actions.swift in Sources */, 3ED373E42C70D99400836511 /* ReplayGainUnitDelegateProtocol.swift in Sources */, 3EF4CDA32C65909C00A5922D /* AVFWaveformDecoder.swift in Sources */, @@ -6355,7 +6340,6 @@ 3E0219852C23490E00865AC2 /* JSONSerializationExtensions.swift in Sources */, 3E0218662C23490E00865AC2 /* ChapterChangedNotification.swift in Sources */, 3E0218002C23490E00865AC2 /* FilterUnitProtocol.swift in Sources */, - 3E6C39F826AA110200AF5009 /* CutoffFrequencySliderPreviewCell.swift in Sources */, 3E3D7C8F2BDAEC8000A82646 /* MenuBarFontSchemesTableViewDelegate.swift in Sources */, 3ECF71BC2B75B48E00FDB69B /* CompactPlayQueueSearchViewController.swift in Sources */, 3E02197D2C23490E00865AC2 /* AVFExtensions.swift in Sources */, diff --git a/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate b/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate index e1d470b87..41ffcd3ae 100644 Binary files a/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate and b/Aural.xcodeproj/project.xcworkspace/xcuserdata/kven.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Resources/Aural.xcassets/PlayerControls/Play.imageset/Contents.json b/Resources/Aural.xcassets/PlayerControls/Play.imageset/Contents.json deleted file mode 100644 index 222061f5a..000000000 --- a/Resources/Aural.xcassets/PlayerControls/Play.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "play.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Resources/Aural.xcassets/PlayerControls/Play.imageset/play.png b/Resources/Aural.xcassets/PlayerControls/Play.imageset/play.png deleted file mode 100644 index d9083a7ee..000000000 Binary files a/Resources/Aural.xcassets/PlayerControls/Play.imageset/play.png and /dev/null differ diff --git a/Source/Core/TrackIO/Model/PlaybackFormat.swift b/Source/Core/TrackIO/Model/PlaybackFormat.swift index eaebafeee..406d03c9a 100644 --- a/Source/Core/TrackIO/Model/PlaybackFormat.swift +++ b/Source/Core/TrackIO/Model/PlaybackFormat.swift @@ -27,7 +27,7 @@ struct PlaybackFormat { if self.layoutTag == kAudioChannelLayoutTag_UseChannelBitmap { self.channelBitmapRawValue = audioFormat.channelLayout?.layout.pointee.mChannelBitmap.rawValue } else { - self.channelBitmapRawValue = 0 + self.channelBitmapRawValue = nil } } diff --git a/Source/Core/UI/Images.swift b/Source/Core/UI/Images.swift index 82f0cc424..45b7bc3b2 100644 --- a/Source/Core/UI/Images.swift +++ b/Source/Core/UI/Images.swift @@ -31,7 +31,6 @@ extension NSImage { // static let imgLibrary: NSImage = NSImage(named: "Library")! static let imgPlaylist: NSImage = NSImage(systemSymbolName: "list.dash") -// static let imgPlay: NSImage = NSImage(named: "Play")! static let imgPlay: NSImage = NSImage(systemSymbolName: "play") static let imgPlayFilled: NSImage = NSImage(systemSymbolName: "play.fill") diff --git a/Source/Core/Utils/GraphicsUtils.swift b/Source/Core/Utils/GraphicsUtils.swift index f63b5bfb9..7a62244f3 100644 --- a/Source/Core/Utils/GraphicsUtils.swift +++ b/Source/Core/Utils/GraphicsUtils.swift @@ -22,11 +22,11 @@ class GraphicsUtils { } // Draws a line between 2 points - static func drawVerticalLine(_ gradient: NSGradient, pt1: NSPoint, pt2: NSPoint, width: CGFloat) { - - let rect = NSRect(x: pt1.x, y: pt1.y, width: pt2.x - pt1.x + width, height: pt2.y - pt1.y + 1) - gradient.draw(in: rect, angle: .verticalGradientDegrees) - } +// static func drawVerticalLine(_ gradient: NSGradient, pt1: NSPoint, pt2: NSPoint, width: CGFloat) { +// +// let rect = NSRect(x: pt1.x, y: pt1.y, width: pt2.x - pt1.x + width, height: pt2.y - pt1.y + 1) +// gradient.draw(in: rect, angle: .verticalGradientDegrees) +// } // Draws an arrow, from a given point (origin) static func drawArrow(_ color: NSColor, origin: NSPoint, dx: CGFloat, dy: CGFloat, lineWidth: CGFloat) { diff --git a/Source/UI/ColorSchemes/Utils/ColorSchemeHistory.swift b/Source/UI/ColorSchemes/Utils/ColorSchemeHistory.swift index e5b9f32f9..c5efe3939 100644 --- a/Source/UI/ColorSchemes/Utils/ColorSchemeHistory.swift +++ b/Source/UI/ColorSchemes/Utils/ColorSchemeHistory.swift @@ -35,7 +35,7 @@ struct ColorSchemeChange { // The value that should be assigned to the changed control if/when a redo is performed on this field. let redoValue: Any - // The type of change that this record represents (i.e. a color change or a gradient amount change). + // The type of change that this record represents (i.e. a color change). let changeType: ColorSchemeChangeType } diff --git a/Source/UI/CustomViews/Menus/PopupMenuCells.swift b/Source/UI/CustomViews/Menus/PopupMenuCells.swift index a0c0e2634..e7f3a4b63 100644 --- a/Source/UI/CustomViews/Menus/PopupMenuCells.swift +++ b/Source/UI/CustomViews/Menus/PopupMenuCells.swift @@ -73,14 +73,3 @@ class FontsPopupMenuCell: PopupMenuCell { override var arrowColor: NSColor {.lightPopupMenuArrowColor} override var textOffsetY: CGFloat {3} } - -class EffectsPreviewPopupMenuCell: NicerPopupMenuCell { - -// override var menuGradient: NSGradient {Colors.Effects.defaultPopupMenuGradient} -// -// override var titleColor: NSColor {Colors.Effects.defaultPopupMenuTextColor} - -// override var arrowColor: NSColor {titleColor} - - override var textOffsetY: CGFloat {-1} -} diff --git a/Source/UI/CustomViews/Sliders/RangeSlider.swift b/Source/UI/CustomViews/Sliders/RangeSlider.swift index 42872479c..717af79f7 100644 --- a/Source/UI/CustomViews/Sliders/RangeSlider.swift +++ b/Source/UI/CustomViews/Sliders/RangeSlider.swift @@ -44,7 +44,7 @@ fileprivate let bypassedColor: NSColor = .white35Percent fileprivate let suppressedColor: NSColor = NSColor(red: 0.53, green: 0.4, blue: 0) @IBDesignable -class RangeSlider: NSControl, FXUnitStateObserver { +class RangeSlider: NSControl { //****************************************************************************// //****************************************************************************// @@ -172,59 +172,9 @@ class RangeSlider: NSControl, FXUnitStateObserver { //MARK: - Appearance - - var barBackgroundColor: NSColor {systemColorScheme.inactiveControlColor} + var barBackgroundColor: NSColor {.white15Percent} - private lazy var sliderGradient: NSGradient = { - let backgroundStart = NSColor(white: 0.92, alpha: 1.0) - let backgroundEnd = NSColor(white: 0.80, alpha: 1.0) - let barBackgroundColor = NSGradient(starting: backgroundStart, ending: backgroundEnd) - assert(barBackgroundColor != nil, "Couldn't generate gradient.") - - return barBackgroundColor! - }() - - // TODO: Change this to a computed color - var knobColor: NSColor {.white50Percent} - - var controlStateColor: NSColor { - systemColorScheme.colorForEffectsUnitState(fxUnitStateObserverRegistry.currentState(forObserver: self)) - } - - var barFillColor: NSColor { - - switch fxUnitStateObserverRegistry.currentState(forObserver: self) { - - case .active: return bandPassColor - - case .bypassed: return bypassedColor - - case .suppressed: return suppressedColor - - } - } - - private let barStrokeColor: NSColor = NSColor(white: 0.0, alpha: 0.25) - - private var barFillStrokeColor: NSColor = NSColor(deviceRed: CGFloat(0.7), green: CGFloat(0.7), blue: CGFloat(0.7), alpha: CGFloat(1)) - - private var _sliderShadow: NSShadow? = nil - private func sliderShadow() -> NSShadow? { - - if (_sliderShadow == nil) { - let shadowOffset = NSMakeSize(2.0, -2.0) - let shadowBlurRadius: CGFloat = 2.0 - let shadowColor = NSColor(white: 0.0, alpha: 0.12) - - let shadow = NSShadow() - shadow.shadowOffset = shadowOffset - shadow.shadowBlurRadius = shadowBlurRadius - shadow.shadowColor = shadowColor - - _sliderShadow = shadow - } - - return _sliderShadow - } + var barFillColor: NSColor {.white} //MARK: - UI Sizing - @@ -232,7 +182,7 @@ class RangeSlider: NSControl, FXUnitStateObserver { private let sliderHeight: CGFloat = 7 private let minSliderX: CGFloat = 0 - private var maxSliderX: CGFloat { return NSWidth(bounds) - sliderWidth - barTrailingMargin } + private var maxSliderX: CGFloat { return bounds.width - sliderWidth - barTrailingMargin } //MARK: - Event - @@ -276,7 +226,7 @@ class RangeSlider: NSControl, FXUnitStateObserver { guard currentSliderDragging != nil else {return} - var x = Double(point.x / NSWidth(bounds)) + var x = Double(point.x / bounds.width) x = max(min(1.0, x), 0.0) if currentSliderDragging! == .start { @@ -294,8 +244,8 @@ class RangeSlider: NSControl, FXUnitStateObserver { /* Floor the rect values here, rather than use NSIntegralRect etc. */ var newRect = NSMakeRect(floor(rect.origin.x), floor(rect.origin.y), - floor(rect.size.width), - floor(rect.size.height)) + floor(rect.width), + floor(rect.height)) newRect.origin.x += 0.5 newRect.origin.y += 0.5 @@ -303,20 +253,20 @@ class RangeSlider: NSControl, FXUnitStateObserver { } private func startKnobFrame() -> NSRect { - var x = max(CGFloat(selection.start) * NSWidth(bounds) - (sliderWidth / 2.0), minSliderX) + var x = max(CGFloat(selection.start) * bounds.width - (sliderWidth / 2.0), minSliderX) x = min(x, maxSliderX) - return crispLineRect(NSMakeRect(x, (NSHeight(bounds) - sliderHeight) / 2.0, sliderWidth, sliderHeight)) + return crispLineRect(NSMakeRect(x, (bounds.height - sliderHeight) / 2.0, sliderWidth, sliderHeight)) } private func endKnobFrame() -> NSRect { - let width = NSWidth(bounds) + let width = bounds.width var x = CGFloat(selection.end) * width x -= (sliderWidth / 2.0) x = min(x, maxSliderX) x = max(x, minSliderX) - return crispLineRect(NSMakeRect(x, (NSHeight(bounds) - sliderHeight) / 2.0, sliderWidth, sliderHeight)) + return crispLineRect(NSMakeRect(x, (bounds.height - sliderHeight) / 2.0, sliderWidth, sliderHeight)) } //MARK: - Layout @@ -324,9 +274,9 @@ class RangeSlider: NSControl, FXUnitStateObserver { override func layout() { super.layout() - assert(NSWidth(bounds) >= (NSHeight(bounds) * 2), "Range control expects a reasonable width to height ratio, width should be greater than twice the height at least."); - assert(NSWidth(bounds) >= (sliderWidth * 2.0), "Width must be able to accommodate two range sliders.") - assert(NSHeight(bounds) >= sliderHeight, "Expects minimum height of at least \(sliderHeight)") + assert(bounds.width >= (bounds.height * 2), "Range control expects a reasonable width to height ratio, width should be greater than twice the height at least."); + assert(bounds.width >= (sliderWidth * 2.0), "Width must be able to accommodate two range sliders.") + assert(bounds.height >= sliderHeight, "Expects minimum height of at least \(sliderHeight)") } //MARK: - Drawing - @@ -334,8 +284,8 @@ class RangeSlider: NSControl, FXUnitStateObserver { override func draw(_ dirtyRect: NSRect) { /* Setup, calculations */ - let width = NSWidth(bounds) - barTrailingMargin - let height = NSHeight(bounds) + let width = bounds.width - barTrailingMargin + let height = bounds.height let barHeight: CGFloat = 3 let barY = floor((height - barHeight) / 2.0) @@ -355,27 +305,17 @@ class RangeSlider: NSControl, FXUnitStateObserver { let startPoint = NSMakePoint(barRect.minX, barRect.centerY) let endPoint = NSMakePoint(barRect.maxX, barRect.centerY) - GraphicsUtils.drawLine(barBackgroundColor, pt1: startPoint, pt2: endPoint, width: 1) + GraphicsUtils.drawLine(barBackgroundColor, pt1: startPoint, pt2: endPoint, width: 2) /* Draw bar fill */ - if NSWidth(selectedRect) > 0.0 { - + if selectedRect.width > 0.0 { selectedPath.fill(withColor: barFillColor) - barFillStrokeColor.setStroke() } - /* Draw slider knobs */ - sliderGradient.draw(in: endSliderPath, angle: .horizontalGradientDegrees) - endSliderPath.stroke() - - sliderGradient.draw(in: startSliderPath, angle: .horizontalGradientDegrees) - startSliderPath.stroke() - - startSliderPath.fill(withColor: knobColor) + startSliderPath.fill(withColor: barFillColor) NSBezierPath.strokeRoundedRect(startSliderFrame, radius: 1, withColor: systemColorScheme.backgroundColor, lineWidth: 2) - endSliderPath.fill(withColor: knobColor) + endSliderPath.fill(withColor: barFillColor) NSBezierPath.strokeRoundedRect(endSliderFrame, radius: 1, withColor: systemColorScheme.backgroundColor, lineWidth: 2) } } - diff --git a/Source/UI/Effects/Filter/BandEditor/FilterBandSlider.swift b/Source/UI/Effects/Filter/BandEditor/FilterBandSlider.swift index 9d7312b0b..25dcb47f2 100644 --- a/Source/UI/Effects/Filter/BandEditor/FilterBandSlider.swift +++ b/Source/UI/Effects/Filter/BandEditor/FilterBandSlider.swift @@ -9,7 +9,7 @@ // import Cocoa -class FilterBandSlider: RangeSlider { +class FilterBandSlider: RangeSlider, FXUnitStateObserver { var filterType: FilterBandType = .bandStop { didSet {redraw()} @@ -43,12 +43,8 @@ class FilterBandSlider: RangeSlider { if band.type == .bandStop, !band.bypass, filterUnit.state == .active { return systemColorScheme.activeControlColor } - - return super.barBackgroundColor - } - - override var knobColor: NSColor { - barFillColor + + return systemColorScheme.inactiveControlColor } var startFrequency: Float { diff --git a/Source/UI/ModularPlayer/Player/ModularPlayer.xib b/Source/UI/ModularPlayer/Player/ModularPlayer.xib index 65e6f9835..8315caef1 100644 --- a/Source/UI/ModularPlayer/Player/ModularPlayer.xib +++ b/Source/UI/ModularPlayer/Player/ModularPlayer.xib @@ -292,11 +292,11 @@