KMPrintBottomView.swift 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //
  2. // KMPrintBottomView.swift
  3. // PDF Master
  4. //
  5. // Created by lizhe on 2022/12/9.
  6. //
  7. import Cocoa
  8. class KMPrintBottomView: KMBaseXibView {
  9. @IBOutlet weak var printerButton: NSButton!
  10. @IBOutlet weak var savePDFButton: NSButton!
  11. @IBOutlet weak var cancelButton: NSButton!
  12. @IBOutlet weak var printButton: NSButton!
  13. var delegate: KMPrintBottomViewDelegate?
  14. // lazy var presenter: KMImageToPDFChoosePresenter! = KMImageToPDFChoosePresenter()
  15. // lazy var OCRPresenter: KMOCRPresenter! = KMOCRPresenter()
  16. // lazy var data: KMImageToPDFChooseModel! = KMImageToPDFChooseModel()
  17. deinit {
  18. // self.delegate = nil
  19. }
  20. override func draw(_ dirtyRect: NSRect) {
  21. super.draw(dirtyRect)
  22. // Drawing code here.
  23. }
  24. override func setup() {
  25. super.setup()
  26. // self.printerButton.wantsLayer = true
  27. // self.printerButton.layer?.borderWidth = 1
  28. // self.printerButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
  29. // self.printerButton.layer?.cornerRadius = 4
  30. // self.printerButton.title = NSLocalizedString("Printer", comment: "")
  31. // self.printerButton.font = NSFont.SFProTextRegularFont(14)
  32. // self.printerButton.contentTintColor = NSColor.km_init(hex: "#252629")
  33. //
  34. // self.cancelButton.wantsLayer = true
  35. // self.cancelButton.layer?.borderWidth = 1
  36. // self.cancelButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
  37. // self.cancelButton.layer?.cornerRadius = 4
  38. // self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
  39. // self.cancelButton.font = NSFont.SFProTextRegularFont(14)
  40. // self.cancelButton.contentTintColor = NSColor.km_init(hex: "#252629")
  41. //
  42. // self.savePDFButton.wantsLayer = true
  43. // self.savePDFButton.layer?.borderWidth = 1
  44. // self.savePDFButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
  45. // self.savePDFButton.layer?.cornerRadius = 4
  46. // self.savePDFButton.title = NSLocalizedString("Save as PDF", comment: "")
  47. // self.savePDFButton.font = NSFont.SFProTextRegularFont(14)
  48. // self.savePDFButton.contentTintColor = NSColor.km_init(hex: "#252629")
  49. //
  50. // self.printButton.wantsLayer = true
  51. // self.printButton.layer?.backgroundColor = NSColor.km_init(hex: "#1770F4").cgColor
  52. // self.printButton.layer?.cornerRadius = 4
  53. // self.printButton.title = NSLocalizedString("Printer", comment: "")
  54. // self.printButton.font = NSFont.SFProTextRegularFont(14)
  55. // self.printButton.contentTintColor = NSColor.km_init(hex: "#FFFFFF")
  56. }
  57. //刷新界面UI 和 数据
  58. override func reloadData() {
  59. super.reloadData()
  60. // let exporkOptions = self.data.options ?? .PDF
  61. // let exportType = self.data.exportPDFType ?? .new
  62. //
  63. // if exporkOptions.contains(.PDF) {
  64. //
  65. // }
  66. //
  67. // if exporkOptions.contains(.OCR) {
  68. // self.selectLanguageButton.isEnabled = true
  69. // self.saveTXTButton.isEnabled = true
  70. // } else {
  71. // self.selectLanguageButton.isEnabled = false
  72. // self.saveTXTButton.isEnabled = false
  73. // }
  74. //
  75. // if exportType == .new {
  76. // self.newPDFButton.state = .on
  77. // self.mergePDFButton.isEnabled = true
  78. //
  79. // self.insertPDFButton.state = .off
  80. // self.exportSelectFileButton.isEnabled = false
  81. // } else if exportType == .insert {
  82. // self.newPDFButton.state = .off
  83. // self.mergePDFButton.isEnabled = false
  84. //
  85. // self.insertPDFButton.state = .on
  86. // self.exportSelectFileButton.isEnabled = true
  87. // }
  88. //
  89. // self.selectLanguageButton.title = self.data.OCRModel.languageDic[KMGOCRLanguageStringKey] as! String
  90. //
  91. // self.exportSelectFileButton.title = self.data.insertFilePath
  92. //
  93. }
  94. @IBAction func printerAction(_ sender: Any) {
  95. if self.delegate != nil {
  96. self.delegate?.printerAction()
  97. }
  98. }
  99. @IBAction func cancelAction(_ sender: Any) {
  100. if self.delegate != nil {
  101. self.delegate?.cancelAction()
  102. }
  103. }
  104. @IBAction func printAction(_ sender: Any) {
  105. if self.delegate != nil {
  106. self.delegate?.printAction()
  107. }
  108. }
  109. @IBAction func savePDFAction(_ sender: Any) {
  110. if self.delegate != nil {
  111. self.delegate?.savePDFAction()
  112. }
  113. }
  114. @IBAction func bookletButtonAction(_ sender: Any) {
  115. self.delegate?.bookletAction()
  116. }
  117. @IBAction func multipleButtonAction(_ sender: Any) {
  118. self.delegate?.multipageAction()
  119. }
  120. @IBAction func poseterButtonAction(_ sender: Any) {
  121. self.delegate?.posterAction()
  122. }
  123. }
  124. protocol KMPrintBottomViewDelegate {
  125. func printerAction()
  126. func cancelAction()
  127. func printAction()
  128. func savePDFAction()
  129. func posterAction()
  130. func multipageAction()
  131. func bookletAction()
  132. }