Browse Source

【综合】Swift文件兼容

TangChao 7 months ago
parent
commit
f06fd281c8
94 changed files with 362 additions and 356 deletions
  1. 12 12
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.swift
  2. 15 15
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/AIChatView.swift
  3. 2 2
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/CollectionViewItems/AIChatTranslateResultItem.swift
  4. 2 2
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.swift
  5. 16 16
      PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AITypeItemChooseView/AITypeItemChooseView.swift
  6. 1 1
      PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.swift
  7. 1 1
      PDF Office/PDF Master/Class/Batch/View/KMCustomViewButton.swift
  8. 1 1
      PDF Office/PDF Master/Class/Batch/View/KMLongerButton.swift
  9. 4 4
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  10. 12 6
      PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift
  11. 1 1
      PDF Office/PDF Master/Class/Common/Category/NSWindow+KMExtension.swift
  12. 2 2
      PDF Office/PDF Master/Class/Common/Control/KMCustomStepperView.swift
  13. 3 3
      PDF Office/PDF Master/Class/Common/Control/KMPageIndicator.swift
  14. 2 2
      PDF Office/PDF Master/Class/Common/Designs/KMDesignStepperView.swift
  15. 15 15
      PDF Office/PDF Master/Class/Common/Tools/KMPageSizeTool.swift
  16. 1 1
      PDF Office/PDF Master/Class/DigtalSignature/CPDFDigtalView/KMPDFDigitalSignViewController.swift
  17. 1 1
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/CDSignatureDrawViewController.swift
  18. 3 3
      PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.swift
  19. 3 3
      PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMConvertGuideView.swift
  20. 3 3
      PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMCustomColorGuideView.swift
  21. 5 5
      PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMOpenFileFunctionView.swift
  22. 2 2
      PDF Office/PDF Master/Class/GuideInfo/Controllers/KMFunctionGuideMultiController.swift
  23. 3 3
      PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuidePanel.swift
  24. 4 4
      PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuideProperty.swift
  25. 2 2
      PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuideToolbar.swift
  26. 1 1
      PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift
  27. 8 8
      PDF Office/PDF Master/Class/GuideInfo/KMGuideInfoWindowController.swift
  28. 1 1
      PDF Office/PDF Master/Class/Home/View/HomeContentView/History/Model/KMHomeHistoryListViewModel.swift
  29. 2 2
      PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift
  30. 2 2
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.swift
  31. 3 3
      PDF Office/PDF Master/Class/Home/WindowController/KMURLToPDFWindowController/KMURLToPDFWindowController.swift
  32. 1 1
      PDF Office/PDF Master/Class/KMFileManager/KMFile/KMFile.swift
  33. 1 1
      PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentComplete/View/KMCompareContentView.swift
  34. 4 4
      PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentSetting/View/KMCompareContentSettingView.swift
  35. 3 3
      PDF Office/PDF Master/Class/PDFTools/Crop/KMPDFCropWindowController.swift
  36. 1 1
      PDF Office/PDF Master/Class/PDFTools/EditPDF/Toolbar/KMEditPDFToolbarItemView.swift
  37. 3 3
      PDF Office/PDF Master/Class/PDFTools/EditPDF/Tools/KMEditPDfHanddler.swift
  38. 2 2
      PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift
  39. 8 8
      PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/View/KMMergeView.swift
  40. 4 4
      PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPDFEditInsertBlankPageWindow.swift
  41. 1 1
      PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift
  42. 2 2
      PDF Office/PDF Master/Class/PDFTools/Print/Presenter/KMPrintPresenter.swift
  43. 2 2
      PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.swift
  44. 1 1
      PDF Office/PDF Master/Class/PDFTools/Print/View/PrintSettingView/ViewModel/KMPrintViewModel.swift
  45. 1 1
      PDF Office/PDF Master/Class/PDFTools/Redact/Controller/KMPDFRedactViewController.swift
  46. 11 11
      PDF Office/PDF Master/Class/PDFTools/Redact/View/KMRedactPDFView.swift
  47. 3 3
      PDF Office/PDF Master/Class/PDFTools/Snapshot/Window/KMSnapshotWindowController.swift
  48. 3 3
      PDF Office/PDF Master/Class/PDFTools/Watermark/Controller/KMBatchOperateAddWatermarkViewController.swift
  49. 1 1
      PDF Office/PDF Master/Class/PDFTools/Watermark/Model/KMWatermarkModel.swift
  50. 5 5
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/PDFListView+KMExtensions.swift
  51. 8 8
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotation+PDFListView.swift
  52. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFButtonWidgetAnnotation+PDFListView.swift
  53. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFCircleAnnotation+PDFListView.swift
  54. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift
  55. 10 10
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFInkAnnotation+PDFListView.swift
  56. 27 27
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift
  57. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLinkAnnotation+PDFListView.swift
  58. 5 5
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFMarkupAnnotation+PDFListView.swift
  59. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFRedactAnnotation+PDFListView.swift
  60. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFSquareAnnotation+PDFListView.swift
  61. 11 11
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFStampAnnotation+PDFListView.swift
  62. 17 17
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFTextAnnotation+PDFListView.swift
  63. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFWidgetAnnotation+PDFListView.swift
  64. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift
  65. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.m
  66. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift
  67. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationView/Views/KMAnnotationOutlineCellView.swift
  68. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMFilterAuthorLabel.swift
  69. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteColorCollectionViewItem.swift
  70. 6 6
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift
  71. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift
  72. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Outline.swift
  73. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift
  74. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/KMBOTAOutlineView.swift
  75. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMPDFThumbnailView.swift
  76. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/View/KMButtonLayer.swift
  77. 10 10
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift
  78. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/View/KMSelfSignAnnotation.swift
  79. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMDrawView.swift
  80. 5 5
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/CreateStamp/View/KMAnnotationStamp.swift
  81. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift
  82. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMPopMenuButtonCell.swift
  83. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarItemView.swift
  84. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarView.swift
  85. 2 2
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarCustomItemView.swift
  86. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarPreviousNextItemView.swift
  87. 3 3
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarZoomItemView.swift
  88. 1 1
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  89. 4 4
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  90. 1 1
      PDF Office/PDF Master/Class/Parsers/Data/KMSyncDot.swift
  91. 2 2
      PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift
  92. 2 2
      PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.swift
  93. 1 1
      PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMTrialSuccessController.swift
  94. 2 2
      PDF Office/PDF Master/Class/Welcome/KMWelcomeWindowController.swift

+ 12 - 12
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/AINewConfigWindowController.swift

@@ -99,7 +99,7 @@ protocol AIConfigWindowDelegate: AnyObject {
     
     func loadAIHeaderView() {
         self.aiHeaderView = AIHeaderView.createFromNib()
-        self.aiHeaderView.frame = CGRectMake(0, CGRectGetHeight(self.contendBox.frame)-58, CGRectGetWidth(self.contendBox.frame), 28)
+        self.aiHeaderView.frame = NSMakeRect(0, NSHeight(self.contendBox.frame)-58, NSWidth(self.contendBox.frame), 28)
         self.aiHeaderView.autoresizingMask = [.minXMargin, .maxXMargin, .width, .minYMargin]
         self.contendBox.addSubview(self.aiHeaderView)
         
@@ -109,7 +109,7 @@ protocol AIConfigWindowDelegate: AnyObject {
         self.aiChatView = AIChatView.createFromNib()
         self.aiChatView.wantsLayer = true
         self.aiChatView.layer?.backgroundColor = NSColor.clear.cgColor
-        self.aiChatView.frame = CGRectMake(0, 300, CGRectGetWidth(self.contendBox.frame), CGRectGetHeight(self.contendBox.frame)-400)
+        self.aiChatView.frame = NSMakeRect(0, 300, NSWidth(self.contendBox.frame), NSHeight(self.contendBox.frame)-400)
         self.aiChatView.autoresizingMask = [.width, .height]
         self.contendBox.addSubview(self.aiChatView)
   
@@ -172,7 +172,7 @@ protocol AIConfigWindowDelegate: AnyObject {
     
     func loadAIInputView() {
         self.aiInfoInputView = AIInfoInputView.createFromNib()
-        self.aiInfoInputView.frame = CGRectMake((CGRectGetWidth(self.contendBox.frame)-248)/2.0, 20, 248, 86)
+        self.aiInfoInputView.frame = NSMakeRect((NSWidth(self.contendBox.frame)-248)/2.0, 20, 248, 86)
         self.aiInfoInputView.autoresizingMask = [.minXMargin, .maxXMargin, .width, .maxYMargin]
         self.contendBox.addSubview(self.aiInfoInputView)
         self.aiInfoInputView.aiConfigType = .none
@@ -261,7 +261,7 @@ protocol AIConfigWindowDelegate: AnyObject {
         self.aiTypeItemView =  AITypeItemChooseView.createFromNib()
         self.aiTypeItemView.wantsLayer = true
         self.aiTypeItemView.layer?.backgroundColor = NSColor.clear.cgColor
-        self.aiTypeItemView.frame = CGRectMake((CGRectGetWidth(self.contendBox.frame)-246)/2, CGRectGetMaxY(self.aiInfoInputView.frame)+13, 246, 52)
+        self.aiTypeItemView.frame = NSMakeRect((NSWidth(self.contendBox.frame)-246)/2, NSMaxY(self.aiInfoInputView.frame)+13, 246, 52)
         self.aiTypeItemView.autoresizingMask = [.minXMargin, .maxXMargin, .width, .maxYMargin]
         self.contendBox.addSubview(self.aiTypeItemView)
         
@@ -332,21 +332,21 @@ protocol AIConfigWindowDelegate: AnyObject {
     }
     
     func refreshViewUI() {
-        self.aiHeaderView.frame = CGRectMake(0, CGRectGetHeight(self.contendBox.frame)-58, CGRectGetWidth(self.contendBox.frame), 28)
+        self.aiHeaderView.frame = NSMakeRect(0, NSHeight(self.contendBox.frame)-58, NSWidth(self.contendBox.frame), 28)
         if self.aiInfoInputView.aiConfigType == .none {
-            self.aiInfoInputView.frame = CGRectMake(13, 17, 240, 86)
+            self.aiInfoInputView.frame = NSMakeRect(13, 17, 240, 86)
         } else if self.aiInfoInputView.aiConfigType == .summarize {
-            self.aiInfoInputView.frame = CGRectMake(13, 17, 240, min(96+self.inputStringHeight, 500))
+            self.aiInfoInputView.frame = NSMakeRect(13, 17, 240, min(96+self.inputStringHeight, 500))
         } else if self.aiInfoInputView.aiConfigType == .reWriting {
-            self.aiInfoInputView.frame = CGRectMake(13, 17, 240, min(72+self.inputStringHeight, 500))
+            self.aiInfoInputView.frame = NSMakeRect(13, 17, 240, min(72+self.inputStringHeight, 500))
         } else if self.aiInfoInputView.aiConfigType == .proofreading {
-            self.aiInfoInputView.frame = CGRectMake(13, 17, 240, min(72+self.inputStringHeight, 500))
+            self.aiInfoInputView.frame = NSMakeRect(13, 17, 240, min(72+self.inputStringHeight, 500))
         } else if self.aiInfoInputView.aiConfigType == .translate {
-            self.aiInfoInputView.frame = CGRectMake(13, 17, 240, min(125+self.inputStringHeight, 500))
+            self.aiInfoInputView.frame = NSMakeRect(13, 17, 240, min(125+self.inputStringHeight, 500))
         }
         
-        self.aiTypeItemView.frame = CGRectMake(13, CGRectGetMaxY(self.aiInfoInputView.frame)+8, 240, self.aiTypeItemView.viewHeight)
-        self.aiChatView.frame = CGRectMake(0, CGRectGetMaxY(self.aiTypeItemView.frame)+8, CGRectGetWidth(self.contendBox.frame), CGRectGetHeight(self.contendBox.frame) - CGRectGetMaxY(self.aiTypeItemView.frame) - 16 - 58)
+        self.aiTypeItemView.frame = NSMakeRect(13, NSMaxY(self.aiInfoInputView.frame)+8, 240, self.aiTypeItemView.viewHeight)
+        self.aiChatView.frame = NSMakeRect(0, NSMaxY(self.aiTypeItemView.frame)+8, NSWidth(self.contendBox.frame), NSHeight(self.contendBox.frame) - NSMaxY(self.aiTypeItemView.frame) - 16 - 58)
         
     }
     

+ 15 - 15
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/AIChatView.swift

@@ -235,12 +235,12 @@ extension AIChatView: NSCollectionViewDelegateFlowLayout {
         }
         let model = AIChatInfoManager.defaultManager.modelsArrM[indexPath.item]
         if model.infoType == .defaultTip {
-            return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 160)
+            return NSSize(width: NSWidth(self.collectionView.frame), height: 160)
         } else if model.infoType == .chatFileUpload {
-            return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 64)
+            return NSSize(width: NSWidth(self.collectionView.frame), height: 64)
         } else if model.infoType == .chatStringUpload {
             let height = self.sizeOfString(model.uploadContent, NSFont.SFProTextRegularFont(14), 216).height
-            return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: height + 24)
+            return NSSize(width: NSWidth(self.collectionView.frame), height: height + 24)
         } else if model.infoType == .chatStringResult {
             if model.aiConfigType == .summarize ||
                 model.aiConfigType == .reWriting ||
@@ -248,41 +248,41 @@ extension AIChatView: NSCollectionViewDelegateFlowLayout {
                 
                 if model.chatInfoState == .stateSuccess {
                     let height = self.sizeOfString(model.chatResult, NSFont.SFProTextRegularFont(14), 216).height
-                    return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 28+48+height)
+                    return NSSize(width: NSWidth(self.collectionView.frame), height: 28+48+height)
                 } else if model.chatInfoState == .stateFailed {
                     let height = self.sizeOfString(model.chatResult, NSFont.SFProTextRegularFont(13), 198).height
-                    return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 28+16+height)
+                    return NSSize(width: NSWidth(self.collectionView.frame), height: 28+16+height)
                 }
-                return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 155+28)
+                return NSSize(width: NSWidth(self.collectionView.frame), height: 155+28)
             }
-            return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 164)
+            return NSSize(width: NSWidth(self.collectionView.frame), height: 164)
         } else if model.infoType == .chatTranslateResult {
             if model.aiConfigType == .translate {
                 if model.chatInfoState == .stateLoading {
-                    return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 155+28)
+                    return NSSize(width: NSWidth(self.collectionView.frame), height: 155+28)
                 } else if model.chatInfoState == .stateInfoConfirm {
                     if model.creditsValid == true {
-                        return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 200)
+                        return NSSize(width: NSWidth(self.collectionView.frame), height: 200)
                     } else {
-                        return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 228)
+                        return NSSize(width: NSWidth(self.collectionView.frame), height: 228)
                     }
                 } else if model.chatInfoState == .stateCancel {
-                    return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 96)
+                    return NSSize(width: NSWidth(self.collectionView.frame), height: 96)
                 } else if model.chatInfoState == .stateFailed {
                     let height = self.sizeOfString(model.chatResult, NSFont.SFProTextRegularFont(13), 198).height
-                    return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 40+28+height)
+                    return NSSize(width: NSWidth(self.collectionView.frame), height: 40+28+height)
                 } else if model.chatInfoState == .stateSuccess {
                     if model.filePath.isEmpty == false {
                         //文件
-                        return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 160)
+                        return NSSize(width: NSWidth(self.collectionView.frame), height: 160)
                     } else {
                         //文字
                         let height = self.sizeOfString(model.chatResult, NSFont.SFProTextRegularFont(13), 216).height
-                        return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 110+height)
+                        return NSSize(width: NSWidth(self.collectionView.frame), height: 110+height)
                     }
                 }
             }
-            return NSSize(width: CGRectGetWidth(self.collectionView.frame), height: 155+28)
+            return NSSize(width: NSWidth(self.collectionView.frame), height: 155+28)
         }
         
         return NSSize(width: 1, height: 1)

+ 2 - 2
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIChatView/CollectionViewItems/AIChatTranslateResultItem.swift

