Browse Source

【注释】补充Form注释创建逻辑

wanjun 1 year ago
parent
commit
fd1fe7858b

+ 3 - 3
PDF Office/PDF Master/Class/Common/Category/NSUserDefaults_KMExtension.swift

@@ -34,7 +34,7 @@ extension UserDefaults {
 //        
 //        return color
 //    }
-    func color(forKey key: String) -> NSColor? {
+    @objc func color(forKey key: String) -> NSColor? {
         let colorString = self.object(forKey: key) as? AnyObject
         var color: NSColor?
         if let data = colorString?.isKind(of: NSData.self), data {
@@ -47,7 +47,7 @@ extension UserDefaults {
         return color
     }
     
-    func setColor(_ color: NSColor, forKey key: String) {
+    @objc func setColor(_ color: NSColor, forKey key: String) {
 //        let data = color.map { NSArchiver.archivedData(withRootObject: $0) }
 //        set(data, forKey: key)
         let colorString = color.toHex(alpha: true)
@@ -55,7 +55,7 @@ extension UserDefaults {
         self.synchronize()
     }
     
-    func font(forNameKey nameKey: String, sizeKey: String) -> NSFont? {
+    @objc func font(forNameKey nameKey: String, sizeKey: String) -> NSFont? {
         guard let fontName = string(forKey: nameKey) else {
             return nil
         }

+ 96 - 0
PDF Office/PDF Master/Class/PDFWindowController/Form/KMPDFAnnotationButtonWidgetSub.swift

@@ -0,0 +1,96 @@
+//
+//  KMPDFAnnotationButtonWidgetSub.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/1/31.
+//
+
+import Cocoa
+
+class KMPDFAnnotationButtonWidgetSub: CPDFButtonWidgetAnnotation {
+    var formType: CAnnotationType = .unkown
+    
+    override func draw(with box: CPDFDisplayBox, in context: CGContext!) {
+        guard shouldDisplay() else {
+            return
+        }
+        
+        if controlType() == .checkBoxControl {
+            if hasAppearanceStream() {
+                super.draw(with: box, in: context)
+            } else {
+                super.draw(with: box, in: context)
+
+                NSGraphicsContext.saveGraphicsState()
+                transformContext(for: page, displayBox: box)
+                
+                context.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
+                context.setLineWidth(1.0)
+                context.addRect(CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.size.width, height: bounds.size.height))
+                context.strokePath()
+
+                NSGraphicsContext.restoreGraphicsState()
+            }
+        } else if controlType() == .pushButtonControl {
+            if hasAppearanceStream() {
+                super.draw(with: box, in: context)
+            } else {
+                NSGraphicsContext.saveGraphicsState()
+                let stabilizeHeight: CGFloat = 25
+                let actualRect = NSRect(x: bounds.origin.x, y: bounds.minY + (bounds.height - stabilizeHeight) / 2, width: bounds.size.width, height: stabilizeHeight)
+                let bezierPath = NSBezierPath(roundedRect: actualRect, xRadius: 2, yRadius: 2)
+                NSColor(red: 37/255.0, green: 139/255.0, blue: 251/255.0, alpha: 1).set()
+                bezierPath.fill()
+                
+                var attributes = [NSAttributedString.Key: Any]()
+                if let font = self.font {
+                    attributes[.font] = font
+                }
+                if let fontColor = self.fontColor {
+                    attributes[.foregroundColor] = fontColor
+                }
+                
+                let stringRect = caption()!.boundingRect(with: CGSize(width: actualRect.size.width, height: actualRect.size.height), options: .usesLineFragmentOrigin, attributes: attributes)
+                
+                caption().draw(in: CGRect(x: (actualRect.size.width - stringRect.size.width)/2 + actualRect.origin.x,
+                                        y: (actualRect.size.height - stringRect.size.height)/2 + actualRect.origin.y,
+                                        width: stringRect.size.width, height: stringRect.size.height), withAttributes: attributes)
+                
+                NSGraphicsContext.restoreGraphicsState()
+            }
+        } else {
+            super.draw(with: box, in: context)
+        }
+    }
+    
+    func transformContext(for page: CPDFPage, displayBox box: CPDFDisplayBox) {
+        var transform = NSAffineTransform()
+        let boxRect = page.bounds(for: box)
+        let rotation = page.rotation
+        
+        // Handle rotation.
+        switch rotation {
+        case 90:
+            transform.rotate(byDegrees: -90)
+            transform.translateX(by: -boxRect.size.width, yBy: 0.0)
+        case 180:
+            transform.rotate(byDegrees: 180)
+            transform.translateX(by: -boxRect.size.width, yBy: -boxRect.size.height)
+        case 270:
+            transform.rotate(byDegrees: 90)
+            transform.translateX(by: 0.0, yBy: -boxRect.size.height)
+        default:
+            break
+        }
+        
+        // Origin.
+        transform.translateX(by: -boxRect.origin.x, yBy: -boxRect.origin.y)
+        
+        // Concatenate.
+        transform.concat()
+    }
+
+    func keysForValuesToObserveForUndo() -> Set<String> {
+        return []
+    }
+}

+ 138 - 0
PDF Office/PDF Master/Class/PDFWindowController/Form/KMPDFAnnotationChoiceWidgetSub.swift

@@ -0,0 +1,138 @@
+//
+//  KMPDFAnnotationChoiceWidgetSub.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/1/31.
+//
+
+import Cocoa
+
+class KMPDFAnnotationChoiceWidgetSub: CPDFChoiceWidgetAnnotation {
+    var formType: CAnnotationType = .unkown
+    
+    override func draw(with box: CPDFDisplayBox, in context: CGContext!) {
+        let listChoice: Bool = isListChoice
+        if listChoice {
+            if hasAppearanceStream() {
+                super.draw(with: box, in: context)
+            } else {
+                super.draw(with: box, in: context)
+                transformContext(for: page, displayBox: box)
+                
+                context.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
+                context.setLineWidth(1.0)
+                context.addRect(CGRect(x: bounds.origin.x, y: bounds.origin.y, width: bounds.size.width, height: bounds.size.height))
+                context.strokePath()
+            }
+        } else {
+            if hasAppearanceStream() {
+                super.draw(with: box, in: context)
+            } else {
+                var stabilizeHeight = bounds.size.height
+                if stabilizeHeight > 25.0 {
+                    stabilizeHeight = 25.0
+                }
+                var actualRect = CGRect.zero
+                actualRect = CGRect(x: bounds.origin.x, y: bounds.minY + (bounds.height - stabilizeHeight) / 2, width: bounds.size.width, height: stabilizeHeight)
+                
+                let borderWidth: CGFloat = 0.5
+                var rightPartWidthChangePointValue = bounds.size.width / 2
+                if rightPartWidthChangePointValue > 30 {
+                    rightPartWidthChangePointValue = 30
+                }
+                let radius: CGFloat = 2.0
+                
+                // 画外框
+                context.saveGState()
+                context.move(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue, y: actualRect.minY + borderWidth))
+                context.addLine(to: CGPoint(x: actualRect.minX + borderWidth, y: actualRect.minY + borderWidth))
+                context.addLine(to: CGPoint(x: actualRect.minX + borderWidth, y: actualRect.maxY - borderWidth))
+                context.addLine(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue + 2 * borderWidth, y: actualRect.maxY - borderWidth))
+                context.addLine(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue + 2 * borderWidth, y: actualRect.minY + borderWidth))
+                context.setStrokeColor(NSColor.lightGray.cgColor)
+                context.setLineWidth(borderWidth)
+                context.setFillColor(self.backgroundColor.cgColor)
+                context.drawPath(using: .fillStroke)
+                context.restoreGState()
+                
+                context.saveGState()
+                context.move(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue, y: actualRect.maxY))
+                context.addLine(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue, y: actualRect.minY))
+                context.addLine(to: CGPoint(x: actualRect.maxX - radius, y: actualRect.minY))
+                context.addArc(center: CGPoint(x: actualRect.maxX - radius, y: actualRect.minY + radius), radius: radius, startAngle: CGFloat(3 * Double.pi / 2), endAngle: CGFloat(2 * Double.pi), clockwise: false)
+                context.addLine(to: CGPoint(x: actualRect.maxX, y: actualRect.maxY - radius))
+                context.addArc(center: CGPoint(x: actualRect.maxX - radius, y: actualRect.maxY - radius), radius: radius, startAngle: CGFloat(2 * Double.pi), endAngle: CGFloat(Double.pi / 2), clockwise: false)
+                context.addLine(to: CGPoint(x: actualRect.maxX - rightPartWidthChangePointValue, y: actualRect.maxY))
+                context.setFillColor(NSColor(red: 37/255.0, green: 139/255.0, blue: 251/255.0, alpha: 1.0).cgColor)
+                context.drawPath(using: .fill)
+                context.restoreGState()
+                
+                // 画等边三角形
+                let triangleWidth = min(rightPartWidthChangePointValue, actualRect.height) / 2.0
+                let triangleHeight = triangleWidth * sqrt(3.0) / 2
+                let centerPointUpGap = triangleHeight / 3.0
+                
+                context.saveGState()
+                let startPointX = actualRect.maxX - rightPartWidthChangePointValue + (rightPartWidthChangePointValue - triangleWidth) / 2
+                let startPointY = actualRect.midY + centerPointUpGap
+                context.move(to: CGPoint(x: startPointX, y: startPointY))
+                context.addLine(to: CGPoint(x: startPointX + triangleWidth, y: startPointY))
+                context.addLine(to: CGPoint(x: startPointX + triangleWidth / 2.0, y: actualRect.midY - 2 * centerPointUpGap))
+                context.closePath()
+                context.setFillColor(NSColor.white.cgColor)
+                context.drawPath(using: .fill)
+                context.restoreGState()
+                
+                context.saveGState()
+                // 画文字
+                var attributes = [NSAttributedString.Key: Any]()
+                if let font = self.font {
+                    attributes[.font] = font
+                }
+                if let fontColor = self.fontColor {
+                    attributes[.foregroundColor] = fontColor
+                }
+                let stringRect = self.string().boundingRect(with: CGSize(width: actualRect.size.width - rightPartWidthChangePointValue, height: actualRect.size.height), options: .usesLineFragmentOrigin, attributes: attributes)
+                
+                self.string().draw(in: CGRect(x: actualRect.origin.x, y: (actualRect.size.height - stringRect.size.height) / 2 + actualRect.origin.y, width: stringRect.size.width, height: stringRect.size.height), withAttributes: attributes)
+//                context.restoreGState()
+            }
+        }
+    }
+    
+    func transformContext(for page: CPDFPage, displayBox box: CPDFDisplayBox) {
+        var transform = NSAffineTransform()
+
+        // Identity.
+        transform = NSAffineTransform()
+
+        // Bounds for page.
+        let boxRect = page.bounds(for: box)
+
+        // Handle rotation.
+        let rotation = page.rotation
+        switch rotation {
+        case 90:
+            transform.rotate(byDegrees: -90)
+            transform.translateX(by: -boxRect.size.width, yBy: 0.0)
+        case 180:
+            transform.rotate(byDegrees: 180)
+            transform.translateX(by: -boxRect.size.width, yBy: -boxRect.size.height)
+        case 270:
+            transform.rotate(byDegrees: 90)
+            transform.translateX(by: 0.0, yBy: -boxRect.size.height)
+        default:
+            break
+        }
+
+        // Origin.
+        transform.translateX(by: -boxRect.origin.x, yBy: -boxRect.origin.y)
+
+        // Concatenate.
+        transform.concat()
+    }
+
+    func keysForValuesToObserveForUndo() -> Set<String> {
+        return []
+    }
+}

+ 46 - 0
PDF Office/PDF Master/Class/PDFWindowController/Form/KMPDFAnnotationTextWidgetSub.swift

@@ -0,0 +1,46 @@
+//
+//  KMPDFAnnotationTextWidgetSub.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/1/31.
+//
+
+import Cocoa
+
+class KMPDFAnnotationTextWidgetSub: CPDFTextWidgetAnnotation {
+    func transformContext(for page: PDFPage, displayBox box: PDFDisplayBox) {
+        var transform = NSAffineTransform()
+
+        // Identity.
+        transform = NSAffineTransform()
+
+        // Bounds for page.
+        let boxRect = page.bounds(for: box)
+
+        // Handle rotation.
+        let rotation = page.rotation
+        switch rotation {
+        case 90:
+            transform.rotate(byDegrees: -90)
+            transform.translateX(by: -boxRect.size.width, yBy: 0.0)
+        case 180:
+            transform.rotate(byDegrees: 180)
+            transform.translateX(by: -boxRect.size.width, yBy: -boxRect.size.height)
+        case 270:
+            transform.rotate(byDegrees: 90)
+            transform.translateX(by: 0.0, yBy: -boxRect.size.height)
+        default:
+            break
+        }
+
+        // Origin.
+        transform.translateX(by: -boxRect.origin.x, yBy: -boxRect.origin.y)
+
+        // Concatenate.
+        transform.concat()
+    }
+
+    func keysForValuesToObserveForUndo() -> Set<String> {
+        return []
+    }
+}

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Form/KMAnnotationFromSignature.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMAnnotationFromSignature: CPDFButtonWidgetAnnotation {
+class KMAnnotationFromSignature: CPDFSignatureWidgetAnnotation {
     var signature: KMSignature?
     
     override func draw(with box: CPDFDisplayBox, in context: CGContext!) {

+ 17 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.h

@@ -13,6 +13,15 @@
 #import "CPDFListView.h"
 #import "NSGeometry+PDFListView.h"
 
+static inline NSRect SKRectFromCenterAndSquareSize(NSPoint center, CGFloat size) {
+    NSRect rect;
+    rect.origin.x = center.x - 0.5 * size;
+    rect.origin.y = center.y - 0.5 * size;
+    rect.size.width = size;
+    rect.size.height = size;
+    return rect;
+}
+
 static inline NSRect SKRectFromCenterAndPoint(NSPoint center, NSPoint point) {
     NSRect rect;
     rect.size.width = 2.0 * fabs(center.x - point.x);
@@ -22,6 +31,14 @@ static inline NSRect SKRectFromCenterAndPoint(NSPoint center, NSPoint point) {
     return rect;
 }
 
+static inline NSRect SKRectFromCenterAndSize(NSPoint center, NSSize size) {
+    NSRect rect;
+    rect.origin.x = center.x - 0.5 * size.width;
+    rect.origin.y = center.y - 0.5 * size.height;
+    rect.size = size;
+    return rect;
+}
+
 static inline NSRect SKRectFromPoints(NSPoint aPoint, NSPoint bPoint) {
     NSRect rect;
     rect.origin.x = fmin(aPoint.x, bPoint.x);

+ 385 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -183,6 +183,18 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
                     [self doDrawLinkNoteWithEvent:theEvent];
                 }
             }
+        } else if (self.toolMode == CFormToolMode) {
+            NSPoint p = [theEvent locationInWindow];
+            NSPoint currentPoint = [self convertPoint:p fromView:nil];
+            for (CPDFAnnotation *ann in self.currentPage.annotations) {
+                if (CGRectContainsPoint(ann.bounds, [self convertPoint:currentPoint toPage: self.currentPage])) {
+                    if (!ann.shouldDisplay) {
+                        [self updateActiveAnnotations:@[ann]];
+                        return;
+                    }
+                }
+            }
+            [self doFormWithEvent:theEvent];
         } else {
             [self doDragAddAnnotationWithEvent:theEvent];
         }
@@ -2858,6 +2870,379 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
     self.multiplAnnotationObject.drawRect = newBounds;
 }
 
+#pragma mark - Form
+- (void)doFormWithEvent:(NSEvent *)theEvent
+{
+    if (self.annotationType == CAnnotationTypeRadioButton || self.annotationType == CAnnotationTypeCheckBox) {
+        [self updateActiveAnnotations:@[]];
+
+        NSPoint pagePoint = NSZeroPoint;
+        CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+        NSUInteger eventMask = NSLeftMouseUpMask;
+        theEvent = [[self window] nextEventMatchingMask:eventMask];
+        while (YES) {
+            if ([theEvent type] == NSLeftMouseUp) {
+                CGRect bounds =CGRectMake(pagePoint.x - 10, pagePoint.y - 10, 20, 20);
+                [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:bounds];
+                break;
+            }
+        }
+    } else if (self.annotationType == CAnnotationTypeTextField || self.annotationType == CAnnotationTypeListMenu || self.annotationType == CAnnotationTypeComboBox || self.annotationType == CAnnotationTypeActionButton){
+        CPDFAnnotation *annotation = self.activeAnnotation;
+        [self updateActiveAnnotations:@[]];
+        // Old (current) annotation location and click point relative to it
+        NSRect originalBounds = [self.activeAnnotation bounds];
+        NSPoint pagePoint = NSZeroPoint;
+        CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+        BOOL shouldAddAnnotation = self.activeAnnotation == nil;
+ 
+        // Hit-test for resize box.
+        CRectEdges resizeHandle = [self.activeAnnotation resizeHandleForPoint:pagePoint scaleFactor:[self scaleFactor]];
+        if (shouldAddAnnotation) {
+            originalBounds = SKRectFromCenterAndSquareSize(NSMakePoint(round(pagePoint.x), round(pagePoint.y)), 0.0);
+            resizeHandle = CMaxXEdgeMask | CMinYEdgeMask;
+        }
+        BOOL draggedAnnotation = NO;
+        NSEvent *lastMouseEvent = theEvent;
+        NSPoint offset = NSMakePoint(pagePoint.x - originalBounds.origin.x, pagePoint.y - originalBounds.origin.y);
+        NSUInteger eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
+        [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(resizeHandle, page)];
+        while (YES) {
+            theEvent = [[self window] nextEventMatchingMask:eventMask];
+            if ([theEvent type] == NSLeftMouseUp) {
+                if (!draggedAnnotation) {
+                    if (annotation) {
+                        break;
+                    }
+                } else {
+                    if (annotation) {
+//                        [self showEditableFormAnnotationEditor:annotation];
+                    }
+                    break;
+                }
+                NSSize defaultSize = CGSizeZero;
+                if (self.annotationType == CAnnotationTypeTextField) {
+                    defaultSize = CGSizeMake(100, 20);
+                } else if (self.annotationType == CAnnotationTypeComboBox){
+                    defaultSize = CGSizeMake(130, 40);
+                } else if (self.annotationType == CAnnotationTypeListMenu){
+                    defaultSize = CGSizeMake(130, 40);
+                } else if (self.annotationType == CAnnotationTypeActionButton){
+                    defaultSize = CGSizeMake(130, 40);
+                }
+                defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultSize.width, defaultSize.height) : NSMakeSize(defaultSize.height, defaultSize.width);
+                
+                annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSize(NSMakePoint(round(pagePoint.x), round(pagePoint.y)), defaultSize)];
+                break;
+            } else if ([theEvent type] == NSLeftMouseDragged){
+                if (self.activeAnnotation == nil) {
+              annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
+                }
+                lastMouseEvent = theEvent;
+                draggedAnnotation = YES;
+            } else if (self.activeAnnotation == nil){
+                continue;
+            }
+            if (resizeHandle == 0) {
+                [self doMoveAnnotation:self.activeAnnotation withEvent:lastMouseEvent offset:offset];
+            } else {
+                [self doResizeAnnotationWithEvent:lastMouseEvent fromPoint:pagePoint originalBounds:originalBounds resizeHandle:&resizeHandle];
+            }
+            
+            if (resizeHandle == 0)
+                [NSEvent stopPeriodicEvents];
+            
+            if (self.activeAnnotation) {
+                if (draggedAnnotation)
+                    [self.activeAnnotation autoUpdateString];
+//                if (shouldAddAnnotation && self.toolMode == CNoteToolMode && (annotationMode == SKAnchoredNote || annotationMode == SKFreeTextNote))
+//                    [self editActiveAnnotation:self];
+                
+                [self setNeedsDisplayAnnotation:self.activeAnnotation];
+            }
+            
+            // ??? PDFView's delayed layout seems to reset the cursor to an arrow
+            [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
+        }
+    } else if (CAnnotationTypeSignature == self.annotationType) {
+        [self creatFromSignatureWithEvent:theEvent];
+    } 
+//    else if (KMFormTypeClear == self.annotationType) {
+//        
+//    } 
+    else {
+        [self updateActiveAnnotations:@[]];
+    }
+}
+
+- (void)creatFromSignatureWithEvent:(NSEvent *)theEvent
+{
+    CPDFAnnotation *annotation = self.activeAnnotation;
+    [self updateActiveAnnotations:@[]];
+    NSRect originalBounds = [self.activeAnnotation bounds];
+    NSPoint pagePoint = NSZeroPoint;
+    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
+    BOOL shouldAddAnnotation = self.activeAnnotation == nil;
+    
+    CRectEdges resizeHandle = [self.activeAnnotation resizeHandleForPoint:pagePoint scaleFactor:[self scaleFactor]];
+    if (shouldAddAnnotation) {
+        originalBounds = SKRectFromCenterAndSquareSize(NSMakePoint(round(pagePoint.x), round(pagePoint.y)), 0.0);
+        resizeHandle = CMaxXEdgeMask | CMinYEdgeMask;
+    }
+    BOOL draggedAnnotation = NO;
+    NSEvent *lastMouseEvent = theEvent;
+    
+    NSPoint offset = NSMakePoint(pagePoint.x - originalBounds.origin.x, pagePoint.y - originalBounds.origin.y);
+    NSUInteger eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
+    [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(resizeHandle, page)];
+    while (YES) {
+        theEvent = [[self window] nextEventMatchingMask:eventMask];
+        if ([theEvent type] == NSLeftMouseUp) {
+            if(draggedAnnotation){
+                break;
+            }
+            NSSize defaultSize = CGSizeMake(150, 20);
+            defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultSize.width, defaultSize.height) : NSMakeSize(defaultSize.height, defaultSize.width);
+            
+            annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSize(NSMakePoint(round(pagePoint.x), round(pagePoint.y)), defaultSize)];
+            break;
+        } else if ([theEvent type] == NSLeftMouseDragged){
+            if (self.activeAnnotation == nil) {
+                annotation = [self addFormAnnotationWithType:self.annotationType selection:nil page:page bounds:SKRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
+            }
+            lastMouseEvent = theEvent;
+            draggedAnnotation = YES;
+        } else if (self.activeAnnotation == nil){
+            continue;
+        }
+        if (resizeHandle == 0) {
+            [self doMoveAnnotation:self.activeAnnotation withEvent:lastMouseEvent offset:offset];
+        } else {
+            [self doResizeAnnotationWithEvent:lastMouseEvent fromPoint:pagePoint originalBounds:originalBounds resizeHandle:&resizeHandle];
+        }
+        if (resizeHandle == 0)
+            [NSEvent stopPeriodicEvents];
+        
+        if (self.activeAnnotation) {
+            if (draggedAnnotation)
+                [self.activeAnnotation autoUpdateString];
+            
+//            if (shouldAddAnnotation && toolMode == SKNoteToolMode && (annotationMode == SKAnchoredNote || annotationMode == SKFreeTextNote))
+//                [self editActiveAnnotation:self];
+            
+            [self setNeedsDisplayAnnotation:self.activeAnnotation];
+        }
+        
+        // ??? PDFView's delayed layout seems to reset the cursor to an arrow
+        [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
+    }
+}
+
+- (CPDFAnnotation *)addFormAnnotationWithType:(CAnnotationType)type selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds
+{
+    CPDFAnnotation *newAnnotation = nil;
+    BOOL isButtonAddText = NO;
+    NSFont *addFreeTextFont = nil;
+    NSColor *addFreeTextFontColor = nil;
+    
+    BOOL isInitial = NSEqualSizes(bounds.size, NSZeroSize) && selection == nil;
+    if (isInitial) {
+        bounds = SKRectFromCenterAndSize(bounds.origin,[self fetchFormMinSizeValueViaFormType:type]);
+    }
+    NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
+    
+    switch (type) {
+        case CAnnotationTypeRadioButton:
+        {
+            newAnnotation = [[KMPDFAnnotationButtonWidgetSub alloc] initWithDocument:self.document controlType:CPDFWidgetRadioButtonControl];
+            [newAnnotation setBounds:bounds];
+            [self setAnnotationType:CAnnotationTypeRadioButton];
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationRadioButtonWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:[NSColor whiteColor]];
+            }
+            
+            isButtonAddText = [sud boolForKey:@"SKAnnotationRadioButtonWidgetAddTextKey"];
+            if (isButtonAddText) {
+                addFreeTextFontColor = [sud colorForKey:@"SKAnnotationRadioButtonWidgetFontColorKey"];
+                addFreeTextFont = [NSFont fontWithName:[sud stringForKey:@"SKAnnotationRadioButtonWidgetFontNameKey"] size:[sud floatForKey:@"SKAnnotationRadioButtonWidgetFontSizeKey"]];
+            }
+        }
+            break;
+            case CAnnotationTypeCheckBox:
+        {
+            newAnnotation = [[KMPDFAnnotationButtonWidgetSub alloc] initWithDocument:self.document controlType:CPDFWidgetCheckBoxControl];
+            [newAnnotation setBounds:bounds];
+            [self setAnnotationType:CAnnotationTypeCheckBox];
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationCheckBoxWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:[NSColor whiteColor]];
+            }
+            
+            isButtonAddText = [sud boolForKey:@"SKAnnotationCheckBoxWidgetAddTextKey"];
+            if (isButtonAddText) {
+                addFreeTextFontColor = [sud colorForKey:@"SKAnnotationCheckBoxWidgetFontColorKey"];
+                addFreeTextFont = [NSFont fontWithName:[sud stringForKey:@"SKAnnotationCheckBoxWidgetFontNameKey"] size:[sud floatForKey:@"SKAnnotationCheckBoxWidgetFontSizeKey"]];
+            }
+        }
+            break;
+        case CAnnotationTypeComboBox:
+        {
+            newAnnotation = [[KMPDFAnnotationChoiceWidgetSub alloc] initWithDocument:self.document listChoice:NO];
+            [self setAnnotationType:CAnnotationTypeComboBox];
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationChoiceWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:[NSColor clearColor]];
+            }
+            
+            NSColor* fontColor = [sud colorForKey:@"SKAnnotationChoiceWidgetFontColorKey"];
+            if (fontColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFontColor:fontColor];
+            }
+            NSFont *font = [sud fontForNameKey:@"SKAnnotationChoiceWidgetFontNameKey" sizeKey:@"SKAnnotationChoiceWidgetFontSizeKey"];
+            if (font) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFont:font];
+            }
+        }
+            break;
+            
+        case CAnnotationTypeListMenu:
+        {
+            newAnnotation = [[KMPDFAnnotationChoiceWidgetSub alloc] initWithDocument:self.document listChoice:YES];
+            [self setAnnotationType:CAnnotationTypeListMenu];
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationChoiceListWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:[NSColor clearColor]];
+            }
+            
+            NSColor* fontColor = [sud colorForKey:@"SKAnnotationChoiceListWidgetFontColorKey"];
+            if (fontColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFontColor:fontColor];
+            }
+            
+            NSFont *font = [sud fontForNameKey:@"SKAnnotationChoiceListWidgetFontNameKey" sizeKey:@"SKAnnotationChoiceListWidgetFontSizeKey"];
+            if (font) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFont:font];
+            }
+        }
+            break;
+            
+        case CAnnotationTypeActionButton:
+        {
+            newAnnotation = [[KMPDFAnnotationButtonWidgetSub alloc] initWithDocument:self.document controlType:CPDFWidgetPushButtonControl];
+            [newAnnotation setBounds:bounds];
+            [self setAnnotationType:CAnnotationTypeActionButton];
+
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationActionButtonWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)newAnnotation setBackgroundColor:[NSColor whiteColor]];
+            }
+            
+            NSColor* fontColor = [sud colorForKey:@"SKAnnotationActionButtonWidgetFontColorKey"];
+            if (fontColor) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFontColor:fontColor];
+            }
+            
+            NSFont *font = [sud fontForNameKey:@"SKAnnotationActionButtonWidgetFontNameKey" sizeKey:@"SKAnnotationActionButtonWidgetFontSizeKey"];
+            if (font) {
+                [(CPDFWidgetAnnotation *)newAnnotation setFont:font];
+            }
+            [(CPDFButtonWidgetAnnotation *)newAnnotation setCaption:NSLocalizedString(@"Submit", nil)];
+        }
+            break;
+        case CAnnotationTypeTextField:{
+            KMPDFAnnotationTextWidgetSub *textWidget = [[KMPDFAnnotationTextWidgetSub alloc] initWithDocument:self.document];
+            textWidget.stringValue = NSLocalizedString(@"", nil);
+            CPDFBorder *border = [[CPDFBorder alloc] initWithStyle:CPDFBorderStyleSolid lineWidth:0 dashPattern:nil];
+            textWidget.border = border;
+            NSColor* backgroundColor = [sud colorForKey:@"SKAnnotationTextWidgetBackgroundColorKey"];
+            if (backgroundColor) {
+                [(CPDFWidgetAnnotation *)textWidget setBackgroundColor:backgroundColor];
+            } else {
+                [(CPDFWidgetAnnotation *)textWidget setBackgroundColor:[NSColor clearColor]];
+            }
+            
+            NSColor* fontColor = [sud colorForKey:@"SKAnnotationTextWidgetFontColorKey"];
+            if (fontColor) {
+                [(CPDFWidgetAnnotation *)textWidget setFontColor:fontColor];
+            }
+            textWidget.alignment = [sud integerForKey:@"SKAnnotationTextWidgetAlignmenKey"];
+            NSFont *font = [sud fontForNameKey:@"SKAnnotationTextWidgetFontNameKey" sizeKey:@"SKAnnotationTextWidgetFontSizeKey"];
+            if (font) {
+                [(CPDFWidgetAnnotation *)textWidget setFont:font];
+            }
+            textWidget.isMultiline = [sud boolForKey:@"SKAnnotationTextMultilineKey"];
+            newAnnotation = textWidget;
+        }
+            break;
+        case CAnnotationTypeSignature:{
+            if (@available(macOS 10.13, *)) {
+                KMAnnotationFromSignature *signature = [[KMAnnotationFromSignature alloc] initWithDocument:self.document];
+                signature.backgroundColor = [NSColor clearColor];
+                signature.fieldName = @"signature";
+                newAnnotation = signature;
+            }
+        }
+            break;
+        default:
+            break;
+    }
+    if (newAnnotation) {
+        [newAnnotation registerUserName];
+        if (type == CAnnotationTypeRadioButton) {
+            [(CPDFWidgetAnnotation *)newAnnotation setFieldName:@"Group1"];
+            [(CPDFButtonWidgetAnnotation *)newAnnotation setOnStateValue:[NSString stringWithFormat:@"Radio Button_%@",[self fetchFieldName]]];
+        } else {
+            NSString *annotationType = @"";
+            if (type == CAnnotationTypeCheckBox) {
+                annotationType = @"Check Box";
+            } else if (type == CAnnotationTypeTextField) {
+                annotationType = @"Text Field";
+            } else if (type == CAnnotationTypeComboBox) {
+                annotationType = @"Combo Box";
+            } else if (type == CAnnotationTypeListMenu) {
+                annotationType = @"List Box";
+            } else if (type == CAnnotationTypeActionButton) {
+                annotationType = @"Button";
+            } else if (type == CAnnotationTypeSignature) {
+                annotationType = @"Signature";
+            }
+            [(CPDFWidgetAnnotation *)newAnnotation setFieldName:[NSString stringWithFormat:@"%@_%@", annotationType,[self fetchFieldName]]];
+        }
+        [self addAnnotation:newAnnotation toPage:page];
+        [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
+        
+        [self updateActiveAnnotations:@[newAnnotation]];
+        self.lastAddAnnotationPoint = newAnnotation.bounds.origin;
+        
+        if (isButtonAddText) {
+            NSString *fieldString = [(CPDFWidgetAnnotation *)newAnnotation fieldName];
+            if ([(CPDFButtonWidgetAnnotation *)newAnnotation controlType] == CPDFWidgetRadioButtonControl) {
+                if (@available(macOS 10.13, *)) {
+                    fieldString = newAnnotation.buttonWidgetStateString;
+                }
+            }
+            NSString *annotationField = [NSString stringWithFormat:@"%@_AddText", fieldString];
+//            CPDFFreeTextAnnotation *freeText = [self addWidgetRelatedAnnotationFreeText:annotationField];
+//            [freeText setFontColor:addFreeTextFontColor];
+//            [freeText setFont:addFreeTextFont];
+        }
+        return newAnnotation;
+    } else {
+        return nil;
+    }
+}
+
 #pragma mark - Operation
 
 -(CGRect)adjustFreetText:(CPDFFreeTextAnnotation *)freeTextAn rect:(CGRect)rect {

+ 48 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Form.swift

@@ -0,0 +1,48 @@
+//
+//  CPDFListView+Event.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/1/31.
+//
+
+import Foundation
+
+
+extension CPDFListView {
+    
+    // MARK: Edit
+    
+    @objc func fetchFieldName() -> String {
+        let formatter = DateFormatter()
+        formatter.dateFormat = "YYYY-MM-dd hh:mm:ss"
+        let dateString = formatter.string(from: Date())
+        return "\(dateString) \(Int.random(in: 0..<10000))"
+    }
+    
+    @objc func fetchFormMinSizeValueViaFormType(_ type: CAnnotationType) -> CGSize {
+        var returnSize = CGSize.zero
+        
+        switch type {
+        case .radioButton, .checkBox:
+            returnSize.width = 20
+            returnSize.height = 20
+        case .textField:
+            returnSize.width = 25
+            returnSize.height = 15
+        case .comboBox:
+            returnSize.width = 50
+            returnSize.height = 25
+        case .listMenu:
+            returnSize.width = 50
+            returnSize.height = 30
+        case .actionButton:
+            returnSize.width = 50
+            returnSize.height = 25
+        default:
+            break
+        }
+        
+        return returnSize
+    }
+
+}

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

@@ -1146,6 +1146,18 @@
 		9FE0BBF32B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FE0BBEF2B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib */; };
 		9FE0BBF42B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FE0BBEF2B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib */; };
 		9FE0BBF52B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9FE0BBEF2B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib */; };
