Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename RecordView.enabled to isEnabled #10

Merged
merged 1 commit into from
Apr 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Lib/KeyHolder/RecordView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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()
}
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public protocol RecordViewDelegate: class {

// MARK: - NSResponder
override open var acceptsFirstResponder: Bool {
return enabled
return isEnabled
}

override open var canBecomeKeyView: Bool {
Expand All @@ -194,7 +194,7 @@ public protocol RecordViewDelegate: class {
}

override open func mouseDown(with theEvent: NSEvent) {
if !enabled {
if !isEnabled {
super.mouseDown(with: theEvent)
return
}
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down