KMSnapshotViewController.swift 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // KMSnapshotViewController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by Niehaoyu on 7/18/24.
  6. //
  7. import Cocoa
  8. class KMSnapshotViewController: NSViewController {
  9. @IBOutlet weak var snapshotNormalView: NSView!
  10. @IBOutlet weak var snapshotLabel: NSTextField!
  11. @IBOutlet weak var snapshotNormalMoreButton: NSButton!
  12. @IBOutlet weak var snapshotNormalSearchButton: NSButton!
  13. @IBOutlet weak var snapshotNormalZoomOutButton: NSButton!
  14. @IBOutlet weak var snapshotNormalZoomInButton: NSButton!
  15. @IBOutlet weak var snapshotSearchField: KMLeftSideViewSearchField!
  16. @IBOutlet weak var snapshotDoneButton: NSButton!
  17. @IBOutlet var snapshotTableView: KMBotaTableView!
  18. @IBOutlet var emptySnapView: NSView!
  19. @IBOutlet weak var emptySnapLabel: NSTextField!
  20. @IBOutlet weak var snapshotNotCreatedLabel: NSTextField!
  21. //
  22. // convenience init(type : KMLeftMethodMode) {
  23. // self.init()
  24. //
  25. // }
  26. override init(nibName nibNameOrNil: NSNib.Name?, bundle nibBundleOrNil: Bundle?) {
  27. super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
  28. }
  29. required init?(coder: NSCoder) {
  30. super.init(coder: coder)
  31. }
  32. override func viewDidLoad() {
  33. super.viewDidLoad()
  34. // Do view setup here.
  35. self.snapshotNormalView.wantsLayer = true
  36. if(KMAppearance.isDarkMode()){
  37. self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
  38. } else {
  39. self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
  40. }
  41. self.emptySnapView.wantsLayer = true
  42. self.emptySnapView.layer?.backgroundColor = .clear
  43. self.emptySnapLabel.stringValue = KMLocalizedString("To create snapshot select an area in contents, right click it and select \"Snapshot\" .",nil)
  44. self.emptySnapLabel.textColor = KMAppearance.Layout.h2Color()
  45. self.snapshotNotCreatedLabel.stringValue = KMLocalizedString("No Snapshots", nil)
  46. self.snapshotNotCreatedLabel.textColor = KMAppearance.Layout.h0Color()
  47. }
  48. func snapshot_initDefalutValue() {
  49. self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
  50. self.snapshotLabel.textColor = KMAppearance.Layout.h0Color()
  51. self.snapshotNormalSearchButton.toolTip = KMLocalizedString("Search", nil)
  52. self.snapshotSearchField.backgroundColor = KMAppearance.Layout.l_1Color()
  53. self.snapshotSearchField.wantsLayer = true
  54. self.snapshotSearchField.layer?.backgroundColor = KMAppearance.Layout.l_1Color().cgColor
  55. self.snapshotSearchField.layer?.borderWidth = 1.0
  56. self.snapshotSearchField.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
  57. self.snapshotDoneButton.toolTip = KMLocalizedString("Done", nil)
  58. self.snapshotDoneButton.wantsLayer = true
  59. self.snapshotDoneButton.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
  60. self.snapshotDoneButton.layer?.cornerRadius = 4.0
  61. self.snapshotDoneButton.title = KMLocalizedString("Done", nil)
  62. self.snapshotDoneButton.setTitleColor(KMAppearance.Layout.w0Color())
  63. self.snapshotDoneButton.isHidden = true
  64. self.snapshotSearchField.isHidden = true
  65. self.snapshotNormalZoomInButton.toolTip = KMLocalizedString("Zoom In", nil)
  66. self.snapshotNormalZoomOutButton.toolTip = KMLocalizedString("Zoom Out", nil)
  67. }
  68. func reloadData() {
  69. self.snapshotTableView.reloadData()
  70. }
  71. }