Ver Fonte

Merge branch 'compdfkit_demo_ios' of git.kdan.cc:others/kmpdfkit_demo into compdfkit_demo_ios

chenyu há 1 ano atrás
pai
commit
1db7322ee1

+ 12 - 0
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -191,6 +191,9 @@
 		F38F5B682A03D68100D0EEFD /* CPDFListMagnifierView.h in Headers */ = {isa = PBXBuildFile; fileRef = F38F5B662A03D68100D0EEFD /* CPDFListMagnifierView.h */; };
 		F38F60C629EFF0C2008098F8 /* CPDFColorUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = F38F60C429EFF0C1008098F8 /* CPDFColorUtils.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F38F60C729EFF0C2008098F8 /* CPDFColorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = F38F60C529EFF0C1008098F8 /* CPDFColorUtils.m */; };
+		F3DF83D42A0BB9BA00D4F3AF /* CStringConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DF83D22A0BB9BA00D4F3AF /* CStringConstants.h */; };
+		F3DF83D52A0BB9BA00D4F3AF /* CStringConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = F3DF83D32A0BB9BA00D4F3AF /* CStringConstants.m */; };
+		F3DF83D72A0BBBB900D4F3AF /* InitialUserDefaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = F3DF83D62A0BBBB900D4F3AF /* InitialUserDefaults.plist */; };
 		F3E8495929E69712007BE967 /* DisplayImage.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3E8495829E69712007BE967 /* DisplayImage.xcassets */; };
 /* End PBXBuildFile section */
 
@@ -397,6 +400,9 @@
 		F38F5B662A03D68100D0EEFD /* CPDFListMagnifierView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFListMagnifierView.h; sourceTree = "<group>"; };
 		F38F60C429EFF0C1008098F8 /* CPDFColorUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPDFColorUtils.h; sourceTree = "<group>"; };
 		F38F60C529EFF0C1008098F8 /* CPDFColorUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPDFColorUtils.m; sourceTree = "<group>"; };
+		F3DF83D22A0BB9BA00D4F3AF /* CStringConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CStringConstants.h; sourceTree = "<group>"; };
+		F3DF83D32A0BB9BA00D4F3AF /* CStringConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CStringConstants.m; sourceTree = "<group>"; };
+		F3DF83D62A0BBBB900D4F3AF /* InitialUserDefaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = InitialUserDefaults.plist; sourceTree = "<group>"; };
 		F3E8495829E69712007BE967 /* DisplayImage.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DisplayImage.xcassets; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -720,6 +726,9 @@
 		C9B9EC5629F54E6700C6A5D2 /* Model */ = {
 			isa = PBXGroup;
 			children = (
+				F3DF83D62A0BBBB900D4F3AF /* InitialUserDefaults.plist */,
+				F3DF83D22A0BB9BA00D4F3AF /* CStringConstants.h */,
+				F3DF83D32A0BB9BA00D4F3AF /* CStringConstants.m */,
 				C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */,
 				C9B9EC5829F54E9600C6A5D2 /* CAnnotStyle.m */,
 			);
@@ -1109,6 +1118,7 @@
 				F32DA16529ED904300E19ECA /* CPDFOutlineViewController.h in Headers */,
 				4F06AB5729F6792E007797E4 /* CPDFImageProperty.h in Headers */,
 				F35DD19D2A06850700B57F5B /* CPDFLineAnnotation+PDFListView.h in Headers */,
+				F3DF83D42A0BB9BA00D4F3AF /* CStringConstants.h in Headers */,
 				C918CEA029F8F74000D43974 /* CPDFStrikeoutViewController.h in Headers */,
 				C91BE7E62A04AD880038F2BC /* CSignatureTopBar.h in Headers */,
 				F38F60C629EFF0C2008098F8 /* CPDFColorUtils.h in Headers */,
@@ -1192,6 +1202,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F3DF83D72A0BBBB900D4F3AF /* InitialUserDefaults.plist in Resources */,
 				C9AF183329EFC63300EC4979 /* Images.xcassets in Resources */,
 				C918CED129FA490000D43974 /* Image.xcassets in Resources */,
 				F32DA16E29ED904300E19ECA /* Images.xcassets in Resources */,
@@ -1244,6 +1255,7 @@
 				C918CEA629F8FC1800D43974 /* CPDFUnderlineViewController.m in Sources */,
 				C918CEE429FBA41A00D43974 /* CPDFDrawArrowView.m in Sources */,
 				F32DA16929ED904300E19ECA /* CPDFSearchResultsViewController.m in Sources */,
+				F3DF83D52A0BB9BA00D4F3AF /* CStringConstants.m in Sources */,
 				F32DA16D29ED904300E19ECA /* CPDFSearchViewCell.m in Sources */,
 				F35DD1982A06850700B57F5B /* CPDFFreeTextAnnotation+PDFListView.m in Sources */,
 				4FD34DFA2A0B9DB2005CEAB6 /* UIViewController+LeftItem.m in Sources */,

+ 3 - 6
compdfkit-tools/compdfkit-tools/Annotation/PDFAnnotationManage/CAnnotationManage.h

@@ -11,6 +11,7 @@
 //
 
 #import <UIKit/UIKit.h>
+#import <compdfkit_tools/CPDFListView.h>
 
 NS_ASSUME_NONNULL_BEGIN
 
@@ -28,13 +29,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)setAnnotStyleFromAnnotations:(NSArray<CPDFAnnotation *> *)annotations;
 
