From 2f331a85033c6edca8b050af6b53f0ad884a6bfc Mon Sep 17 00:00:00 2001 From: Christian Tietze Date: Wed, 7 Feb 2018 09:19:26 +0100 Subject: [PATCH] rename RecordView.enabled to isEnabled --- Lib/KeyHolder/RecordView.swift | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/KeyHolder/RecordView.swift b/Lib/KeyHolder/RecordView.swift index 0885d37..8c5afaf 100644 --- a/Lib/KeyHolder/RecordView.swift +++ b/Lib/KeyHolder/RecordView.swift @@ -49,10 +49,10 @@ public protocol RecordViewDelegate: class { open var keyCombo: KeyCombo? { didSet { needsDisplay = true } } - open var enabled = true { + open var isEnabled = true { didSet { needsDisplay = true - if !enabled { endRecording() } + if !isEnabled { endRecording() } noteFocusRingMaskChanged() } } @@ -86,7 +86,7 @@ public protocol RecordViewDelegate: class { return true } open override var focusRingMaskBounds: NSRect { - return (enabled && window?.firstResponder == self) ? bounds : NSRect.zero + return (isEnabled && window?.firstResponder == self) ? bounds : NSRect.zero } // MARK: - Initialize @@ -112,7 +112,7 @@ public protocol RecordViewDelegate: class { // MARK: - Draw open override func drawFocusRingMask() { - if enabled && window?.firstResponder == self { + if isEnabled && window?.firstResponder == self { NSBezierPath(roundedRect: bounds, xRadius: cornerRadius, yRadius: cornerRadius).fill() } } @@ -173,7 +173,7 @@ public protocol RecordViewDelegate: class { // MARK: - NSResponder override open var acceptsFirstResponder: Bool { - return enabled + return isEnabled } override open var canBecomeKeyView: Bool { @@ -194,7 +194,7 @@ public protocol RecordViewDelegate: class { } override open func mouseDown(with theEvent: NSEvent) { - if !enabled { + if !isEnabled { super.mouseDown(with: theEvent) return } @@ -212,7 +212,7 @@ public protocol RecordViewDelegate: class { } override open func performKeyEquivalent(with theEvent: NSEvent) -> Bool { - if !enabled { return false } + if !isEnabled { return false } if window?.firstResponder != self { return false } let keyCodeInt = Int(theEvent.keyCode) @@ -313,7 +313,7 @@ private extension RecordView { paragraphStyle.lineBreakMode = NSParagraphStyle.LineBreakMode.byTruncatingTail paragraphStyle.baseWritingDirection = NSWritingDirection.leftToRight let textColor: NSColor - if !enabled { + if !isEnabled { textColor = .disabledControlTextColor } else if modifiers.contains(checkModifier) { textColor = tintColor @@ -338,7 +338,7 @@ private extension RecordView { // MARK: - Recording public extension RecordView { public func beginRecording() -> Bool { - if !enabled { return false } + if !isEnabled { return false } if recording { return true } needsDisplay = true