فهرست منبع

【2025】【综合】
1、Form自测完善
2、代码整理

niehaoyu 2 ماه پیش
والد
کامیت
135e790585

+ 22 - 5
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Form/CPDFButtonWidgetAnnotation+PDFListView.swift

@@ -28,10 +28,19 @@ import Foundation
         self.setWidgetCheck(CPDFButtonWidgetAnnotation.defaultWidgetButtonStyle(controlType: controlType))
         
         if (controlType == .pushButtonControl) {
-            self.cFont = CPDFButtonWidgetAnnotation.defaultFont()            
-            self.setCaption(NSLocalizedString("Submit", comment: ""))
-            let action = CPDFURLAction(url: "mailto:")
-            self.setAction(action)
+            self.cFont = CPDFButtonWidgetAnnotation.defaultFont()
+            
+            if CPDFButtonWidgetAnnotation.defaultActionType() == 0 {
+                self.setCaption(KMLocalizedString("Submit"))
+                let action = CPDFURLAction(url: "mailto:")
+                self.setAction(action)
+            } else if CPDFButtonWidgetAnnotation.defaultActionType() == 1 {
+                let action = CPDFURLAction(url: "https://")
+                self.setAction(action)
+            } else if CPDFButtonWidgetAnnotation.defaultActionType() == 2 {
+                let action = CPDFNamedAction(name: .print)
+                self.setAction(action)
+            }
         }
     }
     
@@ -224,6 +233,13 @@ extension CPDFButtonWidgetAnnotation {
     class func defaultFontSize() -> CGFloat {
         return CPDFAnnotationConfig.getDefaultFloatValue(forKey: CAnnotationActionButtonWidgetFontSizeKey) ?? 12
     }
+    
+    class func defaultActionType() -> Int {
+        if let value = CPDFAnnotationConfig.getDefaultIntValue(forKey: CAnnotationActionButtonWidgetActionTypeKey) {
+            return value
+        }
+        return 0
+    }
 }
 
 //MARK: - Update
@@ -416,7 +432,7 @@ extension CPDFButtonWidgetAnnotation {
         CPDFAnnotationConfig.setDefaultFloatValue(size, toKey: CAnnotationActionButtonWidgetFontSizeKey)
     }
     
-    class func update(_ annotations: [CPDFButtonWidgetAnnotation], mouseUpAction action: CPDFAction?, PDFView pdfView: CPDFListView?) {
+    class func update(_ annotations: [CPDFButtonWidgetAnnotation], mouseUpAction action: CPDFAction?, PDFView pdfView: CPDFListView?, actionType index: Int) {
         guard let pdfView = pdfView else {
             return
         }
@@ -425,6 +441,7 @@ extension CPDFButtonWidgetAnnotation {
         }
         pdfView.setNeedsDisplayMultiAnnotations(annotations)
         
+        CPDFAnnotationConfig.setDefaultIntValue(index, toKey: CAnnotationActionButtonWidgetActionTypeKey)
     }
 }
 

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CStringConstants.h

@@ -120,6 +120,7 @@ extern NSString *CAnnotationRadioButtonWidgetBackgroundColorKey;
 extern NSString *CAnnotationRadioButtonWidgetButtonStyleKey;
 
 //MARK: - Form_ActionButton
+extern NSString *CAnnotationActionButtonWidgetActionTypeKey;
 extern NSString *CAnnotationActionButtonWidgetBorderColorKey;
 extern NSString *CAnnotationActionButtonWidgetFontNameKey;
 extern NSString *CAnnotationChoiceButtonWidgetFontStyleKey;

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CStringConstants.m

@@ -121,6 +121,7 @@ NSString *CAnnotationRadioButtonBoxWidgetBorderColorKey  = @"CAnnotationRadioBut
 NSString *CAnnotationRadioButtonWidgetButtonStyleKey     = @"CAnnotationRadioButtonWidgetButtonStyleKey";
 
 //MARK: - Form_ActionButton
+NSString *CAnnotationActionButtonWidgetActionTypeKey      = @"CAnnotationActionButtonWidgetActionTypeKey";
 NSString *CAnnotationActionButtonWidgetFontColorKey       = @"SKAnnotationActionButtonWidgetFontColorKey";
 NSString *CAnnotationActionButtonWidgetBackgroundColorKey = @"SKAnnotationActionButtonWidgetBackgroundColorKey";
 NSString *CAnnotationActionButtonWidgetBorderColorKey     = @"CAnnotationActionButtonWidgetBorderColor";

+ 7 - 5
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Forms/Forms_Button/FormsButtonController.swift

