Explorar o código

【注释】Form表单属性面板KMAnnotationButtonWidgetAppearanceViewController补充

wanjun hai 1 ano
pai
achega
f3834e9a61

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

@@ -0,0 +1,663 @@
+//
+//  KMAnnotationButtonWidgetAppearanceViewController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2024/1/15.
+//
+
+import Cocoa
+
+class KMAnnotationButtonWidgetAppearanceViewController: NSViewController {
+
+    private var _annotations: [CPDFButtonWidgetAnnotation] = []
+    private var _formMode: CAnnotationType = .radioButton
+    var pdfView: CPDFListView?
+    var annotationModel: CPDFAnnotationModel?
+    
+    @IBOutlet private var backgroundColorLabel: NSTextField!
+    @IBOutlet private var backgroundColorPickerView: KMColorPickerView!
+    @IBOutlet private var appearanceAddTextBtn: NSButton!
+    @IBOutlet private var appearanceFontLabel: NSTextField!
+    @IBOutlet private var fontPopUpButton: KMPopUpButton!
+    @IBOutlet private var fontStylePopUpButton: KMPopUpButton!
+    @IBOutlet private var fontSizeComboBox: KMComboBox!
+    @IBOutlet private var fontButton: NSButton!
+    @IBOutlet private var fontView: NSView!
+    @IBOutlet private var textColorPickerView: KMColorPickerView!
+    private var annotation: CPDFButtonWidgetAnnotation?
+    private var isFromMode: Bool = false
+    private var annotationFreeText: CPDFFreeTextAnnotation?
+    private var annotationFont: NSFont?
+
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        annotation = nil
+        annotationFreeText = nil
+        annotationFont = nil
+        backgroundColorPickerView.action = nil
+        backgroundColorPickerView.target = nil
+        textColorPickerView.action = nil
+        textColorPickerView.target = nil
+        NSFontManager.shared.target = nil
+    }
+    
+    override func loadView() {
+        super.loadView()
+        
+        backgroundColorLabel.stringValue = NSLocalizedString("Colors", comment: "")
+        backgroundColorLabel.textColor = KMAppearance.Layout.h0Color()
+        appearanceAddTextBtn.title = NSLocalizedString("Add Text", comment: "")
+        
+        appearanceFontLabel.stringValue = NSLocalizedString("Fonts", comment: "")
+        appearanceFontLabel.textColor = KMAppearance.Layout.h0Color()
+        
+        backgroundColorPickerView.noContentString = true
+        backgroundColorPickerView.annotationTypeString = NSLocalizedString("Background Color", comment: "")
+        backgroundColorPickerView.annotationType = .fromFillColors
+        backgroundColorPickerView.isCallColorPanelAction = true
+        
+        textColorPickerView.noContentString = true
+        textColorPickerView.annotationTypeString = NSLocalizedString("Text Color", comment: "")
+        textColorPickerView.annotationType = .fromColors
+        textColorPickerView.isCallColorPanelAction = true
+
+        fontStylePopUpButton.type = .arrowDown
+        fontSizeComboBox.type = .none
+        fontSizeComboBox.comboxRect = fontSizeComboBox.bounds
+        fontPopUpButton.type = .arrowUpDown
+        
+        [fontPopUpButton, fontStylePopUpButton, fontSizeComboBox].forEach { view in
+            view?.wantsLayer = true
+            view?.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            view?.layer?.borderWidth = 1.0
+            view?.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+            view?.layer?.cornerRadius = 1.0
+        }
+        
+        var fieldString = annotation?.fieldName
+        if annotation?.controlType() == .radioButtonControl, #available(macOS 10.13, *) {
+            fieldString = annotation!.buttonWidgetStateString
+        }
+        
+        if pdfView?.currentPage() != nil {
+            let currentPage: CPDFPage = (pdfView?.currentPage())!
+            if currentPage.annotations != nil {
+                for annotation in currentPage.annotations {
+                    let annotationField = "\(fieldString)_AddText"
+                    
+                    if let freeTextAnnotation = annotation as? CPDFFreeTextAnnotation,
+                       freeTextAnnotation.userName() == annotationField {
+                        self.annotationFreeText = freeTextAnnotation
+                        appearanceAddTextBtn.state = .on
+                        fontView.isHidden = false
+                    } else {
+                        appearanceAddTextBtn.state = .off
+                        fontView.isHidden = true
+                    }
+                }
+            }
+        }
+        
+        if annotationFreeText == nil {
+            annotationFreeText = CPDFFreeTextAnnotation(PDFListViewNoteWith: pdfView!.document!)
+            annotationFreeText?.setUserName("\(annotation!.fieldName)_AddText")
+            
+            let defaults = UserDefaults.standard
+            var formFont: NSFont? = nil
+            var formColor: NSColor = NSColor.black
+            
+            if formMode == .radioButton {
+                formFont = defaults.font(forNameKey: SKAnnotationRadioButtonWidgetFontNameKey,
+                                         sizeKey: SKAnnotationRadioButtonWidgetFontSizeKey)
+                formColor = defaults.color(forKey: SKAnnotationRadioButtonWidgetFontColorKey) ?? NSColor.black
+            } else if formMode == .checkBox {
+                formFont = defaults.font(forNameKey: SKAnnotationCheckBoxWidgetFontNameKey,
+                                         sizeKey: SKAnnotationCheckBoxWidgetFontSizeKey)
+                formColor = defaults.color(forKey: SKAnnotationCheckBoxWidgetFontColorKey) ?? NSColor.black
+            } else {
+                formFont = NSFont.systemFont(ofSize: 9.0)
+            }
+            
+            if formFont == nil {
+                formFont = NSFont.systemFont(ofSize: 12.0)
+            }
+            
+            annotationFreeText?.font = formFont!
+            annotationFreeText?.fontColor = formColor
+            annotationFreeText?.contents = NSLocalizedString("Text", comment: "")
+        }
+        
+        reloadData()
+    }
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+
+        let showConvertDetails = KMPropertiesViewPopController.showChangeColorDetails()
+        if showConvertDetails, self.view.window?.windowController?.document?.fileURL != nil {
+            KMPropertiesViewPopController.defaultManager().showChangeColorDetailsView(self.textColorPickerView.firstButton)
+        }
+    }
+    
+    func reloadData() {
+        var opacity: CGFloat = 1
+        if let color = annotation!.backgroundColor {
+            color.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+        }
+
+        annotationFont = annotation?.font
+        if let buttonWidget = annotation {
+            backgroundColorPickerView.color = buttonWidget.backgroundColor
+        }
+        
+        let fontManager = NSFontManager.shared
+        fontManager.target = self
+        fontManager.action = #selector(changeFont(_:))
+
+        if annotations.count > 1 {
+            appearanceAddTextBtn.isEnabled = false
+        }
+
+        if let annotationFreeText = annotationFreeText {
+            if let fontColor = annotationFreeText.fontColor {
+                textColorPickerView.color = fontColor
+            }
+
+            fontSizeComboBox.stringValue = "\(annotationFreeText.font.pointSize) pt"
+            DispatchQueue.global(qos: .default).async {
+                let fonts = NSFontManager.shared.availableFontFamilies
+                var selectedIndex = 0
+                let family = annotationFreeText.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String
+                let style = annotationFreeText.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String
+
+                var menuItems: [NSMenuItem] = []
+
+                for (index, fontName) in fonts.enumerated() {
+                    if let font = NSFont(name: fontName, size: 12.0) {
+                        let attrited = [NSAttributedString.Key.font: font]
+                        let string = NSAttributedString(string: fontName, attributes: attrited)
+                        let item = NSMenuItem()
+                        item.attributedTitle = string
+                        menuItems.append(item)
+
+                        if annotationFreeText.font.fontName == font.fontName {
+                            selectedIndex = index
+                        }
+                    }
+                }
+
+                DispatchQueue.main.async { [self] in
+                    fontPopUpButton.menu?.items = menuItems
+                    fontPopUpButton.selectItem(at: selectedIndex)
+                    let selectedStyleIndex = setFontStyle(fontName: family!, currentStyle: style)
+                    fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
+                }
+            }
+        }
+
+        let userDefaults = UserDefaults.standard
+        if appearanceAddTextBtn.state == .on {
+            switch self.formMode {
+            case .radioButton:
+                userDefaults.set(true, forKey: SKAnnotationRadioButtonWidgetAddTextKey)
+            case .checkBox:
+                userDefaults.set(true, forKey: SKAnnotationCheckBoxWidgetAddTextKey)
+            default:
+                break
+            }
+        } else {
+            switch self.formMode {
+            case .radioButton:
+                userDefaults.set(false, forKey: SKAnnotationRadioButtonWidgetAddTextKey)
+            case .checkBox:
+                userDefaults.set(false, forKey: SKAnnotationCheckBoxWidgetAddTextKey)
+            default:
+                break
+            }
+        }
+    }
+    
+    // MARK: Set & Get
+    var formMode: CAnnotationType {
+        get {
+            return _formMode
+        }
+        set {
+            _formMode = newValue
+            
+            isFromMode = true
+            
+            let defaults = UserDefaults.standard
+            var annotation: CPDFButtonWidgetAnnotation?
+            let bounds = NSMakeRect(0, 0, 60, 25)
+            var backgroundColor: NSColor?
+
+            if formMode == .checkBox {
+                annotation = CPDFButtonWidgetAnnotation(PDFListViewNoteWith: pdfView!.document!)
+                backgroundColor = defaults.color(forKey: SKAnnotationCheckBoxWidgetBackgroundColorKey)
+            } else if formMode == .radioButton {
+                annotation = CPDFButtonWidgetAnnotation(PDFListViewNoteWith: pdfView!.document!, controlType: .radioButtonControl)
+                backgroundColor = defaults.color(forKey: SKAnnotationRadioButtonWidgetBackgroundColorKey)
+            }
+
+            annotation?.backgroundColor = backgroundColor ?? NSColor.clear
+
+            if let annotation = annotation {
+                annotations = [annotation]
+            }
+            
+            self.annotation = annotation
+        }
+    }
+    
+    var annotations: [CPDFButtonWidgetAnnotation] {
+        get {
+            return _annotations
+        }
+        set {
+            _annotations = newValue
+            annotation = _annotations.first
+        }
+    }
+    
+    func updateAnnotationMode() {
+        let defaults = UserDefaults.standard
+        let annotation = self.annotation
+        let annotationMode = self.formMode
+        
+        if annotationMode == .radioButton {
+            defaults.setColor(annotation!.backgroundColor!, forKey: SKAnnotationRadioButtonWidgetBackgroundColorKey)
+        } else if annotationMode == .checkBox {
+            defaults.setColor(annotation!.backgroundColor!, forKey: SKAnnotationCheckBoxWidgetBackgroundColorKey)
+        }
+    }
+
+    // MARK: Private Method
+    
+    func setFontStyle(fontName: String, currentStyle style: String?) -> UInt {
+        var selectIndex: UInt = 0
+        let menu = NSMenu()
+        if let fontFamily = NSFontManager.shared.availableMembers(ofFontFamily: fontName) {
+            for (index, array) in fontFamily.enumerated() {
+                let styleName = array[1] as! String
+                if style == styleName {
+                    selectIndex = UInt(index)
+                }
+                
+                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [
+                    NSFontDescriptor.AttributeName.family: fontName,
+                    NSFontDescriptor.AttributeName.face: styleName
+                ])
+                if let font = NSFont(descriptor: attributeFontDescriptor, size: 12.0) {
+                    let attrited: [NSAttributedString.Key: Any] = [NSAttributedString.Key.font: font]
+                    let string = NSAttributedString(string: styleName, attributes: attrited)
+                    let item = NSMenuItem()
+                    item.attributedTitle = string
+                    menu.addItem(item)
+                }
+            }
+        }
+        
+        if style == nil {
+            selectIndex = 0
+        }
+        
+        fontStylePopUpButton.menu = menu
+        
+        return selectIndex
+    }
+
+    func colorWithCGColor(_ CGColor: CGColor?) -> NSColor? {
+        guard let cgColor = CGColor else { return nil }
+        return NSColor(cgColor: cgColor)
+    }
+    
+    private func updateAnnotation() {
+        if annotationModel?.annotation != nil {
+            for tAnnotation in annotations {
+                pdfView?.setNeedsDisplayAnnotationViewFor(tAnnotation.page)
+            }
+        }
+    }
+    
+    // MARK: UI Action
+    
+    @IBAction func backgroundColorViewAction(_ sender: Any) {
+        for tAnnotation in annotations {
+            tAnnotation.updateAppearanceStream()
+            tAnnotation.backgroundColor = backgroundColorPickerView.color
+        }
+        updateAnnotation()
+    }
+
+    @IBAction func textColorPickerViewAction(_ sender: Any) {
+        if self.annotationFreeText == nil {
+            var fieldString = annotation!.fieldName
+            if annotation?.controlType() == .radioButtonControl,
+               #available(macOS 10.13, *) {
+                fieldString = annotation!.buttonWidgetStateString
+            }
+            
+            if let page = annotation?.page {
+                for annotation in page.annotations {
+                    let annotationField = "\(fieldString)_AddText"
+                    if let freeTextAnnotation = annotation as? CPDFFreeTextAnnotation,
+                       freeTextAnnotation.userName() == annotationField {
+                        self.annotationFreeText = freeTextAnnotation
+                    }
+                }
+            }
+        }
+        
+        let userDefaults = UserDefaults.standard
+        if formMode == .radioButton {
+            userDefaults.setColor(textColorPickerView.color!, forKey: SKAnnotationRadioButtonWidgetFontColorKey)
+        } else if formMode == .checkBox {
+            userDefaults.setColor(textColorPickerView.color!, forKey: SKAnnotationCheckBoxWidgetFontColorKey)
+        }
+        self.annotationFreeText?.fontColor = self.textColorPickerView.color
+        updateAnnotation()
+    }
+    
+    @IBAction func addTextButtonAction(_ sender: NSButton) {
+        guard let PDFView = pdfView else { return }
+        
+        let sud = UserDefaults.standard
+        
+        if sender.state == .on {
+            self.fontView.isHidden = false
+            
+            if !annotation!.fieldName().hasPrefix("button") {
+                var fieldString = annotation!.fieldName
+                if annotation!.controlType() == .radioButtonControl, #available(macOS 10.13, *) {
+                    fieldString = annotation!.buttonWidgetStateString
+                }
+                
+                let annotationField = "\(fieldString)_AddText"
+//                if PDFView.addWidgetRelatedAnnotationFreeText(annotationField) {
+//                    reloadData()
+//                    
+//                    for annotation in PDFView.currentSelectionPage().annotations {
+//                        if let freeTextAnnotation = annotation as? CPDFFreeTextAnnotation,
+//                           annotationField == freeTextAnnotation.userName() {
+//                            self.annotationFreeText = freeTextAnnotation
+//                            break
+//                        }
+//                    }
+//                }
+            }
+            
+            let annotationMode = self.formMode
+            var formFontColor: NSColor = .black
+            var formFontSize: CGFloat = 9.0
+            var formFontName: String? = nil
+            
+            if annotationMode == .radioButton {
+                formFontColor = sud.color(forKey: SKAnnotationRadioButtonWidgetFontColorKey) ?? .black
+                formFontSize = CGFloat(sud.float(forKey: SKAnnotationRadioButtonWidgetFontSizeKey))
+                formFontName = sud.string(forKey: SKAnnotationRadioButtonWidgetFontNameKey)
+            } else if annotationMode == .checkBox {
+                formFontColor = sud.color(forKey: SKAnnotationCheckBoxWidgetFontColorKey) ?? .black
+                formFontSize = CGFloat(sud.float(forKey: SKAnnotationCheckBoxWidgetFontSizeKey))
+                formFontName = sud.string(forKey: SKAnnotationCheckBoxWidgetFontNameKey)
+            }
+            
+            if formFontColor == nil {
+                formFontColor = .black
+            }
+            
+            textColorPickerView.color = formFontColor
+            
+            if formFontSize == 0.0 {
+                formFontSize = 9.0
+            }
+            
+            DispatchQueue.global(qos: .default).async {
+                let fonts = NSFontManager.shared.availableFontFamilies
+                let menu = NSMenu()
+                var selectedIndex = 0
+                
+                if let family = self.annotationFreeText?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String,
+                   let style = self.annotationFreeText?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String {
+                    
+                    for (index, fontName) in fonts.enumerated() {
+                        if let font = NSFont(name: fontName, size: 12.0) {
+                            let attributes: [NSAttributedString.Key: Any] = [.font: font]
+                            let string = NSAttributedString(string: fontName, attributes: attributes)
+                            
+                            let item = NSMenuItem()
+                            item.attributedTitle = string
+                            menu.addItem(item)
+                            
+                            if formFontName == font.fontName {
+                                selectedIndex = index
+                            }
+                        }
+                    }
+                }
+                
+                DispatchQueue.main.async {
+                    self.fontPopUpButton.menu = menu
+                    self.fontPopUpButton.selectItem(at: selectedIndex)
+                    
+                    if let family = self.annotationFreeText?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String,
+                       let style = self.annotationFreeText?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String {
+                        let selectedStyleIndex = self.setFontStyle(fontName: family, currentStyle: style)
+                        self.fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
+                    }
+                }
+            }
+            
+            if annotationMode == .radioButton {
+                sud.set(true, forKey: SKAnnotationRadioButtonWidgetAddTextKey)
+            } else if annotationMode == .checkBox {
+                sud.set(true, forKey: SKAnnotationCheckBoxWidgetAddTextKey)
+            }
+        } else {
+            fontView.isHidden = true
+            
+            var fieldString = annotation!.fieldName
+            if annotation?.controlType() == .radioButtonControl, #available(macOS 10.13, *) {
+                fieldString = annotation!.buttonWidgetStateString
+            }
+            
+            let annotationField = "\(fieldString)_AddText"
+//            PDFView.removeWidgetRelatedAnnotationFreeText(annotationField)
+            
+            let annotationMode = self.formMode
+            if annotationMode == .radioButton {
+                sud.set(false, forKey: SKAnnotationRadioButtonWidgetAddTextKey)
+            } else if annotationMode == .checkBox {
+                sud.set(false, forKey: SKAnnotationCheckBoxWidgetAddTextKey)
+            }
+        }
+    }
+    
+    @IBAction func fontPopUpButtonAction(_ sender: NSPopUpButton) {
+        guard let familyString = fontPopUpButton.selectedItem?.attributedTitle?.string else {
+            return
+        }
+        
+        let selectIndex = setFontStyle(fontName: familyString, currentStyle: nil)
+        if let styleString = fontStylePopUpButton.selectedItem?.title {
+            fontStylePopUpButton.selectItem(at: Int(selectIndex))
+            
+            if annotationFreeText == nil {
+                if let page = annotation?.page {
+                    var fieldString = annotation!.fieldName
+                    if annotation?.controlType() == .radioButtonControl,
+                        #available(macOS 10.13, *) {
+                        fieldString = annotation!.buttonWidgetStateString
+                    }
+                    for tAnnotation in page.annotations {
+                        let annotationField = "\(fieldString)_AddText"
+                        if let tAnnotation = tAnnotation as? CPDFFreeTextAnnotation,
+                           tAnnotation.userName() == annotationField {
+                            annotationFreeText = tAnnotation
+                            break
+                        }
+                    }
+                }
+            }
+            
+            let userDefaults = UserDefaults.standard
+            if formMode == .radioButton {
+                userDefaults.set(familyString, forKey: SKAnnotationRadioButtonWidgetFontNameKey)
+            } else if formMode == .checkBox {
+                userDefaults.set(familyString, forKey: SKAnnotationCheckBoxWidgetFontNameKey)
+            }
+            
+            if let fontSize = annotationFreeText!.font!.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.size) as? NSNumber {
+                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [
+                    NSFontDescriptor.AttributeName.family: familyString,
+                    NSFontDescriptor.AttributeName.face: styleString
+                ])
+                if let font = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize.floatValue)) {
+                    annotationFreeText?.font = font
+                }
+            }
+            
+            updateAnnotation()
+        }
+    }
+    
+    @IBAction func fontSizeComboBox(_ sender: NSComboBox) {
+        if annotationFreeText == nil {
+            var fieldString = annotation!.fieldName
+            if annotation?.controlType() == .radioButtonControl,
+               #available(macOS 10.13, *) {
+                fieldString = annotation!.buttonWidgetStateString
+            }
+            
+            if let page = annotation?.page {
+                for tAnnotation in page.annotations {
+                    let annotationField = "\(fieldString)_AddText"
+                    if let tFreeTextAnnotation = tAnnotation as? CPDFFreeTextAnnotation,
+                       tFreeTextAnnotation.userName() == annotationField {
+                        annotationFreeText = tFreeTextAnnotation
+                    }
+                }
+            }
+        }
+        
+        let userDefaults = UserDefaults.standard
+        var fontSizeKey: String = ""
+        if formMode == .radioButton {
+            fontSizeKey = SKAnnotationRadioButtonWidgetFontSizeKey
+        } else if formMode == .checkBox {
+            fontSizeKey = SKAnnotationCheckBoxWidgetFontSizeKey
+        }
+        
+        userDefaults.set(Float(sender.floatValue), forKey: fontSizeKey)
+        
+        if let font = annotationFreeText?.font {
+            let newFont = NSFont(name: font.fontName, size: CGFloat(sender.floatValue))
+            annotationFreeText?.font = newFont
+        }
+        
+        updateAnnotation()
+    }
+    
+    @IBAction func fontStylePopUpButtonAction(_ sender: NSPopUpButton) {
+        guard let styleString = self.fontStylePopUpButton.selectedItem?.title else {
+            return
+        }
+
+        if self.annotationFreeText == nil {
+            var fieldString = annotation!.fieldName
+            if self.annotation?.controlType() == .radioButtonControl, #available(macOS 10.13, *) {
+                fieldString = annotation!.buttonWidgetStateString
+            }
+
+            if let page = annotation!.page {
+                for annotation in page.annotations {
+                    let annotationField = "\(fieldString)_AddText"
+                    if let freeTextAnnotation = annotation as? CPDFFreeTextAnnotation, freeTextAnnotation.userName() == annotationField {
+                        self.annotationFreeText = freeTextAnnotation
+                        break
+                    }
+                }
+            }
+        }
+
+        if let font = self.annotationFreeText?.font,
+           let fontSize = font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.size),
+           let familyString = font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) {
+            let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: familyString, NSFontDescriptor.AttributeName.face: styleString])
+            if let updatedFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat((fontSize as! NSString).floatValue)) {
+//                self.annotationFreeText?.removeAllAppearanceStreams()
+                self.annotationFreeText?.font = updatedFont
+            }
+        }
+        updateAnnotation()
+    }
+    
+    @IBAction func fontButtonAction(_ sender: NSButton) {
+        weak var weakSelf = self
+//        let fontWindowController = KMAnnotationFontWindowController.sharedAnnotationFont()
+//        let window = fontWindowController.window
+//        fontWindowController.annotations = [self.annotationFreeText] ?? []
+//        
+//        fontWindowController.annotationAlignCallback = { selectedCount in
+//            weakSelf?.annotationFreeText.removeAllAppearanceStreams()
+//            
+//            switch selectedCount {
+//            case 0:
+//                weakSelf?.annotationFreeText.setAlignment(.left)
+//            case 2:
+//                weakSelf?.annotationFreeText.setAlignment(.center)
+//            case 1:
+//                weakSelf?.annotationFreeText.setAlignment(.right)
+//            case 3:
+//                weakSelf?.annotationFreeText.setAlignment(.justified)
+//            default:
+//                break
+//            }
+//            
+//            weakSelf?.updateAnnotation()
+//        }
+        
+//        fontWindowController.annotationCallback = { annotation in
+//            weakSelf?.annotationFreeText.fontColor = annotation.fontColor
+//            weakSelf?.annotationFreeText.font = annotation.font
+//            weakSelf?.reloadData()
+//            weakSelf?.updateAnnotation()
+//        }
+        
+//        window?.orderFront(sender)
+    }
+    
+    @objc func changeFont(_ sender: Any) {
+        if annotationFreeText == nil {
+            var fieldString = annotation?.fieldName
+            if annotation?.controlType() == .radioButtonControl, #available(macOS 10.13, *) {
+                fieldString = annotation?.buttonWidgetStateString
+            }
+            
+            if let page = annotation?.page {
+                for pageAnnotation in page.annotations {
+                    if let freeTextAnnotation = pageAnnotation as? CPDFFreeTextAnnotation,
+                       freeTextAnnotation.userName() == "\(fieldString)_AddText" {
+                        annotationFreeText = freeTextAnnotation
+                        break
+                    }
+                }
+            }
+        }
+        
+        let userDefaults = UserDefaults.standard
+        
+        if formMode == .radioButton {
+            userDefaults.set(annotationFont?.fontName, forKey: SKAnnotationRadioButtonWidgetFontNameKey)
+            userDefaults.set(annotationFont?.pointSize, forKey: SKAnnotationRadioButtonWidgetFontSizeKey)
+        } else if formMode == .checkBox {
+            userDefaults.set(annotationFont?.fontName, forKey: SKAnnotationCheckBoxWidgetFontNameKey)
+            userDefaults.set(annotationFont?.pointSize, forKey: SKAnnotationCheckBoxWidgetFontSizeKey)
+        }
+        
+//        annotationFont = (sender as AnyObject).convert(annotationFont!)
+        annotationFreeText?.font = NSFont(name: annotationFont!.fontName, size: annotationFont!.pointSize)
+        
+        updateAnnotation()
+    }
+}

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

