KMBrowserWindowController.swift 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851
  1. //
  2. // KMBrowserWindowController.swift
  3. // PDF Master
  4. //
  5. // Created by wanjun on 2022/12/9.
  6. //
  7. import Cocoa
  8. @objcMembers class KMBrowserWindowController: CTBrowserWindowController {
  9. var rightSegmentControl: KMSegmentedBox?
  10. var modeType: KMHomeToolState = .Home
  11. var filterType: Int = 0
  12. var mainViewController: NSViewController?
  13. var isShowingTokenTimeOutAlert: Bool = false
  14. var currentTimer: Timer?
  15. private(set) var isMultiTabMode: Bool = false
  16. private var homeVC: KMHomeViewController?
  17. override func windowDidLoad() {
  18. super.windowDidLoad()
  19. NSImage.makeTextAlignImages()
  20. window?.backgroundColor = NSColor.km_init(hex: "#DFE1E5")
  21. // window?.setFrameAutosaveName("")
  22. rightTabStripView_.delete = self
  23. homeRightTabStripView_.delete = self
  24. rightTabStripView_.updateView()
  25. fileUploadPanel.delete = self
  26. homeRightTabStripView_.homeRightSearchField.delegate = self
  27. isMultiTabMode = true
  28. addObserverForAppearanceChange()
  29. refreshToolBar(homeToolState: .Home)
  30. NotificationCenter.default.addObserver(self, selector: #selector(closeAllTabs(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerCloseAllTabs"), object: nil)
  31. NotificationCenter.default.addObserver(self, selector: #selector(openNewWindow(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerOpenNewWindow"), object: nil)
  32. if (KMWelcomeWindowController.welcomeHasShow() == false) {
  33. //AI 版本禁掉首次开启帮助文档
  34. // KMTools.openQuickStartStudy()
  35. DispatchQueue.main.async {
  36. let welcome = KMWelcomeWindowController()
  37. self.km_beginSheet(windowC: welcome)
  38. welcome.itemClick = { [weak self] idx, param in
  39. if (idx == 1) { // 关闭
  40. self?.km_endSheet()
  41. } else if (idx == 2) { // 以后提醒
  42. self?.km_endSheet()
  43. } else if (idx == 3) { // 注册
  44. self?.km_endSheet()
  45. guard let window_ = self?.window else {
  46. return
  47. }
  48. _ = KMLoginWindowController.show(window: window_, .Batch, .register)
  49. }
  50. }
  51. }
  52. }
  53. }
  54. @objc func closeAction() {
  55. self.window?.performClose(nil)
  56. }
  57. override func windowShouldClose(_ sender: NSWindow) -> Bool {
  58. if self.browser.tabStripModel.count() > 1 {
  59. self.browser.windowDidBeginToClose()
  60. return false
  61. }
  62. return true
  63. }
  64. override func layoutSubviews() {
  65. super.layoutSubviews()
  66. if let button = (self.window as? CTBrowserWindow)?.standardWindowButton(.closeButton) {
  67. button.frame = NSMakeRect(button.frame.minX, 0, button.frame.width, button.frame.height)
  68. }
  69. if let button = (self.window as? CTBrowserWindow)?.standardWindowButton(.zoomButton) {
  70. button.frame = NSMakeRect(button.frame.minX, 0, button.frame.width, button.frame.height)
  71. }
  72. if let button = (self.window as? CTBrowserWindow)?.standardWindowButton(.miniaturizeButton) {
  73. button.frame = NSMakeRect(button.frame.minX, 0, button.frame.width, button.frame.height)
  74. }
  75. }
  76. // MARK: Dark&Light
  77. func addObserverForAppearanceChange() -> Void {
  78. window?.contentView!.addObserver(self, forKeyPath: "effectiveAppearance", options: .new, context: nil)
  79. }
  80. func removeObserverForAppearanceChange() -> Void {
  81. window?.contentView!.removeObserver(self, forKeyPath: "effectiveAppearance")
  82. }
  83. override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
  84. if keyPath == "effectiveAppearance" {
  85. updateViewColor()
  86. }
  87. }
  88. override func updateViewColor() {
  89. super.updateViewColor()
  90. window?.backgroundColor = KMTabAppearance.tabsViewBackgroundColor()
  91. }
  92. // MARK: Public Methods
  93. func refreshToolBar(homeToolState toolState: KMHomeToolState) -> Void {
  94. modeType = toolState
  95. let document = browser.activeTabContents()
  96. if document != nil {
  97. if document!.isHome {
  98. homeRightTabStripView_.isHidden = modeType == .Home
  99. } else {
  100. self.homeRightStripView.isHidden = true
  101. }
  102. } else {
  103. self.homeRightStripView.isHidden = true
  104. }
  105. homeRightTabStripView_.homeRefreshButton.isEnabled = true
  106. homeRightTabStripView_.homeUploadButton.isEnabled = true
  107. filterType = 0
  108. rightTabStripView_.sortPopUpButton.removeAllItems()
  109. rightTabStripView_.filterPopUpButton.removeAllItems()
  110. rightTabStripView_.updateView()
  111. }
  112. override var hasToolbar: Bool {
  113. get {
  114. return false
  115. }
  116. }
  117. var km_browser: KMBrowser? {
  118. get {
  119. return self.browser as? KMBrowser
  120. }
  121. }
  122. // MARK: Private Methods
  123. func openDocumentWindow() -> Void {
  124. // let panel = NSOpenPanel()
  125. // panel.allowsMultipleSelection = false
  126. // panel.allowedFileTypes = ["pdf"]
  127. // panel.beginSheetModal(for: NSApp.mainWindow!) { response in
  128. // if response == .OK {
  129. // let openPath = panel.url?.path
  130. // let selectDocument = self.selectTabContents(path: openPath!)
  131. // if selectDocument != nil {
  132. // let currentIndex = selectDocument!.browser.tabStripModel.index(of: selectDocument)
  133. // self.browser.tabStripModel.selectTabContents(at: Int32(currentIndex), userGesture: true)
  134. // return
  135. // }
  136. // if !panel.url!.path.isPDFValid() {
  137. // let alert = NSAlert()
  138. // alert.alertStyle = .critical
  139. // alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
  140. // alert.runModal()
  141. // return
  142. // }
  143. // NSDocumentController.shared.openDocument(withContentsOf: panel.url!, display: true) { pdfDocument, documentWasAlreadyOpen, error in
  144. // print("openDocumentWindow")
  145. // }
  146. // }
  147. // }
  148. // MARK TODO: + 号开启
  149. // self.browser.addHomeTabContents()
  150. self.km_browser?.addNewTabContents()
  151. }
  152. // override func openDocument(_ sender: Any!) {
  153. // self.openDocumentWindow()
  154. // }
  155. func selectTabContents(path filePath: String) -> KMMainDocument? {
  156. let document = NSDocumentController.shared.document(for: URL(fileURLWithPath: filePath))
  157. var selectDocument: KMMainDocument?
  158. if document != nil {
  159. if document!.isKind(of: KMMainDocument.self) {
  160. selectDocument = document as! KMMainDocument
  161. }
  162. }
  163. return selectDocument
  164. }
  165. // MARK: Getter
  166. override var rightStripView: NSView! {
  167. get {
  168. return rightTabStripView_
  169. }
  170. }
  171. override var homeRightStripView: NSView! {
  172. get {
  173. return homeRightTabStripView_
  174. }
  175. }
  176. // MARK: Button Action
  177. func commandDispatch(_ sender: Any) -> Void {
  178. openDocumentWindow()
  179. }
  180. func closeAllTabs(_ sender: Any) -> Void {
  181. if self.browser != nil {
  182. self.browser.closeAllTabs()
  183. }
  184. }
  185. func openNewWindow(_ sender: Any) -> Void {
  186. if let noti = sender as? NSNotification, noti.object is CTTabController {
  187. if let window_ = (noti.object as! CTTabController).view.window, window_.isEqual(to: self.window) == false {
  188. return
  189. }
  190. }
  191. if self.browser != nil {
  192. let activeInt = self.browser.activeTabIndex()
  193. let activeTab = self.browser.activeTabContents()
  194. self.browser.closeTab(at: activeInt, makeHistory: false)
  195. let browser: KMBrowser = KMBrowser.init()
  196. browser.windowController = KMBrowserWindowController.init(browser: browser)
  197. browser.addHomeTabContents()
  198. browser.windowController.showWindow(self)
  199. // browser.add(activeTab, inForeground: false)
  200. // browser.selectTab(at: 1)
  201. if activeTab?.fileURL == nil {
  202. return
  203. }
  204. let pdfDoc = CPDFDocument.init(url: (activeTab?.fileURL)!)
  205. let document = NSDocumentController.shared.document(for: (activeTab?.fileURL)!)
  206. KMMainDocument().tryToUnlockDocument(pdfDoc!)
  207. if ((pdfDoc?.isLocked)! == true) {
  208. KMPasswordInputWindow.openWindow(window: self.window!, url: (activeTab?.fileURL)!) { result, password in
  209. if result == .cancel { /// 关闭
  210. return
  211. }
  212. /// 解密成功
  213. var selectDocument: KMMainDocument? = nil
  214. if ((document?.isKind(of: KMMainDocument.self)) != nil) {
  215. selectDocument = (document as! KMMainDocument)
  216. }
  217. if selectDocument != nil {
  218. let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
  219. selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
  220. if (selectDocument?.browser.window.isVisible)! as Bool {
  221. selectDocument?.browser.window.orderFront(nil)
  222. } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
  223. selectDocument?.browser.window.orderFront(nil)
  224. }
  225. } else {
  226. NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { document, _, error in
  227. if (error == nil) {
  228. (document as! KMMainDocument).mainViewController?.password = password
  229. }
  230. }
  231. }
  232. }
  233. } else {
  234. var selectDocument: KMMainDocument? = nil
  235. if ((document?.isKind(of: KMMainDocument.self)) != nil) {
  236. selectDocument = (document as! KMMainDocument)
  237. }
  238. if selectDocument != nil {
  239. let currentIndex = selectDocument?.browser.tabStripModel.index(of: selectDocument)
  240. selectDocument?.browser.tabStripModel.selectTabContents(at: Int32(currentIndex!), userGesture: true)
  241. if (selectDocument?.browser.window.isVisible)! as Bool {
  242. selectDocument?.browser.window.orderFront(nil)
  243. } else if (selectDocument?.browser.window.isMiniaturized)! as Bool {
  244. selectDocument?.browser.window.orderFront(nil)
  245. }
  246. } else {
  247. NSDocumentController.shared.km_safe_openDocument(withContentsOf: (activeTab?.fileURL)!, display: true) { _, _, _ in
  248. }
  249. }
  250. }
  251. }
  252. }
  253. func canMergeAllWindow() -> Bool {
  254. return self.fetchBrowserWindowControllers().count > 0
  255. }
  256. fileprivate func fetchBrowserWindowControllers() -> [KMBrowserWindowController] {
  257. var windowArray: [KMBrowserWindowController] = []
  258. for window in NSApp.windows {
  259. guard let windowController = window.windowController, windowController is KMBrowserWindowController else {
  260. continue
  261. }
  262. if let _tabScripC = (windowController as? KMBrowserWindowController)?.tabStripController, _tabScripC.viewsCount() <= 1 {
  263. continue
  264. }
  265. if (window.isVisible && (windowController.isEqual(to: self) == false)) {
  266. windowArray.append(windowController as! KMBrowserWindowController)
  267. }
  268. }
  269. return windowArray
  270. }
  271. func mergeAllWindow(_ sender: Any) {
  272. let windowArray = self.fetchBrowserWindowControllers()
  273. if (windowArray.count <= 0) {
  274. return
  275. }
  276. for windowC in windowArray {
  277. // 拼接窗口 [拼接窗口里的标签,除了home标签]
  278. self.append(windowC, toTabView: NSView())
  279. if let browser = windowC.browser {
  280. if (browser.tabCount() <= 1 && browser.activeTabContents().isHome) {
  281. windowC.close()
  282. }
  283. }
  284. }
  285. }
  286. override func tabDidSelect(_ notification: Notification!) {
  287. super.tabDidSelect(notification)
  288. if let _userInfo = notification.userInfo, let _newContents = _userInfo[CTTabNewContentsUserInfoKey] as? KMMainDocument {
  289. _newContents.addWindowController(self)
  290. }
  291. }
  292. override func layoutTabContentArea(_ frame: NSRect) {
  293. super.layoutTabContentArea(frame)
  294. self.rightStripView.autoresizingMask = [.minXMargin, .minYMargin]
  295. }
  296. override func openDocument(_ sender: Any!) {
  297. guard let _window = self.window else {
  298. return
  299. }
  300. NSOpenPanel.km_open_pdf_multi_success(_window, panel: nil) { urls in
  301. for url in urls {
  302. NSDocumentController.shared.km_safe_openDocument(withContentsOf: url, display: true) { _, _, _ in
  303. }
  304. }
  305. }
  306. }
  307. }
  308. // MARK: - KMToolbarRightViewDelegate
  309. extension KMBrowserWindowController: KMToolbarRightViewDelegate {
  310. func pdfRightSegmentedControlAction(_ sender: KMSegmentedBox?) {
  311. self.trackEvent_upgrade()
  312. KMComparativeTableViewController.show(window: self.window!, .upgrade)
  313. }
  314. func userInfoButtonAction(_ sender: NSButton) {
  315. if KMLightMemberManager.manager.isLogin() {
  316. Task { @MainActor in
  317. if await KMLightMemberManager.manager.canUseAdvanced(needNetworking: true) {
  318. KMAccountInfoWindowController.show(window: self.window!)
  319. } else {
  320. KMLoginWindowController.show(window: self.window!)
  321. }
  322. }
  323. } else {
  324. KMLoginWindowController.show(window: self.window!)
  325. }
  326. }
  327. func homeRefreshButtonAction(_ sender: NSButton?) {
  328. self.layoutSubviews()
  329. }
  330. func homeUploadButtonAction(_ sender: NSButton) {
  331. }
  332. func homeMenuSortAction(_ sender: NSPopUpButton) {
  333. }
  334. func homeMenuFilterAction(_ sender: NSPopUpButton) {
  335. }
  336. }
  337. // MARK: - KMUploadFileDelegate
  338. extension KMBrowserWindowController: KMUploadFileDelegate {
  339. // override func cancelOperation(_ sender: Any?) {
  340. //
  341. // }
  342. }
  343. // MARK: - NSSearchFieldDelegate
  344. extension KMBrowserWindowController: NSSearchFieldDelegate {
  345. func controlTextDidChange(_ obj: Notification) {
  346. }
  347. func controlTextDidEndEditing(_ obj: Notification) {
  348. }
  349. func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
  350. var result = false
  351. return result
  352. }
  353. }
  354. // MARK: -
  355. // MARK: Menu Actions
  356. extension KMBrowserWindowController {
  357. func canResponseDocumentAction() -> Bool {
  358. if (self.browser == nil) {
  359. return false
  360. }
  361. guard let _ = self.browser.activeTabContents() as? KMMainDocument else {
  362. return false
  363. }
  364. return true
  365. }
  366. }
  367. // MARK: -
  368. // MARK: File Menu
  369. extension KMBrowserWindowController: NSMenuDelegate, NSMenuItemValidation {
  370. func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
  371. if (self.browser == nil) {
  372. return false
  373. }
  374. guard let action = menuItem.action else {
  375. return false
  376. }
  377. guard let document = self.browser.activeTabContents() as? KMMainDocument else {
  378. return false
  379. }
  380. if (KMSystemMenu.isFileSelector(sel: action)) {
  381. if (document.isHome) {
  382. if (menuItem.action == KMSystemMenu.File.closeTagPageSelector ||
  383. menuItem.action == KMSystemMenu.File.propertySelector ||
  384. menuItem.action == KMSystemMenu.File.showInFinderSelector ||
  385. menuItem.action == KMSystemMenu.File.printSelector ||
  386. menuItem.action == KMSystemMenu.File.saveAsFlattenedPDFSelector) {
  387. return false
  388. }
  389. return document.homeViewController!.validateMenuItem(menuItem)
  390. } else {
  391. return document.mainViewController!.validateMenuItem(menuItem)
  392. }
  393. }
  394. if (KMSystemMenu.isEditSelector(sel: action)) {
  395. return document.isHome ? false : document.mainViewController!.validateMenuItem(menuItem)
  396. }
  397. if (KMSystemMenu.isViewSelector(sel: action)) {
  398. return document.isHome ? false : document.mainViewController!.validateMenuItem(menuItem)
  399. }
  400. if (KMSystemMenu.isAnnotationSelector(sel: action)) {
  401. return document.isHome ? false : document.mainViewController!.validateMenuItem(menuItem)
  402. }
  403. if (KMSystemMenu.isGotoSelector(sel: action)) {
  404. return document.isHome ? false : document.mainViewController!.validateMenuItem(menuItem)
  405. }
  406. if (KMSystemMenu.isToolSelector(sel: action)) {
  407. return document.isHome ? false : document.mainViewController!.validateMenuItem(menuItem)
  408. }
  409. if (KMSystemMenu.isWindowSelector(sel: action)) {
  410. return document.isHome ? document.homeViewController!.validateMenuItem(menuItem) : document.mainViewController!.validateMenuItem(menuItem)
  411. }
  412. return true
  413. }
  414. }
  415. extension KMBrowserWindowController {
  416. @IBAction func menuItemAction_openFile(_ sender: Any) {
  417. super.openDocument(sender)
  418. }
  419. @IBAction func importFromFile(_ sender: Any) {
  420. let document: KMMainDocument = self.browser.activeTabContents() as! KMMainDocument
  421. if (document.isHome) {
  422. document.homeViewController?.importFromFile(sender)
  423. } else {
  424. self.homeVC = KMHomeViewController()
  425. self.homeVC?.importFromFile(sender)
  426. }
  427. }
  428. @IBAction func openBlankPage(_ sender: Any) {
  429. let document: KMMainDocument = self.browser.activeTabContents() as! KMMainDocument
  430. if (document.isHome) {
  431. document.homeViewController?.openBlankPage()
  432. } else {
  433. self.homeVC = KMHomeViewController()
  434. self.homeVC?.openBlankPage()
  435. }
  436. }
  437. @IBAction func importFromScanner(_ sender: Any) {
  438. let document: KMMainDocument = self.browser.activeTabContents() as! KMMainDocument
  439. if (document.isHome) {
  440. document.homeViewController?.importFromScanner()
  441. } else {
  442. self.homeVC = KMHomeViewController()
  443. self.homeVC?.importFromScanner()
  444. }
  445. }
  446. @IBAction func menuItemAction_newTab(_ sender: Any) {
  447. self.openDocumentWindow()
  448. }
  449. /// New
  450. @IBAction func newDocumentFromClipboard(_ sender: Any?) {
  451. KMPrint("newDocumentFromClipboard")
  452. }
  453. @IBAction func newDocumentFromImage(_ sender: Any?) {
  454. KMPrint("importFromWebPage")
  455. }
  456. @IBAction func importFromWebPage(_ sender: Any?) {
  457. KMPrint("importFromWebPage")
  458. }
  459. /// screenShot
  460. @IBAction func screenShot_SelectArea(_ sender: Any?) {
  461. KMPrint("screenShot_SelectArea")
  462. }
  463. @IBAction func screenShot_Window(_ sender: Any?) {
  464. KMPrint("screenShot_Window")
  465. }
  466. @IBAction func screenShot_FullScreenDelay(_ sender: Any?) {
  467. KMPrint("screenShot_FullScreenDelay")
  468. }
  469. @IBAction func screenShot_FullScreen(_ sender: Any?) {
  470. KMPrint("screenShot_FullScreen")
  471. }
  472. @IBAction func pasteAsPlainText(_ sender: Any?) {
  473. KMPrint("pasteAsPlainText")
  474. }
  475. @IBAction func deselectAll(_ sender: Any?) {
  476. KMPrint("deselectAll")
  477. }
  478. @IBAction func searchPDF(_ sender: Any?) {
  479. KMPrint("searchPDF")
  480. }
  481. @IBAction func notesLink(_ sender: Any?) {
  482. KMPrint("notesLink")
  483. }
  484. @IBAction func notesStamp(_ sender: Any?) {
  485. KMPrint("notesStamp")
  486. }
  487. @IBAction func selectToolModel(_ sender: Any?) {
  488. KMPrint("selectToolModel")
  489. }
  490. @IBAction func table(_ sender: Any?) {
  491. KMPrint("table ...")
  492. }
  493. @IBAction func image(_ sender: Any?) {
  494. KMPrint("image ...")
  495. }
  496. @IBAction func addForm(_ sender: Any?) {
  497. KMPrint("addForm ...")
  498. }
  499. @IBAction func editNote(_ sender: Any?) {
  500. KMPrint("editNote ...")
  501. }
  502. @IBAction func togglePresentation(_ sender: Any?) {
  503. KMPrint("togglePresentation ...")
  504. }
  505. @IBAction func chooseTransition(_ sender: Any?) {
  506. KMPrint("chooseTransition ...")
  507. }
  508. @IBAction func toggleAutoFlow(_ sender: Any?) {
  509. KMPrint("toggleAutoFlow ...")
  510. }
  511. @IBAction func chooseAutoFlowSetting(_ sender: Any?) {
  512. KMPrint("chooseAutoFlowSetting ...")
  513. }
  514. @IBAction func toggleReadingBar(_ sender: Any?) {
  515. KMPrint("toggleReadingBar ...")
  516. }
  517. @IBAction func toggleLeftSidePane(_ sender: Any?) {
  518. KMPrint("toggleLeftSidePane ...")
  519. }
  520. @IBAction func changeLeftSidePaneState(_ sender: Any?) {
  521. KMPrint("changeLeftSidePaneState ...")
  522. }
  523. @IBAction func splitViewAction(_ sender: Any?) {
  524. KMPrint("splitViewAction ...")
  525. }
  526. @IBAction func themesColor(_ sender: Any?) {
  527. KMPrint("themesColor ...")
  528. }
  529. @IBAction func toggleStatusBar(_ sender: Any?) {
  530. KMPrint("toggleStatusBar ...")
  531. }
  532. @IBAction func toggleToolbarShow(_ sender: Any?) {
  533. KMPrint("toggleToolbarShow ...")
  534. }
  535. @IBAction func changeDisplayMode(_ sender: Any?) {
  536. KMPrint("changeDisplayMode ...")
  537. }
  538. @IBAction func toggleDisplayAsBook(_ sender: Any?) {
  539. KMPrint("toggleDisplayAsBook ...")
  540. }
  541. @IBAction func toggleDisplayPageBreaks(_ sender: Any?) {
  542. KMPrint("toggleDisplayPageBreaks ...")
  543. }
  544. @IBAction func changeDisplayBox(_ sender: Any?) {
  545. KMPrint("changeDisplayBox ...")
  546. }
  547. @IBAction func changeColor(_ sender: Any?) {
  548. KMPrint("changeColor ...")
  549. }
  550. @IBAction func changeFont(_ sender: Any?) {
  551. KMPrint("changeFont ...")
  552. }
  553. @IBAction func changeAttributes(_ sender: Any?) {
  554. KMPrint("changeAttributes ...")
  555. }
  556. @IBAction func alignLeft(_ sender: Any?) {
  557. KMPrint("alignLeft ...")
  558. }
  559. @IBAction func alignRight(_ sender: Any?) {
  560. KMPrint("alignRight ...")
  561. }
  562. @IBAction func alignCenter(_ sender: Any?) {
  563. KMPrint("alignCenter ...")
  564. }
  565. @IBAction func createNewNote(_ sender: Any?) {
  566. KMPrint("createNewNote ...")
  567. }
  568. @IBAction func toggleHideNotes(_ sender: Any?) {
  569. KMPrint("toggleHideNotes ...")
  570. }
  571. @IBAction func takeSnapshot(_ sender: Any?) {
  572. KMPrint("takeSnapshot ...")
  573. }
  574. @IBAction func takeSnapshotSelectContent(_ sender: Any?) {
  575. KMPrint("takeSnapshotSelectContent ...")
  576. }
  577. @IBAction func changeDisplaySinglePages(_ sender: Any?) {
  578. KMPrint("changeDisplaySinglePages ...")
  579. }
  580. @IBAction func changeDisplayContinuous(_ sender: Any?) {
  581. KMPrint("changeDisplayContinuous ...")
  582. }
  583. @IBAction func doGoToNextPage(_ sender: Any?) {
  584. KMPrint("doGoToNextPage ...")
  585. }
  586. @IBAction func doGoToPreviousPage(_ sender: Any?) {
  587. KMPrint("doGoToPreviousPage ...")
  588. }
  589. @IBAction func doGoToFirstPage(_ sender: Any?) {
  590. KMPrint("doGoToFirstPage ...")
  591. }
  592. @IBAction func doGoToLastPage(_ sender: Any?) {
  593. KMPrint("doGoToLastPage ...")
  594. }
  595. @IBAction func allGoToNextPage(_ sender: Any?) {
  596. KMPrint("allGoToNextPage ...")
  597. }
  598. @IBAction func allGoToPreviousPage(_ sender: Any?) {
  599. KMPrint("allGoToPreviousPage ...")
  600. }
  601. @IBAction func allGoToFirstPage(_ sender: Any?) {
  602. KMPrint("allGoToFirstPage ...")
  603. }
  604. @IBAction func allGoToLastPage(_ sender: Any?) {
  605. KMPrint("allGoToLastPage ...")
  606. }
  607. @IBAction func doGoToPage(_ sender: Any?) {
  608. KMPrint("doGoToPage ...")
  609. }
  610. @IBAction func doGoBack(_ sender: Any?) {
  611. KMPrint("doGoBack ...")
  612. }
  613. @IBAction func doGoForward(_ sender: Any?) {
  614. KMPrint("doGoForward ...")
  615. }
  616. @IBAction func goToMarkedPage(_ sender: Any?) {
  617. KMPrint("goToMarkedPage ...")
  618. }
  619. @IBAction func markPage(_ sender: Any?) {
  620. KMPrint("markPage ...")
  621. }
  622. @IBAction func doZoomIn(_ sender: Any?) {
  623. KMPrint("doZoomIn ...")
  624. }
  625. @IBAction func doZoomOut(_ sender: Any?) {
  626. KMPrint("doZoomOut ...")
  627. }
  628. @IBAction func doZoomToActualSize(_ sender: Any?) {
  629. KMPrint("doZoomToActualSize ...")
  630. }
  631. @IBAction func doZoomToPhysicalSize(_ sender: Any?) {
  632. KMPrint("doZoomToPhysicalSize ...")
  633. }
  634. @IBAction func doZoomToFit(_ sender: Any?) {
  635. KMPrint("doZoomToFit ...")
  636. }
  637. @IBAction func alternateZoomToFit(_ sender: Any?) {
  638. KMPrint("alternateZoomToFit ...")
  639. }
  640. @IBAction func doZoomToSelection(_ sender: Any?) {
  641. KMPrint("doZoomToSelection ...")
  642. }
  643. @IBAction func doMarqueeZoomTool(_ sender: Any?) {
  644. KMPrint("doMarqueeZoomTool ...")
  645. }
  646. @IBAction func doAutoScale(_ sender: Any?) {
  647. KMPrint("doAutoScale ...")
  648. }
  649. @IBAction func toggleAutoScale(_ sender: Any?) {
  650. KMPrint("toggleAutoScale ...")
  651. }
  652. @IBAction func rotateRight(_ sender: Any?) {
  653. KMPrint("rotateRight ...")
  654. }
  655. @IBAction func rotateLeft(_ sender: Any?) {
  656. KMPrint("rotateLeft ...")
  657. }
  658. @IBAction func rotateAllRight(_ sender: Any?) {
  659. KMPrint("rotateAllRight ...")
  660. }
  661. @IBAction func rotateAllLeft(_ sender: Any?) {
  662. KMPrint("rotateAllLeft ...")
  663. }
  664. @IBAction func crop(_ sender: Any?) {
  665. KMPrint("crop ...")
  666. }
  667. @IBAction func cropAll(_ sender: Any?) {
  668. KMPrint("cropAll ...")
  669. }
  670. @IBAction func autoCropAll(_ sender: Any?) {
  671. KMPrint("autoCropAll ...")
  672. }
  673. @IBAction func smartAutoCropAll(_ sender: Any?) {
  674. KMPrint("smartAutoCropAll ...")
  675. }
  676. @IBAction func cropOptionsModel(_ sender: Any?) {
  677. KMPrint("cropOptionsModel ...")
  678. }
  679. @IBAction func autoSelectContent(_ sender: Any?) {
  680. KMPrint("autoSelectContent ...")
  681. }
  682. @IBAction func getInfo(_ sender: Any?) {
  683. KMPrint("getInfo ...")
  684. }
  685. // @IBAction func delete(_ sender: Any?) {
  686. // KMPrint("delete ...")
  687. // }
  688. // @IBAction func paste(_ sender: Any?) {
  689. // KMPrint("paste ...")
  690. // }
  691. @IBAction func alternatePaste(_ sender: Any?) {
  692. KMPrint("alternatePaste ...")
  693. }
  694. @IBAction func copy(_ sender: Any?) {
  695. KMPrint("copy ...")
  696. }
  697. @IBAction func cut(_ sender: Any?) {
  698. KMPrint("cut ...")
  699. }
  700. @IBAction func changeToolMode(_ sender: Any?) {
  701. KMPrint("changeToolMode ...")
  702. }
  703. @IBAction func changeAnnotationMode(_ sender: Any?) {
  704. KMPrint("changeAnnotationMode ...")
  705. }
  706. @IBAction func toggleFullscreen(_ sender: Any?) {
  707. KMPrint("toggleFullscreen ...")
  708. }
  709. @IBAction func toggleRightSidePane(_ sender: Any?) {
  710. KMPrint("toggleRightSidePane ...")
  711. }
  712. @IBAction func performFit(_ sender: Any?) {
  713. KMPrint("performFit ...")
  714. }
  715. @IBAction func changeRightSidePaneState(_ sender: Any?) {
  716. KMPrint("changeRightSidePaneState ...")
  717. }
  718. @IBAction func changeFindPaneState(_ sender: Any?) {
  719. KMPrint("changeFindPaneState ...")
  720. }
  721. @IBAction func toggleSplitPDF(_ sender: Any?) {
  722. KMPrint("toggleSplitPDF ...")
  723. }
  724. @IBAction func search(_ sender: Any?) {
  725. KMPrint("search ...")
  726. }
  727. @IBAction func searchNotes(_ sender: Any?) {
  728. KMPrint("searchNotes ...")
  729. }
  730. @IBAction func password(_ sender: Any?) {
  731. KMPrint("password ...")
  732. }
  733. @IBAction func savePDFSettingToDefaults(_ sender: Any?) {
  734. KMPrint("savePDFSettingToDefaults ...")
  735. }
  736. @IBAction func toggleCaseInsensitiveSearch(_ sender: Any?) {
  737. KMPrint("toggleCaseInsensitiveSearch ...")
  738. }
  739. @IBAction func toggleWholeWordSearch(_ sender: Any?) {
  740. KMPrint("toggleWholeWordSearch ...")
  741. }
  742. @IBAction func toggleCaseInsensitiveNoteSearch(_ sender: Any?) {
  743. KMPrint("toggleCaseInsensitiveNoteSearch ...")
  744. }
  745. @IBAction func performFindPanelAction(_ sender: Any?) {
  746. KMPrint("performFindPanelAction ...")
  747. }
  748. @IBAction func scrollUp(_ sender: Any?) {
  749. KMPrint("scrollUp ...")
  750. }
  751. @IBAction func scrollDown(_ sender: Any?) {
  752. KMPrint("scrollDown ...")
  753. }
  754. @IBAction func scrollRight(_ sender: Any?) {
  755. KMPrint("scrollRight ...")
  756. }
  757. @IBAction func scrollLeft(_ sender: Any?) {
  758. KMPrint("scrollLeft ...")
  759. }
  760. @IBAction func selectSelectedNote(_ sender: Any?) {
  761. KMPrint("selectSelectedNote ...")
  762. }
  763. @IBAction func goToSelectedOutlineItem(_ sender: Any?) {
  764. KMPrint("goToSelectedOutlineItem ...")
  765. }
  766. @IBAction func goToSelectedFindResults(_ sender: Any?) {
  767. KMPrint("goToSelectedFindResults ...")
  768. }
  769. @IBAction func toggleSelectedSnapshots(_ sender: Any?) {
  770. KMPrint("toggleSelectedSnapshots ...")
  771. }
  772. @IBAction func selfSignProfile(_ sender: Any?) {
  773. KMPrint("selfSignProfile ...")
  774. }
  775. @IBAction func highlightFormFiled(_ sender: Any?) {
  776. KMPrint("highlightFormFiled ...")
  777. }
  778. @IBAction func highlightLinks(_ sender: Any?) {
  779. KMPrint("highlightLinks ...")
  780. }
  781. @IBAction func resetForm(_ sender: Any?) {
  782. KMPrint("resetForm ...")
  783. }
  784. @IBAction func removeAllAnnotation(_ sender: Any?) {
  785. KMPrint("removeAllAnnotation ...")
  786. }
  787. @IBAction func link(_ sender: Any?) {
  788. KMPrint("link ...")
  789. }
  790. @IBAction func addWatermark(_ sender: Any?) {
  791. KMPrint("addWatermark ...")
  792. }
  793. @IBAction func convert(_ sender: Any?) {
  794. KMPrint("convert ...")
  795. }
  796. @IBAction func imageToPDF(_ sender: Any?) {
  797. KMPrint("imageToPDF ...")
  798. }
  799. @IBAction func pageEdit(_ sender: Any?) {
  800. KMPrint("pageEdit ...")
  801. }
  802. @IBAction func ocr(_ sender: Any?) {
  803. KMPrint("ocr ...")
  804. }
  805. @IBAction func insertPage(_ sender: Any?) {
  806. KMPrint("insertPage ...")
  807. }
  808. @IBAction func merge(_ sender: Any?) {
  809. KMPrint("merge ...")
  810. }
  811. @IBAction func split(_ sender: Any?) {
  812. KMPrint("split ...")
  813. }
  814. @IBAction func compression(_ sender: Any?) {
  815. KMPrint("compression ...")
  816. }
  817. @IBAction func comparison(_ sender: Any?) {
  818. KMPrint("comparison ...")
  819. }
  820. @IBAction func contentComparison(_ sender: Any?) {
  821. KMPrint("contentComparison ...")
  822. }
  823. @IBAction func coverageComparison(_ sender: Any?) {
  824. KMPrint("coverageComparison ...")
  825. }
  826. @IBAction func extractImage(_ sender: Any?) {
  827. KMPrint("extractImage ...")
  828. }
  829. @IBAction func security(_ sender: Any?) {
  830. KMPrint("security ...")
  831. }
  832. @IBAction func addBackground(_ sender: Any?) {
  833. KMPrint("addBackground ...")
  834. }
  835. @IBAction func removeBackground(_ sender: Any?) {
  836. KMPrint("removeBackground ...")
  837. }
  838. @IBAction func addHeaderFooter(_ sender: Any?) {
  839. KMPrint("addHeaderFooter ...")
  840. }
  841. @IBAction func removeHeaderFooter(_ sender: Any?) {
  842. KMPrint("removeHeaderFooter ...")
  843. }
  844. @IBAction func addHeaderFooterBates(_ sender: Any?) {
  845. KMPrint("addHeaderFooterBates ...")
  846. }
  847. @IBAction func removeHeaderFooterBates(_ sender: Any?) {
  848. KMPrint("removeHeaderFooterBates ...")
  849. }
  850. @IBAction func editWatermark(_ sender: Any?) {
  851. KMPrint("editWatermark ...")
  852. }
  853. @IBAction func batchAddWatermark(_ sender: Any?) {
  854. KMPrint("batchAddWatermark ...")
  855. }
  856. @IBAction func batchRemoveWatermark(_ sender: Any?) {
  857. KMPrint("batchRemoveWatermark ...")
  858. }
  859. @IBAction func removeWatermark(_ sender: Any?) {
  860. KMPrint("removeWatermark ...")
  861. }
  862. @IBAction func templateWatermark(_ sender: Any?) {
  863. KMPrint("templateWatermark ...")
  864. }
  865. @IBAction func batchAddBackground(_ sender: Any?) {
  866. KMPrint("batchAddBackground ...")
  867. }
  868. @IBAction func batchRemoveBackground(_ sender: Any?) {
  869. KMPrint("batchRemoveBackground ...")
  870. }
  871. @IBAction func templateBackground(_ sender: Any?) {
  872. KMPrint("templateBackground ...")
  873. }
  874. @IBAction func batchAddHeaderFooter(_ sender: Any?) {
  875. KMPrint("batchAddHeaderFooter ...")
  876. }
  877. @IBAction func batchRemoveHeaderFooter(_ sender: Any?) {
  878. KMPrint("batchRemoveHeaderFooter ...")
  879. }
  880. @IBAction func templateHeaderFooter(_ sender: Any?) {
  881. KMPrint("templateHeaderFooter ...")
  882. }
  883. @IBAction func batchAddBates(_ sender: Any?) {
  884. KMPrint("batchAddBates ...")
  885. }
  886. @IBAction func batchRemoveBates(_ sender: Any?) {
  887. KMPrint("batchRemoveBates ...")
  888. }
  889. @IBAction func templateBates(_ sender: Any?) {
  890. KMPrint("templateBates ...")
  891. }
  892. @IBAction func togglePoster(_ sender: Any?) {
  893. KMPrint("togglePoster ...")
  894. }
  895. @IBAction func toggleMultiple(_ sender: Any?) {
  896. KMPrint("toggleMultiple ...")
  897. }
  898. @IBAction func toggleBooklet(_ sender: Any?) {
  899. KMPrint("toggleBooklet ...")
  900. }
  901. @IBAction func decryption(_ sender: Any?) {
  902. KMPrint("decryption ...")
  903. }
  904. @IBAction func readMode(_ sender: Any?) {
  905. KMPrint("readMode ...")
  906. }
  907. @IBAction func changeFormType(_ sender: Any?) {
  908. KMPrint("changeFormType ...")
  909. }
  910. @IBAction func changeSelfSignType(_ sender: Any?) {
  911. KMPrint("changeSelfSignType ...")
  912. }
  913. @IBAction func clearAllForm(_ sender: Any?) {
  914. KMPrint("clearAllForm ...")
  915. }
  916. @IBAction func thumbnailSizeScaling(_ sender: Any?) {
  917. KMPrint("thumbnailSizeScaling ...")
  918. }
  919. @IBAction func textEditAction(_ sender: Any?) {
  920. KMPrint("textEditAction ...")
  921. }
  922. @IBAction func redactAction(_ sender: Any?) {
  923. KMPrint("redactAction ...")
  924. }
  925. }
  926. // MARK: - KMSystemFileMenuProtocol
  927. extension KMBrowserWindowController: KMSystemFileMenuProtocol {
  928. func menuItemClick_saveAsFlattenedPDF(_ sender: Any) {
  929. if (self.canResponseDocumentAction() == false) {
  930. return
  931. }
  932. if let document = self.browser.activeTabContents() as? KMMainDocument {
  933. if (document.isHome) {
  934. // document.homeViewController?.menuItemClick_mergePDF(sender)
  935. } else {
  936. document.mainViewController?.menuItemClick_saveAsFlattenedPDF(sender)
  937. }
  938. }
  939. }
  940. func menuItemClick_mergePDF(_ sender: Any) {
  941. if (self.canResponseDocumentAction() == false) {
  942. return
  943. }
  944. if let document = self.browser.activeTabContents() as? KMMainDocument {
  945. if (document.isHome) {
  946. document.homeViewController?.menuItemClick_mergePDF(sender)
  947. } else {
  948. document.mainViewController?.menuItemClick_mergePDF(sender)
  949. }
  950. }
  951. }
  952. func menuItemClick_Compress(_ sender: Any) {
  953. if (self.canResponseDocumentAction() == false) {
  954. return
  955. }
  956. if let document = self.browser.activeTabContents() as? KMMainDocument {
  957. if (document.isHome) {
  958. document.homeViewController?.menuItemClick_Compress(sender)
  959. } else {
  960. document.mainViewController?.menuItemClick_Compress(sender)
  961. }
  962. }
  963. }
  964. func menuItemAction_ConvertToWord(_ sender: Any) {
  965. if (self.canResponseDocumentAction() == false) {
  966. return
  967. }
  968. if let document = self.browser.activeTabContents() as? KMMainDocument {
  969. if (document.isHome) {
  970. document.homeViewController?.menuItemAction_ConvertToWord(sender)
  971. } else {
  972. document.mainViewController?.menuItemAction_ConvertToWord(sender)
  973. }
  974. }
  975. }
  976. func menuItemAction_ConvertToExcel(_ sender: Any) {
  977. if (self.canResponseDocumentAction() == false) {
  978. return
  979. }
  980. if let document = self.browser.activeTabContents() as? KMMainDocument {
  981. if (document.isHome) {
  982. document.homeViewController?.menuItemAction_ConvertToExcel(sender)
  983. } else {
  984. document.mainViewController?.menuItemAction_ConvertToExcel(sender)
  985. }
  986. }
  987. }
  988. func menuItemAction_ConvertToPPT(_ sender: Any) {
  989. if (self.canResponseDocumentAction() == false) {
  990. return
  991. }
  992. if let document = self.browser.activeTabContents() as? KMMainDocument {
  993. if (document.isHome) {
  994. document.homeViewController?.menuItemAction_ConvertToPPT(sender)
  995. } else {
  996. document.mainViewController?.menuItemAction_ConvertToPPT(sender)
  997. }
  998. }
  999. }
  1000. func menuItemAction_ConvertToRTF(_ sender: Any) {
  1001. if (self.canResponseDocumentAction() == false) {
  1002. return
  1003. }
  1004. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1005. if (document.isHome) {
  1006. document.homeViewController?.menuItemAction_ConvertToRTF(sender)
  1007. } else {
  1008. document.mainViewController?.menuItemAction_ConvertToRTF(sender)
  1009. }
  1010. }
  1011. }
  1012. func menuItemAction_ConvertToHTML(_ sender: Any) {
  1013. if (self.canResponseDocumentAction() == false) {
  1014. return
  1015. }
  1016. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1017. if (document.isHome) {
  1018. document.homeViewController?.menuItemAction_ConvertToHTML(sender)
  1019. } else {
  1020. document.mainViewController?.menuItemAction_ConvertToHTML(sender)
  1021. }
  1022. }
  1023. }
  1024. func menuItemAction_ConvertToText(_ sender: Any) {
  1025. if (self.canResponseDocumentAction() == false) {
  1026. return
  1027. }
  1028. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1029. if (document.isHome) {
  1030. document.homeViewController?.menuItemAction_ConvertToText(sender)
  1031. } else {
  1032. document.mainViewController?.menuItemAction_ConvertToText(sender)
  1033. }
  1034. }
  1035. }
  1036. func menuItemAction_ConvertToCSV(_ sender: Any) {
  1037. if (self.canResponseDocumentAction() == false) {
  1038. return
  1039. }
  1040. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1041. if (document.isHome) {
  1042. document.homeViewController?.menuItemAction_ConvertToCSV(sender)
  1043. } else {
  1044. document.mainViewController?.menuItemAction_ConvertToCSV(sender)
  1045. }
  1046. }
  1047. }
  1048. func menuItemAction_ConvertToImage(_ sender: Any) {
  1049. if (self.canResponseDocumentAction() == false) {
  1050. return
  1051. }
  1052. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1053. if (document.isHome) {
  1054. document.homeViewController?.menuItemAction_ConvertToImage(sender)
  1055. } else {
  1056. document.mainViewController?.menuItemAction_ConvertToImage(sender)
  1057. }
  1058. }
  1059. }
  1060. func menuItemClick_SettingPassword(_ sender: Any) {
  1061. if (self.canResponseDocumentAction() == false) {
  1062. return
  1063. }
  1064. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1065. if (document.isHome) {
  1066. document.homeViewController?.menuItemClick_SettingPassword(sender)
  1067. } else {
  1068. document.mainViewController?.menuItemClick_SettingPassword(sender)
  1069. }
  1070. }
  1071. }
  1072. func menuItemClick_RemovePassword(_ sender: Any) {
  1073. if (self.canResponseDocumentAction() == false) {
  1074. return
  1075. }
  1076. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1077. document.mainViewController?.menuItemClick_RemovePassword(sender)
  1078. }
  1079. }
  1080. func menuItemAction_closeWindow(_ sender: Any) {
  1081. if (self.canResponseDocumentAction() == false) {
  1082. return
  1083. }
  1084. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1085. if (document.isHome) {
  1086. document.homeViewController?.menuItemAction_closeWindow(sender)
  1087. } else {
  1088. document.mainViewController?.menuItemAction_closeWindow(sender)
  1089. }
  1090. }
  1091. }
  1092. func menuItemAction_closeAllWindows(_ sender: Any) {
  1093. if (self.canResponseDocumentAction() == false) {
  1094. return
  1095. }
  1096. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1097. if (document.isHome) {
  1098. document.homeViewController?.menuItemAction_closeAllWindows(sender)
  1099. } else {
  1100. document.mainViewController?.menuItemAction_closeAllWindows(sender)
  1101. }
  1102. }
  1103. }
  1104. func menuItemAction_closeTagPage(_ sender: Any) {
  1105. if (self.canResponseDocumentAction() == false) {
  1106. return
  1107. }
  1108. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1109. document.mainViewController?.menuItemAction_closeTagPage(sender)
  1110. }
  1111. }
  1112. func menuItemAction_showInFinder(_ sender: Any) {
  1113. if (self.canResponseDocumentAction() == false) {
  1114. return
  1115. }
  1116. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1117. document.mainViewController?.menuItemAction_showInFinder(sender)
  1118. }
  1119. }
  1120. func menuItemAction_property(_ sender: Any) {
  1121. if (self.canResponseDocumentAction() == false) {
  1122. return
  1123. }
  1124. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1125. document.mainViewController?.menuItemAction_property(sender)
  1126. }
  1127. }
  1128. func menuItemAction_print(_ sender: Any) {
  1129. if (self.canResponseDocumentAction() == false) {
  1130. return
  1131. }
  1132. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1133. document.mainViewController?.menuItemAction_print(sender)
  1134. }
  1135. }
  1136. }
  1137. // MARK: - KMSystemViewMenuProtocol
  1138. extension KMBrowserWindowController: KMSystemViewMenuProtocol {
  1139. func menuItemAction_adjustWidth(_ sender: Any) {
  1140. if (self.canResponseDocumentAction() == false) {
  1141. return
  1142. }
  1143. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1144. document.mainViewController?.menuItemAction_adjustWidth(sender)
  1145. }
  1146. }
  1147. func menuItemAction_adjustPage(_ sender: Any) {
  1148. if (self.canResponseDocumentAction() == false) {
  1149. return
  1150. }
  1151. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1152. document.mainViewController?.menuItemAction_adjustPage(sender)
  1153. }
  1154. }
  1155. func menuItemAction_size(_ sender: Any) {
  1156. if (self.canResponseDocumentAction() == false) {
  1157. return
  1158. }
  1159. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1160. document.mainViewController?.menuItemAction_size(sender)
  1161. }
  1162. }
  1163. func menuItemAction_zoomOut(_ sender: Any) {
  1164. if (self.canResponseDocumentAction() == false) {
  1165. return
  1166. }
  1167. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1168. document.mainViewController?.menuItemAction_zoomOut(sender)
  1169. }
  1170. }
  1171. func menuItemAction_zoomIn(_ sender: Any) {
  1172. if (self.canResponseDocumentAction() == false) {
  1173. return
  1174. }
  1175. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1176. document.mainViewController?.menuItemAction_zoomIn(sender)
  1177. }
  1178. }
  1179. func menuItemAction_singlePage(_ sender: Any) {
  1180. if (self.canResponseDocumentAction() == false) {
  1181. return
  1182. }
  1183. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1184. document.mainViewController?.menuItemAction_singlePage(sender)
  1185. }
  1186. }
  1187. func menuItemAction_singlePageContinue(_ sender: Any) {
  1188. if (self.canResponseDocumentAction() == false) {
  1189. return
  1190. }
  1191. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1192. document.mainViewController?.menuItemAction_singlePageContinue(sender)
  1193. }
  1194. }
  1195. func menuItemAction_doublePage(_ sender: Any) {
  1196. if (self.canResponseDocumentAction() == false) {
  1197. return
  1198. }
  1199. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1200. document.mainViewController?.menuItemAction_doublePage(sender)
  1201. }
  1202. }
  1203. func menuItemAction_doublePageContinue(_ sender: Any) {
  1204. if (self.canResponseDocumentAction() == false) {
  1205. return
  1206. }
  1207. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1208. document.mainViewController?.menuItemAction_doublePageContinue(sender)
  1209. }
  1210. }
  1211. func menuItemAction_bookMode(_ sender: Any) {
  1212. if (self.canResponseDocumentAction() == false) {
  1213. return
  1214. }
  1215. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1216. document.mainViewController?.menuItemAction_bookMode(sender)
  1217. }
  1218. }
  1219. func menuItemAction_readMode(_ sender: Any) {
  1220. if (self.canResponseDocumentAction() == false) {
  1221. return
  1222. }
  1223. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1224. document.mainViewController?.menuItemAction_readMode(sender)
  1225. }
  1226. }
  1227. func menuItemAction_showSplitPage(_ sender: Any) {
  1228. if (self.canResponseDocumentAction() == false) {
  1229. return
  1230. }
  1231. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1232. document.mainViewController?.menuItemAction_showSplitPage(sender)
  1233. }
  1234. }
  1235. func menuItemAction_rotateLeft(_ sender: Any) {
  1236. if (self.canResponseDocumentAction() == false) {
  1237. return
  1238. }
  1239. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1240. document.mainViewController?.menuItemAction_rotateLeft(sender)
  1241. }
  1242. }
  1243. func menuItemAction_rotateRight(_ sender: Any) {
  1244. if (self.canResponseDocumentAction() == false) {
  1245. return
  1246. }
  1247. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1248. document.mainViewController?.menuItemAction_rotateRight(sender)
  1249. }
  1250. }
  1251. func menuItemAction_rotateAllPageLeft(_ sender: Any) {
  1252. if (self.canResponseDocumentAction() == false) {
  1253. return
  1254. }
  1255. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1256. document.mainViewController?.menuItemAction_rotateAllPageLeft(sender)
  1257. }
  1258. }
  1259. func menuItemAction_rotateAllPageRight(_ sender: Any) {
  1260. if (self.canResponseDocumentAction() == false) {
  1261. return
  1262. }
  1263. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1264. document.mainViewController?.menuItemAction_rotateAllPageRight(sender)
  1265. }
  1266. }
  1267. func menuItemAction_view_readMode(_ sender: Any) {
  1268. if (self.canResponseDocumentAction() == false) {
  1269. return
  1270. }
  1271. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1272. document.mainViewController?.menuItemAction_view_readMode(sender)
  1273. }
  1274. }
  1275. func menuItemAction_hiddenLeftSide(_ sender: Any) {
  1276. if (self.canResponseDocumentAction() == false) {
  1277. return
  1278. }
  1279. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1280. document.mainViewController?.menuItemAction_hiddenLeftSide(sender)
  1281. }
  1282. }
  1283. func menuItemAction_hiddenRightSide(_ sender: Any) {
  1284. if (self.canResponseDocumentAction() == false) {
  1285. return
  1286. }
  1287. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1288. document.mainViewController?.menuItemAction_hiddenRightSide(sender)
  1289. }
  1290. }
  1291. func menuItemAction_thumai(_ sender: Any) {
  1292. if (self.canResponseDocumentAction() == false) {
  1293. return
  1294. }
  1295. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1296. document.mainViewController?.menuItemAction_thumai(sender)
  1297. }
  1298. }
  1299. func menuItemAction_outline(_ sender: Any) {
  1300. if (self.canResponseDocumentAction() == false) {
  1301. return
  1302. }
  1303. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1304. document.mainViewController?.menuItemAction_outline(sender)
  1305. }
  1306. }
  1307. func menuItemAction_bookmark(_ sender: Any) {
  1308. if (self.canResponseDocumentAction() == false) {
  1309. return
  1310. }
  1311. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1312. document.mainViewController?.menuItemAction_bookmark(sender)
  1313. }
  1314. }
  1315. func menuItemAction_annotation(_ sender: Any) {
  1316. if (self.canResponseDocumentAction() == false) {
  1317. return
  1318. }
  1319. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1320. document.mainViewController?.menuItemAction_annotation(sender)
  1321. }
  1322. }
  1323. func menuItemAction_search(_ sender: Any) {
  1324. if (self.canResponseDocumentAction() == false) {
  1325. return
  1326. }
  1327. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1328. document.mainViewController?.menuItemAction_search(sender)
  1329. }
  1330. }
  1331. func menuItemAction_hiddenPageIndicator(_ sender: Any) {
  1332. if (self.canResponseDocumentAction() == false) {
  1333. return
  1334. }
  1335. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1336. document.mainViewController?.menuItemAction_hiddenPageIndicator(sender)
  1337. }
  1338. }
  1339. }
  1340. // MARK: - KMSystemEditMenuProtocol
  1341. extension KMBrowserWindowController: KMSystemEditMenuProtocol {
  1342. func menuItemAction_find(_ sender: Any) {
  1343. if (self.canResponseDocumentAction() == false) {
  1344. return
  1345. }
  1346. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1347. document.mainViewController?.menuItemAction_find(sender)
  1348. }
  1349. }
  1350. }
  1351. // MARK: - Annotation Menu
  1352. extension KMBrowserWindowController {
  1353. @IBAction func menuItemAction_highlight(_ sender: Any) {
  1354. if (self.canResponseDocumentAction() == false) {
  1355. return
  1356. }
  1357. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1358. document.mainViewController?.menuItemAction_highlight(sender)
  1359. }
  1360. }
  1361. @IBAction func menuItemAction_underline(_ sender: Any) {
  1362. if (self.canResponseDocumentAction() == false) {
  1363. return
  1364. }
  1365. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1366. document.mainViewController?.menuItemAction_underline(sender)
  1367. }
  1368. }
  1369. @IBAction func menuItemAction_deleteLine(_ sender: Any) {
  1370. if (self.canResponseDocumentAction() == false) {
  1371. return
  1372. }
  1373. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1374. document.mainViewController?.menuItemAction_deleteLine(sender)
  1375. }
  1376. }
  1377. @IBAction func menuItemAction_freehand(_ sender: Any) {
  1378. if (self.canResponseDocumentAction() == false) {
  1379. return
  1380. }
  1381. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1382. document.mainViewController?.menuItemAction_freehand(sender)
  1383. }
  1384. }
  1385. @IBAction func menuItemAction_text(_ sender: Any) {
  1386. if (self.canResponseDocumentAction() == false) {
  1387. return
  1388. }
  1389. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1390. document.mainViewController?.menuItemAction_text(sender)
  1391. }
  1392. }
  1393. @IBAction func menuItemAction_note(_ sender: Any) {
  1394. if (self.canResponseDocumentAction() == false) {
  1395. return
  1396. }
  1397. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1398. document.mainViewController?.menuItemAction_note(sender)
  1399. }
  1400. }
  1401. @IBAction func menuItemAction_squre(_ sender: Any) {
  1402. if (self.canResponseDocumentAction() == false) {
  1403. return
  1404. }
  1405. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1406. document.mainViewController?.menuItemAction_squre(sender)
  1407. }
  1408. }
  1409. @IBAction func menuItemAction_circle(_ sender: Any) {
  1410. if (self.canResponseDocumentAction() == false) {
  1411. return
  1412. }
  1413. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1414. document.mainViewController?.menuItemAction_circle(sender)
  1415. }
  1416. }
  1417. @IBAction func menuItemAction_arrow(_ sender: Any) {
  1418. if (self.canResponseDocumentAction() == false) {
  1419. return
  1420. }
  1421. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1422. document.mainViewController?.menuItemAction_arrow(sender)
  1423. }
  1424. }
  1425. @IBAction func menuItemAction_line(_ sender: Any) {
  1426. if (self.canResponseDocumentAction() == false) {
  1427. return
  1428. }
  1429. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1430. document.mainViewController?.menuItemAction_line(sender)
  1431. }
  1432. }
  1433. // link
  1434. @IBAction func menuItemAction_link(_ sender: Any) {
  1435. if (self.canResponseDocumentAction() == false) {
  1436. return
  1437. }
  1438. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1439. document.mainViewController?.menuItemAction_link(sender)
  1440. }
  1441. }
  1442. @IBAction func menuItemAction_linkPage(_ sender: Any) {
  1443. if (self.canResponseDocumentAction() == false) {
  1444. return
  1445. }
  1446. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1447. document.mainViewController?.menuItemAction_linkPage(sender)
  1448. }
  1449. }
  1450. // stamp
  1451. @IBAction func menuItemAction_stamp(_ sender: Any) {
  1452. if (self.canResponseDocumentAction() == false) {
  1453. return
  1454. }
  1455. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1456. document.mainViewController?.menuItemAction_stamp(sender)
  1457. }
  1458. }
  1459. @IBAction func menuItemAction_signure(_ sender: Any) {
  1460. if (self.canResponseDocumentAction() == false) {
  1461. return
  1462. }
  1463. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1464. document.mainViewController?.menuItemAction_signure(sender)
  1465. }
  1466. }
  1467. @IBAction func menuItemAction_hiddenAllAnnotation(_ sender: Any) {
  1468. if (self.canResponseDocumentAction() == false) {
  1469. return
  1470. }
  1471. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1472. document.mainViewController?.menuItemAction_hiddenAllAnnotation(sender)
  1473. }
  1474. }
  1475. @IBAction func menuItemAction_clearAllAnnotation(_ sender: Any) {
  1476. if (self.canResponseDocumentAction() == false) {
  1477. return
  1478. }
  1479. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1480. document.mainViewController?.menuItemAction_clearAllAnnotation(sender)
  1481. }
  1482. }
  1483. }
  1484. // MARK: - KMSystemGotoMenuProtocol
  1485. extension KMBrowserWindowController: KMSystemGotoMenuProtocol {
  1486. func menuItemAction_nextPage(_ sender: Any) {
  1487. if (self.canResponseDocumentAction() == false) {
  1488. return
  1489. }
  1490. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1491. document.mainViewController?.menuItemAction_nextPage(sender)
  1492. }
  1493. }
  1494. func menuItemAction_forwardPage(_ sender: Any) {
  1495. if (self.canResponseDocumentAction() == false) {
  1496. return
  1497. }
  1498. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1499. document.mainViewController?.menuItemAction_forwardPage(sender)
  1500. }
  1501. }
  1502. func menuItemAction_firstPage(_ sender: Any) {
  1503. if (self.canResponseDocumentAction() == false) {
  1504. return
  1505. }
  1506. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1507. document.mainViewController?.menuItemAction_firstPage(sender)
  1508. }
  1509. }
  1510. func menuItemAction_lastPage(_ sender: Any) {
  1511. if (self.canResponseDocumentAction() == false) {
  1512. return
  1513. }
  1514. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1515. document.mainViewController?.menuItemAction_lastPage(sender)
  1516. }
  1517. }
  1518. func menuItemAction_forward(_ sender: Any) {
  1519. if (self.canResponseDocumentAction() == false) {
  1520. return
  1521. }
  1522. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1523. document.mainViewController?.menuItemAction_forward(sender)
  1524. }
  1525. }
  1526. func menuItemAction_goback(_ sender: Any) {
  1527. if (self.canResponseDocumentAction() == false) {
  1528. return
  1529. }
  1530. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1531. document.mainViewController?.menuItemAction_goback(sender)
  1532. }
  1533. }
  1534. func menuItemAction_gotoPage(_ sender: Any) {
  1535. if (self.canResponseDocumentAction() == false) {
  1536. return
  1537. }
  1538. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1539. document.mainViewController?.menuItemAction_gotoPage(sender)
  1540. }
  1541. }
  1542. }
  1543. // MARK: - KMSystemToolMenuProtocol
  1544. extension KMBrowserWindowController: KMSystemToolMenuProtocol {
  1545. func menuItemAction_scrolTool(_ sender: Any) {
  1546. if (self.canResponseDocumentAction() == false) {
  1547. return
  1548. }
  1549. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1550. document.mainViewController?.menuItemAction_scrolTool(sender)
  1551. }
  1552. }
  1553. func menuItemAction_zoomOutTool(_ sender: Any) {
  1554. if (self.canResponseDocumentAction() == false) {
  1555. return
  1556. }
  1557. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1558. document.mainViewController?.menuItemAction_zoomOutTool(sender)
  1559. }
  1560. }
  1561. func menuItemAction_selectTool(_ sender: Any) {
  1562. if (self.canResponseDocumentAction() == false) {
  1563. return
  1564. }
  1565. if let document = self.browser.activeTabContents() as? KMMainDocument, document.isHome == false {
  1566. document.mainViewController?.menuItemAction_selectTool(sender)
  1567. }
  1568. }
  1569. }
  1570. // MARK: - KMSystemWindowMenuRrotocol
  1571. extension KMBrowserWindowController: KMSystemWindowMenuRrotocol {
  1572. func menuItemAction_showForwardTagPage(_ sender: Any) {
  1573. if (self.canResponseDocumentAction() == false) {
  1574. return
  1575. }
  1576. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1577. if (document.isHome) {
  1578. document.homeViewController?.menuItemAction_showForwardTagPage(sender)
  1579. } else {
  1580. document.mainViewController?.menuItemAction_showForwardTagPage(sender)
  1581. }
  1582. }
  1583. }
  1584. func menuItemAction_showNextTagPage(_ sender: Any) {
  1585. if (self.canResponseDocumentAction() == false) {
  1586. return
  1587. }
  1588. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1589. if (document.isHome) {
  1590. document.homeViewController?.menuItemAction_showNextTagPage(sender)
  1591. } else {
  1592. document.mainViewController?.menuItemAction_showNextTagPage(sender)
  1593. }
  1594. }
  1595. }
  1596. func menuItemAction_newTagPageToNewWindow(_ sender: Any) {
  1597. if (self.canResponseDocumentAction() == false) {
  1598. return
  1599. }
  1600. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1601. if (document.isHome) {
  1602. document.homeViewController?.menuItemAction_newTagPageToNewWindow(sender)
  1603. } else {
  1604. document.mainViewController?.menuItemAction_newTagPageToNewWindow(sender)
  1605. }
  1606. }
  1607. }
  1608. func menuItemAction_mergeAllWindow(_ sender: Any) {
  1609. if (self.canResponseDocumentAction() == false) {
  1610. return
  1611. }
  1612. if let document = self.browser.activeTabContents() as? KMMainDocument {
  1613. if (document.isHome) {
  1614. document.homeViewController?.menuItemAction_mergeAllWindow(sender)
  1615. } else {
  1616. document.mainViewController?.menuItemAction_mergeAllWindow(sender)
  1617. }
  1618. }
  1619. }
  1620. }
  1621. // MARK: - Analytics (埋点)
  1622. extension KMBrowserWindowController {
  1623. func trackEvent_upgrade() -> Void {
  1624. KMAnalytics.trackEvent(eventName: "Btn_Tbr_Upgrade", parameters: [
  1625. KMAnalytics.Parameter.categoryKey : KMAnalytics.Category.tbr,
  1626. KMAnalytics.Parameter.labelKey : KMAnalytics.Label.tbr_Btn], platform: .AppCenter, appTarget: .all)
  1627. }
  1628. }