|
@@ -750,6 +750,27 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
|
|
|
|
|
|
func toolbarViewController(_ viewController: KMToolbarViewController, clickMode toolMode: KMToolbarViewType, toolbar toolbarItem: KMToolbarItemView, _ pages: [Int]) {
|
|
|
let beforeModel = KMToolbarViewType(rawValue: self.lastItemBox.clickButton.tag) ?? .None
|
|
|
+
|
|
|
+ if toolMode != .redact { // 标记秘文
|
|
|
+ let mainC = self.delegate as? KMMainViewController
|
|
|
+ var control: KMPDFRedactViewController?
|
|
|
+ for childC in mainC?.children ?? [] {
|
|
|
+ if (childC.isKind(of: KMPDFRedactViewController.self)) {
|
|
|
+ control = (childC as! KMPDFRedactViewController)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if let annos = control?.redactPdfView.newAddAnnotation, annos.count > 0 {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.informativeText = KMLocalizedString("There are unapplied redactions in this file. Exit will not save redaction.", nil)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Exit", nil))
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Cancel", nil))
|
|
|
+ let resp = alert.runModal()
|
|
|
+ if resp != .alertFirstButtonReturn { // 取消
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if self.lastItemBox != nil {
|
|
|
if (toolbarItem.isSelected && toolMode.isToolMode()) {
|
|
|
// no nothings
|
|
@@ -958,6 +979,27 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if toolbarItem.itemIdentifier != KMDocumentRedactToolbarItemIdentifier { // 标记秘文
|
|
|
+ let mainC = self.delegate as? KMMainViewController
|
|
|
+ var control: KMPDFRedactViewController?
|
|
|
+ for childC in mainC?.children ?? [] {
|
|
|
+ if (childC.isKind(of: KMPDFRedactViewController.self)) {
|
|
|
+ control = (childC as! KMPDFRedactViewController)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if let annos = control?.redactPdfView.newAddAnnotation, annos.count > 0 {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.informativeText = KMLocalizedString("There are unapplied redactions in this file. Exit will not save redaction.", nil)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Exit", nil))
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Cancel", nil))
|
|
|
+ let resp = alert.runModal()
|
|
|
+ if resp != .alertFirstButtonReturn { // 取消
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
self.delegate?.toolbarViewController?(viewController, itemDidClick: toolbarItem)
|
|
|
}
|
|
|
|
|
@@ -988,6 +1030,27 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if toolbarItem.itemIdentifier != KMDocumentRedactToolbarItemIdentifier { // 标记秘文
|
|
|
+ let mainC = self.delegate as? KMMainViewController
|
|
|
+ var control: KMPDFRedactViewController?
|
|
|
+ for childC in mainC?.children ?? [] {
|
|
|
+ if (childC.isKind(of: KMPDFRedactViewController.self)) {
|
|
|
+ control = (childC as! KMPDFRedactViewController)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if let annos = control?.redactPdfView.newAddAnnotation, annos.count > 0 {
|
|
|
+ let alert = NSAlert()
|
|
|
+ alert.informativeText = KMLocalizedString("There are unapplied redactions in this file. Exit will not save redaction.", nil)
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Exit", nil))
|
|
|
+ alert.addButton(withTitle: KMLocalizedString("Cancel", nil))
|
|
|
+ let resp = alert.runModal()
|
|
|
+ if resp != .alertFirstButtonReturn { // 取消
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
self.delegate?.toolbarViewController?(viewController, menuItemDidClick: toolbarItem, index: index, info: info)
|
|
|
}
|
|
|
|