123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- //
- // KMPrintBottomView.swift
- // PDF Master
- //
- // Created by lizhe on 2022/12/9.
- //
- import Cocoa
- class KMPrintBottomView: KMBaseXibView {
- @IBOutlet weak var printerButton: NSButton!
-
- @IBOutlet weak var savePDFButton: NSButton!
-
- @IBOutlet weak var cancelButton: NSButton!
- @IBOutlet weak var printButton: NSButton!
- var delegate: KMPrintBottomViewDelegate?
-
- // lazy var presenter: KMImageToPDFChoosePresenter! = KMImageToPDFChoosePresenter()
- // lazy var OCRPresenter: KMOCRPresenter! = KMOCRPresenter()
- // lazy var data: KMImageToPDFChooseModel! = KMImageToPDFChooseModel()
-
- deinit {
- // self.delegate = nil
- }
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
-
- }
-
- override func setup() {
- super.setup()
-
- self.printerButton.wantsLayer = true
- self.printerButton.layer?.borderWidth = 1
- self.printerButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
- self.printerButton.layer?.cornerRadius = 4
- self.printerButton.title = NSLocalizedString("Printer", comment: "")
- self.printerButton.font = NSFont.SFProTextRegularFont(14)
- self.printerButton.contentTintColor = NSColor.km_init(hex: "#252629")
-
- self.cancelButton.wantsLayer = true
- self.cancelButton.layer?.borderWidth = 1
- self.cancelButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
- self.cancelButton.layer?.cornerRadius = 4
- self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
- self.cancelButton.font = NSFont.SFProTextRegularFont(14)
- self.cancelButton.contentTintColor = NSColor.km_init(hex: "#252629")
-
- self.savePDFButton.wantsLayer = true
- self.savePDFButton.layer?.borderWidth = 1
- self.savePDFButton.layer?.borderColor = NSColor.km_init(hex: "#DFE1E5").cgColor
- self.savePDFButton.layer?.cornerRadius = 4
- self.savePDFButton.title = NSLocalizedString("Save as PDF", comment: "")
- self.savePDFButton.font = NSFont.SFProTextRegularFont(14)
- self.savePDFButton.contentTintColor = NSColor.km_init(hex: "#252629")
-
- self.printButton.wantsLayer = true
- self.printButton.layer?.backgroundColor = NSColor.km_init(hex: "#1770F4").cgColor
- self.printButton.layer?.cornerRadius = 4
- self.printButton.title = NSLocalizedString("Printer", comment: "")
- self.printButton.font = NSFont.SFProTextRegularFont(14)
- self.printButton.contentTintColor = NSColor.km_init(hex: "#FFFFFF")
- }
-
- //刷新界面UI 和 数据
- override func reloadData() {
- super.reloadData()
- // let exporkOptions = self.data.options ?? .PDF
- // let exportType = self.data.exportPDFType ?? .new
- //
- // if exporkOptions.contains(.PDF) {
- //
- // }
- //
- // if exporkOptions.contains(.OCR) {
- // self.selectLanguageButton.isEnabled = true
- // self.saveTXTButton.isEnabled = true
- // } else {
- // self.selectLanguageButton.isEnabled = false
- // self.saveTXTButton.isEnabled = false
- // }
- //
- // if exportType == .new {
- // self.newPDFButton.state = .on
- // self.mergePDFButton.isEnabled = true
- //
- // self.insertPDFButton.state = .off
- // self.exportSelectFileButton.isEnabled = false
- // } else if exportType == .insert {
- // self.newPDFButton.state = .off
- // self.mergePDFButton.isEnabled = false
- //
- // self.insertPDFButton.state = .on
- // self.exportSelectFileButton.isEnabled = true
- // }
- //
- // self.selectLanguageButton.title = self.data.OCRModel.languageDic[KMGOCRLanguageStringKey] as! String
- //
- // self.exportSelectFileButton.title = self.data.insertFilePath
- //
- }
-
-
-
- @IBAction func printerAction(_ sender: Any) {
- if self.delegate != nil {
- self.delegate?.printerAction()
- }
- }
-
- @IBAction func cancelAction(_ sender: Any) {
- if self.delegate != nil {
- self.delegate?.cancelAction()
- }
- }
-
- @IBAction func printAction(_ sender: Any) {
- if self.delegate != nil {
- self.delegate?.printAction()
- }
- }
-
- @IBAction func savePDFAction(_ sender: Any) {
- if self.delegate != nil {
- self.delegate?.savePDFAction()
- }
- }
- }
- protocol KMPrintBottomViewDelegate {
- func printerAction()
- func cancelAction()
- func printAction()
- func savePDFAction()
- }
|