소스 검색

【2025】【数字签名】移除数字签名代码

dinglingui 2 달 전
부모
커밋
b1eaffc046

+ 0 - 113
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.h

@@ -1,113 +0,0 @@
-//
-//  CPDFDigtalView.h
-//  PDF Reader Pro Edition
-//
-//  Created by Niehaoyu on 2023/10/10.
-//
-
-#import <ComPDFKit/ComPDFKit.h>
-#import "NSEvent+PDFListView.h"
-#import "CPDFSelection+PDFListView.h"
-#import "CPDFListView.h"
-
-//#import <PDF_Reader_Pro-Swift.h>
-//typedef NS_ENUM(NSInteger, CAnnotationType) {
-//    CAnnotationTypeUnkown = 0,
-//    CAnnotationTypeAnchored,
-//    CAnnotationTypeLink,
-//    CAnnotationTypeFreeText,
-//    CAnnotationTypeLine,
-//    CAnnotationTypeArrow,
-//    CAnnotationTypeSquare,
-//    CAnnotationTypeCircle,
-//    /*CAnnotationTypePolyGon,*/
-//    /*CAnnotationTypePolyLine,*/
-//    CAnnotationTypeHighlight,
-//    CAnnotationTypeUnderline,
-////    CAnnotationTypeSquiggly,
-//    CAnnotationTypeStrikeOut,
-//    CAnnotationTypeStamp,
-//    CAnnotationTypeSignSignature,
-//    /*CAnnotationTypeCaret,*/
-//    CAnnotationTypeInk,
-//    /*CAnnotationTypePopUp,*/
-//    /*CAnnotationTypeFileattachment,*/
-//    /*CAnnotationTypeSound,*/
-//    /*CAnnotationTypeMovie,*/
-//    CAnnotationTypeRedact,
-//    CAnnotationTypeEraser,
-//    CAnnotationTypeAddText,
-//    CAnnotationTypeAddImage,
-//    
-//    CAnnotationTypeRadioButton = 100,
-//    CAnnotationTypeCheckBox,
-//    CAnnotationTypeTextField,
-//    CAnnotationTypeComboBox,
-//    CAnnotationTypeListMenu,
-//    CAnnotationTypeActionButton,
-//    CAnnotationTypeSignature,
-//    
-//    CAnnotationTypeSignText = 200,
-//    CAnnotationTypeSignFalse,
-//    CAnnotationTypeSignTure,
-//    CAnnotationTypeSignCircle,
-//    CAnnotationTypeSignLine,
-//    CAnnotationTypeSignDot,
-//    CAnnotationTypeSignConfig,
-//    CAnnotationTypeSignDate,
-//};
-
-//typedef NS_OPTIONS(NSUInteger, CRectEdges) {
-//    CNoEdgeMask = 0,
-//    CMinXEdgeMask = (1UL << 0),
-//    CMinYEdgeMask = (1UL << 1),
-//    CMaxXEdgeMask = (1UL << 2),
-//    CMaxYEdgeMask = (1UL << 3),
-//    CEditInEdgeMask = (1UL << 4),
-//};
-
-//enum {
-//    CDragArea = 1 << 16,
-//    CResizeUpDownArea = 1 << 17,
-//    CReadingBarArea = 1 << 18,
-//    CSpecialToolArea = 1 << 19,
-//    CResizeMinXMinY = 1 << 20,
-//    CResizeMidXMinY = 1 << 21,
-//    CResizeMaxXMinY = 1 << 22,
-//    CResizeMinXMidY = 1 << 23,
-//    CResizeMaxXMaxY = 1 << 24,
-//    CResizeMidXMaxY = 1 << 25,
-//    CResizeMinXMaxY =  1 << 26,
-//    CResizeMaxXMidY = 1 << 27,
-//};
-
-
-@protocol CPDFDigtalViewDelegate;
-
-@interface CPDFDigtalView : CPDFView
-
-@property (nonatomic, assign) CAnnotationType annotationType;
-
-@property (nonatomic, readonly) CPDFAnnotation * activeAnnotation;
-
-@property (nonatomic, retain) NSMutableArray *activeAnnotations;
-
-@property (nonatomic, retain) NSMutableArray *selectAnnotations;
-
-@property (nonatomic, assign) id<CPDFDigtalViewDelegate>pdfListViewDelegate;
-
-@property (nonatomic, retain) NSArray *signatures;
-
-@end
-
- 
-@protocol CPDFDigtalViewDelegate <NSObject>
-
-@optional
-
-- (void)PDFListViewAddAnnotation:(CPDFDigtalView *)pdfListView forAddAnnotation:(CPDFAnnotation *)annotation inPage:(CPDFPage *)pdfPage;
-
-- (void)PDFListViewEditAnnotation:(CPDFDigtalView *)pdfListView forAnnotation:(CPDFAnnotation *)anotation;
-
-- (void)PDFListViewDeleteAnnotation:(CPDFDigtalView *)pdfListView forAnnotation:(CPDFAnnotation *)anotation;
-@end

+ 0 - 819
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/CPDFDigtalView.m

