Kaynağa Gözat

【注释】选中Forn注释模式后属性面板补充

wanjun 1 yıl önce
ebeveyn
işleme
1b5d8b3414
20 değiştirilmiş dosya ile 1186 ekleme ve 275 silme
  1. 1 1
      PDF Office/PDF Master/Class/Common/Category/NSString+KMExtension.swift
  2. 21 18
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m
  3. 1 57
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CStringConstants.h
  4. 4 59
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CStringConstants.m
  5. 40 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m
  6. 81 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.xib
  7. 0 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift
  8. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonOptionsViewController.swift
  9. 49 31
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetAppearanceViewController.swift
  10. 29 29
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetAppearanceViewController.xib
  11. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetOptionsViewController.swift
  12. 59 27
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetAppearanceViewController.swift
  13. 28 28
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetAppearanceViewController.xib
  14. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetOptionsViewController.swift
  15. 606 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift
  16. 239 0
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.xib
  17. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationGeneralViewController.swift
  18. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationTextWidgetOptionsViewController.swift
  19. 7 7
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMFormPropertPanelViewController.xib
  20. 16 0
      PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

+ 1 - 1
PDF Office/PDF Master/Class/Common/Category/NSString+KMExtension.swift

@@ -114,7 +114,7 @@ let SKAnnotationTextWidgetPrintKey = "SKAnnotationTextWidgetPrintKey"
 let SKAnnotationTextWidgetFontColorKey = "SKAnnotationTextWidgetFontColorKey"
 let SKAnnotationTextWidgetBackgroundColorKey = "SKAnnotationTextWidgetBackgroundColorKey"
 let SKAnnotationTextWidgetFontSizeKey = "SKAnnotationTextWidgetFontSizeKey"
-let SKAnnotationTextWidgetFontNameKey = "SKAnnotationTextWidgetFontNameKey"
+let CAnnotationTextWidgetFontNameKey = "CAnnotationTextWidgetFontNameKey"
 let SKAnnotationTextWidgetAlignmenKey = "SKAnnotationTextWidgetAlignmenKey"
 let SKAnnotationTextMultilineKey = "SKAnnotationTextMultilineKey"
 let SKAnnotationTextStringValueKey = "SKAnnotationStringValueMultilineKey"

+ 21 - 18
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -14,9 +14,6 @@
 
 #import "CSelfSignAnnotationFreeText.h"
 #import "CSelfSignAnnotation.h"
-
-#import "CStringConstants.h"
-
 #import <PDF_Reader_Pro-Swift.h>
 
 @interface CPDFAnnotationModel()
@@ -1337,22 +1334,22 @@
             case CAnnotationTypeFreeText:
             case CAnnotationTypeSignText:
             case CAnnotationTypeSignDate:
-                fontSize = [userDefaults floatForKey:CFreeTextNoteFontSizeKey];
+                fontSize = [userDefaults floatForKey:CFreeTextNoteFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CFreeTextNoteFontSizeKey];
                 break;
             case CAnnotationTypeTextField:
-                fontSize = [userDefaults floatForKey:CAnnotationTextWidgetFontSizeKey];
+                fontSize = [userDefaults floatForKey:CAnnotationTextWidgetFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CAnnotationTextWidgetFontSizeKey];
                 break;
             case CAnnotationTypeListMenu:
-                fontSize = [userDefaults floatForKey:CAnnotationChoiceListWidgetFontSizeKey];
+                fontSize = [userDefaults floatForKey:CAnnotationChoiceListWidgetFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CAnnotationChoiceListWidgetFontSizeKey];
                 break;
             case CAnnotationTypeComboBox:
-                fontSize = [userDefaults floatForKey:CAnnotationChoiceWidgetFontSizeKey];
+                fontSize = [userDefaults floatForKey:CAnnotationChoiceWidgetFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CAnnotationChoiceWidgetFontSizeKey];
                 break;
             case CAnnotationTypeActionButton:
-                fontSize = [userDefaults floatForKey:CAnnotationActionButtonWidgetFontSizeKey];
+                fontSize = [userDefaults floatForKey:CAnnotationActionButtonWidgetFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CAnnotationActionButtonWidgetFontSizeKey];
                 break;
             case CAnnotationTypeRedact:
-                fontSize = [userDefaults floatForKey:CAnnotationRedactFontSizeKey];
+                fontSize = [userDefaults floatForKey:CAnnotationRedactFontSizeKey] < 0.001 ? 11 : [userDefaults floatForKey:CAnnotationRedactFontSizeKey];
                 break;
             default:
                 break;
@@ -1418,19 +1415,22 @@
             case CAnnotationTypeFreeText:
             case CAnnotationTypeSignText:
             case CAnnotationTypeSignDate:
-                fontName = [userDefaults objectForKey:CFreeTextNoteFontNameKey];
+                fontName = [userDefaults objectForKey:CFreeTextNoteFontNameKey] ?: @"Helvetica";
                 break;
             case CAnnotationTypeTextField:
-                fontName = [userDefaults objectForKey:CAnnotationTextWidgetFontNameKey];
+                fontName = [userDefaults objectForKey:@"SKAnnotationTextWidgetFontNameKey"] ?: @"Helvetica";
+                break;
+            case CAnnotationTypeRadioButton:
+                fontName = [userDefaults objectForKey:CAnnotationRadioButtonWidgetFontNameKey] ?: @"Helvetica";
                 break;
             case CAnnotationTypeListMenu:
-                fontName = [userDefaults objectForKey:CAnnotationChoiceListWidgetFontNameKey];
+                fontName = [userDefaults objectForKey:@"SKAnnotationChoiceListWidgetFontNameKey"] ?: @"Helvetica";
                 break;
             case CAnnotationTypeComboBox:
-                fontName = [userDefaults objectForKey:CAnnotationChoiceWidgetFontNameKey];
+                fontName = [userDefaults objectForKey:@"SKAnnotationChoiceWidgetFontNameKey"] ?: @"Helvetica";
                 break;
             case CAnnotationTypeActionButton:
-                fontName = [userDefaults objectForKey:CAnnotationActionButtonWidgetFontNameKey];
+                fontName = [userDefaults objectForKey:@"SKAnnotationActionButtonWidgetFontNameKey"] ?: @"Helvetica";
                 break;
             default:
                 break;
@@ -1460,16 +1460,19 @@
                 [userDefaults setObject:fontName forKey:CFreeTextNoteFontNameKey];
                 break;
             case CAnnotationTypeTextField:
-                [userDefaults setObject:fontName forKey:CAnnotationTextWidgetFontNameKey];
+                [userDefaults setObject:fontName forKey:@"SKAnnotationTextWidgetFontNameKey"];
+                break;
+            case CAnnotationTypeCheckBox:
+                [userDefaults setObject:fontName forKey:CAnnotationRadioButtonWidgetFontNameKey];
                 break;
             case CAnnotationTypeListMenu:
-                [userDefaults setObject:fontName forKey:CAnnotationChoiceListWidgetFontNameKey];
+                [userDefaults setObject:fontName forKey:@"SKAnnotationChoiceListWidgetFontNameKey"];
                 break;
             case CAnnotationTypeComboBox:
-                [userDefaults setObject:fontName forKey:CAnnotationChoiceWidgetFontNameKey];
+                [userDefaults setObject:fontName forKey:@"SKAnnotationChoiceWidgetFontNameKey"];
                 break;
             case CAnnotationTypeActionButton:
-                [userDefaults setObject:fontName forKey:CAnnotationActionButtonWidgetFontNameKey];
+                [userDefaults setObject:fontName forKey:@"SKAnnotationActionButtonWidgetFontNameKey"];
                 break;
             default:
                 break;

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

@@ -123,129 +123,73 @@ extern NSString *CArrowNoteEndStyleKey;
 //Form
 
 extern NSString *CAnnotationTextWidgetLineStyleKey;
-
 extern NSString *CAnnotationTextWidgetLineWidthKey;
-
 extern NSString *CAnnotationTextWidgetBorderColorKey;
-
 extern NSString *CAnnotationTextWidgetFontNameKey;
-
 extern NSString *CAnnotationTextWidgetFontSizeKey;
-
 extern NSString *CAnnotationTextWidgetFontColorKey;
-
 extern NSString *CAnnotationTextWidgetAlignmenKey;
-
 extern NSString *CAnnotationTextWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationTextWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultTextWidgetWidthKey;
-
 extern NSString *CDefaultTextWidgetHeightKey;
-
 extern NSString *CAnnotationTextWidgetMultilineKey;
 
 extern NSString *CAnnotationCheckBoxWidgetLineStyleKey;
-
 extern NSString *CAnnotationCheckBoxWidgetLineWidthKey;
-
 extern NSString *CAnnotationCheckBoxWidgetBorderColorKey;
-
 extern NSString *CAnnotationCheckBoxWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationCheckBoxWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultCheckBoxWidgetWidthKey;
-
 extern NSString *CDefaultCheckBoxWidgetHeightKey;
 
 extern NSString *CAnnotationRadioButtonBoxWidgetLineStyleKey;
-
 extern NSString *CAnnotationRadioButtonBoxWidgetLineWidthKey;
-
 extern NSString *CAnnotationRadioButtonBoxWidgetBorderColorKey;
-
 extern NSString *CAnnotationRadioButtonWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationRadioButtonWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultRadioButtonWidgetWidthKey;
-
 extern NSString *CDefaultRadioButtonWidgetHeightKey;
+extern NSString *CAnnotationRadioButtonWidgetFontNameKey;
 
 extern NSString *CAnnotationChoiceListWidgetLineStyleKey;
-
 extern NSString *CAnnotationChoiceListWidgetLineWidthKey;
-
 extern NSString *CAnnotationChoiceListWidgetBorderColorKey;
-
 extern NSString *CAnnotationChoiceListWidgetFontNameKey;
-
 extern NSString *CAnnotationChoiceListWidgetFontSizeKey;
-
 extern NSString *CAnnotationChoiceListWidgetFontColorKey;
-
 extern NSString *CAnnotationChoiceListWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationChoiceListWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultChoiceListWidthKey;
-
 extern NSString *CDefaultChoiceListHeightKey;
-
 extern NSString *CAnnotationChoiceWidgetLineStyleKey;
-
 extern NSString *CAnnotationChoiceWidgetLineWidthKey;
-
 extern NSString *CAnnotationChoiceWidgetBorderColorKey;
-
 extern NSString *CAnnotationChoiceWidgetFontNameKey;
-
 extern NSString *CAnnotationChoiceWidgetFontSizeKey;
-
 extern NSString *CAnnotationChoiceWidgetFontColorKey;
-
 extern NSString *CAnnotationChoiceWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationChoiceWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultChoiceWidgetWidthKey;
-
 extern NSString *CDefaultChoiceWidgetHeightKey;
 
 extern NSString *CAnnotationActionButtonWidgetLineStyleKey;
-
 extern NSString *CAnnotationActionButtonWidgetLineWidthKey;
-
 extern NSString *CAnnotationActionButtonWidgetBorderColorKey;
-
 extern NSString *CAnnotationActionButtonWidgetFontNameKey;
-
 extern NSString *CAnnotationActionButtonWidgetFontSizeKey;
-
 extern NSString *CAnnotationActionButtonWidgetFontColorKey;
-
 extern NSString *CAnnotationActionButtonWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationActionButtonWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultActionButtonWidgetWidthKey;
-
 extern NSString *CDefaultActionButtonWidgetHeightKey;
 
 extern NSString *CAnnotationSignatureWidgetLineStyleKey;
-
 extern NSString *CAnnotationSignatureWidgetLineWidthKey;
-
 extern NSString *CAnnotationSignatureWidgetBorderColorKey;
-
 extern NSString *CAnnotationSignatureWidgetBackgroundColorKey;
-
 extern NSString *CAnnotationSignatureWidgetBackgroundOpacityKey;
-
 extern NSString *CDefaultSignatureWidgetWidthKey;
-
 extern NSString *CDefaultSignatureWidgetHeightKey;
 
 //Fill & Sign

+ 4 - 59
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CStringConstants.m

@@ -121,127 +121,72 @@ NSString *CArrowNoteStartStyleKey = @"CArrowNoteStartStyle";
 NSString *CArrowNoteEndStyleKey = @"CArrowNoteEndStyle";
 
 //Form
-
 NSString *CAnnotationTextWidgetLineStyleKey = @"CAnnotationTextWidgetLineStyle";
-
 NSString *CAnnotationTextWidgetLineWidthKey = @"CAnnotationTextWidgetLineWidthKey";
-
 NSString *CAnnotationTextWidgetBorderColorKey = @"CAnnotationTextWidgetBorderColor";
