Bladeren bron

【转档】工具栏调整

tangchao 1 maand geleden
bovenliggende
commit
f82ac2d5f4

+ 1 - 1
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -909,7 +909,7 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
                     }
                 }
             }
-        } else if ((KMToolbarType.word.rawValue ... KMToolbarType.conversion_image.rawValue).contains(clickChaildToolType.rawValue)) { /// 转档
+        } else if ((KMToolbarType.word.rawValue ... KMToolbarType.conversion_imageToPDF.rawValue).contains(clickChaildToolType.rawValue)) { /// 转档
             self.delegate?.clickChildTool?(type: clickChaildToolType, index: 0)
         } else if (clickChaildToolType == .merge) {
             self.delegate?.clickChildTool?(type: clickChaildToolType, index: 0)

+ 18 - 2
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -79,6 +79,7 @@ import Cocoa
     case html = 3005
     case conversion_text = 3006
     case conversion_image = 3007
+    case conversion_imageToPDF = 3008
     
     /// tool
     case compress = 8000
@@ -478,6 +479,8 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
                 type = .conversion_text
             } else if (item.btnTag == KMToolbarType.conversion_image.rawValue) {
                 type = .conversion_image
+            } else if (item.btnTag == KMToolbarType.conversion_imageToPDF.rawValue) {
+                type = .conversion_imageToPDF
             }
             self.delegate?.toolbarViewController?(self, clickChaildToolType: type, toolbar: item)
             self._itemSetPromptFlag(item: item)
@@ -841,7 +844,8 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
                     KMToolbarToolProfileIdentifier,
                     KMToolbarFillSignSignatureIdentifier]
         case .Conversion:
-            return [KMToolbarConversionCreatePDFItemIdentifier,
+            return [
+//                KMToolbarConversionCreatePDFItemIdentifier,
                     KMToolbarConversionWordItemIdentifier,
                     KMToolbarConversionExcelItemIdentifier,
                     KMToolbarConversionPPTItemIdentifier,
@@ -849,7 +853,7 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
                     KMToolbarConversionCSVItemIdentifier,
                     KMToolbarConversionHTMLItemIdentifier,
                     KMToolbarConversionTextItemIdentifier,
-                    KMToolbarConversionImageItemIdentifier,
+                    KMToolbarConversionImageItemIdentifier, KMToolbarConversionImageToPDFItemIdentifier,
                     KMToolbarDividerItemIdentifier, KMToolbarConversionOCRIdentifier, KMToolbarConversionExportImageItemIdentifier]
         case .ScanOCR:
             return [KMToolbarToolEnhancedScanIdentifier,
@@ -1985,6 +1989,18 @@ extension KMToolbarViewController {
             let menuItem = NSMenuItem.init(title: NSLocalizedString("To Text", comment: ""), action: #selector(_menuItemAction), target: self)
             menuItem.representedObject = identifier
             item?.menuFormRepresentation = menuItem
+        } else if identifier == KMToolbarConversionImageItemIdentifier {
+            item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertText)
+            item?.target = self
+            item?.btnTag = KMToolbarType.conversion_imageToPDF.rawValue
+            item?.toolTip = NSLocalizedString("Image To PDF", comment: "")
+            item?.titleName = NSLocalizedString("Image To PDF", comment: "")
+            item?.boxImagePosition = .imageLeft
+            item?.btnAction = #selector(conversionMenuItemAction)
+            
+            let menuItem = NSMenuItem.init(title: NSLocalizedString("Image To PDF", comment: ""), action: #selector(_menuItemAction), target: self)
+            menuItem.representedObject = identifier
+            item?.menuFormRepresentation = menuItem
         } else if identifier == KMToolbarConversionImageItemIdentifier {
             item?.image = NSImage(named: KMImageNameUXIconSubtoolbarConvertPDFToIMG)
             item?.target = self

+ 2 - 1
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/PublicKey.swift

@@ -110,6 +110,7 @@ let KMToolbarConversionCSVItemIdentifier = "KMToolbarPDFToCSVItemIdentifier"
 let KMToolbarConversionHTMLItemIdentifier = "KMToolbarPDFToHtmlItemIdentifier"
 let KMToolbarConversionTextItemIdentifier = "KMToolbarPDFToTextItemIdentifier"
 let KMToolbarConversionImageItemIdentifier = "KMToolbarPDFToImageItemIdentifier"
+let KMToolbarConversionImageToPDFItemIdentifier = "KMToolbarImageToPDFNewItemIdentifier"
 let KMToolbarConversionOCRIdentifier = "KMToolbarConversionOCRIdentifier"
 let KMToolbarConversionExportImageItemIdentifier = "KMToolbarExtractPDFImageItemIdentifier"
 
@@ -117,7 +118,7 @@ let conversionToolIdentifiers = [KMToolbarConversionCreatePDFItemIdentifier,
                                  KMToolbarConversionWordItemIdentifier, KMToolbarConversionExcelItemIdentifier,
                                  KMToolbarConversionPPTItemIdentifier, KMToolbarConversionRTFItemIdentifier,
                                  KMToolbarConversionCSVItemIdentifier, KMToolbarConversionHTMLItemIdentifier,
-                                 KMToolbarConversionTextItemIdentifier, KMToolbarConversionImageItemIdentifier,
+                                 KMToolbarConversionTextItemIdentifier, KMToolbarConversionImageItemIdentifier, KMToolbarConversionImageToPDFItemIdentifier,
                                  KMToolbarConversionOCRIdentifier, KMToolbarConversionExportImageItemIdentifier]
 
 // EditPDF

+ 7 - 1
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -3871,7 +3871,13 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
                 return
             }
             
-            if ((KMToolbarType.word.rawValue ... KMToolbarType.conversion_image.rawValue).contains(type.rawValue)) { /// 转档
+            if ((KMToolbarType.word.rawValue ... KMToolbarType.conversion_imageToPDF.rawValue).contains(type.rawValue)) { /// 转档
+                if type == .conversion_imageToPDF {
+                    Task {
+                        let _ = await NSApplication.ShowImageToPDFWindow(urls: [])
+                    }
+                    return
+                }
                 var identifier: String?
                 if (type == .word) { /// Word
                     identifier = KMToolbarConversionWordItemIdentifier