-- (void)setAnnotStyleFromMode:(NSInteger)annotationMode;
+- (void)setAnnotStyleFromMode:(CPDFViewAnnotationMode)annotationMode;
 
-- (void)refreshAnnotation:(CAnnotStyle *)annotStyle;
-
-- (void)resetAnnotation:(CAnnotStyle *)annotStyle;
-
-- (void)setAnnotStyleFromAnnotation:(CPDFAnnotation *)annotation;
+- (void)refreshPageWithAnnotations:(NSArray *)annotations;
 /**
  * Get the default color of highlight annotations.
  */

+ 13 - 99
compdfkit-tools/compdfkit-tools/Annotation/PDFAnnotationManage/CAnnotationManage.m

@@ -39,111 +39,25 @@
 #pragma mark - Publice Methods
 
 - (void)setAnnotStyleFromAnnotations:(NSArray<CPDFAnnotation *> *)annotations {
-    self.annotStyle = [[CAnnotStyle alloc] init];
-    self.annotation = annotations.firstObject;
-    self.annotStyle.isSelectAnnot = YES;
-    if ([self.annotation isKindOfClass:[CPDFTextAnnotation class]]) {
-        self.annotStyle.annotMode = CPDFViewAnnotationModeNote;
-        self.annotStyle.color = ((CPDFTextAnnotation *)self.annotation).color;
-    } else if ([self.annotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
-        switch ([(CPDFMarkupAnnotation *)self.annotation markupType]) {
-            case CPDFMarkupTypeHighlight:
-            {
-                self.annotStyle.annotMode = CPDFViewAnnotationModeHighlight;
-                self.annotStyle.color = self.annotation.color;
-                self.annotStyle.opacity = self.annotation.opacity;
-            }
-                break;
-            case CPDFMarkupTypeUnderline:
-            {
-                self.annotStyle.annotMode = CPDFViewAnnotationModeUnderline;
-                self.annotStyle.color = self.annotation.color;
-                self.annotStyle.opacity = self.annotation.opacity;
-            }
-                break;
-            case CPDFMarkupTypeStrikeOut:
-            {
-                self.annotStyle.annotMode = CPDFViewAnnotationModeStrikeout;
-                self.annotStyle.color = self.annotation.color;
-                self.annotStyle.opacity = self.annotation.opacity;
-            }
-                break;
-            case CPDFMarkupTypeSquiggly:
-            {
-                self.annotStyle.annotMode = CPDFViewAnnotationModeSquiggly;
-                self.annotStyle.color = self.annotation.color;
-                self.annotStyle.opacity = self.annotation.opacity;
-            }
-                break;
-        }
-        
-    } else if ([self.annotation isKindOfClass:[CPDFCircleAnnotation class]]) {
-        self.annotStyle.annotMode = CPDFViewAnnotationModeCircle;
-        self.annotStyle.color = self.annotation.color;
-        self.annotStyle.fillColor = ((CPDFCircleAnnotation *)self.annotation).interiorColor;
-        self.annotStyle.borderStyle = self.annotation.border.style;
-        self.annotStyle.borderWidth = self.annotation.border.lineWidth;
-        if (self.annotation.border.dashPattern) {
-            self.annotStyle.dashPattern = self.annotation.border.dashPattern;
-        } else {
-            self.annotStyle.dashPattern = @[@10, @0];
-        }
-        self.annotStyle.opacity = self.annotation.opacity;
-        self.annotation.borderWidth = self.annotation.borderWidth;
-    }
+    self.annotStyle = [[CAnnotStyle alloc] initWithAnnotionMode:CPDFViewAnnotationModeNote annotations:annotations];
 }
 
-- (void)setAnnotStyleFromMode:(NSInteger)annotationMode {
-    self.annotStyle = [[CAnnotStyle alloc] initWithAnnotionMode:annotationMode isSelectAnnot:NO];
-}
-
-- (void)refreshAnnotation:(CAnnotStyle *)annotStyle {
-    self.annotStyle = annotStyle;
-    switch (annotStyle.annotMode) {
-        case CPDFViewAnnotationModeNote:
-        {
-            self.pdfListView.activeAnnotations.firstObject.color = self.annotStyle.color;
-            self.pdfListView.activeAnnotations.firstObject.opacity = 1.0;
-
-            [self.pdfListView setNeedsDisplayForPage:self.pdfListView.activeAnnotations.firstObject.page];
+- (void)refreshPageWithAnnotations:(NSArray *)annotations {
+    NSMutableArray *pages = [NSMutableArray array];
+    for (CPDFAnnotation * annotation in annotations) {
+        CPDFPage *page = annotation.page;
+        if(![pages containsObject:page]) {
+            [pages addObject:page];
         }
-            break;
-        case CPDFViewAnnotationModeHighlight ... CPDFViewAnnotationModeSquiggly: {
-            CPDFAnnotation *nowAnnotation = self.pdfListView.activeAnnotations.firstObject;
-            nowAnnotation.color = annotStyle.color;
-            nowAnnotation.opacity = annotStyle.opacity;
-            [self.pdfListView setNeedsDisplayForPage:self.pdfListView.activeAnnotations.firstObject.page];
-        }
-            break;
-        case CPDFViewAnnotationModeCircle:
-        {
-            CPDFAnnotation *nowAnnotation = self.pdfListView.activeAnnotations.firstObject;
-            nowAnnotation.color = annotStyle.color;
-            nowAnnotation.opacity = annotStyle.opacity;
-            CPDFBorder *border = [[CPDFBorder alloc] initWithStyle:annotStyle.borderStyle lineWidth:annotStyle.borderWidth dashPattern:annotStyle.dashPattern];
-            nowAnnotation.border = border;
-            ((CPDFCircleAnnotation *)nowAnnotation).interiorColor = self.annotStyle.fillColor;
-            ((CPDFCircleAnnotation *)nowAnnotation).interiorOpacity = self.annotStyle.opacity;
-            [self.pdfListView setNeedsDisplayForPage:self.pdfListView.activeAnnotations.firstObject.page];
-        }
-            break;
-        default:
-            break;
+        
+    }
+    for (CPDFPage *page in pages) {
+           [self.pdfListView setNeedsDisplayForPage:page];
     }
 }
 
-- (void)resetAnnotation:(CAnnotStyle *)annotStyle {
-    self.annotStyle = annotStyle;
-}
-
-- (void)setAnnotStyleFromAnnotation:(CPDFAnnotation *)annotation {
-    self.annotStyle = [[CAnnotStyle alloc] init];
-    self.annotation = annotation;
-    self.annotStyle.isSelectAnnot = YES;
-    if ([self.annotation isKindOfClass:[CPDFTextAnnotation class]]) {
-        self.annotStyle.annotMode = CPDFViewAnnotationModeNote;
-        self.annotStyle.color = self.annotation.color;
-    }
+- (void)setAnnotStyleFromMode:(CPDFViewAnnotationMode)annotationMode {
+    self.annotStyle = [[CAnnotStyle alloc] initWithAnnotionMode:annotationMode annotations:@[]];
 }
 
 + (CPDFKitPlatformColor *)highlightAnnotationColor {

+ 7 - 7
compdfkit-tools/compdfkit-tools/Annotation/PDFProperties/PDFShape/CPDFShapeCircleViewController.m

@@ -86,12 +86,12 @@
     self.sampleView.fillColor = self.annotStyle.color;
     self.sampleView.opcity = self.annotStyle.opacity;
     self.opacitySliderView.opacitySlider.value = self.annotStyle.opacity;
-    self.thicknessView.thicknessSlider.value = self.annotStyle.borderWidth;
-    self.sampleView.thickness = self.annotStyle.borderWidth;
+    self.thicknessView.thicknessSlider.value = self.annotStyle.lineWidth;
+    self.sampleView.thickness = self.annotStyle.lineWidth;
     self.dashPattern = (NSMutableArray *)self.annotStyle.dashPattern;
     self.dottedView.thicknessSlider.value = [self.dashPattern[1] floatValue];
     self.sampleView.dotted = [self.dashPattern[1] floatValue];
-    self.sampleView.fillShapeColor = self.annotStyle.fillColor;
+    self.sampleView.fillShapeColor = self.annotStyle.interiorColor;
     [self.sampleView setNeedsDisplay];
 }
 
@@ -127,14 +127,14 @@
 - (void)thicknessSliderView:(CPDFThicknessSliderView *)thicknessSliderView thickness:(CGFloat)thickness {
     if (thicknessSliderView == self.thicknessView) {
         self.sampleView.thickness = thickness;
-        self.annotStyle.borderWidth = thickness;
+        self.annotStyle.lineWidth = thickness;
         [self.sampleView setNeedsDisplay];
         if (self.delegate && [self.delegate respondsToSelector:@selector(circleViewController:annotStyle:)]) {
             [self.delegate circleViewController:self annotStyle:self.annotStyle];
         }
     } else if (thicknessSliderView == self.dottedView) {
         self.sampleView.dotted = thickness;
-        self.annotStyle.borderStyle = CPDFBorderStyleDashed;
+        self.annotStyle.style = CPDFBorderStyleDashed;
         self.annotStyle.dashPattern = @[@10, [NSNumber numberWithFloat:(float)thickness]];
         if (self.delegate && [self.delegate respondsToSelector:@selector(circleViewController:annotStyle:)]) {
             [self.delegate circleViewController:self annotStyle:self.annotStyle];
@@ -171,7 +171,7 @@
         }
     } else if (select == self.fillColorSelectView) {
         self.sampleView.fillShapeColor = color;
-        self.annotStyle.fillColor = color;
+        self.annotStyle.interiorColor = color;
         [self.sampleView setNeedsDisplay];
         if (self.delegate && [self.delegate respondsToSelector:@selector(circleViewController:annotStyle:)]) {
             [self.delegate circleViewController:self annotStyle:self.annotStyle];
@@ -191,7 +191,7 @@
         }
     } else if (colorPickerView == self.fillColorPicker) {
         self.sampleView.fillShapeColor = color;
-        self.annotStyle.fillColor = color;
+        self.annotStyle.interiorColor = color;
         [self.sampleView setNeedsDisplay];
         if (self.delegate && [self.delegate respondsToSelector:@selector(circleViewController:annotStyle:)]) {
             [self.delegate circleViewController:self annotStyle:self.annotStyle];

+ 34 - 24
compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.h

@@ -21,50 +21,60 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface CAnnotStyle : NSObject
 
-@property (nonatomic, strong) NSString *type;
+@property (nonatomic, readonly) CPDFViewAnnotationMode annotMode;
 
-@property (nonatomic, assign) CGRect bounds;
+@property (nonatomic, readonly) NSArray *annotations;
 
-@property (nonatomic, strong) NSString *contents;
+@property (nonatomic, readonly) BOOL isSelectAnnot;
 
-@property (nonatomic, assign) CGFloat borderWidth;
+- (instancetype)initWithAnnotionMode:(CPDFViewAnnotationMode)annotionMode annotations:(NSArray *)annotations;
 
-@property (nonatomic, assign) NSInteger borderStyle;
+#pragma mark - Common
 
-@property (nonatomic, strong) NSArray *dashPattern;
+- (UIColor *)color;
+- (void)setColor:(UIColor *)color;
 
-@property (nonatomic, strong) CPDFPage *page;
+- (CGFloat)opacity;
+- (void)setOpacity:(CGFloat)opacity;
 
-@property (nonatomic, assign) CGFloat opacity;
+- (CPDFBorderStyle)style;
+- (void)setStyle:(CPDFBorderStyle)style;
 
-@property (nonatomic, strong) UIColor *color;
+- (NSArray *)dashPattern;
+- (void)setDashPattern:(NSArray *)dashPattern;
 
-@property (nonatomic, strong) UIColor *fillColor;
+- (CGFloat)lineWidth;
+- (void)setLineWidth:(CGFloat)lineWidth;
 
-@property (nonatomic, assign) BOOL isNoRotate;
+#pragma mark - Line
 
-@property (nonatomic, assign) NSInteger annotMode;
+- (CPDFLineStyle)startLineStyle;
+- (void)setStartLineStyle:(CPDFLineStyle)startLineStyle;
 
-@property (nonatomic, assign) BOOL isSelectAnnot;
+- (CPDFLineStyle)endLineStyle;
+- (void)setEndLineStyle:(CPDFLineStyle)endLineStyle;
 
+#pragma mark - FreeText
 
-- (instancetype)initWithAnnotionMode:(NSInteger)annotionMode isSelectAnnot:(BOOL)isSelectAnnot;
+- (UIColor *)fontColor;
+- (void)setFontColor:(UIColor *)fontColor;
 
-- (instancetype)initWithAnnotionMode:(CPDFViewAnnotationMode)annotionMode annotations:(NSArray *)annotations;
+- (CGFloat)fontSize;
+- (void)setFontSize:(CGFloat)fontSize;
 
-#pragma mark - Common
+- (NSString *)fontName;
+- (void)setFontName:(NSString *)fontName;
 
-- (UIColor *)color;
-- (void)setColor:(UIColor *)color;
+- (NSTextAlignment)alignment;
+- (void)setAlignment:(NSTextAlignment)alignment;
 
-- (CGFloat)opacity;
-- (void)setOpacity:(CGFloat)opacity;
+#pragma mark - Circle&Square
 
-- (UIColor *)fillColor;
-- (void)setFillColor:(UIColor *)fillColor;
+- (UIColor *)interiorColor;
+- (void)setInteriorColor:(UIColor *)interiorColor;
 
-- (CGFloat)borderWidth;
-- (void)setBorderWidth:(CGFloat)borderWidth;
+- (CGFloat)interiorOpacity;
+- (void)setInteriorOpacity:(CGFloat)interiorOpacity;
 
 @end
 

Diff do ficheiro suprimidas por serem muito extensas
+ 690 - 524
compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.m


+ 117 - 0
compdfkit-tools/compdfkit-tools/Common/Model/CStringConstants.h

@@ -0,0 +1,117 @@
+//
+//  CStringConstants.h
+//  compdfkit-tools
+//
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
+//
+
+#import <Foundation/Foundation.h>
+
+extern NSString *CHighlightNoteColorKey;
+
+extern NSString *CHighlightNoteOpacityKey;
+
+extern NSString *CUnderlineNoteColorKey;
+
+extern NSString *CUnderlineNoteOpacityKey;
+
+extern NSString *CStrikeOutNoteColorKey;
+
+extern NSString *CStrikeOutNoteOpacityKey;
+
+extern NSString *CSquigglyNoteColorKey;
+
+extern NSString *CSquigglyNoteOpacityKey;
+
+extern NSString *CInkNoteColorKey;
+
+extern NSString *CInkNoteOpacityKey;
+
+extern NSString *CInkNoteLineWidthKey;
+
+extern NSString *CInkNoteLineStyleyKey;
+
+extern NSString *CInkNoteDashPatternKey;
+
+extern NSString *CFreeTextNoteFontNameKey;
+
+extern NSString *CFreeTextNoteFontSizeKey;
+
+extern NSString *CFreeTextNoteFontColorKey;
+
+extern NSString *CFreeTextNoteAlignmentKey;
+
+extern NSString *CFreeTextNoteColorKey;
+
+extern NSString *CFreeTextNoteOpacityKey;
+
+extern NSString *CFreeTextNoteBorderColorKey;
+
+extern NSString *CFreeTextNoteLineStyleKey;
+
+extern NSString *CFreeTextNoteLineWidthKey;
+
+extern NSString *CFreeTextNoteDashPatternKey;
+
+extern NSString *CAnchoredNoteColorKey;
+
+extern NSString *CAnchoredNoteOpacityKey;
+
+extern NSString *CAnchoredNoteIconTypeKey;
+
+extern NSString *CCircleNoteColorKey;
+
+extern NSString *CCircleNoteOpacityKey;
+
+extern NSString *CCircleNoteInteriorColorKey;
+
+extern NSString *CCircleNoteInteriorOpacityKey;
+
+extern NSString *CCircleNoteLineWidthKey;
+
+extern NSString *CCircleNoteLineStyleKey;
+
+extern NSString *CCircleNoteDashPatternKey;
+
+extern NSString *CSquareNoteColorKey;
+
+extern NSString *CSquareNoteOpacityKey;
+
+extern NSString *CSquareNoteInteriorColorKey;
+
+extern NSString *CSquareNoteInteriorOpacityKey;
+
+extern NSString *CSquareNoteLineWidthKey;
+
+extern NSString *CSquareNoteLineStyleKey;
+
+extern NSString *CSquareNoteDashPatternKey;
+
+extern NSString *CLineNoteColorKey;
+
+extern NSString *CLineNoteOpacityKey;
+
+extern NSString *CLineNoteLineWidthKey;
+
+extern NSString *CLineNoteLineStyleKey;
+
+extern NSString *CLineNoteDashPatternKey;
+
+extern NSString *CArrowNoteColorKey;
+
+extern NSString *CArrowNoteOpacityKey;
+
+extern NSString *CArrowNoteLineWidthKey;
+
+extern NSString *CArrowNoteLineStyleKey;
+
+extern NSString *CArrowNoteStartStyleKey;
+
+extern NSString *CArrowNoteEndStyleKey;
+
+extern NSString *CArrowNoteDashPatternKey;

+ 120 - 0
compdfkit-tools/compdfkit-tools/Common/Model/CStringConstants.m

@@ -0,0 +1,120 @@
+//
+//  CStringConstants.m
+//  compdfkit-tools
+//
+//  Copyright © 2014-2023 PDF Technologies, Inc. All Rights Reserved.
+//
+//  THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
+//  AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE ComPDFKit LICENSE AGREEMENT.
+//  UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
+//  This notice may not be removed from this file.
+//
+
+#import "CStringConstants.h"
+
+NSString *CHighlightNoteColorKey = @"CHighlightNoteColor";
+
+NSString *CHighlightNoteOpacityKey = @"CHighlightNoteOpacity";
+
+NSString *CUnderlineNoteColorKey = @"CUnderlineNoteColor";
+
+NSString *CUnderlineNoteOpacityKey = @"CUnderlineNoteOpacity";
+
+NSString *CStrikeOutNoteColorKey = @"CStrikeOutNoteColor";
+
+NSString *CStrikeOutNoteOpacityKey = @"CStrikeOutNoteOpacity";
+
+NSString *CSquigglyNoteColorKey = @"CSquigglyNoteColor";
+
+NSString *CSquigglyNoteOpacityKey = @"CSquigglyNoteOpacity";
+
+NSString *CInkNoteColorKey = @"CInkNoteColor";
+
+NSString *CInkNoteOpacityKey = @"CInkNoteOpacity";
+
+NSString *CInkNoteLineWidthKey = @"CInkNoteLineWidth";
+
+NSString * CInkNoteLineStyleyKey = @"CInkNoteLineStyley";
+
+NSString * CInkNoteDashPatternKey = @"CInkNoteDashPattern";
+
+NSString *CFreeTextNoteFontNameKey = @"CFreeTextNoteFontName";
+
+NSString *CFreeTextNoteFontSizeKey = @"CFreeTextNoteFontSize";
+
+NSString *CFreeTextNoteFontColorKey = @"CFreeTextNoteFontColor";
+
+NSString *CFreeTextNoteAlignmentKey = @"CFreeTextNoteAlignment";
+
+NSString *CFreeTextNoteColorKey = @"CFreeTextNoteColor";
+
+NSString *CFreeTextNoteOpacityKey = @"CFreeTextNoteOpacity";
+
+NSString *CFreeTextNoteBorderColorKey = @"CFreeTextNoteBorderColor";
+
+NSString *CFreeTextNoteLineStyleKey = @"CFreeTextNoteLineStyle";
+
+NSString *CFreeTextNoteLineWidthKey = @"CFreeTextNoteLineWidth";
+
+NSString *CFreeTextNoteDashPatternKey = @"CFreeTextNoteDashPattern";
+
+NSString *CAnchoredNoteColorKey = @"CAnchoredNoteColor";
+
+NSString *CAnchoredNoteOpacityKey = @"CAnchoredNoteOpacity";
+
+NSString *CAnchoredNoteIconTypeKey = @"CAnchoredNoteIconType";
+
+NSString *CCircleNoteColorKey = @"CCircleNoteColor";
+
+NSString *CCircleNoteOpacityKey = @"CCircleNoteOpacity";
+
+NSString *CCircleNoteInteriorColorKey = @"CCircleNoteInteriorColor";
+
+NSString *CCircleNoteInteriorOpacityKey = @"CCircleNoteInteriorOpacity";
+
+NSString *CCircleNoteLineWidthKey = @"CCircleNoteLineWidth";
+
+NSString *CCircleNoteLineStyleKey = @"CCircleNoteLineStyle";
+
+NSString *CCircleNoteDashPatternKey = @"CCircleNoteDashPattern";
+
+NSString *CSquareNoteColorKey = @"CSquareNoteColor";
+
+NSString *CSquareNoteOpacityKey = @"CSquareNoteOpacity";
+
+NSString *CSquareNoteInteriorColorKey = @"CSquareNoteInteriorColor";
+
+NSString *CSquareNoteInteriorOpacityKey = @"CSquareNoteInteriorOpacity";
+
+NSString *CSquareNoteLineWidthKey = @"CSquareNoteLineWidth";
+
+NSString *CSquareNoteLineStyleKey = @"CSquareNoteLineStyle";
+
+NSString *CSquareNoteDashPatternKey = @"CSquareNoteDashPattern";
+
+NSString *CLineNoteColorKey = @"CLineNoteColor";
+
+NSString *CLineNoteOpacityKey = @"CLineNoteOpacity";
+
+NSString *CLineNoteLineWidthKey = @"CLineNoteLineWidth";
+
+NSString *CLineNoteLineStyleKey = @"CLineNoteLineStyle";
+
+NSString *CLineNoteDashPatternKey = @"CLineNoteDashPattern";
+
+NSString *CArrowNoteColorKey = @"CArrowNoteColor";
+
+NSString *CArrowNoteOpacityKey = @"CArrowNoteOpacity";
+
+NSString *CArrowNoteLineWidthKey = @"CArrowNoteLineWidth";
+
+NSString *CArrowNoteLineStyleKey = @"CArrowNoteLineStyle";
+
+NSString *CArrowNoteStartStyleKey = @"CArrowNoteStartStyle";
+
+NSString *CArrowNoteEndStyleKey = @"CArrowNoteEndStyle";
+
+NSString *CArrowNoteDashPatternKey = @"CArrowNoteDashPattern";
+
+
+

+ 115 - 0
compdfkit-tools/compdfkit-tools/Common/Model/InitialUserDefaults.plist

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>RegisteredDefaults</key>
+	<dict>
+		<key>CHighlightNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQEAAYY=</data>
+		<key>CHighlightNoteOpacity</key>
+		<integer>1</integer>
+		<key>CUnderlineNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAIM/AAAAAAGG</data>
+		<key>CUnderlineNoteOpacity</key>
+		<integer>1</integer>
+		<key>CStrikeOutNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQAAAYY=</data>
+		<key>CStrikeOutNoteOpacity</key>
+		<integer>1</integer>
+		<key>CSquigglyNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQAAAYY=</data>
+		<key>CSquigglyNoteOpacity</key>
+		<integer>1</integer>
+		<key>CInkNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQAAAYY=</data>
+		<key>CInkNoteOpacity</key>
+		<integer>1</integer>
+		<key>CInkNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CInkNoteLineStyley</key>
+		<integer>0</integer>
+		<key>CInkNoteDashPattern</key>
+		<integer>5</integer>
+		<key>CEraserkNoteLineWidth</key>
+		<integer>10</integer>
+		<key>CFreeTextNoteFontName</key>
+		<string>Helvetica</string>
+		<key>CFreeTextNoteFontSize</key>
+		<integer>12</integer>
+		<key>CFreeTextNoteFontColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAAAAAYY=</data>
+		<key>CFreeTextNoteAlignment</key>
+		<integer>0</integer>
+		<key>CFreeTextNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMDhAJmZgAAhg==</data>
+		<key>CFreeTextNoteOpacity</key>
+		<integer>1</integer>
+		<key>CFreeTextNoteBorderColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAAAAAYY=</data>
+		<key>CFreeTextNoteLineStyle</key>
+		<integer>0</integer>
+		<key>CFreeTextNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CFreeTextNoteDashPattern</key>
+		<integer>5</integer>
+		<key>CAnchoredNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQGDPwAAAAGG</data>
+		<key>CAnchoredNoteOpacity</key>
+		<integer>1</integer>
+		<key>CAnchoredNoteIconType</key>
+		<integer>2</integer>
+		<key>CCircleNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAQAAAYY=</data>
+		<key>CCircleNoteOpacity</key>
+		<integer>1</integer>
+		<key>CCircleNoteInteriorColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMDhAJmZgAAhg==</data>
+		<key>CCircleNoteInteriorOpacity</key>
+		<integer>1</integer>
+		<key>CCircleNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CCircleNoteLineStyle</key>
+		<integer>0</integer>
+		<key>CCircleNoteDashPattern</key>
+		<integer>5</integer>
+		<key>CSquareNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAAEAAYY=</data>
+		<key>CSquareNoteOpacity</key>
+		<integer>1</integer>
+		<key>CSquareNoteInteriorColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMDhAJmZgAAhg==</data>
+		<key>CSquareNoteInteriorOpacity</key>
+		<integer>1</integer>
+		<key>CSquareNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CSquareNoteLineStyle</key>
+		<integer>0</integer>
+		<key>CSquareNoteDashPattern</key>
+		<integer>5</integer>
+		<key>CLineNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAAABAYY=</data>
+		<key>CLineNoteOpacity</key>
+		<integer>1</integer>
+		<key>CLineNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CLineNoteLineStyle</key>
+		<integer>0</integer>
+		<key>CLineNoteDashPattern</key>
+		<integer>5</integer>
+		<key>CArrowNoteColor</key>
+		<data>BAt0eXBlZHN0cmVhbYED6IQBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMBhARmZmZmAAABAYY=</data>
+		<key>CArrowNoteOpacity</key>
+		<integer>1</integer>
+		<key>CArrowNoteLineWidth</key>
+		<integer>2</integer>
+		<key>CArrowNoteLineStyle</key>
+		<integer>0</integer>
+		<key>CArrowNoteStartStyle</key>
+		<integer>0</integer>
+		<key>CArrowNoteEndStyle</key>
+		<integer>1</integer>
+		<key>CArrowNoteDashPattern</key>
+		<integer>5</integer>
+	</dict>
+</dict>
+</plist>

+ 9 - 15
compdfkit-tools/compdfkit-tools/Common/Views/PDFAnnotationBar/CPDFAnnotationBar.m

@@ -422,9 +422,7 @@
 
 - (void)noteViewController:(CPDFNoteViewController *)noteViewController annotSytle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
-    } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     }
 }
 
@@ -432,9 +430,7 @@
 
 - (void)circleViewController:(CPDFShapeCircleViewController *)circleViewController annotStyle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
-    } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     }
 }
 
@@ -442,9 +438,9 @@
 
 - (void)highlightViewController:(CPDFHighlightViewController *)highlightViewController annotStyle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        
     }
 }
 
