|
@@ -92,6 +92,7 @@ import Cocoa
|
|
|
case crop = 8009
|
|
|
case comparison = 8010
|
|
|
case aiTools = 8011
|
|
|
+ case measure = 8012
|
|
|
}
|
|
|
|
|
|
@objc protocol KMToolbarViewControllerDelegate {
|
|
@@ -424,6 +425,19 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
self._itemSetPromptFlag(itemIdentifier: KMToolbarToolSecureItemIdentifier)
|
|
|
}
|
|
|
|
|
|
+ @objc func measureMenuAction(sender: KMToolbarClickButton) {
|
|
|
+ self.delegate?.toolbarViewController?(self, clickChaildToolType: .measure, toolbar: sender.clickObject as! KMToolbarItemView)
|
|
|
+ self._itemSetPromptFlag(item: sender.clickObject as? KMToolbarItemView)
|
|
|
+ }
|
|
|
+ @objc private func _measureAction(sender: NSMenuItem) {
|
|
|
+ if let data = self._currentItemView {
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: data, index: sender.tag, info: nil)
|
|
|
+ } else {
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarMeasureItemIdentifier), index: sender.tag, info: nil)
|
|
|
+ }
|
|
|
+ self._itemSetPromptFlag(itemIdentifier: KMToolbarMeasureItemIdentifier)
|
|
|
+ }
|
|
|
+
|
|
|
@objc func conversionMenuItemAction(sender: KMToolbarClickButton) {
|
|
|
if let item: KMToolbarItemView = sender.clickObject as? KMToolbarItemView {
|
|
|
var type: KMToolbarType = .word
|
|
@@ -679,7 +693,7 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
|
|
|
return [KMNewToolbarSpaceItemIdentifier,
|
|
|
KMToolbarPageEditInsetItemIdentifier, KMToolbarToolMergeItemIdentifier, KMToolbarPageEditSplitItemIdentifier,
|
|
|
KMToolbarToolCompressItemIdentifier, KMToolbarToolSecureItemIdentifier, KMToolbarToolWatermarkItemIdentifier,
|
|
|
- KMToolbarToolBackgroundItemIdentifier, KMToolbarToolHeaderFooterItemIdentifier, KMToolbarToolBatesItemIdentifier,
|
|
|
+ KMToolbarToolBackgroundItemIdentifier, KMToolbarToolHeaderFooterItemIdentifier, KMToolbarToolBatesItemIdentifier,KMToolbarMeasureItemIdentifier,
|
|
|
KMToolbarAIItemIdentifier,
|
|
|
KMToolbarCropIdentifier,
|
|
|
KMToolbarConversionWordItemIdentifier, KMToolbarConversionExcelItemIdentifier, KMToolbarConversionPPTItemIdentifier,
|
|
@@ -778,7 +792,8 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
|
|
|
return [KMToolbarToolCompressItemIdentifier, KMToolbarToolMergeItemIdentifier,
|
|
|
KMToolbarToolSecureItemIdentifier, KMToolbarComparisonItemIdentifier,
|
|
|
KMToolbarToolWatermarkItemIdentifier, KMToolbarToolBackgroundItemIdentifier,
|
|
|
- KMToolbarToolHeaderFooterItemIdentifier, KMToolbarToolBatesItemIdentifier]
|
|
|
+ KMToolbarToolHeaderFooterItemIdentifier, KMToolbarToolBatesItemIdentifier,
|
|
|
+ KMToolbarMeasureItemIdentifier]
|
|
|
case .Form:
|
|
|
return [KMToolbarToolTextFieldItemIdentifier,
|
|
|
KMToolbarToolCheckBoxItemIdentifier,
|
|
@@ -2318,6 +2333,21 @@ extension KMToolbarViewController {
|
|
|
item?.titleName = NSLocalizedString("Merge", comment: "")
|
|
|
item?.boxImagePosition = .imageLeft
|
|
|
item?.btnAction = #selector(mergeMenuItemAction)
|
|
|
+ } else if identifier == KMToolbarMeasureItemIdentifier {
|
|
|
+ item?.image = NSImage(named: "KMImageNameUXIconMeasureNor")
|
|
|
+ item?.target = self
|
|
|
+ item?.titleName = NSLocalizedString("Measure", comment: "")
|
|
|
+ item?.boxImagePosition = .imageExpandLeft
|
|
|
+ item?.needExpandAction = true
|
|
|
+ let menuItem = NSMenuItem.init(title: NSLocalizedString("Measure", comment: ""), action: #selector(measureMenuAction), target: self)
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Line", comment: ""), action: #selector(_measureAction), target: self, tag: 1)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Multilines", comment: ""), action: #selector(_measureAction), target: self, tag: 2)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Polygon", comment: ""), action: #selector(_measureAction), target: self, tag: 3)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Rectangle", comment: ""), action: #selector(_measureAction), target: self, tag: 4)
|
|
|
+ menuItem.submenu = subMenu
|
|
|
+ item?.menuFormRepresentation = menuItem
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|