소스 검색

【toolbar】密文+OCR新建入口

tangchao 1 년 전
부모
커밋
50b6d432a5

+ 16 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -340,5 +340,21 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "E33CE6EB-AF37-4B1D-89A4-DB97337F719D"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "323"
+            endingLineNumber = "323"
+            landmarkName = "scanOCRModelSelect(sender:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

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

@@ -797,9 +797,8 @@ extension KMToolbarViewController {
             item?.target = self
             item?.image = NSImage(named: "KMImageNameToolbarOCRNor")
             item?.boxImagePosition = .imageAbove
-            item?.btnTag = KMToolbarViewType.ScanOCR.rawValue
             item?.toolTip = NSLocalizedString("Recognize text from Image-based or Scanned PDF with OCR", comment: "")
-            item?.btnAction = #selector(leftControllButtonAction)
+            item?.btnAction = #selector(_itemAction)
         } else if identifier == KMToolbarToolEnhancedScanIdentifier {
             item?.image = NSImage(named: "KMImageNameMainToolEnhancedScan")
             item?.target = self
@@ -852,9 +851,8 @@ extension KMToolbarViewController {
             item?.target = self
             item?.image = NSImage(named: "KMImageNameUXIconToolbarRedactNor")
             item?.boxImagePosition = .imageAbove
-            item?.btnTag = KMToolbarViewType.redact.rawValue
             item?.toolTip = NSLocalizedString("Mark for redaction", comment: "")
-            item?.btnAction = #selector(leftControllButtonAction)
+            item?.btnAction = #selector(_itemAction)
         } else if identifier == KMDocumentAITranslationToolbarItemIdentifier {
             item?.image = NSImage(named: "ic_function_other_AITranslation")
             item?.titleName = "AI Translation"

+ 37 - 26
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -2906,33 +2906,44 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
     }
     
     func toolbarViewController(_ viewController: KMToolbarViewController, itemDidClick toolbarItem: KMToolbarItemView) {
-        if toolbarItem.itemIdentifier == KMDocumentHomeToolbarItemIdentifier {
-            Swift.debugPrint("KMDocumentHomeToolbarItemIdentifier ...")
-        } else if toolbarItem.itemIdentifier == KMDocumentPreviousPageToolbarItemIdentifier {
-            self.changePDFViewGoToPreviousPageAction()
-        } else if toolbarItem.itemIdentifier == KMDocumentNextPageToolbarItemIdentifier {
-            self.changePDFViewGotoNextPageAction()
-        } else if toolbarItem.itemIdentifier == KMDocumentViewSettingToolbarItemIdentifier {
-            Swift.debugPrint("KMDocumentViewSettingToolbarItemIdentifier ...")
-        } else if toolbarItem.itemIdentifier == KMToolbarAnnotationSettingItemIdentifier {
-            let windowC = KMToolbarCustomWindowController()
-            windowC.toolbar = self.toolbarController.childToolBarView?.toolbar
-            self.km_beginSheet(windowC: windowC)
-        } else if toolbarItem.itemIdentifier == KMToolbarComparisonItemIdentifier {
-            Swift.debugPrint("KMToolbarComparisonItemIdentifier ...")
-        } else if toolbarItem.itemIdentifier == KMLeftControlToolbarItemIdentifier {
-            toolbarItem.isSelected = !toolbarItem.isSelected
-            self.toggleLeftPane()
-            self.leftSideViewController.showPanelView(show: toolbarItem.isSelected)
-        } else if toolbarItem.itemIdentifier == KMRightControlToolbarItemIdentifier {
-            toolbarItem.isSelected = !toolbarItem.isSelected
-            self.toggleRightPane()
-        } else if toolbarItem.itemIdentifier == KMDocumentPrintToolbarItemIdentifier {
-            self.trackEvent_print()
-            self.showPrintWindow()
-        } else if toolbarItem.itemIdentifier == KMToolbarToolProfileIdentifier {
-            Swift.debugPrint("KMToolbarToolProfileIdentifier ...")
+        if let itemID = toolbarItem.itemIdentifier {
+            if isMainToolItem(itemID) {
+                if toolbarItem.itemIdentifier == KMDocumentHomeToolbarItemIdentifier {
+                    Swift.debugPrint("KMDocumentHomeToolbarItemIdentifier ...")
+                } else if toolbarItem.itemIdentifier == KMDocumentPreviousPageToolbarItemIdentifier {
+                    self.changePDFViewGoToPreviousPageAction()
+                } else if toolbarItem.itemIdentifier == KMDocumentNextPageToolbarItemIdentifier {
+                    self.changePDFViewGotoNextPageAction()
+                } else if toolbarItem.itemIdentifier == KMDocumentViewSettingToolbarItemIdentifier {
+                    Swift.debugPrint("KMDocumentViewSettingToolbarItemIdentifier ...")
+                } else if toolbarItem.itemIdentifier == KMLeftControlToolbarItemIdentifier {
+                    toolbarItem.isSelected = !toolbarItem.isSelected
+                    self.toggleLeftPane()
+                    self.leftSideViewController.showPanelView(show: toolbarItem.isSelected)
+                } else if toolbarItem.itemIdentifier == KMRightControlToolbarItemIdentifier {
+                    toolbarItem.isSelected = !toolbarItem.isSelected
+                    self.toggleRightPane()
+                } else if itemID == KMDocumentRedactToolbarItemIdentifier {
+                    Swift.debugPrint("KMDocumentRedactToolbarItemIdentifier ...")
+                } else if itemID == KMDocumentScanOCRToolbarItemIdentifier {
+                    Swift.debugPrint("KMDocumentScanOCRToolbarItemIdentifier ...")
+                }
+            } else {
+                if toolbarItem.itemIdentifier == KMToolbarAnnotationSettingItemIdentifier {
+                    let windowC = KMToolbarCustomWindowController()
+                    windowC.toolbar = self.toolbarController.childToolBarView?.toolbar
+                    self.km_beginSheet(windowC: windowC)
+                } else if toolbarItem.itemIdentifier == KMToolbarComparisonItemIdentifier {
+                    Swift.debugPrint("KMToolbarComparisonItemIdentifier ...")
+                } else if toolbarItem.itemIdentifier == KMDocumentPrintToolbarItemIdentifier {
+                    self.trackEvent_print()
+                    self.showPrintWindow()
+                } else if toolbarItem.itemIdentifier == KMToolbarToolProfileIdentifier {
+                    Swift.debugPrint("KMToolbarToolProfileIdentifier ...")
+                }
+            }
         }
+        
     }
     
     func toolbarViewController(_ viewController: KMToolbarViewController, searchAction searchString: String) {