@@ -345,6 +345,8 @@ class FormsButtonController: NSViewController {
                 actionType = 2
             }
         } else {
+            actionType = CPDFButtonWidgetAnnotation.defaultActionType()
+            
             //Appearance
             textColor = CPDFButtonWidgetAnnotation.defaultTextColor(controlType: .pushButtonControl)
             borderColor = CPDFButtonWidgetAnnotation.defaultBorderColor(controlType: .pushButtonControl)
@@ -534,7 +536,7 @@ extension FormsButtonController: ComponentInputDelegate {
                 }
                 if let url = url {
                     let action = CPDFURLAction(url: url)
-                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView)
+                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView, actionType: 0)
                 }
             } else if selectActionSelect.indexOfSelect() == 1 {
                 var url: String?
@@ -547,7 +549,7 @@ extension FormsButtonController: ComponentInputDelegate {
                 
                 if let url = url {
                     let action = CPDFURLAction(url: url)
-                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView)
+                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView, actionType: 1)
                 }
             }
         }
@@ -622,7 +624,7 @@ extension FormsButtonController: ComponentSelectDelegate {
                     }
                     if let url = url {
                         let action = CPDFURLAction(url: url)
-                        CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView)
+                        CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView, actionType: 0)
                     }
                 } else if selectActionSelect.indexOfSelect() == 1 {
                     var url: String?
@@ -635,11 +637,11 @@ extension FormsButtonController: ComponentSelectDelegate {
                     
                     if let url = url {
                         let action = CPDFURLAction(url: url)
-                        CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView)
+                        CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView, actionType: 1)
                     }
                 } else if selectActionSelect.indexOfSelect() == 2 {
                     let action = CPDFNamedAction(name: .print)
-                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView)
+                    CPDFButtonWidgetAnnotation.update(annotations, mouseUpAction: action, PDFView: pdfView, actionType: 2)
                 }
                 CPDFButtonWidgetAnnotation.update(annotations, caption: tagInput.properties.text, PDFView: pdfView)
                 

+ 6 - 0
PDF Office/PDF Master/KMClass/KMPDFViewController/RightSideController/Views/Forms/Forms_Raido/FormsRadioController.swift