-
-NSString *CAnnotationTextWidgetFontNameKey = @"CAnnotationTextWidgetFontName";
-
+NSString *CAnnotationTextWidgetFontNameKey = @"CAnnotationTextWidgetFontNameKey";
 NSString *CAnnotationTextWidgetFontSizeKey = @"CAnnotationTextWidgetFontSize";
-
 NSString *CAnnotationTextWidgetFontColorKey = @"CAnnotationTextWidgetFontColor";
-
 NSString *CAnnotationTextWidgetAlignmenKey = @"CAnnotationTextWidgetAlignmen";
-
 NSString *CAnnotationTextWidgetBackgroundColorKey = @"CAnnotationTextWidgetBackgroundColor";
-
 NSString *CAnnotationTextWidgetBackgroundOpacityKey = @"CAnnotationTextWidgetBackgroundOpacity";
-
 NSString *CAnnotationTextWidgetMultilineKey = @"CAnnotationTextWidgetMultiline";
-
 NSString *CDefaultTextWidgetWidthKey = @"CDefaultTextWidgetWidth";
-
 NSString *CDefaultTextWidgetHeightKey = @"CDefaultTextWidgetHeight";
 
 NSString *CAnnotationCheckBoxWidgetLineStyleKey = @"CAnnotationCheckBoxWidgetLineStyle";
-
 NSString *CAnnotationCheckBoxWidgetLineWidthKey = @"CAnnotationCheckBoxWidgetLineWidth";
-
 NSString *CAnnotationCheckBoxWidgetBorderColorKey = @"CAnnotationCheckBoxWidgetBorderColor";
-
 NSString *CAnnotationCheckBoxWidgetBackgroundColorKey = @"CAnnotationCheckBoxWidgetBackgroundColor";
-
 NSString *CAnnotationCheckBoxWidgetBackgroundOpacityKey = @"CAnnotationCheckBoxWidgetBackgroundOpacity";
 
 NSString *CAnnotationRadioButtonBoxWidgetLineStyleKey = @"CAnnotationRadioButtonBoxWidgetLineStyle";
-
 NSString *CAnnotationRadioButtonBoxWidgetLineWidthKey = @"CAnnotationRadioButtonBoxWidgetLineWidth";
-
 NSString *CAnnotationRadioButtonBoxWidgetBorderColorKey = @"CAnnotationRadioButtonBoxWidgetBorderColor";
-
 NSString *CAnnotationRadioButtonWidgetBackgroundColorKey = @"CAnnotationRadioButtonWidgetBackgroundColor";
-
 NSString *CAnnotationRadioButtonWidgetBackgroundOpacityKey = @"CAnnotationRadioButtonWidgetBackgroundOpacity";
-
 NSString *CDefaultRadioButtonWidgetWidthKey = @"CDefaultRadioButtonWidgetWidth";
-
 NSString *CDefaultRadioButtonWidgetHeightKey = @"CDefaultRadioButtonWidgetHeight";
+NSString *CAnnotationRadioButtonWidgetFontNameKey = @"CAnnotationRadioButtonWidgetFontNameKey";
 
 NSString *CAnnotationChoiceListWidgetLineStyleKey = @"CAnnotationChoiceListWidgetLineStyle";
-
 NSString *CAnnotationChoiceListWidgetLineWidthKey = @"CAnnotationChoiceListWidgetLineWidth";
-
 NSString *CAnnotationChoiceListWidgetBorderColorKey = @"CAnnotationChoiceListWidgetBorderColor";
-
-NSString *CAnnotationChoiceListWidgetFontNameKey = @"CAnnotationChoiceWidgetFontName";
-
+NSString *CAnnotationChoiceListWidgetFontNameKey = @"CAnnotationChoiceListWidgetFontNameKey";
 NSString *CAnnotationChoiceListWidgetFontSizeKey = @"CAnnotationChoiceWidgetFontSize";
-
 NSString *CAnnotationChoiceListWidgetFontColorKey = @"CAnnotationChoiceWidgetFontColor";
-
 NSString *CAnnotationChoiceListWidgetBackgroundColorKey = @"CAnnotationChoiceListWidgetBackgroundColor";
-
 NSString *CAnnotationChoiceListWidgetBackgroundOpacityKey = @"CAnnotationChoiceListWidgetBackgroundOpacity";
-
 NSString *CDefaultChoiceListWidgetWidthKey = @"CDefaultChoiceListWidgetWidth";
-
 NSString *CDefaultChoiceListWidgetHeightKey = @"CDefaultChoiceListWidgetHeight";
-
 NSString *CAnnotationChoiceWidgetLineStyleKey = @"CAnnotationChoiceWidgetLineStyle";
-
 NSString *CAnnotationChoiceWidgetLineWidthKey = @"CAnnotationChoiceWidgetLineWidth";
-
 NSString *CAnnotationChoiceWidgetBorderColorKey = @"CAnnotationChoiceWidgetBorderColor";
-
-NSString *CAnnotationChoiceWidgetFontNameKey = @"CAnnotationChoiceWidgetFontName";
-
+NSString *CAnnotationChoiceWidgetFontNameKey = @"CAnnotationChoiceWidgetFontNameKey";
 NSString *CAnnotationChoiceWidgetFontSizeKey = @"CAnnotationChoiceWidgetFontSize";
-
 NSString *CAnnotationChoiceWidgetFontColorKey = @"CAnnotationChoiceWidgetFontColor";
-
 NSString *CAnnotationChoiceWidgetBackgroundColorKey = @"CAnnotationChoiceWidgetBackgroundColor";
-
 NSString *CAnnotationChoiceWidgetBackgroundOpacityKey = @"CAnnotationChoiceWidgetBackgroundOpacity";
-
 NSString *CDefaultChoiceWidgetWidthKey = @"CDefaultChoiceWidgetWidth";
-
 NSString *CDefaultChoiceWidgetHeightKey = @"CDefaultChoiceWidgetHeight";
 
 NSString *CAnnotationActionButtonWidgetLineStyleKey = @"CAnnotationActionButtonWidgetLineStyle";
-
 NSString *CAnnotationActionButtonWidgetLineWidthKey = @"CAnnotationActionButtonWidgetLineWidth";
-
 NSString *CAnnotationActionButtonWidgetBorderColorKey = @"CAnnotationActionButtonWidgetBorderColor";
-
 NSString *CAnnotationActionButtonWidgetFontNameKey = @"CAnnotationActionButtonWidgetFontName";
-
 NSString *CAnnotationActionButtonWidgetFontSizeKey = @"CAnnotationActionButtonWidgetFontSize";
-
 NSString *CAnnotationActionButtonWidgetFontColorKey = @"CAnnotationActionButtonWidgetFontColor";
-
 NSString *CAnnotationActionButtonWidgetBackgroundColorKey = @"CAnnotationActionButtonWidgetBackgroundColor";
-
 NSString *CAnnotationActionButtonWidgetBackgroundOpacityKey = @"CAnnotationActionButtonWidgetBackgroundOpacity";
-
 NSString *CDefaultActionButtonWidgetWidthKey = @"CDefaultActionButtonWidgetWidth";
-
 NSString *CDefaultActionButtonWidgetHeightKey = @"CDefaultActionButtonWidgetHeight";
 
 NSString *CAnnotationSignatureWidgetLineStyleKey = @"CAnnotationSignatureWidgetLineStyle";
-
 NSString *CAnnotationSignatureWidgetLineWidthKey = @"CAnnotationSignatureWidgetLineWidth";
-
 NSString *CAnnotationSignatureWidgetBorderColorKey = @"CAnnotationSignatureWidgetBorderColor";
-
 NSString *CAnnotationSignatureWidgetBackgroundColorKey = @"CAnnotationSignatureWidgetBackgroundColor";
-
 NSString *CAnnotationSignatureWidgetBackgroundOpacityKey = @"CAnnotationSignatureWidgetBackgroundOpacity";
-
 NSString *CDefaultSignatureWidgetWidthKey = @"CDefaultSignatureWidgeWidth";
-
 NSString *CDefaultSignatureWidgeHeightKey = @"CDefaultSignatureWidgeHeight";
 
 //Fill & Sign

+ 40 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.m

@@ -41,6 +41,9 @@
 
 @property (nonatomic,retain) NSViewController *contentViewController;
 @property (weak) IBOutlet NSLayoutConstraint *titleViewHeightConstraint;
+@property (weak) IBOutlet NSLayoutConstraint *buttonbuttonLayoutConstraint;
+
+@property (assign) IBOutlet NSView *buttonView;
 
 @end
 
@@ -80,6 +83,7 @@
         _annotations = annotations;
     }
     
