Browse Source

Merge branch 'develop_PDFReaderProNew' of git.kdan.cc:Mac_PDF/PDF_Office into develop_PDFReaderProNew

# Conflicts:
#	PDF Office/PDF Master.xcodeproj/project.pbxproj
niehaoyu 1 year ago
parent
commit
3f1d4f2c3a

+ 16 - 0
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -720,6 +720,12 @@
 		9F56648A2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
 		9F56648B2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
 		9F56648C2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
+		9F69DBB22B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
+		9F69DBB32B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
+		9F69DBB42B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
+		9F69DBB52B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */; };
+		9F69DBB62B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */; };
+		9F69DBB72B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */; };
 		9F705F76291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F705F74291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift */; };
 		9F705F77291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F705F74291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift */; };
 		9F705F78291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F705F74291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift */; };
@@ -5097,6 +5103,8 @@
 		9F53D5562AD6908600CCF9D8 /* KMAnnotationLinkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationLinkViewController.swift; sourceTree = "<group>"; };
 		9F5664852988B16F00020985 /* KMTextfieldVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMTextfieldVC.swift; sourceTree = "<group>"; };
 		9F5664862988B16F00020985 /* KMTextfieldVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMTextfieldVC.xib; sourceTree = "<group>"; };
+		9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationTextWidgetOptionsViewController.swift; sourceTree = "<group>"; };
+		9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationTextWidgetOptionsViewController.xib; sourceTree = "<group>"; };
 		9F705F74291A3A84005199AD /* KMHistoryFileDeleteWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMHistoryFileDeleteWindowController.swift; sourceTree = "<group>"; };
 		9F705F75291A3A84005199AD /* KMHistoryFileDeleteWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMHistoryFileDeleteWindowController.xib; sourceTree = "<group>"; };
 		9F705F88291E576D005199AD /* KMTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMTableView.swift; sourceTree = "<group>"; };
@@ -7680,6 +7688,8 @@
 			children = (
 				9FB220F52B186C9800A5B208 /* KMAnnotationGeneralViewController.swift */,
 				9FB220F62B186C9800A5B208 /* KMAnnotationGeneralViewController.xib */,
+				9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */,
+				9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */,
 			);
 			path = FormProperties;
 			sourceTree = "<group>";
@@ -12826,6 +12836,7 @@
 				ADF1569729A62D31001D1018 /* KMLoginLeftImageView.xib in Resources */,
 				BB5DF1F42959C9F00025CDA1 /* KMHeaderFooterPropertyMainController.xib in Resources */,
 				ADD1B6DB2946BE1700C3FFF7 /* KMPrintChoosePageSizeView.xib in Resources */,
+				9F69DBB52B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */,
 				9F0CB4AA296CF19600007028 /* KMPropertiesPanelListMenuSubVC.xib in Resources */,
 				ADE8BC3329F9261900570F89 /* KMSearchCellView.xib in Resources */,
 				AD3AAD492B0B7B8900DE5FE7 /* KMCompareToolbar.xib in Resources */,
@@ -13099,6 +13110,7 @@
 				9FD0FA3529CD947000F2AB0D /* KMOpacityPanel.xib in Resources */,
 				BB5DF1F52959C9F00025CDA1 /* KMHeaderFooterPropertyMainController.xib in Resources */,
 				9FBC48BC299B44C600CA39D7 /* KMSecondaryViewController.xib in Resources */,
+				9F69DBB62B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */,
 				BBAC26A92AFE138800563A08 /* KMToolbarItemPopViewController.xib in Resources */,
 				9F94747C29FA22700042F949 /* InfoPlist.strings in Resources */,
 				AD2D74B129F0CEB300EDC5E4 /* KMCancellationWindowController.xib in Resources */,
@@ -13781,6 +13793,7 @@
 				AD1D48542AFB8510007AC1F0 /* KMMergeTableViewCell.xib in Resources */,
 				BB4F7E932B0C80000077EC8C /* KMNoteColorCollectionViewItem.xib in Resources */,
 				9FF816E32AFA5BA80087EFC5 /* KMAnnotationTableViewController.xib in Resources */,
+				9F69DBB72B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib in Resources */,
 				BB99ACC7292DE22E0048AFD9 /* KMMergeViewController.xib in Resources */,
 				AD867F8D29D950B400F00440 /* KMBOTAOutlineView.xib in Resources */,
 				9F1F82CF292F6CF90092C4B4 /* KMPDFInsertPageWindow.xib in Resources */,