@@ -1,819 +0,0 @@
-//
-//  CPDFDigtalView.m
-//  PDF Reader Pro Edition
-//
-//  Created by Niehaoyu on 2023/10/10.
-//
-
-#import "CPDFDigtalView.h"
-#import "CPDFAnnotation+PDFListView.h"
-#import "NSGeometry+PDFListView.h"
-#import "CPDFListViewConfig.h"
-
-#define HANDLE_SIZE 4.0
-
-#define MIN_NOTE_SIZE 8.0
-
-@implementation CPDFDigtalView
-
-- (void)drawRect:(NSRect)dirtyRect {
-    [super drawRect:dirtyRect];
-    
-    // Drawing code here.
-}
-
-- (id)initWithFrame:(NSRect)frameRect {
-    self = [super initWithFrame:frameRect];
-    if (self) {
-        [self setUp];
-    }
-    return self;
-}
-
-- (id)initWithCoder:(NSCoder *)decoder {
-    self = [super initWithCoder:decoder];
-    if (self) {
-        [self setUp];
-    }
-    return self;
-}
-
-- (void)setUp {
-    
-    self.annotationType = CAnnotationTypeSignature;
-    self.activeAnnotations = [NSMutableArray array];
-}
-
-- (void)setDocument:(CPDFDocument *)document {
-    [super setDocument:document];
-    
-    NSArray *signatures = document.signatures;
-    
-    NSMutableArray *tempArr = [NSMutableArray array];
-    for (CPDFSignature *signature in signatures) {
-        if(signature.signers.count > 0) {
-            [signature verifySignatureWithDocument:document];
-            [tempArr addObject:signature];
-        }
-    }
-    self.signatures = tempArr;
-}
-
-- (CPDFPage *)pageAndPoint:(NSPoint *)point forEvent:(NSEvent *)event nearest:(BOOL)nearest {
-    NSPoint p = [self convertPoint:[event locationInWindow] fromView:nil];
-    CPDFPage *page = [self pageForPoint:p nearest:nearest];
-    if (page && point)
-        *point = [self convertPoint:p toPage:page];
-    return page;
-}
-
-- (void)setCursorForMouse:(NSEvent *)theEvent {
-    if (theEvent == nil)
-        theEvent = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
-                                      location:[[self window] mouseLocationOutsideOfEventStream]
-                                 modifierFlags:[NSEvent standardPDFListViewModifierFlags]
-                                     timestamp:0
-                                  windowNumber:[[self window] windowNumber]
-                                       context:nil
-                                   eventNumber:0
-                                    clickCount:1
-                                      pressure:0.0];
-    [self setCursorForAreaOfInterest:[self areaOfInterestForMouse:theEvent]];
-}
-
-- (CPDFAnnotation *)activeAnnotation {
-    return self.activeAnnotations.lastObject;
-}
-
-- (void)mouseDown:(NSEvent *)theEvent {
-    [self setCursorForMouse:theEvent];
-    
-    NSPoint point = NSZeroPoint;
-
-    CPDFAreaOfInterest area = [self areaOfInterestForMouse:theEvent];
-    NSPoint newpoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
-    area = [self areaOfInterestForPoint:newpoint];
-
-    CPDFAnnotation *newActiveAnnotation = nil;
-    if ([[self document] isLocked]) {
-        [super mouseDown:theEvent];
-    } else if ([self doClickAnnotationWithEvent:theEvent forAnnotation:&newActiveAnnotation]) {
-        [self doDragAnnotationWithEvent:theEvent forAnnotation:newActiveAnnotation];
-    } else {
-        [self doDragAddAnnotationWithEvent:theEvent];
-    }
-    
-}
-
-- (BOOL)doClickAnnotationWithEvent:(NSEvent *)theEvent forAnnotation:(CPDFAnnotation **)annotation{
-    CPDFAnnotation *newActiveAnnotation = nil;
-    NSPoint point = NSZeroPoint;
-    CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
-    
-    
-    NSMutableArray *currentActiveAnnotations = [NSMutableArray array];
-    for (CPDFAnnotation *an in self.activeAnnotations) {
-        if([an.page isEqual:page]) {
-            if(!([an isKindOfClass:[CPDFMarkupAnnotation class]] || [an isKindOfClass:[CPDFTextAnnotation class]])) {
-                [currentActiveAnnotations addObject:an];
-            }
-        }
-    }
-    
-    newActiveAnnotation = [self doSelectAnnotationWithEvent:theEvent];
-    *annotation = newActiveAnnotation;
-    return !!newActiveAnnotation;
-}
-
-- (CPDFAnnotation *)doSelectAnnotationWithEvent:(NSEvent *)theEvent {
-    CPDFAnnotation *newActiveAnnotation = nil;
-    NSPoint point = NSZeroPoint;
-    CPDFPage *page = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
-    id annotations = [page annotations];
-    
-    for (CPDFAnnotation *annotation in annotations) {
-        if ([annotation hitTest:point] && [annotation annotationShouldDisplay] ) {
-            newActiveAnnotation = annotation;
-            break;
-        }
-    }
-    
-    return newActiveAnnotation;
-}
-
-- (void)doDragAnnotationWithEvent:(NSEvent *)theEvent forAnnotation:(CPDFAnnotation *)newActiveAnnotation {
-    BOOL isContains = YES;
-    if (self.activeAnnotations.count == 0 || ![self.activeAnnotations containsObject:newActiveAnnotation]) {
-        isContains = NO;
-    }
-    
-    NSRect originalBounds = [newActiveAnnotation bounds];
-    BOOL isLine = [newActiveAnnotation isKindOfClass:[CPDFLineAnnotation class]];
-    NSPoint pagePoint = NSZeroPoint;
-    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
-    NSPoint originalStartPoint = NSZeroPoint;
-    NSPoint originalEndPoint = NSZeroPoint;
-    
-    BOOL draggedAnnotation = NO;
-    NSEvent *lastMouseEvent = theEvent;
-    NSPoint offset = CPDFListViewSubstractPoints(pagePoint, originalBounds.origin);
-    NSUInteger eventMask = NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged;
-
-    CGFloat mouseOffset = [self unitWidthOnPage:page];
-    
-    
-    while (YES) {
-        theEvent = [[self window] nextEventMatchingMask:eventMask];
-        if ([theEvent type] == NSEventTypeLeftMouseUp) {
-            if(draggedAnnotation) {
-                if (!isContains)
-                    [self.selectAnnotations removeAllObjects];
-            } else {
-                if(self.activeAnnotations.count == 1 &&
-                   self.activeAnnotation == newActiveAnnotation &&
-                   ([newActiveAnnotation isKindOfClass:[CPDFTextAnnotation class]] || [newActiveAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]])) {
-                    [self editAnnotation:newActiveAnnotation];
-                    break;
-                }
-                
-                if(!isContains) {
-                    [self updateActiveAnnotations:@[newActiveAnnotation]];
-                }
-                [self editAnnotation:newActiveAnnotation];
-            }
-            [self setNeedsDisplayAnnotationViewForPage:page];
-            break;
-        } else if ([theEvent type] == NSEventTypeLeftMouseDragged) {
-            NSPoint point = NSZeroPoint;
-            [self pageAndPoint:&point forEvent:theEvent nearest:YES];
-            CGRect zRect = CGRectMake(pagePoint.x-2*mouseOffset, pagePoint.y-2*mouseOffset, 4*mouseOffset, 4*mouseOffset);
-            if (CGRectContainsPoint(zRect, point)) {continue;}
-            
-            lastMouseEvent = theEvent;
-            draggedAnnotation = YES;
-
-            if(!isContains) {
-                [self dragAnnotationReferenceLine:newActiveAnnotation];
-                
-                [self.selectAnnotations removeAllObjects];
-                [self.selectAnnotations addObject:newActiveAnnotation];
-                
-                [self doMoveAnnotation:newActiveAnnotation withEvent:lastMouseEvent offset:offset];
-            } else {
-                
-                if ([newActiveAnnotation isKindOfClass:[CPDFStampAnnotation class]] ||
-                    [newActiveAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]] ||
-                    [newActiveAnnotation isKindOfClass:[CPDFSignatureAnnotation class]] ||
-                    [newActiveAnnotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
-                    [newActiveAnnotation updateAppearanceStream];
-                }
-            }
-            [self dragAnnotationReferenceLine:newActiveAnnotation];
-            
-            [self setNeedsDisplayAnnotationViewForPage:page];
-        }
-    }
-    
-    [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
-    
-}
-
-
-- (void)doMoveAnnotation:(CPDFAnnotation *)activeAnnotation withEvent:(NSEvent *)theEvent offset:(NSPoint)offset {
-    // Move annotation.
-    [[[self documentView] contentView] autoscroll:theEvent];
-    
-    NSPoint point = NSZeroPoint;
-    CPDFPage *newActivePage = [self pageAndPoint:&point forEvent:theEvent nearest:YES];
-    
-    if (newActivePage) { // newActivePage should never be nil, but just to be sure
-        if (newActivePage != [activeAnnotation page]) {
-            return;
-        }
-        
-        NSRect newBounds = [activeAnnotation bounds];
-        newBounds.origin = CPDFListViewIntegralPoint(CPDFListViewSubstractPoints(point, offset));
-        // constrain bounds inside page bounds
-        
-    }
-}
-
-- (void)dragAnnotationReferenceLine:(CPDFAnnotation *)annotation {
-    
-}
-
-- (void)editAnnotation:(CPDFAnnotation *)annotation {
-    if ([annotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
-        [self editAnnotationFreeText:(CPDFFreeTextAnnotation *)annotation];
-        [[self window] makeFirstResponder:self];
-        
-        [self setNeedsDisplayAnnotation:annotation];
-    } else {
-        if([annotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
-            if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewEditAnnotation:forAnnotation:)]) {
-                [self.pdfListViewDelegate PDFListViewEditAnnotation:self forAnnotation:annotation];
-            }
-        }
-    }
-}
-
-
-- (void)doDragAddAnnotationWithEvent:(NSEvent *)theEvent {
-    NSPoint pagePoint = NSZeroPoint;
-    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
-
-    NSRect originalBounds = CGRectZero;
-    CGFloat mouseOffset = [self unitWidthOnPage:page];
-//    [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(CMaxXEdgeMask | CMinYEdgeMask, page)];
-
-    CPDFAnnotation *annotation = nil;
-    
-    originalBounds = CPDFListViewRectFromCenterAndSquareSize(CPDFListViewIntegralPoint(pagePoint), 0.0);
-    CRectEdges resizeHandle = CMaxXEdgeMask | CMinYEdgeMask;
-    
-    BOOL draggedAnnotation = NO;
-    NSEvent *lastMouseEvent = theEvent;
-    NSUInteger eventMask = NSEventMaskLeftMouseUp | NSEventMaskLeftMouseDragged;
-    while (YES) {
-        theEvent = [[self window] nextEventMatchingMask:eventMask];
-        if ([theEvent type] == NSEventTypeLeftMouseUp) {
-            if (!draggedAnnotation) {
-                if (annotation) {
-                    break;
-                }
-                if(CAnnotationTypeLine == self.annotationType ||
-                   CAnnotationTypeArrow == self.annotationType) {
-                    
-                } else {
-                    
-                    CGFloat defaultWidth = 72;
-                    CGFloat defaultHeight = 32;
-                    NSSize defaultSize = ([page rotation] % 180 == 0) ? NSMakeSize(defaultWidth, defaultHeight) : NSMakeSize(defaultHeight, defaultWidth);
-                    CGRect bounds = CGRectZero;
-                   
-                    bounds = CPDFListViewRectFromCenterAndSize(CPDFListViewIntegralPoint(pagePoint), defaultSize);
-                    
-                    bounds = CPDFListViewConstrainRect(bounds, page.bounds,[CPDFListViewConfig defaultManager].annotationBorderOffset.floatValue);
-                    annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:bounds];
-                    originalBounds = [annotation bounds];
-                    
-                    if(annotation) {
-                        [self updateActiveAnnotations:@[annotation]];
-                        [self setNeedsDisplayAnnotation:annotation];
-                    } else if(self.activeAnnotations.count >0) {
-                        [self updateActiveAnnotations:@[]];
-                        [self setNeedsDisplayAnnotationViewForPage:page];
-                    }
-                }
-            } else {
-                
-            }
-            
-            break;
-        } else if ([theEvent type] == NSEventTypeLeftMouseDragged) {
-
-            CGPoint zPoint = pagePoint;
-            [self pageAndPoint:&zPoint forEvent:theEvent nearest:YES];
-            CGRect zRect = CGRectMake(pagePoint.x-2*mouseOffset, pagePoint.y-2*mouseOffset, 4*mouseOffset, 4*mouseOffset);
-            if (CGRectContainsPoint(zRect, zPoint)) {continue;}
-            
-            if (annotation == nil)
-                annotation = [self addAnnotationWithType:self.annotationType selection:nil page:page bounds:CPDFListViewRectFromCenterAndSquareSize(originalBounds.origin, 0.0)];
-            
-            if(annotation) {
-                [self updateActiveAnnotations:@[annotation]];
-            } else if(self.activeAnnotations.count >0) {
-                [self updateActiveAnnotations:@[]];
-                [self setNeedsDisplayAnnotationViewForPage:page];
-            }
-            lastMouseEvent = theEvent;
-            draggedAnnotation = YES;
-            
-            [self setNeedsDisplayAnnotationViewForPage:page];
-        }
-        [self doResizeAnnotationWithEvent:lastMouseEvent fromPoint:pagePoint originalBounds:originalBounds resizeHandle:&resizeHandle];
-    }
-    if (annotation) {
-        [self setNeedsDisplayAnnotation:annotation];
-        
-        if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewAddAnnotation:forAddAnnotation:inPage:)]) {
-            [self.pdfListViewDelegate PDFListViewAddAnnotation:self forAddAnnotation:annotation inPage:page];
-        }
-    }
-    
-    [self performSelector:@selector(setCursorForMouse:) withObject:theEvent afterDelay:0];
-}
-
-- (void)setNeedsDisplayAnnotation:(CPDFAnnotation *)annotation {
-    if (annotation) {
-        [self setNeedsDisplayAnnotationViewForPage:annotation.page];
-    } else {
-        [self setNeedsDisplayAnnotationViewForVisiblePages];
-    }
-}
-
-- (CGFloat)unitWidthOnPage:(CPDFPage *)page {
-    return NSWidth([self convertRect:NSMakeRect(0.0, 0.0, 1.0, 1.0) toPage:page]);
-}
-
-
-- (CPDFAnnotation *)addAnnotationWithType:(CAnnotationType)annotationType selection:(CPDFSelection *)selection page:(CPDFPage *)page bounds:(NSRect)bounds {
-    CPDFAnnotation *annotation = nil;
-    
-    NSString *text = [selection PDFListViewCleanedString];
-    
-    BOOL isInitial = NO;
-    if(selection) {
-        CGRect noteRect = selection.bounds;
-        isInitial = NSEqualSizes(noteRect.size, NSZeroSize);
-    } else {
-        isInitial = NSEqualSizes(bounds.size, NSZeroSize);
-    }
-        
-    if (isInitial)
-        bounds = CPDFListViewRectFromCenterAndSquareSize(bounds.origin, 8.0);
-    switch (annotationType) {
-        case CAnnotationTypeSignature:
-            annotation = [[CPDFSignatureWidgetAnnotation alloc] initPDFListViewNoteWithDocument:self.document];
-            annotation.bounds = bounds;
-            break;
-        default:
-            break;
-    }
-    if (annotation) {
-        if (annotationType != CAnnotationTypeLine && annotationType != CAnnotationTypeArrow && annotationType != CAnnotationTypeInk && [text length] > 0)
-            [annotation setString:text];
-        [self addAnnotation:annotation toPage:page];
-    }
-    return annotation;
-}
-
-- (void)updateActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations {
-    [self refreshActiveAnnotations:activeAnnotations isRight:NO];
-}
-
-- (void)addAnnotation:(CPDFAnnotation *)annotation toPage:(CPDFPage *)page {
-//    [[[self undoManager] prepareWithInvocationTarget:self] removeAnnotation:annotation];
-    
-    [annotation setModificationDate:[NSDate date]];
-    //widget设置作者与fieldName冲突
-    if (![annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
-        [annotation setUserName:CPDFKitShareConfig.annotationAuthor?:NSFullUserName()];
-    }
-    [page addAnnotation:annotation];
-    [self setNeedsDisplayAnnotation:annotation];
-    [[self undoManager] setActionName:NSLocalizedString(@"Add Note", @"Undo action name")];
-}
-
-- (void)refreshActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations isRight:(BOOL)isRight {
-    if(activeAnnotations) {
-        NSArray *selectTure = [activeAnnotations filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"SELF in %@", self.activeAnnotations]];
-        BOOL isSame = NO;
-        if(self.activeAnnotations.count == activeAnnotations.count && self.activeAnnotations.count == selectTure.count) isSame = YES;
-        
-        if(!isSame) {
-            self.activeAnnotations = [NSMutableArray arrayWithArray:activeAnnotations];
-        }
-    } else if (!activeAnnotations && self.activeAnnotations.count > 0) {
-        [self.activeAnnotations removeAllObjects];
-    }
-}
-
-- (void)doResizeAnnotationWithEvent:(NSEvent *)theEvent fromPoint:(NSPoint)originalPagePoint originalBounds:(NSRect)originalBounds resizeHandle:(CRectEdges *)resizeHandlePtr {
-    CPDFAnnotation *activeAnnotation = self.activeAnnotation;
-    NSPoint pagePoint = NSZeroPoint;
-    CPDFPage *page = activeAnnotation?activeAnnotation.page:[self pageAndPoint:&pagePoint forEvent:theEvent nearest:YES];
-    NSRect newBounds = originalBounds;
-    NSRect pageBounds = [page boundsForBox:[self displayBox]];
-    NSPoint currentPagePoint = [self convertPoint:[theEvent locationInPDFListView:self] toPage:page];
-    NSPoint relPoint = CPDFListViewSubstractPoints(currentPagePoint, originalPagePoint);
-    CRectEdges resizeHandle = *resizeHandlePtr;
-    
-    if (NSEqualSizes(originalBounds.size, NSZeroSize)) {
-        CRectEdges currentResizeHandle = (relPoint.x < 0.0 ? CMinXEdgeMask : CMaxXEdgeMask) | (relPoint.y <= 0.0 ? CMinYEdgeMask : CMaxYEdgeMask);
-        if (currentResizeHandle != resizeHandle) {
-            *resizeHandlePtr = resizeHandle = currentResizeHandle;
-//            [self setCursorForAreaOfInterest:CAreaOfInterestForResizeHandle(resizeHandle, page)];
-        }
-    }
-    
-    BOOL isRadioOrCheckButton = NO;
-    if ([activeAnnotation isKindOfClass:[CPDFButtonWidgetAnnotation class]]) {
-        CPDFButtonWidgetAnnotation *annotation = (CPDFButtonWidgetAnnotation *)activeAnnotation;
-        if (CPDFWidgetRadioButtonControl == annotation.controlType ||
-            CPDFWidgetCheckBoxControl == annotation.controlType) {
-            isRadioOrCheckButton = YES;
-        }
-    }
-    
-    CGFloat minWidth = MIN_NOTE_SIZE;
-    CGFloat minHeight = MIN_NOTE_SIZE;
-    CGFloat offsetPageSet = 2;
-    if ((resizeHandle & CMaxXEdgeMask)) {
-        newBounds.size.width += relPoint.x;
-        if (NSMaxX(newBounds)+offsetPageSet > NSMaxX(pageBounds))
-            newBounds.size.width = NSMaxX(pageBounds) - NSMinX(newBounds)-offsetPageSet;
-        if (NSWidth(newBounds) < minWidth) {
-            newBounds.size.width = minWidth;
-        }
-    } else if ((resizeHandle & CMinXEdgeMask)) {
-        newBounds.origin.x += relPoint.x;
-        newBounds.size.width -= relPoint.x;
-        if (NSMinX(newBounds)-offsetPageSet < NSMinX(pageBounds)) {
-            newBounds.size.width = NSMaxX(newBounds) - NSMinX(pageBounds)-offsetPageSet;
-            newBounds.origin.x = NSMinX(pageBounds)+offsetPageSet;
-        }
-        if (NSWidth(newBounds) < minWidth) {
-            newBounds.origin.x = NSMaxX(newBounds) - minWidth;
-            newBounds.size.width = minWidth;
-        }
-    }
-    if ((resizeHandle & CMaxYEdgeMask)) {
-        newBounds.size.height += relPoint.y;
-        if (NSMaxY(newBounds)+ offsetPageSet > NSMaxY(pageBounds)) {
-            newBounds.size.height = NSMaxY(pageBounds) - NSMinY(newBounds)- offsetPageSet;
-        }
-        if (NSHeight(newBounds) < minHeight) {
-            newBounds.size.height = minHeight;
-        }
-        
-    } else if ((resizeHandle & CMinYEdgeMask)) {
-        newBounds.origin.y += relPoint.y;
-        newBounds.size.height -= relPoint.y;
-        if (NSMinY(newBounds)-offsetPageSet < NSMinY(pageBounds)) {
-            newBounds.size.height = NSMaxY(newBounds) - NSMinY(pageBounds)-offsetPageSet;
-            newBounds.origin.y = NSMinY(pageBounds)+offsetPageSet;
-        }
-        if (NSHeight(newBounds) < minHeight) {
-            newBounds.origin.y = NSMaxY(newBounds) - minHeight;
-            newBounds.size.height = minHeight;
-        }
-    }
-    
-    [activeAnnotation setBounds:NSIntegralRect(newBounds)];
-    
-    if ([activeAnnotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
-        [self updateAnnotationFreeTextBounds:(CPDFFreeTextAnnotation *)activeAnnotation];
-    }
-}
-
-#pragma mark - NSMenu
-
-- (NSMenu *)menuForEvent:(NSEvent *)event {
-    if (self.annotationType == CAnnotationTypeInk || self.annotationType == CAnnotationTypeEraser) {
-        return nil;
-    }
-    NSMenu *menu = [super menuForEvent:event];
-    if(!menu)
-        menu = [[NSMenu alloc] init];
-    
-    NSPoint pagePoint = NSZeroPoint;
-    CPDFPage *page = [self pageAndPoint:&pagePoint forEvent:event nearest:YES];
-    NSMenuItem * copyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy", @"PDFListView") action:@selector(copy:) keyEquivalent:@"c"];
-    
-    NSMenuItem * pasteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Paste", @"PDFListView") action:@selector(menuItemClick_Paste:) keyEquivalent:@"v"];
-    pasteItem.representedObject = event;
-    NSMenuItem * cutItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Cut", @"PDFListView") action:@selector(cut:) keyEquivalent:@"x"];
-    
-    NSMenuItem * deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Delete", @"PDFListView") action:@selector(delete:) keyEquivalent:@""];
-    
-    NSMenu *subMenu = nil;
-    NSMenuItem * arrangementItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Arrangement", @"PDFListView") action:nil keyEquivalent:@""];
-    subMenu = [[NSMenu alloc] init];
-    
-    NSMenuItem * bringForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring Forward", @"PDFListView") action:@selector(menuItemClick_BringForward:) keyEquivalent:@""];
-    NSMenuItem * sendBackForwardItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send Backward", @"PDFListView") action:@selector(menuItemClick_SendBackward:) keyEquivalent:@""];
-    NSMenuItem * bringFrontItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Bring to Front", @"PDFListView") action:@selector(menuItemClick_BringFront:) keyEquivalent:@""];
-    NSMenuItem * sendBackItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Send to Back", @"PDFListView") action:@selector(menuItemClick_SendBack:) keyEquivalent:@""];
-    [subMenu addItem:bringForwardItem];
-    [subMenu addItem:sendBackForwardItem];
-    [subMenu addItem:bringFrontItem];
-    [subMenu addItem:sendBackItem];
-    arrangementItem.submenu = subMenu;
-    
-    NSMenuItem * editNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Note", @"PDFListView") action:@selector(menuItemClick_EditNote:) keyEquivalent:@""];
-
-    if(0) {
-      
-        
-    } else {
-        CPDFAnnotation *annotation = nil;
-        
-        for (CPDFAnnotation *tAnnotation in page.annotations) {
-            if ([tAnnotation hitTest:pagePoint]) {
-                annotation = tAnnotation;
-                break;
-            }
-        }
-        
-        if (annotation && [annotation isKindOfClass:[CPDFWidgetAnnotation class]] ){
-           
-        }
-        
-        if(annotation) {
-            if(![self.activeAnnotations containsObject:annotation]) {
-                [self updateIsRightActiveAnnotations:@[annotation]];
-                [self setNeedsDisplayAnnotation:annotation];
-            }
-        }
-        
-        if(annotation && [annotation isKindOfClass:[CPDFWidgetAnnotation class]]) {
-            annotation = nil;
-        } else if(annotation && [annotation isKindOfClass:[CPDFRedactAnnotation class]]) {
-            annotation = nil;
-        } else if (annotation && [annotation isKindOfClass:[CPDFInkAnnotation class]] && [self annotationType] == CAnnotationTypeInk) {
-            annotation = nil;
-        }
-        
-
-        CPDFSelection *selection = [self creatImageCurrentSelectionForPoint:[event locationInPDFListView:self]];
-        if(selection && CPDFSelectionTypeImage == [selection selectionType] && !self.activeAnnotation){
-            self.currentSelection = selection;
-        }
-        
-        NSMenu *subMenu = [[NSMenu alloc] init];
-        if(self.activeAnnotations.count == 1) {
-//            NSMenuItem * lineStyleItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Line Style", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-//            
-//            subMenu = [[NSMenu alloc] init];
-//            NSMenuItem * lineSolidItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Solid", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-//            lineSolidItem.tag = CPDFBorderStyleSolid;
-//            NSMenuItem * lineDashedItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Dashed", @"PDFListView") action:@selector(menuItemClick_LineStyle:) keyEquivalent:@""];
-//            lineDashedItem.tag = CPDFBorderStyleDashed;
-//
-//            [subMenu addItem:lineSolidItem];
-//            [subMenu addItem:lineDashedItem];
-//            lineStyleItem.submenu = subMenu;
-//
-//            NSMenuItem * changeColorItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Color...", @"PDFListView") action:@selector(menuItemClick_ChangeColor:) keyEquivalent:@""];
-
-//            [menu insertItem:arrangementItem atIndex:0];
-//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-
-//            if([self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]] ||
-//               [self.activeAnnotation isKindOfClass:[CPDFStampAnnotation class]] ||
-//               [self.activeAnnotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
-//                [menu insertItem:editNoteItem atIndex:0];
-//            } else if ([self.activeAnnotation isKindOfClass:[CPDFInkAnnotation class]]) {
-//                [menu insertItem:editNoteItem atIndex:0];
-//                [menu insertItem:lineStyleItem atIndex:0];
-//                [menu insertItem:changeColorItem atIndex:0];
-//            } else if ([self.activeAnnotation isKindOfClass:[CPDFTextAnnotation class]]) {
-//                [menu insertItem:editNoteItem atIndex:0];
-//                [menu insertItem:changeColorItem atIndex:0];
-//            } else if ([self.activeAnnotation isKindOfClass:[CPDFSquareAnnotation class]] ||
-//                       [self.activeAnnotation isKindOfClass:[CPDFCircleAnnotation class]] ||
-//                       [self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
-//                [menu insertItem:editNoteItem atIndex:0];
-//                if([self.activeAnnotation isKindOfClass:[CPDFLineAnnotation class]]) {
-//                    NSMenuItem * directionItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Direction", @"PDFListView") action:nil keyEquivalent:@""];
-//                    subMenu = [[NSMenu alloc]init];
-//                    
-//                    NSMenuItem * lineHorizontalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Horizontal", @"PDFListView") action:@selector(menuItemClick_LineHorizontal:) keyEquivalent:@""];
-//                    NSMenuItem * lineVerticalItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Vertical", @"PDFListView") action:@selector(menuItemClick_LineVertical:) keyEquivalent:@""];
-//                    [subMenu addItem:lineHorizontalItem];
-//                    [subMenu addItem:lineVerticalItem];
-//                    directionItem.submenu = subMenu;
-//                    
-//                    [menu insertItem:directionItem atIndex:0];
-//                }
-//                [menu insertItem:lineStyleItem atIndex:0];
-//                [menu insertItem:changeColorItem atIndex:0];
-//            }
-            if ([self.activeAnnotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
-                CPDFSignatureWidgetAnnotation *aa = (CPDFSignatureWidgetAnnotation *)self.activeAnnotation;
-                CPDFSignature *aaa = aa.signature;
-                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-                [menu insertItem:deleteItem atIndex:0];
-            }
-//            if(![self.activeAnnotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-//                if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
-//                    [menu insertItem:pasteItem atIndex:0];
-//                }
-//                [menu insertItem:cutItem atIndex:0];
-//            }
-//            [menu insertItem:copyItem atIndex:0];
-            __block typeof(self) blockSelf = self;
-
-            
-        } else if (self.activeAnnotations.count > 1) {
-            BOOL isMarkupAn = NO;
-            for (CPDFAnnotation *annotation in self.activeAnnotations) {
-                if([annotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-                    isMarkupAn = YES;
-                    break;
-                }
-            }
-            
-//            [menu insertItem:arrangementItem atIndex:0];
-            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            [menu insertItem:deleteItem atIndex:0];
-            if(!isMarkupAn) {
-                [menu insertItem:cutItem atIndex:0];
-                [menu insertItem:copyItem atIndex:0];
-            }
-        } else if (self.currentSelection) {
-            if(CPDFSelectionTypeImage == [self.currentSelection selectionType]) {
-                NSMenuItem * exportImageItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Export…", nil) action:@selector(menuItemClick_ExportImage:) keyEquivalent:@""];
-
-                [menu insertItem:exportImageItem atIndex:0];
-                [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-            }
-            if ([[NSPasteboard generalPasteboard] canReadObjectForClasses:[NSArray arrayWithObjects:[CPDFAnnotation class], [NSString class],[NSImage class], nil] options:[NSDictionary dictionary]]) {
-                [menu insertItem:pasteItem atIndex:0];
-            }
-            [menu insertItem:copyItem atIndex:0];
-        } else if (!self.activeAnnotation) {
-//            NSMenuItem * pageDisplayItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Page Display", @"PDFListView") action:nil keyEquivalent:@""];
-//            subMenu = [[NSMenu alloc] init];
-//
-//            NSMenuItem * twoPagesContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages Continuous", @"PDFListView") action:@selector(menuItemClick_TwoPagesContinuous:) keyEquivalent:@""];
-//            NSMenuItem * twoPagesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Two Pages", @"PDFListView") action:@selector(menuItemClick_TwoPages:) keyEquivalent:@""];
-//            NSMenuItem * singlePageContinuousItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page Continuous", @"PDFListView") action:@selector(menuItemClick_SinglePagesContinuous:) keyEquivalent:@""];
-//            NSMenuItem * singlePageItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Single Page", @"PDFListView") action:@selector(menuItemClick_SinglePage:) keyEquivalent:@""];
-//            NSMenuItem * bookModeItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Book Mode", @"PDFListView") action:@selector(menuItemClick_BookMode:) keyEquivalent:@""];
-//            switch (self.displayViewMode) {
-//                case CPDFDisplayViewSinglePageContinuous:
-//                    singlePageContinuousItem.state = NSControlStateValueOn;
-//                    break;
-//                case CPDFDisplayViewTwoUp:
-//                    if (self.displaysAsBook)
-//                        bookModeItem.state = NSControlStateValueOn;
-//                    else
-//                        twoPagesItem.state = NSControlStateValueOn;
-//                    break;
-//                case CPDFDisplayViewTwoUpContinuous:
-//                    if (self.displaysAsBook)
-//                        bookModeItem.state = NSControlStateValueOn;
-//                    else
-//                        twoPagesContinuousItem.state = NSControlStateValueOn;
-//                    break;
-//                default:
-//                case CPDFDisplayViewSinglePage:
-//                    singlePageItem.state = NSControlStateValueOn;
-//                    break;
-//            }
-//
-//            [subMenu addItem:singlePageItem];
-//            [subMenu addItem:singlePageContinuousItem];
-//            [subMenu addItem:twoPagesItem];
-//            [subMenu addItem:twoPagesContinuousItem];
-//            [subMenu addItem:bookModeItem];
-//            pageDisplayItem.submenu = subMenu;
-//            
-//            [menu insertItem:pageDisplayItem atIndex:0];
-//
-//            NSMenuItem *zoomItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom", @"PDFListView") action:nil keyEquivalent:@""];
-//            subMenu = [[NSMenu alloc]init];
-//
-//            NSMenuItem * fitWidthItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Fit Width", @"PDFListView") action:@selector(menuItemClick_FitWidth:) keyEquivalent:@""];
-//            NSMenuItem * automaticallyItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Automatically Resize", @"PDFListView") action:@selector(menuItemClick_AutomaticallyResize:) keyEquivalent:@""];
-//            NSMenuItem * actualSizeItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Actual Size", @"PDFListView") action:@selector(menuItemClick_ActualSize:) keyEquivalent:@""];
-//            NSMenuItem * zoomInItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom In", @"PDFListView") action:@selector(menuItemClick_ZoomIn:) keyEquivalent:@""];
-//            NSMenuItem * zoomOutItem =  [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Zoom Out", @"PDFListView") action:@selector(menuItemClick_ZoomOut:) keyEquivalent:@""];
-//            
-//            NSMenuItem * hidenShowNoteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Hide Notes", @"PDFListView") action:@selector(menuItemClick_HidenorShowNote:) keyEquivalent:@""];
-//            
-//            if (self.autoScales) {
-//                automaticallyItem.state = NSControlStateValueOn;
-//            } else if (self.scaleFactor == 1.0) {
-//                actualSizeItem.state = NSControlStateValueOn;
-//            }
-//            
-//           
-//            
-//            [subMenu addItem:fitWidthItem];
-//            [subMenu addItem:automaticallyItem];
-//            [subMenu addItem:actualSizeItem];
-//            [subMenu addItem:zoomInItem];
-//            [subMenu addItem:zoomOutItem];
-//            zoomItem.submenu = subMenu;
-//            [menu insertItem:zoomItem atIndex:0];
-//            
-//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-//            [menu insertItem:hidenShowNoteItem atIndex:0];
-//            [menu insertItem:[NSMenuItem separatorItem] atIndex:0];
-//            [menu insertItem:pasteItem atIndex:0];
-
-        }
-    }
-    
-//    if ([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewMenuForEvent:forEvent:clickMenu:)]) {
-//        [self.pdfListViewDelegate PDFListViewMenuForEvent:self forEvent:event clickMenu:&menu];
-//    }
-    
-    return menu;
-}
-
-- (void)updateIsRightActiveAnnotations:(NSArray<CPDFAnnotation *> *)activeAnnotations {
-    [self refreshActiveAnnotations:activeAnnotations isRight:YES];
-}
-
-- (IBAction)delete:(id)sender {
-    if (self.activeAnnotations.count > 0 ) {
-        NSMutableArray *tarr = [NSMutableArray arrayWithArray:self.activeAnnotations];
-        for (CPDFAnnotation * an in tarr) {
-//            if(self.hoverAnnotation == an) {
-//                self.hoverAnnotation = nil;
-//            }
-            [self removeAnnotation:an];
-            [[self undoManager] setActionName:NSLocalizedString(@"Remove Note", @"Undo action name")];
-            if([an isKindOfClass:[CPDFFreeTextAnnotation class]]) {
-                CPDFFreeTextAnnotation *freeTextAn = (CPDFFreeTextAnnotation *)an;
-                if ([self isEditWithCurrentFreeText:freeTextAn]) {
-                    [self commitEditAnnotationFreeText:freeTextAn];
-                }
-            }
-        }
-        [self removeActiveAnnotations:tarr];
-    } else {
-        NSBeep();
-    }
-}
-
-- (void)removeAnnotation:(CPDFAnnotation *)annotation {
-    CPDFAnnotation *wasAnnotation = annotation;
-    CPDFPage *page = wasAnnotation.page;
-    
-    [[[self undoManager] prepareWithInvocationTarget:self] addAnnotation:wasAnnotation toPage:page];
-    
-    [page removeAnnotation:wasAnnotation];
-    [self annotationsChangedOnPage:page];
-    [self setNeedsDisplayAnnotation:wasAnnotation];
-
-//    dispatch_async(dispatch_get_main_queue(), ^{
-//        [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewDidRemoveAnnotationNotification object:self
-//                                                          userInfo:[NSDictionary dictionaryWithObjectsAndKeys:wasAnnotation, CPDFListViewAnnotationKey, page, CPDFListViewPageKey, nil]];
-//    });
-//    
-//    if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewRemoveAnnotations:forRemoveAnnotations:inPage:)])
-//        [self.pdfListViewDelegate PDFListViewRemoveAnnotations:self forRemoveAnnotations:@[annotation] inPage:page];
-}
-
-- (void)removeActiveAnnotations:(NSArray<CPDFAnnotation *> *)removeAnnotations {
-    BOOL isContains = NO;
-    NSMutableArray *tarr = [NSMutableArray arrayWithArray:self.activeAnnotations];
-    [tarr removeObjectsInArray:removeAnnotations];
-    self.activeAnnotations = tarr;
-    isContains = YES;
-    
-    if(isContains) {
-        if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewDeleteAnnotation:forAnnotation:)])
-            [self.pdfListViewDelegate PDFListViewDeleteAnnotation:self forAnnotation:removeAnnotations.firstObject];
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewActiveAnnotationsChangeNotification object:self];
-        });
-    }
-
-//    if(isContains) {
-//        if([self.pdfListViewDelegate respondsToSelector:@selector(PDFListViewChangeatioActiveAnnotations:forActiveAnnotations:isRightMenu:)])
-//            [self.pdfListViewDelegate PDFListViewChangeatioActiveAnnotations:self forActiveAnnotations:self.activeAnnotations isRightMenu:NO];
-//        
-//        dispatch_async(dispatch_get_main_queue(), ^{
-//            [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewActiveAnnotationsChangeNotification object:self];
-//        });
-//    }
-}
-
-@end

