|
@@ -14,6 +14,10 @@ extension KMNoteOutlineFilterViewController {
|
|
|
static let filterSelectStateKey = "KMNoteOutlineFilterSelectArray_State"
|
|
|
}
|
|
|
|
|
|
+//class KMNoteOutlineFilterViewController_window: NSWindow {
|
|
|
+//
|
|
|
+//}
|
|
|
+
|
|
|
typealias NoteFilterVC = KMNoteOutlineFilterViewController
|
|
|
class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
|
|
@@ -141,18 +145,20 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
self.colorCollectionView.dataSource = self
|
|
|
self.typeCollectionView.delegate = self
|
|
|
self.typeCollectionView.dataSource = self
|
|
|
- self.collectionView.delegate = self
|
|
|
- self.collectionView.dataSource = self
|
|
|
-
|
|
|
- if self.scrollView.superview == nil {
|
|
|
- self.mainScrollView.documentView?.addSubview(self.scrollView)
|
|
|
- }
|
|
|
- self.scrollView.mas_remakeConstraints { make in
|
|
|
- make?.leading.equalTo()(16)
|
|
|
- make?.top.equalTo()(self.stateLabel.mas_bottom)?.offset()(8)
|
|
|
- make?.right.equalTo()(-16)
|
|
|
- make?.height.equalTo()(self.stateH_)
|
|
|
- }
|
|
|
+// self.collectionView.delegate = self
|
|
|
+// self.collectionView.dataSource = self
|
|
|
+ self.stateCollectionView.delegate = self
|
|
|
+ self.stateCollectionView.dataSource = self
|
|
|
+
|
|
|
+// if self.scrollView.superview == nil {
|
|
|
+// self.mainScrollView.documentView?.addSubview(self.scrollView)
|
|
|
+// }
|
|
|
+// self.scrollView.mas_remakeConstraints { make in
|
|
|
+// make?.leading.equalTo()(16)
|
|
|
+// make?.top.equalTo()(self.stateLabel.mas_bottom)?.offset()(8)
|
|
|
+// make?.right.equalTo()(-16)
|
|
|
+// make?.height.equalTo()(self.stateH_)
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
func updateStates(states: [CPDFAnnotationState]) {
|
|
@@ -179,6 +185,11 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
@IBOutlet weak var cancelButton: NSButton!
|
|
|
@IBOutlet weak var OKButton: NSButton!
|
|
|
|
|
|
+
|
|
|
+ @IBOutlet weak var stateView: NSView!
|
|
|
+ @IBOutlet weak var stateScrollView: NSScrollView!
|
|
|
+ @IBOutlet weak var stateCollectionView: NSCollectionView!
|
|
|
+
|
|
|
@IBOutlet weak var authorCollectionView: NSCollectionView!
|
|
|
@IBOutlet weak var colorCollectionView: NSCollectionView!
|
|
|
@IBOutlet weak var typeCollectionView: NSCollectionView!
|
|
@@ -201,12 +212,14 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
view.scrollerStyle = .overlay
|
|
|
|
|
|
view.drawsBackground = false
|
|
|
+// view.focusRingType = .none
|
|
|
view.borderType = .noBorder
|
|
|
- view.wantsLayer = true
|
|
|
- view.layer?.backgroundColor = NSColor.clear.cgColor
|
|
|
+// view.wantsLayer = true
|
|
|
+// view.layer?.backgroundColor = NSColor.blue.cgColor
|
|
|
+// view.backgroundColor = .red
|
|
|
|
|
|
- view.wantsLayer = true
|
|
|
- view.contentView.layer?.backgroundColor = .clear
|
|
|
+// view.wantsLayer = true
|
|
|
+// view.contentView.layer?.backgroundColor = .clear
|
|
|
|
|
|
return view
|
|
|
}()
|
|
@@ -260,6 +273,30 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
|
|
|
DistributedNotificationCenter.default().removeObserver(self)
|
|
|
}
|
|
|
+
|
|
|
+// override func viewWillAppear() {
|
|
|
+// super.viewWillAppear()
|
|
|
+//
|
|
|
+// for sv in self.collectionView.subviews {
|
|
|
+// if let data = sv as? NSVisualEffectView {
|
|
|
+// data.wantsLayer = true
|
|
|
+// data.layer?.backgroundColor = NSColor.purple.cgColor
|
|
|
+// }
|
|
|
+// }
|
|
|
+// self.scrollView.backgroundColor = .red
|
|
|
+// self.scrollView.borderType = .noBorder
|
|
|
+// self.collectionView.wantsLayer = true
|
|
|
+// self.collectionView.layer?.backgroundColor = NSColor.blue.cgColor
|
|
|
+// for sv in self.scrollView.subviews {
|
|
|
+//// if let data = sv as? NSVisualEffectView {
|
|
|
+// sv.wantsLayer = true
|
|
|
+// sv.layer?.backgroundColor = NSColor.purple.cgColor
|
|
|
+//// }
|
|
|
+// }
|
|
|
+// self.scrollView.contentView.drawsBackground = false
|
|
|
+// self.scrollView.contentView.backgroundColor = .red
|
|
|
+// }
|
|
|
+
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
@@ -334,18 +371,41 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
make?.top.equalTo()(self.authorCollectionView.mas_bottom)?.offset()(8)
|
|
|
}
|
|
|
|
|
|
- if self.scrollView.superview == nil {
|
|
|
- self.mainScrollView.documentView?.addSubview(self.scrollView)
|
|
|
- }
|
|
|
- self.scrollView.mas_remakeConstraints { make in
|
|
|
+// if self.scrollView.superview == nil {
|
|
|
+// self.mainScrollView.documentView?.addSubview(self.scrollView)
|
|
|
+// }
|
|
|
+
|
|
|
+ self.stateView.mas_remakeConstraints { make in
|
|
|
make?.leading.equalTo()(16)
|
|
|
make?.top.equalTo()(self.stateLabel.mas_bottom)?.offset()(8)
|
|
|
make?.right.equalTo()(-16)
|
|
|
make?.height.equalTo()(self.stateH_)
|
|
|
}
|
|
|
+
|
|
|
+ self.stateScrollView.mas_remakeConstraints { make in
|
|
|
+// make?.leading.equalTo()(16)
|
|
|
+// make?.top.equalTo()(self.stateLabel.mas_bottom)?.offset()(8)
|
|
|
+// make?.right.equalTo()(-16)
|
|
|
+// make?.height.equalTo()(self.stateH_)
|
|
|
+ make?.edges.equalTo()(0)
|
|
|
+ }
|
|
|
// self.scrollView.autoresizingMask = [.width, .height]
|
|
|
|
|
|
- self.scrollView.documentView = self.collectionView
|
|
|
+// self.scrollView.documentView = self.collectionView
|
|
|
+// self.collectionView.backgroundView?.wantsLayer = true
|
|
|
+// self.collectionView.backgroundView?.layer?.backgroundColor = NSColor.blue.cgColor
|
|
|
+// self.collectionView.wantsLayer = true
|
|
|
+// self.collectionView.layer?.backgroundColor = NSColor.red.cgColor
|
|
|
+
|
|
|
+ for sv in self.collectionView.subviews {
|
|
|
+ if let data = sv as? NSVisualEffectView {
|
|
|
+// data.wantsLayer = true
|
|
|
+// data.layer?.backgroundColor = NSColor.purple.cgColor
|
|
|
+ data.isHidden = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ self.scrollView.drawsBackground = false
|
|
|
|
|
|
self.typeCollectionView.enclosingScrollView?.scrollerStyle = .legacy
|
|
|
self.typeCollectionView.enclosingScrollView?.autohidesScrollers = true
|
|
@@ -354,9 +414,14 @@ class KMNoteOutlineFilterViewController: NSViewController {
|
|
|
self.authorCollectionView.enclosingScrollView?.scrollerStyle = .legacy
|
|
|
self.authorCollectionView.enclosingScrollView?.autohidesScrollers = true
|
|
|
|
|
|
+ self.scrollView.scrollerStyle = .legacy
|
|
|
+ self.scrollView.autohidesScrollers = true
|
|
|
+// self.scrollView.alphaValue = 0
|
|
|
+
|
|
|
self.authorCollectionView.register(KMNoteFilterCollevtionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteFilterCollevtionViewItem"))
|
|
|
self.colorCollectionView.register(KMNoteColorCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteColorCollectionViewItem"))
|
|
|
self.typeCollectionView.register(KMNoteTypeCollectionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteTypeCollectionViewItem"))
|
|
|
+ self.stateCollectionView.register(KMNoteFilterStateCollevtionViewItem.self, forItemWithIdentifier: NSUserInterfaceItemIdentifier("KMNoteFilterStateCollevtionViewItem"))
|
|
|
|
|
|
DistributedNotificationCenter.default().addObserver(self, selector: #selector(_themeChanged), name: NSApplication.interfaceThemeChangedNotification, object: nil)
|
|
|
|
|
@@ -499,7 +564,7 @@ extension KMNoteOutlineFilterViewController: NSCollectionViewDelegate, NSCollect
|
|
|
return self._colorMutableArray?.count ?? 0
|
|
|
} else if collectionView.isEqual(to: self.typeCollectionView) {
|
|
|
return self._typeMutableArray?.count ?? 0
|
|
|
- } else if collectionView.isEqual(to: self.collectionView) {
|
|
|
+ } else if collectionView.isEqual(to: self.stateCollectionView) {
|
|
|
return self.stateArray_.count
|
|
|
}
|
|
|
return 0
|
|
@@ -556,7 +621,7 @@ extension KMNoteOutlineFilterViewController: NSCollectionViewDelegate, NSCollect
|
|
|
}
|
|
|
}
|
|
|
return item
|
|
|
- } else if collectionView.isEqual(to: self.collectionView) {
|
|
|
+ } else if collectionView.isEqual(to: self.stateCollectionView) {
|
|
|
let item = collectionView.makeItem(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "KMNoteFilterStateCollevtionViewItem"), for: indexPath) as! KMNoteFilterStateCollevtionViewItem
|
|
|
|
|
|
let state = self.stateArray_[indexPath.item]
|
|
@@ -578,6 +643,8 @@ extension KMNoteOutlineFilterViewController: NSCollectionViewDelegate, NSCollect
|
|
|
}
|
|
|
}
|
|
|
// let state = self.stateArray_[indexPath.item]
|
|
|
+// item.view.wantsLayer = true
|
|
|
+// item.view.layer?.backgroundColor = NSColor.orange.cgColor
|
|
|
item.label.stringValue = KMPDFAnnotationStateGetString(state: state) ?? ""
|
|
|
if let data = KMPDFAnnotationStateGetIcon(state: state) {
|
|
|
item.iv.image = NSImage(named: data)
|
|
@@ -598,7 +665,7 @@ extension KMNoteOutlineFilterViewController: NSCollectionViewDelegate, NSCollect
|
|
|
return NSMakeSize(24, 24)
|
|
|
} else if collectionView.isEqual(self.typeCollectionView) {
|
|
|
return NSMakeSize(24, 24)
|
|
|
- } else if collectionView.isEqual(to: self.collectionView) {
|
|
|
+ } else if collectionView.isEqual(to: self.stateCollectionView) {
|
|
|
let state = self.stateArray_[indexPath.item]
|
|
|
let string = KMPDFAnnotationStateGetString(state: state) ?? ""
|
|
|
let width = self._widthOfString(string, font: .SFProTextRegularFont(14)) + 12 + 16 + 8 + 8
|