@@ -14066,6 +14079,7 @@
 				BBEC00A8295BDECF00A26C98 /* KMHeaderFooterContentInfoView.swift in Sources */,
 				9FDD0F6F294AD13C000C4DAD /* KMMainViewController+Action.swift in Sources */,
 				BB67EE1D2B54FFEF00573BF0 /* ASIFormDataRequest.m in Sources */,
+				9F69DBB22B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */,
 				ADDF839B2B391A5D00A81A4E /* PDFCertExportAccessoryView.swift in Sources */,
 				9F0CB4E52986557F00007028 /* KMDesignToken+PaddingRight.swift in Sources */,
 				BB86C1ED28F544F4005AD968 /* CPDFListView+Event.m in Sources */,
@@ -15108,6 +15122,7 @@
 				89D9896D28FD50EF003A3E87 /* KMAnnotationCollectionViewItem.swift in Sources */,
 				BB146FDF299DC0D100784A6A /* GTLRDriveObjects.m in Sources */,
 				9F0CB5122986565700007028 /* KMDesignToken+BorderRadius.swift in Sources */,
+				9F69DBB32B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */,
 				BBF811E12B07178F0074874F /* KMExtractImageWindowController.swift in Sources */,
 				BB86C1EE28F544F4005AD968 /* CPDFListView+Event.m in Sources */,
 				BBF245592AE78D0300037D08 /* KMBatchOperateWindowController.swift in Sources */,
@@ -16448,6 +16463,7 @@
 				BB74DA792AC41182006EDFE7 /* NSFont+KMExtension.swift in Sources */,
 				BB493F972B3E9805003E6175 /* KMBatchQuickActionManager.swift in Sources */,
 				BB49ECF3293F40F500C82CA2 /* KMConvertPageRangeSettingItemView.swift in Sources */,
+				9F69DBB42B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */,
 				BBFEF7212B3A787900C28AC0 /* KMSystemAnnotationMenu.swift in Sources */,
 				9F1FE4F529406E4700E952CA /* FastResizeView.m in Sources */,
 				9F1FE4FE29406E4700E952CA /* CTTabStripController.m in Sources */,

+ 30 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -49,6 +49,21 @@
                   endingLineNumber = "392"
                   offsetFromSymbolStart = "92">
                </Location>
+               <Location
+                  uuid = "B76B13E1-8734-4B17-9930-B97EF4578D2C - cd68228e7bcaf385"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "__51-[VerificationManager verificationWithComplention:]_block_invoke_3"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "392"
+                  endingLineNumber = "392"
+                  offsetFromSymbolStart = "120">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
@@ -97,6 +112,21 @@
                   endingLineNumber = "369"
                   offsetFromSymbolStart = "816">
                </Location>
+               <Location
+                  uuid = "5423EA5F-EE41-4612-B7F2-9CB978699CA3 - ae92948b24e149c8"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "__51-[VerificationManager verificationWithComplention:]_block_invoke"
+                  moduleName = "PDF Master"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/Purchase/DMG/Verification/VerificationManager/VerificationManager.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "369"
+                  endingLineNumber = "369"
+                  offsetFromSymbolStart = "1244">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>

+ 4 - 0
PDF Office/PDF Master/AppDelegate.swift