@@ -0,0 +1,274 @@
+<?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="KMAnnotationButtonWidgetAppearanceViewController">
+            <connections>
+                <outlet property="appearanceAddTextBtn" destination="bqR-Ix-HTJ" id="T16-AG-l3D"/>
+                <outlet property="appearanceFontLabel" destination="dPp-Rb-yWg" id="DaT-e2-r18"/>
+                <outlet property="backgroundColorLabel" destination="PBQ-Dj-b1j" id="spf-5c-kqx"/>
+                <outlet property="backgroundColorPickerView" destination="EFk-fn-6X1" id="UOD-2m-309"/>
+                <outlet property="fontButton" destination="072-BB-1SK" id="j3c-Nq-rFm"/>
+                <outlet property="fontPopUpButton" destination="EA9-AX-1Uq" id="Kh6-zr-I9K"/>
+                <outlet property="fontSizeComboBox" destination="fgb-vf-yF0" id="eI0-zH-J8u"/>
+                <outlet property="fontStylePopUpButton" destination="6Ud-Bd-kSK" id="E4t-93-vif"/>
+                <outlet property="fontView" destination="AVo-l0-xCc" id="NUh-0X-i0W"/>
+                <outlet property="textColorPickerView" destination="zu7-sx-j7d" id="doT-Mq-vms"/>
+                <outlet property="view" destination="ofS-bh-Ctt" id="35A-tj-aB5"/>
+            </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="ofS-bh-Ctt">
+            <rect key="frame" x="0.0" y="0.0" width="475" height="464"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="prV-gr-DaJ" customClass="KMClipView">
+                <rect key="frame" x="0.0" y="0.0" width="475" height="464"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <subviews>
+                    <view translatesAutoresizingMaskIntoConstraints="NO" id="q7n-Au-vJ3">
+                        <rect key="frame" x="0.0" y="166" width="475" height="298"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="0cJ-2d-rI3">
+                                <rect key="frame" x="16" y="192" width="443" height="96"/>
+                                <subviews>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PBQ-Dj-b1j">
+                                        <rect key="frame" x="-2" y="66" width="128" height="20"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="20" id="sP3-ke-gmY"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Background Color" id="Cjn-IM-XMQ">
+                                            <font key="font" metaFont="systemBold" size="14"/>
+                                            <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>
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="EFk-fn-6X1" customClass="KMColorPickerView">
+                                        <rect key="frame" x="0.0" y="24" width="443" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="32" id="cBL-YN-Z03"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="backgroundColorViewAction:" target="-2" id="Uqk-c3-JDs"/>
+                                        </connections>
+                                    </customView>
+                                    <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="hQ4-96-CKs">
+                                        <rect key="frame" x="0.0" y="5" width="443" height="5"/>
+                                    </box>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="PBQ-Dj-b1j" firstAttribute="top" secondItem="0cJ-2d-rI3" secondAttribute="top" constant="10" id="86E-ko-CUd"/>
+                                    <constraint firstItem="EFk-fn-6X1" firstAttribute="top" secondItem="PBQ-Dj-b1j" secondAttribute="bottom" constant="10" id="9le-8U-msE"/>
+                                    <constraint firstAttribute="bottom" secondItem="hQ4-96-CKs" secondAttribute="bottom" constant="7" id="EXy-zk-Hc2"/>
+                                    <constraint firstItem="PBQ-Dj-b1j" firstAttribute="leading" secondItem="0cJ-2d-rI3" secondAttribute="leading" id="FZd-7i-9Sa"/>
+                                    <constraint firstItem="hQ4-96-CKs" firstAttribute="top" secondItem="EFk-fn-6X1" secondAttribute="bottom" constant="16" id="QzG-CU-TLy"/>
+                                    <constraint firstItem="EFk-fn-6X1" firstAttribute="leading" secondItem="0cJ-2d-rI3" secondAttribute="leading" id="c5l-MB-VTz"/>
+                                    <constraint firstAttribute="trailing" secondItem="hQ4-96-CKs" secondAttribute="trailing" id="nPf-MG-WFP"/>
+                                    <constraint firstItem="hQ4-96-CKs" firstAttribute="leading" secondItem="0cJ-2d-rI3" secondAttribute="leading" id="oTT-0J-PBI"/>
+                                    <constraint firstAttribute="trailing" secondItem="EFk-fn-6X1" secondAttribute="trailing" id="xR7-4r-ClC"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="RbL-jd-AfR">
+                                <rect key="frame" x="16" y="168" width="443" height="17"/>
+                                <subviews>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bqR-Ix-HTJ">
+                                        <rect key="frame" x="-2" y="-1.5" width="74" height="20"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="17" id="jzL-se-DbA"/>
+                                        </constraints>
+                                        <buttonCell key="cell" type="check" title="Add text" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="XP5-mX-vWS">
+                                            <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+                                            <font key="font" metaFont="cellTitle"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="addTextButtonAction:" target="-2" id="cqE-JC-Aha"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="bqR-Ix-HTJ" firstAttribute="top" secondItem="RbL-jd-AfR" secondAttribute="top" id="S1d-Il-13I"/>
+                                    <constraint firstAttribute="bottom" secondItem="bqR-Ix-HTJ" secondAttribute="bottom" id="eYT-v2-Nz7"/>
+                                    <constraint firstItem="bqR-Ix-HTJ" firstAttribute="leading" secondItem="RbL-jd-AfR" secondAttribute="leading" id="gfd-xt-FYc"/>
+                                    <constraint firstItem="bqR-Ix-HTJ" firstAttribute="leading" secondItem="RbL-jd-AfR" secondAttribute="leading" id="slQ-6f-DVs"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="AVo-l0-xCc">
+                                <rect key="frame" x="16" y="10" width="443" height="148"/>
+                                <subviews>
+                                    <button translatesAutoresizingMaskIntoConstraints="NO" id="072-BB-1SK">
+                                        <rect key="frame" x="427" y="121" width="16" height="14"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="14" id="aFq-Wx-BLx"/>
+                                            <constraint firstAttribute="width" constant="16" id="mBk-F0-I9p"/>
+                                        </constraints>
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnFontsetNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="z0p-gn-AEq">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="fontButtonAction:" target="-2" id="QHj-oZ-KfZ"/>
+                                        </connections>
+                                    </button>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dPp-Rb-yWg">
+                                        <rect key="frame" x="-2" y="118" width="35" height="20"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="20" id="6cH-af-Lyp"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Font" id="M7B-cy-Iqr">
+                                            <font key="font" metaFont="systemBold" size="14"/>
+                                            <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="6Ud-Bd-kSK" customClass="KMPopUpButton">
+                                        <rect key="frame" x="-2" y="3" width="349" height="36"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="loq-LL-etH"/>
+                                        </constraints>
+                                        <popUpButtonCell key="cell" type="push" title="UltraLight" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" arrowPosition="noArrow" selectedItem="sd4-ps-9hd" id="wAD-Kt-rYb" customClass="KMPopUpButtonCell">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="7Qp-t0-1ed">
+                                                <items>
+                                                    <menuItem title="UltraLight" state="on" id="sd4-ps-9hd"/>
+                                                    <menuItem title="Thin" id="sbZ-Tn-Oxd"/>
+                                                    <menuItem title="Light" id="exS-kT-WeQ"/>
+                                                    <menuItem title="Regular" id="EFw-dg-NxV"/>
+                                                    <menuItem title="Medium" id="9fT-MQ-F3Q"/>
+                                                    <menuItem title="Semibold" id="u9M-Gd-6Yi"/>
+                                                    <menuItem title="Bold" id="VUe-sn-map"/>
+                                                    <menuItem title="Heavy" id="61q-4t-4b9"/>
+                                                    <menuItem title="Black" id="7b1-jG-FF2"/>
+                                                </items>
+                                            </menu>
+                                        </popUpButtonCell>
+                                        <connections>
+                                            <action selector="fontStylePopUpButtonAction:" target="-2" id="Qua-ep-9Dn"/>
+                                        </connections>
+                                    </popUpButton>
+                                    <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fgb-vf-yF0" customClass="KMComboBox">
+                                        <rect key="frame" x="347" y="10" width="96" height="23"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="92" id="lut-MM-qja"/>
+                                        </constraints>
+                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="mHY-uf-DDf" customClass="KMComboBoxCell">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <objectValues>
+                                                <string>4 pt</string>
+                                                <string>6 pt</string>
+                                                <string>8 pt</string>
+                                                <string>9 pt</string>
+                                                <string>10 pt</string>
+                                                <string>11 pt</string>
+                                                <string>12 pt</string>
+                                                <string>13 pt</string>
+                                                <string>14 pt</string>
+                                                <string>15 pt</string>
+                                                <string>16 pt</string>
+                                                <string>17 pt</string>
+                                                <string>18 pt</string>
+                                                <string>24 pt</string>
+                                                <string>36 pt</string>
+                                                <string>48 pt</string>
+                                                <string>64 pt</string>
+                                                <string>72 pt</string>
+                                                <string>98 pt</string>
+                                                <string>144 pt</string>
+                                                <string>288 pt</string>
+                                            </objectValues>
+                                        </comboBoxCell>
+                                        <connections>
+                                            <action selector="fontSizeComboBox:" target="-2" id="4Jv-Y7-VMQ"/>
+                                        </connections>
+                                    </comboBox>
+                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EA9-AX-1Uq" customClass="KMPopUpButton">
+                                        <rect key="frame" x="-2" y="35" width="452" height="36"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="c0k-2D-edV"/>
+                                        </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="Yns-VE-yf9" id="PDf-QI-VzP" customClass="KMPopUpButtonCell">
+                                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="WRU-t9-bhR">
+                                                <items>
+                                                    <menuItem title="Item 1" state="on" id="Yns-VE-yf9"/>
+                                                    <menuItem title="Item 2" id="WGg-LK-Td5"/>
+                                                    <menuItem title="Item 3" id="5hM-7e-UM8"/>
+                                                </items>
+                                            </menu>
+                                        </popUpButtonCell>
+                                        <connections>
+                                            <action selector="fontPopUpButtonAction:" target="-2" id="f8t-1t-opd"/>
+                                        </connections>
+                                    </popUpButton>
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="zu7-sx-j7d" customClass="KMColorPickerView">
+                                        <rect key="frame" x="0.0" y="76" width="443" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="32" id="7VU-fc-AUs"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="textColorPickerViewAction:" target="-2" id="T9b-g0-tvj"/>
+                                        </connections>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="6Ud-Bd-kSK" firstAttribute="leading" secondItem="AVo-l0-xCc" secondAttribute="leading" constant="5" id="8U2-m5-idS"/>
+                                    <constraint firstAttribute="trailing" secondItem="zu7-sx-j7d" secondAttribute="trailing" id="A2W-Qb-h4a"/>
+                                    <constraint firstAttribute="bottom" secondItem="6Ud-Bd-kSK" secondAttribute="bottom" constant="10" id="Ecw-Qv-xTB"/>
+                                    <constraint firstItem="EA9-AX-1Uq" firstAttribute="top" secondItem="zu7-sx-j7d" secondAttribute="bottom" constant="10" id="Fyp-WC-V4Z"/>
+                                    <constraint firstItem="fgb-vf-yF0" firstAttribute="leading" secondItem="6Ud-Bd-kSK" secondAttribute="trailing" constant="8" id="IM5-On-dqm"/>
+                                    <constraint firstAttribute="trailing" secondItem="fgb-vf-yF0" secondAttribute="trailing" constant="3" id="LaE-cv-DUq"/>
+                                    <constraint firstItem="EA9-AX-1Uq" firstAttribute="leading" secondItem="AVo-l0-xCc" secondAttribute="leading" constant="5" id="MYK-Db-oOS"/>
+                                    <constraint firstItem="zu7-sx-j7d" firstAttribute="leading" secondItem="AVo-l0-xCc" secondAttribute="leading" id="N6N-Iw-KSV"/>
+                                    <constraint firstItem="072-BB-1SK" firstAttribute="centerY" secondItem="dPp-Rb-yWg" secondAttribute="centerY" id="X2M-Of-jgX"/>
+                                    <constraint firstItem="fgb-vf-yF0" firstAttribute="centerY" secondItem="6Ud-Bd-kSK" secondAttribute="centerY" id="YFl-jM-DYA"/>
+                                    <constraint firstAttribute="trailing" secondItem="072-BB-1SK" secondAttribute="trailing" id="cOF-vh-vFH"/>
+                                    <constraint firstItem="dPp-Rb-yWg" firstAttribute="leading" secondItem="AVo-l0-xCc" secondAttribute="leading" id="kBD-gA-hg3"/>
+                                    <constraint firstItem="dPp-Rb-yWg" firstAttribute="top" secondItem="AVo-l0-xCc" secondAttribute="top" constant="10" id="nmR-1D-Nyc"/>
+                                    <constraint firstItem="zu7-sx-j7d" firstAttribute="top" secondItem="dPp-Rb-yWg" secondAttribute="bottom" constant="10" id="oxY-X6-kwY"/>
+                                    <constraint firstAttribute="trailing" secondItem="EA9-AX-1Uq" secondAttribute="trailing" id="r1u-Bz-DBG"/>
+                                    <constraint firstItem="6Ud-Bd-kSK" firstAttribute="top" secondItem="EA9-AX-1Uq" secondAttribute="bottom" constant="8" id="zWa-kX-BXc"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="bottom" secondItem="AVo-l0-xCc" secondAttribute="bottom" constant="10" id="6YL-QM-jdc"/>
+                            <constraint firstItem="AVo-l0-xCc" firstAttribute="trailing" secondItem="0cJ-2d-rI3" secondAttribute="trailing" id="72s-1l-oN3"/>
+                            <constraint firstItem="0cJ-2d-rI3" firstAttribute="leading" secondItem="q7n-Au-vJ3" secondAttribute="leading" constant="16" id="KRq-t4-MgA"/>
+                            <constraint firstItem="0cJ-2d-rI3" firstAttribute="top" secondItem="q7n-Au-vJ3" secondAttribute="top" constant="10" id="KZr-NN-bEJ"/>
+                            <constraint firstItem="RbL-jd-AfR" firstAttribute="leading" secondItem="0cJ-2d-rI3" secondAttribute="leading" id="N7f-nz-nya"/>
+                            <constraint firstItem="RbL-jd-AfR" firstAttribute="trailing" secondItem="0cJ-2d-rI3" secondAttribute="trailing" id="OAZ-zm-lOc"/>
+                            <constraint firstAttribute="trailing" secondItem="0cJ-2d-rI3" secondAttribute="trailing" constant="16" id="btV-8K-0w9"/>
+                            <constraint firstItem="AVo-l0-xCc" firstAttribute="leading" secondItem="0cJ-2d-rI3" secondAttribute="leading" id="mcr-D8-WuB"/>
+                            <constraint firstItem="AVo-l0-xCc" firstAttribute="top" secondItem="RbL-jd-AfR" secondAttribute="bottom" constant="10" id="qJK-Ee-coe"/>
+                            <constraint firstItem="RbL-jd-AfR" firstAttribute="top" secondItem="0cJ-2d-rI3" secondAttribute="bottom" constant="7" id="rri-PX-hRi"/>
+                        </constraints>
+                    </view>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="q7n-Au-vJ3" firstAttribute="leading" secondItem="prV-gr-DaJ" secondAttribute="leading" id="WMj-pk-7uh"/>
+                    <constraint firstAttribute="trailing" secondItem="q7n-Au-vJ3" secondAttribute="trailing" id="o2f-bQ-HiB"/>
+                    <constraint firstItem="q7n-Au-vJ3" firstAttribute="top" secondItem="prV-gr-DaJ" secondAttribute="top" id="wgf-jP-9XO"/>
+                </constraints>
+            </clipView>
+            <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="k3s-VR-o2G">
+                <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="tvg-SG-BO4">
+                <rect key="frame" x="460" y="0.0" width="15" height="464"/>
+                <autoresizingMask key="autoresizingMask"/>
+            </scroller>
+            <point key="canvasLocation" x="-112.5" y="148"/>
+        </scrollView>
+    </objects>
+    <resources>
+        <image name="KMImageNameUXIconBtnFontsetNor" width="17" height="16"/>
+    </resources>
+</document>

