Преглед изворни кода

PDFTools(iOS) - 注释模式初始化默认值

dinglingui пре 1 година
родитељ
комит
000402814c

+ 13 - 5
compdfkit-tools/compdfkit-tools.xcodeproj/project.pbxproj

@@ -119,7 +119,7 @@
 		C9B9EC4B29F4DC8900C6A5D2 /* CPDFThicknessSliderView.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B9EC4929F4DC8900C6A5D2 /* CPDFThicknessSliderView.m */; };
 		C9B9EC4E29F52DBF00C6A5D2 /* AAPLCustomPresentationController.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B9EC4D29F52DBF00C6A5D2 /* AAPLCustomPresentationController.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		C9B9EC5029F52DCC00C6A5D2 /* AAPLCustomPresentationController.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B9EC4F29F52DCC00C6A5D2 /* AAPLCustomPresentationController.m */; };
-		C9B9EC5929F54E9600C6A5D2 /* CAnnotStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		C9B9EC5929F54E9600C6A5D2 /* CAnnotStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */; };
 		C9B9EC5A29F54E9600C6A5D2 /* CAnnotStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = C9B9EC5829F54E9600C6A5D2 /* CAnnotStyle.m */; };
 		F32DA16229ED904300E19ECA /* CPDFOutlineModel.h in Headers */ = {isa = PBXBuildFile; fileRef = F32DA12229ED904300E19ECA /* CPDFOutlineModel.h */; };
 		F32DA16329ED904300E19ECA /* Image.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F32DA12329ED904300E19ECA /* Image.xcassets */; };
@@ -193,7 +193,9 @@
 		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 */; };
+		F3DF83D72A0BBBB900D4F3AF /* AnnotationUserDefaults.plist in Resources */ = {isa = PBXBuildFile; fileRef = F3DF83D62A0BBBB900D4F3AF /* AnnotationUserDefaults.plist */; };
+		F3DF83DE2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = F3DF83DC2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m */; };
+		F3DF83DF2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = F3DF83DD2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.h */; };
 		F3E8495929E69712007BE967 /* DisplayImage.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F3E8495829E69712007BE967 /* DisplayImage.xcassets */; };
 /* End PBXBuildFile section */
 
@@ -402,7 +404,9 @@
 		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>"; };
