KMBrowserWindowController.swift 63 KB

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