Browse Source

【综合】刷选窗UI调整

tangchao 5 months ago
parent
commit
8d69467d4e

+ 91 - 24
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift

@@ -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

+ 42 - 1
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.xib

@@ -6,7 +6,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMNoteOutlineFilterViewController" customModule="PDF_Master" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMNoteOutlineFilterViewController" customModule="PDF_Reader_Pro" customModuleProvider="target">
             <connections>
                 <outlet property="OKButton" destination="Q36-TR-heS" id="IIb-by-xE2"/>
                 <outlet property="applyWidthConst" destination="DNw-rt-8Kg" id="CkL-dg-WE9"/>
@@ -24,6 +24,9 @@
                 <outlet property="filterButtonView" destination="wsX-g6-qi9" id="uWE-dV-GVl"/>
                 <outlet property="mainScrollView" destination="OBX-fQ-pdq" id="vv6-ye-7gp"/>
                 <outlet property="scrollConstraint" destination="W4F-1b-Wr4" id="T2B-aj-PIE"/>
+                <outlet property="stateCollectionView" destination="ixq-QO-5sP" id="sZB-ku-ydb"/>
+                <outlet property="stateScrollView" destination="fsf-R2-8j4" id="9vD-1D-Ka5"/>
+                <outlet property="stateView" destination="2FA-Ce-Bjg" id="gii-kx-ohF"/>
                 <outlet property="typeCollectionView" destination="lww-MI-hzj" id="P66-0z-n6U"/>
                 <outlet property="typeLabel" destination="bHN-tD-pde" id="lEf-Zc-w9L"/>
                 <outlet property="typeViewLayoutConstraint" destination="X5B-pq-PLX" id="DQR-Be-IR0"/>
@@ -236,6 +239,44 @@
                                             <constraint firstAttribute="trailing" secondItem="JLB-3L-Mbh" secondAttribute="trailing" id="cRZ-0w-vcX"/>
                                         </constraints>
                                     </customView>
+                                    <customView ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2FA-Ce-Bjg">
+                                        <rect key="frame" x="17" y="91" width="226" height="40"/>
+                                        <subviews>
+                                            <scrollView wantsLayer="YES" ambiguous="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="fsf-R2-8j4">
+                                                <rect key="frame" x="0.0" y="0.0" width="226" height="40"/>
+                                                <clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="Hu9-NZ-o4e">
+                                                    <rect key="frame" x="0.0" y="0.0" width="226" height="40"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <collectionView ambiguous="YES" selectable="YES" id="ixq-QO-5sP">
+                                                            <rect key="frame" x="0.0" y="0.0" width="226" height="40"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+                                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" id="gTa-MW-kBo">
+                                                                <size key="itemSize" width="50" height="50"/>
+                                                            </collectionViewFlowLayout>
+                                                            <color key="primaryBackgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                            <color key="secondaryBackgroundColor" white="1" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                        </collectionView>
+                                                    </subviews>
+                                                </clipView>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="dOF-65-Bru">
+                                                    <rect key="frame" x="-100" y="-100" width="233" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="00O-Rs-JRj">
+                                                    <rect key="frame" x="211" y="0.0" width="15" height="31"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="fsf-R2-8j4" firstAttribute="top" secondItem="2FA-Ce-Bjg" secondAttribute="top" id="PrX-Aw-KPL"/>
+                                            <constraint firstAttribute="bottom" secondItem="fsf-R2-8j4" secondAttribute="bottom" id="Wke-Da-9yk"/>
+                                            <constraint firstItem="fsf-R2-8j4" firstAttribute="leading" secondItem="2FA-Ce-Bjg" secondAttribute="leading" id="jiw-pt-W3e"/>
+                                            <constraint firstAttribute="height" constant="40" id="s9l-jv-sgt"/>
+                                            <constraint firstAttribute="trailing" secondItem="fsf-R2-8j4" secondAttribute="trailing" id="uY1-lc-gjK"/>
+                                        </constraints>
+                                    </customView>
                                 </subviews>
                                 <constraints>
                                     <constraint firstItem="bHN-tD-pde" firstAttribute="top" secondItem="If1-Rk-rcV" secondAttribute="top" constant="17" id="2jw-Vn-uGn"/>