KMCompareContentWindowController.swift 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // KMCompareContentWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by lizhe on 2023/11/20.
  6. //
  7. import Cocoa
  8. class KMCompareContentWindowController: NSWindowController {
  9. @IBOutlet weak var contentView: KMCompareContentView!
  10. var results: [CPDFCompareResults] = []
  11. var pdfDocument: CPDFDocument?
  12. var pdfOldDocumnet: CPDFDocument?
  13. var hideCloseInfo: Bool = false
  14. var saveHandle: ((KMCompareContentWindowController) -> Void)?
  15. var closeHandle: ((KMCompareContentWindowController) -> Void)?
  16. convenience init(document: CPDFDocument, oldDocument: CPDFDocument, results: [CPDFCompareResults]) {
  17. self.init(windowNibName: "KMCompareContentWindowController")
  18. self.results = results
  19. self.pdfOldDocumnet = oldDocument
  20. self.pdfDocument = document
  21. // contentView.oldDocument = oldDocument
  22. // contentView.document = document
  23. // contentView.compareResults = results
  24. }
  25. override func windowDidLoad() {
  26. super.windowDidLoad()
  27. guard let pdfOldDocumnet = pdfOldDocumnet else { return }
  28. guard let pdfDocument = pdfDocument else { return }
  29. contentView.oldDocument = pdfOldDocumnet
  30. contentView.document = pdfDocument
  31. contentView.compareResults = results
  32. contentView.closeHandle = {[unowned self] view in
  33. self.closeHandle?(self)
  34. }
  35. contentView.saveHandle = {[unowned self] view in
  36. self.saveHandle?(self)
  37. }
  38. }
  39. }