|
@@ -78,48 +78,6 @@ class KMNotesPreferences: NSViewController {
|
|
|
super.loadView()
|
|
|
|
|
|
self._initLayoutUI()
|
|
|
-
|
|
|
-// NSUserDefaultsController *sudc = [NSUserDefaultsController sharedUserDefaultsController];
|
|
|
-
|
|
|
-// SKLineWell *lineWell = [lineWells1 objectAtIndex:0];
|
|
|
-// [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteLineWidthKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteDashPatternKey) options:nil];
|
|
|
-// [lineWell setDisplayStyle:SKLineWellDisplayStyleRectangle];
|
|
|
- self.textLineWell.lineWidth = 0
|
|
|
-//
|
|
|
-// [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteLineWidthKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteDashPatternKey) options:nil];
|
|
|
- self.circleLineWell.displayStyle = .oval
|
|
|
- self.circleLineWell.lineWidth = 2
|
|
|
-//
|
|
|
-// lineWell = [lineWells2 objectAtIndex:1];
|
|
|
-// [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteLineWidthKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteDashPatternKey) options:nil];
|
|
|
-// [lineWell setDisplayStyle:SKLineWellDisplayStyleRectangle];
|
|
|
- self.rectLineWell.displayStyle = .rectangle
|
|
|
- self.rectLineWell.lineWidth = 2
|
|
|
-//
|
|
|
-// lineWell = [lineWells1 objectAtIndex:1];
|
|
|
-// [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteLineWidthKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteDashPatternKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStartLineStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteStartLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellEndLineStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteEndLineStyleKey) options:nil];
|
|
|
- self.lineLineWell.displayStyle = .line
|
|
|
- self.lineLineWell.lineWidth = 2
|
|
|
- self.lineLineWell.endLineStyle = .openArrow
|
|
|
-//
|
|
|
-// lineWell = [lineWells1 objectAtIndex:2];
|
|
|
-// [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteLineWidthKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteLineStyleKey) options:nil];
|
|
|
-// [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteDashPatternKey) options:nil];
|
|
|
-// [lineWell setDisplayStyle:SKLineWellDisplayStyleSimpleLine];
|
|
|
- self.freehandLineWell.displayStyle = .simpleLine
|
|
|
- self.freehandLineWell.lineWidth = 2
|
|
|
-
|
|
|
// let fontWell = self.fontWell1
|
|
|
// NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:NSUnarchiveFromDataTransformerName, NSValueTransformerNameBindingOption, nil];
|
|
|
// [fontWell setHasTextColor:YES];
|
|
@@ -288,6 +246,28 @@ class KMNotesPreferences: NSViewController {
|
|
|
self.alignmentSegmentControl.selectedSegment = 2
|
|
|
}
|
|
|
|
|
|
+ self.textLineWell.displayStyle = .rectangle
|
|
|
+ self.textLineWell.lineWidth = KMPreference.shared.freeTextNoteLineWidth.cgFloat
|
|
|
+ self.textLineWell.style = CPDFBorderStyle(rawValue: KMPreference.shared.freeTextNoteLineStyle) ?? .solid
|
|
|
+ self.textLineWell.dashPattern = KMPreference.shared.freeTextNoteDashPattern as NSArray
|
|
|
+ self.lineLineWell.displayStyle = .line
|
|
|
+ self.lineLineWell.lineWidth = KMPreference.shared.lineNoteLineWidth.cgFloat
|
|
|
+ self.lineLineWell.style = CPDFBorderStyle(rawValue: KMPreference.shared.lineNoteLineStyle) ?? .solid
|
|
|
+ self.lineLineWell.dashPattern = KMPreference.shared.lineNoteDashPattern as NSArray
|
|
|
+ self.lineLineWell.startLineStyle = CPDFLineStyle(rawValue: KMPreference.shared.lineNoteStartLineStyle) ?? .none
|
|
|
+ self.lineLineWell.endLineStyle = CPDFLineStyle(rawValue: KMPreference.shared.lineNoteEndLineStyle) ?? .none
|
|
|
+ self.freehandLineWell.displayStyle = .simpleLine
|
|
|
+ self.freehandLineWell.lineWidth = KMPreference.shared.inkNoteLineWidth.cgFloat
|
|
|
+ self.freehandLineWell.style = CPDFBorderStyle(rawValue: KMPreference.shared.inkNoteLineStyle) ?? .solid
|
|
|
+ self.freehandLineWell.dashPattern = KMPreference.shared.inkNoteDashPattern as NSArray
|
|
|
+ self.circleLineWell.displayStyle = .oval
|
|
|
+ self.circleLineWell.lineWidth = KMPreference.shared.circleNoteLineWidth.cgFloat
|
|
|
+ self.circleLineWell.style = CPDFBorderStyle(rawValue: KMPreference.shared.circleNoteLineStyle) ?? .solid
|
|
|
+ self.circleLineWell.dashPattern = KMPreference.shared.circleNoteDashPattern as NSArray
|
|
|
+ self.rectLineWell.displayStyle = .rectangle
|
|
|
+ self.rectLineWell.lineWidth = KMPreference.shared.squareNoteLineWidth.cgFloat
|
|
|
+ self.rectLineWell.style = CPDFBorderStyle(rawValue: KMPreference.shared.squareNoteLineStyle) ?? .solid
|
|
|
+ self.rectLineWell.dashPattern = KMPreference.shared.squareNoteDashPattern as NSArray
|
|
|
}
|
|
|
|
|
|
private func _initActions() {
|
|
@@ -325,8 +305,16 @@ class KMNotesPreferences: NSViewController {
|
|
|
self.alignmentSegmentControl.target = self
|
|
|
self.alignmentSegmentControl.action = #selector(alignmentSegmentAction)
|
|
|
|
|
|
+ self.textLineWell.target = self
|
|
|
+ self.textLineWell.action = #selector(textLineWellAction)
|
|
|
+ self.lineLineWell.target = self
|
|
|
+ self.lineLineWell.action = #selector(lineLineWellAction)
|
|
|
+ self.freehandLineWell.target = self
|
|
|
+ self.freehandLineWell.action = #selector(freehandLineWellAction)
|
|
|
self.circleLineWell.target = self
|
|
|
self.circleLineWell.action = #selector(circleLineWellAction)
|
|
|
+ self.rectLineWell.target = self
|
|
|
+ self.rectLineWell.action = #selector(rectLineWellAction)
|
|
|
}
|
|
|
|
|
|
@objc func textColorWellAction(_ sender: NSColorWell) {
|
|
@@ -402,6 +390,43 @@ class KMNotesPreferences: NSViewController {
|
|
|
|
|
|
// MARK: - LineWell
|
|
|
|
|
|
+ @objc func textLineWellAction(_ sender: KMLineWell) {
|
|
|
+ let action = KMLineInspector.shared.currentLineChangeAction
|
|
|
+ if action == .lineWidth {
|
|
|
+ KMPreference.shared.freeTextNoteLineWidth = Float(sender.lineWidth)
|
|
|
+ } else if action == .style {
|
|
|
+ KMPreference.shared.freeTextNoteLineStyle = sender.style.rawValue
|
|
|
+ } else if action == .dashPattern {
|
|
|
+ KMPreference.shared.freeTextNoteDashPattern = sender.dashPattern as? [CGFloat] ?? []
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func lineLineWellAction(_ sender: KMLineWell) {
|
|
|
+ let action = KMLineInspector.shared.currentLineChangeAction
|
|
|
+ if action == .lineWidth {
|
|
|
+ KMPreference.shared.lineNoteLineWidth = Float(sender.lineWidth)
|
|
|
+ } else if action == .style {
|
|
|
+ KMPreference.shared.lineNoteLineStyle = sender.style.rawValue
|
|
|
+ } else if action == .dashPattern {
|
|
|
+ KMPreference.shared.lineNoteDashPattern = sender.dashPattern as? [CGFloat] ?? []
|
|
|
+ } else if action == .startLineStyle {
|
|
|
+ KMPreference.shared.lineNoteStartLineStyle = sender.startLineStyle.rawValue
|
|
|
+ } else if action == .endLineStyle {
|
|
|
+ KMPreference.shared.lineNoteEndLineStyle = sender.endLineStyle.rawValue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func freehandLineWellAction(_ sender: KMLineWell) {
|
|
|
+ let action = KMLineInspector.shared.currentLineChangeAction
|
|
|
+ if action == .lineWidth {
|
|
|
+ KMPreference.shared.inkNoteLineWidth = Float(sender.lineWidth)
|
|
|
+ } else if action == .style {
|
|
|
+ KMPreference.shared.inkNoteLineStyle = sender.style.rawValue
|
|
|
+ } else if action == .dashPattern {
|
|
|
+ KMPreference.shared.inkNoteDashPattern = sender.dashPattern as? [CGFloat] ?? []
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@objc func circleLineWellAction(_ sender: KMLineWell) {
|
|
|
// KMPreference.shared.beginGrouping()
|
|
|
// KMPreference.shared.circleNoteLineWidth = Float(sender.lineWidth)
|
|
@@ -417,6 +442,17 @@ class KMNotesPreferences: NSViewController {
|
|
|
KMPreference.shared.circleNoteDashPattern = sender.dashPattern as? [CGFloat] ?? []
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @objc func rectLineWellAction(_ sender: KMLineWell) {
|
|
|
+ let action = KMLineInspector.shared.currentLineChangeAction
|
|
|
+ if action == .lineWidth {
|
|
|
+ KMPreference.shared.squareNoteLineWidth = Float(sender.lineWidth)
|
|
|
+ } else if action == .style {
|
|
|
+ KMPreference.shared.squareNoteLineStyle = sender.style.rawValue
|
|
|
+ } else if action == .dashPattern {
|
|
|
+ KMPreference.shared.squareNoteDashPattern = sender.dashPattern as? [CGFloat] ?? []
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
extension KMNotesPreferences: KMPreferencePane {
|