@@ -102,7 +102,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, iRateDelegate{
         
         DistributedNotificationCenter.default().addObserver(self, selector: #selector(_themeChanged), name: NSApplication.interfaceThemeChangedNotification, object: nil)
         
+#if VERSION_DMG
         VerificationManager.default()
+#endif
+        
+        
     }
     
     func initiRateData() {

+ 235 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationTextWidgetOptionsViewController.swift

@@ -0,0 +1,235 @@
+//
+//  KMAnnotationTextWidgetOptionsViewController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2024/1/12.
+//
+
+import Cocoa
+
+class KMAnnotationTextWidgetOptionsViewController: NSViewController {
+    private var _annotations: [CPDFTextWidgetAnnotation] = []
+    private var _formMode: CAnnotationType = .radioButton
+    var pdfView: CPDFListView?
+    var annotationModel: CPDFAnnotationModel?
+
+    @IBOutlet private var textFilledAlignmentLabel: NSTextField! // 对齐方式
+    @IBOutlet private var textFilledAlignmentPopUpBtn: KMPopUpButton!
+    @IBOutlet private var textFilledPresetValueLabel: NSTextField! // 预设值
+    @IBOutlet private var textFilledPresetValueTextField: NSTextField!
+    @IBOutlet private var textFilledAllowNewLineBtn: NSButton! // 允许换行
+    @IBOutlet private var scrollLongTextButton: NSButton!
+    @IBOutlet private var presetValueViewHeight: NSLayoutConstraint!
+    
+    private var annotation: CPDFTextWidgetAnnotation?
+    private var isFromMode: Bool = false
+    
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        DistributedNotificationCenter.default.removeObserver(self)
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        textFilledAlignmentLabel.stringValue = NSLocalizedString("Text Alignment", comment: "")
+        textFilledAlignmentLabel.textColor = KMAppearance.Layout.h1Color()
+        textFilledPresetValueLabel.stringValue = NSLocalizedString("Default Value", comment: "")
+        textFilledPresetValueLabel.textColor = KMAppearance.Layout.h1Color()
+        textFilledAllowNewLineBtn.title = NSLocalizedString("Multi-line", comment: "")
+        textFilledAlignmentPopUpBtn.removeAllItems()
+        textFilledAlignmentPopUpBtn.addItems(withTitles: [
+            NSLocalizedString("Left Alignment", comment: ""),
+            NSLocalizedString("Center", comment: ""),
+            NSLocalizedString("Right Alignment", comment: "")
+        ])
+        textFilledAlignmentPopUpBtn.type = .arrowUpDown
+        textFilledPresetValueTextField.backgroundColor = KMAppearance.Layout.l1Color()
+        textFilledAlignmentPopUpBtn.wantsLayer = true
+        textFilledPresetValueTextField.wantsLayer = true
+        textFilledAlignmentPopUpBtn.layer?.borderWidth = 1.0
+        textFilledPresetValueTextField.layer?.borderWidth = 1.0
+        textFilledAlignmentPopUpBtn.layer?.cornerRadius = 1.0
+        textFilledPresetValueTextField.layer?.cornerRadius = 1.0
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(textFilledPresetValueTextFieldDidChange), name: NSControl.textDidChangeNotification, object: textFilledPresetValueTextField)
+        
+        scrollLongTextButton.isHidden = true
+        reloadData()
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(themeChanged(_:)), name: NSNotification.Name("AppleInterfaceThemeChangedNotification"), object: nil)
+    }
+    
+    private func reloadData() {
+        if annotation != nil {
+            let annotationTextWidget = self.annotation!
+            if annotationTextWidget.stringValue != nil {
+                textFilledPresetValueTextField.stringValue = annotationTextWidget.stringValue // 预设值
+            }
+            switch annotationTextWidget.alignment {
+            case .left:
+                textFilledAlignmentPopUpBtn.selectItem(at: 0)
+            case .center:
+                textFilledAlignmentPopUpBtn.selectItem(at: 2)
+            case .right:
+                textFilledAlignmentPopUpBtn.selectItem(at: 1)
+            default:
+                break
+            }
+            textFilledAllowNewLineBtn.state = annotationTextWidget.isMultiline ? .on : .off
+        }
+    }
+    
+    private func updateAnnotation() {
+        if annotationModel?.annotation != nil {
+            for tAnnotation in annotations {
+                pdfView?.setNeedsDisplayAnnotationViewFor(tAnnotation.page)
+            }
+        }
+    }
+    
+    // MARK: Set & Get
+    
+    var formMode: CAnnotationType {
+        get {
+            return _formMode
+        }
+        set {
+            _formMode = newValue
+            
+            isFromMode = true
+            let defaults = UserDefaults.standard
+            var annotation: CPDFTextWidgetAnnotation? = nil
+            let bounds = NSMakeRect(0, 0, 60, 25)
+            
+            if formMode == .textField {
+                annotation = CPDFTextWidgetAnnotation(PDFListViewNoteWith: pdfView!.document!)
+                annotation?.alignment = NSTextAlignment(rawValue: defaults.integer(forKey: SKAnnotationTextWidgetAlignmenKey)) ?? .left
+                annotation?.stringValue = defaults.string(forKey: SKAnnotationTextStringValueKey) ?? ""
+                
+                annotation?.isMultiline = defaults.bool(forKey: SKAnnotationTextMultilineKey)
+            }
+            
+            if let annotation = annotation {
+                annotations = [annotation]
+            }
+            
+            self.annotation = annotation
+        }
+    }
+
+    var annotations: [CPDFTextWidgetAnnotation] {
+        get {
+            return _annotations
+        }
+        set {
+            _annotations = newValue
+            annotation = _annotations.first
+        }
+    }
+
+    func updateAnnotationMode() {
+        let sud = UserDefaults.standard
+        let annotation = self.annotation
+        let annotationMode = self.formMode
+        
+        if annotationMode == .textField {
+            sud.set(annotation?.alignment.rawValue, forKey: SKAnnotationTextWidgetAlignmenKey)
+            sud.set(annotation?.isMultiline, forKey: SKAnnotationTextMultilineKey)
+            sud.set(annotation?.stringValue, forKey: SKAnnotationTextStringValueKey)
+        }
+    }
+    
+    func updateViewColor() {
+        if KMAppearance.isDarkMode() {
+            textFilledAlignmentPopUpBtn.layer?.backgroundColor = NSColor(red: 57/255.0, green: 60/255.0, blue: 62/255.0, alpha: 1.0).cgColor
+            textFilledAlignmentPopUpBtn.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+            textFilledPresetValueTextField.layer?.borderColor = NSColor(red: 86/255.0, green: 88/255.0, blue: 90/255.0, alpha: 1.0).cgColor
+        } else {
+            textFilledAlignmentPopUpBtn.layer?.backgroundColor = NSColor.white.cgColor
+            textFilledAlignmentPopUpBtn.layer?.borderColor = NSColor(red: 57/255.0, green: 60/255.0, blue: 62/255.0, alpha: 1.0).cgColor
+            textFilledPresetValueTextField.layer?.borderColor = NSColor(red: 57/255.0, green: 60/255.0, blue: 62/255.0, alpha: 1.0).cgColor
+        }
+    }
+    
+    // MARK: NSButton Action
+    
+    @IBAction func textFilledAlignmentAction(_ sender: NSPopUpButton) {
+        for tAnnotation in annotations {
+            var annotationString = ""
+            if tAnnotation.stringValue.isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.stringValue.suffix(1))
+                
+                if lastString == " " {
+                    annotationString = String(tAnnotation.stringValue.prefix(tAnnotation.stringValue.count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.stringValue) "
+                }
+            }
+            
+            switch sender.indexOfSelectedItem {
+            case 0:
+                tAnnotation.alignment = NSTextAlignment.left
+            case 1:
+                tAnnotation.alignment = NSTextAlignment.center
+            case 2:
+                tAnnotation.alignment = NSTextAlignment.right
+            default:
+                break
+            }
+            
+            tAnnotation.stringValue = annotationString
+        }
+        
+        updateAnnotation()
+    }
+    
+    @IBAction func textFilledAllowNewLineAction(_ sender: NSButton) {
+        for tAnnotation in annotations {
+            var annotationString = ""
+            
+            if tAnnotation.stringValue.isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.stringValue.suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.stringValue.prefix(tAnnotation.stringValue.count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.stringValue) "
+                }
+            }
+            
+            if let textWidgetAnnotation = tAnnotation as? CPDFTextWidgetAnnotation {
+                textWidgetAnnotation.isMultiline = (sender.state == .on)
+            }
+            
+            tAnnotation.stringValue = annotationString
+        }
+        
+        updateAnnotation()
+    }
+
+    @IBAction func scrollLongTextAction(_ sender: NSButton) {
+        
+    }
+    
+    // MARK: NSNotification
+    
+    @objc func textFilledPresetValueTextFieldDidChange() {
+        for tAnnotation in self.annotations {
+            if let pdfAnnotation = tAnnotation as? CPDFTextWidgetAnnotation {
+                pdfAnnotation.stringValue = textFilledPresetValueTextField.stringValue
+            }
+        }
+        updateAnnotation()
+    }
+
+    @objc func themeChanged(_ notification: Notification) {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
+            self.updateViewColor()
+        }
+    }
+}