+ 0 - 457
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.swift

@@ -1,457 +0,0 @@
-//
-//  KMPDFDigitalSignViewController.swift
-//  PDF Reader Pro Edition
-//
-//  Created by Niehaoyu on 2023/10/19.
-//
-
-import Cocoa
-
-class KMPDFDigitalSignViewController: NSViewController, CPDFViewDelegate {
-
-    @IBOutlet weak var contendView: NSView!
-    @IBOutlet weak var headerView: NSView!
-    @IBOutlet weak var tipLabel: NSTextField!
-    @IBOutlet weak var exitBox: NSBox!
-    @IBOutlet weak var exitButton: KMCustomButton!
-    @IBOutlet weak var saveBox: NSBox!
-    @IBOutlet weak var saveButton: KMCustomButton!
-    
-    @IBOutlet weak var stateBGView: NSView!
-    @IBOutlet weak var stateLbl: NSTextField!
-    @IBOutlet weak var stateButton: NSButton!
-    
-    @IBOutlet weak var pdfContendView: NSView!
-    @IBOutlet weak var contentTopConst: NSLayoutConstraint!
-    
-    
-    var editWidgeAnnotation: CPDFSignatureWidgetAnnotation!
-    var stateVC: CDSignatureCertificateStateViewController!
-    
-    @objc var scaleFactor: CGFloat = 0
-    @objc var url: URL!
-    @objc var password = String()
-    @objc var currentPageIndex: Int = 0
-    
-    var signatures = NSArray()
-    var type:CPromptSignaturesState = .failure
-    
-    @objc var titleChangeBlock: ((_ title: String, _ pageIndex: NSInteger)->Void)?
-    @objc var buttonActionBlock: ((_ actionType: DSignatureActionType, _ isChanged: Bool)->Void)?
-    
-    var pdfView: CPDFDigtalView!
-    
-    override func viewDidAppear() {
-        super.viewDidAppear()
-        
-        let contextString = NSLocalizedString("Please box an area for the signature to be added, then you can add a new digital signature.", comment: "")
-        _ = CustomAlertView.alertView(message: contextString, fromView: self.view, withStyle: .black)
-    }
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        // Do view setup here.
-        
-        self.contendView.wantsLayer = true
-        self.contendView.layer?.backgroundColor = KMAppearance.Layout.bgColor().cgColor
-        
-        self.headerView.wantsLayer = true
-        self.headerView.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
-        
-        self.tipLabel.stringValue = NSLocalizedString("You are Under Digital Sign Mode", comment: "")
-        
-        self.exitBox.borderColor = KMAppearance.Layout.w70Color()
-        self.exitBox.borderWidth = 1.0
-        self.exitButton.title = NSLocalizedString("Exit", comment: "")
-        
-        self.saveBox.fillColor = NSColor.white
-        self.saveButton.title = NSLocalizedString("Exit", comment: "")
-        self.saveButton.setTitleColor(KMAppearance.Interactive.a0Color())
-        
-        self.exitBox.isHidden = true
-        
-        self.pdfView = CPDFDigtalView.init(frame: self.pdfContendView.bounds)
-        self.pdfView.autoresizingMask = [.width, .height]
-        
-        let document = CPDFDocument.init(url: self.url)
-        if self.password.count > 0 {
-            document?.unlock(withPassword: self.password)
-        }
-        self.pdfView.delegate = self
-        self.pdfView.document = document
-        self.pdfView.autoScales = true
-        self.pdfView.pdfListViewDelegate = self
-        self.pdfContendView.addSubview(self.pdfView)
-        
-        self.stateBGView.wantsLayer = true
-        self.stateBGView.layer?.backgroundColor = KMAppearance.Else.textHighlightColor().cgColor
-        self.stateLbl.textColor = NSColor.labelColor
-        
-        self.reloadState()
-        
-        NotificationCenter.default.addObserver(self, selector: #selector(signatureStateChangeNoti), name: NSNotification.Name(rawValue: "CSignatureTrustCerDidChangeNotification"), object: nil)
-
-    }
-    
-    //MARK: Public Method
-    
-    func reloadState() {
-        if self.pdfView.signatures.count > 0 {
-            self.stateBGView.isHidden = false
-            self.contentTopConst.constant = 44
-        } else {
-            self.stateBGView.isHidden = true
-            self.contentTopConst.constant = 0
-        }
-        
-        self.signatures = self.pdfView.signatures! as NSArray
-        
-        var isSignVerified = false
-        var isCertTrusted = false
-        
-        for item in self.signatures {
-            let signature: CPDFSignature = item as! CPDFSignature
-            if signature.signers != nil {
-                let signer = signature.signers.first
-                if signer?.isCertTrusted == false {
-                    isCertTrusted = false
-                    break
-                } else {
-                    isCertTrusted = true
-                }
-            }
-        }
-        
-        for item in self.signatures {
-            let signature: CPDFSignature = item as! CPDFSignature
-            if signature.signers != nil {
-                let signer = signature.signers.first
-                if signer?.isSignVerified == false {
-                    isSignVerified = false
-                    break
-                } else {
-                    isSignVerified = true
-                }
-            }
-        }
-        
-        self.stateBGView.isHidden = false
-        
-        if (isSignVerified && isCertTrusted) {
-            self.type = .Success;
-        } else if(isSignVerified && !isCertTrusted) {
-            self.type = .Unknown;
-        } else {
-            self.type = .failure;
-        }
-        
-        if (.Success == self.type) {
-            self.stateButton.image = NSImage(named: "ImageNameSigntureVerifySuccess")
-            self.stateLbl.stringValue = NSLocalizedString("Signature is valid.", comment: "")
-        } else if(.Unknown == self.type) {
-            self.stateButton.image = NSImage(named: "ImageNameSigntureTrustedFailure")
-            if(self.signatures.count > 1) {
-                self.stateLbl.stringValue = NSLocalizedString("At least one signature is invalid.", comment: "")
-            } else {
-                self.stateLbl.stringValue = NSLocalizedString("Signature is invalid", comment: "")
-            }
-        } else {
-            self.stateButton.image = NSImage(named: "ImageNameSigntureVerifyFailure")
-            if(self.signatures.count > 1) {
-                self.stateLbl.stringValue = NSLocalizedString("At least one signature is invalid.", comment: "")
-            } else {
-                self.stateLbl.stringValue = NSLocalizedString("Signature is invalid", comment: "")
-            }
-        }
-    }
-    
-    func writeSignatureToWidget(_ widget: CPDFSignatureWidgetAnnotation, _ path: String, _ password: String, _ config: CPDFSignatureConfig, _ isLock: Bool) ->() {
-        
-        let fileName = self.pdfView.document.documentURL?.lastPathComponent
-        let fileNameWithoutExtension = URL(fileURLWithPath: fileName!).deletingPathExtension().lastPathComponent
-
-        let outputSavePanel = NSSavePanel()
-        outputSavePanel.directoryURL = self.pdfView.document.documentURL.deletingLastPathComponent()
-        outputSavePanel.title = NSLocalizedString("", comment: "Save as PDF")
-        outputSavePanel.allowedFileTypes = ["pdf"]
-        outputSavePanel.nameFieldStringValue = fileNameWithoutExtension + "_" + NSLocalizedString("Signed", comment: "")
-        let result = outputSavePanel.runModal()
-        if result == .OK {
-            let contentArr = NSMutableArray()
-            var locationStr = ""
-            var reasonStr = NSLocalizedString("none", comment: "")
-            for item in config.contents {
-                if item.key == NSLocalizedString("Reason", comment: "") {
-                    if item.value == NSLocalizedString("<your signing reason here>", comment: "") {
-                        item.value = " " + NSLocalizedString("none", comment: "")
-                    }
-                    reasonStr = item.value
-                } else if item.key == NSLocalizedString("Location", comment: "") {
-                    if item.value == NSLocalizedString("<your signing location here>", comment: "") {
-                        item.value = " "
-                    }
-                    locationStr = item.value
-                }
-                contentArr.add(item)
-            }
-            config.contents = contentArr as? [CPDFSignatureConfigItem]
-            widget.signAppearanceConfig(config)
-            
-            let success = self.pdfView.document.writeSignature(to: outputSavePanel.url, withWidget: widget, pkcs12Cert: path, password: password, location: locationStr, reason: reasonStr, permissions: .forbidChange)
-            widget.removeSignature()
-            if success {
-                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
-                    NSDocumentController.shared.openDocument(withContentsOf: outputSavePanel.url!, display: true) { document, documentWasAlreadyOpen, error in
-                        if error != nil {
-                            NSApp.presentError(error!)
-                            return
-                        }
-                    }
-                }
-            } else {
-                let alert = NSAlert.init()
-                alert.messageText = NSLocalizedString("Save failed!", comment: "")
-                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
-                alert.runModal()
-            }
-            widget.page.removeAnnotation(widget)
-            self.pdfView.setNeedsDisplayAnnotationViewFor(widget.page)
-        } else {
-            widget.page.removeAnnotation(widget)
-            self.pdfView.setNeedsDisplayAnnotationViewFor(widget.page)
-        }
-    }
- 
-    //MARK: Setter
-    
-    
-    
-    //MARK: IBAction
-    @IBAction func exitButtonAction(_ sender: NSButton) {
-        
-    }
-    
-    @IBAction func saveButtonAction(_ sender: NSButton) {
-        
-//        var documentArray = NSDocumentController.shared.documents
-        var didFileEdit = false
-//        for i in 0...documentArray.count-1 {
-//            let document = documentArray[i] 
-//            if document.fileURL!.path == self.pdfView.document.documentURL.path {
-//                didFileEdit = document.isDocumentEdited
-//            
-//                break
-//            }
-//        }
-        guard let callBack = self.buttonActionBlock else {
-            return
-        }
-        callBack(.cancel, didFileEdit)
-        
-    }
- 
-    
-    //MARK: CPDFViewDelegate
-    func pdfViewDocumentDidLoaded(_ pdfView: CPDFView!) {
-        self.pdfView.go(toPageIndex: self.currentPageIndex, animated: true)
-    }
-    
-    func setCurrentPageIndex(_ currentPageIndex: Int) {
-        self.pdfView.go(toPageIndex: currentPageIndex, animated: false)
-    }
-    
-    func pdfViewCurrentPageDidChanged(_ pdfView: CPDFView!) {
-        let fileName = pdfView.document.documentURL.deletingPathExtension().lastPathComponent
-        let title = String(format: "%@ (page %ld / %ld)", fileName, pdfView.currentPageIndex+1, pdfView.document.pageCount)
-        
-        self.currentPageIndex = pdfView.currentPageIndex
-        guard let callBack = self.titleChangeBlock else {
-            return
-        }
-        callBack(title, self.currentPageIndex)
-    }
-
-    func popUpSignatureWidgetState(_ signature: CPDFSignature, _ pdfListView: CPDFDigtalView) ->(){
-        if self.stateVC == nil {
-            self.stateVC = CDSignatureCertificateStateViewController.init()
-        }
-        self.stateVC.signature = signature
-        self.stateVC.pdfListView = pdfListView
-        self.stateVC.actionBlock = { [weak self, weak stateVC] stateVCSelf, actionType in
-            guard let self = self, let stateVC = stateVC else { return }
-            if actionType == .cancel {
-                stateVC.dismiss(stateVCSelf)
-            } else if actionType == .confirm {
-                if let signer = signature.signers.first, let data = signer.certificates {
-                    let signatureDetail = DSignatureDetailsViewController.init()
-                    signatureDetail.certificates = data
-                    signatureDetail.signature = signature
-                    signatureDetail.pdfListView = pdfListView
-                    stateVCSelf.presentAsSheet(signatureDetail)
-                } else {
-                    NSSound.beep()
-                }
-            }
-        }
-        if let stateVC = self.stateVC {
-            self.presentAsSheet(stateVC)
-            stateVC.reloadData()
-        }
-    }
-     
-    func signElectronicSignature(_ signatureWidgetAnnotation: CPDFSignatureWidgetAnnotation) -> () {
-        
-//        PDFCustomSignatureWindowController *signatureWindowController = [[PDFCustomSignatureWindowController alloc] init];
-//        __block typeof(self) blockSelf = self;
-//        [signatureWindowController beginSheetModalForWindow:[NSApp mainWindow] completionHandler:^(PDFSignature *signature){
-//            if (signature) {
-//                [signatureWidgetAnnotation signWithImage:signature.pathsImage];
-//                [blockSelf.PDFListView setNeedsDisplayAnnotationViewForPage:signatureWidgetAnnotation.page];
-//            }
-//        }];
-//        [signatureWindowController release];
-    }
-    
-    //MARK: Notification
-    @objc fileprivate func signatureStateChangeNoti() {
-         
-        let signatures = self.pdfView.document.signatures()!
-        
-        let tempArr = NSMutableArray()
-        for signature in signatures {
-            if signature.signers != nil {
-                if signature.signers.count > 0 {
-                    signature.verifySignature(with: self.pdfView.document)
-                    tempArr.add(signature)
-                }
-            }
-        }
-        self.pdfView.signatures = tempArr as? [Any]
-        
-        self.reloadState()
-        
-        if self.stateVC != nil {
-            let signatureWidget = self.editWidgeAnnotation!
-            var signature = signatureWidget.signature()
-            if signature == nil {
-                return
-            }
-            self.stateVC.signature = signature
-            self.stateVC.reloadData()
-        }
-    }
-}
-
-extension KMPDFDigitalSignViewController: CPDFDigtalViewDelegate {
-    func pdfListViewAddAnnotation(_ pdfListView: CPDFDigtalView!, forAdd annotation: CPDFAnnotation!, in pdfPage: CPDFPage!) {
-        
-        let widget = CPDFSignatureWidgetAnnotation.init(PDFListViewNoteWith: self.pdfView.document)
-        widget.bounds = NSMakeRect(-1000, -1000, 545, 178);
-        annotation.page.addAnnotation(widget)
-        
-        let configWindowVC = DSignatureConfigWindowController.init(windowNibName: "DSignatureConfigWindowController")
-        configWindowVC.viewType = .fileList;
-        configWindowVC.appearanceWidget = widget;
-        configWindowVC.isCreatDS = false
-        configWindowVC.complentionHandle = {[weak self] isSign, dic, config, isLock in
-            widget.page.removeAnnotation(widget)
-            if isSign {
-                if (dic.object(forKey: SAVEFILEPATH_KEY) != nil) {
-                    let p12Path = dic.object(forKey: SAVEFILEPATH_KEY) as! String
-                    let password = dic.object(forKey: PASSWORD_KEY)
-                    if p12Path.count > 0 {
-                        self?.writeSignatureToWidget(annotation as! CPDFSignatureWidgetAnnotation, p12Path, password as! String, config, isLock)
-                    }
-                }
-            }
-        }
-        configWindowVC.actionBlock = { controller, type in
-            if (type == .cancel) {
-                NSApplication.shared.stopModal()
-                controller.window?.orderOut(nil)
-                controller.window?.close()
-            
-                annotation.page.removeAnnotation(annotation)
-                widget.page.removeAnnotation(widget)
-                self.pdfView.setNeedsDisplayAnnotationViewFor(annotation.page)
-                
-            } else if (type == .confirm) {
-                NSApplication.shared.stopModal()
-                controller.window?.orderOut(nil)
-                controller.window?.close()
-            }
-        }
-        configWindowVC.window?.center()
-        NSApplication.shared.runModal(for: configWindowVC.window!)
-    }
-    
-    func pdfListViewEditAnnotation(_ pdfListView: CPDFDigtalView!, for anotation: CPDFAnnotation!) {
-        if anotation.className == CPDFSignatureWidgetAnnotation.className() {
-            let signatureWidget = anotation as! CPDFSignatureWidgetAnnotation
-            var signature = signatureWidget.signature()
-            if signature == nil {
-                return
-            }
-            if signature?.signers != nil {
-                self.editWidgeAnnotation = signatureWidget
-                self.popUpSignatureWidgetState(signature!, self.pdfView)
-            } else if signatureWidget.isSigned() {
-//                self.signElectronicSignature(signatureWidget)
-            } else {
-                
-            }
-            
-////            __block WindowController *weakself = self;
-//            CPDFSignatureWidgetAnnotation *signatureWidget = (CPDFSignatureWidgetAnnotation *)annotation;
-//            CPDFSignature *signature = [signatureWidget signature];
-//            if (signature.signers.count > 0) {
-//                [self popUpSignatureWidgetState:signature];
-//            } else if (signatureWidget.isSigned) {
-//                [self signElectronicSignature:signatureWidget];
-//            } else {
-//                CDSignatureSignTypeWindowController *signType = [[CDSignatureSignTypeWindowController alloc] init];
-//                signType.callback = ^(CDSignType type) {
-//                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
-//                        if(type == CDSignType_ElectronicSignature) {
-//                            [weakself signElectronicSignature:signatureWidget];
-//                        } else {
-//                            [weakself signDigitalSignature:signatureWidget];
-//                        }
-//                    });
-//                };
-//                [signType startModal:nil];
-//                [signType release];
-//            }
-        }
-    }
-    
-    func pdfListViewDeleteAnnotation(_ pdfListView: CPDFDigtalView!, for anotation: CPDFAnnotation!) {
-        let fileName = self.pdfView.document.documentURL?.lastPathComponent
-        let fileNameWithoutExtension = URL(fileURLWithPath: fileName!).deletingPathExtension().lastPathComponent
-        
-        let outputSavePanel = NSSavePanel()
-        outputSavePanel.directoryURL = self.pdfView.document.documentURL.deletingLastPathComponent()
-        outputSavePanel.title = NSLocalizedString("", comment: "Save as PDF")
-        outputSavePanel.allowedFileTypes = ["pdf"]
-        outputSavePanel.nameFieldStringValue = fileNameWithoutExtension + "_" + NSLocalizedString("Signed", comment: "")
-        let result = outputSavePanel.runModal()
-        if result == .OK {
-            let success = self.pdfView.document.write(to: outputSavePanel.url)
-            if success {
-                DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
-                    NSDocumentController.shared.openDocument(withContentsOf: outputSavePanel.url!, display: true) { document, documentWasAlreadyOpen, error in
-                        if error != nil {
-                            NSApp.presentError(error!)
-                            return
-                        }
-                    }
-                }
-            } else {
-                let alert = NSAlert.init()
-                alert.messageText = NSLocalizedString("Save failed!", comment: "")
-                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
-                alert.runModal()
-            }
-        }
-    }
-}