+    self.buttonView.hidden = YES;
     CPDFAnnotation *annotation = _annotations.firstObject;
     if (self.contentViewController) {
         [self.contentViewController.view removeFromSuperview];
@@ -174,11 +178,13 @@
     if ([annotation isKindOfClass:[CPDFTextWidgetAnnotation class]] ||
         [annotation isKindOfClass:[CPDFChoiceWidgetAnnotation class]] ||
         [annotation isKindOfClass:[CPDFButtonWidgetAnnotation class]]){
-        KMFormPropertPanelViewController *vc = [[KMFormPropertPanelViewController alloc] init];
-        vc.pdfView = self.pdfView;
-        vc.annotationModel = annotationModel;
-        self.propertiesBox.contentView = vc.view;
-        self.contentViewController = vc;
+//        KMFormPropertPanelViewController *vc = [[KMFormPropertPanelViewController alloc] init];
+//        vc.pdfView = self.pdfView;
+//        vc.annotationModel = annotationModel;
+//        self.propertiesBox.contentView = vc.view;
+//        self.contentViewController = vc;
+        self.buttonView.hidden = NO;
+
     } else if ([annotation isKindOfClass:[CPDFSignatureWidgetAnnotation class]]) {
         KMFillSignShapePanel *vc = [[KMFillSignShapePanel alloc] init];
         vc.pdfView = self.pdfView;
@@ -277,6 +283,8 @@
         self.propertiesBox.contentView = vc.view;
         self.contentViewController = vc;
     }
+    
+    self.buttonbuttonLayoutConstraint.constant = self.buttonView.hidden ? -36 : 0;
 }
 
 - (void)selectAnnotations:(NSArray *)annotations {
@@ -443,11 +451,33 @@
                annotationMode == CAnnotationTypeComboBox ||
                annotationMode == CAnnotationTypeListMenu ||
                annotationMode == CAnnotationTypeActionButton) {
-        KMFormPropertPanelViewController *vc = [[KMFormPropertPanelViewController alloc] init];
-        vc.pdfView = self.pdfView;
-        vc.annotationModel = annotationModel;
-        self.propertiesBox.contentView = vc.view;
-        self.contentViewController = vc;
+//        KMFormPropertPanelViewController *vc = [[KMFormPropertPanelViewController alloc] init];
+//        vc.pdfView = self.pdfView;
+//        vc.annotationModel = annotationModel;
+//        self.propertiesBox.contentView = vc.view;
+//        self.contentViewController = vc;
+        if (annotationMode == CAnnotationTypeTextField) {
+            KMAnnotationFromViewController *vc = [[KMAnnotationFromViewController alloc] init];
+            vc.annotationModel = annotationModel;
+            vc.pdfView = self.pdfView;
+            self.propertiesBox.contentView = vc.view;
+            self.contentViewController = vc;
+        } else if (annotationMode == CAnnotationTypeListMenu ||
+                   annotationMode == CAnnotationTypeComboBox ||
+                   annotationMode == CAnnotationTypeActionButton) {
+            KMAnnotationChoiceWidgetAppearanceViewController *vc = [[KMAnnotationChoiceWidgetAppearanceViewController alloc] init];
+            vc.annotationModel = annotationModel;
+            vc.pdfView = self.pdfView;
+            self.propertiesBox.contentView = vc.view;
+            self.contentViewController = vc;
+        } else if (annotationMode == CAnnotationTypeRadioButton ||
+                   annotationMode == CAnnotationTypeCheckBox) {
+            KMAnnotationButtonWidgetAppearanceViewController *vc = [[KMAnnotationButtonWidgetAppearanceViewController alloc] init];
+            vc.annotationModel = annotationModel;
+            vc.pdfView = self.pdfView;
+            self.propertiesBox.contentView = vc.view;
+            self.contentViewController = vc;
+        }
     } else if (annotationMode == CAnnotationTypeSignFalse ||
                annotationMode == CAnnotationTypeSignTure ||
                annotationMode == CAnnotationTypeSignCircle ||

+ 81 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMAnnotationPropertiesViewController.xib

@@ -1,13 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="22154"/>
+        <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="KMAnnotationPropertiesViewController">
             <connections>
+                <outlet property="buttonView" destination="IWa-HT-xIg" id="4jc-DO-kae"/>
+                <outlet property="buttonbuttonLayoutConstraint" destination="1t8-bZ-MPp" id="KRg-1h-Xpx"/>
                 <outlet property="emptyImageView" destination="IyU-eu-2bu" id="fgt-Po-b4I"/>
                 <outlet property="emptyView" destination="B80-hQ-s7Z" id="a5K-dQ-LAr"/>
                 <outlet property="gradientView" destination="rxw-ZM-edB" id="ySD-nb-CCK"/>
@@ -83,14 +85,86 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     </view>
                 </box>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="IWa-HT-xIg">
+                    <rect key="frame" x="0.0" y="497" width="284" height="32"/>
+                    <subviews>
+                        <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="7py-aO-M57">
+                            <rect key="frame" x="0.0" y="-2" width="284" height="5"/>
+                        </box>
+                        <button tag="100" springLoaded="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="O14-Bw-MTD">
+                            <rect key="frame" x="0.0" y="0.0" width="95" height="32"/>
+                            <buttonCell key="cell" type="bevel" title="General" bezelStyle="regularSquare" image="KMImageNameFormGeneral" alignment="center" imageScaling="proportionallyDown" inset="2" id="GOJ-rf-MvX">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <button tag="101" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0u6-d1-HjM">
+                            <rect key="frame" x="95" y="0.0" width="94" height="32"/>
+                            <buttonCell key="cell" type="bevel" title="Appearance" bezelStyle="regularSquare" image="KMImageNameFormAppearanceSelected" alignment="center" imageScaling="proportionallyDown" inset="2" id="mjt-Z8-knI">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <button tag="102" springLoaded="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nRW-rs-cpa">
+                            <rect key="frame" x="190" y="0.0" width="95" height="32"/>
+                            <buttonCell key="cell" type="bevel" title="Preferences" bezelStyle="regularSquare" image="KMImageNameFormOptions" alignment="center" lineBreakMode="truncatingMiddle" imageScaling="proportionallyDown" inset="2" id="f75-aB-BO2">
+                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                <font key="font" metaFont="system"/>
+                            </buttonCell>
+                        </button>
+                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="csV-19-IRC">
+                            <rect key="frame" x="95" y="4" width="1" height="24"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="1" id="09n-Ea-LWD"/>
+                            </constraints>
+                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="3hu-xe-1OR"/>
+                        </imageView>
+                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="X2r-AT-5fy">
+                            <rect key="frame" x="189" y="4" width="1" height="24"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="1" id="zaJ-qb-Xa9"/>
+                            </constraints>
+                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="yF2-ph-GW8"/>
+                        </imageView>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="nRW-rs-cpa" firstAttribute="height" secondItem="O14-Bw-MTD" secondAttribute="height" id="01M-FS-5bM"/>
+                        <constraint firstItem="nRW-rs-cpa" firstAttribute="width" secondItem="O14-Bw-MTD" secondAttribute="width" id="1b3-YX-BlU"/>
+                        <constraint firstAttribute="trailing" secondItem="7py-aO-M57" secondAttribute="trailing" id="3w7-7f-qbg"/>
+                        <constraint firstItem="0u6-d1-HjM" firstAttribute="leading" secondItem="O14-Bw-MTD" secondAttribute="trailing" id="HqY-0F-teJ"/>
+                        <constraint firstAttribute="bottom" secondItem="O14-Bw-MTD" secondAttribute="bottom" id="Hsq-76-cpc"/>
+                        <constraint firstItem="O14-Bw-MTD" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" id="KB5-1b-esU"/>
+                        <constraint firstAttribute="bottom" secondItem="csV-19-IRC" secondAttribute="bottom" constant="4" id="KfR-ps-6ch"/>
+                        <constraint firstItem="0u6-d1-HjM" firstAttribute="height" secondItem="O14-Bw-MTD" secondAttribute="height" id="Of9-bh-VQZ"/>
+                        <constraint firstItem="0u6-d1-HjM" firstAttribute="width" secondItem="O14-Bw-MTD" secondAttribute="width" id="RuC-Ia-Pkv"/>
+                        <constraint firstItem="X2r-AT-5fy" firstAttribute="leading" secondItem="0u6-d1-HjM" secondAttribute="trailing" id="XPn-3P-P5U"/>
+                        <constraint firstItem="0u6-d1-HjM" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" id="XqO-Yw-52D"/>
+                        <constraint firstItem="O14-Bw-MTD" firstAttribute="leading" secondItem="IWa-HT-xIg" secondAttribute="leading" id="Z49-y5-QWk"/>
+                        <constraint firstAttribute="bottom" secondItem="O14-Bw-MTD" secondAttribute="bottom" id="ZBx-hR-KQT"/>
+                        <constraint firstItem="nRW-rs-cpa" firstAttribute="leading" secondItem="0u6-d1-HjM" secondAttribute="trailing" constant="0.5" id="bgf-CP-CVV"/>
+                        <constraint firstItem="O14-Bw-MTD" firstAttribute="width" secondItem="IWa-HT-xIg" secondAttribute="width" multiplier="1:3" id="dHU-Bx-wfa"/>
+                        <constraint firstItem="csV-19-IRC" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" constant="4" id="feG-Lu-Wbp"/>
+                        <constraint firstItem="7py-aO-M57" firstAttribute="leading" secondItem="IWa-HT-xIg" secondAttribute="leading" id="gJS-W9-GNQ"/>
+                        <constraint firstItem="X2r-AT-5fy" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" constant="4" id="gTh-MP-SCi"/>
+                        <constraint firstAttribute="bottom" secondItem="X2r-AT-5fy" secondAttribute="bottom" constant="4" id="h5v-wt-aep"/>
+                        <constraint firstAttribute="height" constant="32" id="h6k-uV-w5k"/>
+                        <constraint firstItem="O14-Bw-MTD" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" id="tPW-DG-Oab"/>
+                        <constraint firstItem="nRW-rs-cpa" firstAttribute="top" secondItem="IWa-HT-xIg" secondAttribute="top" id="uIt-xg-uZt"/>
+                        <constraint firstAttribute="bottom" secondItem="7py-aO-M57" secondAttribute="bottom" id="vxf-dr-xbd"/>
+                        <constraint firstItem="csV-19-IRC" firstAttribute="leading" secondItem="O14-Bw-MTD" secondAttribute="trailing" id="xq0-g6-XhR"/>
+                    </constraints>
+                </customView>
             </subviews>
             <constraints>
+                <constraint firstItem="IWa-HT-xIg" firstAttribute="top" secondItem="rxw-ZM-edB" secondAttribute="bottom" id="0Ib-10-CuH"/>
                 <constraint firstItem="rxw-ZM-edB" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="0id-ag-6a1"/>
                 <constraint firstItem="Gxz-qV-Ap6" firstAttribute="top" secondItem="rxw-ZM-edB" secondAttribute="bottom" id="1t8-bZ-MPp"/>
                 <constraint firstItem="Gxz-qV-Ap6" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="Gsl-AQ-r4u"/>
+                <constraint firstItem="IWa-HT-xIg" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="Igz-TM-SKj"/>
                 <constraint firstAttribute="trailing" secondItem="rxw-ZM-edB" secondAttribute="trailing" id="KND-L6-dZ2"/>
                 <constraint firstAttribute="bottom" secondItem="Gxz-qV-Ap6" secondAttribute="bottom" id="KTQ-vg-rJj"/>
                 <constraint firstItem="B80-hQ-s7Z" firstAttribute="centerX" secondItem="Gxz-qV-Ap6" secondAttribute="centerX" id="WME-Ow-cdY"/>
+                <constraint firstAttribute="trailing" secondItem="IWa-HT-xIg" secondAttribute="trailing" id="bFr-Jm-GEF"/>
                 <constraint firstItem="B80-hQ-s7Z" firstAttribute="centerY" secondItem="Gxz-qV-Ap6" secondAttribute="centerY" id="gob-d6-4iG"/>
                 <constraint firstItem="rxw-ZM-edB" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="kxZ-XW-zXg"/>
                 <constraint firstAttribute="trailing" secondItem="Gxz-qV-Ap6" secondAttribute="trailing" id="uKl-em-Ovn"/>
@@ -98,4 +172,9 @@
             <point key="canvasLocation" x="-246" y="264.5"/>
         </customView>
     </objects>
+    <resources>
+        <image name="KMImageNameFormAppearanceSelected" width="20" height="20"/>
+        <image name="KMImageNameFormGeneral" width="20" height="20"/>
+        <image name="KMImageNameFormOptions" width="20" height="20"/>
+    </resources>
 </document>

+ 0 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMPopUpButton.swift

@@ -78,7 +78,6 @@ import Cocoa
         case .arrowDown:
             image = NSImage(named: KMImageNameUXIconBtnArrowDown)
         case .arrowUpDown:
-            // Handle ArrowUpDown case
             break
         default:
             break

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonOptionsViewController.swift

@@ -10,7 +10,7 @@ import Cocoa
 private let SendEmail = "support@pdfreaderpro.com"
 private let LinkHyperlink = "https://www.pdfreaderpro.com"
 
-class KMAnnotationButtonOptionsViewController: NSViewController {
+@objcMembers class KMAnnotationButtonOptionsViewController: NSViewController {
     
     private var _annotations: [CPDFButtonWidgetAnnotation] = []
     private var _formMode: CAnnotationType = .radioButton

+ 49 - 31
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetAppearanceViewController.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMAnnotationButtonWidgetAppearanceViewController: NSViewController {
+@objcMembers class KMAnnotationButtonWidgetAppearanceViewController: NSViewController {
 
     private var _annotations: [CPDFButtonWidgetAnnotation] = []
     private var _formMode: CAnnotationType = .radioButton
@@ -99,32 +99,34 @@ class KMAnnotationButtonWidgetAppearanceViewController: NSViewController {
         }
         
         if annotationFreeText == nil {
-            annotationFreeText = CPDFFreeTextAnnotation(PDFListViewNoteWith: pdfView!.document!)
-            annotationFreeText?.setUserName("\(annotation!.fieldName)_AddText")
-            
-            let defaults = UserDefaults.standard
-            var formFont: NSFont? = nil
-            var formColor: NSColor = NSColor.black
-            
-            if formMode == .radioButton {
-                formFont = defaults.font(forNameKey: SKAnnotationRadioButtonWidgetFontNameKey,
-                                         sizeKey: SKAnnotationRadioButtonWidgetFontSizeKey)
-                formColor = defaults.color(forKey: SKAnnotationRadioButtonWidgetFontColorKey) ?? NSColor.black
-            } else if formMode == .checkBox {
-                formFont = defaults.font(forNameKey: SKAnnotationCheckBoxWidgetFontNameKey,
-                                         sizeKey: SKAnnotationCheckBoxWidgetFontSizeKey)
-                formColor = defaults.color(forKey: SKAnnotationCheckBoxWidgetFontColorKey) ?? NSColor.black
-            } else {
-                formFont = NSFont.systemFont(ofSize: 9.0)
-            }
-            
-            if formFont == nil {
-                formFont = NSFont.systemFont(ofSize: 12.0)
+            if annotations.count > 0 {
+                annotationFreeText = CPDFFreeTextAnnotation(PDFListViewNoteWith: pdfView!.document!)
+                annotationFreeText?.setUserName("\(annotation!.fieldName)_AddText")
+                
+                let defaults = UserDefaults.standard
+                var formFont: NSFont? = nil
+                var formColor: NSColor = NSColor.black
+                
+                if formMode == .radioButton {
+                    formFont = defaults.font(forNameKey: SKAnnotationRadioButtonWidgetFontNameKey,
+                                             sizeKey: SKAnnotationRadioButtonWidgetFontSizeKey)
+                    formColor = defaults.color(forKey: SKAnnotationRadioButtonWidgetFontColorKey) ?? NSColor.black
+                } else if formMode == .checkBox {
+                    formFont = defaults.font(forNameKey: SKAnnotationCheckBoxWidgetFontNameKey,
+                                             sizeKey: SKAnnotationCheckBoxWidgetFontSizeKey)
+                    formColor = defaults.color(forKey: SKAnnotationCheckBoxWidgetFontColorKey) ?? NSColor.black
+                } else {
+                    formFont = NSFont.systemFont(ofSize: 9.0)
+                }
+                
+                if formFont == nil {
+                    formFont = NSFont.systemFont(ofSize: 12.0)
+                }
+                
+                annotationFreeText?.font = formFont!
+                annotationFreeText?.fontColor = formColor
+                annotationFreeText?.contents = NSLocalizedString("Text", comment: "")
             }
-            
-            annotationFreeText?.font = formFont!
-            annotationFreeText?.fontColor = formColor
-            annotationFreeText?.contents = NSLocalizedString("Text", comment: "")
         }
         
         reloadData()
@@ -141,13 +143,29 @@ class KMAnnotationButtonWidgetAppearanceViewController: NSViewController {
     
     func reloadData() {
         var opacity: CGFloat = 1
-        if let color = annotation!.backgroundColor {
-            color.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+        
+        if annotations.count > 0 {
+            if let color = annotation!.backgroundColor {
+                color.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+            }
+        } else {
+            if let color = annotationModel?.backgroundColor() {
+                color.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+            }
         }
+        
+        if annotations.count > 0 {
+            annotationFont = annotation?.font
+            if let buttonWidget = annotation {
+                backgroundColorPickerView.color = buttonWidget.backgroundColor
+            }
+        } else {
+            annotationFont = NSFont.systemFont(ofSize: (annotationModel?.fontSize())!)
+            if annotationModel?.fontName() != nil {
+                annotationFont = NSFont(name: (annotationModel?.fontName())!, size: (annotationModel?.fontSize())!)!
+            }
 
-        annotationFont = annotation?.font
-        if let buttonWidget = annotation {
-            backgroundColorPickerView.color = buttonWidget.backgroundColor
+            backgroundColorPickerView.color = annotationModel?.backgroundColor()
         }
         
         let fontManager = NSFontManager.shared

+ 29 - 29
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetAppearanceViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="21507"/>
+        <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="KMAnnotationButtonWidgetAppearanceViewController">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationButtonWidgetAppearanceViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="appearanceAddTextBtn" destination="bqR-Ix-HTJ" id="T16-AG-l3D"/>
                 <outlet property="appearanceFontLabel" destination="dPp-Rb-yWg" id="DaT-e2-r18"/>
@@ -36,7 +36,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="0cJ-2d-rI3">
                                 <rect key="frame" x="16" y="192" width="443" height="96"/>
                                 <subviews>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PBQ-Dj-b1j">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PBQ-Dj-b1j">
                                         <rect key="frame" x="-2" y="66" width="128" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="sP3-ke-gmY"/>
@@ -47,7 +47,7 @@
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="EFk-fn-6X1" customClass="KMColorPickerView">
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="EFk-fn-6X1" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="24" width="443" height="32"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="32" id="cBL-YN-Z03"/>
@@ -77,13 +77,13 @@
                                 <subviews>
                                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bqR-Ix-HTJ">
                                         <rect key="frame" x="-2" y="-1.5" width="74" height="20"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="17" id="jzL-se-DbA"/>
-                                        </constraints>
                                         <buttonCell key="cell" type="check" title="Add text" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="XP5-mX-vWS">
                                             <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
                                             <font key="font" metaFont="cellTitle"/>
                                         </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="17" id="jzL-se-DbA"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="addTextButtonAction:" target="-2" id="cqE-JC-Aha"/>
                                         </connections>
@@ -101,19 +101,19 @@
                                 <subviews>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="072-BB-1SK">
                                         <rect key="frame" x="427" y="121" width="16" height="14"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="14" id="aFq-Wx-BLx"/>
-                                            <constraint firstAttribute="width" constant="16" id="mBk-F0-I9p"/>
-                                        </constraints>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnFontsetNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="z0p-gn-AEq">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="14" id="aFq-Wx-BLx"/>
+                                            <constraint firstAttribute="width" constant="16" id="mBk-F0-I9p"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="fontButtonAction:" target="-2" id="QHj-oZ-KfZ"/>
                                         </connections>
                                     </button>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dPp-Rb-yWg">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dPp-Rb-yWg">
                                         <rect key="frame" x="-2" y="118" width="35" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="6cH-af-Lyp"/>
@@ -124,12 +124,9 @@
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6Ud-Bd-kSK" customClass="KMPopUpButton">
-                                        <rect key="frame" x="-2" y="3" width="349" height="36"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="24" id="loq-LL-etH"/>
-                                        </constraints>
-                                        <popUpButtonCell key="cell" type="push" title="UltraLight" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" arrowPosition="noArrow" selectedItem="sd4-ps-9hd" id="wAD-Kt-rYb" customClass="KMPopUpButtonCell">
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="6Ud-Bd-kSK" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="10" width="340" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="UltraLight" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" state="on" inset="2" arrowPosition="noArrow" selectedItem="sd4-ps-9hd" id="wAD-Kt-rYb" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
                                             <menu key="menu" id="7Qp-t0-1ed">
@@ -146,16 +143,19 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="loq-LL-etH"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="fontStylePopUpButtonAction:" target="-2" id="Qua-ep-9Dn"/>
                                         </connections>
                                     </popUpButton>
-                                    <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fgb-vf-yF0" customClass="KMComboBox">
+                                    <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fgb-vf-yF0" customClass="KMComboBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="347" y="10" width="96" height="23"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="92" id="lut-MM-qja"/>
                                         </constraints>
-                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="mHY-uf-DDf" customClass="KMComboBoxCell">
+                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="mHY-uf-DDf" customClass="KMComboBoxCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -187,13 +187,10 @@
                                             <action selector="fontSizeComboBox:" target="-2" id="4Jv-Y7-VMQ"/>
                                         </connections>
                                     </comboBox>
-                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EA9-AX-1Uq" customClass="KMPopUpButton">
-                                        <rect key="frame" x="-2" y="35" width="452" height="36"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="24" id="c0k-2D-edV"/>
-                                        </constraints>
-                                        <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="Yns-VE-yf9" id="PDf-QI-VzP" customClass="KMPopUpButtonCell">
-                                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="EA9-AX-1Uq" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="42" width="443" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="Item 1" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="Yns-VE-yf9" id="PDf-QI-VzP" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
                                             <menu key="menu" id="WRU-t9-bhR">
                                                 <items>
@@ -203,11 +200,14 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="c0k-2D-edV"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="fontPopUpButtonAction:" target="-2" id="f8t-1t-opd"/>
                                         </connections>
                                     </popUpButton>
-                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="zu7-sx-j7d" customClass="KMColorPickerView">
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="zu7-sx-j7d" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="76" width="443" height="32"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="32" id="7VU-fc-AUs"/>

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationButtonWidgetOptionsViewController.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMAnnotationButtonWidgetOptionsViewController: NSViewController {
+@objcMembers class KMAnnotationButtonWidgetOptionsViewController: NSViewController {
 
     private var _annotations: [CPDFButtonWidgetAnnotation] = []
     private var _formMode: CAnnotationType = .radioButton

+ 59 - 27
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetAppearanceViewController.swift

@@ -19,7 +19,7 @@ private enum KMPDFAnnotationFontWeightType: Int {
     case black
 }
 
-class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
+@objcMembers class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
     
     private var _annotations: [CPDFChoiceWidgetAnnotation] = []
     private var _formMode: CAnnotationType = .radioButton
@@ -119,23 +119,41 @@ class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
     
     func reloadData() {
         var opacity: CGFloat = 1
-        if let color = annotation!.backgroundColor {
-            color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
-        }
-
-        if let fontColor = annotation?.fontColor,
-           annotation != nil /*|| annotation?.type == .widgetPushButtonControl*/ {
-            fillColorPickerView.color = annotation?.backgroundColor
-            colorPickerView.color = fontColor
+        
+        if annotations.count > 0 {
+            if let color = annotation!.backgroundColor {
+                color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
+            }
+            if let fontColor = annotation?.fontColor,
+                annotation != nil /*|| annotation?.type == .widgetPushButtonControl*/ {
+                fillColorPickerView.color = annotation?.backgroundColor
+                colorPickerView.color = fontColor
+            }
+            fontSizeComboBox.stringValue = "\(annotation?.font.pointSize) pt"
+        } else {
+            if let color = annotationModel?.backgroundColor() {
+                color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)?.getRed(nil, green: nil, blue: nil, alpha: &opacity)
+            }
+            if let fontColor = annotationModel?.fontColor() {
+                fillColorPickerView.color = annotationModel?.backgroundColor()
+                colorPickerView.color = fontColor
+            }
+            fontSizeComboBox.stringValue = "\(annotationModel?.fontSize()) pt"
         }
 
-        fontSizeComboBox.stringValue = "\(annotation?.font.pointSize) pt"
-
         DispatchQueue.global(qos: .default).async { [self] in
             let fonts = NSFontManager.shared.availableFontFamilies
             var selectedIndex = 0
-            let family = annotation?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String ?? ""
-            let style = annotation?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String ?? ""
+            var family = ""
+            var style = ""
+            if annotations.count > 0 {
+                family = annotation?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String ?? ""
+                style = annotation?.font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String ?? ""
+            } else {
+                let annotationFont = NSFont(name: (annotationModel?.fontName())!, size: (annotationModel?.fontSize())!)
+                family = annotationFont!.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String ?? ""
+                style = annotationFont!.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String ?? ""
+            }
 
             let menu = NSMenu()
             
@@ -146,8 +164,15 @@ class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
                     let item = NSMenuItem()
                     item.attributedTitle = attributedString
                     menu.addItem(item)
-                    if annotation?.font.fontName == font.fontName {
-                        selectedIndex = index
+                    
+                    if annotations.count > 0 {
+                        if annotation?.font.fontName == font.fontName {
+                            selectedIndex = index
+                        }
+                    } else {
+                        if annotationModel?.fontName() == font.fontName {
+                            selectedIndex = index
+                        }
                     }
                 }
             }
@@ -159,8 +184,12 @@ class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
                 fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
             }
         }
-
-        annotationFont = annotation?.font
+        
+        if annotations.count > 0 {
+            annotationFont = annotation?.font
+        } else {
+            annotationFont = NSFont(name: (annotationModel?.fontName())!, size: (annotationModel?.fontSize())!)
+        }
 
         let fontManager = NSFontManager.shared
         fontManager.target = self
@@ -236,21 +265,24 @@ class KMAnnotationChoiceWidgetAppearanceViewController: NSViewController {
     func setFontStyleWithFontName(_ fontName: String, currentStyle style: String?) -> UInt {
         var selectIndex: UInt = 0
         let menu = NSMenu()
-        if let fontFamily = NSFontManager.shared.availableMembers(ofFontFamily: fontName) {
-            for (index, array) in fontFamily.enumerated() {
-                let styleName = array[1] as? String ?? ""
-                if style == styleName {
+        let fontFamily = NSFontManager.shared.availableMembers(ofFontFamily: fontName)
+        if fontFamily != nil {
+            for (index, array) in fontFamily!.enumerated() {
+                let styleName = array[1]
+                if let currentStyle = style, styleName as! String == currentStyle {
                     selectIndex = UInt(index)
                 }
                 let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontName, NSFontDescriptor.AttributeName.face: styleName])
-                let font = NSFont(descriptor: attributeFontDescriptor, size: 12.0)
-                let attrited = [NSAttributedString.Key.font: font]
-                let string = NSAttributedString(string: styleName, attributes: attrited)
-                let item = NSMenuItem()
-                item.attributedTitle = string
-                menu.addItem(item)
+                if let font = NSFont(descriptor: attributeFontDescriptor, size: 12.0) {
+                    let attrited = [NSAttributedString.Key.font: font]
+                    let string = NSAttributedString(string: styleName as! String, attributes: attrited)
+                    let item = NSMenuItem()
+                    item.attributedTitle = string
+                    menu.addItem(item)
+                }
             }
         }
+
         if style == nil {
             selectIndex = 0
         }

+ 28 - 28
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetAppearanceViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="18122"/>
+        <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="KMAnnotationChoiceWidgetAppearanceViewController">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAnnotationChoiceWidgetAppearanceViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="colorPickerView" destination="fb8-83-Upj" id="SRL-RL-w8c"/>
                 <outlet property="fillColorLabel" destination="IId-XT-GX4" id="9EZ-wi-XAX"/>
@@ -35,7 +35,7 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="sUG-di-Kdv">
                                 <rect key="frame" x="16" y="165" width="443" height="72"/>
                                 <subviews>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IId-XT-GX4">
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IId-XT-GX4">
                                         <rect key="frame" x="-2" y="42" width="42" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="2HK-FU-Gre"/>
@@ -46,7 +46,7 @@
                                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                                         </textFieldCell>
                                     </textField>
-                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="F5z-22-r2f" customClass="KMColorPickerView">
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="F5z-22-r2f" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="0.0" width="443" height="32"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="32" id="uyy-tS-u3h"/>
@@ -68,8 +68,8 @@
                             <customView translatesAutoresizingMaskIntoConstraints="NO" id="QuF-Kd-WRq">
                                 <rect key="frame" x="16" y="10" width="443" height="145"/>
                                 <subviews>
-                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1dR-tg-XTu">
-                                        <rect key="frame" x="-2" y="118" width="36" height="17"/>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1dR-tg-XTu">
+                                        <rect key="frame" x="-2" y="118" width="35" height="17"/>
                                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Font" id="aLz-5f-LzI">
                                             <font key="font" metaFont="systemBold" size="14"/>
                                             <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
@@ -78,24 +78,21 @@
                                     </textField>
                                     <button translatesAutoresizingMaskIntoConstraints="NO" id="0qZ-0s-ONw">
                                         <rect key="frame" x="417" y="119" width="16" height="16"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="16" id="RQ2-Np-u1f"/>
-                                            <constraint firstAttribute="width" constant="16" id="ebk-LL-wBK"/>
-                                        </constraints>
                                         <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnFontsetNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="DMe-4N-iGI">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="16" id="RQ2-Np-u1f"/>
+                                            <constraint firstAttribute="width" constant="16" id="ebk-LL-wBK"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="buttonClicked_ChangeFont:" target="-2" id="ccS-m1-x8A"/>
                                         </connections>
                                     </button>
-                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2u3-Kk-MNa" customClass="KMPopUpButton">
-                                        <rect key="frame" x="-2" y="3" width="349" height="36"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="24" id="A08-h9-JXQ"/>
-                                        </constraints>
-                                        <popUpButtonCell key="cell" type="push" title="UltraLight" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" inset="2" arrowPosition="noArrow" selectedItem="b8w-9P-1Ld" id="MeQ-zr-ReI" customClass="KMPopUpButtonCell">
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="2u3-Kk-MNa" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="10" width="340" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="UltraLight" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" state="on" inset="2" arrowPosition="noArrow" selectedItem="b8w-9P-1Ld" id="MeQ-zr-ReI" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
                                             <menu key="menu" id="6eM-Of-hda">
@@ -112,16 +109,19 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="A08-h9-JXQ"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="fontStylePopUpButtonAction:" target="-2" id="Vgt-PU-i4T"/>
                                         </connections>
                                     </popUpButton>
-                                    <comboBox verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Ve-E4-2UE" customClass="KMComboBox">
-                                        <rect key="frame" x="348" y="10" width="95" height="23"/>
+                                    <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8Ve-E4-2UE" customClass="KMComboBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="347" y="10" width="96" height="23"/>
                                         <constraints>
                                             <constraint firstAttribute="width" constant="92" id="yqp-xQ-AJY"/>
                                         </constraints>
-                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="Pzf-xX-zIz" customClass="KMComboBoxCell">
+                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="Pzf-xX-zIz" customClass="KMComboBoxCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                             <font key="font" metaFont="system"/>
                                             <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
                                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -153,13 +153,10 @@
                                             <action selector="fontSizeComboBoxAction:" target="-2" id="fJc-QM-eBL"/>
                                         </connections>
                                     </comboBox>
-                                    <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dds-CG-9jA" customClass="KMPopUpButton">
-                                        <rect key="frame" x="-2" y="35" width="452" height="36"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="24" id="BKI-cy-EMV"/>
-                                        </constraints>
-                                        <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="Lif-0J-Dbd" id="qTm-jx-qUv" customClass="KMPopUpButtonCell">
-                                            <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="Dds-CG-9jA" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="42" width="443" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="Item 1" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="Lif-0J-Dbd" id="qTm-jx-qUv" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="menu"/>
                                             <menu key="menu" id="u73-CF-6q8">
                                                 <items>
@@ -169,11 +166,14 @@
                                                 </items>
                                             </menu>
                                         </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="BKI-cy-EMV"/>
+                                        </constraints>
                                         <connections>
                                             <action selector="fontPopUpButtonAction:" target="-2" id="Rlu-Q8-tCK"/>
                                         </connections>
                                     </popUpButton>
-                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="fb8-83-Upj" customClass="KMColorPickerView">
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="fb8-83-Upj" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="0.0" y="76" width="443" height="32"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="32" id="7uL-Qc-jV3"/>

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationChoiceWidgetOptionsViewController.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMChoiceWidgetTableViewCell: NSTableCellView {
+@objcMembers class KMChoiceWidgetTableViewCell: NSTableCellView {
     
     @IBOutlet weak var titleLabel: NSTextField!
     

+ 606 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift

@@ -0,0 +1,606 @@
+//
+//  KMAnnotationFromViewController.swift
+//  PDF Reader Pro
+//
+//  Created by wanjun on 2024/1/18.
+//
+
+import Cocoa
+
+@objcMembers class KMAnnotationFromViewController: NSViewController {
+    
+    private var _annotations: [CPDFWidgetAnnotation] = []
+    private var _formMode: CAnnotationType = .radioButton
+    var pdfView: CPDFListView?
+    var annotationModel: CPDFAnnotationModel?
+    
+    @IBOutlet private var colorLabel: NSTextField!
+    @IBOutlet private var colorPickerView: KMColorPickerView!
+    @IBOutlet private var fillColorPickerView: KMColorPickerView!
+    
+    @IBOutlet private var fontViewBottom: NSLayoutConstraint!
+    @IBOutlet private var fontLabel: NSTextField!
+
+    @IBOutlet private var fontPopUpButton: KMPopUpButton!
+    @IBOutlet private var fontStylePopUpButton: KMPopUpButton!
+    @IBOutlet private var fontSizeComboBox: KMComboBox!
+
+    private var annotation: CPDFWidgetAnnotation?
+    private var isFromMode: Bool = false
+    private var annotationFont: NSFont?
+    
+    deinit {
+        NotificationCenter.default.removeObserver(self)
+        DistributedNotificationCenter.default.removeObserver(self)
+        annotation = nil
+        colorPickerView.target = nil
+        colorPickerView.action = nil
+        fillColorPickerView.target = nil
+        fillColorPickerView.action = nil
+        NSFontManager.shared.target = nil
+    }
+
+    override func loadView() {
+        super.loadView()
+        
+        colorLabel.stringValue = NSLocalizedString("Colors", comment: "")
+        colorLabel.textColor = KMAppearance.Layout.h0Color()
+        fontLabel.stringValue = NSLocalizedString("Fonts", comment: "")
+        fontLabel.textColor = KMAppearance.Layout.h0Color()
+        
+        colorPickerView.noContentString = true
+        colorPickerView.annotationTypeString = NSLocalizedString("Text Color", comment: "")
+        fillColorPickerView.annotationTypeString = NSLocalizedString("Background Color", comment: "")
+        fillColorPickerView.noContentString = true
+        
+        colorPickerView.annotationType = .fromColors
+        fillColorPickerView.annotationType = .fromFillColors
+        fillColorPickerView.isFillColor = true
+        colorPickerView.isCallColorPanelAction = true
+        fillColorPickerView.isCallColorPanelAction = true
+        
+        fontPopUpButton.type = .arrowUpDown
+        fontStylePopUpButton.type = .arrowDown
+        fontSizeComboBox.type = .none
+        fontSizeComboBox.comboxRect = fontSizeComboBox.bounds
+        
+        let views: [NSView] = [fontPopUpButton, fontStylePopUpButton, fontSizeComboBox]
+        for view in views {
+            view.wantsLayer = true
+            view.layer?.backgroundColor = KMAppearance.Layout.l1Color().cgColor
+            view.layer?.borderWidth = 1.0
+            view.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
+            view.layer?.cornerRadius = 1.0
+        }
+        
+        updateViewColor()
+        reloadData()
+    }
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+
+        let showConvertDetails = KMPropertiesViewPopController.showChangeColorDetails()
+        if showConvertDetails, let document = self.view.window?.windowController?.document as? NSDocument, document.fileURL != nil {
+            KMPropertiesViewPopController.defaultManager().showChangeColorDetailsView(colorPickerView.firstButton)
+        }
+
+        NotificationCenter.default.addObserver(self, selector: #selector(themeChanged(_:)), name: NSNotification.Name("AppleInterfaceThemeChangedNotification"), object: nil)
+    }
+    
+    // MARK: Get & Set
+    
+    var annotations: [CPDFWidgetAnnotation] {
+        get {
+            return _annotations
+        }
+        set {
+            _annotations = newValue
+            annotation = _annotations.first
+        }
+    }
+    var formMode: CAnnotationType {
+        get {
+            return _formMode
+        }
+        set {
+            _formMode = newValue
+            isFromMode = true
+            
+            let defaults = UserDefaults.standard
+            var annotation: CPDFWidgetAnnotation?
+            var backgroundColor: NSColor?
+            var fontColor: NSColor?
+            
+            if formMode == .textField {
+                annotation = CPDFTextWidgetAnnotation(PDFListViewNoteWith: (pdfView?.document)!)
+                backgroundColor = defaults.color(forKey: SKAnnotationTextWidgetBackgroundColorKey) ?? NSColor.clear
+                annotation?.backgroundColor = backgroundColor
+                fontColor = defaults.color(forKey: SKAnnotationTextWidgetFontColorKey)
+                annotation?.fontColor = fontColor
+                (annotation as! CPDFTextWidgetAnnotation).alignment = NSTextAlignment(rawValue: defaults.integer(forKey: SKAnnotationTextWidgetAlignmenKey)) ?? .left
+                if let font = defaults.font(forNameKey: CAnnotationTextWidgetFontNameKey, sizeKey: CAnnotationTextWidgetFontSizeKey) {
+                    annotation?.font = font
+                }
+                if let tAnnotation = annotation as? CPDFTextWidgetAnnotation {
+                    (annotation as! CPDFTextWidgetAnnotation).isMultiline = defaults.bool(forKey: SKAnnotationTextMultilineKey)
+                }
+            } else if formMode == .listMenu {
+                annotation = CPDFChoiceWidgetAnnotation(PDFListViewNoteWith: (pdfView?.document)!, listChoice: true)
+                backgroundColor = defaults.color(forKey: SKAnnotationChoiceListWidgetBackgroundColorKey) ?? NSColor.clear
+                annotation?.backgroundColor = backgroundColor
+                fontColor = defaults.color(forKey: SKAnnotationChoiceListWidgetFontColorKey)
+                annotation?.fontColor = fontColor
+                if let font = defaults.font(forNameKey: SKAnnotationChoiceListWidgetFontNameKey, sizeKey: SKAnnotationChoiceListWidgetFontSizeKey) {
+                    annotation?.font = font
+                }
+            } else if formMode == .comboBox {
+                annotation = CPDFChoiceWidgetAnnotation(PDFListViewNoteWith: (pdfView?.document)!, listChoice: false)
+                backgroundColor = defaults.color(forKey: SKAnnotationChoiceWidgetBackgroundColorKey) ?? NSColor.clear
+                annotation?.backgroundColor = backgroundColor
+                fontColor = defaults.color(forKey: SKAnnotationChoiceWidgetFontColorKey)
+                annotation?.fontColor = fontColor
+                if let font = defaults.font(forNameKey: SKAnnotationChoiceWidgetFontNameKey, sizeKey: SKAnnotationChoiceWidgetFontSizeKey) {
+                    annotation?.font = font
+                }
+            } else {
+                annotation = CPDFWidgetAnnotation(document: (pdfView?.document)!)
+            }
+            
+            self.annotations = [annotation].compactMap { $0 }
+            self.annotation = annotations.first
+
+        }
+    }
+
+    // MARK: Private Method
+    
+    func reloadData() {
+        if annotations.count > 0 {
+            if let presetValue = annotation?.buttonWidgetStateString() {
+                annotation?.setButtonWidgetStateString(presetValue)
+            }
+            var opacity: CGFloat = 1
+            let color = annotation!.backgroundColor
+            if color != nil {
+                color!.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+            }
+
+            let fontColor = self.annotation!.fontColor
+            if let isTextWidget = (annotation?.isKind(of: CPDFTextWidgetAnnotation.self)), isTextWidget {
+                fillColorPickerView!.color = color
+                colorPickerView.color = fontColor
+                
+                fontSizeComboBox.stringValue = "\((annotation as! CPDFTextWidgetAnnotation).font.pointSize) pt"
+                
+                DispatchQueue.global(qos: .default).async { [self] in
+                    let fonts = NSFontManager.shared.availableFontFamilies
+                    var selectedIndex = 0
+                    if let family = (annotation as! CPDFTextWidgetAnnotation).font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String,
+                       let style = (annotation as! CPDFTextWidgetAnnotation).font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String {
+
+                        let menu = NSMenu()
+                        for (index, fontName) in fonts.enumerated() {
+                            if let font = NSFont(name: fontName, size: annotation!.fontSize()) {
+                                let attributes: [NSAttributedString.Key: Any] = [.font: font]
+                                let attributedString = NSAttributedString(string: fontName, attributes: attributes)
+                                let item = NSMenuItem()
+                                item.attributedTitle = attributedString
+                                menu.addItem(item)
+
+                                if (annotation as! CPDFTextWidgetAnnotation).font.fontName == font.fontName {
+                                    selectedIndex = index
+                                }
+                            }
+                        }
+
+                        DispatchQueue.main.async { [self] in
+                            fontPopUpButton.menu = menu
+                            fontPopUpButton.selectItem(at: selectedIndex)
+                            let selectedStyleIndex = setFontStyle(withFontName: family, currentStyle: style)
+                            fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
+                        }
+                    }
+                }
+                annotationFont = (annotation as! CPDFTextWidgetAnnotation).font
+            }
+        } else {
+            if let presetValue = annotationModel?.stringValue() {
+                annotationModel?.setStringValue(presetValue)
+            }
+            var opacity: CGFloat = 1
+            let color = annotationModel?.backgroundColor()
+            if color != nil {
+                color!.usingColorSpaceName(.calibratedRGB)?.getRed(nil, green:nil, blue: nil, alpha: &opacity)
+            }
+
+            let fontColor = annotationModel?.fontColor()
+            fillColorPickerView!.color = color
+            colorPickerView.color = fontColor
+            fontSizeComboBox.stringValue = "\(annotationModel?.fontSize() ?? 12.0) pt"
+            
+            var annotationFont = NSFont.systemFont(ofSize: (annotationModel?.fontSize())!)
+            if annotationModel?.fontName() != nil {
+                annotationFont = NSFont(name: (annotationModel?.fontName())!, size: (annotationModel?.fontSize())!)!
+            }
+            DispatchQueue.global(qos: .default).async { [self] in
+                let fonts = NSFontManager.shared.availableFontFamilies
+                var selectedIndex = 0
+                let family = annotationFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String
+                let style = annotationFont.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.face) as? String
+                let menu = NSMenu()
+                for (index, fontName) in fonts.enumerated() {
+                    if let font = NSFont(name: fontName, size: (annotationModel?.fontSize())!) {
+                        let attributes: [NSAttributedString.Key: Any] = [.font: font]
+                        let attributedString = NSAttributedString(string: fontName, attributes: attributes)
+                        let item = NSMenuItem()
+                        item.attributedTitle = attributedString
+                        menu.addItem(item)
+
+                        if annotationModel?.fontName() != nil {
+                            if annotationModel?.fontName() == font.fontName {
+                                selectedIndex = index
+                            }
+                        }
+                    }
+                }
+
+                DispatchQueue.main.async { [self] in
+                    fontPopUpButton.menu = menu
+                    fontPopUpButton.selectItem(at: selectedIndex)
+                    let selectedStyleIndex = setFontStyle(withFontName: family!, currentStyle: style)
+                    fontStylePopUpButton.selectItem(at: Int(selectedStyleIndex))
+                }
+            }
+            self.annotationFont = annotationFont
+        }
+
+        let fontManager = NSFontManager.shared
+        fontManager.target = self
+        fontManager.action = #selector(changeFont(_:))
+    }
+    
+    func updateAnnotationMode() {
+        let userDefaults = UserDefaults.standard
+        guard let annotation = self.annotation else { return }
+        
+        if formMode == .textField {
+            userDefaults.setColor(annotation.backgroundColor, forKey: SKAnnotationTextWidgetBackgroundColorKey)
+            userDefaults.setColor(annotation.fontColor, forKey: SKAnnotationTextWidgetFontColorKey)
+            userDefaults.set((annotation as! CPDFTextWidgetAnnotation).alignment.rawValue, forKey: SKAnnotationTextWidgetAlignmenKey)
+            userDefaults.set(annotation.font.fontName, forKey: CAnnotationTextWidgetFontNameKey)
+            userDefaults.set(annotation.font.pointSize, forKey: CAnnotationTextWidgetFontSizeKey)
+            userDefaults.set((annotation as! CPDFTextWidgetAnnotation).isMultiline, forKey: SKAnnotationTextMultilineKey)
+        } else if formMode == .comboBox {
+            userDefaults.setColor(annotation.backgroundColor, forKey: SKAnnotationChoiceWidgetBackgroundColorKey)
+            userDefaults.setColor(annotation.fontColor, forKey: SKAnnotationChoiceWidgetFontColorKey)
+            userDefaults.set(annotation.font.fontName, forKey: SKAnnotationChoiceWidgetFontNameKey)
+            userDefaults.set(annotation.font.pointSize, forKey: SKAnnotationChoiceWidgetFontSizeKey)
+        } else if formMode == .comboBox {
+            userDefaults.setColor(annotation.backgroundColor, forKey: SKAnnotationChoiceListWidgetBackgroundColorKey)
+            userDefaults.setColor(annotation.fontColor, forKey: SKAnnotationChoiceListWidgetFontColorKey)
+            userDefaults.set(annotation.font.fontName, forKey: SKAnnotationChoiceListWidgetFontNameKey)
+            userDefaults.set(annotation.font.pointSize, forKey: SKAnnotationChoiceListWidgetFontSizeKey)
+        }
+    }
+    
+    func colorWithCGColor(_ CGColor: CGColor?) -> NSColor? {
+        guard let CGColor = CGColor else { return nil }
+        return NSColor(cgColor: CIColor(cgColor: CGColor) as! CGColor)
+    }
+
+    private func updateAnnotation() {
+        if annotationModel?.annotation != nil {
+            for tAnnotation in annotations {
+                pdfView?.setNeedsDisplayAnnotationViewFor(tAnnotation.page)
+            }
+        }
+    }
+    
+    func setFontStyle(withFontName fontName: String, currentStyle style: String?) -> UInt {
+        var selectIndex: UInt = 0
+        let menu = NSMenu()
+        let fontFamily = NSFontManager.shared.availableMembers(ofFontFamily: fontName)
+        if fontFamily != nil {
+            for (index, array) in fontFamily!.enumerated() {
+                let styleName = array[1]
+                if let currentStyle = style, styleName as! String == currentStyle {
+                    selectIndex = UInt(index)
+                }
+                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: fontName, NSFontDescriptor.AttributeName.face: styleName])
+                if let font = NSFont(descriptor: attributeFontDescriptor, size: 12.0) {
+                    let attrited = [NSAttributedString.Key.font: font]
+                    let string = NSAttributedString(string: styleName as! String, attributes: attrited)
+                    let item = NSMenuItem()
+                    item.attributedTitle = string
+                    menu.addItem(item)
+                }
+            }
+        }
+        
+        if style == nil {
+            selectIndex = 0
+        }
+        
+        fontStylePopUpButton.menu = menu
+        return selectIndex
+    }
+
+    func changeStoredFontInfo(_ sender: Any) {
+        for tAnnotation in annotations {
+//            if let font = (sender as AnyObject).convertFont(tAnnotation.font) {
+//                tAnnotation.font = font
+//            }
+        }
+    }
+
+    @objc func changeFont(_ sender: Any) {
+//        if let convertedFont = (sender as AnyObject).convertFont(annotationFont) {
+//            annotationFont = convertedFont
+//        }
+        
+        for tAnnotation in annotations {
+            var annotationString = ""
+            
+            if tAnnotation.buttonWidgetStateString().isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                }
+            }
+            
+            tAnnotation.font = annotationFont
+            tAnnotation.setButtonWidgetStateString(annotationString)
+        }
+        
+        updateAnnotation()
+    }
+    
+    // MARK: UI Action
+    
+    @IBAction func colorPickerViewAction(_ sender: Any) {
+        for tAnnotation in annotations {
+            var annotationString = ""
+            if tAnnotation.buttonWidgetStateString().isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                }
+            }
+            tAnnotation.fontColor = colorPickerView.color
+            tAnnotation.setButtonWidgetStateString(annotationString)
+        }
+        updateAnnotation()
+    }
+
+    @IBAction func fillColorPickerViewAction(_ sender: Any) {
+        for tAnnotation in annotations {
+//            tAnnotation.removeAllAppearanceStreams()
+            tAnnotation.backgroundColor = fillColorPickerView.color
+        }
+        updateAnnotation()
+    }
+    
+    @IBAction func fontSizeComboBoxAction(_ sender: Any) {
+        for tAnnotation in annotations {
+            var annotationString = ""
+            if tAnnotation.buttonWidgetStateString().isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                }
+            }
+            
+            // tAnnotation.removeAllAppearanceStreams()
+            if let font = tAnnotation.font {
+                tAnnotation.font = NSFont(name: font.fontName, size: CGFloat(fontSizeComboBox.floatValue))
+            }
+            tAnnotation.setButtonWidgetStateString(annotationString)
+        }
+        updateAnnotation()
+    }
+
+    @IBAction func fontColorButtonAction(_ sender: NSButton) {
+        NSColorPanel.shared.setTarget(self)
+        NSColorPanel.shared.setAction(#selector(colorPanelAction(_:)))
+        NSColorPanel.shared.orderFront(nil)
+    }
+
+    @IBAction func colorPanelAction(_ sender: Any) {
+        let color = NSColorPanel.shared.color
+        for tAnnotation in annotations {
+            var annotationString = ""
+            if tAnnotation.buttonWidgetStateString().isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                } else {
+                    annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                }
+            }
+            
+            tAnnotation.fontColor = color
+            tAnnotation.setButtonWidgetStateString(annotationString)
+        }
+        updateAnnotation()
+    }
+
+    @IBAction func currentFontColorButtonAction(_ sender: NSButton) {
+        if let color = colorWithCGColor(sender.layer?.backgroundColor) {
+            for tAnnotation in annotations {
+//                tAnnotation.removeAllAppearanceStreams()
+                tAnnotation.fontColor = color
+            }
+            updateAnnotation()
+        }
+    }
+    
+    @IBAction func fontPopUpButtonAction(_ sender: NSPopUpButton) {
+        if let selectedItem = fontPopUpButton.selectedItem {
+            let resultAtt = NSMutableAttributedString(attributedString: selectedItem.attributedTitle!)
+            let familyString = resultAtt.string
+            let selectIndex = setFontStyle(withFontName: familyString, currentStyle: nil)
+            let styleString = fontStylePopUpButton.selectedItem?.title ?? ""
+            fontStylePopUpButton.selectItem(at: Int(selectIndex))
+            
+            for tAnnotation in annotations {
+                var annotationString = ""
+                
+                if tAnnotation.buttonWidgetStateString().isEmpty {
+                    annotationString = " "
+                } else {
+                    let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                    if lastString == " " {
+                        annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                    } else {
+                        annotationString = tAnnotation.buttonWidgetStateString() + " "
+                    }
+                }
+                
+                if let font = (annotation as! CPDFTextWidgetAnnotation).font {
+                    let fontSize = font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.size) as? CGFloat ?? 12.0
+                    
+                    let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: familyString, NSFontDescriptor.AttributeName.face: styleString])
+                    if let newFont = NSFont(descriptor: attributeFontDescriptor, size: fontSize) {
+                        tAnnotation.font = newFont
+                    }
+                }
+                
+                tAnnotation.setButtonWidgetStateString(annotationString)
+            }
+            
+            updateAnnotation()
+        }
+    }
+    
+    @IBAction func fontStylePopUpButtonAction(_ sender: NSPopUpButton) {
+        guard let styleString = sender.selectedItem?.title else {
+            return
+        }
+        
+        for tAnnotation in annotations {
+            var annotationString = ""
+            if tAnnotation.buttonWidgetStateString().isEmpty {
+                annotationString = " "
+            } else {
+                let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                if lastString == " " {
+                    annotationString = String(tAnnotation.buttonWidgetStateString().dropLast())
+                } else {
+                    annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                }
+            }
+            
+            if let font = tAnnotation.font {
+                let fontSize = font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.size) as? NSNumber
+                let familyString = font.fontDescriptor.object(forKey: NSFontDescriptor.AttributeName.family) as? String
+                
+                let attributeFontDescriptor = NSFontDescriptor(fontAttributes: [NSFontDescriptor.AttributeName.family: familyString as Any, NSFontDescriptor.AttributeName.face: styleString])
+                if let newFont = NSFont(descriptor: attributeFontDescriptor, size: CGFloat(fontSize?.floatValue ?? 12.0)) {
+                    tAnnotation.font = newFont
+                }
+            }
+            tAnnotation.setButtonWidgetStateString(annotationString)
+        }
+        updateAnnotation()
+    }
+    
+    @IBAction func buttonClicked_ChangeFont(_ sender: Any) {
+        let fontWindowController = KMAnnotationFontWindowController.sharedAnnotationFont
+        let window = fontWindowController.window
+        if fontWindowController != nil && window != nil {
+            fontWindowController.annotations = annotations
+
+            fontWindowController.annotationAlignCallback = { [weak self] selectedCount in
+                guard let self = self else { return }
+                
+                for tAnnotation in self.annotations {
+                    var annotationString = ""
+                    
+                    
+                    if tAnnotation.buttonWidgetStateString().isEmpty {
+                        annotationString = " "
+                    } else {
+                        let lastString = String(tAnnotation.buttonWidgetStateString().suffix(1))
+                        
+                        if lastString == " " {
+                            annotationString = String(tAnnotation.buttonWidgetStateString().prefix(tAnnotation.buttonWidgetStateString().count - 1))
+                        } else {
+                            annotationString = "\(tAnnotation.buttonWidgetStateString()) "
+                        }
+                    }
+                    
+                    switch selectedCount {
+                    case 0:
+                        (tAnnotation as! CPDFTextWidgetAnnotation).alignment = .left
+                    case 2:
+                        (tAnnotation as! CPDFTextWidgetAnnotation).alignment = .center
+                    case 1:
+                        (tAnnotation as! CPDFTextWidgetAnnotation).alignment = .right
+                    case 3:
+                        (tAnnotation as! CPDFTextWidgetAnnotation).alignment = .justified
+                    default:
+                        break
+                    }
+                    
+                    tAnnotation.setButtonWidgetStateString(annotationString)
+                }
+                
+                updateAnnotation()
+            }
+            
+//            fontWindowController.annotationCallback = {
+//                
+//            }
+            
+            window!.orderFront(sender)
+        }
+    }
+
+    // MARK: NSNotification Action
+    
+    @objc func themeChanged(_ notification: Notification) {
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
+            self?.updateViewColor()
+        }
+    }
+
+    func updateViewColor() {
+        if KMAppearance.isDarkMode() {
+            let darkModeColor = NSColor(red: 57/255.0, green: 60/255.0, blue: 62/255.0, alpha: 1.0).cgColor
+            
+            fontPopUpButton.layer?.backgroundColor = darkModeColor
+            fontStylePopUpButton.layer?.backgroundColor = darkModeColor
+            fontSizeComboBox.layer?.backgroundColor = darkModeColor
+            
+            fontPopUpButton.layer?.borderColor = darkModeColor
+            fontStylePopUpButton.layer?.borderColor = darkModeColor
+            fontSizeComboBox.layer?.borderColor = darkModeColor
+        } else {
+            let lightModeColor = NSColor.white.cgColor
+            let borderColor = NSColor(red: 218/255.0, green: 219/255.0, blue: 222/255.0, alpha: 1.0).cgColor
+            
+            fontPopUpButton.layer?.backgroundColor = lightModeColor
+            fontStylePopUpButton.layer?.backgroundColor = lightModeColor
+            fontSizeComboBox.layer?.backgroundColor = lightModeColor
+            
+            fontPopUpButton.layer?.borderColor = borderColor
+            fontStylePopUpButton.layer?.borderColor = borderColor
+            fontSizeComboBox.layer?.borderColor = borderColor
+        }
+    }
+}

+ 239 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.xib

@@ -0,0 +1,239 @@
+<?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="KMAnnotationFromViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
+            <connections>
+                <outlet property="colorLabel" destination="EzY-Rn-BbY" id="LCb-jl-YjA"/>
+                <outlet property="colorPickerView" destination="I9j-dh-A4F" id="8am-cA-Tgl"/>
+                <outlet property="fillColorPickerView" destination="80w-Z8-ZcV" id="y8t-UQ-cAf"/>
+                <outlet property="fontLabel" destination="F3t-vo-m8R" id="Rig-fQ-Gdk"/>
+                <outlet property="fontPopUpButton" destination="deY-mX-vB8" id="8jI-8Z-5HO"/>
+                <outlet property="fontSizeComboBox" destination="Zsv-um-rt4" id="jL0-2b-BEM"/>
+                <outlet property="fontStylePopUpButton" destination="gDa-hs-HAY" id="Mkz-vz-PjV"/>
+                <outlet property="fontViewBottom" destination="OAZ-g4-dUn" id="ZNe-cP-Ymx"/>
+                <outlet property="view" destination="5fm-Jp-Vhe" id="dSw-o2-jRB"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="5fm-Jp-Vhe">
+            <rect key="frame" x="0.0" y="0.0" width="475" height="406"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="BZu-z6-xmB" customClass="KMClipView">
+                <rect key="frame" x="0.0" y="0.0" width="475" height="406"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                <subviews>
+                    <view translatesAutoresizingMaskIntoConstraints="NO" id="H8a-Ge-fmm">
+                        <rect key="frame" x="0.0" y="156" width="475" height="250"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="yZI-R2-shQ">
+                                <rect key="frame" x="16" y="168" width="443" height="72"/>
+                                <subviews>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="EzY-Rn-BbY">
+                                        <rect key="frame" x="-2" y="42" width="42" height="20"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="20" id="K6J-D4-0kY"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Color" id="OMa-HJ-JI8">
+                                            <font key="font" metaFont="systemBold" size="14"/>
+                                            <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="80w-Z8-ZcV" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="0.0" width="443" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="32" id="Obp-4o-9Rl"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="fillColorPickerViewAction:" target="-2" id="jjb-94-gRp"/>
+                                        </connections>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="80w-Z8-ZcV" firstAttribute="top" secondItem="EzY-Rn-BbY" secondAttribute="bottom" constant="10" id="ARi-wl-uEi"/>
+                                    <constraint firstItem="EzY-Rn-BbY" firstAttribute="top" secondItem="yZI-R2-shQ" secondAttribute="top" constant="10" id="SVB-Ll-y9z"/>
+                                    <constraint firstItem="EzY-Rn-BbY" firstAttribute="leading" secondItem="yZI-R2-shQ" secondAttribute="leading" id="UA2-ne-YRG"/>
+                                    <constraint firstAttribute="trailing" secondItem="80w-Z8-ZcV" secondAttribute="trailing" id="ZqA-ZU-MzK"/>
+                                    <constraint firstItem="80w-Z8-ZcV" firstAttribute="leading" secondItem="yZI-R2-shQ" secondAttribute="leading" id="sHZ-1k-wyZ"/>
+                                    <constraint firstAttribute="bottom" secondItem="80w-Z8-ZcV" secondAttribute="bottom" id="yqq-QX-o4B"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="aY5-Ez-sJf">
+                                <rect key="frame" x="16" y="10" width="443" height="148"/>
+                                <subviews>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="gDa-hs-HAY" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="10" width="340" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="UltraLight" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" inset="2" arrowPosition="noArrow" selectedItem="kMy-Sq-F6W" id="kPM-Z8-bb5" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="9Au-Ew-JIE">
+                                                <items>
+                                                    <menuItem title="UltraLight" state="on" id="kMy-Sq-F6W"/>
+                                                    <menuItem title="Thin" id="ves-OD-2en"/>
+                                                    <menuItem title="Light" id="KDv-JC-MSY"/>
+                                                    <menuItem title="Regular" id="7i6-9o-V1p"/>
+                                                    <menuItem title="Medium" id="DI9-6B-sI3"/>
+                                                    <menuItem title="Semibold" id="JkM-9n-TjL"/>
+                                                    <menuItem title="Bold" id="gg4-dq-csg"/>
+                                                    <menuItem title="Heavy" id="FJQ-cj-M6f"/>
+                                                    <menuItem title="Black" id="29t-Zw-chX"/>
+                                                </items>
+                                            </menu>
+                                        </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="HT6-g1-iEG"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="fontStylePopUpButtonAction:" target="-2" id="BRd-D2-ycb"/>
+                                        </connections>
+                                    </popUpButton>
+                                    <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="F3t-vo-m8R">
+                                        <rect key="frame" x="-2" y="118" width="35" height="20"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="20" id="uoY-Ue-5wh"/>
+                                        </constraints>
+                                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Font" id="9zX-1k-kqG">
+                                            <font key="font" metaFont="systemBold" size="14"/>
+                                            <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <comboBox focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Zsv-um-rt4" customClass="KMComboBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="347" y="10" width="96" height="23"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="92" id="ztg-0e-bsM"/>
+                                        </constraints>
+                                        <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="center" completes="NO" numberOfVisibleItems="5" id="ffS-ZL-DII" customClass="KMComboBoxCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <objectValues>
+                                                <string>4 pt</string>
+                                                <string>6 pt</string>
+                                                <string>8 pt</string>
+                                                <string>9 pt</string>
+                                                <string>10 pt</string>
+                                                <string>11 pt</string>
+                                                <string>12 pt</string>
+                                                <string>13 pt</string>
+                                                <string>14 pt</string>
+                                                <string>15 pt</string>
+                                                <string>16 pt</string>
+                                                <string>17 pt</string>
+                                                <string>18 pt</string>
+                                                <string>24 pt</string>
+                                                <string>36 pt</string>
+                                                <string>48 pt</string>
+                                                <string>64 pt</string>
+                                                <string>72 pt</string>
+                                                <string>98 pt</string>
+                                                <string>144 pt</string>
+                                                <string>288 pt</string>
+                                            </objectValues>
+                                        </comboBoxCell>
+                                        <connections>
+                                            <action selector="fontSizeComboBoxAction:" target="-2" id="nol-zz-tkl"/>
+                                        </connections>
+                                    </comboBox>
+                                    <button translatesAutoresizingMaskIntoConstraints="NO" id="OAZ-g4-dUn">
+                                        <rect key="frame" x="427" y="120" width="16" height="16"/>
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="KMImageNameUXIconBtnFontsetNor" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="CH8-BW-DSJ">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="16" id="dVA-6x-6Cd"/>
+                                            <constraint firstAttribute="height" constant="16" id="tOe-4X-eWG"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="buttonClicked_ChangeFont:" target="-2" id="l1T-yJ-bZE"/>
+                                        </connections>
+                                    </button>
+                                    <popUpButton translatesAutoresizingMaskIntoConstraints="NO" id="deY-mX-vB8" customClass="KMPopUpButton" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="42" width="443" height="24"/>
+                                        <popUpButtonCell key="cell" type="bevel" title="Item 1" bezelStyle="regularSquare" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" arrowPosition="noArrow" selectedItem="0tn-2c-zcS" id="eco-oh-wQb" customClass="KMPopUpButtonCell" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="menu"/>
+                                            <menu key="menu" id="8hZ-75-OGy">
+                                                <items>
+                                                    <menuItem title="Item 1" state="on" id="0tn-2c-zcS"/>
+                                                    <menuItem title="Item 2" id="t7B-2L-85J"/>
+                                                    <menuItem title="Item 3" id="fWB-Ha-eAZ"/>
+                                                </items>
+                                            </menu>
+                                        </popUpButtonCell>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="bHC-gk-GkI"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="fontPopUpButtonAction:" target="-2" id="hog-Sk-saI"/>
+                                        </connections>
+                                    </popUpButton>
+                                    <customView placeholderIntrinsicWidth="240" placeholderIntrinsicHeight="26" translatesAutoresizingMaskIntoConstraints="NO" id="I9j-dh-A4F" customClass="KMColorPickerView" customModule="PDF_Reader_Pro" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="76" width="443" height="32"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="32" id="T8E-Zh-jTf"/>
+                                        </constraints>
+                                        <connections>
+                                            <action selector="colorPickerViewAction:" target="-2" id="nFj-sf-KWc"/>
+                                        </connections>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="trailing" secondItem="deY-mX-vB8" secondAttribute="trailing" id="1Ui-0b-4Xb"/>
+                                    <constraint firstItem="OAZ-g4-dUn" firstAttribute="centerY" secondItem="F3t-vo-m8R" secondAttribute="centerY" id="3pf-VS-Ihx"/>
+                                    <constraint firstItem="I9j-dh-A4F" firstAttribute="leading" secondItem="aY5-Ez-sJf" secondAttribute="leading" id="A2x-sN-tgx"/>
+                                    <constraint firstItem="deY-mX-vB8" firstAttribute="top" secondItem="I9j-dh-A4F" secondAttribute="bottom" constant="10" id="Ami-Uq-6uj"/>
+                                    <constraint firstItem="deY-mX-vB8" firstAttribute="leading" secondItem="aY5-Ez-sJf" secondAttribute="leading" constant="5" id="CaB-yp-pWQ"/>
+                                    <constraint firstAttribute="bottom" secondItem="gDa-hs-HAY" secondAttribute="bottom" constant="10" id="Dcg-Tb-w38"/>
+                                    <constraint firstItem="Zsv-um-rt4" firstAttribute="leading" secondItem="gDa-hs-HAY" secondAttribute="trailing" constant="8" id="Kk3-wT-3oQ"/>
+                                    <constraint firstAttribute="trailing" secondItem="OAZ-g4-dUn" secondAttribute="trailing" id="LvX-vY-pqi"/>
+                                    <constraint firstItem="F3t-vo-m8R" firstAttribute="top" secondItem="aY5-Ez-sJf" secondAttribute="top" constant="10" id="N1b-B6-h07"/>
+                                    <constraint firstAttribute="trailing" secondItem="I9j-dh-A4F" secondAttribute="trailing" id="VBQ-kV-WdI"/>
+                                    <constraint firstAttribute="trailing" secondItem="Zsv-um-rt4" secondAttribute="trailing" constant="3" id="Zdi-ur-aoG"/>
+                                    <constraint firstItem="gDa-hs-HAY" firstAttribute="leading" secondItem="aY5-Ez-sJf" secondAttribute="leading" constant="5" id="fxA-g0-bdj"/>
+                                    <constraint firstItem="Zsv-um-rt4" firstAttribute="centerY" secondItem="gDa-hs-HAY" secondAttribute="centerY" id="gaJ-h1-guf"/>
+                                    <constraint firstItem="F3t-vo-m8R" firstAttribute="leading" secondItem="aY5-Ez-sJf" secondAttribute="leading" id="mYg-an-hzF"/>
+                                    <constraint firstItem="I9j-dh-A4F" firstAttribute="top" secondItem="F3t-vo-m8R" secondAttribute="bottom" constant="10" id="o7I-NN-Wpb"/>
+                                    <constraint firstItem="gDa-hs-HAY" firstAttribute="top" secondItem="deY-mX-vB8" secondAttribute="bottom" constant="8" id="ub8-li-2Np"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="yZI-R2-shQ" firstAttribute="leading" secondItem="H8a-Ge-fmm" secondAttribute="leading" constant="16" id="36C-xb-Cn8"/>
+                            <constraint firstItem="yZI-R2-shQ" firstAttribute="top" secondItem="H8a-Ge-fmm" secondAttribute="top" constant="10" id="B3D-F5-0he"/>
+                            <constraint firstItem="aY5-Ez-sJf" firstAttribute="leading" secondItem="yZI-R2-shQ" secondAttribute="leading" id="Gak-oS-PH8"/>
+                            <constraint firstAttribute="bottom" secondItem="aY5-Ez-sJf" secondAttribute="bottom" constant="10" id="KSs-XY-3Ks"/>
+                            <constraint firstItem="aY5-Ez-sJf" firstAttribute="trailing" secondItem="yZI-R2-shQ" secondAttribute="trailing" id="Lgz-dl-Kek"/>
+                            <constraint firstItem="aY5-Ez-sJf" firstAttribute="top" secondItem="yZI-R2-shQ" secondAttribute="bottom" constant="10" id="NVV-h6-hNk"/>
+                            <constraint firstAttribute="trailing" secondItem="yZI-R2-shQ" secondAttribute="trailing" constant="16" id="RM0-FS-apj"/>
+                        </constraints>
+                    </view>
+                </subviews>
+                <constraints>
+                    <constraint firstAttribute="trailing" secondItem="H8a-Ge-fmm" secondAttribute="trailing" id="1P1-pE-c8e"/>
+                    <constraint firstItem="H8a-Ge-fmm" firstAttribute="top" secondItem="BZu-z6-xmB" secondAttribute="top" id="QjS-lZ-EfE"/>
+                    <constraint firstItem="H8a-Ge-fmm" firstAttribute="leading" secondItem="BZu-z6-xmB" secondAttribute="leading" id="kC1-Zs-4IE"/>
+                </constraints>
+            </clipView>
+            <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="XTy-FD-esX">
+                <rect key="frame" x="-100" y="-100" width="303" height="15"/>
+                <autoresizingMask key="autoresizingMask"/>
+            </scroller>
+            <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="keR-tz-hNM">
+                <rect key="frame" x="460" y="0.0" width="15" height="352"/>
+                <autoresizingMask key="autoresizingMask"/>
+            </scroller>
+            <point key="canvasLocation" x="-112.5" y="119"/>
+        </scrollView>
+    </objects>
+    <resources>
+        <image name="KMImageNameUXIconBtnFontsetNor" width="17" height="16"/>
+    </resources>
+</document>

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationGeneralViewController.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMAnnotationGeneralViewController: NSViewController {
+@objcMembers class KMAnnotationGeneralViewController: NSViewController {
     
     var _annotations: [CPDFAnnotation] = []
     var _formMode: CAnnotationType = .radioButton

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationTextWidgetOptionsViewController.swift

@@ -7,7 +7,7 @@
 
 import Cocoa
 
-class KMAnnotationTextWidgetOptionsViewController: NSViewController {
+@objcMembers class KMAnnotationTextWidgetOptionsViewController: NSViewController {
     private var _annotations: [CPDFTextWidgetAnnotation] = []
     private var _formMode: CAnnotationType = .radioButton
     var pdfView: CPDFListView?

+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/KMFormPropertPanelViewController.xib

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="22154" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="22154"/>
+        <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="KMFormPropertPanelViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMFormPropertPanelViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="actionBox" destination="hAo-ej-dYS" id="wOz-2a-wrE"/>
                 <outlet property="actionImageView" destination="b9q-3H-eRH" id="m0d-MQ-9mn"/>
@@ -40,7 +40,7 @@
                                 <rect key="frame" x="0.0" y="0.0" width="220" height="32"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Yul-VA-i9G" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Yul-VA-i9G" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="2" y="2" width="54" height="28"/>
                                         <view key="contentView" id="jkk-fi-7ue">
                                             <rect key="frame" x="0.0" y="0.0" width="54" height="28"/>
@@ -62,7 +62,7 @@
                                             <constraint firstAttribute="width" constant="54" id="slK-fF-bPk"/>
                                         </constraints>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="VfD-1U-FxE" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="VfD-1U-FxE" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="56" y="2" width="54" height="28"/>
                                         <view key="contentView" id="HqJ-Nh-DGi">
                                             <rect key="frame" x="0.0" y="0.0" width="54" height="28"/>
@@ -81,7 +81,7 @@
                                             </constraints>
                                         </view>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="sau-qz-fza" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="sau-qz-fza" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="110" y="2" width="54" height="28"/>
                                         <view key="contentView" id="uds-Di-MGu">
                                             <rect key="frame" x="0.0" y="0.0" width="54" height="28"/>
@@ -100,7 +100,7 @@
                                             </constraints>
                                         </view>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="hAo-ej-dYS" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="hAo-ej-dYS" customClass="KMBox" customModule="PDF_Reader_Pro" customModuleProvider="target">
                                         <rect key="frame" x="164" y="2" width="54" height="28"/>
                                         <view key="contentView" id="2Th-ZA-kl9">
                                             <rect key="frame" x="0.0" y="0.0" width="54" height="28"/>

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

@@ -720,6 +720,12 @@
 		9F56648A2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
 		9F56648B2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
 		9F56648C2988B16F00020985 /* KMTextfieldVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5664862988B16F00020985 /* KMTextfieldVC.xib */; };
+		9F5752E92B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F5752E72B58FF73005DC303 /* KMAnnotationFromViewController.swift */; };
+		9F5752EA2B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F5752E72B58FF73005DC303 /* KMAnnotationFromViewController.swift */; };
+		9F5752EB2B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F5752E72B58FF73005DC303 /* KMAnnotationFromViewController.swift */; };
+		9F5752EC2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5752E82B58FF73005DC303 /* KMAnnotationFromViewController.xib */; };
+		9F5752ED2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5752E82B58FF73005DC303 /* KMAnnotationFromViewController.xib */; };
+		9F5752EE2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F5752E82B58FF73005DC303 /* KMAnnotationFromViewController.xib */; };
 		9F69DBB22B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
 		9F69DBB32B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
 		9F69DBB42B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */; };