+ 173 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationTextWidgetOptionsViewController.xib

@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationTextWidgetOptionsViewController">
+            <connections>
+                <outlet property="presetValueViewHeight" destination="EGL-u6-blV" id="qNI-cj-nPz"/>
+                <outlet property="scrollLongTextButton" destination="iMz-lV-MGc" id="EHz-Vv-L0T"/>
+                <outlet property="textFilledAlignmentLabel" destination="BXo-bX-hUD" id="dxY-Ne-fFg"/>
+                <outlet property="textFilledAlignmentPopUpBtn" destination="lcz-Lz-CR9" id="Li6-If-Yec"/>
+                <outlet property="textFilledAllowNewLineBtn" destination="jRJ-UN-3vV" id="145-3k-oCI"/>
+                <outlet property="textFilledPresetValueLabel" destination="RhL-uO-Aps" id="1pT-ej-882"/>
+                <outlet property="textFilledPresetValueTextField" destination="Eh5-Tn-EQ7" id="KDS-g5-qiH"/>
+                <outlet property="view" destination="b9K-Gs-RGB" id="xnf-BD-b8s"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="b9K-Gs-RGB">
+            <rect key="frame" x="0.0" y="0.0" width="463" height="334"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="xhD-jO-oV2" customClass="KMClipView">
+                <rect key="frame" x="0.0" y="0.0" width="463" height="334"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <subviews>
+                    <view translatesAutoresizingMaskIntoConstraints="NO" id="bw8-vY-9AX">
+                        <rect key="frame" x="0.0" y="102" width="463" height="232"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="tqL-4p-rTu">
+                                <rect key="frame" x="16" y="163" width="431" height="49"/>
+                                <subviews>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BXo-bX-hUD">
+                                        <rect key="frame" x="-2" y="31" width="66" height="18"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="18" id="Jam-6N-V6w"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Alignment" id="xBg-ER-Fms">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lcz-Lz-CR9" customClass="KMPopUpButton">
+                                        <rect key="frame" x="-2" y="-7" width="440" height="36"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="tGW-66-njp"/>
+                                        </constraints>
+                                        <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="gWx-kM-BCb" id="b7g-LN-Sqs" customClass="KMPopUpButtonCell">
+                                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="ueO-Hc-8dA">
+                                                <items>
+                                                    <menuItem title="Item 1" state="on" id="gWx-kM-BCb"/>
+                                                    <menuItem title="Item 2" id="ED6-ED-gHy"/>
+                                                    <menuItem title="Item 3" id="1B2-IB-vof"/>
+                                                </items>
+                                            </menu>
+                                        </popUpButtonCell>
+                                        <connections>
+                                            <action selector="textFilledAlignmentAction:" target="-2" id="UFH-5z-b7X"/>
+                                        </connections>
+                                    </popUpButton>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="BXo-bX-hUD" firstAttribute="leading" secondItem="tqL-4p-rTu" secondAttribute="leading" id="EWW-Pe-u6O"/>
+                                    <constraint firstItem="lcz-Lz-CR9" firstAttribute="leading" secondItem="tqL-4p-rTu" secondAttribute="leading" constant="5" id="Qcu-rE-DeU"/>
+                                    <constraint firstItem="BXo-bX-hUD" firstAttribute="top" secondItem="tqL-4p-rTu" secondAttribute="top" id="RVD-1o-n5u"/>
+                                    <constraint firstAttribute="trailing" secondItem="lcz-Lz-CR9" secondAttribute="trailing" id="egi-pb-bpQ"/>
+                                    <constraint firstAttribute="bottom" secondItem="lcz-Lz-CR9" secondAttribute="bottom" id="pQ8-Ib-5gA"/>
+                                    <constraint firstItem="lcz-Lz-CR9" firstAttribute="top" secondItem="BXo-bX-hUD" secondAttribute="bottom" constant="7" id="q69-tK-duF"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="hQe-UV-seB">
+                                <rect key="frame" x="16" y="10" width="431" height="138"/>
+                                <subviews>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RhL-uO-Aps">
+                                        <rect key="frame" x="-2" y="111" width="425" height="24"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="Or0-mc-aRa"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Preset value" id="24R-gz-mhP">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jRJ-UN-3vV">
+                                        <rect key="frame" x="-2" y="9" width="84" height="19"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="17" id="gHX-Tv-13P"/>
+                                        </constraints>
+                                        <buttonCell key="cell" type="check" title="Multi-line" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="4Z6-Nv-vCd">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="textFilledAllowNewLineAction:" target="-2" id="O17-h5-oo8"/>
+                                        </connections>
+                                    </button>
+                                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Eh5-Tn-EQ7">
+                                        <rect key="frame" x="0.0" y="38" width="431" height="70"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="70" id="5sD-Y8-Csc"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" drawsBackground="YES" id="Bwt-mW-a5v">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iMz-lV-MGc">
+                                        <rect key="frame" x="100" y="9" width="84" height="19"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="17" id="8jd-2k-xQj"/>
+                                        </constraints>
+                                        <buttonCell key="cell" type="check" title="Multi-line" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Wb4-YR-P5x">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="scrollLongTextAction:" target="-2" id="JXl-JX-I7q"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="RhL-uO-Aps" firstAttribute="top" secondItem="hQe-UV-seB" secondAttribute="top" constant="3" id="0Fm-DU-UKV"/>
+                                    <constraint firstItem="RhL-uO-Aps" firstAttribute="leading" secondItem="hQe-UV-seB" secondAttribute="leading" id="0k7-Mf-eVt"/>
+                                    <constraint firstAttribute="height" constant="138" id="EGL-u6-blV"/>
+                                    <constraint firstItem="jRJ-UN-3vV" firstAttribute="leading" secondItem="hQe-UV-seB" secondAttribute="leading" id="FC4-GB-b60"/>
+                                    <constraint firstAttribute="trailing" secondItem="Eh5-Tn-EQ7" secondAttribute="trailing" id="H9O-1B-Y5W"/>
+                                    <constraint firstItem="iMz-lV-MGc" firstAttribute="leading" secondItem="jRJ-UN-3vV" secondAttribute="trailing" constant="20" id="HM3-aK-6VG"/>
+                                    <constraint firstAttribute="bottom" secondItem="jRJ-UN-3vV" secondAttribute="bottom" constant="10" id="PjK-Qr-ua0"/>
+                                    <constraint firstItem="jRJ-UN-3vV" firstAttribute="top" secondItem="Eh5-Tn-EQ7" secondAttribute="bottom" constant="11" id="TdB-7A-HyK"/>
+                                    <constraint firstItem="Eh5-Tn-EQ7" firstAttribute="top" secondItem="RhL-uO-Aps" secondAttribute="bottom" constant="3" id="X3o-wA-Eph"/>
+                                    <constraint firstItem="iMz-lV-MGc" firstAttribute="centerY" secondItem="jRJ-UN-3vV" secondAttribute="centerY" id="Xc9-MM-lKP"/>
+                                    <constraint firstItem="Eh5-Tn-EQ7" firstAttribute="leading" secondItem="hQe-UV-seB" secondAttribute="leading" id="YZI-gs-9Qy"/>
+                                    <constraint firstAttribute="trailing" secondItem="RhL-uO-Aps" secondAttribute="trailing" constant="10" id="dNK-3o-Xo3"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="hQe-UV-seB" firstAttribute="trailing" secondItem="tqL-4p-rTu" secondAttribute="trailing" id="8OW-S7-4yP"/>
+                            <constraint firstItem="tqL-4p-rTu" firstAttribute="leading" secondItem="bw8-vY-9AX" secondAttribute="leading" constant="16" id="HyH-cD-ORD"/>
+                            <constraint firstAttribute="bottom" secondItem="hQe-UV-seB" secondAttribute="bottom" constant="10" id="Hzh-9x-7Sj"/>
+                            <constraint firstAttribute="trailing" secondItem="tqL-4p-rTu" secondAttribute="trailing" constant="16" id="Mg3-Ul-ghD"/>
+                            <constraint firstItem="hQe-UV-seB" firstAttribute="top" secondItem="tqL-4p-rTu" secondAttribute="bottom" constant="15" id="VPa-rX-oFk"/>
+                            <constraint firstItem="tqL-4p-rTu" firstAttribute="top" secondItem="bw8-vY-9AX" secondAttribute="top" constant="20" id="a8H-1C-b1J"/>
+                            <constraint firstItem="hQe-UV-seB" firstAttribute="leading" secondItem="tqL-4p-rTu" secondAttribute="leading" id="aSe-uK-VyL"/>
+                        </constraints>
+                    </view>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="bw8-vY-9AX" firstAttribute="leading" secondItem="xhD-jO-oV2" secondAttribute="leading" id="afY-bP-6Tw"/>
+                    <constraint firstAttribute="trailing" secondItem="bw8-vY-9AX" secondAttribute="trailing" id="teF-t4-5I7"/>
+                    <constraint firstItem="bw8-vY-9AX" firstAttribute="top" secondItem="xhD-jO-oV2" secondAttribute="top" id="vKF-GV-lPk"/>
+                </constraints>
+            </clipView>
+            <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="tCo-o5-3HX">
+                <rect key="frame" x="-100" y="-100" width="303" height="15"/>
+                <autoresizingMask key="autoresizingMask"/>
+            </scroller>
+            <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="huO-qP-VSp">
+                <rect key="frame" x="448" y="0.0" width="15" height="187"/>
+                <autoresizingMask key="autoresizingMask"/>
+            </scroller>
+            <point key="canvasLocation" x="-119.5" y="83"/>
+        </scrollView>
+    </objects>
+</document>