+		F3DF83D62A0BBBB900D4F3AF /* AnnotationUserDefaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AnnotationUserDefaults.plist; sourceTree = "<group>"; };
+		F3DF83DC2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPDFListViewAnnotationConfig.m; sourceTree = "<group>"; };
+		F3DF83DD2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPDFListViewAnnotationConfig.h; sourceTree = "<group>"; };
 		F3E8495829E69712007BE967 /* DisplayImage.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = DisplayImage.xcassets; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -726,7 +730,9 @@
 		C9B9EC5629F54E6700C6A5D2 /* Model */ = {
 			isa = PBXGroup;
 			children = (
-				F3DF83D62A0BBBB900D4F3AF /* InitialUserDefaults.plist */,
+				F3DF83DD2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.h */,
+				F3DF83DC2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m */,
+				F3DF83D62A0BBBB900D4F3AF /* AnnotationUserDefaults.plist */,
 				F3DF83D22A0BB9BA00D4F3AF /* CStringConstants.h */,
 				F3DF83D32A0BB9BA00D4F3AF /* CStringConstants.m */,
 				C9B9EC5729F54E9600C6A5D2 /* CAnnotStyle.h */,
@@ -1059,6 +1065,7 @@
 				4F06AB5629F6792E007797E4 /* CPDFEditContextMenu.h in Headers */,
 				C918CEBF29F9078A00D43974 /* CPDFNoteOpenViewController.h in Headers */,
 				C918CE9B29F8EE7200D43974 /* CPDFHighlightViewController.h in Headers */,
+				F3DF83DF2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.h in Headers */,
 				F32DA18129ED904300E19ECA /* CNavigationRightView.h in Headers */,
 				C918CE8129F621E200D43974 /* CPDFColorPickerView.h in Headers */,
 				C91BE7C92A0347770038F2BC /* CPDFFontStyleTableView.h in Headers */,
@@ -1202,7 +1209,7 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				F3DF83D72A0BBBB900D4F3AF /* InitialUserDefaults.plist in Resources */,
+				F3DF83D72A0BBBB900D4F3AF /* AnnotationUserDefaults.plist in Resources */,
 				C9AF183329EFC63300EC4979 /* Images.xcassets in Resources */,
 				C918CED129FA490000D43974 /* Image.xcassets in Resources */,
 				F32DA16E29ED904300E19ECA /* Images.xcassets in Resources */,
@@ -1233,6 +1240,7 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				F3DF83DE2A0C78B000D4F3AF /* CPDFListViewAnnotationConfig.m in Sources */,
 				F32DA17B29ED904300E19ECA /* CPDFDisplayViewController.m in Sources */,
 				4FF3E1D12A064A8200C14F91 /* CPDFListView+Edit.m in Sources */,
 				C91BE7CA2A0347770038F2BC /* CPDFFontStyleTableView.m in Sources */,

Разлика између датотеке није приказан због своје велике величине
+ 111 - 0
compdfkit-tools/compdfkit-tools/Common/Model/AnnotationUserDefaults.plist


+ 1 - 1
compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.h

@@ -11,7 +11,7 @@
 //
 
 #import <UIKit/UIKit.h>
-#import <compdfkit_tools/CPDFListView.h>
+#import "CPDFListView.h"
 
 NS_ASSUME_NONNULL_BEGIN
 

+ 44 - 1
compdfkit-tools/compdfkit-tools/Common/Model/CAnnotStyle.m

@@ -173,6 +173,7 @@
         if(annotations.count > 0) {
             self.isSelectAnnot = YES;
             self.annotations = annotations;
+            self.annotMode = [self convertAnnotationType];
         } else {
             self.isSelectAnnot = NO;
             self.annotMode = annotionMode;
@@ -185,6 +186,49 @@
     return self.annotations.firstObject;
 }
 
+- (CPDFViewAnnotationMode)convertAnnotationType {
+    CPDFViewAnnotationMode annotationType = CPDFViewAnnotationModeNone;
+    if ([self.annotation isKindOfClass:[CPDFFreeTextAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeFreeText;
+    } else if ([self.annotation isKindOfClass:[CPDFTextAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeNote;
+    } else if ([self.annotation isKindOfClass:[CPDFCircleAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeCircle;
+    } else if ([self.annotation isKindOfClass:[CPDFSquareAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeSquare;
+    } else if ([self.annotation isKindOfClass:[CPDFMarkupAnnotation class]]) {
+        CPDFMarkupAnnotation *markup = (CPDFMarkupAnnotation *)self.annotation;
+        if (CPDFMarkupTypeHighlight == markup.markupType) {
+            annotationType = CPDFViewAnnotationModeHighlight;
+        } else if (CPDFMarkupTypeStrikeOut == markup.markupType) {
+            annotationType = CPDFViewAnnotationModeStrikeout;
+        } else if (CPDFMarkupTypeUnderline == markup.markupType) {
+            annotationType = CPDFViewAnnotationModeUnderline;
+        } else if (CPDFMarkupTypeSquiggly == markup.markupType) {
+            annotationType = CPDFViewAnnotationModeSquiggly;
+        }
+    } else if ([self.annotation isKindOfClass:[CPDFLineAnnotation class]]) {
+        CPDFLineAnnotation *line = (CPDFLineAnnotation *)self.annotation;
+        if (CPDFLineStyleNone == line.endLineStyle && CPDFLineStyleNone == line.startLineStyle) {
+            annotationType = CPDFViewAnnotationModeLine;
+        } else {
+            annotationType = CPDFViewAnnotationModeArrow;
+        }
+    } else if ([self.annotation isKindOfClass:[CPDFInkAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeInk;
+    } else if ([self.annotation isKindOfClass:[CPDFLinkAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeLink;
+    } else if ([self.annotation isKindOfClass:[CPDFSignatureAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeSignature;
+    } else if ([self.annotation isKindOfClass:[CPDFStampAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeStamp;
+    } else if ([self.annotation isKindOfClass:[CPDFSoundAnnotation class]]) {
+        annotationType = CPDFViewAnnotationModeSound;
+    }
+
+    return annotationType;
+}
+
 #pragma mark - Common
 
 - (UIColor *)color {
@@ -236,7 +280,6 @@
 
 - (void)setColor:(UIColor *)color {
     if (self.isSelectAnnot) {
-        UIColor *tColor = color;
         for (CPDFAnnotation *annotation in self.annotations) {
             annotation.color = color;
         }

+ 19 - 0
compdfkit-tools/compdfkit-tools/Common/Model/CPDFListViewAnnotationConfig.h

@@ -0,0 +1,19 @@
+//
+//  CPDFListViewAnnotationConfig.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>
+
+@interface CPDFListViewAnnotationConfig : NSObject
+
++ (void)initializeAnnotationConfig;
+
+@end

+ 26 - 0
compdfkit-tools/compdfkit-tools/Common/Model/CPDFListViewAnnotationConfig.m

@@ -0,0 +1,26 @@
+//
+//  CPDFListViewAnnotationConfig.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 "CPDFListViewAnnotationConfig.h"
+
+@implementation CPDFListViewAnnotationConfig
+
++ (void)initializeAnnotationConfig {
+    NSURL *initialUserDefaultsURL = [[NSBundle bundleForClass:self.class] URLForResource:@"AnnotationUserDefaults" withExtension:@"plist"];
+    NSDictionary *initialUserDefaultsDict = [NSDictionary dictionaryWithContentsOfURL:initialUserDefaultsURL];
+    NSDictionary *initialValuesDict = [initialUserDefaultsDict objectForKey:@"RegisteredDefaults"];
+    
+    // set them in the standard user defaults
+    [[NSUserDefaults standardUserDefaults] registerDefaults:initialValuesDict];
+}
+
+@end

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

@@ -1,115 +0,0 @@
-<?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>

+ 12 - 6
compdfkit-tools/compdfkit-tools/Common/Views/PDFView/PDFListView/CPDFListView.m

@@ -18,6 +18,7 @@
 #import "CPDFColorUtils.h"
 #import "CPDFSlider.h"
 #import "CPDFPageIndicatorView.h"
+#import "CPDFListViewAnnotationConfig.h"
 
 NSNotificationName const CPDFListViewToolModeChangeNotification = @"CPDFListViewToolModeChangeNotification";
 
@@ -41,6 +42,8 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
     if (self = [super initWithFrame:frame]) {
         self.backgroundColor = [UIColor lightGrayColor];
         
+        [CPDFListViewAnnotationConfig initializeAnnotationConfig];
+
         [self commomInit];
         
         [self addNotification];
@@ -56,6 +59,8 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
     if (self) {
         self.backgroundColor = [UIColor lightGrayColor];
 
+        [CPDFListViewAnnotationConfig initializeAnnotationConfig];
+
         [self commomInit];
 
         [self addNotification];
@@ -69,8 +74,6 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
 #pragma mark - Accessors
 
 - (void)setAnnotationMode:(CPDFViewAnnotationMode)annotationMode {
-    _annotationMode = annotationMode;
-    
     if (CPDFViewAnnotationModeHighlight == annotationMode ||
         CPDFViewAnnotationModeUnderline == annotationMode ||
         CPDFViewAnnotationModeStrikeout == annotationMode ||
@@ -96,11 +99,14 @@ NSNotificationName const CPDFListViewAnnotationsOperationChangeNotification = @"
         [self becomeFirstResponder];
     }
     
-    if (CPDFViewAnnotationModeNone != annotationMode) {
-        CPDFPage *page = self.activeAnnotation.page;
-        [self updateActiveAnnotations:@[]];
-        [self setNeedsDisplayForPage:page];
+    if (CPDFViewAnnotationModeNone != annotationMode || CPDFViewAnnotationModeNone != _annotationMode) {
+        if(self.activeAnnotations.count > 0) {
+            CPDFPage *page = self.activeAnnotation.page;
+            [self updateActiveAnnotations:@[]];
+            [self setNeedsDisplayForPage:page];
+        }
     }
+    _annotationMode = annotationMode;
     
     dispatch_async(dispatch_get_main_queue(), ^{
         [[NSNotificationCenter defaultCenter] postNotificationName:CPDFListViewAnnotationModeChangeNotification object:self];

+ 0 - 3
compdfkit-tools/compdfkit-tools/compdfkit_tools.h

@@ -68,6 +68,3 @@
 #import <compdfkit_tools/CPDFEditToolBar.h>
 #import <compdfkit_tools/CPDFEditViewController.h>
 
-
-// Model
-#import <compdfkit_tools/CAnnotStyle.h>