@@ -5248,6 +5254,8 @@
 		9F53D5562AD6908600CCF9D8 /* KMAnnotationLinkViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationLinkViewController.swift; sourceTree = "<group>"; };
 		9F5664852988B16F00020985 /* KMTextfieldVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMTextfieldVC.swift; sourceTree = "<group>"; };
 		9F5664862988B16F00020985 /* KMTextfieldVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMTextfieldVC.xib; sourceTree = "<group>"; };
+		9F5752E72B58FF73005DC303 /* KMAnnotationFromViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationFromViewController.swift; sourceTree = "<group>"; };
+		9F5752E82B58FF73005DC303 /* KMAnnotationFromViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationFromViewController.xib; sourceTree = "<group>"; };
 		9F69DBB02B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationTextWidgetOptionsViewController.swift; sourceTree = "<group>"; };
 		9F69DBB12B512614003D4C45 /* KMAnnotationTextWidgetOptionsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAnnotationTextWidgetOptionsViewController.xib; sourceTree = "<group>"; };
 		9F69DBB82B55014F003D4C45 /* KMAnnotationButtonWidgetAppearanceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAnnotationButtonWidgetAppearanceViewController.swift; sourceTree = "<group>"; };
@@ -7905,6 +7913,8 @@
 				9F8810942B56877C00F69815 /* KMAnnotationChoiceWidgetOptionsViewController.xib */,
 				9F88109B2B5762BD00F69815 /* KMAnnotationButtonOptionsViewController.swift */,
 				9F88109C2B5762BD00F69815 /* KMAnnotationButtonOptionsViewController.xib */,