@@ -279,6 +279,12 @@ class FormsRadioController: NSViewController {
             
             buttonType = annotation.widgetCheckStyle()
         } else {
+            if CPDFButtonWidgetAnnotation.defaultChecked(controlType: .radioButtonControl) {
+                isDefaultSelected = 1
+            } else {
+                isDefaultSelected = 0
+            }
+            
             //Appearance
             textColor = CPDFButtonWidgetAnnotation.defaultTextColor(controlType: .radioButtonControl)
             borderColor = CPDFButtonWidgetAnnotation.defaultBorderColor(controlType: .radioButtonControl)

+ 3 - 3
PDF Office/PDF Master/KMClass/Left/Annotaion/Controller/KMLeftSideViewController+Note.swift

@@ -607,9 +607,9 @@ extension KMLeftSideViewController {
     }
     
     func note_refrshUIIfNeed() {
-        Task { @MainActor in
-            self.noteOutlineView.reloadData()
-        }
+//        Task { @MainActor in
+//            self.noteOutlineView.reloadData()
+//        }
     }
     
     func note_reloadDataIfNeed() {

+ 0 - 576
PDF Office/PDF Master/KMClass/Settings/Preference/View/KMFontWell.swift

@@ -1,576 +0,0 @@
-//
-//  KMFontWell.swift
-//  PDF Reader Pro
-//
-//  Created by tangchao on 2023/11/7.
-//
-
-import Cocoa
-
-class KMFontWellCell: NSButtonCell {
-    var textColor: NSColor?
-    var hasTextColor: Bool = false
-    
-    private let FONTNAME_KEY = "fontName"
-    private let FONTSIZE_KEY = "fontSize"
-    private let TEXTCOLOR_KEY = "textColor"
-    private let HASTEXTCOLOR_KEY = "hasTextColor"
-    
-    deinit {
-        KMPrint("KMFontWellCell deinit.")
-    }
-    
-    override init(textCell string: String) {
-        super.init(textCell: string)
-        
-        self.commonInit()
-    }
-    
-    required init(coder: NSCoder) {
-        super.init(coder: coder)
-        
-        self.textColor = coder.decodeObject(forKey: TEXTCOLOR_KEY) as? NSColor
-        self.hasTextColor = coder.decodeBool(forKey: HASTEXTCOLOR_KEY)
-        self.commonInit()
-    }
-    
-    func commonInit() {
-        if self.textColor == nil {
-            self.textColor = .black
-        }
-        
-        self.bezelStyle = .shadowlessSquare
-        self.setButtonType(.pushOnPushOff)
-        self.state = .off
-    }
-    
-    override func encode(with coder: NSCoder) {
-        super.encode(with: coder)
-        
-        coder.encodeConditionalObject(self.textColor, forKey: TEXTCOLOR_KEY)
-        coder.encode(self.hasTextColor, forKey: HASTEXTCOLOR_KEY)
-    }
-    
-    override func copy(with zone: NSZone? = nil) -> Any {
-        let cell = super.copy(with: zone) as? KMFontWellCell
-        cell?.textColor = self.textColor?.copy(with: zone) as? NSColor
-        cell?.hasTextColor = self.hasTextColor
-        return cell as Any
-    }
-    
-    override func drawBezel(withFrame frame: NSRect, in controlView: NSView) {
-        KMDrawTextFieldBezel(frame, controlView)
-        if (self.state == .on) {
-            NSGraphicsContext.saveGraphicsState()
-            NSColor.selectedControlColor.setFill()
-            frame.fill(using: .plusDarker)
-            NSGraphicsContext.restoreGraphicsState()
-        }
-        if (self.isHighlighted) {
-            NSGraphicsContext.saveGraphicsState()
-            NSColor(calibratedWhite: 0, alpha: 0.1).setFill()
-            frame.frame(withWidth: 1, using: .plusDarker)
-            NSGraphicsContext.restoreGraphicsState()
-        }
-        
-        if (self.showsFirstResponder) {
-            NSGraphicsContext.saveGraphicsState()
-            NSFocusRingPlacement.only.set()
-            _ = CGRect.fill(frame)
-            NSGraphicsContext.restoreGraphicsState()
-        }
-    }
-    
-    override var attributedTitle: NSAttributedString {
-        set {
-            super.attributedTitle = newValue
-        }
-        get {
-            if (self.hasTextColor) {
-                var attrString = super.attributedTitle.mutableCopy() as? NSMutableAttributedString
-                attrString?.addAttribute(.foregroundColor, value: self.textColor ?? NSColor.black, range: NSMakeRange(0, attrString?.length ?? 0))
-                if let data = self.textColor?.usingColorSpaceName(.calibratedRGB)?.brightnessComponent, data > 0.8 {
-                    let shade = NSShadow()
-                    shade.shadowColor = .black
-                    shade.shadowBlurRadius = 1
-                    attrString?.addAttribute(.shadow, value: shade, range: NSMakeRange(0, attrString?.length ?? 0))
-                }
-                
-                return attrString!
-            } else {
-                return super.attributedTitle
-            }
-        }
-    }
-}
-
-private let SKFontWellWillBecomeActiveNotification = "SKFontWellWillBecomeActiveNotification"
-
-private let ACTION_KEY = "action"
-private let TARGET_KEY = "target"
-
-class KMFontWell: NSButton {
-    var isActive: Bool {
-        get {
-            return self.state == .on
-        }
-    }
-    var fontName: String? {
-        get {
-            return self.font?.fontName
-        }
-        set {
-            if let _fontName = newValue {
-                let newFont = NSFont(name: _fontName, size: self.font?.pointSize ?? 12)
-                self.font = newFont
-            }
-        }
-    }
-
-    var fontSize:  CGFloat {
-        get {
-            return self.font?.pointSize ?? 12
-        }
-        set {
-            if let _fontName = self.fontName {
-                let newFont = NSFont(name: _fontName, size: newValue)
-                self.font = newFont
-            }
-        }
-    }
-
-    var textColor: NSColor? {
-        get {
-            return (self.cell as? KMFontWellCell)?.textColor
-        }
-        set {
-            let didChange = self.textColor?.isEqual(to: newValue) ?? false
-            (self.cell as? KMFontWellCell)?.textColor = newValue
-            if didChange {
-                self.needsDisplay = true
-            }
-        }
-    }
-    
-    var hasTextColor: Bool  {
-        get {
-            if let data = self.cell as? KMFontWellCell {
-                return data.hasTextColor
-            }
-            return false
-        }
-        set {
-            if self.hasTextColor != newValue {
-                (self.cell as? KMFontWellCell)?.hasTextColor = newValue
-                self.needsDisplay = true
-            }
-        }
-    }
-    
-    private var _pri_target: AnyObject?
-    private var _pri_action: Selector?
-    /*
-     @interface SKFontWell : NSButton {
-         NSMutableDictionary *bindingInfo;
-     }
-
-     - (void)changeFontFromFontManager:(id)sender;
-     - (void)changeAttributesFromFontManager:(id)sender;
-     */
-    
-    override class var cellClass: AnyClass? {
-        set {
-            super.cellClass = newValue
-        }
-        get {
-            return KMFontWellCell.self
-        }
-    }
-    
-    deinit {
-        //    SKENSURE_MAIN_THREAD(
-//                [self unbind:FONTNAME_KEY];
-//                [self unbind:FONTSIZE_KEY];
-        //    );
-        NotificationCenter.default.removeObserver(self)
-        //    SKDESTROY(bindingInfo);
-    }
-    
-    override init(frame frameRect: NSRect) {
-        super.init(frame: frameRect)
-        
-        self.commonInit()
-    }
-    
-    required init?(coder: NSCoder) {
-        super.init(coder: coder)
-        
-        let oldCell = self.cell as? NSButtonCell
-        if let data = oldCell?.isKind(of: Self.cellClass!), !data {
-            let newCell = KMFontWellCell(textCell: "")
-            newCell.alignment = oldCell?.alignment ?? .center
-            newCell.isEditable = oldCell?.isEditable ?? true
-            newCell.target = oldCell?.target
-            newCell.action = oldCell?.action
-            self.cell = newCell
-        }
-        action = NSSelectorFromString(coder.decodeObject(forKey: ACTION_KEY) as? String ?? "")
-        target = coder.decodeObject(forKey: TARGET_KEY) as AnyObject?
-        self.commonInit()
-    }
-    
-    override func encode(with coder: NSCoder) {
-        super.encode(with: coder)
-        
-        if let data = self.action {
-            coder.encode(NSStringFromSelector(data), forKey: ACTION_KEY)
-        }
-        coder.encodeConditionalObject(target, forKey: TARGET_KEY)
-    }
-    
-    func commonInit() {
-        if (self.font == nil) {
-            self.font = .systemFont(ofSize: 0.0)
-        }
-        self.isEnabled = true
-        self._fontChanged()
-        super.action = #selector(_changeActive)
-        super.target = self
-//        bindingInfo = [[NSMutableDictionary alloc] init];
-//        [self registerForDraggedTypes:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, NSPasteboardTypeColor, nil]];
-    }
-
-    override func draw(_ dirtyRect: NSRect) {
-        super.draw(dirtyRect)
-
-        // Drawing code here.
-    }
-    
-    override func viewWillMove(toWindow newWindow: NSWindow?) {
-        self._deactivate()
-        super.viewWillMove(toWindow: newWindow)
-    }
-    
-    @objc func fontPickerWillBecomeActive(_ notification: NSNotification) {
-        let sender = notification.object
-        if self.isEqual(to: sender) == false && self.isActive {
-            self._deactivate()
-        }
-    }
-    
-    @objc func fontPanelWillClose(_ notification: NSNotification) {
-        self._deactivate()
-    }
-    
-    override var font: NSFont? {
-        get {
-            return super.font
-        }
-        set {
-            let didChange = (self.font?.isEqual(to: newValue) == false)
-            super.font = newValue
-            if didChange {
-                self._fontChanged()
-            }
-        }
-    }
-    
-    override func activeFontWell() -> KMFontWell? {
-        if self.isActive {
-            return self
-        }
-        return super.activeFontWell()
-    }
-    
-    func changeFontFromFontManager(_ sender: AnyObject?) {
-        if (self.isActive) {
-            if let _fontManager = sender as? NSFontManager {
-                if let _font = self.font {
-                    self.font = _fontManager.convert(_font)
-                }
-            }
-//            [self notifyFontBinding];
-            self.sendAction(self._pri_action, to: self._pri_target)
-        }
-    }
-    
-    override var target: AnyObject? {
-        get {
-            return self._pri_target
-        }
-        set {
-            self._pri_target = newValue
-        }
-    }
-    
-    override var action: Selector? {
-        get {
-            return self._pri_action
-        }
-        set {
-            self._pri_action = newValue
-        }
-    }
-    
-    /*
-     
-     #define SKNSFontPanelDescriptorsPboardType @"NSFontPanelDescriptorsPboardType"
-     #define SKNSFontPanelFamiliesPboardType @"NSFontPanelFamiliesPboardType"
-     #define SKNSFontCollectionFontDescriptors @"NSFontCollectionFontDescriptors"
-
-     #define FONT_KEY         @"font"
-     static char SKFontWellFontNameObservationContext;
-     static char SKFontWellFontSizeObservationContext;
-
-
-     @interface SKFontWell (SKPrivate)
-     - (void)changeActive:(id)sender;
-     - (void)fontChanged;
-     @end
-
-     @implementation SKFontWell
-
-
-     + (void)initialize {
-     //    SKINITIALIZE;
-         
-         [self exposeBinding:FONTNAME_KEY];
-         [self exposeBinding:FONTSIZE_KEY];
-         [self exposeBinding:TEXTCOLOR_KEY];
-     }
-
-     + (NSSet *)keyPathsForValuesAffectingFontName {
-         return [NSSet setWithObjects:FONT_KEY, nil];
-     }
-
-     + (NSSet *)keyPathsForValuesAffectingFontSize {
-         return [NSSet setWithObjects:FONT_KEY, nil];
-     }
-
-     - (Class)valueClassForBinding:(NSString *)binding {
-         if ([binding isEqualToString:FONTNAME_KEY])
-             return [NSString class];
-         else if ([binding isEqualToString:FONTNAME_KEY])
-             return [NSNumber class];
-         else if ([binding isEqualToString:TEXTCOLOR_KEY])
-             return [NSColor class];
-         else
-             return [super valueClassForBinding:binding];
-     }
-
-     - (void)notifyFontBinding {
-         NSDictionary *info = [self infoForBinding:FONTNAME_KEY];
-         [[info objectForKey:NSObservedObjectKey] setValue:[self fontName] forKeyPath:[info objectForKey:NSObservedKeyPathKey]];
-         info = [self infoForBinding:FONTSIZE_KEY];
-         [[info objectForKey:NSObservedObjectKey] setValue:[NSNumber numberWithDouble:[self fontSize]] forKeyPath:[info objectForKey:NSObservedKeyPathKey]];
-     }
-
-     - (void)notifyTextColorBinding {
-         NSDictionary *info = [self infoForBinding:TEXTCOLOR_KEY];
-         if (info) {
-             id value = [self textColor];
-             NSString *transformerName = [[info objectForKey:NSOptionsKey] objectForKey:NSValueTransformerNameBindingOption];
-             if (transformerName && [transformerName isEqual:[NSNull null]] == NO) {
-                 NSValueTransformer *valueTransformer = [NSValueTransformer valueTransformerForName:transformerName];
-                 value = [valueTransformer reverseTransformedValue:value];
-             }
-             [[info objectForKey:NSObservedObjectKey] setValue:value forKeyPath:[info objectForKey:NSObservedKeyPathKey]];
-         }
-     }
-
-     - (void)changeAttributesFromFontManager:(id)sender {
-         if ([self isActive] && [self hasTextColor]) {
-             [self setTextColor:[[sender convertAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[self textColor], NSForegroundColorAttributeName, nil]] valueForKey:NSForegroundColorAttributeName]];
-             [self notifyTextColorBinding];
-             [self sendAction:[self action] to:[self target]];
-         }
-     }
-
-     #pragma mark Accessors
-
-     - (SEL)action { return action; }
-     - (void)setAction:(SEL)newAction { action = newAction; }
-     - (id)target { return target; }
-     - (void)setTarget:(id)newTarget { target = newTarget; }
-
-     #pragma mark Binding support
-
-     - (void)bind:(NSString *)bindingName toObject:(id)observableController withKeyPath:(NSString *)keyPath options:(NSDictionary *)options {
-         if ([bindingName isEqualToString:FONTNAME_KEY] || [bindingName isEqualToString:FONTSIZE_KEY]) {
-             
-             if ([bindingInfo objectForKey:bindingName])
-                 [self unbind:bindingName];
-             
-     //        NSDictionary *bindingsData = [NSDictionary dictionaryWithObjectsAndKeys:observableController, NSObservedObjectKey, [[keyPath copy] autorelease], NSObservedKeyPathKey, [[options copy] autorelease], NSOptionsKey, nil];
-     //        [bindingInfo setObject:bindingsData forKey:bindingName];
-             
-             void *context = NULL;
-             if ([bindingName isEqualToString:FONTNAME_KEY])
-                 context = &SKFontWellFontNameObservationContext;
-             else if ([bindingName isEqualToString:FONTSIZE_KEY])
-                 context = &SKFontWellFontSizeObservationContext;
-             
-             [observableController addObserver:self forKeyPath:keyPath options:0 context:context];
-             [self observeValueForKeyPath:keyPath ofObject:observableController change:nil context:context];
-         } else {
-             [super bind:bindingName toObject:observableController withKeyPath:keyPath options:options];
-         }
-         [self setNeedsDisplay:YES];
-     }
-
-     - (void)unbind:(NSString *)bindingName {
-         if ([bindingName isEqualToString:FONTNAME_KEY] || [bindingName isEqualToString:FONTSIZE_KEY]) {
-             
-             NSDictionary *info = [self infoForBinding:bindingName];
-             [[info objectForKey:NSObservedObjectKey] removeObserver:self forKeyPath:[info objectForKey:NSObservedKeyPathKey]];
-             [bindingInfo removeObjectForKey:bindingName];
-         } else {
-             [super unbind:bindingName];
-         }
-         [self setNeedsDisplay:YES];
-     }
-
-     - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
-         NSString *key = nil;
-         if (context == &SKFontWellFontNameObservationContext)
-             key = FONTNAME_KEY;
-         else if (context == &SKFontWellFontSizeObservationContext)
-             key = FONTSIZE_KEY;
-         
-         if (key) {
-             NSDictionary *info = [self infoForBinding:key];
-             id value = [[info objectForKey:NSObservedObjectKey] valueForKeyPath:[info objectForKey:NSObservedKeyPathKey]];
-             if (NSIsControllerMarker(value) == NO)
-                 [self setValue:value forKey:key];
-         } else {
-             [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
-         }
-     }
-
-     - (NSDictionary *)infoForBinding:(NSString *)bindingName {
-         return [bindingInfo objectForKey:bindingName] ?: [super infoForBinding:bindingName];
-     }
-
-     #pragma mark NSDraggingDestination protocol
-
-     - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
-         if ([self isEnabled] && [sender draggingSource] != self && [[sender draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]]) {
-             [[self cell] setHighlighted:YES];
-             [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
-             [self setNeedsDisplay:YES];
-             return NSDragOperationGeneric;
-         } else
-             return NSDragOperationNone;
-     }
-
-     - (void)draggingExited:(id <NSDraggingInfo>)sender {
-         if ([self isEnabled] && [sender draggingSource] != self && [[sender draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]]) {
-             [[self cell] setHighlighted:NO];
-             [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
-             [self setNeedsDisplay:YES];
-         }
-     }
-
-     - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender {
-         return [self isEnabled] && [sender draggingSource] != self && [[sender draggingPasteboard] availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]];
-     }
-
-     - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender{
-         NSPasteboard *pboard = [sender draggingPasteboard];
-         NSString *type = [pboard availableTypeFromArray:[NSArray arrayWithObjects:SKNSFontPanelDescriptorsPboardType, SKNSFontPanelFamiliesPboardType, ([self hasTextColor] ? NSPasteboardTypeColor : nil), nil]];
-         NSFont *droppedFont = nil;
-         NSColor *droppedColor = nil;
-         
-         @try {
-             if ([type isEqualToString:SKNSFontPanelDescriptorsPboardType]) {
-                 NSData *data = [pboard dataForType:type];
-                 NSDictionary *dict = [data isKindOfClass:[NSData class]] ? [NSKeyedUnarchiver unarchiveObjectWithData:data] : nil;
-                 if ([dict isKindOfClass:[NSDictionary class]]) {
-                     NSArray *fontDescriptors = [dict objectForKey:SKNSFontCollectionFontDescriptors];
-                     NSFontDescriptor *fontDescriptor = ([fontDescriptors isKindOfClass:[NSArray class]] && [fontDescriptors count]) ? [fontDescriptors objectAtIndex:0] : nil;
-                     if ([fontDescriptor isKindOfClass:[NSFontDescriptor class]]) {
-                         NSNumber *size = [[fontDescriptor fontAttributes] objectForKey:NSFontSizeAttribute] ?: [dict objectForKey:NSFontSizeAttribute];
-                         CGFloat fontSize = [size respondsToSelector:@selector(doubleValue)] ? [size doubleValue] : [self fontSize];
-                         droppedFont = [NSFont fontWithDescriptor:fontDescriptor size:fontSize];
-                     }
-                 }
-             } else if ([type isEqualToString:SKNSFontPanelFamiliesPboardType]) {
-                 NSArray *families = [pboard propertyListForType:type];
-                 NSString *family = ([families isKindOfClass:[NSArray class]] && [families count]) ? [families objectAtIndex:0] : nil;
-                 if ([family isKindOfClass:[NSString class]])
-                     droppedFont = [[NSFontManager sharedFontManager] convertFont:[self font] toFamily:family];
-             } else if ([type isEqualToString:NSPasteboardTypeColor]) {
-                 droppedColor = [NSColor colorFromPasteboard:pboard];
-             }
-         }
-         @catch (id exception) {
-             NSLog(@"Ignoring exception %@ when dropping on SKFontWell failed", exception);
-         }
-         
-         if (droppedFont) {
-             [self setFont:droppedFont];
-             [self notifyFontBinding];
-             [self sendAction:[self action] to:[self target]];
-         }
-         if (droppedColor) {
-             [self setTextColor:droppedColor];
-             [self notifyTextColorBinding];
-             [self sendAction:[self action] to:[self target]];
-         }
-         
-         [[self cell] setHighlighted:NO];
-         [self setKeyboardFocusRingNeedsDisplayInRect:[self bounds]];
-         [self setNeedsDisplay:YES];
-         
-         return droppedFont != nil || droppedColor != nil;
-     }
-
-     @end
-     */
-}
-
-// MARK: - Private Methods
-
-extension KMFontWell {
-    private func _fontChanged() {
-        if self.isActive {
-            NSFontManager.shared.setSelectedFont(self.font ?? .systemFont(ofSize: 0), isMultiple: false)
-        }
-        self.title = String(format: "%@ %.0f", self.font?.displayName ?? "", self.fontSize)
-        self.needsDisplay = true
-    }
-    
-    @objc private func _changeActive(_ sender: AnyObject?) {
-        if (self.isEnabled) {
-            if (self.isActive) {
-                self._activate()
-            } else {
-                self._deactivate()
-            }
-        }
-    }
-    
-    private func _activate() {
-        let nc = NotificationCenter.default
-        let fm = NSFontManager.shared
-        
-        nc.post(name: NSNotification.Name(rawValue: SKFontWellWillBecomeActiveNotification), object: self)
-        
-        fm.setSelectedFont(self.font ?? .systemFont(ofSize: 0), isMultiple: false)
-        fm.orderFrontFontPanel(self)
-        
-        nc.addObserver(self, selector: #selector(fontPickerWillBecomeActive), name: NSNotification.Name(SKFontWellWillBecomeActiveNotification), object: nil)
-        nc.addObserver(self, selector: #selector(fontPanelWillClose), name: NSWindow.willCloseNotification, object: fm.fontPanel(true))
-        
-        self.state = .on
-        self.setKeyboardFocusRingNeedsDisplay(self.bounds)
-        self.needsDisplay = true
-    }
-    
-    private func _deactivate() {
-        NotificationCenter.default.removeObserver(self)
-        self.state = .off
-        self.setKeyboardFocusRingNeedsDisplay(self.bounds)
-        self.needsDisplay = true
-    }
-}

+ 2 - 14
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -2652,6 +2652,7 @@
 		BB2CC5642AF1239900D7A796 /* KMBatchBaseParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A4002AE8B4E200788BAC /* KMBatchBaseParameter.swift */; };
 		BB2CC5652AF123A300D7A796 /* KMBatchHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A3F92AE89B8500788BAC /* KMBatchHeader.swift */; };
 		BB2CC5662AF123A400D7A796 /* KMBatchHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBF8A3F92AE89B8500788BAC /* KMBatchHeader.swift */; };
+		BB2D43382D2FA31A00DB3EE2 /* KMAnnotationModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F325FD242D27987F00832097 /* KMAnnotationModel.swift */; };
 		BB2EDF46296E4618003BCF58 /* KMPageEditTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2EDF45296E4618003BCF58 /* KMPageEditTools.swift */; };
 		BB2EDF47296E4618003BCF58 /* KMPageEditTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2EDF45296E4618003BCF58 /* KMPageEditTools.swift */; };
 		BB2EDF48296E4618003BCF58 /* KMPageEditTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2EDF45296E4618003BCF58 /* KMPageEditTools.swift */; };