@@ -452,9 +448,9 @@
 
 - (void)underlineViewController:(CPDFUnderlineViewController *)underlineViewController annotStyle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        
     }
 }
 
@@ -462,9 +458,9 @@
 
 - (void)strikeoutViewController:(CPDFStrikeoutViewController *)strikeoutViewController annotStyle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        
     }
 }
 
@@ -472,9 +468,7 @@
 
 - (void)squigglyViewController:(CPDFSquigglyViewController *)squigglyViewController annotStyle:(CAnnotStyle *)annotStyle {
     if (annotStyle.isSelectAnnot) {
-        [self.annotManage refreshAnnotation:annotStyle];
-    } else {
-        [self.annotManage resetAnnotation:annotStyle];
+        [self.annotManage refreshPageWithAnnotations:annotStyle.annotations];
     }
 }
 

+ 12 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFKit Categories/CPDFAnnotation+PDFListView.h

@@ -16,4 +16,16 @@
 
 - (NSSet *)keysForValuesToObserveForUndo;
 
+- (CPDFBorderStyle)borderStyle;
+
+- (void)setBorderStyle:(CPDFBorderStyle)style;
+
+- (CGFloat)lineWidth;
+
+- (void)setLineWidth:(CGFloat)width;
+
+- (NSArray *)dashPattern;
+
+- (void)setDashPattern:(NSArray *)pattern;
+
 @end