+				9F5752E72B58FF73005DC303 /* KMAnnotationFromViewController.swift */,
+				9F5752E82B58FF73005DC303 /* KMAnnotationFromViewController.xib */,
 			);
 			path = FormProperties;
 			sourceTree = "<group>";
@@ -13111,6 +13121,7 @@
 				9F0CB49229683DEE00007028 /* KMPropertiesPanelLineSubVC.xib in Resources */,
 				BBE9D09B2AF0CEEB002E83CE /* KMBatchOperateCompressViewController.xib in Resources */,
 				BB88108E2B4F7C4100AFA63E /* KMVerificationExpiredViewController.xib in Resources */,
+				9F5752EC2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */,
 				BB4F7E992B0C858D0077EC8C /* KMNoteTypeCollectionViewItem.xib in Resources */,
 				BBF811E42B0717970074874F /* KMExtractImageWindowController.xib in Resources */,
 				AD3AAD1E2B0B5B4400DE5FE7 /* KMCompareCoveringWindowController.xib in Resources */,
@@ -13485,6 +13496,7 @@
 				9F8539FA2947137500DF644E /* newtab_p.pdf in Resources */,
 				BB853C962AF8DCC7009C20C1 /* KMBatchOperateRemovePasswordViewController.xib in Resources */,
 				BB1B0AE42B4FC6E900889528 /* KMOpenFileGuideToolbar.xib in Resources */,
