123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //
- // KMPrintBottomView.swift
- // PDF Reader Pro
- //
- // Created by lizhe on 2022/12/9.
- //
- import Cocoa
- class KMPrintBottomView: BaseXibView {
- @IBOutlet weak var printerButton: NSButton!
-
- @IBOutlet weak var savePDFButton: NSButton!
-
- @IBOutlet weak var cancelButton: NSButton!
- @IBOutlet weak var printButton: NSButton!
- @IBOutlet weak var posterButton: NSButton!
- @IBOutlet weak var multipleButton: NSButton!
- @IBOutlet weak var bookletButton: NSButton!
-
- @IBOutlet weak var cancelButtonRightConstraint: NSLayoutConstraint!
-
- var delegate: KMPrintBottomViewDelegate?
- var type: KMPrintModelType = .size {
- didSet {
- self.updateButtonState()
- }
- }
- // 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.
-
- }
-
- func setup() {
- self.updateButtonState()
-
- self.printButton.title = NSLocalizedString("Printer", comment: "")
- self.cancelButton.title = NSLocalizedString("Cancel", comment: "")
- self.savePDFButton.title = NSLocalizedString("Save", comment: "")
-
- self.posterButton.title = NSLocalizedString("Poster", comment: "")
- self.bookletButton.title = NSLocalizedString("Booklet", comment: "")
- self.multipleButton.title = NSLocalizedString("Multiple", comment: "")
- }
-
- //刷新界面UI 和 数据
- func reloadData() {
-
- }
-
- func updateButtonState() {
- switch type {
- case .size:
- self.cancelButtonRightConstraint.constant = 20
-
- self.savePDFButton.isHidden = true
- self.posterButton.isHidden = false
- self.multipleButton.isHidden = false
- self.bookletButton.isHidden = false
- case .poster, .multipage, .pamphlet:
- self.cancelButtonRightConstraint.constant = 109
-
- self.savePDFButton.isHidden = false
- self.posterButton.isHidden = true
- self.multipleButton.isHidden = true
- self.bookletButton.isHidden = true
- default:
- break
- }
- }
-
-
-
- @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()
- }
- }
-
- @IBAction func bookletButtonAction(_ sender: Any) {
- self.delegate?.bookletAction()
- }
-
- @IBAction func multipleButtonAction(_ sender: Any) {
- self.delegate?.multipageAction()
- }
-
- @IBAction func poseterButtonAction(_ sender: Any) {
- self.delegate?.posterAction()
- }
- }
- protocol KMPrintBottomViewDelegate {
- func printerAction()
- func cancelAction()
- func printAction()
- func savePDFAction()
-
- func posterAction()
- func multipageAction()
- func bookletAction()
- }
|