|
@@ -185,6 +185,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
|
|
|
@IBAction func changeAnnotationMode(item: KMToolbarClickButton) {
|
|
|
self.delegate?.changeAnnotationModeAction?(item: item)
|
|
|
+ self._itemSetPromptFlag(item: item.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
|
|
|
@IBAction func leftControllButtonAction(item: KMToolbarClickButton) {
|
|
@@ -196,6 +197,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, clickMode: tag, toolbar: item.clickObject as! KMToolbarItemView, [])
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(item: item.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
|
|
|
@objc private func _itemAction(_ item: KMToolbarClickButton) {
|
|
@@ -214,6 +216,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, itemDidClick: item.clickObject as! KMToolbarItemView)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(item: item.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
|
|
|
@objc private func _menuItemAction(_ item: NSMenuItem) {
|
|
@@ -221,7 +224,9 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
NSSound.beep()
|
|
|
return
|
|
|
}
|
|
|
- self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: itemId), index: 0, info: nil)
|
|
|
+ let item_ = self.toolbarItemFindItemIdentifiers(value: itemId)
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: item_, index: 0, info: nil)
|
|
|
+ self._itemSetPromptFlag(item: item_)
|
|
|
}
|
|
|
|
|
|
@objc private func _comparisonAction(sender: NSMenuItem) {
|
|
@@ -230,6 +235,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarComparisonItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarComparisonItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@IBAction func showPDFLayoutMode(sender: KMToolbarClickButton) {
|
|
@@ -238,6 +244,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
item?.isSelected = !item!.isSelected
|
|
|
}
|
|
|
self.delegate?.showPDFLayoutModeAction?(show: true)
|
|
|
+ self._itemSetPromptFlag(item: item)
|
|
|
}
|
|
|
|
|
|
@objc func cropMenuAction(item: KMToolbarItemView) {
|
|
@@ -250,6 +257,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarCropIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarCropIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc func batesMenuAction(sender: KMToolbarClickButton) {
|
|
@@ -264,6 +272,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolBatesItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarToolBatesItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc func headerfooterMenuAction(sender: KMToolbarClickButton) {
|
|
@@ -278,6 +287,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolHeaderFooterItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarToolHeaderFooterItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc func backgroundMenuAction(sender: KMToolbarClickButton) {
|
|
@@ -292,6 +302,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolBackgroundItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarToolBackgroundItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc func watermarkMenuAction(sender: KMToolbarClickButton) {
|
|
@@ -306,18 +317,22 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolWatermarkItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarToolWatermarkItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc func redactMenuAction(sender: KMToolbarClickButton) {
|
|
|
self.delegate?.toolbarViewController?(self, clickChaildToolType: .redact, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
+ self._itemSetPromptFlag(item: sender.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
|
|
|
@objc func compressMenuAction(sender: KMToolbarClickButton) {
|
|
|
self.delegate?.toolbarViewController?(self, clickChaildToolType: .compress, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
+ self._itemSetPromptFlag(item: sender.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
|
|
|
@objc func secureMenuAction(sender: KMToolbarClickButton) {
|
|
|
self.delegate?.toolbarViewController?(self, clickChaildToolType: .secure, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
+ self._itemSetPromptFlag(item: sender.clickObject as? KMToolbarItemView)
|
|
|
}
|
|
|
@objc private func _secureAction(sender: NSMenuItem) {
|
|
|
if let data = self._currentItemView {
|
|
@@ -325,9 +340,9 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolSecureItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarToolSecureItemIdentifier)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@objc func conversionMenuItemAction(sender: KMToolbarClickButton) {
|
|
|
let item: KMToolbarItemView = sender.clickObject as! KMToolbarItemView
|
|
|
var type: KMToolbarType = .word
|
|
@@ -347,6 +362,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
type = .conversion_image
|
|
|
}
|
|
|
self.delegate?.toolbarViewController?(self, clickChaildToolType: type, toolbar: item)
|
|
|
+ self._itemSetPromptFlag(item: item)
|
|
|
}
|
|
|
|
|
|
@objc private func _pdfToImageAction(sender: NSMenuItem) {
|
|
@@ -355,6 +371,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarConversionImageItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarConversionImageItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc private func _exportImageAction(sender: NSMenuItem) {
|
|
@@ -363,6 +380,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarConversionExportImageItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarConversionExportImageItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@objc private func _newPDFAction(sender: NSMenuItem) {
|
|
@@ -371,6 +389,7 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
} else {
|
|
|
self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarConversionCreatePDFItemIdentifier), index: sender.tag, info: nil)
|
|
|
}
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarConversionCreatePDFItemIdentifier)
|
|
|
}
|
|
|
|
|
|
@IBAction func zoomModelSelectButtonAction(_ sender: NSPopUpButton) {
|
|
@@ -494,6 +513,22 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
UserDefaults.standard.setValue(value, forKey: SKCaseInsensitiveSearchKey)
|
|
|
UserDefaults.standard.synchronize()
|
|
|
}
|
|
|
+
|
|
|
+ // MARK: - Private Methods
|
|
|
+
|
|
|
+ private func _itemSetPromptFlag(item: KMToolbarItemView?) {
|
|
|
+ if let item_ = item {
|
|
|
+ if let identifier = item_.promptIdentifier {
|
|
|
+ item?.isShowPrompt = false
|
|
|
+ KMDataManager.ud_set(true, forKey: identifier)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private func _itemSetPromptFlag(itemIdentifier: String?) {
|
|
|
+ let item = self.toolbarItemFindItemIdentifiers(value: itemIdentifier ?? "")
|
|
|
+ self._itemSetPromptFlag(item: item)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// MARK: - Public Methods
|
|
@@ -1043,6 +1078,8 @@ extension KMToolbarViewController {
|
|
|
item?.btnAction = #selector(leftControllButtonAction)
|
|
|
item?.boxImagePosition = .imageAbove
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
+
|
|
|
} else if identifier == KMDocumentScanOCRToolbarItemIdentifier {
|
|
|
item?.titleName = NSLocalizedString("OCR", comment: "")
|
|
|
item?.target = self
|
|
@@ -1051,6 +1088,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Recognize text from Image-based or Scanned PDF with OCR", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(_itemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("OCR", comment: ""), action: #selector(_menuItemAction), target: self)
|
|
|
menuItem.representedObject = identifier
|
|
@@ -1072,6 +1110,7 @@ extension KMToolbarViewController {
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(scanOCRModelSelect)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("OCR Text Recognition", comment: ""), action: #selector(scanOCRModelSelect), target: self)
|
|
|
menuItem.representedObject = identifier
|
|
@@ -1085,6 +1124,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Edit text and image in PDF", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(leftControllButtonAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Edit PDF", comment: ""), action: #selector(leftControllButtonAction), target: self)
|
|
|
menuItem.tag = item!.btnTag
|
|
@@ -1098,6 +1138,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Edit PDF Form", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(leftControllButtonAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Forms", comment: ""), action: #selector(leftControllButtonAction), target: self)
|
|
|
menuItem.tag = item!.btnTag
|
|
@@ -1111,6 +1152,8 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Fill and sign forms", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(leftControllButtonAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
+
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Fill & Sign", comment: ""), action: #selector(leftControllButtonAction), target: self)
|
|
|
menuItem.tag = item!.btnTag
|
|
|
item?.menuFormRepresentation = menuItem
|
|
@@ -1124,6 +1167,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Edit, delete, cut, copy, paste, and insert text in PDFs", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(leftControllButtonAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMDocumentRedactToolbarItemIdentifier {
|
|
|
item?.titleName = NSLocalizedString("Redact Text", comment: "")
|
|
|
item?.target = self
|
|
@@ -1132,6 +1176,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Mark for redaction", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(_itemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMDocumentAITranslationToolbarItemIdentifier {
|
|
|
item?.image = NSImage(named: "ic_function_other_AITranslation")
|
|
|
item?.titleName = "AI Translation"
|
|
@@ -1139,6 +1184,7 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("AI Translation", comment: "")
|
|
|
item?.boxImagePosition = .imageOnly
|
|
|
item?.btnAction = #selector(aiTranslationButtonAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMDocumentPrintToolbarItemIdentifier {
|
|
|
item?.image = NSImage(named: "KMImageNameMainToolbarPrint")
|
|
|
item?.titleName = "Print"
|
|
@@ -1154,6 +1200,8 @@ extension KMToolbarViewController {
|
|
|
item?.boxImagePosition = .imageAbove
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(_itemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
+
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Page Display", comment: ""), action: #selector(_menuItemAction), target: self)
|
|
|
menuItem.representedObject = identifier
|
|
|
item?.menuFormRepresentation = menuItem
|
|
@@ -1224,6 +1272,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("Redact", comment: "")
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.btnAction = #selector(redactMenuAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Redact", comment: ""), action: #selector(redactMenuAction), target: self)
|
|
|
menuItem.tag = item!.btnTag
|
|
@@ -1237,6 +1286,7 @@ extension KMToolbarViewController {
|
|
|
item?.selectBackgroundType = .imageBox
|
|
|
item?.boxImagePosition = .imageAbove
|
|
|
item?.btnAction = #selector(_itemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: NSLocalizedString("Digital Sign", comment: ""), action: #selector(_menuItemAction), target: self)
|
|
|
menuItem.tag = item!.btnTag
|
|
@@ -1460,6 +1510,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("To Word", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(conversionMenuItemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMToolbarConversionExcelItemIdentifier {
|
|
|
item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertExcel)
|
|
|
item?.target = self
|
|
@@ -1468,6 +1519,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("To Excel", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(conversionMenuItemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMToolbarConversionPPTItemIdentifier {
|
|
|
item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertPPT)
|
|
|
item?.target = self
|
|
@@ -1476,6 +1528,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("To PPT", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(conversionMenuItemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMToolbarConversionRTFItemIdentifier {
|
|
|
item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertRTF)
|
|
|
item?.target = self
|
|
@@ -1484,6 +1537,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("To RTF", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(conversionMenuItemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMToolbarConversionCSVItemIdentifier {
|
|
|
item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertCSV)
|
|
|
item?.target = self
|
|
@@ -1492,6 +1546,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("To CSV", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(conversionMenuItemAction)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
} else if identifier == KMToolbarConversionHTMLItemIdentifier {
|
|
|
item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertHtml)
|
|
|
item?.target = self
|
|
@@ -1517,6 +1572,7 @@ extension KMToolbarViewController {
|
|
|
item?.boxImagePosition = .imageExpandLeft
|
|
|
item?.needExpandAction = true
|
|
|
item?.btnAction = #selector(convertToImage)
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: "To Image", action: #selector(conversionMenuItemAction), target: self)
|
|
|
let subMenu = NSMenu()
|
|
@@ -1537,6 +1593,7 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("Extract Images", comment: "")
|
|
|
item?.boxImagePosition = .imageExpandLeft
|
|
|
item?.needExpandAction = true
|
|
|
+ item?.promptIdentifier = identifier
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: "To Image", action: nil, target: self)
|
|
|
let subMenu = NSMenu()
|