@@ -2718,8 +2719,6 @@
 		BB31981E2AC57ACA00107371 /* CPDFPage+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB31981D2AC57ACA00107371 /* CPDFPage+PDFListView.swift */; };
 		BB31981F2AC57ACA00107371 /* CPDFPage+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB31981D2AC57ACA00107371 /* CPDFPage+PDFListView.swift */; };
 		BB3198202AC57ACA00107371 /* CPDFPage+PDFListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB31981D2AC57ACA00107371 /* CPDFPage+PDFListView.swift */; };
-		BB31DA5E2AFA1B03006D63CB /* KMFontWell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB31DA5D2AFA1B03006D63CB /* KMFontWell.swift */; };
-		BB31DA5F2AFA1B03006D63CB /* KMFontWell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB31DA5D2AFA1B03006D63CB /* KMFontWell.swift */; };
 		BB328B602B55512F00B382C6 /* KMVerificationMessageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB328B5D2B55512F00B382C6 /* KMVerificationMessageViewController.xib */; };
 		BB328B612B55512F00B382C6 /* KMVerificationMessageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB328B5D2B55512F00B382C6 /* KMVerificationMessageViewController.xib */; };
 		BB328B622B55512F00B382C6 /* KMVerificationMessageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB328B5D2B55512F00B382C6 /* KMVerificationMessageViewController.xib */; };