@@ -449,8 +449,8 @@ class AIChatTranslateResultItem: NSCollectionViewItem {
             let timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true) { timer in
                 var rect = self.downloadInView.frame
                 rect.size.width += 1
-                if rect.size.width > CGRectGetWidth(self.downloadProgressView.frame) {
-                    rect.size.width = CGRectGetWidth(self.downloadProgressView.frame)
+                if rect.size.width > NSWidth(self.downloadProgressView.frame) {
+                    rect.size.width = NSWidth(self.downloadProgressView.frame)
                 }
                 self.downloadInView.frame = rect
                 

+ 2 - 2
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AIInfoInputView/AIInfoInputView.swift

@@ -305,7 +305,7 @@ class AIInfoInputView: NSView, NibLoadable, NSTextFieldDelegate, NSTextViewDeleg
                 self.placeholdLabel.isHidden = false
                 self.chooseFileBtnView.isHidden = false
                 self.placeholdLabel.stringValue = NSLocalizedString("Summarize the current file or click choose other files.", comment: "")
-                self.placeholdLabelTopConst.constant = CGRectGetHeight(self.chooseFileBtnView.frame) + 4
+                self.placeholdLabelTopConst.constant = NSHeight(self.chooseFileBtnView.frame) + 4
                 
                 if self.filePath.isEmpty == false {
                     self.fileInfoContendView.isHidden = false
@@ -639,7 +639,7 @@ class AIInfoInputView: NSView, NibLoadable, NSTextFieldDelegate, NSTextViewDeleg
         let attributes: [NSAttributedString.Key: Any] = [
             .font: font
         ]
-        let size = (string as NSString).boundingRect(with: NSSize(width: CGRectGetWidth(self.textScrollView.frame), height: CGFloat(MAXFLOAT)),
+        let size = (string as NSString).boundingRect(with: NSSize(width: NSWidth(self.textScrollView.frame), height: CGFloat(MAXFLOAT)),
                                                      options: .usesLineFragmentOrigin,
                                                      attributes: attributes,
                                                      context: nil).size

+ 16 - 16
PDF Office/PDF Master/Class/AIInfo/AIConfigWindowController/Views/AITypeItemChooseView/AITypeItemChooseView.swift

@@ -176,44 +176,44 @@ class AITypeItemChooseView: NSView, NibLoadable {
         var maxXValue = 0.1
         let btnHegith = 24.0
         let btnXoffset = 2.0
-        var offsetYValue = CGRectGetHeight(self.contendView.frame)-btnHegith
+        var offsetYValue = NSHeight(self.contendView.frame)-btnHegith
         var lineCount = 1
         
-        self.summarizeBtn.frame = CGRectMake(maxXValue, offsetYValue, self.summarizeBtn.frame.size.width + 4, btnHegith)
+        self.summarizeBtn.frame = NSMakeRect(maxXValue, offsetYValue, self.summarizeBtn.frame.size.width + 4, btnHegith)
         self.summarizeBtn.autoresizingMask = [.maxXMargin, .minYMargin]
         
-        maxXValue = CGRectGetMaxX(self.summarizeBtn.frame)
+        maxXValue = NSMaxX(self.summarizeBtn.frame)
         maxXValue += btnXoffset
         
-        if (maxXValue + CGRectGetWidth(reWriteBtn.frame) + btnXoffset) > CGRectGetWidth(self.contendView.frame) {
+        if (maxXValue + NSWidth(reWriteBtn.frame) + btnXoffset) > NSWidth(self.contendView.frame) {
             maxXValue = 0.1
-            offsetYValue = CGRectGetMinY(self.summarizeBtn.frame) - 4 - btnHegith
+            offsetYValue = NSMinY(self.summarizeBtn.frame) - 4 - btnHegith
             lineCount += 1
         }
-        self.reWriteBtn.frame = CGRectMake(maxXValue, offsetYValue, self.reWriteBtn.frame.size.width + 4, btnHegith)
+        self.reWriteBtn.frame = NSMakeRect(maxXValue, offsetYValue, self.reWriteBtn.frame.size.width + 4, btnHegith)
         self.reWriteBtn.autoresizingMask = [.maxXMargin, .minYMargin]
         
-        maxXValue = CGRectGetMaxX(self.reWriteBtn.frame)
+        maxXValue = NSMaxX(self.reWriteBtn.frame)
         maxXValue += btnXoffset
         
-        if (maxXValue + CGRectGetWidth(self.proofreadBtn.frame) + 2) > CGRectGetWidth(self.contendView.frame) {
+        if (maxXValue + NSWidth(self.proofreadBtn.frame) + 2) > NSWidth(self.contendView.frame) {
             maxXValue = 0.1
-            offsetYValue = CGRectGetMinY(self.reWriteBtn.frame) - 4 - btnHegith
+            offsetYValue = NSMinY(self.reWriteBtn.frame) - 4 - btnHegith
             lineCount += 1
         }
         
-        self.proofreadBtn.frame = CGRectMake(maxXValue, offsetYValue, self.proofreadBtn.frame.size.width + 4, btnHegith)
+        self.proofreadBtn.frame = NSMakeRect(maxXValue, offsetYValue, self.proofreadBtn.frame.size.width + 4, btnHegith)
         self.proofreadBtn.autoresizingMask = [.maxXMargin, .minYMargin]
         
-        maxXValue = CGRectGetMaxX(self.proofreadBtn.frame)
+        maxXValue = NSMaxX(self.proofreadBtn.frame)
         maxXValue += 2
         
-        if (maxXValue + CGRectGetWidth(self.translateBtn.frame) + 2) > CGRectGetWidth(self.contendView.frame) {
+        if (maxXValue + NSWidth(self.translateBtn.frame) + 2) > NSWidth(self.contendView.frame) {
             maxXValue = 0.1
-            offsetYValue = CGRectGetMinY(self.proofreadBtn.frame) - 4 - btnHegith
+            offsetYValue = NSMinY(self.proofreadBtn.frame) - 4 - btnHegith
             lineCount += 1
         }
-        self.translateBtn.frame = CGRectMake(maxXValue, offsetYValue, self.translateBtn.frame.size.width + 4, btnHegith)
+        self.translateBtn.frame = NSMakeRect(maxXValue, offsetYValue, self.translateBtn.frame.size.width + 4, btnHegith)
         self.translateBtn.autoresizingMask = [.maxXMargin, .minYMargin]
  
         if lineCount == 1 {
@@ -227,8 +227,8 @@ class AITypeItemChooseView: NSView, NibLoadable {
         }
         
         var rect = self.closeBtn.frame
-        rect.origin.x = CGRectGetWidth(self.contendView.frame) - 15
-        rect.origin.y = CGRectGetMidY(self.translateBtn.frame) - 7.5
+        rect.origin.x = NSWidth(self.contendView.frame) - 15
+        rect.origin.y = NSMidY(self.translateBtn.frame) - 7.5
         self.closeBtn.frame = rect
          
     }

+ 1 - 1
PDF Office/PDF Master/Class/AIInfo/AIPurchaseWindowController/AIPurchaseWindowController.swift

@@ -67,7 +67,7 @@ class AIPurchaseWindowController: NSWindowController, NSWindowDelegate {
         self.termOfButton.title = NSLocalizedString("Terms of Service", comment: "")
         
         self.purchaseBox.wantsLayer = true
-        self.purchaseBox.layer?.cornerRadius = CGRectGetHeight(self.purchaseBox.frame)/2
+        self.purchaseBox.layer?.cornerRadius = NSHeight(self.purchaseBox.frame)/2
         self.purchaseBox.layer?.masksToBounds = true
         
         self.purchaseButton.wantsLayer = true

+ 1 - 1
PDF Office/PDF Master/Class/Batch/View/KMCustomViewButton.swift

@@ -342,7 +342,7 @@ extension KMCustomViewButton {
         sourcesRect.size.height+=20
         self.window?.popover = self.popOver
         self.window?.sourcesRect = sourcesRect
-        self.popOver?.show(relativeTo: CGRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
+        self.popOver?.show(relativeTo: KMRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
     }
     
     private func _addTrackingArea() {

+ 1 - 1
PDF Office/PDF Master/Class/Batch/View/KMLongerButton.swift

@@ -29,7 +29,7 @@ class KMLongerButton: NSButton,KMCustomButtonPopMenuViewControllerDelegate,KMCus
         self.wantsLayer = true
         self.buttonLayer = CALayer()
         self.layer?.addSublayer(self.buttonLayer!)
-        self.buttonLayer?.frame = CGRect(x: 0, y: 0, width: CGRectGetWidth(self.bounds), height: CGRectGetHeight(self.bounds))
+        self.buttonLayer?.frame = CGRect(x: 0, y: 0, width: NSWidth(self.bounds), height: NSHeight(self.bounds))
         self.buttonLayer?.backgroundColor = KMAppearance.KM_000000_Color5DarkChange01().cgColor
         self.buttonLayer?.cornerRadius = 1
         self.buttonLayer?.isHidden = true

+ 4 - 4
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -300,7 +300,7 @@ import Cocoa
     override var rightStripView: NSView! {
         get {
             if self.rightToolbarItemView == nil {
-                self.rightToolbarItemView = NSView.init(frame: CGRectMake(0, 10, 184, 40))
+                self.rightToolbarItemView = NSView.init(frame: NSMakeRect(0, 10, 184, 40))
                 self.rightToolbarItemView.wantsLayer = true
                 
                 if self.rightMessageVC == nil {
@@ -326,8 +326,8 @@ import Cocoa
                     self?.rightToolbarItemView.frame = superRect
                 }
                 var rect = self.rightMessageVC.view.frame;
-                rect.origin.x = CGRectGetWidth(self.rightToolbarItemView.frame) - rect.size.width - 8
-                rect.origin.y = (CGRectGetHeight(self.rightToolbarItemView.frame) - rect.size.height)/2
+                rect.origin.x = NSWidth(self.rightToolbarItemView.frame) - rect.size.width - 8
+                rect.origin.y = (NSHeight(self.rightToolbarItemView.frame) - rect.size.height)/2
                 self.rightMessageVC.view.frame = rect
                 self.rightMessageVC.view.autoresizingMask = [ .maxXMargin]
                 self.rightToolbarItemView.addSubview(self.rightMessageVC.view)
@@ -1585,7 +1585,7 @@ extension KMBrowserWindowController: KMSystemFileMenuProtocol {
         KMPrint("screenShot_Window")
         KMScreenShotHandler.beginScreenShot_SelectWindowCompleteHandler { ima in
             if let image = ima {
-                if CGSizeEqualToSize(image.size, CGSizeZero) == true {
+                if image.size.equalTo(.zero) == true {
            
                 } else {
                     DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {

+ 12 - 6
PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift

@@ -124,7 +124,7 @@ extension NSSharingServicePicker {
         
         let flatPath: NSBezierPath = self.flattened
         let count = flatPath.elementCount
-        var curr = CGPointZero
+        var curr: CGPoint = .zero
         for i in 0 ..< count {
             flatPath.element(at: i, associatedPoints: &curr)
             points.append(NSStringFromPoint(curr))
@@ -222,7 +222,7 @@ private var _currentPointingDeviceType: NSEvent.PointingDeviceType = .unknown
 extension NSScreen {
     class func screen(for point: NSPoint) -> NSScreen? {
         var screen: NSScreen?
-        var distanceSquared: CGFloat = CGFLOAT_MAX
+        var distanceSquared: CGFloat = CGFloat.greatestFiniteMagnitude
         
         for aScreen in NSScreen.screens {
             let frame = aScreen.frame
@@ -286,7 +286,7 @@ func KMAutoSizeLabelFields(_ labelFields: [NSTextField], _ controls: [NSControl]
     
     var _: NSControl?
     var frame: NSRect = .zero
-    var left = CGFLOAT_MAX
+    var left = CGFloat.greatestFiniteMagnitude
     var width = 0.0
     var right = 0.0
     var dw = -NSMaxX(labelFields.last!.frame)
@@ -393,11 +393,11 @@ func KMContextSetAlpha(_ ctx: CGContext?, _ alpha: CGFloat) {
 }
 
 func KMContextMoveToPoint(_ ctx: CGContext?, _ x: CGFloat, _ y: CGFloat) {
-    ctx?.move(to: CGPointMake(x, y))
+    ctx?.move(to: NSMakePoint(x, y))
 }
 
 func KMContextAddLineToPoint(_ ctx: CGContext?, _ x: CGFloat, _ y: CGFloat) {
-    ctx?.addLine(to: CGPointMake(x, y))
+    ctx?.addLine(to: NSMakePoint(x, y))
 }
 
 func KMContextFillRect(_ ctx: CGContext?, _ c: CGRect) {
@@ -487,6 +487,12 @@ func KMPathCreateCopy(_ path: CGPath?) -> CGPath? {
     return path?.copy()
 }
 
+// MARK: - CGRect
+
+func KMRectInset(_ rect: CGRect, _ dx: CGFloat, _ dy: CGFloat) -> CGRect {
+    return rect.insetBy(dx: dx, dy: dx)
+}
+
 // MARK: - Float
 
 extension Float {
@@ -579,7 +585,7 @@ public func KMSafePoint(x: Double, y: Double) -> NSPoint {
 //    point.safe()
 //    return point
 //    return NSPoint(x: x, y: y).safe()
-    var point: NSPoint = CGPointMake(x, y)
+    var point: NSPoint = NSMakePoint(x, y)
     if x.isInfinite || x.isNaN {
         point.x = 0
     }

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

@@ -47,7 +47,7 @@ extension NSWindow {
             need = true
         }
         if (need) {
-            if (CGRectContainsPoint(self.sourcesRect, point) == false) {
+            if (self.sourcesRect.contains(point) == false) {
                 if self.popover != nil {
                     NotificationCenter.default.post(name: Notification.Name("KMPopOverClosedByWindowNotification"), object: self.popover!)
                     self.popover?.close()

+ 2 - 2
PDF Office/PDF Master/Class/Common/Control/KMCustomStepperView.swift

@@ -103,8 +103,8 @@ class KMCustomStepperView: KMHoverView {
         }
     }
     
-    var minValue: Double = CGFLOAT_MIN
-    var maxValue: Double = CGFLOAT_MAX
+    var minValue: Double = CGFloat.leastNormalMagnitude
+    var maxValue: Double = CGFloat.greatestFiniteMagnitude
     var increment: Double = 1
     var autorepeat = true
 //    var valueWraps = false

+ 3 - 3
PDF Office/PDF Master/Class/Common/Control/KMPageIndicator.swift

@@ -34,7 +34,7 @@ protocol KMPageIndicatorDelegate: AnyObject {
             self.needsDisplay = true
         }
     }
-    var pageIndicatorSize: NSSize = CGSizeMake(6, 6) {
+    var pageIndicatorSize: NSSize = NSMakeSize(6, 6) {
         didSet {
             self.needsDisplay = true
         }
@@ -78,7 +78,7 @@ protocol KMPageIndicatorDelegate: AnyObject {
         self._indicatorRects?.removeAll()
         for i in 0 ..< self.numberOfPages {
             let position = NSMakePoint(leftPosition, topPadding)
-            let rect = CGRectMake(position.x, position.y, self.pageIndicatorSize.width, self.pageIndicatorSize.height)
+            let rect = NSMakeRect(position.x, position.y, self.pageIndicatorSize.width, self.pageIndicatorSize.height)
             self._indicatorRects?.append(NSValue(rect: rect))
             
             let path = NSBezierPath(ovalIn: rect)
@@ -104,7 +104,7 @@ protocol KMPageIndicatorDelegate: AnyObject {
         let pointInView = self.convert(eventLocation, from: nil)
         for i in 0 ..< self.numberOfPages {
             if let datas = self._indicatorRects {
-                let rect = CGRectInset(datas[Int(i)].rectValue, -2, -2)
+                let rect = KMRectInset(datas[Int(i)].rectValue, -2, -2)
                 if (NSPointInRect(pointInView, rect)) {
                     self.currentPage = i
                     

+ 2 - 2
PDF Office/PDF Master/Class/Common/Designs/KMDesignStepperView.swift

@@ -21,12 +21,12 @@ class KMDesignStepperView: KMDesignBaseView {
         }
     }
     
-    var minValue: Double = CGFLOAT_MIN {
+    var minValue: Double = CGFloat.leastNormalMagnitude {
         didSet {
             self._stepperView?.minValue = self.minValue
         }
     }
-    var maxValue: Double = CGFLOAT_MAX {
+    var maxValue: Double = CGFloat.greatestFiniteMagnitude {
         didSet {
             self._stepperView?.maxValue = self.maxValue
         }

+ 15 - 15
PDF Office/PDF Master/Class/Common/Tools/KMPageSizeTool.swift

@@ -41,35 +41,35 @@ let KMPaperSizeNameUSLetter: String = NSLocalizedString("US Letter", comment: ""
     }
     
     static func getPaperSize(paperName: String) -> NSSize {
-        var size = CGSizeZero
+        var size: NSSize = .zero
         if (paperName == KMPaperSizeNameA3) {
-            size = CGSizeMake(297, 420)
+            size = NSMakeSize(297, 420)
         } else if (paperName == KMPaperSizeNameA4){
-            size = CGSizeMake(210, 297)
+            size = NSMakeSize(210, 297)
         } else if (paperName == KMPaperSizeNameA5){
-            size = CGSizeMake(148, 210)
+            size = NSMakeSize(148, 210)
         } else if (paperName == KMPaperSizeNameB5){
-            size = CGSizeMake(176, 250)
+            size = NSMakeSize(176, 250)
         } else if (paperName == KMPaperSizeNameEnvelope10){
-            size = CGSizeMake(105, 241)
+            size = NSMakeSize(105, 241)
         } else if (paperName == KMPaperSizeNameEnvelopeChoukei){
-            size = CGSizeMake(120, 235)
+            size = NSMakeSize(120, 235)
         } else if (paperName == KMPaperSizeNameEnvelopeDL){
-            size = CGSizeMake(110, 220)
+            size = NSMakeSize(110, 220)
         } else if (paperName == KMPaperSizeNameJISB5){
-            size = CGSizeMake(182, 257)
+            size = NSMakeSize(182, 257)
         } else if (paperName == KMPaperSizeNameROC16K){
-            size = CGSizeMake(197, 273)
+            size = NSMakeSize(197, 273)
         } else if (paperName == KMPaperSizeNameSuper){
-            size = CGSizeMake(330, 483)
+            size = NSMakeSize(330, 483)
         } else if (paperName == KMPaperSizeNameTabloid){
-            size = CGSizeMake(279, 432)
+            size = NSMakeSize(279, 432)
         } else if (paperName == KMPaperSizeNameTabloidOversize){
-            size = CGSizeMake(305, 457)
+            size = NSMakeSize(305, 457)
         } else if (paperName == KMPaperSizeNameUSLegal){
-            size = CGSizeMake(216, 356)
+            size = NSMakeSize(216, 356)
         } else if (paperName == KMPaperSizeNameUSLetter){
-            size = CGSizeMake(216, 279)
+            size = NSMakeSize(216, 279)
         }
         return size
     }

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

@@ -346,7 +346,7 @@ extension KMPDFDigitalSignViewController: CPDFDigtalViewDelegate {
     func pdfListViewAddAnnotation(_ pdfListView: CPDFDigtalView!, forAdd annotation: CPDFAnnotation!, in pdfPage: CPDFPage!) {
         
         let widget = CPDFSignatureWidgetAnnotation.init(PDFListViewNoteWith: self.pdfView.document)
-        widget.bounds = CGRectMake(-1000, -1000, 545, 178);
+        widget.bounds = NSMakeRect(-1000, -1000, 545, 178);
         annotation.page.addAnnotation(widget)
         
         let configWindowVC = DSignatureConfigWindowController.init(windowNibName: "DSignatureConfigWindowController")

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

@@ -72,7 +72,7 @@ class CDSignatureDrawViewController: NSViewController, CDSDrawViewDelegate {
     }
     
     @IBAction func applyAction(_ sender: NSButton) {
-        var image = NSImage(size: CGSizeZero)
+        var image = NSImage(size: .zero)
         if self.drawView.signatureImage() != nil {
             image = self.drawView.signatureImage()
         }

+ 3 - 3
PDF Office/PDF Master/Class/DigtalSignature/ViewControllers/DSignatureCertifyDetailViewController.swift

@@ -255,15 +255,15 @@ class DSignatureCertifyDetailViewController: NSViewController, NSTextFieldDelega
         self.deleteButton.layer?.borderColor = NSColor(red: 165.0/255.0, green: 167.0/255.0, blue: 179.0/255.0, alpha: 1).cgColor
 
         let creatFileLayer = CALayer()
-        creatFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.createButton.bounds), CGRectGetHeight(self.createButton.bounds));
+        creatFileLayer.frame = NSMakeRect(0, 0, NSWidth(self.createButton.bounds), NSHeight(self.createButton.bounds));
         self.createButton.layer?.addSublayer(creatFileLayer)
         
         let editFileLayer = CALayer()
-        editFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.editButton.bounds), CGRectGetHeight(self.editButton.bounds));
+        editFileLayer.frame = NSMakeRect(0, 0, NSWidth(self.editButton.bounds), NSHeight(self.editButton.bounds));
         self.editButton.layer?.addSublayer(editFileLayer)
         
         let deleteFileLayer = CALayer()
-        deleteFileLayer.frame = CGRectMake(0, 0, CGRectGetWidth(self.deleteButton.bounds), CGRectGetHeight(self.deleteButton.bounds));
+        deleteFileLayer.frame = NSMakeRect(0, 0, NSWidth(self.deleteButton.bounds), NSHeight(self.deleteButton.bounds));
         self.deleteButton.layer?.addSublayer(deleteFileLayer)
         
         self.titleLabel.textColor = NSColor.labelColor

+ 3 - 3
PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMConvertGuideView.swift

@@ -49,11 +49,11 @@ class KMConvertGuideView: NSView, NibLoadable {
         super.awakeFromNib()
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetHeight(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSHeight(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetHeight(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSHeight(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.tipInfoView.wantsLayer = true
@@ -136,7 +136,7 @@ class KMConvertGuideView: NSView, NibLoadable {
     
     func updateViewColor() {
         if self.window != nil {
-            self.circleTopConst.constant = (self.window?.frame.size.height)! - self.circleRect.origin.y - CGRectGetHeight(self.bigCircleView.frame) + 50
+            self.circleTopConst.constant = (self.window?.frame.size.height)! - self.circleRect.origin.y - NSHeight(self.bigCircleView.frame) + 50
         }
         
         if KMAppearance.isDarkMode() {

+ 3 - 3
PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMCustomColorGuideView.swift

@@ -46,11 +46,11 @@ class KMCustomColorGuideView: NSView, NibLoadable {
         
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetHeight(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSHeight(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetHeight(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSHeight(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.tipInfoView.wantsLayer = true
@@ -109,7 +109,7 @@ class KMCustomColorGuideView: NSView, NibLoadable {
     }
     
     func updateViewColor() {
-        self.circleLeftConst.constant = CGRectGetMinX(self.circleRect) - CGRectGetWidth(self.bigCircleView.frame)/2 + CGRectGetWidth(self.circleRect)/2
+        self.circleLeftConst.constant = NSMinX(self.circleRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(self.circleRect)/2
         self.circleBottomConst.constant = self.circleRect.origin.y - 12
         
         if KMAppearance.isDarkMode() {

+ 5 - 5
PDF Office/PDF Master/Class/GuideInfo/Controllers/FunctionGuide/KMOpenFileFunctionView.swift

@@ -47,11 +47,11 @@ class KMOpenFileFunctionView: NSView, NibLoadable {
         super.awakeFromNib()
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetWidth(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSWidth(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetWidth(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSWidth(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.tipInfoView.wantsLayer = true
@@ -98,7 +98,7 @@ class KMOpenFileFunctionView: NSView, NibLoadable {
         
         if self.type == .digitalSignGuide {
             self.circleTopConst.constant = 20
-            self.circleLeftConst.constant = CGRectGetMinX(self.circleRect) - CGRectGetWidth(self.bigCircleView.frame)/2 + CGRectGetWidth(self.circleRect)/2
+            self.circleLeftConst.constant = NSMinX(self.circleRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(self.circleRect)/2
             self.tipImage.image = NSImage(named: "guideDigitalSign")
             self.tipTitleLabel.stringValue = NSLocalizedString("Digital Signature", comment: "")
             self.tipSubTitleLabel.stringValue = NSLocalizedString("Digital signature provides proof of the signer's identity and intent, ensuring a high level of security and authenticity, making you more productive to sign digital documents.", comment: "")
@@ -106,9 +106,9 @@ class KMOpenFileFunctionView: NSView, NibLoadable {
             
         } else if self.type == .pdfCompareGuide {
             if self.window != nil {
-                self.circleTopConst.constant = (self.window?.frame.size.height)! - self.circleRect.origin.y - CGRectGetHeight(self.bigCircleView.frame) + 50
+                self.circleTopConst.constant = (self.window?.frame.size.height)! - self.circleRect.origin.y - NSHeight(self.bigCircleView.frame) + 50
             }
-            self.circleLeftConst.constant = CGRectGetMinX(KMGuideInfoWindowController.currentWC().compareItemRect) - CGRectGetWidth(self.bigCircleView.frame)/2 + CGRectGetWidth(KMGuideInfoWindowController.currentWC().compareItemRect)/2
+            self.circleLeftConst.constant = NSMinX(KMGuideInfoWindowController.currentWC().compareItemRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(KMGuideInfoWindowController.currentWC().compareItemRect)/2
             self.tipImage.image = NSImage(named: "guidePDFCompare")
             self.tipTitleLabel.stringValue = NSLocalizedString("Compare PDFs", comment: "")
             self.tipSubTitleLabel.stringValue = NSLocalizedString("The document compare feature lets you quickly spot differences between two versions of a PDF for a better review process.", comment: "")

+ 2 - 2
PDF Office/PDF Master/Class/GuideInfo/Controllers/KMFunctionGuideMultiController.swift

@@ -59,7 +59,7 @@ class KMFunctionGuideMultiController: NSViewController {
         
         self.titleInfoView.wantsLayer = true
         self.getStartBox.wantsLayer = true
-        self.getStartBox.layer?.cornerRadius = CGRectGetHeight(self.getStartBox.frame)/2
+        self.getStartBox.layer?.cornerRadius = NSHeight(self.getStartBox.frame)/2
         self.getStartBox.layer?.masksToBounds = true
         
         self.titleLabel.stringValue = NSLocalizedString("What‘s New", comment: "")
@@ -117,7 +117,7 @@ class KMFunctionGuideMultiController: NSViewController {
         for i in 0...self.namesArr.count - 1 {
             let dict = self.namesArr[i]
             let nameItem: KMFunctionGuideNameItemView = KMFunctionGuideNameItemView.createFromNib()!
-            nameItem.frame = CGRectMake(0, viewHeight - offsetY - itemHeight, CGRectGetWidth(self.typeNameView.frame), itemHeight)
+            nameItem.frame = NSMakeRect(0, viewHeight - offsetY - itemHeight, NSWidth(self.typeNameView.frame), itemHeight)
             nameItem.infoDict = dict as! NSDictionary
             nameItem.clickHandle = {[weak self] view in
                 self?.currentNameKEY = view.infoDict["key"] as! String

+ 3 - 3
PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuidePanel.swift

@@ -43,11 +43,11 @@ class KMOpenFileGuidePanel: NSView, NibLoadable {
         super.awakeFromNib()
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetWidth(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSWidth(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetWidth(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSWidth(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.infoContendView.wantsLayer = true
@@ -120,7 +120,7 @@ class KMOpenFileGuidePanel: NSView, NibLoadable {
     
     func updateViewColor() {
         
-        self.circleLeftConst.constant = CGRectGetMinX(self.circleRect) - CGRectGetWidth(self.bigCircleView.frame)/2 + CGRectGetWidth(self.circleRect)/2
+        self.circleLeftConst.constant = NSMinX(self.circleRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(self.circleRect)/2
 
         if KMAppearance.isDarkMode() {
             self.infoContendView.layer?.borderColor = NSColor(red: 34/255, green: 122/255, blue: 255/255, alpha: 1).cgColor

+ 4 - 4
PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuideProperty.swift

@@ -46,11 +46,11 @@ class KMOpenFileGuideProperty: NSView, NibLoadable {
         
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetWidth(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSWidth(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetWidth(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSWidth(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.tipInfoView.wantsLayer = true
@@ -138,10 +138,10 @@ class KMOpenFileGuideProperty: NSView, NibLoadable {
     
     func updateViewColor() {
         if self.circleRect.origin.x > 500 {
-            self.circleLeftConst.constant = CGRectGetMinX(self.circleRect) - CGRectGetWidth(self.bigCircleView.frame)/2 + CGRectGetWidth(self.circleRect)/2
+            self.circleLeftConst.constant = NSMinX(self.circleRect) - NSWidth(self.bigCircleView.frame)/2 + NSWidth(self.circleRect)/2
         } else {
             if self.window != nil {
-                self.circleLeftConst.constant = CGRectGetWidth(self.window!.frame) - 50
+                self.circleLeftConst.constant = NSWidth(self.window!.frame) - 50
             }
         }
 

+ 2 - 2
PDF Office/PDF Master/Class/GuideInfo/Controllers/OpenFileGuide/KMOpenFileGuideToolbar.swift

@@ -48,11 +48,11 @@ class KMOpenFileGuideToolbar: NSView, NibLoadable {
         super.awakeFromNib()
         
         self.bigCircleView.wantsLayer = true
-        self.bigCircleView.layer?.cornerRadius = CGRectGetHeight(self.bigCircleView.frame)/2
+        self.bigCircleView.layer?.cornerRadius = NSHeight(self.bigCircleView.frame)/2
         self.bigCircleView.layer?.borderWidth = 3
         
         self.smallCircleView.wantsLayer = true
-        self.smallCircleView.layer?.cornerRadius = CGRectGetHeight(self.smallCircleView.frame)/2
+        self.smallCircleView.layer?.cornerRadius = NSHeight(self.smallCircleView.frame)/2
         self.smallCircleView.layer?.borderWidth = 3
         
         self.tipInfoView.wantsLayer = true

+ 1 - 1
PDF Office/PDF Master/Class/GuideInfo/KMCouponDueWindowController.swift

@@ -44,7 +44,7 @@ class KMCouponDueWindowController: NSWindowController {
         self.buyButton.font = NSFont.SFProTextSemiboldFont(16)
         self.laterInfoLabel.font = NSFont.SFProTextRegularFont(12)
         
-        self.buyBox.cornerRadius = CGRectGetHeight(self.buyBox.frame)/2
+        self.buyBox.cornerRadius = NSHeight(self.buyBox.frame)/2
         self.buyBox.fillColor = NSColor(red: 255/255, green: 158/255, blue: 42/255, alpha: 1)
         self.buyButton.mouseMoveCallback = {[weak self] mouseEntered in
             if mouseEntered {

+ 8 - 8
PDF Office/PDF Master/Class/GuideInfo/KMGuideInfoWindowController.swift

@@ -218,8 +218,8 @@ class KMGuideInfoWindowController: NSWindowController {
                         }
                         callBack(self)
                         if KMGuideInfoWindowController.availableShow(.digitalSignGuide) &&
-                            (CGRectGetWidth(self.window!.frame) > CGRectGetMinX(self.digitalBoxRect) + 260) &&
-                            CGRectGetMinX(self.digitalBoxRect) > 450 {
+                            (NSWidth(self.window!.frame) > NSMinX(self.digitalBoxRect) + 260) &&
+                            NSMinX(self.digitalBoxRect) > 450 {
                             self.type = .digitalSignGuide
                             self.loadGuideInfoView()
                         } else {
@@ -264,8 +264,8 @@ class KMGuideInfoWindowController: NSWindowController {
                         }
                         callBack(self)
                         if KMGuideInfoWindowController.availableShow(.digitalSignGuide) &&
-                            (CGRectGetWidth(self.window!.frame) > CGRectGetMinX(self.digitalBoxRect) + 260) &&
-                            CGRectGetMinX(self.digitalBoxRect) > 450 {
+                            (NSWidth(self.window!.frame) > NSMinX(self.digitalBoxRect) + 260) &&
+                            NSMinX(self.digitalBoxRect) > 450 {
                             self.type = .digitalSignGuide
                             self.loadGuideInfoView()
                         } else {
@@ -318,8 +318,8 @@ class KMGuideInfoWindowController: NSWindowController {
                         }
                         callBack(self)
                         if KMGuideInfoWindowController.availableShow(.digitalSignGuide) &&
-                            (CGRectGetWidth(self.window!.frame) > CGRectGetMinX(self.digitalBoxRect) + 260) &&
-                            CGRectGetMinX(self.digitalBoxRect) > 450 {
+                            (NSWidth(self.window!.frame) > NSMinX(self.digitalBoxRect) + 260) &&
+                            NSMinX(self.digitalBoxRect) > 450 {
                             self.type = .digitalSignGuide
                             self.loadGuideInfoView()
                         } else {
@@ -344,8 +344,8 @@ class KMGuideInfoWindowController: NSWindowController {
                         }
                         callBack(self)
                         if KMGuideInfoWindowController.availableShow(.digitalSignGuide) &&
-                            (CGRectGetWidth(self.window!.frame) > CGRectGetMinX(self.digitalBoxRect) + 260) &&
-                            CGRectGetMinX(self.digitalBoxRect) > 450 {
+                            (NSWidth(self.window!.frame) > NSMinX(self.digitalBoxRect) + 260) &&
+                            NSMinX(self.digitalBoxRect) > 450 {
                             self.type = .digitalSignGuide
                             self.loadGuideInfoView()
                         } else {

+ 1 - 1
PDF Office/PDF Master/Class/Home/View/HomeContentView/History/Model/KMHomeHistoryListViewModel.swift

@@ -77,7 +77,7 @@ class KMHomeHistoryListViewModel: NSObject {
                     string.setString(filePath.path.deletingLastPathComponent)
                 }
     
-                let image: NSImage = NSImage.previewForFile(path: filePath, ofSize: CGSizeMake(136, 214), asIcon: true) ?? NSImage()
+                let image: NSImage = NSImage.previewForFile(path: filePath, ofSize: NSMakeSize(136, 214), asIcon: true) ?? NSImage()
                 
                 attributesOfItem = attrib
                 showPath = string.description

+ 2 - 2
PDF Office/PDF Master/Class/Home/View/HomeContentView/QucikTools/KMQucikToolsView.swift

@@ -209,7 +209,7 @@ extension KMQucikToolsView {
     func nextPage() {
         let currentPage = self.currentPage()
         let pageCount = self.pageCount()
-        var point = CGPointZero
+        var point: NSPoint = .zero
         
         if currentPage < pageCount {
             point = CGPoint(x: Int(self.collectionView.visibleRect.size.width) * currentPage, y: 0)
@@ -225,7 +225,7 @@ extension KMQucikToolsView {
     func previousPage() {
         let currentPage = self.currentPage()
         let pageCount = self.pageCount()
-        var point = CGPointZero
+        var point: NSPoint = .zero
         if currentPage > 1 {
             point = CGPoint(x: Int(self.collectionView.visibleRect.size.width) * (currentPage - 2), y: 0)
         } else {

+ 2 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.swift

@@ -196,8 +196,8 @@ class KMHomeHistoryFileTableviewCell: NSTableCellView {
         item.target = self
         item = menu.addItem(withTitle: NSLocalizedString("Remove from Recents", comment: ""), action: #selector(buttonItemClick_ClosePath(_:)), keyEquivalent: "")
         item.target = self
-//        menu.popUp(positioning: menu.item(at: 0), at: CGPointMake(CGRectGetMaxX(sender.frame)-35, sender.frame.origin.y+10), in: self)
-        menu.popUp(positioning: menu.item(at: 0), at: CGPointMake(CGRectGetMaxX(sender.frame), sender.frame.origin.y), in: self)
+//        menu.popUp(positioning: menu.item(at: 0), at: NSMakePoint(CGRectGetMaxX(sender.frame)-35, sender.frame.origin.y+10), in: self)
+        menu.popUp(positioning: menu.item(at: 0), at: NSMakePoint(NSMaxX(sender.frame), sender.frame.origin.y), in: self)
     }
     
     @IBAction func buttonItemClick_ShowPath(_ sender: Any) {

+ 3 - 3
PDF Office/PDF Master/Class/Home/WindowController/KMURLToPDFWindowController/KMURLToPDFWindowController.swift

@@ -30,7 +30,7 @@ class KMURLToPDFWindowController: NSWindowController, NSTextFieldDelegate {
     var filePath: String?
     var posterMaskView: KMBookletMaskView?
     var gap: CGFloat = 0
-    var pageSize: CGSize = CGSizeMake(298, 420)
+    var pageSize: CGSize = NSMakeSize(298, 420)
     
     var handler: KMURLToPDFWindowControllerComplete?
     var beginWindow: NSWindow?
@@ -84,7 +84,7 @@ class KMURLToPDFWindowController: NSWindowController, NSTextFieldDelegate {
         pageSizeComboBox.selectItem(at: 0)
         pageSizeComboBox.isEditable = false
 
-        pageSize = CGSizeMake(298, 420)
+        pageSize = NSMakeSize(298, 420)
         gap = 0
 
         pagesGapStepper.stringValue = "0"
@@ -248,7 +248,7 @@ class KMURLToPDFWindowController: NSWindowController, NSTextFieldDelegate {
     @IBAction func comboBoxItemClick_PageSize(_ sender: NSComboBox) {
         switch sender.indexOfSelectedItem {
         case 0:
-            pageSize = CGSizeMake(298, 420)
+            pageSize = NSMakeSize(298, 420)
         case 1:
             pageSize = CGSize(width: 4760, height: 6736)
         case 2:

+ 1 - 1
PDF Office/PDF Master/Class/KMFileManager/KMFile/KMFile.swift

@@ -73,7 +73,7 @@ class KMFile: NSObject {
                     string.setString(filePath.deletingLastPathComponent)
                 }
                 
-                let image = NSImage.previewForFile(path: URL(fileURLWithPath: filePath), ofSize: CGSizeMake(136, 214), asIcon: true) ?? NSImage()
+                let image = NSImage.previewForFile(path: URL(fileURLWithPath: filePath), ofSize: NSMakeSize(136, 214), asIcon: true) ?? NSImage()
                 
                 var info = KMFileInfo()
                 info.size = CGFloat(sizeFloat)

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentComplete/View/KMCompareContentView.swift

@@ -122,7 +122,7 @@ class KMCompareContentView: KMBaseXibView, CPDFViewDelegate, KMCompareToolbarDel
         compareDetailView.wantsLayer = true
         compareDetailView.layer?.backgroundColor = NSColor.clear.cgColor
         
-        compareToolbar.frame = CGRectMake(splitAView.frame.width/2 - 160, 20, 320, 40)
+        compareToolbar.frame = NSMakeRect(splitAView.frame.width/2 - 160, 20, 320, 40)
         compareToolbar.autoresizingMask = [.minXMargin, .maxXMargin, .maxYMargin]
         compareToolbar.delegate = self
         compareToolbar.shadow = NSShadow()

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/Compare/ViewController/ContentSetting/View/KMCompareContentSettingView.swift

@@ -50,18 +50,18 @@ class KMCompareContentSettingView: KMBaseXibView {
     
     func loadUI () {
         var rect = self.replaceWell.frame
-        rect.origin.x = CGRectGetMaxX(self.replaceLabel.frame) + 15
-        rect.origin.y = CGRectGetMidY(self.replaceLabel.frame) - 14
+        rect.origin.x = NSMaxX(self.replaceLabel.frame) + 15
+        rect.origin.y = NSMidY(self.replaceLabel.frame) - 14
         self.replaceWell.frame = rect
         
         rect = self.insertWell.frame
         rect.origin.x = self.replaceWell.frame.origin.x
-        rect.origin.y = CGRectGetMidY(self.insertLabel.frame) - 14
+        rect.origin.y = NSMidY(self.insertLabel.frame) - 14
         self.insertWell.frame = rect
         
         rect = self.deleteWell.frame
         rect.origin.x = self.replaceWell.frame.origin.x
-        rect.origin.y = CGRectGetMidY(self.deleteWell.frame) - 14
+        rect.origin.y = NSMidY(self.deleteWell.frame) - 14
         self.deleteWell.frame = rect
 
     }

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Crop/KMPDFCropWindowController.swift

@@ -23,11 +23,11 @@ class KMPDFCropWindowController: NSWindowController, CPDFViewDelegate, NSWindowD
     var pagesString: String = ""
     var pageType: KMPDFSelectPageStringType = .AllPages
     var currentPage: Int = 0
-    var cropRect: CGRect = CGRectZero
-    var defaultCropRect: CGRect = CGRectZero
+    var cropRect: CGRect = NSRect.zero
+    var defaultCropRect: CGRect = NSRect.zero
     var selectPages = NSMutableArray()
     var cropEdgeInsets: NSEdgeInsets = .init(top: 0, left: 0, bottom: 0, right: 0)
-    var drawPageRect: CGRect = CGRectZero
+    var drawPageRect: CGRect = NSRect.zero
     
     @IBOutlet var unitLabel: NSTextField!
     @IBOutlet var unitPopUpButton: NSPopUpButton!

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/EditPDF/Toolbar/KMEditPDFToolbarItemView.swift

@@ -120,7 +120,7 @@ class KMEditPDFToolbarItemView: NSView {
         self.popOver?.contentSize = popViewController.view.frame.size
         
         popViewController.updateWithHelpTip(helpTip: self.popToolTip ?? "")
-        self.popOver?.show(relativeTo: CGRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
+        self.popOver?.show(relativeTo: KMRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
     }
     
     private func _closePop() {

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/EditPDF/Tools/KMEditPDfHanddler.swift

@@ -505,7 +505,7 @@ extension KMEditPDfHanddler {
                 let wframe = NSMakeRect(x, y, winW, 44)
                 winC.window?.setFrame(wframe, display: true)
                 
-                if CGRectContainsRect(winFrame, wframe) == false {
+                if winFrame.contains(wframe) == false {
                     self.hiddenCropComfirmWindow()
                 } else {
                     self.showCropComfirmWindow()
@@ -542,7 +542,7 @@ extension KMEditPDfHanddler {
             let wframe = NSMakeRect(x, y, width, 44)
             win.setFrame(wframe, display: true)
             
-            if CGRectContainsRect(winFrame, wframe) == false {
+            if winFrame.contains(wframe) == false {
                 self.hiddenPopWindow()
             }
         }
@@ -1585,7 +1585,7 @@ extension KMEditPDfHanddler: CPDFViewDelegate {
             return
         }
         var newRect = rect
-        if CGSizeEqualToSize(rect.size, .zero) {
+        if rect.size.equalTo(.zero) {
             newRect = CGRect(x: rect.origin.x, y: rect.origin.y - 12, width: 20, height: 12)
         } else {
             newRect = CGRect(x: rect.origin.x, y: rect.origin.y + rect.size.height - 12, width: rect.size.width, height: 12)

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/KMMergeWindowController.swift

@@ -134,7 +134,7 @@ extension KMMergeWindowController {
 
     }
     
-    func mergeFiles(files: [KMFileAttribute], size: CGSize = CGSizeZero) {
+    func mergeFiles(files: [KMFileAttribute], size: CGSize = .zero) {
         var size = 0.0
         for file in files {
             size = size + file.fileSize
@@ -360,7 +360,7 @@ extension KMMergeWindowController {
             
             for i in 0..<pageCount {
                 let page: KMMergePDFPage = KMMergePDFPage.init()
-                page.setBounds(CGRectMake(0, 0, size.width, size.height), for: .mediaBox)
+                page.setBounds(NSMakeRect(0, 0, size.width, size.height), for: .mediaBox)
                 page.drawingPage = pagesArray[i]
                 self.oldPDFDocument.insert(page, at: i)
             }

+ 8 - 8
PDF Office/PDF Master/Class/PDFTools/Merge/MergeNew/View/KMMergeView.swift

@@ -67,7 +67,7 @@ class KMMergeView: KMBaseXibView {
         }
     }//存在密码文件
     var lockFilesIndex: Int = 0
-    var newPageSize = CGSizeZero
+    var newPageSize: NSSize = .zero
     
     var insertRow: Int = 0
     override func draw(_ dirtyRect: NSRect) {
@@ -161,7 +161,7 @@ extension KMMergeView: NSTableViewDataSource {
     func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
         var cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("KMMergeTableViewCell"), owner: self)
         if cell == nil {
-            cell = KMMergeTableViewCell.init(frame: CGRectZero)
+            cell = KMMergeTableViewCell.init(frame: .zero)
         }
         let myCellView: KMMergeTableViewCell = cell! as! KMMergeTableViewCell
         if row < files.count {
@@ -332,24 +332,24 @@ extension KMMergeView {
         pageSizeHeightTextField.isEnabled = sender.isEqual(customSizeButton)
         pageSizeWidthTextField.isEnabled = sender.isEqual(customSizeButton)
         
-        var size = CGSizeZero
+        var size: NSSize = .zero
         switch sender.tag {
         case 0:
             break
         case 1:
-            size = CGSizeMake(595, 841);
+            size = NSMakeSize(595, 841);
             break;
         case 2:
-            size = CGSizeMake(841, 1190);
+            size = NSMakeSize(841, 1190);
             break;
         case 3:
-            size = CGSizeMake(612, 792);
+            size = NSMakeSize(612, 792);
             break;
         case 4:
-            size = CGSizeMake(612, 1108);
+            size = NSMakeSize(612, 1108);
             break;
         case 5:
-            size = CGSizeMake(595, 841);
+            size = NSMakeSize(595, 841);
             pageSizeWidthTextField.stringValue = size.width.description
             pageSizeHeightTextField.stringValue = size.height.description
             break;

+ 4 - 4
PDF Office/PDF Master/Class/PDFTools/PageEdit/Window/KMPDFEditInsertBlankPageWindow.swift

@@ -139,8 +139,8 @@ class KMPDFEditInsertBlankPageWindow: NSWindowController {
         
         let page = self.pdfDocument?.page(at: UInt(self.currentPage-1)) as? CPDFPage
         let rect = page?.bounds(for: .mediaBox) ?? .zero
-        let width = KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetWidth(rect)/595 * 210))
-        let height = KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetHeight(rect)/842 * 297))
+        let width = KMPageSizeTool.conversion(withUnit: "mm", value: (NSWidth(rect)/595 * 210))
+        let height = KMPageSizeTool.conversion(withUnit: "mm", value: (NSHeight(rect)/842 * 297))
         self.currentSizeButton.title = String(format: "%@(%@ x %@mm)", KMLocalizedString("Current Size", nil),width,height)
     }
     
@@ -239,8 +239,8 @@ class KMPDFEditInsertBlankPageWindow: NSWindowController {
         if(self.currentSizeButton.state == .on) {
             let page = self.pdfDocument?.page(at: UInt(self.currentPage-1)) as? CPDFPage
             let rect = page?.bounds(for: .mediaBox) ?? .zero
-            let w = KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetWidth(rect)/595 * 210))
-            let h = KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetHeight(rect)/842 * 297))
+            let w = KMPageSizeTool.conversion(withUnit: "mm", value: (NSWidth(rect)/595 * 210))
+            let h = KMPageSizeTool.conversion(withUnit: "mm", value: (NSHeight(rect)/842 * 297))
             width = w.stringToCGFloat()
             height = h.stringToCGFloat()
         } else if self.standardButton.state == .on {

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Print/KMPrintWindowController.swift

@@ -288,7 +288,7 @@ extension KMPrintWindowController {
                 
                 let printPresent = KMPrintPresenter()
 //                let filePath = KMPrintPresenter.fetchSaveFilePath("")
-                let paperSize = (document?.page(at: 0)?.bounds(for: .cropBox).size) ?? CGSizeZero
+                let paperSize = (document?.page(at: 0)?.bounds(for: .cropBox).size) ?? .zero
                 let context: CGContext = printPresent.createContext(filePath, paperSize)
                 var pages: [PDFPage] = []
                 for index in inputPageRange.selectPages {

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Print/Presenter/KMPrintPresenter.swift

@@ -465,7 +465,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
                         }
                     } else if (data.page.operation.type == .pamphlet) {
                         let margin = data.page.operation.pamphlet.margin
-                        let tempSize = CGSizeMake((pageSize.width - margin) / 2, pageSize.height)
+                        let tempSize = NSMakeSize((pageSize.width - margin) / 2, pageSize.height)
                         scale = min(tempSize.width / pageSize.width, tempSize.height / pageSize.height)
                     }
 
@@ -521,7 +521,7 @@ extension KMPrintPresenter: KMPrintPresenterDocument {
                     }
                     NSGraphicsContext.restoreGraphicsState()
                     if data.page.operation.poster.isTags {
-                        self.drawLabelText(data: data, point: CGPointMake(CGFloat(i + 1), CGFloat(j + 1)))
+                        self.drawLabelText(data: data, point: NSMakePoint(CGFloat(i + 1), CGFloat(j + 1)))
                     }
 //                        page.setBounds(NSRect(x: 0, y: 0, width: pageRect.size.width, height: pageRect.size.height), for: .cropBox)
                 }

+ 2 - 2
PDF Office/PDF Master/Class/PDFTools/Print/View/Preview/KMPrintPreviewView.swift

@@ -200,8 +200,8 @@ extension KMPrintPreviewView {
             var size = self.previewView.frame.size
             let rect = self.previewView.currentPage?.bounds(for: .cropBox)
             let scale = self.previewView.scaleFactor
-            let offest = CGPointMake((rect?.origin.x)! * scale, (rect?.origin.y)! * scale)
-            size = CGSizeMake(rect!.size.width * scale, rect!.size.height * scale)
+            let offest = NSMakePoint((rect?.origin.x)! * scale, (rect?.origin.y)! * scale)
+            size = NSMakeSize(rect!.size.width * scale, rect!.size.height * scale)
             
             var point = CGPoint(x: 1, y: 1)
             if model.page.operation.poster.type == .tile {

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Print/View/PrintSettingView/ViewModel/KMPrintViewModel.swift

@@ -130,7 +130,7 @@ extension KMPrintViewModel {
     }
     
     //纸张类型
-    func printPaperTypeAction(type: KMPrintPaperInfo.KMPaperType, posterType: KMPrintPageOperation.Poster.PosterType = .tile, customSize: CGSize = CGSizeZero, completion: KMPrintViewModelCompletion) {
+    func printPaperTypeAction(type: KMPrintPaperInfo.KMPaperType, posterType: KMPrintPageOperation.Poster.PosterType = .tile, customSize: CGSize = .zero, completion: KMPrintViewModelCompletion) {
         if type == self.model.paper.info.type {
             completion(false, nil)
             return

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Redact/Controller/KMPDFRedactViewController.swift

@@ -120,7 +120,7 @@ class KMPDFRedactViewController: NSViewController {
         
     //    [self.redactPdfView layoutDocumentView];
 
-        let frame = CGRectMake((self.redactPdfView.frame.size.width-32)/2.0, (self.redactPdfView.frame.size.height-32)/2.0, 32, 32)
+        let frame = NSMakeRect((self.redactPdfView.frame.size.width-32)/2.0, (self.redactPdfView.frame.size.height-32)/2.0, 32, 32)
         self._indicator = NSProgressIndicator(frame: frame)
         self._indicator?.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
         self._indicator?.style = .spinning

+ 11 - 11
PDF Office/PDF Master/Class/PDFTools/Redact/View/KMRedactPDFView.swift

@@ -336,7 +336,7 @@ private let KMPDFViewRedactAnnotationAcross = "KMPDFViewRedactAnnotationAcross"
         var layer: CAShapeLayer?
         
         let boxBounds = page?.bounds ?? .zero
-        let t = CGAffineTransformRotate(CGAffineTransformMakeScale(self.scaleFactor, self.scaleFactor), -Double.pi * 0.5 * (page!.rotation.cgFloat / 90.0))
+        let t = CGAffineTransform(scaleX: self.scaleFactor, y: self.scaleFactor).rotated(by: -Double.pi * 0.5 * (page!.rotation.cgFloat / 90.0))
         layer = CAShapeLayer()
         layer?.bounds = NSRectToCGRect(boxBounds)
         layer?.anchorPoint = .zero
@@ -355,12 +355,12 @@ private let KMPDFViewRedactAnnotationAcross = "KMPDFViewRedactAnnotationAcross"
         // SKRectEdges
         var resizeHandle: CRectEdges = [.minYEdgeMask, .maxXEdgeMask]
         
-        var originalBounds = CGRectMake(point.x, point.y, 0, 0)
+        var originalBounds = NSMakeRect(point.x, point.y, 0, 0)
 
         self.layer?.addSublayer(layer!)
         
         var eventMask: NSEvent.EventTypeMask = [.leftMouseUp, .leftMouseDragged]
-        var rect = CGRectZero
+        var rect = NSRect.zero
         var theEvent = event
         while (true) {
             theEvent = window!.nextEvent(matching: eventMask)!
@@ -371,10 +371,10 @@ private let KMPDFViewRedactAnnotationAcross = "KMPDFViewRedactAnnotationAcross"
                 var quadrilateralPoints = NSMutableArray()
                 let annotation = CPDFRedactAnnotation(document: self.document)
                 var bounds = rect
-                quadrilateralPoints.add(NSValue(point: CGPointMake(CGRectGetMinX(bounds), CGRectGetMaxY(bounds))))
-                quadrilateralPoints.add(NSValue(point: CGPointMake(CGRectGetMaxX(bounds), CGRectGetMaxY(bounds))))
-                quadrilateralPoints.add(NSValue(point: CGPointMake(CGRectGetMinX(bounds), CGRectGetMinY(bounds))))
-                quadrilateralPoints.add(NSValue(point: CGPointMake(CGRectGetMaxX(bounds), CGRectGetMinY(bounds))))
+                quadrilateralPoints.add(NSValue(point: NSMakePoint(NSMinX(bounds), NSMaxY(bounds))))
+                quadrilateralPoints.add(NSValue(point: NSMakePoint(NSMaxX(bounds), NSMaxY(bounds))))
+                quadrilateralPoints.add(NSValue(point: NSMakePoint(NSMinX(bounds), NSMinY(bounds))))
+                quadrilateralPoints.add(NSValue(point: NSMakePoint(NSMaxX(bounds), NSMinY(bounds))))
                 annotation?.setQuadrilateralPoints(quadrilateralPoints as? [Any] ?? [])
                                         
                 annotation?.setModificationDate(Date())
@@ -558,10 +558,10 @@ extension KMRedactPDFView {
                     
                     let pageRect = page?.bounds ?? .zero
                     let annotationRect  = annotation?.bounds ?? .zero
-                    if (CGRectGetMaxX(annotationRect) > CGRectGetMaxX(pageRect) ||
-                        CGRectGetMinX(annotationRect) < CGRectGetMinX(pageRect) ||
-                        CGRectGetMinY(annotationRect) < CGRectGetMinY(pageRect) ||
-                        CGRectGetMaxY(annotationRect) > CGRectGetMaxY(pageRect) ||
+                    if (NSMaxX(annotationRect) > NSMaxX(pageRect) ||
+                        NSMinX(annotationRect) < NSMinX(pageRect) ||
+                        NSMinY(annotationRect) < NSMinY(pageRect) ||
+                        NSMaxY(annotationRect) > NSMaxY(pageRect) ||
                         anno.page == page){
                         continue
                     }

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Snapshot/Window/KMSnapshotWindowController.swift

@@ -301,7 +301,7 @@ class KMSnapshotWindowController: KMBaseWindowController {
     func thumbnailWithSize(_ size: CGFloat) -> NSImage? {
         let clipView = self.pdfView.documentView().contentView
         var bounds = self.pdfView.convert(clipView.bounds, from: clipView)
-         if (CGRectEqualToRect(CGRectZero, bounds) || CGRectIsNull(bounds)) {
+        if (bounds.equalTo(.zero) || bounds.isNull) {
              return nil
          }
         let imageRep = self.pdfView.bitmapImageRepForCachingDisplay(in: bounds)
@@ -329,12 +329,12 @@ class KMSnapshotWindowController: KMBaseWindowController {
              transform?.scaleX(by: (thumbnailSize.width - 2.0 * shadowBlurRadius) / NSWidth(bounds), yBy: (thumbnailSize.height - 2.0 * shadowBlurRadius) / NSHeight(bounds))
          }
          
-         if (CGSizeEqualToSize(CGSizeZero, thumbnailSize)) {
+        if (thumbnailSize.equalTo(.zero)) {
              return nil
          }
          image = NSImage(size: thumbnailSize)
          
-         if (CGSizeEqualToSize(CGSizeZero, image!.size)) {
+        if (image!.size.equalTo(.zero)) {
              return nil
          }
         image?.lockFocus()

+ 3 - 3
PDF Office/PDF Master/Class/PDFTools/Watermark/Controller/KMBatchOperateAddWatermarkViewController.swift

@@ -461,7 +461,7 @@ extension KMBatchOperateAddWatermarkViewController {
         self.collectionView.enclosingScrollView?.drawsBackground = false
       
         self.collectionView.register(KMWatermarkCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMWatermarkCollectionViewItem"))
-        let v = NSView(frame: CGRectMake(0, 0, 100, 100))
+        let v = NSView(frame: NSMakeRect(0, 0, 100, 100))
         v.wantsLayer = true
         v.layer?.backgroundColor = .clear
         
@@ -1006,9 +1006,9 @@ extension KMBatchOperateAddWatermarkViewController: NSCollectionViewDelegate, NS
     
     func collectionView(_ collectionView: NSCollectionView, layout collectionViewLayout: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
         if (collectionView.frame.size.width < 240) {
-            return CGSizeMake(0, 0)
+            return NSMakeSize(0, 0)
         } else {
-            return CGSizeMake(104, 167)
+            return NSMakeSize(104, 167)
         }
     }
     

+ 1 - 1
PDF Office/PDF Master/Class/PDFTools/Watermark/Model/KMWatermarkModel.swift

@@ -391,7 +391,7 @@ import Cocoa
         let t = CGAffineTransform(rotationAngle: radian)
         var newRect = rect
         if !data.isTilePage {
-            newRect = CGRectApplyAffineTransform(CGRect(x: 0, y: 0, width: size.width + 40, height: size.height + 40), t)
+            newRect = CGRect(x: 0, y: 0, width: size.width + 40, height: size.height + 40).applying(t)
         }
         let image = NSImage(size: newRect.size)
         image.lockFocus()

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/AppKitCategories/PDFListView+KMExtensions.swift

@@ -18,7 +18,7 @@ import Foundation
             return ""
         }
         var tString = self
-        var rect = tString.boundingRect(with: CGSizeMake(MAXFLOAT.cgFloat, MAXFLOAT.cgFloat), options: [.truncatesLastVisibleLine,.usesFontLeading,.usesLineFragmentOrigin], attributes: attributes, context: nil)
+        var rect = tString.boundingRect(with: NSMakeSize(MAXFLOAT.cgFloat, MAXFLOAT.cgFloat), options: [.truncatesLastVisibleLine,.usesFontLeading,.usesLineFragmentOrigin], attributes: attributes, context: nil)
         if (rect.size.width > bounds.size.width) {
             repeat {
                 if (tString.length < 1) {
@@ -26,7 +26,7 @@ import Foundation
                 } else {
                     tString = tString.substring(to: tString.length-1) as NSString
                 }
-                rect = tString.boundingRect(with: CGSizeMake(MAXFLOAT.cgFloat, MAXFLOAT.cgFloat), options: [.truncatesLastVisibleLine,.usesFontLeading,.usesLineFragmentOrigin], attributes: attributes, context: nil)
+                rect = tString.boundingRect(with: NSMakeSize(MAXFLOAT.cgFloat, MAXFLOAT.cgFloat), options: [.truncatesLastVisibleLine,.usesFontLeading,.usesLineFragmentOrigin], attributes: attributes, context: nil)
             } while rect.size.width > bounds.size.width
         }
         return tString
@@ -152,7 +152,7 @@ import Foundation
         
         let flatPath = self.flattened
         let count = flatPath.elementCount
-        var curr = CGPointZero
+        var curr: NSPoint = .zero
         for i in 0 ..< count {
             // Since we are using a flattened path, no element will contain more than one point
             flatPath.element(at: i, associatedPoints: &curr)
@@ -207,14 +207,14 @@ import Foundation
 }
 
 func CPDFListViewDrawResizeHandle(_ context: CGContext, _ point: NSPoint, _ radius: CGFloat, _ active: Bool) {
-    let rect = CGRectMake(point.x - radius, point.y - radius, 2 * radius, 2 * radius)
+    let rect = NSMakeRect(point.x - radius, point.y - radius, 2 * radius, 2 * radius)
     let color = active ? NSColor(red: 82.0/255.0, green: 102.0/255.0, blue: 204.0/255.0, alpha: 1) : NSColor.secondarySelectedControlColor.usingColorSpaceName(.calibratedRGB)?.withAlphaComponent(1)
     
     KMContextSetFillColorWithColor(context, color?.cgColor)
     KMContextSetStrokeColorWithColor(context, NSColor.white.cgColor)
     KMContextSetLineWidth(context, 0.25 * radius)
     KMContextFillEllipseInRect(context, rect)
-    KMContextStrokeEllipseInRect(context, CGRectInset(rect, -0.25*radius, -0.25*radius))
+    KMContextStrokeEllipseInRect(context, KMRectInset(rect, -0.25*radius, -0.25*radius))
 }
 
 func CPDFListViewDrawResizeHandles(_ context: CGContext, _ rect: NSRect, _ radius: CGFloat, _ active: Bool) {

+ 8 - 8
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotation+PDFListView.swift

@@ -47,9 +47,9 @@ import Foundation
         if (isHover) {
             let lengths: [CGFloat] = [5.0, 5.0]
             context.setLineDash(phase: 0.0, lengths: lengths)
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         } else {
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         }
         context.restoreGState()
         context.saveGState()
@@ -63,7 +63,7 @@ import Foundation
     func borderRecct(for pdfView: CPDFListView) -> CGRect {
         var rect = pdfView.integralRect(self.bounds, on: self.page)
         let offsetNum = CPDFListViewConfig.defaultManager.annotationBorderOffset
-        rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(rect), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
+        rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(rect), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
         return rect
     }
     
@@ -81,7 +81,7 @@ import Foundation
 
     func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
         let offsetNum = CPDFListViewConfig.defaultManager.annotationBorderOffset
-        let rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
+        let rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
         return self.isResizable() ? CPDFListViewResizeHandleForPointFromRect(point, rect, 8.0 / scaleFactor) : CRectEdges(rawValue: 0)
     }
     
@@ -173,11 +173,11 @@ import Foundation
     func fetchFormMinSizeValueVia() -> NSSize {
         if self.isKind(of: CPDFButtonWidgetAnnotation.self) {
             if (self as! CPDFButtonWidgetAnnotation).controlType() == .pushButtonControl {
-                return CGSizeMake(8.0, 8.0)
+                return NSMakeSize(8.0, 8.0)
             }
-            return CGSizeMake(2, 2)
+            return NSMakeSize(2, 2)
         } else {
-            return CGSizeMake(8.0, 8.0)
+            return NSMakeSize(8.0, 8.0)
         }
     }
 }
@@ -522,7 +522,7 @@ import Foundation
      */
     
     @objc func displayRectForBounds(_ bounds: NSRect, lineWidth: CGFloat) -> NSRect {
-        return NSRectFromCGRect(CGRectInset(NSRectToCGRect(bounds), -5, -5))
+        return NSRectFromCGRect(KMRectInset(NSRectToCGRect(bounds), -5, -5))
     }
     
     @objc func displayRect() -> NSRect {

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFButtonWidgetAnnotation+PDFListView.swift

@@ -59,9 +59,9 @@ import Foundation
         if (isHover) {
             let lengths: [CGFloat] = [5.0, 5.0]
             context.setLineDash(phase: 0.0, lengths: lengths)
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         } else {
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         }
         context.restoreGState()
         context.saveGState()
@@ -77,7 +77,7 @@ import Foundation
     }
     
     override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
-        let rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(self.bounds), 0.0, 0.0))
+        let rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(self.bounds), 0.0, 0.0))
         return self.isResizable() ? CPDFListViewResizeHandleForPointFromRect(point, rect, 8.0 / scaleFactor) : CRectEdges(rawValue: 0)
     }
     

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFCircleAnnotation+PDFListView.swift

@@ -56,7 +56,7 @@ import Foundation
             context?.setStrokeColor(red: red, green: green, blue: blue, alpha: tAlphaMin)
         }
         
-        bounds = CGRectInset(bounds, lineWidth, lineWidth)
+        bounds = KMRectInset(bounds, lineWidth, lineWidth)
         if (annotationModel.style() == .dashed &&
             annotationModel.dashPattern() != nil) {
             let count = annotationModel.dashPattern().count
@@ -75,7 +75,7 @@ import Foundation
         
         if let data = annotationModel.interiorColor(), annotationModel.interiorOpacity() > 0.01 {
             let interiorColor = data.withAlphaComponent(annotationModel.interiorOpacity())
-            bounds = CGRectInset(bounds, lineWidth/2.0, lineWidth/2.0)
+            bounds = KMRectInset(bounds, lineWidth/2.0, lineWidth/2.0)
             context?.setFillColor(interiorColor.cgColor)
             context?.fillEllipse(in: bounds)
         }

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFFreeTextAnnotation+PDFListView.swift

@@ -50,9 +50,9 @@ import Foundation
         if (isHover) {
             let lengths: [CGFloat] = [5.0, 5.0]
             context.setLineDash(phase: 0.0, lengths: lengths)
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         } else {
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         }
         context.restoreGState()
         context.saveGState()
@@ -64,7 +64,7 @@ import Foundation
     
     override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
         let offsetNum = CPDFListViewConfig.defaultManager.annotationBorderOffset
-        let rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
+        let rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
         var rectEdges = CPDFListViewResizeHandleForPointFromRect(point, rect, 8.0 / scaleFactor)
 
         if ((rectEdges.contains(.maxXEdgeMask) && rectEdges.contains(.minYEdgeMask)) ||

+ 10 - 10
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFInkAnnotation+PDFListView.swift

@@ -63,10 +63,10 @@ import Foundation
             var controlPoint: NSPoint = NSZeroPoint
             var point0: NSPoint = NSZeroPoint
             var point1: NSPoint = NSZeroPoint
-            var t: CGFloat = CGFLOAT_MAX
-            var dInv: CGFloat = CGFLOAT_MAX
-            var d0: CGFloat = CGFLOAT_MAX
-            var d1: CGFloat = CGFLOAT_MAX
+            var t: CGFloat = CGFloat.greatestFiniteMagnitude
+            var dInv: CGFloat = CGFloat.greatestFiniteMagnitude
+            var d0: CGFloat = CGFloat.greatestFiniteMagnitude
+            var d1: CGFloat = CGFloat.greatestFiniteMagnitude
             
             elt = path.element(at: count-2, associatedPoints: points)
             point0 = elt == .curveTo ? points[2] : points[0]
@@ -112,7 +112,7 @@ import Foundation
         if (annotationModel.annotationType == .eraser) {
             context?.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
             context?.setLineWidth(1.0)
-            context?.addArc(center: NSPoint(x: CGRectGetMidX(bounds), y: CGRectGetMidY(bounds)) , radius: lineWidth, startAngle: 0, endAngle: Double.pi * 2, clockwise: true)
+            context?.addArc(center: NSPoint(x: NSMidX(bounds), y: NSMidY(bounds)) , radius: lineWidth, startAngle: 0, endAngle: Double.pi * 2, clockwise: true)
             context?.setStrokeColor(NSColor.gray.cgColor)
             context?.setFillColor(NSColor.gray.cgColor)
             context?.fillPath()
@@ -157,10 +157,10 @@ import Foundation
         guard let model = CPDFAnnotationModel(pdfAnnotations: [_anno]) else {
             return nil
         }
-        var minX: CGFloat = CGFLOAT_MAX
-        var minY: CGFloat = CGFLOAT_MAX
-        var maxX: CGFloat = CGFLOAT_MAX
-        var maxY: CGFloat = CGFLOAT_MAX
+        var minX: CGFloat = CGFloat.greatestFiniteMagnitude
+        var minY: CGFloat = CGFloat.greatestFiniteMagnitude
+        var maxX: CGFloat = CGFloat.greatestFiniteMagnitude
+        var maxY: CGFloat = CGFloat.greatestFiniteMagnitude
         
         var count = 0
         for i in 0 ..< _anno.paths.count {
@@ -205,7 +205,7 @@ import Foundation
         let color = model.color()
         let isDashed = model.style() == .dashed
         //绘制
-        let image = NSImage(size: CGSizeMake(maxX - minX, maxY - minY))
+        let image = NSImage(size: NSMakeSize(maxX - minX, maxY - minY))
         image.lockFocus()
         
         let path = NSBezierPath()

+ 27 - 27
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLineAnnotation+PDFListView.swift

@@ -53,7 +53,7 @@ import Foundation
                     context.setLineDash(phase: 0, lengths: length)
                     context.stroke(rect, width: lineWidth)
                 } else {
-                    context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+                    context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
                 }
                 context.restoreGState()
             }
@@ -125,7 +125,7 @@ import Foundation
     }
     
     class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
-        let image = NSImage(size: CGSizeMake(50+annotationModel.lineWidth(), 50+annotationModel.lineWidth()))
+        let image = NSImage(size: NSMakeSize(50+annotationModel.lineWidth(), 50+annotationModel.lineWidth()))
         image.lockFocus()
         NSGraphicsContext.current?.imageInterpolation = .high
         let context = NSGraphicsContext.current?.cgContext
@@ -174,14 +174,14 @@ extension CPDFLineAnnotation {
         var rpoint = point
         switch style {
         case .openArrow:
-            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 3)
+            var points: [CGPoint] = [CGPoint](repeating: .zero, count: 3)
             self._openArrowExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
             context?.beginPath()
             context?.addLines(between: points)
             context?.drawPath(using: .stroke)
             break
         case .closedArrow:
-            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 3)
+            var points: [CGPoint] = [CGPoint](repeating: .zero, count: 3)
             rpoint = self._closedArrowExPoints(&points, point: point, cpoint: cpoint)
             context?.beginPath()
             context?.addLines(between: points)
@@ -189,7 +189,7 @@ extension CPDFLineAnnotation {
             context?.drawPath(using: .fillStroke)
             break
         case .square:
-            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 4)
+            var points: [CGPoint] = [CGPoint](repeating: .zero, count: 4)
             rpoint = self._squareExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
             context?.beginPath()
             context?.addLines(between: points)
@@ -197,7 +197,7 @@ extension CPDFLineAnnotation {
             context?.drawPath(using: .fillStroke)
             break
         case .circle:
-            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 1)
+            var points: [CGPoint] = [CGPoint](repeating: .zero, count: 1)
             rpoint = self._circleExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
             let radius = sqrt((rpoint.x - points[0].x) * (rpoint.x - points[0].x) + (rpoint.y - points[0].y) * (rpoint.y - points[0].y))
             context?.beginPath()
@@ -205,7 +205,7 @@ extension CPDFLineAnnotation {
             context?.closePath()
             context?.drawPath(using: .fillStroke)
         case .diamond:
-            var points: [CGPoint] = [CGPoint](repeating: CGPointZero, count: 4)
+            var points: [CGPoint] = [CGPoint](repeating: .zero, count: 4)
             rpoint = self._diamondExPoints(&points, point: point, cpoint: cpoint, borderWidth: annotationModel.lineWidth())
             context?.beginPath()
             context?.addLines(between: points)
@@ -222,9 +222,9 @@ extension CPDFLineAnnotation {
         let len = 4 + borderWidth
         var dx = 0.0
         var dy = 0.0
-        var point0 = CGPointZero
-        var point1 = CGPointZero
-        var point2 = CGPointZero
+        var point0 = NSPoint.zero
+        var point1 = NSPoint.zero
+        var point2 = NSPoint.zero
         
         let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
         dx = (point.x - cpoint.x) * len / sqrt(mAB)
@@ -251,9 +251,9 @@ extension CPDFLineAnnotation {
         let len = 4.0
         var dx = 0.0
         var dy = 0.0
-        var point0 = CGPointZero
-        var point1 = CGPointZero
-        var point2 = CGPointZero
+        var point0 = NSPoint.zero
+        var point1 = NSPoint.zero
+        var point2 = NSPoint.zero
         
         let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
         dx = (point.x - cpoint.x) * len / sqrt(mAB)
@@ -280,13 +280,13 @@ extension CPDFLineAnnotation {
         let len = max(4, borderWidth)
         var dx = 0.0
         var dy = 0.0
-        var point0 = CGPointZero
-        var point1 = CGPointZero
-        var point2 = CGPointZero
-        var point3 = CGPointZero
-        var point4 = CGPointZero
-        var point5 = CGPointZero
-        var point6 = CGPointZero
+        var point0 = NSPoint.zero
+        var point1 = NSPoint.zero
+        var point2 = NSPoint.zero
+        var point3 = NSPoint.zero
+        var point4 = NSPoint.zero
+        var point5 = NSPoint.zero
+        var point6 = NSPoint.zero
         
         let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
         dx = (point.x - cpoint.x) * len / sqrt(mAB)
@@ -326,8 +326,8 @@ extension CPDFLineAnnotation {
         let len = max(4, borderWidth)
         var dx = 0.0
         var dy = 0.0
-        var point0 = CGPointZero
-        var point1 = CGPointZero
+        var point0 = NSPoint.zero
+        var point1 = NSPoint.zero
         
         let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
         dx = (point.x - cpoint.x) * len / sqrt(mAB)
@@ -346,10 +346,10 @@ extension CPDFLineAnnotation {
         let len = max(4, borderWidth)
         var dx = 0.0
         var dy = 0.0
-        var point0 = CGPointZero
-        var point1 = CGPointZero
-        var point2 = CGPointZero
-        var point3 = CGPointZero
+        var point0 = NSPoint.zero
+        var point1 = NSPoint.zero
+        var point2 = NSPoint.zero
+        var point3 = NSPoint.zero
         
         let mAB = (point.x - cpoint.x) * (point.x - cpoint.x) + (point.y - cpoint.y) * (point.y - cpoint.y)
         dx = (point.x - cpoint.x) * len / sqrt(mAB)
@@ -424,7 +424,7 @@ extension CPDFLineAnnotation {
              case kPDFLineStyleNone:
                  return;
              case kPDFLineStyleSquare:
-                 CGPathAddRect(path, &transform, CGRectMake(-1.5 * lineWidth, -1.5 * lineWidth, 3.0 * lineWidth, 3.0 * lineWidth));
+                 CGPathAddRect(path, &transform, NSMakeRect(-1.5 * lineWidth, -1.5 * lineWidth, 3.0 * lineWidth, 3.0 * lineWidth));
                  break;
              case kPDFLineStyleCircle:
                  CGPathAddEllipseInRect(path, &transform, CGRectMake(-1.5 * lineWidth, -1.5 * lineWidth, 3.0 * lineWidth, 3.0 * lineWidth));

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFLinkAnnotation+PDFListView.swift

@@ -42,9 +42,9 @@ import Foundation
         if (isHover) {
             let lengths: [CGFloat] = [5.0, 2.0]
             context.setLineDash(phase: 0.0, lengths: lengths)
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         } else {
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         }
         context.restoreGState()
         context.saveGState()

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFMarkupAnnotation+PDFListView.swift

@@ -95,13 +95,13 @@ class CPDFAnnotationMarkupExtraIvars: NSObject {
             }
             step += 1
             
-            let rect = CGRectMake(ptlb.x-3*lineWidth, ptlb.y-3*lineWidth, ptrt.x - ptlb.x+6*lineWidth, ptrt.y - ptlb.y+6*lineWidth)
+            let rect = NSMakeRect(ptlb.x-3*lineWidth, ptlb.y-3*lineWidth, ptrt.x - ptlb.x+6*lineWidth, ptrt.y - ptlb.y+6*lineWidth)
             if(isHover) {
                 var length = [CGFloat](repeating: 5, count: 2)
                 KMContextSetLineDash(context, 0, length, 2)
-                KMContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), lineWidth, lineWidth), lineWidth)
+                KMContextStrokeRectWithWidth(context, KMRectInset(NSRectToCGRect(rect), lineWidth, lineWidth), lineWidth)
             } else {
-                KMContextStrokeRect(context, CGRectInset(NSRectToCGRect(rect), lineWidth, lineWidth))
+                KMContextStrokeRect(context, KMRectInset(NSRectToCGRect(rect), lineWidth, lineWidth))
             }
 
         }
@@ -179,7 +179,7 @@ class CPDFAnnotationMarkupExtraIvars: NSObject {
                 }
                 step += 1
                 
-                var rect = CGRectMake(ptlb.x, ptlb.y, ptrt.x - ptlb.x, ptrt.y - ptlb.y)
+                var rect = NSMakeRect(ptlb.x, ptlb.y, ptrt.x - ptlb.x, ptrt.y - ptlb.y)
                 lineRects?.addPointer(&rect)
             }
                     
@@ -244,7 +244,7 @@ class CPDFAnnotationMarkupExtraIvars: NSObject {
                 }
                 step += 1
                 
-                let rect = CGRectMake(ptlb.x, ptlb.y, ptrt.x - ptlb.x, ptrt.y - ptlb.y)
+                let rect = NSMakeRect(ptlb.x, ptlb.y, ptrt.x - ptlb.x, ptrt.y - ptlb.y)
                 var tString = page?.string(for: rect)
                 if (tString != nil && tString!.isEmpty == false) {
                     if(exproString.isEmpty == false) {

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFRedactAnnotation+PDFListView.swift

@@ -57,9 +57,9 @@ import Foundation
         if (isHover) {
             let lengths: [CGFloat] = [5.0, 5.0]
             context.setLineDash(phase: 0.0, lengths: lengths)
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         } else {
-            context.stroke(CGRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
+            context.stroke(KMRectInset(NSRectToCGRect(rect), 0,0), width: lineWidth)
         }
         context.restoreGState()
     }

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

@@ -75,7 +75,7 @@ import Foundation
         
         if let data = annotationModel.interiorColor(), annotationModel.interiorOpacity() > 0.01 {
             let interiorColor = data.withAlphaComponent(annotationModel.interiorOpacity())
-            bounds = CGRectInset(bounds, lineWidth/2.0, lineWidth/2.0)
+            bounds = KMRectInset(bounds, lineWidth/2.0, lineWidth/2.0)
             context?.setFillColor(interiorColor.cgColor)
             context?.fill([bounds])
         }

+ 11 - 11
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFStampAnnotation+PDFListView.swift

@@ -11,7 +11,7 @@ import Foundation
     class func annotationImage(annotationModel: CPDFAnnotationModel) -> NSImage? {
         var image: NSImage?
 //        let bounds = CGRectMake(0, 0, annotationModel.noteWidth(), annotationModel.noteHeight())
-        let bounds = CGRectMake(0, 0, 50, 50)
+        let bounds = NSMakeRect(0, 0, 50, 50)
         image = NSImage(size: bounds.size)
         image?.lockFocus()
         NSGraphicsContext.current?.imageInterpolation = .high
@@ -26,35 +26,35 @@ import Foundation
         color?.usingColorSpaceName(.calibratedRGB)?.getRed(&red, green: &green, blue: &blue, alpha: &alpha)
         let paintColor = NSColor(red: red, green: green, blue: blue, alpha: opacity)
         if (annotationModel.stampAnnotationType() == .signFalse) {
-            context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMinY(bounds) + lineWidth/2))
-            context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMaxY(bounds)-lineWidth/2))
+            context?.move(to: CGPoint(x: NSMinX(bounds) + lineWidth/2, y: NSMinY(bounds) + lineWidth/2))
+            context?.addLine(to: CGPoint(x: NSMaxX(bounds) - lineWidth/2, y: NSMaxY(bounds)-lineWidth/2))
             context?.setLineWidth(lineWidth)
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
-            context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMaxY(bounds) - lineWidth/2))
-            context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMinY(bounds)+lineWidth/2))
+            context?.move(to: CGPoint(x: NSMinX(bounds) + lineWidth/2, y: NSMaxY(bounds) - lineWidth/2))
+            context?.addLine(to: CGPoint(x: NSMaxX(bounds) - lineWidth/2, y: NSMinY(bounds)+lineWidth/2))
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
         } else if (annotationModel.stampAnnotationType() == .signTure) {
-            context?.move(to: CGPoint(x: CGRectGetMinX(bounds) + lineWidth/2, y: CGRectGetMidY(bounds) + lineWidth/2))
-            context?.addLine(to: CGPoint(x: CGRectGetMinX(bounds) + CGRectGetWidth(bounds)/3.0, y: CGRectGetMinY(bounds) + lineWidth/2))
-            context?.addLine(to: CGPoint(x: CGRectGetMaxX(bounds) - lineWidth/2, y: CGRectGetMaxY(bounds) - lineWidth/2))
+            context?.move(to: CGPoint(x: NSMinX(bounds) + lineWidth/2, y: NSMidY(bounds) + lineWidth/2))
+            context?.addLine(to: CGPoint(x: NSMinX(bounds) + NSWidth(bounds)/3.0, y: NSMinY(bounds) + lineWidth/2))
+            context?.addLine(to: CGPoint(x: NSMaxX(bounds) - lineWidth/2, y: NSMaxY(bounds) - lineWidth/2))
             context?.setLineWidth(lineWidth)
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
         } else if (annotationModel.stampAnnotationType() == .signCircle) {
             context?.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1)
-//            context?.addArc(center: CGPoint(x: CGRectGetMidX(bounds)+1, y: CGRectGetMidY(bounds)-1), radius: min(CGRectGetWidth(bounds)/2.0 - lineWidth , CGRectGetHeight(bounds)/2.0 - 1), startAngle: 0, endAngle: Double.pi * 2, clockwise: true)
+//            context?.addArc(center: CGPoint(x: CGRectGetMidX(bounds)+1, y: CGRectGetMidY(bounds)-1), radius: min(NSWidth(bounds)/2.0 - lineWidth , NSHeight(bounds)/2.0 - 1), startAngle: 0, endAngle: Double.pi * 2, clockwise: true)
             context?.addRect(bounds)
             context?.setLineWidth(lineWidth)
             context?.setStrokeColor(paintColor.cgColor)
             context?.setFillColor(paintColor.cgColor)
             context?.strokePath()
         } else if (annotationModel.stampAnnotationType() == .signLine) {
-            let path = NSBezierPath(roundedRect: CGRectMake(CGRectGetMinX(bounds), CGRectGetMidY(bounds) - lineWidth, CGRectGetWidth(bounds), lineWidth), xRadius: lineWidth/2.0, yRadius: lineWidth/2.0)
+            let path = NSBezierPath(roundedRect: NSMakeRect(NSMinX(bounds), NSMidY(bounds) - lineWidth, NSWidth(bounds), lineWidth), xRadius: lineWidth/2.0, yRadius: lineWidth/2.0)
             paintColor.set()
             path.fill()
         } else if (annotationModel.stampAnnotationType() == .signDot) {
@@ -85,7 +85,7 @@ import Foundation
     override func borderRecct(for pdfView: CPDFListView) -> CGRect {
         var rect = pdfView.integralRect(self.bounds, on: self.page)
         //        let offsetNum = 0
-        rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(rect), 0, 0))
+        rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(rect), 0, 0))
         return rect
     }
 }

+ 17 - 17
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFTextAnnotation+PDFListView.swift

@@ -23,7 +23,7 @@ import Foundation
     
     override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
         let offsetNum = CPDFListViewConfig.defaultManager.annotationBorderOffset
-        let rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
+        let rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(self.bounds), CGFloat(-(offsetNum.floatValue)), CGFloat(-(offsetNum.floatValue))))
         return CPDFListViewResizeHandleForPointFromRect(point, rect, 8.0 / scaleFactor)
     }
     
@@ -80,7 +80,7 @@ import Foundation
             // Draw outer boxes.
             let width = 1.0
             let size = 4.0
-            var outerRect1 = CGRectInset(bounds, 0, 0)
+            var outerRect1 = KMRectInset(bounds, 0, 0)
             outerRect1.origin.y += size
             outerRect1.size.height -= size
             var outerRect2 = outerRect1
@@ -88,16 +88,16 @@ import Foundation
             outerRect2.origin.y -= size
             outerRect2.size.width = size
             outerRect2.size.height = size
-
+            
             KMContextSetLineWidth(context, width)
-            KMContextMoveToPoint(context, CGRectGetMinX(outerRect1), CGRectGetMinY(outerRect1))
-            KMContextAddLineToPoint(context, CGRectGetMinX(outerRect1), CGRectGetMaxY(outerRect1))
-            KMContextAddLineToPoint(context, CGRectGetMaxX(outerRect1), CGRectGetMaxY(outerRect1))
-            KMContextAddLineToPoint(context, CGRectGetMaxX(outerRect1), CGRectGetMinY(outerRect1))
-            KMContextAddLineToPoint(context, CGRectGetMaxX(outerRect2), CGRectGetMaxY(outerRect2))
-            KMContextAddLineToPoint(context, CGRectGetMidX(outerRect2), CGRectGetMinY(outerRect2))
-            KMContextAddLineToPoint(context, CGRectGetMinX(outerRect2), CGRectGetMaxY(outerRect2))
-            KMContextAddLineToPoint(context, CGRectGetMinX(outerRect1), CGRectGetMinY(outerRect1))
+            KMContextMoveToPoint(context, NSMinX(outerRect1), NSMinY(outerRect1))
+            KMContextAddLineToPoint(context, NSMinX(outerRect1), NSMaxY(outerRect1))
+            KMContextAddLineToPoint(context, NSMaxX(outerRect1), NSMaxY(outerRect1))
+            KMContextAddLineToPoint(context, NSMaxX(outerRect1), NSMinY(outerRect1))
+            KMContextAddLineToPoint(context, NSMaxX(outerRect2), NSMaxY(outerRect2))
+            KMContextAddLineToPoint(context, NSMidX(outerRect2), NSMinY(outerRect2))
+            KMContextAddLineToPoint(context, NSMinX(outerRect2), NSMaxY(outerRect2))
+            KMContextAddLineToPoint(context, NSMinX(outerRect1), NSMinY(outerRect1))
             KMContextDrawPath(context, .fillStroke)
             
             // Draw inner lines.
@@ -108,11 +108,11 @@ import Foundation
             var lineRect = outerRect1
             lineRect.origin.x += xDelta
             lineRect.size.width -= 2*xDelta
-
+            
             for i in 0 ..< count {
-                let y = CGRectGetMaxY(lineRect) - yDelta * CGFloat((i + 1))
-                KMContextMoveToPoint(context, CGRectGetMinX(lineRect), y)
-                KMContextAddLineToPoint(context, CGRectGetMaxX(lineRect), y)
+                let y = NSMaxY(lineRect) - yDelta * CGFloat((i + 1))
+                KMContextMoveToPoint(context, NSMinX(lineRect), y)
+                KMContextAddLineToPoint(context, NSMaxX(lineRect), y)
                 KMContextStrokePath(context)
             }
             image.unlockFocus()
@@ -131,9 +131,9 @@ import Foundation
         if(isHover) {
             var length: [CGFloat] = [5.0, 5.0]
             KMContextSetLineDash(context, 0, length, 2)
-            KMContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
+            KMContextStrokeRectWithWidth(context, KMRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
         } else {
-            KMContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), 0, 0), lineWidth)
+            KMContextStrokeRectWithWidth(context, KMRectInset(NSRectToCGRect(rect), 0, 0), lineWidth)
         }
         KMContextSetStrokeColorWithColor(context, color)
         KMContextRestoreGState(context)

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFWidgetAnnotation+PDFListView.swift

@@ -9,7 +9,7 @@ import Foundation
 
 @objc extension CPDFWidgetAnnotation {
     override func resizeHandleForPoint(_ point: NSPoint, scaleFactor: CGFloat) -> CRectEdges {
-        let rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(self.bounds),0, 0))
+        let rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(self.bounds),0, 0))
         return self.isResizable() ? CPDFListViewResizeHandleForPointFromRect(point, rect, 8.0 / scaleFactor) : CRectEdges(rawValue: 0)
     }
     
@@ -28,12 +28,12 @@ import Foundation
         KMContextSetStrokeColorWithColor(context, color)
         if(isHover) {
             let offsetNum = CPDFListViewConfig.defaultManager.annotationBorderOffset
-            rect = NSRectFromCGRect(CGRectInset(NSRectToCGRect(rect), -(offsetNum.floatValue).cgFloat, -(offsetNum.floatValue).cgFloat))
+            rect = NSRectFromCGRect(KMRectInset(NSRectToCGRect(rect), -(offsetNum.floatValue).cgFloat, -(offsetNum.floatValue).cgFloat))
             let length: [CGFloat] = [5,5]
             KMContextSetLineDash(context, 0, length, 2)
-            KMContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
+            KMContextStrokeRectWithWidth(context, KMRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
         } else {
-            KMContextStrokeRectWithWidth(context, CGRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
+            KMContextStrokeRectWithWidth(context, KMRectInset(NSRectToCGRect(rect), 0,0), lineWidth)
         }
         KMContextRestoreGState(context)
         KMContextSaveGState(context)

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Stamp/CStampSignatureObject.swift

@@ -371,7 +371,7 @@ let CPDFListStampFolderPath = ApplicationSupportDirectory.stringByAppendingPathC
         let style = NSMutableParagraphStyle()
         style.alignment = .center
         dictionary[.paragraphStyle] = style
-        let size = (string as NSString).boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT), CGFloat(MAXFLOAT)), options: [.truncatesLastVisibleLine, .usesLineFragmentOrigin, .usesFontLeading], attributes: dictionary).size
+        let size = (string as NSString).boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT), CGFloat(MAXFLOAT)), options: [.truncatesLastVisibleLine, .usesLineFragmentOrigin, .usesFontLeading], attributes: dictionary).size
         return size
     }
 }

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/Table/KMTableAnnotation.m

@@ -837,7 +837,7 @@
         
         for (int i=0; i<self.rowNumber; i++) {
             KMTableCellData *cell = [[KMTableCellData alloc] init];
-            cell.backgroundColor = CFBridgingRelease([[[self.rowDataList objectAtIndex:i] objectAtIndex:index] backgroundColor]);
+            cell.backgroundColor = CFBridgingRelease(CFBridgingRetain([[[self.rowDataList objectAtIndex:i] objectAtIndex:index] backgroundColor]));
             [[self.rowDataList objectAtIndex:i] insertObject:cell atIndex:index+1];
         }
         [self afreshDrawLine];
@@ -880,7 +880,7 @@
                 if (lineJoinStyle == NSRoundLineJoinStyle) {
                     cell.backgroundColor = [NSColor colorWithDeviceRed:159.0/255.0 green:198.0/255.0 blue:221.0/255.0 alpha:1];
                 }else{
-                    cell.backgroundColor = CFBridgingRelease([[[self.rowDataList objectAtIndex:i] objectAtIndex:index] backgroundColor]);
+                    cell.backgroundColor = CFBridgingRelease(CFBridgingRetain([[[self.rowDataList objectAtIndex:i] objectAtIndex:index] backgroundColor]));
                 }
                 [[self.rowDataList objectAtIndex:i] insertObject:cell atIndex:index];
             }
@@ -984,7 +984,7 @@
             if (lineJoinStyle == NSBevelLineJoinStyle) {
                 cell.backgroundColor = [NSColor colorWithDeviceRed:159.0/255.0 green:198.0/255.0 blue:221.0/255.0 alpha:1];
             }else{
-                cell.backgroundColor = CFBridgingRelease([[[self.rowDataList objectAtIndex:index] objectAtIndex:i] backgroundColor]);
+                cell.backgroundColor = CFBridgingRelease(CFBridgingRetain([[[self.rowDataList objectAtIndex:index] objectAtIndex:i] backgroundColor]));
             }
             [strings addObject:cell];
         }
@@ -1029,7 +1029,7 @@
                 if (lineJoinStyle == NSRoundLineJoinStyle) {
                     cell.backgroundColor = [NSColor colorWithDeviceRed:159.0/255.0 green:198.0/255.0 blue:221.0/255.0 alpha:1];
                 }else{
-                    cell.backgroundColor = CFBridgingRelease([[[self.rowDataList objectAtIndex:index] objectAtIndex:i] backgroundColor]);
+                    cell.backgroundColor = CFBridgingRelease(CFBridgingRetain([[[self.rowDataList objectAtIndex:index] objectAtIndex:i] backgroundColor]));
                 }
                 [strings addObject:cell];
             }

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift

@@ -163,12 +163,12 @@ class KMNoteOutlineFilterViewController: NSViewController {
         self.cancelButton.title = KMLocalizedString("Cancel", nil)
         self.cancelButton.setTitleColor(KMAppearance.Layout.h0Color())
         self.cancelButton.wantsLayer = true
-        let cwidth = self.cancelButton.title.boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : self.cancelButton.font ?? NSFont.systemFont(ofSize: 12)]).size.width
+        let cwidth = self.cancelButton.title.boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : self.cancelButton.font ?? NSFont.systemFont(ofSize: 12)]).size.width
         self.cancelWidthConst.constant = cwidth + 7 * 2
         self.OKButton.title = KMLocalizedString("Apply", nil)
         self.OKButton.setTitleColor(KMAppearance.Layout.w0Color())
         self.OKButton.wantsLayer = true
-        let owidth = self.OKButton.title.boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : self.OKButton.font ?? NSFont.systemFont(ofSize: 12)]).size.width
+        let owidth = self.OKButton.title.boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : self.OKButton.font ?? NSFont.systemFont(ofSize: 12)]).size.width
         self.applyWidthConst.constant = owidth + 7 * 2
         
         self.cancelButton.layer?.cornerRadius = 1.0
@@ -288,7 +288,7 @@ extension KMNoteOutlineFilterViewController {
     }
     
     private func _widthOfString(_ string: String) -> CGFloat {
-        let size = string.boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : NSFont.systemFont(ofSize: 11)]).size
+        let size = string.boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT), 20), options: .usesLineFragmentOrigin, attributes: [.font : NSFont.systemFont(ofSize: 11)]).size
         return size.width
     }
     

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationView/Views/KMAnnotationOutlineCellView.swift

@@ -29,7 +29,7 @@ class KMAnnotationOutlineCellView: NSTableCellView {
     @IBOutlet weak var noteTextViewHeightConstraint: NSLayoutConstraint!
     
     weak var delegate: KMAnnotationOutlineCellViewDelegate?
-    var maxSize: CGSize = CGSizeZero
+    var maxSize: CGSize = NSSize.zero
     
     var model: KMBOTAAnnotationItem? {
         didSet {

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMFilterAuthorLabel.swift

@@ -25,8 +25,8 @@ class KMFilterAuthorLabel: NSView {
         style.alignment = .center
         style.lineBreakMode = .byCharWrapping
         let dictionary: [NSAttributedString.Key : Any] = [.paragraphStyle : style, .foregroundColor : self.textColor ?? NSColor.white, .font : NSFont.systemFont(ofSize: 13)]
-        let size = self.stringValue?.boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT), CGFloat(MAXFLOAT)), options: [.usesLineFragmentOrigin,.usesFontLeading], attributes: dictionary).size ?? .zero
-        (self.stringValue as? NSString)?.draw(with: CGRectMake((frameRect.size.width-size.width)/2.0, (frameRect.size.height-size.height)/2.0, size.width, size.height), options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: dictionary)
+        let size = self.stringValue?.boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT), CGFloat(MAXFLOAT)), options: [.usesLineFragmentOrigin,.usesFontLeading], attributes: dictionary).size ?? .zero
+        (self.stringValue as? NSString)?.draw(with: NSMakeRect((frameRect.size.width-size.width)/2.0, (frameRect.size.height-size.height)/2.0, size.width, size.height), options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: dictionary)
     }
     
     override func awakeFromNib() {

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteColorCollectionViewItem.swift

@@ -27,7 +27,7 @@ class KMNoteColorCollectionViewItem: NSCollectionViewItem {
         self.colorButton.layer?.borderColor = KMAppearance.Interactive.s0Color().cgColor
         
         self._selectColorLayer = CALayer()
-        self._selectColorLayer?.frame = CGRectMake(0, 0, 24, 24)
+        self._selectColorLayer?.frame = NSMakeRect(0, 0, 24, 24)
         self._selectColorLayer?.borderWidth = 1.0
         self._selectColorLayer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
         self._selectColorLayer?.cornerRadius = 12

+ 6 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTableViewCell.swift

@@ -47,14 +47,14 @@ class KMNoteTableViewCell: NSTableCellView {
                 
                 self.imageViewHeightConstraint.constant = 18.0 + 8
             } else {
-                let labelheight = self._heightForNoteStringValue(self.annotationContentLabel.stringValue, maxW: CGRectGetWidth(self.annotationContentLabel.bounds))
+                let labelheight = self._heightForNoteStringValue(self.annotationContentLabel.stringValue, maxW: NSWidth(self.annotationContentLabel.bounds))
                 self.maltlineLabelLayoutConstraint.constant = labelheight + 18.0
                 
                 self.foldButton.image = NSImage(named: KMImageNameUXIconBtnTriDownNor)
         //        self.annotationContentLabel.lineBreakMode = NSLineBreakByTruncatingTail;
                 
                 self.noteContentBox.isHidden = false
-                let noteLabelHeight = self._heightForNoteStringValue(self.noteContentLabel.stringValue, maxW: CGRectGetWidth(self.noteContentLabel.bounds))
+                let noteLabelHeight = self._heightForNoteStringValue(self.noteContentLabel.stringValue, maxW: NSWidth(self.noteContentLabel.bounds))
                 self.noteContentHeightConstraint.constant = noteLabelHeight
                 
                 self.imageViewHeightConstraint.constant = self.maltlineLabelLayoutConstraint.constant + self.noteContentHeightConstraint.constant + 25
@@ -120,8 +120,8 @@ class KMNoteTableViewCell: NSTableCellView {
     }
     
     func contentViewHidden(_ hidden: Bool) {
-        self.contentViewTopConstraint.constant = hidden ? -(CGRectGetHeight(self.topView.bounds)) : 8.0
-        self.pageLabelTopConstraint.constant = hidden ? -(CGRectGetHeight(self.topView.bounds)) : 4.0
+        self.contentViewTopConstraint.constant = hidden ? -(NSHeight(self.topView.bounds)) : 8.0
+        self.pageLabelTopConstraint.constant = hidden ? -(NSHeight(self.topView.bounds)) : 4.0
     }
     
     @IBAction func foldButtonAction(_ sender: NSButton) {
@@ -179,7 +179,7 @@ extension KMNoteTableViewCell {
     }
     
     private func _heightForNoteStringValue(_ text: String, maxW: CGFloat) -> CGFloat {
-        let maxSize = CGSizeMake(maxW, CGFloat(MAXFLOAT))
+        let maxSize = NSMakeSize(maxW, CGFloat(MAXFLOAT))
 
         let opts: NSString.DrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading]
         let style = NSMutableParagraphStyle()
@@ -219,7 +219,7 @@ extension KMNoteTableViewCell {
         let showPage = model?.showPage ?? true
         if showPage {
             self.pageLabel.stringValue = pageString
-            let labelsize = self.pageLabel.stringValue.boundingRect(with: CGSizeMake(CGFloat(MAXFLOAT),CGRectGetHeight(self.pageLabel.bounds)), options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font : NSFont.systemFont(ofSize: 12)])
+            let labelsize = self.pageLabel.stringValue.boundingRect(with: NSMakeSize(CGFloat(MAXFLOAT),NSHeight(self.pageLabel.bounds)), options: [.usesLineFragmentOrigin, .usesFontLeading], attributes: [.font : NSFont.systemFont(ofSize: 12)])
             self.pageLabelWidthConstraint.constant = labelsize.size.width + 5
             self.pageLabel.isHidden = false
         } else {

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Note.swift

@@ -31,14 +31,14 @@ extension KMLeftSideViewController {
         self.noteMoreButton.action = #selector(leftSideViewMoreButtonAction)
         self.moreButtonLayer = KMButtonLayer()
         self.noteMoreButton.layer?.addSublayer(self.moreButtonLayer!)
-        self.moreButtonLayer?.frame = CGRectMake(0, 0, CGRectGetWidth(self.noteMoreButton.bounds), CGRectGetHeight(self.noteMoreButton.bounds))
+        self.moreButtonLayer?.frame = NSMakeRect(0, 0, NSWidth(self.noteMoreButton.bounds), NSHeight(self.noteMoreButton.bounds))
         
         self.noteFilterButton.target = self
         self.noteFilterButton.action = #selector(noteFilterAction)
         
         self.filterButtonLayer = NSView()
         self.noteFilterButton.addSubview(self.filterButtonLayer!)
-        self.filterButtonLayer?.frame = CGRectMake(14, 2, 8, 8)
+        self.filterButtonLayer?.frame = NSMakeRect(14, 2, 8, 8)
 
         self.noteDoneButton.action = #selector(leftSideViewDoneButtonAction)
         self.noteDoneButton.target = self
@@ -71,7 +71,7 @@ extension KMLeftSideViewController {
                     timeItem?.state = .off
                     pageItem?.state = .on
                 }
-                menu.popUp(positioning: nil, at: CGPointMake(-10, 0), in: self.sortTypeBox)
+                menu.popUp(positioning: nil, at: NSMakePoint(-10, 0), in: self.sortTypeBox)
             }
         }
  
@@ -589,7 +589,7 @@ extension KMLeftSideViewController {
         item.representedObject = filterViewController
         item.view = filterViewController.view
 
-        menu.popUp(positioning: nil, at: CGPointMake(-130, 30), in: button)
+        menu.popUp(positioning: nil, at: NSMakePoint(-130, 30), in: button)
     }
     
     func fetchNote(for index: Int) -> CPDFAnnotation? {

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Outline.swift

@@ -152,7 +152,7 @@ extension KMLeftSideViewController {
 
                 } else {
                     let pageSize = newPage?.bounds(for: .cropBox).size ?? .zero
-                    if let dest = CPDFDestination(page: newPage, at: CGPointMake(pageSize.width, pageSize.height)) {
+                    if let dest = CPDFDestination(page: newPage, at: NSMakePoint(pageSize.width, pageSize.height)) {
                         self.changePDFOutlineDestination(dest, PDFoutline: ol)
                     }
                 }
@@ -266,7 +266,7 @@ extension KMLeftSideViewController {
             let documentViewFrame = self.tocOutlineView.enclosingScrollView?.documentView?.frame ?? .zero
             let width = self.leftSideEmptyVC.outlineSearchView.bounds.size.width
             let height = self.leftSideEmptyVC.outlineSearchView.bounds.size.height
-            self.leftSideEmptyVC.outlineSearchView.frame = CGRectMake((documentViewFrame.size.width - width)/2.0, (documentViewFrame.size.height - height)/2.0, width, height)
+            self.leftSideEmptyVC.outlineSearchView.frame = NSMakeRect((documentViewFrame.size.width - width)/2.0, (documentViewFrame.size.height - height)/2.0, width, height)
             self.tocOutlineView.enclosingScrollView?.documentView?.addSubview(self.leftSideEmptyVC.outlineSearchView)
             self.leftSideEmptyVC.outlineSearchView.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
         } else {
@@ -303,7 +303,7 @@ extension KMLeftSideViewController {
         let num = self.getNum(ol)
         let gap = self.tocOutlineView.indentationPerLevel
         
-        var rowH = ((cell as? NSCell)?.cellSize(forBounds: NSMakeRect(0, 0, w - (num > 0 ? 16 : 0) - gap * num.cgFloat, CGFLOAT_MAX)).height) ?? 0
+        var rowH = ((cell as? NSCell)?.cellSize(forBounds: NSMakeRect(0, 0, w - (num > 0 ? 16 : 0) - gap * num.cgFloat, CGFloat.greatestFiniteMagnitude)).height) ?? 0
         rowH = fmax(rowH, self.tocOutlineView.rowHeight) + 25
 
         let view = self.tocOutlineView.view(atColumn: 0, row: row, makeIfNecessary: true)

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -1068,8 +1068,8 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
                 //获取Page的真实尺寸
                 let page = self.pdfDocument()?.page(at: UInt(row))
                 let rect = page?.bounds(for: .cropBox) ?? .zero
-                let w =  KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetWidth(rect)/595 * 210))
-                let h =  KMPageSizeTool.conversion(withUnit: "mm", value: (CGRectGetHeight(rect)/842 * 297))
+                let w =  KMPageSizeTool.conversion(withUnit: "mm", value: (NSWidth(rect)/595 * 210))
+                let h =  KMPageSizeTool.conversion(withUnit: "mm", value: (NSHeight(rect)/842 * 297))
                 if let data = page?.rotation, data == 90 || data == 270 {
                     cell.sizeLabel.stringValue = String(format: "%.f × %.f %@", h.stringToCGFloat(), w.stringToCGFloat(), KMLocalizedString("mm", nil))
                 } else {
@@ -1157,7 +1157,7 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
             return thumbSize.height
         } else if tableView.isEqual(to: self.snapshotTableView) {
             let scaling = KMDataManager.ud_float(forKey: Self.Key.snapshotSizeScaling)
-            let snapshotSize = (self.snapshots.safe_element(for: row) as? KMSnapshotModel)?.windowC?.thumbnail?.size ?? CGSizeMake(120, 63)
+            let snapshotSize = (self.snapshots.safe_element(for: row) as? KMSnapshotModel)?.windowC?.thumbnail?.size ?? NSMakeSize(120, 63)
             var newScaling = scaling + 0.1
             let newSnapshotHeight = snapshotSize.width * newScaling.cgFloat
             if (newSnapshotHeight > Self.kMinSidePaneWidth) {
@@ -1964,7 +1964,7 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                 ps.alignment = .left
                 let attris = [NSAttributedString.Key.paragraphStyle : ps,
                                   NSAttributedString.Key.font           : NSFont.SFProTextRegularFont(14.0)]
-                let size = string.boundingRect(with: CGSizeMake(outlineView.frame.size.width - 30, 200), options: NSString.DrawingOptions(rawValue: 3), attributes: attris)
+                let size = string.boundingRect(with: NSMakeSize(outlineView.frame.size.width - 30, 200), options: NSString.DrawingOptions(rawValue: 3), attributes: attris)
                 return max(40, size.height + 16)
             }
             return 40

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Outline/OutlineView/KMBOTAOutlineView.swift

@@ -213,7 +213,7 @@ extension KMBOTAOutlineView : NSOutlineViewDataSource,NSOutlineViewDelegate {
             paragraphStyle.alignment = .left
             let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
                               NSAttributedString.Key.font : NSFont.SFProTextRegularFont(14.0)]
-            let size = string.boundingRect(with: CGSizeMake(outlineView.frame.size.width - 30, 200), options: NSString.DrawingOptions(rawValue: 3), attributes: attributes)
+            let size = string.boundingRect(with: NSMakeSize(outlineView.frame.size.width - 30, 200), options: NSString.DrawingOptions(rawValue: 3), attributes: attributes)
             return max(40, size.height + 16)
         }
         return 40

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMPDFThumbnailView.swift

@@ -53,7 +53,7 @@ class KMPDFThumbnailView: KMThumbnailView {
         
         self.markerLineView.wantsLayer = true
         self.markerLineView.layer?.backgroundColor = NSColor.km_init(hex: "#1770F4").cgColor
-        self.markerLineView.frame = CGRectMake(0, 0, 100, 2)
+        self.markerLineView.frame = NSMakeRect(0, 0, 100, 2)
         self.collectionView.addSubview(markerLineView)
         self.hiddenMarkerLineView()
         self.markerLineView.isHidden = true

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/View/KMButtonLayer.swift

@@ -27,7 +27,7 @@ class KMButtonLayer: CALayer {
 
     override func draw(in ctx: CGContext) {
         if (self.layerType == .dot) {
-            KMContextAddEllipseInRect(ctx, CGRectMake(14, 2, 8, 8))
+            KMContextAddEllipseInRect(ctx, NSMakeRect(14, 2, 8, 8))
             KMContextSetRGBFillColor(ctx, 34/255.0, 122/255.0, 255/255.0, 1.0)
             KMContextDrawPath(ctx, .fill);
         } else {

+ 10 - 10
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/KMGeneralAnnotationViewController.swift

@@ -945,7 +945,7 @@ let KMColorPickerViewHeight: CGFloat = 64
         let vc = KMFreeTextStylesViewController()
         vc.annotations = annotations
         vc.annotationModel = self.annotationModel
-        vc.view.frame = CGRect(x: 0, y: 0, width: 280, height: CGRectGetHeight(self.view.window?.frame ?? CGRect.zero) - 300)
+        vc.view.frame = CGRect(x: 0, y: 0, width: 280, height: NSHeight(self.view.window?.frame ?? CGRect.zero) - 300)
         vc.didSelect = { [weak self] data in
             self?.updateAnnotation()
         }
@@ -1114,14 +1114,14 @@ let KMColorPickerViewHeight: CGFloat = 64
     
     func createInkAndLineProperties() {
         if annotationType == .ink {
-            let colorViewHeight = CGRectGetHeight(colorTitleLabel.frame) + KMColorPickerViewHeight + 30
+            let colorViewHeight = NSHeight(colorTitleLabel.frame) + KMColorPickerViewHeight + 30
             colorView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: colorViewHeight)
             textColorBoxConstraint.constant = 10
             borderColorBoxConstraint.constant = 0
             textColorBox.isHidden = true
             lineWidthBox.isHidden = true
 
-            imageBoxLayoutConstraint.constant = CGRectGetHeight(generalImageBoxView.frame)
+            imageBoxLayoutConstraint.constant = NSHeight(generalImageBoxView.frame)
             hiddenSubviews()
             textColorPickerView.noContentString = true
 
@@ -1129,14 +1129,14 @@ let KMColorPickerViewHeight: CGFloat = 64
             textColorPickerView.annotationType = .inkColors
 
         } else if annotationType == .line || annotationType == .arrow {
-            let colorViewHeight = CGRectGetHeight(colorTitleLabel.frame) + KMColorPickerViewHeight * 2 + 40
+            let colorViewHeight = NSHeight(colorTitleLabel.frame) + KMColorPickerViewHeight * 2 + 40
             colorView.frame = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: colorViewHeight)
             textColorBoxConstraint.constant = KMColorPickerViewHeight + 20
             borderColorBoxConstraint.constant = 0
             lineWidthBox.isHidden = true
             textColorPickerViewConstant.constant = 57
 
-            imageBoxLayoutConstraint.constant = CGRectGetHeight(generalImageBoxView.frame)
+            imageBoxLayoutConstraint.constant = NSHeight(generalImageBoxView.frame)
 
             hiddenSubviews()
 
@@ -1367,14 +1367,14 @@ let KMColorPickerViewHeight: CGFloat = 64
     // MARK: SKSquareNote、SKCircleNote、SKArrowNote Properties
     
     func createSquareAndCircleProperties() {
-        let colorViewHeight = CGRectGetHeight(colorTitleLabel.frame) + KMColorPickerViewHeight * 2 + 40
+        let colorViewHeight = NSHeight(colorTitleLabel.frame) + KMColorPickerViewHeight * 2 + 40
         colorView.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: colorViewHeight)
         textColorBoxConstraint.constant = KMColorPickerViewHeight + 20
         borderColorBoxConstraint.constant = 0
         lineWidthBox.isHidden = true
         textColorPickerViewConstant.constant = 57
         
-        imageBoxLayoutConstraint.constant = CGRectGetHeight(generalImageBoxView.frame)
+        imageBoxLayoutConstraint.constant = NSHeight(generalImageBoxView.frame)
         
         hiddenSubviews()
         
@@ -1432,7 +1432,7 @@ let KMColorPickerViewHeight: CGFloat = 64
         textColorBox.isHidden = true
         lineWidthBox.isHidden = true
         
-        imageBoxLayoutConstraint.constant = CGRectGetHeight(textImageBoxView.frame)
+        imageBoxLayoutConstraint.constant = NSHeight(textImageBoxView.frame)
         
         textImageBox.downCallback = { [weak self] downEntered, mouseBox, event in
             if downEntered {
@@ -1569,14 +1569,14 @@ let KMColorPickerViewHeight: CGFloat = 64
     // MARK: SKFreeTextNote、KMSelfSignAnnotationFreeText Properties
     
     func createSelfSignFreeTextProperties() {
-        let colorViewHeight = CGRectGetHeight(colorTitleLabel.frame) + KMColorPickerViewHeight + 30
+        let colorViewHeight = NSHeight(colorTitleLabel.frame) + KMColorPickerViewHeight + 30
         colorView.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: colorViewHeight)
         textColorBoxConstraint.constant = 10
         borderColorBoxConstraint.constant = 0
         textColorBox.isHidden = true
         lineWidthBox.isHidden = true
 
-        imageBoxLayoutConstraint.constant = CGRectGetHeight(generalImageBoxView.frame)
+        imageBoxLayoutConstraint.constant = NSHeight(generalImageBoxView.frame)
         hiddenSubviews()
 
         fontViewTopConstant.constant = colorView.frame.size.height + opacityView.frame.size.height - 10 + 10

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

@@ -139,7 +139,7 @@ import Quartz
         }  else if self.annotationType == .signDot {
             context.setStrokeColor(red: 0, green: 0, blue: 0, alpha: 1.0)
             context.setLineWidth(1.0)
-            context.addArc(center: CGPointMake(self.bounds.midX, self.bounds.midY), radius: min(self.bounds.width / 2.0 - 1, self.bounds.height / 2.0 - 1), startAngle: 0, endAngle: .pi * 2, clockwise: true)
+            context.addArc(center: NSMakePoint(self.bounds.midX, self.bounds.midY), radius: min(self.bounds.width / 2.0 - 1, self.bounds.height / 2.0 - 1), startAngle: 0, endAngle: .pi * 2, clockwise: true)
             context.setStrokeColor(pathColor.cgColor)
             context.setFillColor(pathColor.cgColor)
             context.fillPath()

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMDrawView.swift

@@ -198,7 +198,7 @@ private var _points: [CGPoint] = [CGPoint](repeating: .zero, count: 5)
             originY = (rect.size.height - height) / 2.0
         }
         
-        let rect = CGRectMake(originX, originY, width, height)
+        let rect = NSMakeRect(originX, originY, width, height)
         
         return rect
     }

+ 5 - 5
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/CreateStamp/View/KMAnnotationStamp.swift

@@ -409,7 +409,7 @@ let StampStringEdgeSizeScale = 0.1
             .RightStampRedColor == self.stampColor ||
             .RightStampBlueColor == self.stampColor ||
             .RightStampGreenColor == self.stampColor {
-            stringSize = str.boundingRect(with: CGSizeMake(borderSize.width - borderSize.height * 0.382, borderSize.height), options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
+            stringSize = str.boundingRect(with: NSMakeSize(borderSize.width - borderSize.height * 0.382, borderSize.height), options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
         } else {
             stringSize = str.boundingRect(with: borderSize, options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
         }
@@ -445,7 +445,7 @@ let StampStringEdgeSizeScale = 0.1
                 .RightStampRedColor == self.stampColor ||
                 .RightStampBlueColor == self.stampColor ||
                 .RightStampGreenColor == self.stampColor {
-                dateStringSize = dateString.boundingRect(with: CGSizeMake(borderSize.width - borderSize.height * 0.618, borderSize.height), options: .usesLineFragmentOrigin, attributes: dateDictionary).size
+                dateStringSize = dateString.boundingRect(with: NSMakeSize(borderSize.width - borderSize.height * 0.618, borderSize.height), options: .usesLineFragmentOrigin, attributes: dateDictionary).size
             } else {
                 dateStringSize = self.dateString.boundingRect(with: borderSize,
                                                               options: .usesLineFragmentOrigin,
@@ -819,7 +819,7 @@ let StampStringEdgeSizeScale = 0.1
             style.alignment = .center
             dictionary[NSAttributedString.Key.paragraphStyle] = style
             let str: NSString = self.contentStr.uppercased() as NSString
-            let size = str.boundingRect(with: self.borderBounds?.size ?? CGSizeZero, options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
+            let size = str.boundingRect(with: self.borderBounds?.size ?? .zero, options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
             var rect: NSRect?
             if self.customStampType == .Witness || self.customStampType == .Signhere || self.customStampType == .Initialhere {
                 rect = NSMakeRect(self.borderBounds?.origin.x ?? 0 + (self.borderBounds?.size.width ?? 0)*0.18,  self.borderBounds?.origin.y ?? 0 + (self.borderBounds?.size.height ?? 0 - size.height)/2.0,  self.borderBounds?.size.width ?? 0 - (self.borderBounds?.size.width ?? 0) * 0.18, size.height)
@@ -863,7 +863,7 @@ let StampStringEdgeSizeScale = 0.1
                 .RightStampRedColor == self.stampColor ||
                 .RightStampBlueColor == self.stampColor ||
                 .RightStampGreenColor == self.stampColor {
-                stringSize = str.boundingRect(with: CGSizeMake(borderSize.width - borderSize.height * 0.383, borderSize.height), options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
+                stringSize = str.boundingRect(with: NSMakeSize(borderSize.width - borderSize.height * 0.383, borderSize.height), options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
             } else {
                 stringSize = str.boundingRect(with: borderSize, options: .usesLineFragmentOrigin, attributes: (dictionary as! [NSAttributedString.Key : Any])).size
             }
@@ -900,7 +900,7 @@ let StampStringEdgeSizeScale = 0.1
                     .RightStampRedColor == self.stampColor ||
                     .RightStampBlueColor == self.stampColor ||
                     .RightStampGreenColor == self.stampColor {
-                    dateStringSize = str.boundingRect(with: CGSizeMake(borderSize.width - borderSize.height * 0.618, borderSize.height), options: .usesLineFragmentOrigin, attributes: dateDictionary).size
+                    dateStringSize = str.boundingRect(with: NSMakeSize(borderSize.width - borderSize.height * 0.618, borderSize.height), options: .usesLineFragmentOrigin, attributes: dateDictionary).size
                 } else {
                     dateStringSize = self.dateString.boundingRect(with: borderSize,
                                                                   options: .usesLineFragmentOrigin,

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/StampList/KMAnnotationStampViewController.swift

@@ -1043,7 +1043,7 @@ let KMPDFDynamicStampNeedAuthorKey1 = "km_pdfview_dynamic_stamp_need_author"
                     if filePath.pathExtension.lowercased() == "pdf" {
                         if let pdf = CPDFDocument(url: url), pdf.isEncrypted {
                             if #available(macOS 13.0, *) {
-                                KMBaseWindowController.checkPassword(url: URL(filePath: filePath), type: .owner) { [weak self] success, resultPassword in
+                                KMBaseWindowController.checkPassword(url: URL(fileURLWithPath: filePath), type: .owner) { [weak self] success, resultPassword in
                                     self?.addImageStamp(withSecurityPDFFilePath: filePath, password: resultPassword, removeBGColor: (accessoryCtr.selectedButton.state == .on))
                                 }
                             } else {

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMPopMenuButtonCell.swift

@@ -12,9 +12,9 @@ class KMPopMenuButtonCell: NSButtonCell {
     override func titleRect(forBounds rect: NSRect) -> NSRect {
         var rect1 = super.titleRect(forBounds: rect)
         if ((self.image?.size.width) != nil) {
-            return CGRectMake(21 + 5 + (self.image?.size.width)!, rect1.origin.y, self.attributedTitle.size().width, self.attributedTitle.size().height)
+            return NSMakeRect(21 + 5 + (self.image?.size.width)!, rect1.origin.y, self.attributedTitle.size().width, self.attributedTitle.size().height)
         } else {
-            return CGRectMake(21 + 5, rect1.origin.y, self.attributedTitle.size().width, self.attributedTitle.size().height)
+            return NSMakeRect(21 + 5, rect1.origin.y, self.attributedTitle.size().width, self.attributedTitle.size().height)
         }
     }
     

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarItemView.swift

@@ -299,7 +299,7 @@ extension KMToolbarItemView {
         if (self.itemIdentifier == KMToolbarDividerItemIdentifier) {
             let context = NSGraphicsContext.current?.cgContext
             KMContextSaveGState(context)
-            KMContextTranslateCTM(context, CGRectGetWidth(dirtyRect)/2.0, CGRectGetHeight(dirtyRect)/2.0-10)
+            KMContextTranslateCTM(context, NSWidth(dirtyRect)/2.0, NSHeight(dirtyRect)/2.0-10)
             KMContextMoveToPoint(context, 0, 0)
             KMContextAddLineToPoint(context, 0, 20)
             KMContextSetStrokeColorWithColor(context, NSColor(red: 0, green: 0, blue: 0, alpha: 0.1).cgColor)

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarView.swift

@@ -154,7 +154,7 @@ private let KMToolbarItemSpace = 8.0
                 menu.addItem(item.menuFormRepresentation!)
             }
         }
-        menu.popUp(positioning: menu.items.first, at: NSMakePoint(CGRectGetMaxX(self.moreButton.frame), CGRectGetMaxY(self.moreButton.frame)-5), in: self)
+        menu.popUp(positioning: menu.items.first, at: NSMakePoint(NSMaxX(self.moreButton.frame), NSMaxY(self.moreButton.frame)-5), in: self)
     }
     
     private func _updateMainView(_ left: Bool = true, _ right: Bool = true) {
@@ -408,7 +408,7 @@ private let KMToolbarItemSpace = 8.0
 
             self.resizeSubviews(withOldSize: self.frame.size)
     
-            let topLine = NSBox(frame: CGRectMake(0, 0, self.frame.size.width, 0.5))
+            let topLine = NSBox(frame: NSMakeRect(0, 0, self.frame.size.width, 0.5))
             topLine.boxType = .separator
             topLine.fillColor = .black
             self.addSubview(topLine)
@@ -418,7 +418,7 @@ private let KMToolbarItemSpace = 8.0
                 make?.height.offset()(0.5)
             }
 
-            let bottomLine = NSBox(frame: CGRectMake(0, 0, self.frame.size.width, 0.5))
+            let bottomLine = NSBox(frame: NSMakeRect(0, 0, self.frame.size.width, 0.5))
             bottomLine.boxType = .separator
             bottomLine.fillColor = .black
             self.addSubview(bottomLine)

+ 2 - 2
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarCustomItemView.swift

@@ -123,7 +123,7 @@ class KMToolbarCustomItemView: KMToolbarItemView {
         self.window?.popover = self.popOver
         self.window?.sourcesRect = sourcesRect
         
-        self.popOver?.show(relativeTo: CGRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
+        self.popOver?.show(relativeTo: KMRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
     }
     
     func _showPopTip(_ sender: NSView) {
@@ -138,7 +138,7 @@ class KMToolbarCustomItemView: KMToolbarItemView {
         self.popOver?.contentSize = popViewController.view.frame.size
         
         popViewController.updateWithHelpTip(helpTip: self.toolTip ?? "")
-        self.popOver?.show(relativeTo: CGRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
+        self.popOver?.show(relativeTo: KMRectInset(self.bounds, 0, 5), of: self, preferredEdge: .minY)
     }
     
     private func _closePop() {

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarPreviousNextItemView.swift

@@ -109,7 +109,7 @@ class KMToolbarPreviousNextItemView: NSView {
     class var itemWidth: CGFloat {
         get {
             let string = _KMPreviousNextString()
-            let width = string.boundingRect(with: NSSize(width: CGFLOAT_MAX, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
+            let width = string.boundingRect(with: NSSize(width: CGFloat.greatestFiniteMagnitude, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
             if width < _minWidth {
                 return _minWidth
             }
@@ -238,7 +238,7 @@ class KMToolbarPreviousBackItemView: NSView {
     class var itemWidth: CGFloat {
         get {
             let string = _KMPreviousBackString()
-            let width = string.boundingRect(with: NSSize(width: CGFLOAT_MAX, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
+            let width = string.boundingRect(with: NSSize(width: CGFloat.greatestFiniteMagnitude, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
             if width < _minWidth {
                 return _minWidth
             }
@@ -366,7 +366,7 @@ class KMToolbarFirstLastItemView: NSView {
     class var itemWidth: CGFloat {
         get {
             let string = _KMFirstLastString()
-            let width = string.boundingRect(with: NSSize(width: CGFLOAT_MAX, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
+            let width = string.boundingRect(with: NSSize(width: CGFloat.greatestFiniteMagnitude, height: 20), options: [.usesLineFragmentOrigin, .truncatesLastVisibleLine], attributes: [.font : KMToolbarMainItemView.textFont]).size.width + 5 * 2
             if width < _minWidth {
                 return _minWidth
             }

+ 3 - 3
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/View/KMToolbarZoomItemView.swift

@@ -82,8 +82,8 @@ class KMToolbarZoomItemView: NSView {
         
         self.addSubview(self.zoomInButton)
         self.addSubview(self.zoomOutButton)
-        self.zoomOutButton.frame = NSMakeRect(CGRectGetMaxX(self.boxView.frame)+vspace, 17, zoomButtonW, zoomButtonW)
-        self.zoomInButton.frame = NSMakeRect(CGRectGetMaxX(self.zoomOutButton.frame), 17, zoomButtonW, zoomButtonW)
+        self.zoomOutButton.frame = NSMakeRect(NSMaxX(self.boxView.frame)+vspace, 17, zoomButtonW, zoomButtonW)
+        self.zoomInButton.frame = NSMakeRect(NSMaxX(self.zoomOutButton.frame), 17, zoomButtonW, zoomButtonW)
         
         self.boxView.wantsLayer = true
         self.boxView.layer?.borderWidth = 1
@@ -156,7 +156,7 @@ class KMToolbarPageIndicatorItemView: NSView {
         self.addSubview(self.titleLabel)
         
         self.addSubview(self.numLabel)
-        self.numLabel.frame = NSMakeRect(CGRectGetMaxX(self.boxView.frame)+vspace, 13, zoomButtonW, 20)
+        self.numLabel.frame = NSMakeRect(NSMaxX(self.boxView.frame)+vspace, 13, zoomButtonW, 20)
         
         self.boxView.wantsLayer = true
         self.boxView.layer?.borderWidth = 1

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -1016,7 +1016,7 @@ extension KMMainViewController {
         }
         let window = NSWindow.currentWindow()
         let currentPage = pdfDoc.index(for: self.listView.currentPage())
-        let cropVC = KMPDFCropWindowController(document: pdfDoc, pwd: "", currentPage: Int(currentPage), cropSize: CGRectMake(100, 100, 50, 80), selectPageString: "\(currentPage)")
+        let cropVC = KMPDFCropWindowController(document: pdfDoc, pwd: "", currentPage: Int(currentPage), cropSize: NSMakeRect(100, 100, 50, 80), selectPageString: "\(currentPage)")
         window.km_beginSheet(windowC: cropVC)
         cropVC.cropWindowCloseBlock = { [weak self] doc in
             window.km_quick_endSheet()

+ 4 - 4
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -796,8 +796,8 @@ import Cocoa
             
         } else {
             var windowRect = windowVC.window?.frame
-            windowRect!.origin.x = CGRectGetMaxX(self.view.window!.frame) - (windowRect?.size.width)!
-            windowRect!.origin.y = CGRectGetMaxY(self.view.window!.frame) - (windowRect?.size.height)! - 64
+            windowRect!.origin.x = NSMaxX(self.view.window!.frame) - (windowRect?.size.width)!
+            windowRect!.origin.y = NSMaxY(self.view.window!.frame) - (windowRect?.size.height)! - 64
             windowVC.window?.setFrame(windowRect!, display: true)
             
             windowVC.didSetOriginFrame = true
@@ -836,7 +836,7 @@ import Cocoa
             guard let guideWC = self.guideInfoWindowController else { return }
             
             guideWC.type = .openFileNormal
-            guideWC.openPanelRect = (self.view.window?.contentView?.convert(leftPanelItem.frame, from: leftPanelItem.superview)) ?? CGRectZero
+            guideWC.openPanelRect = (self.view.window?.contentView?.convert(leftPanelItem.frame, from: leftPanelItem.superview)) ?? .zero
             guideWC.window?.collectionBehavior = [.canJoinAllSpaces]
             guideWC.normalGuideFinishHandle = { [weak self] windowVC in
                 let rightPanelItem = self?.toolbarController.findItem(KMRightControlToolbarItemIdentifier)
@@ -2212,7 +2212,7 @@ import Cocoa
                 self.enterPresentationMode()
 
     //            updatePresentationOptions(for: self.view.window!)
-                self.pdfSplitView.frame = CGRect(x: 0, y: 0, width: CGRectGetWidth(centerContentView.bounds), height: CGRectGetHeight(centerContentView.bounds)-1)
+                self.pdfSplitView.frame = CGRect(x: 0, y: 0, width: NSWidth(centerContentView.bounds), height: NSHeight(centerContentView.bounds)-1)
                 self.centerContentView.addSubview(pdfSplitView)
                 self.listView.frame = (self.view.window?.contentView?.bounds)!
                 self.view.window?.contentView?.addSubview(listView)

+ 1 - 1
PDF Office/PDF Master/Class/Parsers/Data/KMSyncDot.swift

@@ -59,7 +59,7 @@ class KMSyncDot: NSObject {
     }
     
     func bounds() -> NSRect {
-        return KMRectFromCenterAndSquareSize(center: point, size: 22.0) ?? CGRectZero
+        return KMRectFromCenterAndSquareSize(center: point, size: 22.0) ?? .zero
     }
 
     func draw(in ctx: CGContext) {

+ 2 - 2
PDF Office/PDF Master/Class/Preference/Controller/KMGeneralPreferences.swift

@@ -112,11 +112,11 @@ class KMGeneralPreferences: NSViewController {
         
         self.authorLabel.sizeToFit()
         var frame = self.authorTextField.frame
-        frame.origin.x = CGRectGetMaxX(self.authorLabel.frame)+5
+        frame.origin.x = NSMaxX(self.authorLabel.frame)+5
         self.authorTextField.frame = frame
         self.openTabLabel.sizeToFit()
         frame = self.openTabButton.frame
-        frame.origin.x = CGRectGetMaxX(self.openTabLabel.frame)+5
+        frame.origin.x = NSMaxX(self.openTabLabel.frame)+5
         self.openTabButton.frame = frame
         self.openTabButton.isEnabled = true
         

+ 2 - 2
PDF Office/PDF Master/Class/Purchase/DMG/KMPurchaseLimitWindowController.swift

@@ -88,11 +88,11 @@ class KMPurchaseLimitWindowController: NSWindowController {
         
         
         self.purchaseBox.wantsLayer = true
-        self.purchaseBox.cornerRadius = CGRectGetHeight(self.purchaseBox.frame)/2
+        self.purchaseBox.cornerRadius = NSHeight(self.purchaseBox.frame)/2
         self.purchaseBox.layer?.masksToBounds = true
         
         self.purchaseBtn.wantsLayer = true
-        self.purchaseBtn.layer?.cornerRadius = CGRectGetHeight(self.purchaseBtn.frame)/2.0
+        self.purchaseBtn.layer?.cornerRadius = NSHeight(self.purchaseBtn.frame)/2.0
         self.purchaseBtn.layer?.masksToBounds = true
         self.purchaseBtn.title = NSLocalizedString("Upgrade", comment: "")
         self.purchaseBtn.setTitleColor(NSColor.white)

+ 1 - 1
PDF Office/PDF Master/Class/Purchase/DMG/Verification/KMTrialSuccessController.swift

@@ -41,7 +41,7 @@ class KMTrialSuccessController: NSViewController {
         
         self.getStartBox.wantsLayer = true
         self.getStartBox.layer?.masksToBounds = true
-        self.getStartBox.layer?.cornerRadius = CGRectGetHeight(self.getStartBox.frame)/2
+        self.getStartBox.layer?.cornerRadius = NSHeight(self.getStartBox.frame)/2
         
         self.titleLabel.stringValue = NSLocalizedString("Free Trial PDF Reader Pro for 7 Days!", comment: "")
         self.subTitleLabel.stringValue = NSLocalizedString("Congrats! You are eligible to enjoy all advanced features in PDF Reader Pro.", comment: "")

+ 2 - 2
PDF Office/PDF Master/Class/Welcome/KMWelcomeWindowController.swift

@@ -126,10 +126,10 @@ class KMWelcomeWindowController: NSWindowController {
         self._contentViews = [self.content1View, self.content2View, self.content3View, self.content4View, self.content6View, self.content5View]
         for i in 0 ..< self.contentViews.count {
             let view = self.contentViews[i]
-            view.frame = CGRectMake(i.cgFloat*clipView.bounds.size.width, 0, clipView.bounds.size.width, clipView.bounds.size.height)
+            view.frame = NSMakeRect(i.cgFloat*clipView.bounds.size.width, 0, clipView.bounds.size.width, clipView.bounds.size.height)
             self.scrollView.documentView?.addSubview(view)
         }
-        self.scrollView.documentView?.frame = CGRectMake(0, 0, clipView.bounds.size.width*self.contentViews.count.cgFloat, clipView.bounds.size.height)
+        self.scrollView.documentView?.frame = NSMakeRect(0, 0, clipView.bounds.size.width*self.contentViews.count.cgFloat, clipView.bounds.size.height)
     }
     
     override func windowDidLoad() {