+ 35 - 0
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFKit Categories/CPDFAnnotation+PDFListView.m

@@ -26,4 +26,39 @@
     return keys;
 }
 
+- (CPDFBorderStyle)borderStyle {
+    return [[self border] style];
+}
+
+- (void)setBorderStyle:(CPDFBorderStyle)style {
+    CPDFBorder *oldBorder = [self border];
+    NSMutableArray *dashPattern = [NSMutableArray array];
+    if (CPDFBorderStyleDashed == style) {
+        [dashPattern addObjectsFromArray:@[@5]];
+    }
+    CPDFBorder *border = [[CPDFBorder alloc]initWithStyle:style lineWidth:oldBorder.lineWidth dashPattern:dashPattern];
+    [self setBorder:border];
+}
+
+- (CGFloat)lineWidth {
+    return self.borderWidth;
+}
+
+- (void)setLineWidth:(CGFloat)width {
+    CPDFBorder *oldBorder = [self border];
+    CPDFBorder *border = [[CPDFBorder alloc]initWithStyle:oldBorder.style lineWidth:width dashPattern:oldBorder.dashPattern];
+    [self setBorder:border];
+}
+
+- (NSArray *)dashPattern {
+    return [[self border] dashPattern];
+}
+
+- (void)setDashPattern:(NSArray *)pattern {
+    CPDFBorder *oldBorder = [self border];
+    CPDFBorder *border = [[CPDFBorder alloc]initWithStyle:oldBorder.style lineWidth:oldBorder.lineWidth dashPattern:pattern];
+    [self setBorder:border];
+}
+
+
 @end