KMNotesPanelController.swift 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // KMNotesPanelController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by tangchao on 2024/1/8.
  6. //
  7. import Cocoa
  8. class KMNotesPanelController: NSWindowController {
  9. @IBOutlet weak var textBtn: NSButton!
  10. @IBOutlet weak var AnchoredBtn: NSButton!
  11. @IBOutlet weak var circleBtn: NSButton!
  12. @IBOutlet weak var rectangleBtn: NSButton!
  13. @IBOutlet weak var highlightBtn: NSButton!
  14. @IBOutlet weak var underlineBtn: NSButton!
  15. @IBOutlet weak var strikeThroughBtn: NSButton!
  16. @IBOutlet weak var lineBtn: NSButton!
  17. private static var _existFlag = false
  18. static let shared: KMNotesPanelController = {
  19. let windowC = KMNotesPanelController(windowNibName: "NotesPanel")
  20. _existFlag = true
  21. return windowC
  22. }()
  23. static func sharedControllerExists() -> Bool {
  24. // return shared != nil
  25. return _existFlag
  26. }
  27. private var SKNotesPanelFrameAutosaveName = "SKNotesPanel"
  28. override func windowDidLoad() {
  29. super.windowDidLoad()
  30. self.windowFrameAutosaveName = self.SKNotesPanelFrameAutosaveName
  31. self.window?.title = NSLocalizedString("Notes", comment: "")
  32. self.textBtn.title = NSLocalizedString("Text", comment: "")
  33. self.AnchoredBtn.title = NSLocalizedString("Anchored", comment: "")
  34. self.circleBtn.title = NSLocalizedString("Circle", comment: "")
  35. self.rectangleBtn.title = NSLocalizedString("Rectangle", comment: "")
  36. self.highlightBtn.title = NSLocalizedString("Highlight", comment: "")
  37. self.underlineBtn.title = NSLocalizedString("Underline", comment: "")
  38. self.strikeThroughBtn.title = NSLocalizedString("Strikethrough", comment: "")
  39. self.lineBtn.title = NSLocalizedString("Line", comment: "")
  40. }
  41. @IBAction func addNote(_ sender: Any?) {
  42. guard let windowC = NSApp.mainWindow?.windowController as? KMBrowserWindowController else {
  43. NSSound.beep()
  44. return
  45. }
  46. // addNoteFromPanel
  47. // windowC.addnote
  48. }
  49. }