|
@@ -334,6 +334,14 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @objc private func _newPDFAction(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: KMToolbarConversionCreatePDFItemIdentifier), index: sender.tag, info: nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@IBAction func zoomModelSelectButtonAction(_ sender: NSPopUpButton) {
|
|
|
self.delegate?.toolbarViewController?(self, zoomModel: sender.selectedTag())
|
|
|
for item in sender.itemArray {
|
|
@@ -460,6 +468,8 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
|
|
|
return [KMLeftControlToolbarItemIdentifier,
|
|
|
KMDocumentZoomViewToolbarItemIdentifier, KMDocumentZoomOutToolbarItemIdentifier, KMDocumentZoomToolbarItemIdentifier,
|
|
|
KMDocumentPreviousPageToolbarItemIdentifier, KMDocumentNextPageToolbarItemIdentifier, KMDocumentHomeToolbarItemIdentifier]
|
|
|
+ } else if (toolbarType == .Conversion) {
|
|
|
+ return [KMToolbarConversionCreatePDFItemIdentifier]
|
|
|
}
|
|
|
return []
|
|
|
}
|
|
@@ -1279,9 +1289,30 @@ extension KMToolbarViewController {
|
|
|
subMenu.addItem(title: NSLocalizedString("Extract All Images", comment: ""), action: #selector(_exportImageAction), target: self, tag: 1)
|
|
|
subMenu.addItem(title: NSLocalizedString("Extract Images", comment: ""), action: #selector(_exportImageAction), target: self, tag: 2)
|
|
|
|
|
|
+ menuItem.submenu = subMenu
|
|
|
+ item?.menuFormRepresentation = menuItem
|
|
|
+ } else if item?.itemIdentifier == KMToolbarConversionCreatePDFItemIdentifier {
|
|
|
+ item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertCreatPDF)
|
|
|
+ item?.target = self
|
|
|
+ item?.toolTip = NSLocalizedString("Convert JPEG, JPG, PNG, TIFF, BMP or PSD files to PDFs", comment: "")
|
|
|
+ item?.titleName = NSLocalizedString("New PDF Document", comment: "")
|
|
|
+ item?.boxImagePosition = .imageExpandLeft
|
|
|
+ item?.needExpandAction = true
|
|
|
+
|
|
|
+ let menuItem = NSMenuItem.init(title: "New PDF Document", action: nil, target: self)
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ subMenu.addItem(title: NSLocalizedString("New Blank Page", comment: ""), action: #selector(_newPDFAction), target: self, tag: 1)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("New From Images", comment: ""), action: #selector(_newPDFAction), target: self, tag: 2)
|
|
|
+ subMenu.addItem(NSMenuItem.separator())
|
|
|
+ subMenu.addItem(title: NSLocalizedString("New From Web Page", comment: ""), action: #selector(_newPDFAction), target: self, tag: 3)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Import From Camera", comment: ""), action: #selector(_newPDFAction), target: self, tag: 4)
|
|
|
+ subMenu.addItem(NSMenuItem.separator())
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Import From Scanner", comment: ""), action: #selector(_newPDFAction), target: self, tag: 5)
|
|
|
+
|
|
|
menuItem.submenu = subMenu
|
|
|
item?.menuFormRepresentation = menuItem
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private func _setupFillSignItem(_ item: KMToolbarItemView?) {
|