+				9F5752ED2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */,
 				BB04FD112B206F4000D80F7B /* KMPlanViewController.xib in Resources */,
 				BBB376AB2B10A7FD009539CC /* a_3a.png in Resources */,
 				BB90E4EB2AF347A700B04B9F /* PreferenceWindow.xib in Resources */,
@@ -14098,6 +14110,7 @@
 				BB4F7E872B0C4E820077EC8C /* KMNoteFilterCollevtionViewItem.xib in Resources */,
 				BB5BE4F32B060EB500D51BF2 /* KMLanguageViewController.xib in Resources */,
 				BB8810902B4F7C4100AFA63E /* KMVerificationExpiredViewController.xib in Resources */,
+				9F5752EE2B58FF73005DC303 /* KMAnnotationFromViewController.xib in Resources */,
 				AD1CA4052A06040B0070541F /* KMAnnotationScreenCollectionView.xib in Resources */,
 				BB65A0762AF8DE4F003A27A0 /* SyncPreferences.xib in Resources */,
 				BB7F7BFC29AA469F00A3E4E7 /* KMSigntureViewItem.xib in Resources */,
@@ -15107,6 +15120,7 @@
 				BBC8A75C2B05B55200FA9377 /* KMSegmentedControl.swift in Sources */,
 				BB8B173C2907CDD9001C5EA5 /* NibLoadable.swift in Sources */,
 				BB3A669A2B07520800575343 /* KMCustomOutlineView.swift in Sources */,
