KMBatchOperateBaseWindowController.swift 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //
  2. // KMBatchOperateBaseWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by kdanmobile on 2023/10/26.
  6. //
  7. import Cocoa
  8. @objcMembers class KMBatchOperateBaseWindowController: NSWindowController{
  9. var files: [KMBatchOperateFile]?
  10. var operateType: KMBatchOperationType?{
  11. willSet{
  12. }
  13. didSet {
  14. switch operateType {
  15. case .Convert:
  16. self.window!.title = NSLocalizedString("Convert", comment: "")
  17. case .Merge:
  18. self.window!.title = NSLocalizedString("Merge", comment: "")
  19. case .Compress:
  20. self.window!.title = NSLocalizedString("Compress", comment: "")
  21. case .AddPassword:
  22. self.window!.title = NSLocalizedString("Set Passwords", comment: "")
  23. case .RemovePassword:
  24. self.window!.title = NSLocalizedString("Remove Security", comment: "")
  25. case .AddWatermark:
  26. self.window!.title = NSLocalizedString("Add Watermark", comment: "")
  27. case .RemoveWatermark:
  28. self.window!.title = NSLocalizedString("Remove Watermark", comment: "")
  29. case .AddBackground:
  30. self.window!.title = NSLocalizedString("Add Background", comment: "")
  31. case .RemoveBackground:
  32. self.window!.title = NSLocalizedString("Remove Background", comment: "")
  33. case .AddHeaderFooter:
  34. self.window!.title = NSLocalizedString("Add Header & Footer", comment: "")
  35. case .RemoveHeaderFooter:
  36. self.window!.title = NSLocalizedString("Remove Header & Footer", comment: "")
  37. case .AddBates:
  38. self.window!.title = NSLocalizedString("Add Bates Numbers", comment: "")
  39. case .RemoveBates:
  40. self.window!.title = NSLocalizedString("Remove Bates Numbers", comment: "")
  41. case .CreatePDF:
  42. self.window!.title = NSLocalizedString("Image To PDF", comment: "")
  43. default :
  44. self.window!.title = NSLocalizedString("Convert", comment: "")
  45. }
  46. }
  47. }
  48. override func windowDidLoad() {
  49. super.windowDidLoad()
  50. self.configuUI()
  51. files = NSMutableArray() as? [KMBatchOperateFile]
  52. }
  53. func configuUI() {
  54. let splitViewController = KMBatchOperateSplitViewController(nibName: "KMBatchOperateSplitViewController", bundle: nil)
  55. contentViewController = splitViewController
  56. }
  57. func switchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  58. self.files = files
  59. (self.contentViewController as? KMBatchOperateSplitViewController)?.switchToOperateType(operateType: operateType, files: files)
  60. self.operateType = operateType
  61. }
  62. func checkNeedPasswordSwitchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  63. self.files = files
  64. (self.contentViewController as! KMBatchOperateSplitViewController).checkNeedPasswordSwitchToOperateType(operateType, files: files)
  65. self.operateType = operateType
  66. }
  67. func switchToConvertType(convertType: KMConvertWithPDFType) {
  68. (self.contentViewController as! KMBatchOperateSplitViewController).switchToConvertType(convertType)
  69. }
  70. func watermarkInterfaceSelectWatermark(watermark: KMWatermarkModel) {
  71. (self.contentViewController as! KMBatchOperateSplitViewController).watermarkInterfaceSelectWatermark(watermark)
  72. }
  73. func backgroundInterfaceSelectBackGround(background: KMBackgroundModel) {
  74. (self.contentViewController as! KMBatchOperateSplitViewController).backgroundInterfaceSelectBackground(background)
  75. }
  76. func headerFooterInterfaceSelectHeaderFooter(headerFooter: KMHeaderFooterObject) {
  77. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  78. }
  79. func batesInterfaceSelectBates(headerFooter: KMHeaderFooterObject) {
  80. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  81. }
  82. }