+ 0 - 179
PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.xib

@@ -1,179 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
-    <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22505"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMPDFDigitalSignViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
-            <connections>
-                <outlet property="contendView" destination="SJ2-pS-M3B" id="jyP-Zt-Wsa"/>
-                <outlet property="contentTopConst" destination="TVB-8H-a7j" id="PyN-MC-YU8"/>
-                <outlet property="exitBox" destination="gHQ-0K-XbK" id="uSU-eh-Wbc"/>
-                <outlet property="exitButton" destination="FD6-Gh-1xx" id="UaC-rl-g8o"/>
-                <outlet property="headerView" destination="0a0-Fd-gka" id="p2n-oy-DJG"/>
-                <outlet property="pdfContendView" destination="Zqz-md-wWY" id="KK3-10-e8X"/>
-                <outlet property="saveBox" destination="eVE-dl-Oe8" id="otO-Cg-X4G"/>
-                <outlet property="saveButton" destination="pzG-r6-BJl" id="Ub1-Xx-lJs"/>
-                <outlet property="stateBGView" destination="LSe-Oi-yzJ" id="hq1-dp-U6D"/>
-                <outlet property="stateButton" destination="Yrb-Nx-Xvp" id="WNb-tD-Nfw"/>
-                <outlet property="stateLbl" destination="OGs-L1-cgc" id="CLU-fl-D0T"/>
-                <outlet property="tipLabel" destination="Hl2-Ul-Rge" id="Hoo-dI-j2s"/>
-                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
-            </connections>
-        </customObject>
-        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
-        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="Hz6-mo-xeY">
-            <rect key="frame" x="0.0" y="0.0" width="572" height="387"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <subviews>
-                <customView translatesAutoresizingMaskIntoConstraints="NO" id="SJ2-pS-M3B">
-                    <rect key="frame" x="0.0" y="0.0" width="572" height="387"/>
-                    <subviews>
-                        <button translatesAutoresizingMaskIntoConstraints="NO" id="DXG-U6-4uT">
-                            <rect key="frame" x="0.0" y="299" width="572" height="88"/>
-                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" imagePosition="left" inset="2" id="Fkr-1Y-hA9">
-                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                <font key="font" metaFont="system"/>
-                            </buttonCell>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="88" id="gOp-Fc-09h"/>
-                            </constraints>
-                        </button>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="0a0-Fd-gka">
-                            <rect key="frame" x="0.0" y="343" width="572" height="44"/>
-                            <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hl2-Ul-Rge">
-                                    <rect key="frame" x="18" y="14" width="211" height="17"/>
-                                    <textFieldCell key="cell" lineBreakMode="clipping" title="You are under Digital Sign Mode" id="V0q-9R-zZp">
-                                        <font key="font" metaFont="system" size="14"/>
-                                        <color key="textColor" red="0.99999600649999998" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                    </textFieldCell>
-                                </textField>
-                                <box boxType="custom" borderWidth="0.0" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="gHQ-0K-XbK">
-                                    <rect key="frame" x="376" y="9" width="74" height="26"/>
-                                    <view key="contentView" id="ayl-GF-cSS">
-                                        <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
-                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        <subviews>
-                                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FD6-Gh-1xx" customClass="KMCustomButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                                                <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
-                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                                <buttonCell key="cell" type="bevel" title="Exit" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="aYO-5U-m8F">
-                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                    <font key="font" metaFont="system"/>
-                                                </buttonCell>
-                                                <connections>
-                                                    <action selector="exitButtonAction:" target="-2" id="Kku-4m-T30"/>
-                                                </connections>
-                                            </button>
-                                        </subviews>
-                                    </view>
-                                    <constraints>
-                                        <constraint firstAttribute="width" constant="74" id="1er-PM-AqZ"/>
-                                        <constraint firstAttribute="height" constant="26" id="6d8-pV-4YK"/>
-                                    </constraints>
-                                </box>
-                                <box boxType="custom" borderWidth="0.0" cornerRadius="1" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="eVE-dl-Oe8">
-                                    <rect key="frame" x="474" y="9" width="74" height="26"/>
-                                    <view key="contentView" id="OXf-Ca-GEx">
-                                        <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
-                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                        <subviews>
-                                            <button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pzG-r6-BJl" customClass="KMCustomButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
-                                                <rect key="frame" x="0.0" y="0.0" width="74" height="26"/>
-                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                                <buttonCell key="cell" type="bevel" title="Save" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="udW-bE-j0F">
-                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                                    <font key="font" metaFont="system"/>
-                                                </buttonCell>
-                                                <connections>
-                                                    <action selector="saveButtonAction:" target="-2" id="aYF-ao-sD4"/>
-                                                </connections>
-                                            </button>
-                                        </subviews>
-                                    </view>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="26" id="AZg-uX-u6o"/>
-                                        <constraint firstAttribute="width" constant="74" id="wJe-Fd-VPo"/>
-                                    </constraints>
-                                </box>
-                            </subviews>
-                            <constraints>
-                                <constraint firstAttribute="height" constant="44" id="3Nv-UG-pV6"/>
-                                <constraint firstItem="Hl2-Ul-Rge" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="7HZ-GG-ADP"/>
-                                <constraint firstItem="gHQ-0K-XbK" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="GFG-2f-bpw"/>
-                                <constraint firstItem="eVE-dl-Oe8" firstAttribute="centerY" secondItem="0a0-Fd-gka" secondAttribute="centerY" id="dO6-sh-x3I"/>
-                                <constraint firstItem="Hl2-Ul-Rge" firstAttribute="leading" secondItem="0a0-Fd-gka" secondAttribute="leading" constant="20" id="fda-ry-iQg"/>
-                                <constraint firstItem="eVE-dl-Oe8" firstAttribute="leading" secondItem="gHQ-0K-XbK" secondAttribute="trailing" constant="24" id="jJH-v2-8zV"/>
-                                <constraint firstAttribute="trailing" secondItem="eVE-dl-Oe8" secondAttribute="trailing" constant="24" id="jrj-SY-dGC"/>
-                            </constraints>
-                        </customView>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="LSe-Oi-yzJ">
-                            <rect key="frame" x="0.0" y="299" width="572" height="44"/>
-                            <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OGs-L1-cgc">
-                                    <rect key="frame" x="62" y="14" width="118" height="17"/>
-                                    <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Signature is valid." id="8Io-Az-nZb">
-                                        <font key="font" metaFont="system" size="14"/>
-                                        <color key="textColor" red="0.1529411765" green="0.23529411759999999" blue="0.38431372549999998" alpha="1" colorSpace="calibratedRGB"/>
-                                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                                    </textFieldCell>
-                                </textField>
-                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Yrb-Nx-Xvp">
-                                    <rect key="frame" x="20" y="8" width="28" height="28"/>
-                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="ImageNameSigntureVerifySuccess" imagePosition="only" alignment="center" inset="2" id="CSb-kc-4bZ">
-                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                        <font key="font" metaFont="system"/>
-                                    </buttonCell>
-                                    <constraints>
-                                        <constraint firstAttribute="height" constant="28" id="KTF-vp-57P"/>
-                                        <constraint firstAttribute="width" constant="28" id="pH4-eK-D99"/>
-                                    </constraints>
-                                </button>
-                            </subviews>
-                            <constraints>
-                                <constraint firstItem="OGs-L1-cgc" firstAttribute="leading" secondItem="Yrb-Nx-Xvp" secondAttribute="trailing" constant="16" id="InY-f8-nYB"/>
-                                <constraint firstAttribute="height" constant="44" id="LP5-qS-vlI"/>
-                                <constraint firstItem="Yrb-Nx-Xvp" firstAttribute="centerY" secondItem="LSe-Oi-yzJ" secondAttribute="centerY" id="OhR-G4-aH5"/>
-                                <constraint firstItem="Yrb-Nx-Xvp" firstAttribute="leading" secondItem="LSe-Oi-yzJ" secondAttribute="leading" constant="20" id="bzp-4D-Iad"/>
-                                <constraint firstItem="OGs-L1-cgc" firstAttribute="centerY" secondItem="LSe-Oi-yzJ" secondAttribute="centerY" id="tp1-ZU-dCo"/>
-                            </constraints>
-                        </customView>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Zqz-md-wWY">
-                            <rect key="frame" x="0.0" y="0.0" width="572" height="299"/>
-                        </customView>
-                    </subviews>
-                    <constraints>
-                        <constraint firstItem="0a0-Fd-gka" firstAttribute="top" secondItem="SJ2-pS-M3B" secondAttribute="top" id="55g-wO-0OT"/>
-                        <constraint firstItem="DXG-U6-4uT" firstAttribute="top" secondItem="SJ2-pS-M3B" secondAttribute="top" id="85x-iQ-2Rx"/>
-                        <constraint firstAttribute="bottom" secondItem="Zqz-md-wWY" secondAttribute="bottom" id="FUC-Kx-gTD"/>
-                        <constraint firstAttribute="trailing" secondItem="0a0-Fd-gka" secondAttribute="trailing" id="G1W-22-Qz7"/>
-                        <constraint firstAttribute="trailing" secondItem="DXG-U6-4uT" secondAttribute="trailing" id="LTi-Nv-1wb"/>
-                        <constraint firstAttribute="trailing" secondItem="Zqz-md-wWY" secondAttribute="trailing" id="O3j-vR-LrR"/>
-                        <constraint firstItem="LSe-Oi-yzJ" firstAttribute="top" secondItem="0a0-Fd-gka" secondAttribute="bottom" id="T4w-1s-hJl"/>
-                        <constraint firstItem="Zqz-md-wWY" firstAttribute="top" secondItem="0a0-Fd-gka" secondAttribute="bottom" constant="44" id="TVB-8H-a7j"/>
-                        <constraint firstItem="DXG-U6-4uT" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="U7y-2w-BWo"/>
-                        <constraint firstItem="0a0-Fd-gka" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="Xr7-mF-Gp6"/>
-                        <constraint firstAttribute="trailing" secondItem="LSe-Oi-yzJ" secondAttribute="trailing" id="Yh1-Yn-0lm"/>
-                        <constraint firstItem="LSe-Oi-yzJ" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="gFX-ft-SN3"/>
-                        <constraint firstItem="Zqz-md-wWY" firstAttribute="leading" secondItem="SJ2-pS-M3B" secondAttribute="leading" id="pXw-1w-Uie"/>
-                    </constraints>
-                </customView>
-            </subviews>
-            <constraints>
-                <constraint firstAttribute="bottom" secondItem="SJ2-pS-M3B" secondAttribute="bottom" id="EUd-sg-sLZ"/>
-                <constraint firstItem="SJ2-pS-M3B" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="L88-8E-hNk"/>
-                <constraint firstAttribute="trailing" secondItem="SJ2-pS-M3B" secondAttribute="trailing" id="R3R-Qo-tcK"/>
-                <constraint firstItem="SJ2-pS-M3B" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="XUe-4Q-CHV"/>
-            </constraints>
-            <point key="canvasLocation" x="75" y="188.5"/>
-        </customView>
-    </objects>
-    <resources>
-        <image name="ImageNameSigntureVerifySuccess" width="32" height="32"/>
-    </resources>
-</document>

