Browse Source

【BOTA】Snapshot优化01

niehaoyu 7 months ago
parent
commit
d7bb72372a

+ 1 - 9
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideEmptyFileViewController.swift

@@ -11,7 +11,6 @@ class KMLeftSideEmptyFileViewController: NSViewController {
 
     @IBOutlet weak var emptyOutlineView: NSView!
     @IBOutlet weak var emptyAnnotationView: NSView!
-    @IBOutlet weak var emptySnapView: NSView!
     @IBOutlet weak var addOutlineBox: NSBox!
     
     @IBOutlet weak var annotationBox: NSBox!
@@ -32,9 +31,7 @@ class KMLeftSideEmptyFileViewController: NSViewController {
     @IBOutlet weak var notCreateOutLine: NSTextField!
     @IBOutlet weak var emptyOutlineLabel: NSTextField!
     @IBOutlet weak var emptyAnnotationLabel: NSTextField!
-    @IBOutlet weak var emptySnapLabel: NSTextField!
     @IBOutlet weak var emptySearchResultLabel: NSTextField!
-    @IBOutlet weak var snapshotNotCreatedLabel: NSTextField!
     
     override func loadView() {
         super.loadView()
@@ -46,10 +43,7 @@ class KMLeftSideEmptyFileViewController: NSViewController {
         self.emptyAnnotationLabel.stringValue = KMLocalizedString("No Annotations",nil)
 //        self.emptyAnnotationLabel.textColor = KMAppearance.Layout.h0Color()
         self.emptyAnnotationLabel.textColor = NSColor.km_init(hex: "#94989C")
-        self.emptySnapLabel.stringValue = KMLocalizedString("To create snapshot select an area in contents, right click it and select \"Snapshot\" .",nil)
-        self.emptySnapLabel.textColor = KMAppearance.Layout.h2Color()
-        self.snapshotNotCreatedLabel.stringValue = KMLocalizedString("No Snapshots", nil)
-        self.snapshotNotCreatedLabel.textColor = KMAppearance.Layout.h0Color()
+
         self.searchOutlineSearchField.placeholderString = KMLocalizedString("Search Outline", nil)
 
         
@@ -67,8 +61,6 @@ class KMLeftSideEmptyFileViewController: NSViewController {
         self.emptySearchResultLabel.stringValue = KMLocalizedString("No Results", nil)
         self.emptySearchResultLabel.textColor = KMAppearance.Layout.h0Color()
         
-        self.emptySnapView.wantsLayer = true
-        self.emptySnapView.layer?.backgroundColor = .clear
         self.outlineSearchView.wantsLayer = true
         self.outlineSearchView.layer?.backgroundColor = .clear
         self.emptyAnnotationView.wantsLayer = true

+ 0 - 52
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideEmptyFileViewController.xib

@@ -19,8 +19,6 @@
                 <outlet property="emptyOutlineLabel" destination="7TT-b6-xI5" id="Mqs-EE-hBt"/>
                 <outlet property="emptyOutlineView" destination="t4B-v8-qQW" id="9Fc-tp-yrf"/>
                 <outlet property="emptySearchResultLabel" destination="hPH-of-lqx" id="S1a-fO-EwR"/>
-                <outlet property="emptySnapLabel" destination="yc4-ZB-O7V" id="wWh-hX-ENV"/>
-                <outlet property="emptySnapView" destination="1Hw-KB-Acz" id="6bx-Rj-S12"/>
                 <outlet property="exportAnnotationBtn" destination="VqP-1s-dWq" id="Tlx-09-4tj"/>
                 <outlet property="exportSnapBtn" destination="AKb-aF-sGs" id="vIn-GP-Ytw"/>
                 <outlet property="filterAnnotationBtn" destination="DG5-Xh-lr1" id="mae-jl-gYY"/>
@@ -29,7 +27,6 @@
                 <outlet property="outlineSearchView" destination="Er5-ma-Hwn" id="fsM-AP-jSW"/>
                 <outlet property="printSnapBtn" destination="W35-Dq-30v" id="IwE-3h-7py"/>
                 <outlet property="searchOutlineSearchField" destination="2gK-9s-hTv" id="g2S-Hp-4mZ"/>
-                <outlet property="snapshotNotCreatedLabel" destination="Kte-98-v4B" id="iVA-uk-ELr"/>
                 <outlet property="view" destination="kla-cS-TDk" id="WyY-m0-NsX"/>
             </connections>
         </customObject>
@@ -118,54 +115,6 @@
             </constraints>
             <point key="canvasLocation" x="-6084" y="-11706"/>
         </customView>
-        <customView id="1Hw-KB-Acz">
-            <rect key="frame" x="0.0" y="0.0" width="196" height="235"/>
-            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-            <subviews>
-                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cff-47-1UN">
-                    <rect key="frame" x="28" y="95" width="140" height="140"/>
-                    <constraints>
-                        <constraint firstAttribute="width" constant="140" id="D9R-rG-k1f"/>
-                        <constraint firstAttribute="height" constant="140" id="uWh-cy-dRq"/>
-                    </constraints>
-                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameEmptySnapshot" id="X5s-Om-ndi"/>
-                </imageView>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yc4-ZB-O7V">
-                    <rect key="frame" x="-2" y="0.0" width="200" height="51"/>
-                    <constraints>
-                        <constraint firstAttribute="width" constant="196" id="YrF-za-9sF"/>
-                    </constraints>
-                    <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="To create snapshot select an area in contents, right click it and select &quot;Snapshot&quot; ." id="00J-ae-K5G">
-                        <font key="font" metaFont="system" size="14"/>
-                        <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
-                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                </textField>
-                <textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Kte-98-v4B">
-                    <rect key="frame" x="24" y="59" width="149" height="20"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="20" id="NOe-Kc-oC0"/>
-                    </constraints>
-                    <textFieldCell key="cell" lineBreakMode="clipping" title="Snapshot not created" id="3xt-3c-PfH">
-                        <font key="font" metaFont="systemSemibold" size="14"/>
-                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
-                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                </textField>
-            </subviews>
-            <constraints>
-                <constraint firstAttribute="trailing" secondItem="yc4-ZB-O7V" secondAttribute="trailing" id="EFv-Sv-kOc"/>
-                <constraint firstItem="cff-47-1UN" firstAttribute="top" secondItem="1Hw-KB-Acz" secondAttribute="top" id="EuQ-mi-K7R"/>
-                <constraint firstItem="yc4-ZB-O7V" firstAttribute="centerX" secondItem="1Hw-KB-Acz" secondAttribute="centerX" id="FD9-Ay-ERd"/>
-                <constraint firstItem="Kte-98-v4B" firstAttribute="top" secondItem="cff-47-1UN" secondAttribute="bottom" constant="16" id="HZY-ov-V1R"/>
-                <constraint firstItem="cff-47-1UN" firstAttribute="centerX" secondItem="1Hw-KB-Acz" secondAttribute="centerX" id="aPz-YP-4di"/>
-                <constraint firstAttribute="bottom" secondItem="yc4-ZB-O7V" secondAttribute="bottom" id="cOo-2K-hXx"/>
-                <constraint firstItem="yc4-ZB-O7V" firstAttribute="leading" secondItem="1Hw-KB-Acz" secondAttribute="leading" id="ggE-kg-WOS"/>
-                <constraint firstItem="yc4-ZB-O7V" firstAttribute="top" secondItem="Kte-98-v4B" secondAttribute="bottom" constant="8" id="gsR-83-TXC"/>
-                <constraint firstItem="Kte-98-v4B" firstAttribute="centerX" secondItem="1Hw-KB-Acz" secondAttribute="centerX" id="xj4-V5-r29"/>
-            </constraints>
-            <point key="canvasLocation" x="-6452" y="-11265"/>
-        </customView>
         <box boxType="custom" borderWidth="0.0" title="Box" id="MIA-lH-jtO">
             <rect key="frame" x="0.0" y="0.0" width="227" height="35"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -386,7 +335,6 @@
         <image name="KMImageNameEmptyAnnotate" width="140" height="140"/>
         <image name="KMImageNameEmptyOutline" width="140" height="141"/>
         <image name="KMImageNameEmptySearch" width="140" height="140"/>
-        <image name="KMImageNameEmptySnapshot" width="140" height="140"/>
         <image name="KMImageNamePanelAdd" width="14" height="14"/>
         <image name="KMImageNamePanelDelete" width="14" height="14"/>
         <image name="KMImageNamePanelExport" width="14" height="14"/>

+ 3 - 16
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Action.swift

@@ -428,20 +428,8 @@ extension KMLeftSideViewController: NSSearchFieldDelegate {
                 self.tocOutlineView.reloadData()
             }
             self.outlineAddButton.isEnabled = !self.isSearchOutlineMode
-        } else if self.snapshotSearchField.isEqual(to: obj.object) {
-            let searchString = self.snapshotSearchField.stringValue
-//            NSPredicate *filterPredicate = nil;
-//            if ([searchString length] > 0) {
-//                NSExpression *lhs = [NSExpression expressionForConstantValue:searchString];
-//                NSExpression *rhs = [NSExpression expressionForKeyPath:@"string"];
-//                NSUInteger options = NSDiacriticInsensitivePredicateOption;
-//                if (mwcFlags.caseInsensitiveNoteSearch)
-//                    options |= NSCaseInsensitivePredicateOption;
-//                filterPredicate = [NSComparisonPredicate predicateWithLeftExpression:lhs rightExpression:rhs modifier:NSDirectPredicateModifier type:NSInPredicateOperatorType options:options];
-//            }
-//            [rightSideController.snapshotArrayController setFilterPredicate:filterPredicate];
-
-//            NSArray * snapshots = [rightSideController.snapshotArrayController arrangedObjects];
+        } else if ((self.snapshotController?.snapshotSearchField.isEqual(to: obj.object)) != nil) {
+            let searchString = self.snapshotController?.snapshotSearchField.stringValue ?? ""
             self.searchSnapshots.removeAll()
             if searchString.isEmpty {
                 self.isSearchSnapshotMode = false
@@ -545,12 +533,11 @@ extension KMLeftSideViewController {
         if let data = textfield?.stringValue.isEmpty, data == false {
             let findPboard = NSPasteboard(name: .find)
             findPboard.clearContents()
-//            findPboard.writeObjects([textfield!.stringValue])
         }
     }
     
     func updateSnapshotFilterPredicate() {
-        let searchString = self.snapshotSearchField.stringValue
+        let searchString = self.snapshotController?.snapshotSearchField.stringValue ?? ""
         self.searchSnapshots.removeAll()
         if self.findState == .snapshot && searchString.isEmpty == false {
             self.searchSnapshots = self.snapshots.filter({ model in

+ 34 - 75
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Snapshot.swift

@@ -118,27 +118,20 @@ extension KMLeftSideViewController {
     }
     
     func snapshot_initSubViews() {
-        self.snapshotNormalZoomInButton.target = self
-        self.snapshotNormalZoomInButton.tag = 2
-        self.snapshotNormalZoomInButton.action = #selector(thumbnailSizeScaling)
-        self.snapshotNormalZoomOutButton.target = self
-        self.snapshotNormalZoomOutButton.tag = 3
-        self.snapshotNormalZoomOutButton.action = #selector(thumbnailSizeScaling)
+        self.snapshotController?.snapshotNormalZoomInButton.target = self
+        self.snapshotController?.snapshotNormalZoomInButton.tag = 2
+        self.snapshotController?.snapshotNormalZoomInButton.action = #selector(thumbnailSizeScaling)
+        self.snapshotController?.snapshotNormalZoomOutButton.target = self
+        self.snapshotController?.snapshotNormalZoomOutButton.tag = 3
+        self.snapshotController?.snapshotNormalZoomOutButton.action = #selector(thumbnailSizeScaling)
   
-        self.snapshotNormalMoreButton.target = self
-        self.snapshotNormalMoreButton.tag = 300
-        self.snapshotNormalMoreButton.action = #selector(leftSideViewMoreButtonAction)
-
-        self.snapshotSearchZoomInButton.target = self
-        self.snapshotSearchZoomInButton.tag = 2
-        self.snapshotSearchZoomInButton.action = #selector(thumbnailSizeScaling)
-        self.snapshotSearchZoomOutButton.target = self
-        self.snapshotSearchZoomOutButton.tag = 3
-        self.snapshotSearchZoomOutButton.action = #selector(thumbnailSizeScaling)
-
-        self.snapshotDoneButton.target = self
-        self.snapshotDoneButton.tag = 312
-        self.snapshotDoneButton.action = #selector(leftSideViewDoneButtonAction)
+        self.snapshotController?.snapshotNormalMoreButton.target = self
+        self.snapshotController?.snapshotNormalMoreButton.tag = 300
+        self.snapshotController?.snapshotNormalMoreButton.action = #selector(leftSideViewMoreButtonAction)
+ 
+        self.snapshotController?.snapshotDoneButton.target = self
+        self.snapshotController?.snapshotDoneButton.tag = 312
+        self.snapshotController?.snapshotDoneButton.action = #selector(leftSideViewDoneButtonAction)
         
         self.snapshotTableView.delegate = self
         self.snapshotTableView.dataSource = self
@@ -150,7 +143,7 @@ extension KMLeftSideViewController {
         
         self.snapshotTableView.setDraggingSourceOperationMask(.every, forLocal: false)
         
-        self.snapshotSearchField.changeCallBack = { [weak self] changeContent in
+        self.snapshotController?.snapshotSearchField.changeCallBack = { [weak self] changeContent in
             var editContent = ""
             if changeContent != nil {
                 editContent = changeContent!
@@ -160,64 +153,31 @@ extension KMLeftSideViewController {
     }
     
     func snapshot_initDefalutValue() {
-        self.snapshotNormalView.wantsLayer = true
-        self.snapshotNormalView.layer?.backgroundColor = KMAppearance.Layout.l0Color().cgColor
-        
-        self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
-        self.snapshotLabel.textColor = KMAppearance.Layout.h0Color()
-        self.snapshotNormalSearchButton.toolTip = KMLocalizedString("Search", nil)
-        
-        self.snapshotSearchField.backgroundColor = KMAppearance.Layout.l_1Color()
-        self.snapshotSearchField.wantsLayer = true
-        self.snapshotSearchField.layer?.backgroundColor = KMAppearance.Layout.l_1Color().cgColor
-        self.snapshotSearchField.layer?.borderWidth = 1.0
-        self.snapshotSearchField.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
-        
-        self.snapshotDoneButton.toolTip = KMLocalizedString("Done", nil)
-        self.snapshotDoneButton.wantsLayer = true
-        self.snapshotDoneButton.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
-        self.snapshotDoneButton.layer?.cornerRadius = 4.0
-        self.snapshotDoneButton.title = KMLocalizedString("Done", nil)
-        self.snapshotDoneButton.setTitleColor(KMAppearance.Layout.w0Color())
-        self.snapshotDoneButton.isHidden = true
         
-        self.snapshotSearchField.isHidden = true
-        self.snapshotSearchZoomOutButton.isHidden = true
-        self.snapshotSearchZoomInButton.isHidden = true
-        
-        self.snapshotNormalZoomInButton.toolTip = KMLocalizedString("Zoom In", nil)
-        self.snapshotSearchZoomInButton.toolTip = KMLocalizedString("Zoom In", nil)
-        self.snapshotNormalZoomOutButton.toolTip = KMLocalizedString("Zoom Out", nil)
-        self.snapshotSearchZoomOutButton.toolTip = KMLocalizedString("Zoom Out", nil)
-        
-        self.snapshotTableView.backgroundColor = KMAppearance.Layout.l0Color()
-//        self.snapshotTableView.backgroundColor = .clear
     }
     
     func updataLeftSideSnapView() {
         if (snapshots.count < 1) {
-            self.snapshotNormalSearchButton.isEnabled = false
-            self.snapshotNormalZoomOutButton.isEnabled = false
-            self.snapshotNormalZoomInButton.isEnabled = false
-            self.snapshotNormalMoreButton.isEnabled = false
+            self.snapshotController?.snapshotNormalSearchButton.isEnabled = false
+            self.snapshotController?.snapshotNormalZoomOutButton.isEnabled = false
+            self.snapshotController?.snapshotNormalZoomInButton.isEnabled = false
+            self.snapshotController?.snapshotNormalMoreButton.isEnabled = false
             
             self.leftSideEmptyVC.deleteSnapBtn.isEnabled = false
             self.leftSideEmptyVC.exportSnapBtn.isEnabled = false
             self.leftSideEmptyVC.printSnapBtn.isEnabled = false
             self.snapshotTableView.usesAlternatingRowBackgroundColors = false
-            let view = self.snapshotTableView.enclosingScrollView
-            let viewSize = view?.frame.size ?? .zero
-            let emptyVcSize =  self.leftSideEmptyVC.emptySnapView.frame.size
-            self.leftSideEmptyVC.emptySnapView.frame = NSMakeRect((viewSize.width-emptyVcSize.width)/2.0,(viewSize.height-emptyVcSize.height)/2.0, emptyVcSize.width, emptyVcSize.height);
-            self.leftSideEmptyVC.emptySnapView.autoresizingMask = [.minXMargin, .maxXMargin, .minYMargin, .maxYMargin]
-            self.snapshotTableView.enclosingScrollView?.documentView?.addSubview(self.leftSideEmptyVC.emptySnapView)
+
+            self.snapshotController?.emptySnapView.isHidden = false
+            
         } else {
-            self.snapshotNormalSearchButton.isEnabled = true
-            self.snapshotNormalZoomOutButton.isEnabled = true
-            self.snapshotNormalZoomInButton.isEnabled = true
-            self.snapshotNormalMoreButton.isEnabled = true
+            self.snapshotController?.snapshotNormalSearchButton.isEnabled = true
+            self.snapshotController?.snapshotNormalZoomOutButton.isEnabled = true
+            self.snapshotController?.snapshotNormalZoomInButton.isEnabled = true
+            self.snapshotController?.snapshotNormalMoreButton.isEnabled = true
 
-            self.leftSideEmptyVC.emptySnapView.removeFromSuperview()
+            self.snapshotController?.emptySnapView.isHidden = true
+            
             self.leftSideEmptyVC.deleteSnapBtn.isEnabled = true
             self.leftSideEmptyVC.exportSnapBtn.isEnabled = true
             self.leftSideEmptyVC.printSnapBtn.isEnabled = true
@@ -225,15 +185,14 @@ extension KMLeftSideViewController {
     }
     
     @IBAction func snapshotNormalSearchButtonAction(_ sender: NSButton) {
-        self.snapshotSearchField.isHidden = false
-        self.snapshotSearchZoomInButton.isHidden = true
-        self.snapshotNormalSearchButton.isHidden = true
-        self.snapshotDoneButton.isHidden = false
-        self.snapshotLabel.isHidden = true
-        self.snapshotNormalZoomOutButton.isHidden = true
-        self.snapshotNormalZoomInButton.isHidden = true
+        self.snapshotController?.snapshotSearchField.isHidden = false
+        self.snapshotController?.snapshotNormalSearchButton.isHidden = true
+        self.snapshotController?.snapshotDoneButton.isHidden = false
+        self.snapshotController?.snapshotLabel.isHidden = true
+        self.snapshotController?.snapshotNormalZoomOutButton.isHidden = true
+        self.snapshotController?.snapshotNormalZoomInButton.isHidden = true
         
-        self.snapshotSearchField.becomeFirstResponder()
+        self.snapshotController?.snapshotSearchField.becomeFirstResponder()
     }
 }
 

+ 25 - 35
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -39,16 +39,6 @@ class KMLeftSideViewController: KMSideViewController {
     @IBOutlet var searchViewController: KMBotaSearchViewController!
     @IBOutlet weak var toolButtonBox: NSBox!
     @IBOutlet weak var toolButtonBoxLayoutConstraint: NSLayoutConstraint!
-    @IBOutlet weak var snapshotNormalView: NSView!
-    @IBOutlet weak var snapshotLabel: NSTextField!
-    @IBOutlet weak var snapshotNormalMoreButton: NSButton!
-    @IBOutlet weak var snapshotNormalSearchButton: NSButton!
-    @IBOutlet weak var snapshotNormalZoomOutButton: NSButton!
-    @IBOutlet weak var snapshotNormalZoomInButton: NSButton!
-    @IBOutlet weak var snapshotSearchZoomOutButton: NSButton!
-    @IBOutlet weak var snapshotSearchZoomInButton: NSButton!
-    @IBOutlet weak var snapshotSearchField: KMLeftSideViewSearchField!
-    @IBOutlet weak var snapshotDoneButton: NSButton!
     
     @IBOutlet weak var outlineView: NSView!
     @IBOutlet weak var outlineMoreButton: NSButton!
@@ -221,6 +211,9 @@ class KMLeftSideViewController: KMSideViewController {
     
     private var deletePages_ = Set<CPDFPage>()
     
+    var snapshotController: KMSnapshotViewController?
+    
+    
     deinit {
         KMPrint("KMLeftSideViewController deinit.")
         
@@ -344,7 +337,7 @@ class KMLeftSideViewController: KMSideViewController {
                 }
                 FMTrackEventManager.defaultManager.trackEvent(event: "LeftSidebar", withProperties: ["LeftSidebar_Btn": "Btn_LeftSidebar_Snapshot"])
                 self.refreshMethodType(methodType: .snapshot)
-                self.toolButtonBox.contentView = self.snapshotNormalView
+                self.toolButtonBox.contentView = self.snapshotController?.snapshotNormalView
                 self.updateSnapshotFilterPredicate()
                 self.displaySnapshotViewAnimating(false)
                 self.updataLeftSideSnapView()
@@ -472,7 +465,7 @@ class KMLeftSideViewController: KMSideViewController {
         frame.origin.y = 0
         frame.size.height = self.snapshotTableView.enclosingScrollView?.superview?.frame.size.height ?? 0
         self.snapshotTableView.enclosingScrollView?.frame = frame
-        self.leftSideEmptyVC.emptySnapView.removeFromSuperview()
+        self.snapshotController?.emptySnapView.isHidden = true
         
         self.updataLeftSideSnapView()
     }
@@ -666,15 +659,15 @@ class KMLeftSideViewController: KMSideViewController {
     }
     
     func displaySnapshotFind() {
-        self.searchField = self.snapshotSearchField;
+        self.searchField = self.snapshotController?.snapshotSearchField;
         
         let menu = NSMenu()
         _ = menu.addItem(title: KMLocalizedString("Ignore Case", "Menu item title"), action: #selector(toggleCaseInsensitiveNoteSearch), target: self)
-        (self.snapshotSearchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menu
-        (self.snapshotSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Snapshots", "placeholder")
-        self.snapshotSearchField.action = #selector(searchNotes)
-        self.snapshotSearchField.target = self
-        self.snapshotSearchField.delegate = self
+        (self.snapshotController?.snapshotSearchField.cell as? NSSearchFieldCell)?.searchMenuTemplate = menu
+        (self.snapshotController?.snapshotSearchField.cell as? NSSearchFieldCell)?.placeholderString = KMLocalizedString("Search Snapshots", "placeholder")
+        self.snapshotController?.snapshotSearchField.action = #selector(searchNotes)
+        self.snapshotController?.snapshotSearchField.target = self
+        self.snapshotController?.snapshotSearchField.delegate = self
     }
     
     func resetThumbnails(ks: Bool = true) {
@@ -715,13 +708,12 @@ class KMLeftSideViewController: KMSideViewController {
             self.noteFilterButton.isHidden = false
             self.noteMoreButton.isHidden = false
         } else if (tag == 312) {
-            self.snapshotSearchField.isHidden = true
-    //        leftSideController.snapshotSearchZoomInButton.hidden = YES;
-            self.snapshotNormalSearchButton.isHidden = false
-            self.snapshotDoneButton.isHidden = true
-            self.snapshotLabel.isHidden = false
-            self.snapshotNormalZoomOutButton.isHidden = false
-            self.snapshotNormalZoomInButton.isHidden = false
+            self.snapshotController?.snapshotSearchField.isHidden = true
+            self.snapshotController?.snapshotNormalSearchButton.isHidden = false
+            self.snapshotController?.snapshotDoneButton.isHidden = true
+            self.snapshotController?.snapshotLabel.isHidden = false
+            self.snapshotController?.snapshotNormalZoomOutButton.isHidden = false
+            self.snapshotController?.snapshotNormalZoomInButton.isHidden = false
         }
     }
 
@@ -959,7 +951,6 @@ extension KMLeftSideViewController {
     private func _updateViewColor() {
         if(KMAppearance.isDarkMode()){
             self.leftListView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
-            self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
             self.thumbnailView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
             self.noteView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
             self.outlineView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
@@ -969,17 +960,16 @@ extension KMLeftSideViewController {
             self.tocOutlineView.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1)
             self.findTableView.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1)
             
-            self.snapshotSearchField.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
+            self.snapshotController?.snapshotSearchField.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
             self.outlineSearchField.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
             self.noteSearchField.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
             self.segmentedControl.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
             
-            self.snapshotSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
+            self.snapshotController?.snapshotSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
             self.outlineSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
             self.noteSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
         } else {
             self.leftListView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
-            self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
             self.thumbnailView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
             self.noteView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
             self.outlineView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
@@ -990,12 +980,12 @@ extension KMLeftSideViewController {
             self.tocOutlineView.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1.000, alpha: 1)
             self.findTableView.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1.000, alpha: 1)
             
-            self.snapshotSearchField.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
+            self.snapshotController?.snapshotSearchField.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
             self.outlineSearchField.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
             self.noteSearchField.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
             self.segmentedControl.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
             
-            self.snapshotSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
+            self.snapshotController?.snapshotSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
             self.outlineSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
             self.noteSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
         }
@@ -1153,14 +1143,14 @@ extension KMLeftSideViewController: NSTableViewDelegate, NSTableViewDataSource {
             var newScaling = scaling + 0.1
             let newSnapshotHeight = snapshotSize.width * newScaling.cgFloat
             if (newSnapshotHeight > Self.kMinSidePaneWidth) {
-                self.snapshotNormalZoomInButton.isEnabled = false
+                self.snapshotController?.snapshotNormalZoomInButton.isEnabled = false
             } else {
-                self.snapshotNormalZoomInButton.isEnabled = true
+                self.snapshotController?.snapshotNormalZoomInButton.isEnabled = true
             }
             if ((scaling - 0.1) < 0.3 || (newSnapshotHeight < 150.0)) {
-                self.snapshotNormalZoomOutButton.isEnabled = false
+                self.snapshotController?.snapshotNormalZoomOutButton.isEnabled = false
             } else {
-                self.snapshotNormalZoomOutButton.isEnabled = true
+                self.snapshotController?.snapshotNormalZoomOutButton.isEnabled = true
             }
 
             let cellHeight = snapshotSize.height + 24.0

File diff suppressed because it is too large
+ 5 - 139
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/LeftSideView.xib


+ 77 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Snapshot/KMSnapshotViewController.swift

@@ -0,0 +1,77 @@
+//
+//  KMSnapshotViewController.swift
+//  PDF Reader Pro
+//
+//  Created by Niehaoyu on 7/18/24.
+//
+
+import Cocoa
+
+class KMSnapshotViewController: NSViewController {
+
+    @IBOutlet weak var snapshotNormalView: NSView!
+    @IBOutlet weak var snapshotLabel: NSTextField!
+    @IBOutlet weak var snapshotNormalMoreButton: NSButton!
+    @IBOutlet weak var snapshotNormalSearchButton: NSButton!
+    @IBOutlet weak var snapshotNormalZoomOutButton: NSButton!
+    @IBOutlet weak var snapshotNormalZoomInButton: NSButton!
+    @IBOutlet weak var snapshotSearchField: KMLeftSideViewSearchField!
+    @IBOutlet weak var snapshotDoneButton: NSButton!
+    
+    @IBOutlet var snapshotTableView: KMBotaTableView!
+    
+    @IBOutlet var emptySnapView: NSView!
+    @IBOutlet weak var emptySnapLabel: NSTextField!
+    @IBOutlet weak var snapshotNotCreatedLabel: NSTextField!
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        
+        
+        
+        self.snapshotNormalView.wantsLayer = true
+        if(KMAppearance.isDarkMode()){
+            self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.149, green: 0.157, blue: 0.169, alpha: 1).cgColor
+        } else {
+            self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
+        }
+        
+        self.emptySnapView.wantsLayer = true
+        self.emptySnapView.layer?.backgroundColor = .clear
+        self.emptySnapLabel.stringValue = KMLocalizedString("To create snapshot select an area in contents, right click it and select \"Snapshot\" .",nil)
+        self.emptySnapLabel.textColor = KMAppearance.Layout.h2Color()
+        self.snapshotNotCreatedLabel.stringValue = KMLocalizedString("No Snapshots", nil)
+        self.snapshotNotCreatedLabel.textColor = KMAppearance.Layout.h0Color()
+        
+    }
+    
+    func snapshot_initDefalutValue() {
+        self.snapshotLabel.stringValue = KMLocalizedString("Snapshots", nil)
+        self.snapshotLabel.textColor = KMAppearance.Layout.h0Color()
+        self.snapshotNormalSearchButton.toolTip = KMLocalizedString("Search", nil)
+        
+        self.snapshotSearchField.backgroundColor = KMAppearance.Layout.l_1Color()
+        self.snapshotSearchField.wantsLayer = true
+        self.snapshotSearchField.layer?.backgroundColor = KMAppearance.Layout.l_1Color().cgColor
+        self.snapshotSearchField.layer?.borderWidth = 1.0
+        self.snapshotSearchField.layer?.borderColor = KMAppearance.Interactive.a0Color().cgColor
+        
+        self.snapshotDoneButton.toolTip = KMLocalizedString("Done", nil)
+        self.snapshotDoneButton.wantsLayer = true
+        self.snapshotDoneButton.layer?.backgroundColor = KMAppearance.Interactive.a0Color().cgColor
+        self.snapshotDoneButton.layer?.cornerRadius = 4.0
+        self.snapshotDoneButton.title = KMLocalizedString("Done", nil)
+        self.snapshotDoneButton.setTitleColor(KMAppearance.Layout.w0Color())
+        self.snapshotDoneButton.isHidden = true
+        
+        self.snapshotSearchField.isHidden = true
+        
+        self.snapshotNormalZoomInButton.toolTip = KMLocalizedString("Zoom In", nil)
+        self.snapshotNormalZoomOutButton.toolTip = KMLocalizedString("Zoom Out", nil)
+        
+        
+    }
+    
+}

File diff suppressed because it is too large
+ 302 - 0
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Snapshot/KMSnapshotViewController.xib


+ 16 - 0
PDF Office/PDF Reader Pro.xcodeproj/project.pbxproj

@@ -4197,6 +4197,12 @@
 		BB9EA1572B1EEAAC00EAFD9B /* KMImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9EA1562B1EEAAC00EAFD9B /* KMImageModel.swift */; };
 		BB9EA1582B1EEAAC00EAFD9B /* KMImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9EA1562B1EEAAC00EAFD9B /* KMImageModel.swift */; };
 		BB9EA1592B1EEAAC00EAFD9B /* KMImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9EA1562B1EEAAC00EAFD9B /* KMImageModel.swift */; };
+		BB9F97702C48E4D500445430 /* KMSnapshotViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9F976E2C48E4D500445430 /* KMSnapshotViewController.swift */; };
+		BB9F97712C48E4D500445430 /* KMSnapshotViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9F976E2C48E4D500445430 /* KMSnapshotViewController.swift */; };
+		BB9F97722C48E4D500445430 /* KMSnapshotViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9F976E2C48E4D500445430 /* KMSnapshotViewController.swift */; };
+		BB9F97732C48E4D500445430 /* KMSnapshotViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB9F976F2C48E4D500445430 /* KMSnapshotViewController.xib */; };
+		BB9F97742C48E4D500445430 /* KMSnapshotViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB9F976F2C48E4D500445430 /* KMSnapshotViewController.xib */; };
+		BB9F97752C48E4D500445430 /* KMSnapshotViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BB9F976F2C48E4D500445430 /* KMSnapshotViewController.xib */; };
 		BBA00AC42B157C880043D903 /* KMToolbarZoomItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA00AC32B157C880043D903 /* KMToolbarZoomItemView.swift */; };
 		BBA00AC52B157C880043D903 /* KMToolbarZoomItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA00AC32B157C880043D903 /* KMToolbarZoomItemView.swift */; };
 		BBA00AC62B157C880043D903 /* KMToolbarZoomItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA00AC32B157C880043D903 /* KMToolbarZoomItemView.swift */; };
@@ -6923,6 +6929,8 @@
 		BB9EA14E2B1ECD0400EAFD9B /* KMBatchOperateImageToPDFViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBatchOperateImageToPDFViewController.swift; sourceTree = "<group>"; };
 		BB9EA1522B1ECD0F00EAFD9B /* KMBatchOperateImageToPDFViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMBatchOperateImageToPDFViewController.xib; sourceTree = "<group>"; };
 		BB9EA1562B1EEAAC00EAFD9B /* KMImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMImageModel.swift; sourceTree = "<group>"; };
+		BB9F976E2C48E4D500445430 /* KMSnapshotViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMSnapshotViewController.swift; sourceTree = "<group>"; };
+		BB9F976F2C48E4D500445430 /* KMSnapshotViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMSnapshotViewController.xib; sourceTree = "<group>"; };
 		BBA00AC32B157C880043D903 /* KMToolbarZoomItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMToolbarZoomItemView.swift; sourceTree = "<group>"; };
 		BBA19F3129ADAC81001A285A /* signPicture_hover.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = signPicture_hover.pdf; sourceTree = "<group>"; };
 		BBA19F3529ADACC5001A285A /* signPicture_nor.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = signPicture_nor.pdf; sourceTree = "<group>"; };
@@ -11558,6 +11566,8 @@
 			children = (
 				BBBC08812B2AC845009B237F /* Model */,
 				BB3A66942B071AED00575343 /* View */,
+				BB9F976E2C48E4D500445430 /* KMSnapshotViewController.swift */,
+				BB9F976F2C48E4D500445430 /* KMSnapshotViewController.xib */,
 			);
 			path = Snapshot;
 			sourceTree = "<group>";
@@ -14209,6 +14219,7 @@
 				9F8539EB2947131F00DF644E /* KMChromiumTabView.xib in Resources */,
 				BB8F454A295A9CDC0037EA22 /* KMHeaderFooterListController.xib in Resources */,
 				9F853A082947137500DF644E /* newtab.pdf in Resources */,
+				BB9F97732C48E4D500445430 /* KMSnapshotViewController.xib in Resources */,
 				AD7D5CD72B95767C006562CD /* KMBookmarkOutlineTitleCellView.xib in Resources */,
 				BB0FE04F2B734DD1001E0F88 /* AIPurchaseWindowController.xib in Resources */,
 				8997011128F40842009AF911 /* KMOutlineViewController.xib in Resources */,
@@ -14470,6 +14481,7 @@
 				899700E328F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
 				BB328B612B55512F00B382C6 /* KMVerificationMessageViewController.xib in Resources */,
 				BB8F4543295A98960037EA22 /* KMHeaderFooterPropertyController.xib in Resources */,
+				BB9F97742C48E4D500445430 /* KMSnapshotViewController.xib in Resources */,
 				ADBC375929CAE95700D93208 /* KMComparativeOutlineSectionCell.xib in Resources */,
 				AD3AAD172B0B5B2700DE5FE7 /* KMCompareContentWindowController.xib in Resources */,
 				ADDF83482B391A5C00A81A4E /* DSignatureCreateInfoViewController.xib in Resources */,
@@ -15264,6 +15276,7 @@
 				9F8539D029430BF300DF644E /* KMBrowserWindowController.xib in Resources */,
 				ADE8BC2C29F7CDB000570F89 /* KMPageNumberDisplayView.xib in Resources */,
 				BBFD2B182AEFAC9C0016C456 /* KMBatchOperateBaseViewController.xib in Resources */,
+				BB9F97752C48E4D500445430 /* KMSnapshotViewController.xib in Resources */,
 				AD7D5CD92B95767C006562CD /* KMBookmarkOutlineTitleCellView.xib in Resources */,
 				BB0FE0512B734DD1001E0F88 /* AIPurchaseWindowController.xib in Resources */,
 				BBFE6E622930809A00142C01 /* KMMergeCollectionPageViewItem.xib in Resources */,
@@ -16233,6 +16246,7 @@
 				BB2C84882BAE753F00AF6142 /* KMBotaTools.swift in Sources */,
 				AD7D5C852B8ECD83006562CD /* KMPDFSyncRecord.swift in Sources */,
 				9F1F82C3292F113A0092C4B4 /* KMHomeDragView.swift in Sources */,
+				BB9F97702C48E4D500445430 /* KMSnapshotViewController.swift in Sources */,
 				9F080B14298CFDB300FC27DA /* KMTextImageButtonVC.swift in Sources */,
 				BBB14A5F297929BD00936EDB /* KMRedactPageRangeWindowController.swift in Sources */,
 				BBB789842BE8BF2300F7E09C /* AIChatInfoManager.swift in Sources */,
@@ -16772,6 +16786,7 @@
 				BB146FDC299DC0D100784A6A /* GTLRDriveService.m in Sources */,
 				ADE86AA52B031FF000414DFA /* KMCompareView.swift in Sources */,
 				BB4BD9CD2909026500A66A65 /* KMRightSideViewController.swift in Sources */,
+				BB9F97712C48E4D500445430 /* KMSnapshotViewController.swift in Sources */,
 				BB1A916B2AFB7868005E5FD8 /* KMConvertWindowController.swift in Sources */,
 				BB276A532B03776000AB5578 /* KMConvertOperationQueue.swift in Sources */,
 				BB8810652B4F74DD00AFA63E /* KMRepeatTrialAlertController.m in Sources */,
@@ -18609,6 +18624,7 @@
 				9FCFEC9A2AD14EEF00EAD2CB /* KMMailHelper.swift in Sources */,
 				BBC745EC295F067B0072C2ED /* KMCropSettingWindowController.swift in Sources */,
 				BB90E4F02AF3546500B04B9F /* NSUserDefaultsController+KMExtension.swift in Sources */,
+				BB9F97722C48E4D500445430 /* KMSnapshotViewController.swift in Sources */,
 				ADDF832E2B391A5C00A81A4E /* NSEvent+PDFListView.m in Sources */,
 				ADE8BC2729F7CCA600570F89 /* KMPageNumberDisplayView.swift in Sources */,
 				BBB789862BE8BF2300F7E09C /* AIChatInfoManager.swift in Sources */,

+ 37 - 5
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1068,16 +1068,48 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "8D336205-6DF5-4580-A180-A1642B9A4784"
+            uuid = "116B29E6-A655-459E-A23E-D754648851EB"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/Search/KMBotaSearchViewController.swift"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "45"
-            endingLineNumber = "45"
-            landmarkName = "loadView()"
+            startingLineNumber = "722"
+            endingLineNumber = "722"
+            landmarkName = "thumbnailSizeScaling(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "600600A0-2E98-4C47-B308-B421E623CB98"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "425"
+            endingLineNumber = "425"
+            landmarkName = "displayThumbnailViewAnimating(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "2F4152D6-9535-4AAF-9C30-3C2C48856162"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "465"
+            endingLineNumber = "465"
+            landmarkName = "displayFindViewAnimating(_:)"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>