// // KMLeftSideViewController+Search.swift // PDF Master // // Created by tangchao on 2023/12/24. // import Foundation // MARK: - Menu extension KMLeftSideViewController { @objc func addAnnotationsForSelections(_ sender: NSMenuItem) { guard let selections = sender.representedObject as? [CPDFSelection], selections.count > 0 else { return } for selection in selections { self.listView.addAnnotation(with: CAnnotationType(rawValue: sender.tag) ?? .circle, selection: selection, page: selection.page, bounds: selection.bounds) } } @objc func selectSelections(_ sender: NSMenuItem) { guard let selections = sender.representedObject as? [CPDFSelection], selections.count > 0 else { return } self.listView.currentSelection = CPDFSelection.selectionByAddingSelections(selections as NSArray) } @objc func toggleWholeWordSearch(_ sender: AnyObject?) { if self.mwcFlags.wholeWordSearch == 1 { self.mwcFlags.wholeWordSearch = 0 } else { self.mwcFlags.wholeWordSearch = 1 } if self.searchField.stringValue.isEmpty == false { self.search(self.searchField) } UserDefaults.standard.setValue(self.mwcFlags.wholeWordSearch, forKey: SKWholeWordSearchKey) UserDefaults.standard.synchronize() } }