|
@@ -129,9 +129,11 @@ class CustomStampWindowController: NSWindowController, CPDFViewDelegate, CPDFLis
|
|
self?.pdfView.customStampTextValue = string
|
|
self?.pdfView.customStampTextValue = string
|
|
}
|
|
}
|
|
} else if toolbarType == .image {
|
|
} else if toolbarType == .image {
|
|
- self?.pdfView.annotationType = .addImage
|
|
|
|
|
|
+ self?.pdfView.toolMode = .noteToolMode
|
|
|
|
+ self?.pdfView.annotationType = .stamp
|
|
self?.chooseImage()
|
|
self?.chooseImage()
|
|
} else if toolbarType == .stamp {
|
|
} else if toolbarType == .stamp {
|
|
|
|
+ self?.pdfView.toolMode = .noteToolMode
|
|
self?.chooseStamp()
|
|
self?.chooseStamp()
|
|
}
|
|
}
|
|
|
|
|
|
@@ -207,7 +209,7 @@ class CustomStampWindowController: NSWindowController, CPDFViewDelegate, CPDFLis
|
|
openPanel.allowsMultipleSelection = false
|
|
openPanel.allowsMultipleSelection = false
|
|
openPanel.accessoryView = accessoryCtr.view
|
|
openPanel.accessoryView = accessoryCtr.view
|
|
openPanel.canSelectHiddenExtension = true
|
|
openPanel.canSelectHiddenExtension = true
|
|
- openPanel.beginSheetModal(for: NSApp.mainWindow!) { [weak self] (result) in
|
|
|
|
|
|
+ openPanel.beginSheetModal(for: self.window!) { [weak self] (result) in
|
|
if result == .OK {
|
|
if result == .OK {
|
|
guard let url = openPanel.url else {
|
|
guard let url = openPanel.url else {
|
|
return
|
|
return
|
|
@@ -220,11 +222,9 @@ class CustomStampWindowController: NSWindowController, CPDFViewDelegate, CPDFLis
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- let image = NSImage(contentsOfFile: url.path)
|
|
|
|
-
|
|
|
|
- let isRemoveBGColor = accessoryCtr.selectedButton.state == .on
|
|
|
|
- self?.pdfView.addAnnotation(with: image, isRemoveBGColor: isRemoveBGColor)
|
|
|
|
-
|
|
|
|
|
|
+ let stamp = CStampObject(imageStampFilePath: filePath)
|
|
|
|
+ stamp.nameString = ""
|
|
|
|
+ self?.pdfView.setAddStamp(stamp, keepToolModel: true)
|
|
self?.updateRightToolBarInfo()
|
|
self?.updateRightToolBarInfo()
|
|
} else {
|
|
} else {
|
|
self?.leftToolbar.toolbarType = .move
|
|
self?.leftToolbar.toolbarType = .move
|
|
@@ -240,8 +240,11 @@ class CustomStampWindowController: NSWindowController, CPDFViewDelegate, CPDFLis
|
|
|
|
|
|
} else if actionType == 1 {
|
|
} else if actionType == 1 {
|
|
|
|
|
|
- self?.pdfView.annotationType = .addImage
|
|
|
|
- self?.pdfView.addAnnotation(with: NSImage(contentsOf: URL(fileURLWithPath: filePath!)), isRemoveBGColor: false)
|
|
|
|
|
|
+ self?.pdfView.annotationType = .stamp
|
|
|
|
+ let stamp = CStampObject(imageStampFilePath: filePath!)
|
|
|
|
+ stamp.nameString = ""
|
|
|
|
+ self?.pdfView.setAddStamp(stamp, keepToolModel: true)
|
|
|
|
+
|
|
self?.updateRightToolBarInfo()
|
|
self?.updateRightToolBarInfo()
|
|
|
|
|
|
}
|
|
}
|