123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- //
- // KMSystemMenu.swift
- // PDF Master
- //
- // Created by tangchao on 2023/4/24.
- //
- import Cocoa
- protocol KMSystemFileMenuProtocol {
- func menuItemClick_mergePDF(_ sender: Any)
- func menuItemClick_Compress(_ sender: Any)
-
- func menuItemClick_Convert(_ sender: Any)
- func menuItemAction_ConvertToWord(_ sender: Any)
- func menuItemAction_ConvertToExcel(_ sender: Any)
- func menuItemAction_ConvertToPPT(_ sender: Any)
- func menuItemAction_ConvertToRTF(_ sender: Any)
- func menuItemAction_ConvertToHTML(_ sender: Any)
- func menuItemAction_ConvertToText(_ sender: Any)
- func menuItemAction_ConvertToCSV(_ sender: Any)
- func menuItemAction_ConvertToImage(_ sender: Any)
-
- func menuItemClick_SettingPassword(_ sender: Any)
- func menuItemClick_RemovePassword(_ sender: Any)
-
- func menuItemAction_closeWindow(_ sender: Any)
- func menuItemAction_closeAllWindows(_ sender: Any)
- func menuItemAction_closeTagPage(_ sender: Any)
-
- func menuItemAction_showInFinder(_ sender: Any)
- func menuItemAction_property(_ sender: Any)
-
- func menuItemAction_print(_ sender: Any)
- }
- extension KMSystemFileMenuProtocol {
- func menuItemClick_Convert(_ sender: Any) {}
- }
- protocol KMSystemEditMenuProtocol {
- func menuItemAction_find(_ sender: Any)
- }
- protocol KMSystemAnnotationMenuProtocol: NSObjectProtocol {
- func menuItemAction_highlight(_ sender: Any)
- func menuItemAction_underline(_ sender: Any)
- func menuItemAction_deleteLine(_ sender: Any)
- func menuItemAction_freehand(_ sender: Any)
- func menuItemAction_text(_ sender: Any)
- func menuItemAction_note(_ sender: Any)
- func menuItemAction_squre(_ sender: Any)
- func menuItemAction_circle(_ sender: Any)
- func menuItemAction_arrow(_ sender: Any)
- func menuItemAction_line(_ sender: Any)
- // link
- func menuItemAction_link(_ sender: Any)
- func menuItemAction_linkPage(_ sender: Any)
- func menuItemAction_linkHttps(_ sender: Any)
- func menuItemAction_linkEmail(_ sender: Any)
-
- // stamp
- func menuItemAction_stamp(_ sender: Any)
- func menuItemAction_stampStandard(_ sender: Any)
- func menuItemAction_stampDynamic(_ sender: Any)
- func menuItemAction_stampCustom(_ sender: Any)
-
- func menuItemAction_signure(_ sender: Any)
-
- func menuItemAction_hiddenAllAnnotation(_ sender: Any)
- func menuItemAction_clearAllAnnotation(_ sender: Any)
- }
- extension KMSystemAnnotationMenuProtocol {
- func menuItemAction_linkHttps(_ sender: Any) {}
- func menuItemAction_linkEmail(_ sender: Any) {}
-
- func menuItemAction_stampStandard(_ sender: Any) {}
- func menuItemAction_stampDynamic(_ sender: Any) {}
- func menuItemAction_stampCustom(_ sender: Any) {}
- }
- protocol KMSystemGotoMenuProtocol {
- func menuItemAction_nextPage(_ sender: Any)
- func menuItemAction_forwardPage(_ sender: Any)
- func menuItemAction_firstPage(_ sender: Any)
- func menuItemAction_lastPage(_ sender: Any)
- func menuItemAction_forward(_ sender: Any)
- func menuItemAction_goback(_ sender: Any)
- func menuItemAction_gotoPage(_ sender: Any)
- }
- protocol KMSystemToolMenuProtocol {
- func menuItemAction_textTool(_ sender: Any)
- func menuItemAction_scrolTool(_ sender: Any)
- func menuItemAction_zoomOutTool(_ sender: Any)
- func menuItemAction_selectTool(_ sender: Any)
- func menuItemAction_redact(_ sender: Any)
- func menuItemAction_warkmark(_ sender: Any)
- func menuItemAction_background(_ sender: Any)
- func menuItemAction_headerfooter(_ sender: Any)
- func menuItemAction_bates(_ sender: Any)
- func menuItemAction_batch(_ sender: Any)
- }
- extension KMSystemToolMenuProtocol {
- func menuItemAction_textTool(_ sender: Any) {}
-
- func menuItemAction_redact(_ sender: Any) {}
- func menuItemAction_warkmark(_ sender: Any) {}
- func menuItemAction_background(_ sender: Any) {}
- func menuItemAction_headerfooter(_ sender: Any) {}
- func menuItemAction_bates(_ sender: Any) {}
- func menuItemAction_batch(_ sender: Any) {}
- }
- protocol KMSystemWindowMenuRrotocol {
- func menuItemAction_showForwardTagPage(_ sender: Any)
- func menuItemAction_showNextTagPage(_ sender: Any)
- func menuItemAction_newTagPageToNewWindow(_ sender: Any)
- func menuItemAction_mergeAllWindow(_ sender: Any)
- func menuItemAction_currentWindowName(_ sender: Any)
- }
- extension KMSystemWindowMenuRrotocol {
- func menuItemAction_currentWindowName(_ sender: Any) {}
- }
- protocol KMSystemViewMenuProtocol {
- // scale
- func menuItemAction_adjustWidth(_ sender: Any)
- func menuItemAction_adjustPage(_ sender: Any)
- func menuItemAction_size(_ sender: Any)
- func menuItemAction_zoomOut(_ sender: Any)
- func menuItemAction_zoomIn(_ sender: Any)
-
- // page show
- func menuItemAction_singlePage(_ sender: Any)
- func menuItemAction_singlePageContinue(_ sender: Any)
- func menuItemAction_doublePage(_ sender: Any)
- func menuItemAction_doublePageContinue(_ sender: Any)
- func menuItemAction_bookMode(_ sender: Any)
- func menuItemAction_readMode(_ sender: Any)
- func menuItemAction_showSplitPage(_ sender: Any)
- func menuItemAction_autoScrol(_ sender: Any)
- func menuItemAction_autoScrolSetting(_ sender: Any)
-
- // rotate
- func menuItemAction_rotateLeft(_ sender: Any)
- func menuItemAction_rotateRight(_ sender: Any)
- func menuItemAction_rotateAllPageLeft(_ sender: Any)
- func menuItemAction_rotateAllPageRight(_ sender: Any)
-
- // split screen
- func menuItemAction_splitScreenVerti(_ sender: Any)
- func menuItemAction_splitScreenHorti(_ sender: Any)
- func menuItemAction_splitScreenNo(_ sender: Any)
-
- func menuItemAction_view_readMode(_ sender: Any)
- func menuItemAction_enterFullScreen(_ sender: Any)
- func menuItemAction_hiddenLeftSide(_ sender: Any)
- func menuItemAction_hiddenRightSide(_ sender: Any)
- func menuItemAction_thumai(_ sender: Any)
- func menuItemAction_outline(_ sender: Any)
- func menuItemAction_bookmark(_ sender: Any)
- func menuItemAction_annotation(_ sender: Any)
- func menuItemAction_search(_ sender: Any)
- func menuItemAction_topic(_ sender: Any)
- func menuItemAction_hiddenPageIndicator(_ sender: Any)
- }
- extension KMSystemViewMenuProtocol {
- func menuItemAction_autoScrol(_ sender: Any) {}
- func menuItemAction_autoScrolSetting(_ sender: Any) {}
-
- func menuItemAction_splitScreenVerti(_ sender: Any) {}
- func menuItemAction_splitScreenHorti(_ sender: Any) {}
- func menuItemAction_splitScreenNo(_ sender: Any) {}
-
- func menuItemAction_enterFullScreen(_ sender: Any) {}
- func menuItemAction_topic(_ sender: Any) {}
- }
- extension KMSystemMenu.File {
- public static let mergePDFSelector = NSSelectorFromString("menuItemClick_mergePDF:")
- public static let compressSelector = NSSelectorFromString("menuItemClick_Compress:")
-
- public static let convertSelector = NSSelectorFromString("menuItemClick_Convert:")
- public static let convertToWordSelector = NSSelectorFromString("menuItemAction_ConvertToWord:")
- public static let convertToExcelSelector = NSSelectorFromString("menuItemAction_ConvertToExcel:")
- public static let convertToPPTSelector = NSSelectorFromString("menuItemAction_ConvertToPPT:")
- public static let convertToRTFSelector = NSSelectorFromString("menuItemAction_ConvertToRTF:")
- public static let convertToHTMLSelector = NSSelectorFromString("menuItemAction_ConvertToHTML:")
- public static let convertToTextSelector = NSSelectorFromString("menuItemAction_ConvertToText:")
- public static let convertToCSVSelector = NSSelectorFromString("menuItemAction_ConvertToCSV:")
- public static let convertToImageSelector = NSSelectorFromString("menuItemAction_ConvertToImage:")
-
- public static let settingPasswordSelector = NSSelectorFromString("menuItemClick_SettingPassword:")
- public static let removePasswordSelector = NSSelectorFromString("menuItemClick_RemovePassword:")
-
- public static let closeWindowSelector = NSSelectorFromString("menuItemAction_closeWindow:")
- public static let closeAllWindowsSelector = NSSelectorFromString("menuItemAction_closeAllWindows:")
- public static let closeTagPageSelector = NSSelectorFromString("menuItemAction_closeTagPage:")
-
- public static let showInFinderSelector = NSSelectorFromString("menuItemAction_showInFinder:")
- public static let propertySelector = NSSelectorFromString("menuItemAction_property:")
-
- public static let printSelector = NSSelectorFromString("menuItemAction_print:")
-
- public static func actions() -> [Selector] {
- return [self.mergePDFSelector, self.compressSelector,
- // convert
- self.convertSelector, self.convertToWordSelector, self.convertToExcelSelector, self.convertToPPTSelector,
- self.convertToRTFSelector, self.convertToHTMLSelector, self.convertToTextSelector, self.convertToCSVSelector,
- self.convertToImageSelector,
- // secure
- self.settingPasswordSelector, self.removePasswordSelector,
- // other
- self.closeWindowSelector, self.closeAllWindowsSelector, self.closeTagPageSelector,
- self.showInFinderSelector, self.propertySelector,
- self.printSelector]
- }
- }
- extension KMSystemMenu.Edit {
- public static let findSelector = NSSelectorFromString("menuItemAction_find:")
- public static func actions() -> [Selector] {
- return [self.findSelector]
- }
- }
- extension KMSystemMenu.View {
- // scale
- public static let adjustWidthSelector = NSSelectorFromString("menuItemAction_adjustWidth:")
- public static let adjustPageSelector = NSSelectorFromString("menuItemAction_adjustPage:")
- public static let sizeSelector = NSSelectorFromString("menuItemAction_size:")
- public static let zoomOutSelector = NSSelectorFromString("menuItemAction_zoomOut:")
- public static let zoomInSelector = NSSelectorFromString("menuItemAction_zoomIn:")
- // page show
- public static let singlePageSelector = NSSelectorFromString("menuItemAction_singlePage:")
- public static let singlePageContinueSelector = NSSelectorFromString("menuItemAction_singlePageContinue:")
- public static let doublePageSelector = NSSelectorFromString("menuItemAction_doublePage:")
- public static let doublePageContinueSelector = NSSelectorFromString("menuItemAction_doublePageContinue:")
- public static let bookModeSelector = NSSelectorFromString("menuItemAction_bookMode:")
- public static let readModeSelector = NSSelectorFromString("menuItemAction_readMode:")
- public static let showSplitPageSelector = NSSelectorFromString("menuItemAction_showSplitPage:")
- public static let autoScrolSelector = NSSelectorFromString("menuItemAction_autoScrol:")
- public static let autoScrolSettingSelector = NSSelectorFromString("menuItemAction_autoScrolSetting:")
- // rotate
- public static let rotateLeftSelector = NSSelectorFromString("menuItemAction_rotateLeft:")
- public static let rotateRightSelector = NSSelectorFromString("menuItemAction_rotateRight:")
- public static let rotateAllPageLeftSelector = NSSelectorFromString("menuItemAction_rotateAllPageLeft:")
- public static let rotateAllPageRightSelector = NSSelectorFromString("menuItemAction_rotateAllPageRight:")
- // split screen
- public static let splitScreenVertiSelector = NSSelectorFromString("menuItemAction_splitScreenVerti:")
- public static let splitScreenHortiSelector = NSSelectorFromString("menuItemAction_splitScreenHorti:")
- public static let splitScreenNoSelector = NSSelectorFromString("menuItemAction_splitScreenNo:")
- public static let viewReadModeSelector = NSSelectorFromString("menuItemAction_view_readMode:")
- public static let enterFullScreenSelector = NSSelectorFromString("menuItemAction_enterFullScreen:")
-
- public static let hiddenLeftSideSelector = NSSelectorFromString("menuItemAction_hiddenLeftSide:")
- public static let hiddenRightSideSelector = NSSelectorFromString("menuItemAction_hiddenRightSide:")
- public static let thumaiSelector = NSSelectorFromString("menuItemAction_thumai:")
- public static let outlineSelector = NSSelectorFromString("menuItemAction_outline:")
- public static let bookmarkSelector = NSSelectorFromString("menuItemAction_bookmark:")
- public static let annotationSelector = NSSelectorFromString("menuItemAction_annotation:")
- public static let searchSelector = NSSelectorFromString("menuItemAction_search:")
-
- public static let topicSelector = NSSelectorFromString("menuItemAction_topic:")
- public static let hiddenPageIndicatorSelector = NSSelectorFromString("menuItemAction_hiddenPageIndicator:")
-
- public static func actions() -> [Selector] {
- return [self.adjustWidthSelector, self.adjustPageSelector, self.sizeSelector, self.zoomOutSelector, self.zoomInSelector,
- // page show
- self.singlePageSelector, self.singlePageContinueSelector, self.doublePageSelector, self.doublePageContinueSelector,
- self.bookModeSelector, self.readModeSelector, self.showSplitPageSelector, self.autoScrolSelector,
- self.autoScrolSettingSelector,
- // rotate
- self.rotateLeftSelector, self.rotateRightSelector, self.rotateAllPageLeftSelector, self.rotateAllPageRightSelector,
- // split screen
- self.splitScreenVertiSelector, self.splitScreenHortiSelector, self.splitScreenNoSelector,
- self.viewReadModeSelector, self.enterFullScreenSelector,
- self.hiddenLeftSideSelector, self.hiddenRightSideSelector,
- self.thumaiSelector, self.outlineSelector, self.bookmarkSelector, self.annotationSelector,
- self.searchSelector, self.topicSelector, self.hiddenPageIndicatorSelector]
- }
- }
- extension KMSystemMenu.Annotation {
- public static let highlightSelector = NSSelectorFromString("menuItemAction_highlight:")
- public static let underlineSelector = NSSelectorFromString("menuItemAction_underline:")
- public static let strikeOutSelector = NSSelectorFromString("menuItemAction_deleteLine:")
- public static let freehandSelector = NSSelectorFromString("menuItemAction_freehand:")
- public static let textSelector = NSSelectorFromString("menuItemAction_text:")
- public static let noteSelector = NSSelectorFromString("menuItemAction_note:")
- public static let squreSelector = NSSelectorFromString("menuItemAction_squre:")
- public static let circleSelector = NSSelectorFromString("menuItemAction_circle:")
- public static let arrowSelector = NSSelectorFromString("menuItemAction_arrow:")
- public static let lineSelector = NSSelectorFromString("menuItemAction_line:")
-
- public static let linkSelector = NSSelectorFromString("menuItemAction_link:")
- public static let linkPageSelector = NSSelectorFromString("menuItemAction_linkPage:")
- public static let linkHttpsSelector = NSSelectorFromString("menuItemAction_linkHttps:")
- public static let linkEmailSelector = NSSelectorFromString("menuItemAction_linkEmail:")
-
- public static let stampSelector = NSSelectorFromString("menuItemAction_stamp:")
- public static let stampStandardSelector = NSSelectorFromString("menuItemAction_stampStandard:")
- public static let stampDynamicSelector = NSSelectorFromString("menuItemAction_stampDynamic:")
- public static let stampCustomSelector = NSSelectorFromString("menuItemAction_stampCustom:")
-
- public static let signureSelector = NSSelectorFromString("menuItemAction_signure:")
- public static let hiddenAllSelector = NSSelectorFromString("menuItemAction_hiddenAllAnnotation:")
- public static let clearAllSelector = NSSelectorFromString("menuItemAction_clearAllAnnotation:")
-
- public static func actions() -> [Selector] {
- return [self.highlightSelector, self.underlineSelector, self.strikeOutSelector, self.freehandSelector,
- self.textSelector, self.noteSelector, self.squreSelector, self.circleSelector,
- self.arrowSelector, self.lineSelector,
- // link
- self.linkSelector, self.linkPageSelector, self.linkHttpsSelector, self.linkEmailSelector,
- // stamp
- self.stampSelector, self.stampStandardSelector, self.stampDynamicSelector, self.stampCustomSelector,
- // other
- self.signureSelector, self.hiddenAllSelector, self.clearAllSelector]
- }
- }
- extension KMSystemMenu.Goto {
- public static let nextPageSelector = NSSelectorFromString("menuItemAction_nextPage:")
- public static let forwardPageSelector = NSSelectorFromString("menuItemAction_forwardPage:")
- public static let firstPageSelector = NSSelectorFromString("menuItemAction_firstPage:")
- public static let lastPageSelector = NSSelectorFromString("menuItemAction_lastPage:")
- public static let forwardSelector = NSSelectorFromString("menuItemAction_forward:")
- public static let gobackSelector = NSSelectorFromString("menuItemAction_goback:")
- public static let gotoPageSelector = NSSelectorFromString("menuItemAction_gotoPage:")
-
- public static func actions() -> [Selector] {
- return [self.nextPageSelector, self.forwardPageSelector, self.firstPageSelector, self.lastPageSelector,
- self.forwardSelector, self.gobackSelector, self.gotoPageSelector]
- }
- }
- extension KMSystemMenu.Tool {
- public static let textToolSelector = NSSelectorFromString("menuItemAction_textTool:")
- public static let scrolToolSelector = NSSelectorFromString("menuItemAction_scrolTool:")
- public static let zoomToolSelector = NSSelectorFromString("menuItemAction_zoomOutTool:")
- public static let selectToolSelector = NSSelectorFromString("menuItemAction_selectTool:")
- public static let redactSelector = NSSelectorFromString("menuItemAction_redact:")
- public static let warkmarkSelector = NSSelectorFromString("menuItemAction_warkmark:")
- public static let backgroundSelector = NSSelectorFromString("menuItemAction_background:")
- public static let headerfooterSelector = NSSelectorFromString("menuItemAction_headerfooter:")
- public static let batesSelector = NSSelectorFromString("menuItemAction_bates:")
- public static let batchSelector = NSSelectorFromString("menuItemAction_batch:")
-
- public static func actions() -> [Selector] {
- return [self.textToolSelector, self.scrolToolSelector, self.zoomToolSelector, self.selectToolSelector,
- self.redactSelector, self.warkmarkSelector, self.backgroundSelector, self.headerfooterSelector,
- self.batesSelector, self.batchSelector]
- }
- }
- extension KMSystemMenu.Window {
- public static let showForwardTagPageSelector = NSSelectorFromString("menuItemAction_showForwardTagPage:")
- public static let showNextTagPageSelector = NSSelectorFromString("menuItemAction_showNextTagPage:")
- public static let newTagPageToNewWindowSelector = NSSelectorFromString("menuItemAction_newTagPageToNewWindow:")
- public static let mergeAllWindowSelector = NSSelectorFromString("menuItemAction_mergeAllWindow:")
- public static let currentWindowNameSelector = NSSelectorFromString("menuItemAction_currentWindowName:")
-
- public static func actions() -> [Selector] {
- return [self.showForwardTagPageSelector, self.showNextTagPageSelector,
- self.newTagPageToNewWindowSelector, self.mergeAllWindowSelector,
- self.currentWindowNameSelector]
- }
- }
- class KMSystemMenu: NSObject {
- public struct File {
-
- }
- public struct Edit {
-
- }
- public struct View {
-
- }
- public struct Annotation {
- }
- public struct Goto {
-
- }
- public struct Tool {
-
- }
- public struct Window {
-
- }
-
- public static func isFileSelector(sel: Selector) -> Bool {
- return KMSystemMenu.File.actions().contains(sel)
- }
- public static func isEditSelector(sel: Selector) -> Bool {
- return KMSystemMenu.Edit.actions().contains(sel)
- }
- public static func isViewSelector(sel: Selector) -> Bool {
- return KMSystemMenu.View.actions().contains(sel)
- }
- public static func isAnnotationSelector(sel: Selector) -> Bool {
- return KMSystemMenu.Annotation.actions().contains(sel)
- }
- public static func isGotoSelector(sel: Selector) -> Bool {
- return KMSystemMenu.Goto.actions().contains(sel)
- }
- public static func isToolSelector(sel: Selector) -> Bool {
- return KMSystemMenu.Tool.actions().contains(sel)
- }
- public static func isWindowSelector(sel: Selector) -> Bool {
- return KMSystemMenu.Window.actions().contains(sel)
- }
- }
|