+		9FF0D0532B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */; };
+		9FF0D0542B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */; };
+		9FF0D0552B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */; };
+		9FF0D0582B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0572B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift */; };
+		9FF0D0592B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0572B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift */; };
+		9FF0D05A2B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D0572B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift */; };
+		9FF0D05C2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05B2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift */; };
+		9FF0D05D2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05B2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift */; };
+		9FF0D05E2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05B2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift */; };
+		9FF0D0602B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05F2B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift */; };
+		9FF0D0612B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05F2B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift */; };
+		9FF0D0622B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF0D05F2B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift */; };
 		9FF816DD2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF816DC2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift */; };
 		9FF816DE2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF816DC2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift */; };
 		9FF816DF2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF816DC2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift */; };
@@ -5407,6 +5419,10 @@
 		9FE0BBEA2B0F242C00CD1CAC /* NSUserDefaults_KMExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSUserDefaults_KMExtension.swift; sourceTree = "<group>"; };
 		9FE0BBEE2B0F2FB000CD1CAC /* KMAnnotationLineWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationLineWindowController.swift; sourceTree = "<group>"; };
 		9FE0BBEF2B0F2FB000CD1CAC /* KMAnnotationLineWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationLineWindowController.xib; sourceTree = "<group>"; };
+		9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CPDFListView+Form.swift"; sourceTree = "<group>"; };
+		9FF0D0572B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFAnnotationButtonWidgetSub.swift; sourceTree = "<group>"; };
+		9FF0D05B2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFAnnotationChoiceWidgetSub.swift; sourceTree = "<group>"; };
+		9FF0D05F2B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPDFAnnotationTextWidgetSub.swift; sourceTree = "<group>"; };
 		9FF816DC2AFA5B8E0087EFC5 /* KMAnnotationTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationTableViewController.swift; sourceTree = "<group>"; };
 		9FF816E02AFA5BA80087EFC5 /* KMAnnotationTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMAnnotationTableViewController.xib; sourceTree = "<group>"; };
 		9FF816E52AFA5D650087EFC5 /* KMTableAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMTableAnnotation.swift; sourceTree = "<group>"; };
@@ -8024,6 +8040,16 @@
 			path = WindowController;
 			sourceTree = "<group>";
 		};
+		9FF0D0562B6A431E0018A732 /* Form */ = {
+			isa = PBXGroup;
+			children = (
+				9FF0D0572B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift */,
+				9FF0D05B2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift */,
+				9FF0D05F2B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift */,
+			);
+			path = Form;
+			sourceTree = "<group>";
+		};
 		9FF816E42AFA5D400087EFC5 /* Table */ = {
 			isa = PBXGroup;
 			children = (
@@ -10443,6 +10469,7 @@
 		BB2C6A7328F2656000478A33 /* PDFWindowController */ = {
 			isa = PBXGroup;
 			children = (
+				9FF0D0562B6A431E0018A732 /* Form */,
 				ADA08A8829F21A53009B2A7B /* Tools */,
 				ADBC375B29CC619200D93208 /* ReadModelView */,
 				9FDD0F58294AB3E7000C4DAD /* ViewController */,
@@ -11286,6 +11313,7 @@
 				F3F0B27229B8ACD000722957 /* CPDFListViewDragObject.m */,
 				F36AD77529642FE80015AD53 /* CPDFListView+UndoManager.h */,
 				F36AD77629642FE80015AD53 /* CPDFListView+UndoManager.m */,
+				9FF0D0522B6A3EE40018A732 /* CPDFListView+Form.swift */,
 			);
 			path = CPDFListViewExtension;
 			sourceTree = "<group>";
@@ -14397,6 +14425,7 @@
 				AD3AAD7D2B0DFFB100DE5FE7 /* KMAngleIndicateView.swift in Sources */,
 				9FF816E62AFA5D650087EFC5 /* KMTableAnnotation.swift in Sources */,
 				9F0201652A176AF200C9B673 /* KMDottedLineView.swift in Sources */,
+				9FF0D0582B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */,
 				BBBB6CDA2AD15B900035AA66 /* CPDFFreeTextAnnotation+PDFListView.swift in Sources */,
 				BB1B0ABF2B4FC6E900889528 /* KMGuideInfoWindowController.swift in Sources */,
 				BB5DF1F12959C9F00025CDA1 /* KMHeaderFooterPropertyMainController.swift in Sources */,
@@ -14965,6 +14994,7 @@
 				BB6D2DAB2B674D7900624C24 /* CPDFPage+KMExtension.swift in Sources */,
 				BB88107C2B4F7A1F00AFA63E /* KMActivityALertViewController.m in Sources */,
 				BBC3482E29559E12008D2CD1 /* KMBackgroundModel.swift in Sources */,
+				9FF0D0532B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */,
 				BBCE57182A72723600508EFC /* NSResponder+KMExtension.swift in Sources */,
 				ADE3C19F29A3894900793B13 /* KMSearchTableRowView.swift in Sources */,
 				9F1F82C3292F113A0092C4B4 /* KMHomeDragView.swift in Sources */,
@@ -14972,6 +15002,7 @@
 				BBB14A5F297929BD00936EDB /* KMRedactPageRangeWindowController.swift in Sources */,
 				ADA08A8A29F21A53009B2A7B /* KMPDFViewAnnotationOnceModeStore.swift in Sources */,
 				BBBE209B2B21E5F100509C4E /* KMAlertTool.swift in Sources */,
+				9FF0D05C2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */,
 				BB78EAAA2B561F9700121691 /* KMFullScreenWindow.swift in Sources */,
 				89E4E7822967BF5A002DBA6F /* KMCustomizeStampViewController.m in Sources */,
 				9F8DDF2D2924B855006CDC73 /* KMPDFToolsViewController.swift in Sources */,
@@ -15067,6 +15098,7 @@
 				9FAAA32A290BD01D0046FFCE /* KMHomeHistoryFileViewController.swift in Sources */,
 				BB146FB7299DC0D100784A6A /* GTLRRuntimeCommon.m in Sources */,
 				BB3A429E2B4BF03A006D0642 /* KMSystemPDFMenu.swift in Sources */,
+				9FF0D0602B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */,
 				BBFE6E6D2930D9C600142C01 /* KMMergeSettingWindowController.swift in Sources */,
 				9F8539CB29430BF300DF644E /* KMBrowserWindowController.swift in Sources */,
 				9F0CB5192986568000007028 /* KMDesignToken+BorderRadiusTopRight.swift in Sources */,
@@ -15560,6 +15592,7 @@
 				BBC3482529559506008D2CD1 /* KMBackgroundManager.swift in Sources */,
 				BB276A4C2B0375FE00AB5578 /* KMOperationQueue.swift in Sources */,
 				ADFA8F0A2B579945002595A4 /* KMSearchFindView.swift in Sources */,
+				9FF0D0542B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */,
 				BB1B0AFC2B4FC6E900889528 /* KMCustomColorGuideView.swift in Sources */,
 				AD867FC629DFFBC400F00440 /* KMAnnotationOutlineRowView.swift in Sources */,
 				BB4EEF2E29763EE7003A3537 /* KMRedactBaseWindowController.swift in Sources */,
@@ -15906,6 +15939,7 @@
 				9F0CB4FA298655E500007028 /* KMDesignToken+Border.swift in Sources */,
 				ADD1B6E92946C02600C3FFF7 /* KMPrintChoosePageSizeMultipageView.swift in Sources */,
 				9F0CB4602966C9E200007028 /* KMFormPropertPanelViewController.swift in Sources */,
+				9FF0D0612B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */,
 				AD85D1AE2AF09C79000F4D28 /* KMHomeQuickToolsWindowCollectionViewItem.swift in Sources */,
 				BB3A669F2B0752A800575343 /* KMTocOutlineView.swift in Sources */,
 				BB6719F62AD2C949003D44D5 /* CPDFRedactAnnotation+PDFListView.swift in Sources */,
@@ -16076,6 +16110,7 @@
 				BB1B0AD82B4FC6E900889528 /* KMOpenFileGuideProperty.swift in Sources */,
 				BBB14A60297929BD00936EDB /* KMRedactPageRangeWindowController.swift in Sources */,
 				ADA08A8B29F21A53009B2A7B /* KMPDFViewAnnotationOnceModeStore.swift in Sources */,
+				9FF0D05D2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */,
 				BB853C872AF8BC12009C20C1 /* KMAddPasswordOperationQueue.swift in Sources */,
 				89E4E7832967BF5A002DBA6F /* KMCustomizeStampViewController.m in Sources */,
 				BB897252294C3F660045787C /* KMMenuTableView.swift in Sources */,
@@ -16110,6 +16145,7 @@
 				BB4A94A52B04DA0C00940F8B /* KMGOCRManagerNew.swift in Sources */,
 				BB0A823329C00400002C5C1B /* KMCommonEnum.swift in Sources */,
 				BB3198132AC5142900107371 /* NSMenu+KMExtension.swift in Sources */,
+				9FF0D0592B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */,
 				ADB2D6FA294882AE0029D2B3 /* KMTextFieldStepperView.swift in Sources */,
 				BB1969CE2B2833DA00922736 /* KMProgressWindowController.swift in Sources */,
 				BBC3483C2955A60B008D2CD1 /* KMBackgroundPropertyInfoController.swift in Sources */,
@@ -16544,6 +16580,7 @@
 				BBB9B32A299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization+Keychain.m in Sources */,
 				BB96A0BA2AFCE45800559E24 /* WaitingView.swift in Sources */,
 				BB146FB0299DC0D100784A6A /* GTLRService.m in Sources */,
+				9FF0D05E2B6A4C210018A732 /* KMPDFAnnotationChoiceWidgetSub.swift in Sources */,
 				BB2F18482A0C7E250003F65E /* KMConvertBaseView.swift in Sources */,
 				AD867FC729DFFBC400F00440 /* KMAnnotationOutlineRowView.swift in Sources */,
 				9FA607E028FD4C9F00B46586 /* KMHomePopViewController.swift in Sources */,
@@ -16722,6 +16759,7 @@
 				BBA388152AEF9A42004FE93F /* NSWindow+KMExtension.swift in Sources */,
 				9FD0D2A92AD4EFB000DA3FF8 /* KMSavePanelAccessoryController.swift in Sources */,
 				9F1FE4D129406E4700E952CA /* CTTabController.m in Sources */,
+				9FF0D0622B6A5DCF0018A732 /* KMPDFAnnotationTextWidgetSub.swift in Sources */,
 				9F8539E029470A0700DF644E /* KMTabStripView.swift in Sources */,
 				BBA8B7AC2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */,
 				BB146FDD299DC0D100784A6A /* GTLRDriveService.m in Sources */,
@@ -17045,6 +17083,7 @@
 				BBFE6E89293210AB00142C01 /* KMCompressCellView.swift in Sources */,
 				ADDEEA702AD3E16100EF675D /* KMSigntureViewItem.swift in Sources */,
 				ADDEEA842AD4DAB200EF675D /* KMSignatureWindowController.swift in Sources */,
+				9FF0D0552B6A3EE40018A732 /* CPDFListView+Form.swift in Sources */,
 				BB853C7F2AF8B5D6009C20C1 /* KMBatchOperateAddPasswordViewController.swift in Sources */,
 				AD3AAD252B0B6F9E00DE5FE7 /* KMCompareContentView.swift in Sources */,
 				BB147040299DC0D200784A6A /* OIDEndSessionResponse.m in Sources */,
@@ -17231,6 +17270,7 @@
 				9F1FE4CE29406E4700E952CA /* CTTabContentsController.m in Sources */,
 				9F0CB4EF298655A800007028 /* KMDesignToken+PaddingLeft.swift in Sources */,
 				BB9695B429BDA46500FD68D3 /* SKLocalization.m in Sources */,
+				9FF0D05A2B6A43750018A732 /* KMPDFAnnotationButtonWidgetSub.swift in Sources */,
 				9F3D819029A22AD90087B5AD /* Date+KMExtensions.swift in Sources */,
 				BB897222294AF9080045787C /* KMWatermarkAdjectiveTopBarView.swift in Sources */,
 				9F8DDF362924DA6B006CDC73 /* KMPDFToolsCollectionView.swift in Sources */,