+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -726,6 +726,12 @@
 		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 */; };
+		9F69DBBA2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */; };
+		9F69DBBB2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */; };
+		9F69DBBC2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */; };
+		9F69DBBD2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB92B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib */; };
+		9F69DBBE2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB92B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib */; };
+		9F69DBBF2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F69DBB92B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.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 */; };
@@ -5127,6 +5133,8 @@
 		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>"; };
+		9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationButtonWidgetAppearanceViewController.swift; sourceTree = "<group>"; };
+		9F69DBB92B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationButtonWidgetAppearanceViewController.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>"; };
@@ -7719,6 +7727,8 @@
 				9FB220F62B186C9800A5B208 /* KMAnnotationGeneralViewController.xib */,
 				9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */,
 				9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */,
+				9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */,
+				9F69DBB92B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib */,
 			);
 			path = FormProperties;
 			sourceTree = "<group>";
@@ -12670,6 +12680,7 @@
 				ADE86A7B2B0221E100414DFA /* KMSecurityWindowController.xib in Resources */,
 				BBC8A7752B0640C200FA9377 /* KMBotaSearchViewController.xib in Resources */,
 				BBAFDA7D2B4CDE1D00278BC3 /* KMPDFCropWindowController.xib in Resources */,
