KMBatchOperateSplitViewController.swift 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // KMBatchOperateSplitViewController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by kdanmobile on 2023/10/26.
  6. //
  7. import Cocoa
  8. class KMBatchOperateSplitViewController: NSSplitViewController{
  9. var leftFileListViewController: KMBatchOperateLeftViewController?
  10. var rightPropertiesViewController: KMBatchOperateRightViewController?
  11. override func viewDidLoad() {
  12. super.viewDidLoad()
  13. self.leftFileListViewController = KMBatchOperateLeftViewController()
  14. self.rightPropertiesViewController = KMBatchOperateRightViewController()
  15. let item1 = NSSplitViewItem(viewController: self.leftFileListViewController!)
  16. let item2 = NSSplitViewItem(viewController: self.rightPropertiesViewController!)
  17. item1.minimumThickness = 400
  18. item2.minimumThickness = 270
  19. item2.maximumThickness = 270
  20. self.addSplitViewItem(item1)
  21. self.addSplitViewItem(item2)
  22. self.addNewTrackingArea()
  23. }
  24. func addNewTrackingArea() {
  25. let trackingArea = NSTrackingArea(rect: self.view.frame, options: [.mouseEnteredAndExited, .inVisibleRect, .activeAlways, .mouseMoved], owner: self, userInfo: nil)
  26. self.view.addTrackingArea(trackingArea)
  27. }
  28. func switchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  29. self.leftFileListViewController?.switchToOperateType(operateType, files: files)
  30. self.rightPropertiesViewController?.switchToOperateType(operateType: operateType, files: files )
  31. }
  32. func checkNeedPasswordSwitchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  33. self.leftFileListViewController?.checkNeedPasswordSwitchToOperateType(operateType, files: files)
  34. self.rightPropertiesViewController?.switchToOperateType(operateType: operateType, files: files)
  35. }
  36. func switchToOperateType(_ operateType: KMBatchOperationType) {
  37. self.rightPropertiesViewController?.files = self.leftFileListViewController?.files ?? []
  38. self.leftFileListViewController!.switchToOperateType(operateType)
  39. self.rightPropertiesViewController!.switchToOperateType(operateType: operateType)
  40. }
  41. func switchToConvertType(_ convertType: KMConvertWithPDFType) {
  42. self.rightPropertiesViewController?.files = self.leftFileListViewController?.files ?? []
  43. self.leftFileListViewController!.reloadConvertInterface(withType: convertType)
  44. self.rightPropertiesViewController!.switchToConvertType(convertType)
  45. }
  46. func watermarkInterfaceSelectWatermark(_ watermark: KMWatermarkModel) {
  47. self.rightPropertiesViewController?.watermarkInterfaceSelectWatermark(watermark)
  48. }
  49. func backgroundInterfaceSelectBackground(_ background: KMBackgroundModel) {
  50. self.rightPropertiesViewController?.backgroundInterfaceSelectBackground(background)
  51. }
  52. func headerFooterInterfaceSelectHeaderFooter(_ headerFooter: KMHeaderFooterObject) {
  53. self.rightPropertiesViewController?.headerFooterInterfaceSelectHeaderFooter(headerFooter)
  54. }
  55. func batesInterfaceSelectBates(_ headerFooter: KMHeaderFooterObject) {
  56. self.rightPropertiesViewController?.batesInterfaceSelectBates(headerFooter)
  57. }
  58. }