+ 1 - 1
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureCertificateStateViewController.swift

@@ -18,7 +18,7 @@ class CDSignatureCertificateStateViewController: NSViewController {
     @IBOutlet weak var closeBtn: NSButton!
     
     var signature: CPDFSignature!
-    var pdfListView: CPDFDigtalView!
+    weak var pdfListView: CPDFListView?
     
     var actionBlock: ((_ stateVC: CDSignatureCertificateStateViewController, _ actionType: DSignatureActionType)->Void)?
  

+ 1 - 1
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureDetailsViewController.swift

@@ -458,7 +458,7 @@ class DSignatureDetailsViewController: NSViewController, NSTableViewDelegate, NS
         if success {
             self.updateCertificateData()
             if self.signature != nil {
-                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CSignatureTrustCerDidChangeNotification"), object: nil)
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "CSignatureTrustCerDidChangeNotification"), object: pdfListView)
                 self.signature.verifySignature(with: self.pdfListView.document)
             }
             

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView+Private.h

@@ -46,6 +46,8 @@ enum {
 
 @property (nonatomic, assign) CGFloat magnification;
 
+@property (nonatomic, retain) CPDFAnnotation * editAnnotation;
+
 @property (nonatomic, retain) NSMutableArray <CPDFAnnotation *>*activeAnnotations;
 
 @property (nonatomic, assign) BOOL isClickDoubleCreatLine;

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.h

@@ -166,6 +166,8 @@ enum {
 
 @property (nonatomic, readonly) CPDFAnnotation * activeAnnotation;
 
+@property (nonatomic, readonly) CPDFAnnotation * editAnnotation;
+
 // Methods for The annotation type currently selected.
 
 @property (nonatomic, assign) CAnnotationType annotationType;

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -1191,6 +1191,8 @@ void CPDFListViewOCDrawLineHandles(CGContextRef context, CGRect rect, CGFloat ra
 }
 
 - (void)editAnnotation:(CPDFAnnotation *)annotation {
+    self.editAnnotation = annotation;
+    
     if ([annotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
         [self editAnnotationFreeText:(CPDFFreeTextAnnotation *)annotation];
         [[self window] makeFirstResponder:self];

+ 2 - 10
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+MenuAction.swift

@@ -568,11 +568,7 @@ extension KMMainViewController: KMSystemPDFMenuProtocol {
         if (self.listView.canZoomIn) {
             self.listView.zoomIn(nil)
         }
-        if self.digitalSignController?.pdfView != nil {
-            if (self.digitalSignController?.pdfView.canZoomIn) == true {
-                self.digitalSignController?.pdfView.zoomIn(nil)
-            }
-        }
+        
         if self.redactController?.redactPdfView != nil {
             if (self.redactController?.redactPdfView.canZoomIn) == true {
                 self.redactController?.redactPdfView.zoomIn(nil)
@@ -584,11 +580,7 @@ extension KMMainViewController: KMSystemPDFMenuProtocol {
         if (self.listView.canZoomOut) {
             self.listView.zoomOut(nil)
         }
-        if self.digitalSignController?.pdfView != nil {
-            if (self.digitalSignController?.pdfView.canZoomOut) == true {
-                self.digitalSignController?.pdfView.zoomOut(nil)
-            }
-        }
+        
         if self.redactController?.redactPdfView != nil {
             if (self.redactController?.redactPdfView.canZoomOut) == true {
                 self.redactController?.redactPdfView.zoomOut(nil)

+ 25 - 82
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -162,10 +162,7 @@ struct KMNMWCFlags {
     
     var currentWindowController: NSWindowController!
     var savedNormalSetup: NSMutableDictionary = NSMutableDictionary()
-    
-    //数字签名
-    var digitalSignController: KMPDFDigitalSignViewController?
-    
+        
     var redactController: KMPDFRedactViewController!
     
     let CPDFOfficeLeftSidePaneWidthKey = "CPDFOfficeLeftSidePaneWidthKey"
@@ -444,6 +441,8 @@ struct KMNMWCFlags {
     private func addNotificationCenter() {
         NotificationCenter.default.addObserver(self, selector: #selector(annotationsAttributeHasChange), name: NSNotification.Name.CPDFListViewAnnotationsAttributeHasChange, object:nil)
         
+        NotificationCenter.default.addObserver(self, selector: #selector(signatureStateChangeNoti), name: NSNotification.Name(rawValue: "CSignatureTrustCerDidChangeNotification"), object: nil)
+        
     }
     
     private func loadUserDefaultsData() {
@@ -4253,6 +4252,28 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
             }
         }
     }
+    
+    @objc fileprivate func signatureStateChangeNoti(_ sender: Notification) {
+        guard let objecListView = sender.object as? CPDFListView else {
+            return
+        }
+        if listView == objecListView  {
+            reloadDigitalSigns()
+            
+            alertTipViewController.reloadDigitalAlertUI()
+            alertTipViewController.reloadAlertUIFrame()
+            
+            let signatureWidget = listView.editAnnotation
+            if let signatureWidgetAnnotation = signatureWidget as? CPDFSignatureWidgetAnnotation {
+                let signature = signatureWidgetAnnotation.signature()
+                if signature == nil {
+                    return
+                }
+                signaturestateVC.signature = signature
+                signaturestateVC.reloadData()
+            }
+        }
+    }
 }
 
 
@@ -4816,84 +4837,6 @@ extension KMMainViewController {
     open func hasEnterPageEdit() -> Bool {
         return self.getPDFEditController() != nil
     }
-    
-    
-    // MARK: - 数字签名
-    
-    func hasShowDigitalSign() -> Bool {
-        return self.digitalSignController?.view.superview != nil
-    }
-    
-    func canEnterDigitalSign() -> Bool {
-        guard let doc = self.listView.document else {
-            return false
-        }
-        return doc.allowsPrinting && doc.allowsCopying
-    }
-    
-    func enterDigitalSign() {
-        self.listView.toolMode = .CTextToolMode
-        if self.hasShowDigitalSign() {
-            self.exitDigitalSign()
-        } else {
-            if self.needSaveDocument() {
-                self.saveDocumentWithProgressAlert { [unowned self] params in
-                    if (self.listView.document != nil) {
-                        self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
-                    }
-                }
-                return
-            }
-            if (self.listView.document != nil) {
-                self.showDigitalSignWindow(withFilePathURL: self.listView.document.documentURL)
-            }
-        }
-    }
-    
-    func exitDigitalSign() {
-        self.digitalSignController?.view.removeFromSuperview()
-        
-        // KMDocumentDigitalSignToolbarItemIdentifier
-    }
-    
-    func showDigitalSignWindow(withFilePathURL fileURL: URL) {
-        if !IAPProductsManager.default().isAvailableAllFunction(){
-            let winC = KMPurchaseCompareWindowController.sharedInstance()
-            winC?.kEventName = "Reading_DigitalSign_BuyNow"
-            winC?.showWindow(nil)
-            return
-        }
-        
-        if hasShowDigitalSign() {
-            self.exitDigitalSign()
-        }
-        
-        var currentPageIndex = listView.document?.index(for: listView.currentPage()) ?? 0
-        var password: String = ""
-        
-        password = listView.document?.password ?? ""
-        
-        digitalSignController = KMPDFDigitalSignViewController()
-        
-        digitalSignController?.currentPageIndex = Int(currentPageIndex)
-        digitalSignController?.url = listView.document?.documentURL
-        digitalSignController?.password = password
-        digitalSignController?.scaleFactor = listView.scaleFactor
-        
-        digitalSignController?.titleChangeBlock = { title, index in
-            currentPageIndex = UInt(index)
-        }
-        
-        digitalSignController?.buttonActionBlock = { [weak self] type, isChanged in
-            if type == .cancel {
-                if let page = self?.listView.document?.page(at: currentPageIndex) {
-                    self?.listView.go(to: page)
-                }
-                self?.exitDigitalSign()
-            }
-        }
-        
-    }
      
     // MARK: - Private Methods
     

+ 0 - 1
PDF Office/PDF Master/PDF_Reader_Pro DMG-Bridging-Header.h

@@ -55,7 +55,6 @@
 
 //数字签名
 #import "KMDSignatureManager.h"
-#import "CPDFDigtalView.h"
 #import "CDSDrawView.h"
 #import "CPDFSignatureWidgetAnnotation+PDFListView.h"
 

+ 0 - 1
PDF Office/PDF Master/PDF_Reader_Pro Edition-Bridging-Header.h

@@ -54,7 +54,6 @@
 #import "NewTabButton.h"
 //数字签名
 #import "KMDSignatureManager.h"
-#import "CPDFDigtalView.h"
 #import "CDSDrawView.h"
 #import "CPDFSignatureWidgetAnnotation+PDFListView.h"
 

+ 0 - 1
PDF Office/PDF Master/PDF_Reader_Pro-Bridging-Header.h

@@ -57,7 +57,6 @@
 #import "NewTabButton.h"
 //数字签名
 #import "KMDSignatureManager.h"
-#import "CPDFDigtalView.h"
 #import "CDSDrawView.h"
 #import "CPDFSignatureWidgetAnnotation+PDFListView.h"
 

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

@@ -1679,15 +1679,9 @@
 		ADDEEA9A2AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDEEA992AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift */; };
 		ADDEEA9B2AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDEEA992AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift */; };
 		ADDEEA9C2AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDEEA992AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift */; };
-		ADDF83202B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E22B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift */; };
-		ADDF83212B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E22B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift */; };
-		ADDF83222B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E22B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift */; };
 		ADDF83232B391A5C00A81A4E /* CDSDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E42B391A5C00A81A4E /* CDSDrawView.m */; };
 		ADDF83242B391A5C00A81A4E /* CDSDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E42B391A5C00A81A4E /* CDSDrawView.m */; };
 		ADDF83252B391A5C00A81A4E /* CDSDrawView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E42B391A5C00A81A4E /* CDSDrawView.m */; };
-		ADDF83262B391A5C00A81A4E /* CPDFDigtalView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E52B391A5C00A81A4E /* CPDFDigtalView.m */; };
-		ADDF83272B391A5C00A81A4E /* CPDFDigtalView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E52B391A5C00A81A4E /* CPDFDigtalView.m */; };
-		ADDF83282B391A5C00A81A4E /* CPDFDigtalView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E52B391A5C00A81A4E /* CPDFDigtalView.m */; };
 		ADDF83292B391A5C00A81A4E /* CPDFSelection+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E92B391A5C00A81A4E /* CPDFSelection+PDFListView.m */; };
 		ADDF832A2B391A5C00A81A4E /* CPDFSelection+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E92B391A5C00A81A4E /* CPDFSelection+PDFListView.m */; };
 		ADDF832B2B391A5C00A81A4E /* CPDFSelection+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82E92B391A5C00A81A4E /* CPDFSelection+PDFListView.m */; };
