|
@@ -559,10 +559,14 @@ import Cocoa
|
|
|
self?.showPrintWindow(pageRange: KMPrintPageRange(type: .custom, selectPages: params.first as! [Int]))
|
|
|
}
|
|
|
}
|
|
|
- controller.documentEditedCallback = { [weak self] _ in
|
|
|
+ controller.documentEditedCallback = { [weak self] params in
|
|
|
self?.recordIsPDFDocumentEdited()
|
|
|
// self?.needSave = true
|
|
|
- self?.recordSaveWatermarkFlag()
|
|
|
+ if let data = params.first as? KMPageEditType {
|
|
|
+ self?.recordSaveWatermarkFlag(type: data.toSubscribeWaterMarkType())
|
|
|
+ } else {
|
|
|
+ self?.recordSaveWatermarkFlag()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -881,11 +885,11 @@ import Cocoa
|
|
|
|
|
|
self?._secureOptions = windowController_secure.options
|
|
|
self?.needSave = true
|
|
|
- self?.recordIsPDFDocumentEdited()
|
|
|
+ self?.recordIsPDFDocumentEdited(type: .setPassword)
|
|
|
|
|
|
if (result) {
|
|
|
self?.showSecureSuccessTip()
|
|
|
- self?.recordSaveWatermarkFlag()
|
|
|
+ self?.recordSaveWatermarkFlag(type: .setPassword)
|
|
|
} else {
|
|
|
let alert = NSAlert()
|
|
|
alert.messageText = NSLocalizedString("Failure", comment: "")
|
|
@@ -1293,7 +1297,7 @@ import Cocoa
|
|
|
public func recordRemoveSecureFlag() {
|
|
|
self._removeSecureFlag = true
|
|
|
self.clearSecureOptions()
|
|
|
- self.recordIsPDFDocumentEdited()
|
|
|
+ self.recordIsPDFDocumentEdited(type: .removePassword)
|
|
|
self._needSave = true
|
|
|
}
|
|
|
|
|
@@ -1301,7 +1305,7 @@ import Cocoa
|
|
|
self._removeSecureFlag = false
|
|
|
}
|
|
|
|
|
|
- public func recordSaveWatermarkFlag() {
|
|
|
+ public func recordSaveWatermarkFlag(type: KMSubscribeWaterMarkType = .none) {
|
|
|
km_synchronized(self) {
|
|
|
self._saveWatermarkFlag = true
|
|
|
}
|
|
@@ -1313,7 +1317,7 @@ import Cocoa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public func recordIsPDFDocumentEdited() {
|
|
|
+ public func recordIsPDFDocumentEdited(type: KMSubscribeWaterMarkType = .none) {
|
|
|
km_synchronized(self) {
|
|
|
self._isPDFDocumentEdited = true
|
|
|
|
|
@@ -1522,7 +1526,7 @@ import Cocoa
|
|
|
}
|
|
|
}
|
|
|
if self.listView.isEdited() {
|
|
|
- self.recordIsPDFDocumentEdited()
|
|
|
+ self.recordIsPDFDocumentEdited(type: .editText)
|
|
|
}
|
|
|
if self.listView.annotationType != .addText {
|
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
|
|
@@ -1590,7 +1594,7 @@ import Cocoa
|
|
|
}
|
|
|
|
|
|
if self.listView.isEdited() {
|
|
|
- self.recordIsPDFDocumentEdited()
|
|
|
+ self.recordIsPDFDocumentEdited(type: .editText)
|
|
|
|
|
|
if self.listView.annotationType != .addText {
|
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kPDFViewEditingAreaDidChanged"), object: self.listView.document)
|
|
@@ -1608,7 +1612,7 @@ import Cocoa
|
|
|
|
|
|
//编辑PDF 创建图片区域回调
|
|
|
func pdfViewEditingAddImageArea(_ pdfView: CPDFView!, add page: CPDFPage!, add rect: CGRect) {
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
+ self.recordSaveWatermarkFlag(type: .editImage)
|
|
|
|
|
|
if self.listView.isEditImage {
|
|
|
self.menuItemEditingClick_CropImage(sender: NSMenuItem())
|
|
@@ -1683,7 +1687,7 @@ import Cocoa
|
|
|
DispatchQueue.main.async {
|
|
|
self.listView.createImagePath(filePath, rect: imageRect, page: pdfView.currentPage())
|
|
|
self.isPDFTextImageEdited = true
|
|
|
- self.recordIsPDFDocumentEdited()
|
|
|
+ self.recordIsPDFDocumentEdited(type: .editImage)
|
|
|
// self.asyncSaveDocument { params in
|
|
|
//
|
|
|
// }
|
|
@@ -1732,7 +1736,7 @@ import Cocoa
|
|
|
// self.asyncSaveDocument { params in
|
|
|
//
|
|
|
// }
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
+ self.recordSaveWatermarkFlag(type: .editText)
|
|
|
}
|
|
|
|
|
|
func pdfListViewKeyDownIsContinue(_ pdfListView: CPDFListView!, theEvent: NSEvent!) -> Bool {
|
|
@@ -2107,20 +2111,24 @@ import Cocoa
|
|
|
func pdfListViewAddAnnotations(_ pdfListView: CPDFListView!, forAdd annotations: [CPDFAnnotation]!, in pdfPage: CPDFPage!) {
|
|
|
var addRedact = false
|
|
|
var saveWatermark = false
|
|
|
+ var saveWatermarkType: KMSubscribeWaterMarkType = .none
|
|
|
for anno in annotations {
|
|
|
if (anno.isKind(of: CPDFRedactAnnotation.self)) {
|
|
|
addRedact = true
|
|
|
// break
|
|
|
} else if (anno.isKind(of: CPDFLinkAnnotation.self)) { // link 注释
|
|
|
saveWatermark = true
|
|
|
+ saveWatermarkType = .link
|
|
|
} else if (anno.isKind(of: CPDFListStampAnnotation.self)) { // 图章注释
|
|
|
saveWatermark = true
|
|
|
+ saveWatermarkType = .stamp
|
|
|
} else if (anno.isKind(of: CPDFListSignatureAnnotation.self)) { // 签名注释
|
|
|
saveWatermark = true
|
|
|
+ saveWatermarkType = .sign
|
|
|
}
|
|
|
}
|
|
|
if (saveWatermark) {
|
|
|
- self.recordSaveWatermarkFlag()
|
|
|
+ self.recordSaveWatermarkFlag(type: saveWatermarkType)
|
|
|
}
|
|
|
self.hasAddRedact = addRedact
|
|
|
if self.isReadMode || self.listView.toolMode == .moveToolMode {
|