+				9F69DBBD2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */,
 				BBA9223B2B4E97540061057A /* KMPurchaseLimitWindowController.xib in Resources */,
 				BB65A0742AF8DE4F003A27A0 /* SyncPreferences.xib in Resources */,
 				9F0201992A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */,
@@ -12990,6 +13001,7 @@
 				ADD1B6F92946C0CA00C3FFF7 /* KMPrintChoosePageSizeMultipageView.xib in Resources */,
 				BB1A916F2AFB7871005E5FD8 /* KMConvertWindowController.xib in Resources */,
 				AD88109B29A78AEC00178CA1 /* KMVerificationCodeView.xib in Resources */,
+				9F69DBBE2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */,
 				9F512CD32B469A7700EC0BC3 /* KMPageDisplayThemeCollectionViewItem.xib in Resources */,
 				AD8810A429A8459000178CA1 /* KMComparativeTableViewController.xib in Resources */,
 				AD0FA4F629A8582C00EDEB50 /* KMComparativeTableView.xib in Resources */,
@@ -13630,6 +13642,7 @@
 				ADB2D6EB294740F30029D2B3 /* KMPrintPaperSetWindowController.xib in Resources */,
 				BB1969D32B2833FF00922736 /* KMProgressWindowController.xib in Resources */,
 				BBAFDA7F2B4CDE1D00278BC3 /* KMPDFCropWindowController.xib in Resources */,
