// // KMNotesPanelController.swift // PDF Reader Pro // // Created by tangchao on 2024/1/8. // import Cocoa class KMNotesPanelController: NSWindowController { @IBOutlet weak var textBtn: NSButton! @IBOutlet weak var AnchoredBtn: NSButton! @IBOutlet weak var circleBtn: NSButton! @IBOutlet weak var rectangleBtn: NSButton! @IBOutlet weak var highlightBtn: NSButton! @IBOutlet weak var underlineBtn: NSButton! @IBOutlet weak var strikeThroughBtn: NSButton! @IBOutlet weak var lineBtn: NSButton! private static var _existFlag = false static let shared: KMNotesPanelController = { let windowC = KMNotesPanelController(windowNibName: "NotesPanel") _existFlag = true return windowC }() static func sharedControllerExists() -> Bool { // return shared != nil return _existFlag } private var SKNotesPanelFrameAutosaveName = "SKNotesPanel" override func windowDidLoad() { super.windowDidLoad() self.windowFrameAutosaveName = self.SKNotesPanelFrameAutosaveName self.window?.title = NSLocalizedString("Notes", comment: "") self.textBtn.title = NSLocalizedString("Text", comment: "") self.AnchoredBtn.title = NSLocalizedString("Anchored", comment: "") self.circleBtn.title = NSLocalizedString("Circle", comment: "") self.rectangleBtn.title = NSLocalizedString("Rectangle", comment: "") self.highlightBtn.title = NSLocalizedString("Highlight", comment: "") self.underlineBtn.title = NSLocalizedString("Underline", comment: "") self.strikeThroughBtn.title = NSLocalizedString("Strikethrough", comment: "") self.lineBtn.title = NSLocalizedString("Line", comment: "") } @IBAction func addNote(_ sender: Any?) { guard let windowC = NSApp.mainWindow?.windowController as? KMBrowserWindowController else { NSSound.beep() return } // addNoteFromPanel // windowC.addnote } }