@@ -1709,9 +1703,6 @@
 		ADDF833B2B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F42B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m */; };
 		ADDF833C2B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F42B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m */; };
 		ADDF833D2B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F42B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m */; };
-		ADDF833E2B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADDF82F52B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib */; };
-		ADDF833F2B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADDF82F52B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib */; };
-		ADDF83402B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = ADDF82F52B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib */; };
 		ADDF83412B391A5C00A81A4E /* DSignatureConfigWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F72B391A5C00A81A4E /* DSignatureConfigWindowController.swift */; };
 		ADDF83422B391A5C00A81A4E /* DSignatureConfigWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F72B391A5C00A81A4E /* DSignatureConfigWindowController.swift */; };
 		ADDF83432B391A5C00A81A4E /* DSignatureConfigWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADDF82F72B391A5C00A81A4E /* DSignatureConfigWindowController.swift */; };
@@ -5275,10 +5266,7 @@
 		ADDEEA792AD3F4C800EF675D /* KMPopUpButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPopUpButton.swift; sourceTree = "<group>"; };
 		ADDEEA7D2AD3FB1D00EF675D /* KMImageAccessoryController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMImageAccessoryController.swift; sourceTree = "<group>"; };
 		ADDEEA992AD7BB2D00EF675D /* KMAnnotationPropertiesColorManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationPropertiesColorManager.swift; sourceTree = "<group>"; };
-		ADDF82E22B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMPDFDigitalSignViewController.swift; sourceTree = "<group>"; };
-		ADDF82E32B391A5C00A81A4E /* CPDFDigtalView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFDigtalView.h; sourceTree = "<group>"; };
 		ADDF82E42B391A5C00A81A4E /* CDSDrawView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDSDrawView.m; sourceTree = "<group>"; };
-		ADDF82E52B391A5C00A81A4E /* CPDFDigtalView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFDigtalView.m; sourceTree = "<group>"; };
 		ADDF82E72B391A5C00A81A4E /* NSEvent+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSEvent+PDFListView.h"; sourceTree = "<group>"; };
 		ADDF82E82B391A5C00A81A4E /* CPDFAnnotation+PDFListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPDFAnnotation+PDFListView.h"; sourceTree = "<group>"; };
 		ADDF82E92B391A5C00A81A4E /* CPDFSelection+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFSelection+PDFListView.m"; sourceTree = "<group>"; };
@@ -5293,7 +5281,6 @@
 		ADDF82F22B391A5C00A81A4E /* CPDFListViewConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFListViewConfig.m; sourceTree = "<group>"; };
 		ADDF82F32B391A5C00A81A4E /* CPDFSignatureAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFSignatureAnnotation+PDFListView.m"; sourceTree = "<group>"; };
 		ADDF82F42B391A5C00A81A4E /* CPDFSignatureWidgetAnnotation+PDFListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CPDFSignatureWidgetAnnotation+PDFListView.m"; sourceTree = "<group>"; };
-		ADDF82F52B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMPDFDigitalSignViewController.xib; sourceTree = "<group>"; };
 		ADDF82F62B391A5C00A81A4E /* CDSDrawView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDSDrawView.h; sourceTree = "<group>"; };
 		ADDF82F72B391A5C00A81A4E /* DSignatureConfigWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DSignatureConfigWindowController.swift; sourceTree = "<group>"; };
 		ADDF82F82B391A5C00A81A4E /* KMDSignatureManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMDSignatureManager.h; sourceTree = "<group>"; };
@@ -8843,11 +8830,7 @@
 		ADDF82E12B391A5C00A81A4E /* CPDFDigtalView */ = {
 			isa = PBXGroup;
 			children = (
-				ADDF82E22B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift */,
-				ADDF82F52B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib */,
-				ADDF82E32B391A5C00A81A4E /* CPDFDigtalView.h */,
 				ADDF82E42B391A5C00A81A4E /* CDSDrawView.m */,
-				ADDF82E52B391A5C00A81A4E /* CPDFDigtalView.m */,
 				ADDF82E62B391A5C00A81A4E /* Event */,
 				ADDF82F62B391A5C00A81A4E /* CDSDrawView.h */,
 			);
@@ -13073,7 +13056,6 @@
 				BB0FE04F2B734DD1001E0F88 /* AIPurchaseWindowController.xib in Resources */,
 				6554450B2C88483C00BD9010 /* KMDiscountToSaveWindowController.xib in Resources */,
 				BBAC26AC2AFE31F400563A08 /* KMBatchOperateAddPasswordViewController.xib in Resources */,
-				ADDF833E2B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */,
 				ADB2D6FD294882B70029D2B3 /* KMTextFieldStepperView.xib in Resources */,
 				BB69C95F299116FD0001A9B1 /* plaid.pdf in Resources */,
 				89D2D2FE294C806000BFF5FE /* KMPDFThumbnailItem.xib in Resources */,
@@ -13463,7 +13445,6 @@
 				BBE788C72CBD2463008086E2 /* SelectVC.xib in Resources */,
 				9F8539DB294318D600DF644E /* TabsImage.xcassets in Resources */,
 				BB88106B2B4F771D00AFA63E /* KMVerificationInfoViewController.xib in Resources */,
-				ADDF833F2B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */,
 				BB6192342D13E9F0003FDEA6 /* FillDateController.xib in Resources */,
 				BBBAECF92B57672C00266BD3 /* TransitionSheet.xib in Resources */,
 				BBD8EE912B8EC86900EB05FE /* AutoSavePopController.xib in Resources */,
@@ -14054,7 +14035,6 @@
 				ADE86AE22B0AF4B600414DFA /* KMCompareContentSettingWindowController.xib in Resources */,
 				BB9AEB322D0FC9A0004BF8D2 /* FormsCheckBoxController.xib in Resources */,
 				ADBC374729CAD2D300D93208 /* SF-Pro-Text-Bold.otf in Resources */,
-				ADDF83402B391A5C00A81A4E /* KMPDFDigitalSignViewController.xib in Resources */,
 				ADD1B6C12942DD3D00C3FFF7 /* KMPrintChooseView.xib in Resources */,
 				F367D4E42CFD62DB00B0BB4E /* KMNPopAnnotationWindowController.xib in Resources */,
 				AD055E2A2B70B3C10035F824 /* KMBookmarkController.xib in Resources */,
@@ -14445,7 +14425,6 @@
 				9FCFECA42AD237B500EAD2CB /* KMBatchTableRowView.swift in Sources */,
 				BB86C1ED28F544F4005AD968 /* CPDFListView+Event.m in Sources */,
 				BB88E454294045B4002B3655 /* KMPDFConvertManager.swift in Sources */,
-				ADDF83202B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */,
 				BB52F5512CC1FAB2007418DB /* KMLinkViewController.swift in Sources */,
 				BBBE20932B21B18900509C4E /* KMPDFInsertWindowController.swift in Sources */,
 				BBC28F4A2B0F509B00D73206 /* KMAnimatedBorderlessWindow.swift in Sources */,
@@ -14568,7 +14547,6 @@
 				9F1FE4B729406E4700E952CA /* CTBrowserFrameView.m in Sources */,
 				BB4EEF3C29764578003A3537 /* KMRedactPropertyContentView.swift in Sources */,
 				BBE788B72CBD2463008086E2 /* PaginationVC.swift in Sources */,
-				ADDF83262B391A5C00A81A4E /* CPDFDigtalView.m in Sources */,
 				BBFEF7132B3A766C00C28AC0 /* KMSystemMenu.swift in Sources */,
 				BBE068A22CDDF149000512BC /* KMBatesTemplateItem.swift in Sources */,
 				9F1FE4D529406E4700E952CA /* NSPasteboard+Utils.m in Sources */,
@@ -15554,7 +15532,6 @@
 				ADAFDA142AE8DD6600F084BC /* KMAdvertisementCollectionViewItem.swift in Sources */,
 				BBB789A92BE8BF2400F7E09C /* AIChatFileInfoItem.swift in Sources */,
 				BBC28F4B2B0F509B00D73206 /* KMAnimatedBorderlessWindow.swift in Sources */,
-				ADDF83212B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */,
 				AD1FE8452BD7C98300AA4A9B /* KMPDFPosterPrintWindowController.m in Sources */,
 				BBD14F602CDA16080077D52E /* KMWatermarkSaveWindow.swift in Sources */,
 				65B143992CF06B97001B5A69 /* NSView+KMExtension.swift in Sources */,
@@ -15616,7 +15593,6 @@
 				BBBF68812A3BF17F0058E14E /* KMFilePromiseProvider.swift in Sources */,
 				AD1FE81E2BD7C98300AA4A9B /* KMBookletManager.m in Sources */,
 				9F1FE4A929406E4700E952CA /* CTBrowserWindowController.m in Sources */,
-				ADDF83272B391A5C00A81A4E /* CPDFDigtalView.m in Sources */,
 				BB00301E298CB799002DD1A0 /* KMPreferenceManager.swift in Sources */,
 				ADA9102F2A272CEA003352F0 /* KMImageOptimization.swift in Sources */,
 				AD9527DC2952EE700039D2BC /* KMPrintPage_C.swift in Sources */,
@@ -16822,12 +16798,10 @@
 				ADDF838B2B391A5D00A81A4E /* DSignatureFileListCellView.swift in Sources */,
 				BB46CF4E2AFBB34900281EDF /* AutoSaveManager.swift in Sources */,
 				ADD1B6BD29420B4A00C3FFF7 /* KMPrintPreviewView.swift in Sources */,
-				ADDF83222B391A5C00A81A4E /* KMPDFDigitalSignViewController.swift in Sources */,
 				651675D52CE3312000019A20 /* KMBOTAOutlineRowView.swift in Sources */,
 				BB5A9D5A2CB6521400F64C1F /* SettingsGeneralView.swift in Sources */,
 				BB6B436D2A04935000E02B54 /* KMPDFThumbViewBaseController.swift in Sources */,
 				BB1E7F322B511079002D9785 /* SKInspectPublicTool.swift in Sources */,
-				ADDF83282B391A5C00A81A4E /* CPDFDigtalView.m in Sources */,
 				F367D4DC2CFC2F5B00B0BB4E /* KMNAnnotationPopMode.swift in Sources */,
 				AD7D5CA22B8F34EC006562CD /* SKPDFSynchronizer.m in Sources */,
 				F34BF928295303E8002C25A2 /* NSCursor+PDFListView.m in Sources */,