+				9F69DBBF2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.xib in Resources */,
 				BBA9223D2B4E97540061057A /* KMPurchaseLimitWindowController.xib in Resources */,
 				BB276A5E2B038D3A00AB5578 /* KMOCRPDFWindowController.xib in Resources */,
 				AD0FA50029A8DD8700EDEB50 /* KMRegisterSuccessView.xib in Resources */,
@@ -14916,6 +14929,7 @@
 				BB146FF9299DC0D100784A6A /* OIDExternalUserAgentMac.m in Sources */,
 				BB9DCC9F2A0A2B0A0024A6F1 /* KMConvertSettingView.swift in Sources */,
 				ADDEEA9A2AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift in Sources */,
+				9F69DBBA2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */,
 				BBE9D0972AF0CECB002E83CE /* KMBatchOperateCompressViewController.swift in Sources */,
 				BB74DA772AC41182006EDFE7 /* NSFont+KMExtension.swift in Sources */,
 				BB6DD8252934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */,
@@ -15080,6 +15094,7 @@
 				BBD426802B4FCF1500AC8660 /* KMTextFieldCell.swift in Sources */,
 				BBA00AC52B157C880043D903 /* KMToolbarZoomItemView.swift in Sources */,
 				BB1B0AC62B4FC6E900889528 /* KMGuideInfoWindow.swift in Sources */,
+				9F69DBBB2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */,
 				BBC3484B2958222C008D2CD1 /* KMBackgroundOutsideView.swift in Sources */,
 				AD1D48222AFB6BBA007AC1F0 /* KMMergeView.swift in Sources */,
 				BB90E4F32AF37F9F00B04B9F /* KMCustomViewButton.swift in Sources */,
@@ -16754,6 +16769,7 @@
 				BB147028299DC0D100784A6A /* OIDTokenRequest.m in Sources */,
 				BB1B0AD02B4FC6E900889528 /* KMFunctionGuideMultiController.swift in Sources */,
 				9F1FE49829406E4700E952CA /* common.c in Sources */,
+				9F69DBBC2B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift in Sources */,
 				ADBC375629CAE94700D93208 /* KMComparativeOutlineSectionCell.swift in Sources */,
 				9F0CB5442986953A00007028 /* KMURLToPDFWindowController.swift in Sources */,
 				ADAFDA322AE8E45000F084BC /* KMAdvertisementConfig.swift in Sources */,