+				9F5752E92B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */,
 				BBF62C682B033B34007B7E86 /* KMPDFEditExtractWindow.swift in Sources */,
 				BB3A669E2B0752A800575343 /* KMTocOutlineView.swift in Sources */,
 				BB2F9AB32AFCC2F800F9DD93 /* KMProfileInfoWindowController.swift in Sources */,
@@ -15380,6 +15394,7 @@
 				BB8810C52B4F95A900AFA63E /* NSObject+DeviceInfo.m in Sources */,
 				ADE86A9E2B031FDB00414DFA /* KMCompareWindowController.swift in Sources */,
 				BB99ACC3292DE22E0048AFD9 /* KMMergeViewController.swift in Sources */,
+				9F5752EA2B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */,
 				9F8810962B56877C00F69815 /* KMAnnotationChoiceWidgetOptionsViewController.swift in Sources */,
 				9F78EFC728F7E965001E66F4 /* KMHomeViewController+UI.swift in Sources */,
 				9FBA0EFA2900188F001117AF /* KMFastToolCollectionView.swift in Sources */,
@@ -16964,6 +16979,7 @@
 				BB146FCE299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
 				BB10FAF82AFE2C2900F18D65 /* KMNumberArrayFormatter.swift in Sources */,
 				BB3198142AC5142900107371 /* NSMenu+KMExtension.swift in Sources */,
+				9F5752EB2B58FF73005DC303 /* KMAnnotationFromViewController.swift in Sources */,
 				BB89724F294C1DCE0045787C /* KMWatermarkAdjectiveListTableCellView.swift in Sources */,
 				ADD1B6E62946C00800C3FFF7 /* KMPrintChoosePageSizePosterView.swift in Sources */,
 				9F1FE4BC29406E4700E952CA /* NSImage+CTAdditions.m in Sources */,