+ 163 - 68
PDF Office/PDF Master/Class/Preference/Controller/KMNotesPreferences.swift

@@ -9,20 +9,6 @@ import Cocoa
 
 class KMNotesPreferences: NSViewController {
 
-   /*
-    @interface SKNotesPreferences : NSViewController <SKPreferencePane> {
-        NSArray *labels1;
-        NSArray *colorLabels2;
-        NSArray *colorLabels3;
-        NSArray *lineLabels2;
-        NSArray *colorWells1;
-        NSArray *colorWells2;
-        NSArray *colorWells3;
-    //    NSArray *fontWells;
-        NSArray *lineWells1;
-        NSArray *lineWells2;
-    }
-    */
     @IBOutlet weak var noteLabel: NSTextField!
     
     @IBOutlet weak var textLabel: NSTextField!
@@ -63,7 +49,6 @@ class KMNotesPreferences: NSViewController {
     @IBOutlet weak var anchoredFontLabel: NSTextField!
     @IBOutlet weak var alignmentSegmentControl: NSSegmentedControl!
     
-    
     @IBOutlet weak var lineAndBorderLabel: NSTextField!
     @IBOutlet weak var lbTextLabel: NSTextField!
     @IBOutlet weak var textLineWell: KMLineWell!
@@ -92,12 +77,72 @@ class KMNotesPreferences: NSViewController {
     override func loadView() {
         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 = [lineWells2 objectAtIndex: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];
+//        [lineWell setDisplayStyle:SKLineWellDisplayStyleOval];
+        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];
+//        [fontWell bind:@"textColor" toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteFontColorKey) options:options];
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        self._initStrings()
+        self._initValues()
+        self._initActions()
+    }
+    
+    private func _initLayoutUI() {
         var controls: [NSControl] = []
         var dw: CGFloat = 0
         var dw1: CGFloat = 0
         var dw2: CGFloat = 0
         
-        for view in [self.highlightColorWell, self.underlineColorWell, self.strikeThroughColorWell, self.freehandLineWell] {
+        for view in [self.highlightColorWell, self.underlineColorWell, self.strikeThroughColorWell, self.freehandColorWell] {
             if let data = view {
                 controls.append(data)
             }
@@ -129,7 +174,7 @@ class KMNotesPreferences: NSViewController {
         }
         dw += KMAutoSizeLabelFields(colorLabels2, controls, false)
         
-        for view in [self.textLineWell, self.anchoredColorWell, self.lineLineWell, self.lineInteriorColorWell] {
+        for view in [self.textColorWell, self.anchoredColorWell, self.lineColorWell, self.lineInteriorColorWell] {
             if let data = view {
                 controls.append(data)
             }
@@ -176,59 +221,9 @@ class KMNotesPreferences: NSViewController {
         KMShiftAndResizeViews([self.fontWell1, self.fontWell2], dx: 0.0, dw: dw - dw1)
         KMShiftAndResizeViews([self.ibCircleLabel, self.ibRectLabel, self.circleLineWell, self.rectLineWell], dx: dw - dw2, dw: 0.0)
         KMShiftAndResizeView(self.view, dx: 0.0, dw: dw)
-        
-//        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 = [lineWells2 objectAtIndex: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];
-//        [lineWell setDisplayStyle:SKLineWellDisplayStyleOval];
-        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];
-//        [fontWell bind:@"textColor" toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteFontColorKey) options:options];
     }
     
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
+    private func _initStrings() {
         self.noteLabel.stringValue = NSLocalizedString("Note colors:", comment: "")
         self.textLabel.stringValue = NSLocalizedString("Text:", comment: "")
         self.anchoredLabel.stringValue = NSLocalizedString("Anchored:", comment: "")
@@ -254,6 +249,106 @@ class KMNotesPreferences: NSViewController {
         self.ibCircleLabel.stringValue = NSLocalizedString("Circle:", comment: "")
         self.ibRectLabel.stringValue = NSLocalizedString("Rect:", comment: "")
     }
+    
+    private func _initValues() {
+        self.textColorWell.color = KMPreference.shared.markupTextColor
+        self.anchoredColorWell.color = KMPreference.shared.markupNoteColor
+        self.lineColorWell.color = KMPreference.shared.markupLineColor
+//        self.lineInteriorColorWell.color = KMPreference.shared.markupLineColor
+        
+        self.circleColorWell.color = KMPreference.shared.markupCircleBorderColor
+        self.circleInteriorColorWell.color = KMPreference.shared.markupCircleFillColor
+        self.rectColorWell.color = KMPreference.shared.markupRectangleBorderColor
+        self.rectInteriorColorWell.color = KMPreference.shared.markupRectangleFillColor
+        
+        self.highlightColorWell.color = KMPreference.shared.markupHighlightColor
+        self.underlineColorWell.color = KMPreference.shared.markupUnderlineColor
+        self.strikeThroughColorWell.color = KMPreference.shared.markupStrikthroughColor
+        self.freehandColorWell.color = KMPreference.shared.markupPenColor
+        
+        // SKFreeTextNoteFontNameKey
+        // SKFreeTextNoteFontSizeKey
+        // SKFreeTextNoteAlignmentKey
+        // SKAnchoredNoteFontNameKey
+        // SKAnchoredNoteFontSizeKey
+    }
+    
+    private func _initActions() {
+        self.textColorWell.target = self
+        self.textColorWell.action = #selector(textColorWellAction)
+        self.anchoredColorWell.target = self
+        self.anchoredColorWell.action = #selector(anchoredColorWellAction)
+        self.lineColorWell.target = self
+        self.lineColorWell.action = #selector(lineColorWellAction)
+        self.lineInteriorColorWell.target = self
+        self.lineInteriorColorWell.action = #selector(lineInteriorColorWellAction)
+        
+        self.circleColorWell.target = self
+        self.circleColorWell.action = #selector(circleColorWellAction)
+        self.circleInteriorColorWell.target = self
+        self.circleInteriorColorWell.action = #selector(circleInteriorColorWellAction)
+        self.rectColorWell.target = self
+        self.rectColorWell.action = #selector(rectColorWellAction)
+        self.rectInteriorColorWell.target = self
+        self.rectInteriorColorWell.action = #selector(rectInteriorColorWellAction)
+        
+        self.highlightColorWell.target = self
+        self.highlightColorWell.action = #selector(highlightColorWellAction)
+        self.underlineColorWell.target = self
+        self.underlineColorWell.action = #selector(underlineColorWellAction)
+        self.strikeThroughColorWell.target = self
+        self.strikeThroughColorWell.action = #selector(strikeThroughColorWellAction)
+        self.freehandColorWell.target = self
+        self.freehandColorWell.action = #selector(freehandColorWellAction)
+    }
+    
+    @objc func textColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupTextColor = sender.color
+    }
+    
+    @objc func anchoredColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupNoteColor = sender.color
+    }
+    
+    @objc func lineColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupLineColor = sender.color
+    }
+    
+    @objc func lineInteriorColorWellAction(_ sender: NSColorWell) {
+//        KMPreference.shared.markupLineColor = sender.color
+    }
+    
+    @objc func circleColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupCircleBorderColor = sender.color
+    }
+    
+    @objc func circleInteriorColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupCircleFillColor = sender.color
+    }
+    
+    @objc func rectColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupRectangleBorderColor = sender.color
+    }
+    
+    @objc func rectInteriorColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupRectangleFillColor = sender.color
+    }
+    
+    @objc func highlightColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupHighlightColor = sender.color
+    }
+    
+    @objc func underlineColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupUnderlineColor = sender.color
+    }
+    
+    @objc func strikeThroughColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupStrikthroughColor = sender.color
+    }
+    
+    @objc func freehandColorWellAction(_ sender: NSColorWell) {
+        KMPreference.shared.markupPenColor = sender.color
+    }
 }
 
 extension KMNotesPreferences: KMPreferencePane {