@@ -5770,7 +5769,6 @@
 		BB3198152AC55E6D00107371 /* CPDFDocument+KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFDocument+KMExtension.swift"; sourceTree = "<group>"; };
 		BB3198192AC567B500107371 /* CPDFSelection+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFSelection+PDFListView.swift"; sourceTree = "<group>"; };
 		BB31981D2AC57ACA00107371 /* CPDFPage+PDFListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFPage+PDFListView.swift"; sourceTree = "<group>"; };
-		BB31DA5D2AFA1B03006D63CB /* KMFontWell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMFontWell.swift; sourceTree = "<group>"; };
 		BB328B5D2B55512F00B382C6 /* KMVerificationMessageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMVerificationMessageViewController.xib; sourceTree = "<group>"; };
 		BB328B5E2B55512F00B382C6 /* KMVerificationMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMVerificationMessageViewController.m; sourceTree = "<group>"; };
 		BB328B5F2B55512F00B382C6 /* KMVerificationMessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMVerificationMessageViewController.h; sourceTree = "<group>"; };
@@ -9774,14 +9772,6 @@
 			path = images;
 			sourceTree = "<group>";
 		};
-		BB00300D298CA367002DD1A0 /* View */ = {
-			isa = PBXGroup;
-			children = (
-				BB31DA5D2AFA1B03006D63CB /* KMFontWell.swift */,
-			);
-			path = View;
-			sourceTree = "<group>";
-		};
 		BB00301B298CB787002DD1A0 /* Tools */ = {
 			isa = PBXGroup;
 			children = (
@@ -11323,7 +11313,6 @@
 			children = (
 				BB46CF462AFB7E5C00281EDF /* Resource */,
 				BB00301B298CB787002DD1A0 /* Tools */,
-				BB00300D298CA367002DD1A0 /* View */,
 			);
 			path = Preference;
 			sourceTree = "<group>";
@@ -14951,7 +14940,6 @@
 				BB5A9D5B2CB6521400F64C1F /* SettingsManager.swift in Sources */,
 				BB96A0B02AFCD56100559E24 /* KMToolCompareWindowController.swift in Sources */,
 				BB86C1ED28F544F4005AD968 /* CPDFListView+Event.m in Sources */,
-				BB31DA5E2AFA1B03006D63CB /* KMFontWell.swift in Sources */,
 				BB7256BD2CDC5B5300B6CE64 /* KMBackgroundController.swift in Sources */,
 				BBE788872CBD2463008086E2 /* SelectVC.swift in Sources */,
 				9F1FE4D229406E4700E952CA /* CTTabView.m in Sources */,
@@ -16324,7 +16312,6 @@
 				9F1F82D3292F6D510092C4B4 /* KMPDFInsertPreviewViewController.swift in Sources */,
 				BB5A9D6B2CB6521400F64C1F /* KMPDFToolbarController.swift in Sources */,
 				AD055EA02B8836AE0035F824 /* SKDocumentController.m in Sources */,
-				BB31DA5F2AFA1B03006D63CB /* KMFontWell.swift in Sources */,
 				9F1FE4EB29406E4700E952CA /* NSBezierPath+MCAdditions.m in Sources */,
 				AD8B59F42D2B778D00150EA6 /* KMBatchProcessingOrderTableCell.swift in Sources */,
 				BBA922362B4E97540061057A /* KMPurchaseFirstTrialWindowController.swift in Sources */,
@@ -16723,6 +16710,7 @@
 				BB79E71A2CE617CB0052CAD5 /* KMEditImageController.swift in Sources */,
 				9F9461882BD644BF0076574B /* KMTableCellData.m in Sources */,
 				ADDF837E2B391A5D00A81A4E /* DSignatureDetailsViewController.swift in Sources */,
+				BB2D43382D2FA31A00DB3EE2 /* KMAnnotationModel.swift in Sources */,
 				BB9138372CEE089C00BAB4A7 /* KMCropController.swift in Sources */,
 				9F1FE50029406E4700E952CA /* CTTabStripModel.m in Sources */,
 				BB03D69D2B0249A2008C9976 /* KMPDFEditInsertPageWindow.swift in Sources */,

+ 80 - 32
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -4215,22 +4215,6 @@
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "0724CE56-135C-4750-B7C4-45F652CECAED"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/KMClass/KMNPDFPageEdit/KMNThumbnailView/KMNThumbnailCollectionViewItem.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "82"
-            endingLineNumber = "82"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -4407,22 +4391,6 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "40C0CA63-2482-433E-9A6A-2A1B6676EC82"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KMComponentLibrary/KMComponentLibrary/View/Input/ComponentTextarea/ComponentTextarea.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "192"
-            endingLineNumber = "192"
-            landmarkName = "mouseDown(with:)"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
@@ -5224,5 +5192,85 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "FCCF0038-3028-450C-BDE2-BD1D86C4110B"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/KMClass/PDFListView/Mode/KMNAnnotationPopMode.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "424"
+            endingLineNumber = "424"
+            landmarkName = "setannotationGropName(gropName:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "1FBF3017-0D73-4CED-ABC4-1415B9080281"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/KMClass/PDFListView/WindowController/KMNPopAnnotationWindowController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "1009"
+            endingLineNumber = "1009"
+            landmarkName = "componentInputDidChanged(inputView:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "8DA34A6D-3CCE-4889-921F-0305759ECF61"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Form/CPDFButtonWidgetAnnotation+PDFListView.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "322"
+            endingLineNumber = "322"
+            landmarkName = "update(_:buttonWidgetStateString:PDFView:)"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "8DA34A6D-3CCE-4889-921F-0305759ECF61 - f4f4ffde33a9f087"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "static __C.CPDFButtonWidgetAnnotation.update(_: Swift.Array&lt;__C.CPDFButtonWidgetAnnotation&gt;, buttonWidgetStateString: Swift.Optional&lt;Swift.String&gt;, PDFView: Swift.Optional&lt;__C.CPDFListView&gt;) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Form/CPDFButtonWidgetAnnotation+PDFListView.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "306"
+                  endingLineNumber = "306"
+                  offsetFromSymbolStart = "404">
+               </Location>
+               <Location
+                  uuid = "8DA34A6D-3CCE-4889-921F-0305759ECF61 - f4f4ffde33a9f697"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "static __C.CPDFButtonWidgetAnnotation.update(_: Swift.Array&lt;__C.CPDFButtonWidgetAnnotation&gt;, buttonWidgetStateString: Swift.Optional&lt;Swift.String&gt;, PDFView: Swift.Optional&lt;__C.CPDFListView&gt;) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Form/CPDFButtonWidgetAnnotation+PDFListView.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "322"
+                  endingLineNumber = "322"
+                  offsetFromSymbolStart = "404">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>