Browse Source

Merge branch 'develop' of git.kdan.cc:Mac_PDF/PDF_Office into develop

tangchao 1 year ago
parent
commit
bbd1e08be6

+ 2 - 2
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -311,8 +311,8 @@ extension KMBrowserWindowController: KMToolbarRightViewDelegate {
         }
     }
     
-    func homeRefreshButtonAction(_ sender: NSButton) {
-        
+    func homeRefreshButtonAction(_ sender: NSButton?) {
+        self.layoutSubviews()
     }
     
     func homeUploadButtonAction(_ sender: NSButton) {

+ 8 - 8
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.xib

@@ -5,7 +5,7 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBrowserWindowController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBrowserWindowController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="fileSearchView_" destination="eJO-4K-8Fw" id="eOY-0e-9xQ"/>
                 <outlet property="fileUploadPanel" destination="iH2-4t-6uG" id="zAQ-Xv-eYu"/>
@@ -33,7 +33,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="1280" height="786"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kjc-aQ-qNb" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+                            <customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kjc-aQ-qNb" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="208" y="481" width="163" height="96"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                             </customView>
@@ -46,7 +46,7 @@
             </connections>
             <point key="canvasLocation" x="21" y="144"/>
         </window>
-        <customView id="xy6-xE-uD2" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="xy6-xE-uD2" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="418" height="55"/>
             <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
             <subviews>
@@ -144,7 +144,7 @@
             </connections>
             <point key="canvasLocation" x="104.5" y="581.5"/>
         </customView>
-        <customView id="p5u-KH-T9i" customClass="KMToolbarRightView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="p5u-KH-T9i" customClass="KMToolbarRightView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="267" height="45"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
             <subviews>
@@ -162,7 +162,7 @@
                         <action selector="userInfoButtonAction:" target="xy6-xE-uD2" id="UcG-2p-rY4"/>
                     </connections>
                 </button>
-                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WXF-Ar-JGk" customClass="KMSegmentedBox" customModule="PDF_Office" customModuleProvider="target">
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="WXF-Ar-JGk" customClass="KMSegmentedBox" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="60" y="12" width="163" height="21"/>
                     <view key="contentView" id="pfi-aZ-YRi">
                         <rect key="frame" x="0.0" y="0.0" width="163" height="21"/>
@@ -241,7 +241,7 @@
             </connections>
             <point key="canvasLocation" x="-3.5" y="718.5"/>
         </customView>
-        <customView id="eJO-4K-8Fw" userLabel="Management Search View" customClass="KMFileSearchView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="eJO-4K-8Fw" userLabel="Management Search View" customClass="KMFileSearchView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="145" height="22"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
@@ -301,7 +301,7 @@
             </connections>
             <point key="canvasLocation" x="43" y="538"/>
         </customView>
-        <window title="Panel" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="iH2-4t-6uG" userLabel="Progress Panel" customClass="KMUploadFilePanel" customModule="PDF_Office" customModuleProvider="target">
+        <window title="Panel" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="iH2-4t-6uG" userLabel="Progress Panel" customClass="KMUploadFilePanel" customModule="PDF_Master" customModuleProvider="target">
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="1127" y="748" width="369" height="111"/>
@@ -355,7 +355,7 @@ Gw
             </connections>
             <point key="canvasLocation" x="-80" y="1015"/>
         </window>
-        <customView id="zbC-Pu-Vky" userLabel="TabBar" customClass="KMTabStripView" customModule="PDF_Office" customModuleProvider="target">
+        <customView id="zbC-Pu-Vky" userLabel="TabBar" customClass="KMTabStripView" customModule="PDF_Master" customModuleProvider="target">
             <rect key="frame" x="0.0" y="0.0" width="483" height="40"/>
             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
             <subviews>

+ 23 - 13
PDF Office/PDF Master/Class/ChromiumTabs/KMToolbarRightView.swift

@@ -10,7 +10,7 @@ import Cocoa
 @objc protocol KMToolbarRightViewDelegate {
     @objc func pdfRightSegmentedControlAction(_ sender: KMSegmentedBox?)
     @objc func userInfoButtonAction(_ sender: NSButton)
-    @objc func homeRefreshButtonAction(_ sender: NSButton)
+    @objc func homeRefreshButtonAction(_ sender: NSButton?)
     @objc func homeUploadButtonAction(_ sender: NSButton)
     @objc func homeMenuSortAction(_ sender: NSPopUpButton)
     @objc func homeMenuFilterAction(_ sender: NSPopUpButton)
@@ -63,15 +63,7 @@ import Cocoa
             }
             
             if self.rightSegmentControlConstraint != nil {
-                let paragraphStyle = NSMutableParagraphStyle()
-                paragraphStyle.lineHeightMultiple = 1.32
-                paragraphStyle.alignment = .right
-                let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
-                                  NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
-                let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
-                let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
-                                              attributes: attributes).size
-                
+                let size = self.fetchAdvancedViewSize()
                 self.rightSegmentControlConstraint.constant = size.width + 20
             }
         } else {
@@ -98,11 +90,29 @@ import Cocoa
         }
     }
     
+    func fetchAdvancedViewSize() -> CGSize {
+        let paragraphStyle = NSMutableParagraphStyle()
+        paragraphStyle.lineHeightMultiple = 1.32
+        paragraphStyle.alignment = .right
+        let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
+                          NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
+        let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
+        let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
+                                      attributes: attributes).size
+        
+        return size
+    }
+    
     func addNotification() {
         self.removeNotification()
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
-        NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
+        NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
+    }
+    
+    func updateAdvancedContentView() {
+        self.updateView()
+        self.delete?.homeRefreshButtonAction(nil)
     }
     
     func removeNotification() {

+ 7 - 2
PDF Office/PDF Master/Class/ChromiumTabs/src/Browser Window/CTBrowserWindowController.m

@@ -863,7 +863,7 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     
     CTTabContents* document = [self.browser activeTabContents];
 
-    NSView* rightStripView = nil;
+    KMToolbarRightView *rightStripView = nil;
     if (document.isHome) {
         rightStripView = self.homeRightStripView;
     } else {
@@ -873,6 +873,7 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     CGFloat rightWidth = NSWidth([rightStripView frame]);
     if ([[KMLightMemberManager manager] canShowAdvancedView] && ![[KMLightMemberManager manager] isLogin]) {
         rightWidth = NSWidth([rightStripView frame]);
+        rightWidth += rightStripView.fetchAdvancedViewSize.width;
     } else {
         rightWidth = 56.0;
     }
@@ -891,7 +892,11 @@ static CTBrowserWindowController* _currentMain = nil; // weak
     
     [tabStripController_ setIndentForControls:0];
 
-    [rightStripView setFrame:NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight)];
+//    [rightStripView setFrame:NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight)];
+    self.homeRightStripView.frame = NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight);
+    self.rightStripView.frame = NSMakeRect(NSMaxX(tabStripView.frame), maxY, rightWidth, tabStripHeight);
+    [(KMToolbarRightView *)self.rightStripView updateView];
+    [(KMToolbarRightView *)self.homeRightStripView updateView];
 
     // Set indentation.
     [tabStripController_ layoutTabsWithoutAnimation];

+ 5 - 6
PDF Office/PDF Master/Class/PDFTools/ImageToPDF/View/KMBatchProcessingView/KMBatchProcessingView.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchProcessingView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchProcessingView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="addBox" destination="CFL-oP-esw" id="EUt-9H-7zF"/>
                 <outlet property="cleanButton" destination="ZW9-hb-VaF" id="5kP-QY-Dep"/>
@@ -24,10 +23,10 @@
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="GnF-d1-s3v">
                     <rect key="frame" x="0.0" y="52" width="632" height="576"/>
                     <subviews>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="OMY-wn-4ox" customClass="KMBatchProcessingTableView" customModule="PDF_Office" customModuleProvider="target">
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="OMY-wn-4ox" customClass="KMBatchProcessingTableView" customModule="PDF_Master" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="0.0" width="632" height="576"/>
                         </customView>
-                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Btb-75-0Y1" customClass="KMBatchSelectedFilesView" customModule="PDF_Office" customModuleProvider="target">
+                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Btb-75-0Y1" customClass="KMBatchSelectedFilesView" customModule="PDF_Master" customModuleProvider="target">
                             <rect key="frame" x="0.0" y="0.0" width="632" height="576"/>
                         </customView>
                     </subviews>

+ 9 - 0
PDF Office/PDF Master/Class/PDFTools/ImageToPDF/View/KMBatchProcessingView/SelectedFiles/KMBatchSelectedFilesView.swift

@@ -13,6 +13,7 @@ class KMBatchSelectedFilesView: KMBaseXibView {
     @IBOutlet weak var imageButton: NSButton!
     @IBOutlet weak var titleLabel: NSTextField!
     @IBOutlet weak var subtitleLabel: NSTextField!
+    @IBOutlet weak var box: KMBox!
     
     var inputType: DataNavigationViewButtonActionType?
     var data: [URL] = []
@@ -37,6 +38,14 @@ class KMBatchSelectedFilesView: KMBaseXibView {
         self.subtitleLabel.textColor = NSColor.init(hex: "#94989C")
         self.subtitleLabel.font = NSFont.SFProTextRegular(12.0)
         self.subtitleLabel.stringValue = NSLocalizedString("Drop files here or Click Add Files at bottom left button.", comment: "")
+        
+        self.box.moveCallback = { [unowned self] mouseEntered, mouseBox in
+            if mouseEntered {
+                self.imageButton.image = NSImage(named: "icon_empty_add_hov")
+            } else {
+                self.imageButton.image = NSImage(named: "icon_empty_add_norm")
+            }
+        }
     }
 }
 

+ 18 - 4
PDF Office/PDF Master/Class/PDFTools/ImageToPDF/View/KMBatchProcessingView/SelectedFiles/KMBatchSelectedFilesView.xib

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchSelectedFilesView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchSelectedFilesView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
+                <outlet property="box" destination="y5i-wB-Qel" id="ZZN-sE-YKB"/>
                 <outlet property="imageButton" destination="STJ-AT-hZ8" id="zQz-NR-i0B"/>
                 <outlet property="subtitleLabel" destination="zH4-UK-9qG" id="B6o-JS-9vD"/>
                 <outlet property="titleLabel" destination="sAL-Vd-XZZ" id="tMW-xI-LeS"/>
@@ -22,6 +22,17 @@
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="Ibq-pW-6fR">
                     <rect key="frame" x="62" y="136" width="418" height="200"/>
                     <subviews>
+                        <box boxType="custom" borderWidth="0.0" cornerRadius="4" translatesAutoresizingMaskIntoConstraints="NO" id="y5i-wB-Qel" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                            <rect key="frame" x="145" y="72" width="128" height="128"/>
+                            <view key="contentView" id="aGb-yq-zUB">
+                                <rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="128" id="1ea-VG-Qef"/>
+                                <constraint firstAttribute="width" constant="128" id="vNq-f1-LJQ"/>
+                            </constraints>
+                        </box>
                         <button translatesAutoresizingMaskIntoConstraints="NO" id="STJ-AT-hZ8">
                             <rect key="frame" x="145" y="72" width="128" height="128"/>
                             <constraints>
@@ -65,10 +76,13 @@
                         <constraint firstItem="sAL-Vd-XZZ" firstAttribute="centerX" secondItem="Ibq-pW-6fR" secondAttribute="centerX" id="9Y7-jS-EwI"/>
                         <constraint firstItem="zH4-UK-9qG" firstAttribute="centerX" secondItem="Ibq-pW-6fR" secondAttribute="centerX" id="G28-DZ-VIh"/>
                         <constraint firstItem="STJ-AT-hZ8" firstAttribute="top" secondItem="Ibq-pW-6fR" secondAttribute="top" id="HWS-Fs-hwa"/>
+                        <constraint firstItem="y5i-wB-Qel" firstAttribute="centerX" secondItem="Ibq-pW-6fR" secondAttribute="centerX" id="Mjf-JJ-wUX"/>
                         <constraint firstItem="STJ-AT-hZ8" firstAttribute="centerX" secondItem="Ibq-pW-6fR" secondAttribute="centerX" id="XRB-UH-BSM"/>
                         <constraint firstAttribute="height" constant="200" id="dRa-O2-ZIE"/>
                         <constraint firstAttribute="width" constant="418" id="jX2-q2-wWm"/>
+                        <constraint firstItem="sAL-Vd-XZZ" firstAttribute="top" secondItem="y5i-wB-Qel" secondAttribute="bottom" constant="8" id="jnU-i7-WuC"/>
                         <constraint firstItem="sAL-Vd-XZZ" firstAttribute="top" secondItem="STJ-AT-hZ8" secondAttribute="bottom" constant="8" id="lzf-9u-xTI"/>
+                        <constraint firstItem="y5i-wB-Qel" firstAttribute="top" secondItem="Ibq-pW-6fR" secondAttribute="top" id="sev-fp-PCp"/>
                         <constraint firstItem="zH4-UK-9qG" firstAttribute="top" secondItem="sAL-Vd-XZZ" secondAttribute="bottom" constant="2" id="zHD-xY-uIQ"/>
                     </constraints>
                 </customView>

+ 3 - 4
PDF Office/PDF Master/Class/PDFTools/ImageToPDF/View/KMBatchProcessingView/Tableview/KMBatchProcessingTableView.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchProcessingTableView" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMBatchProcessingTableView" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="contentView" destination="c22-O7-iKe" id="B0n-CN-hq3"/>
                 <outlet property="tableView" destination="iF7-ag-gLW" id="zPn-P7-7Gb"/>

+ 27 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Search/KMSearchViewController.swift

@@ -60,6 +60,8 @@ class KMSearchViewController: NSViewController {
     var searchResults : [KMSearchMode] = []
     var sortResults : [KMSearchMode] = []
     var isCancelCell : String = ""
+    var previousSearchString: String = ""
+    var previousCase: Bool = true
     open weak var delegate: KMSearchViewControllerDelegate?
 
     override func viewDidLoad() {
@@ -115,6 +117,7 @@ class KMSearchViewController: NSViewController {
         } else {
             self.isCase = UserDefaults.standard.bool(forKey: "CPDFOfficeSearchIgnoreCaseKey")
         }
+        self.previousCase = self.isCase
         
         self.findTipTextField.stringValue = NSLocalizedString("Search", comment: "")
         self.findTipTextField.font = NSFont.SFProTextSemibold(14.0)
@@ -199,7 +202,7 @@ extension KMSearchViewController: NSSearchFieldDelegate {
         var searchs : [String] = UserDefaults.standard.object(forKey: CPDFOfficeSearchHistoryKey) as? [String] ?? []
         let searchString = self.searchTextField.stringValue
         
-        if searchString != "" {
+        if searchString != "" && (self.previousSearchString != searchString || self.isCase != self.previousCase) {
             //缓存搜索词汇是否重复
             if searchs.contains(searchString) {
                 searchs.removeObject(searchString)
@@ -221,6 +224,9 @@ extension KMSearchViewController: NSSearchFieldDelegate {
             }
             self.outlineView.expandItem(nil, expandChildren: true)
             self.selectAllSearchModel()
+            
+            self.previousSearchString = searchString
+            self.previousCase = self.isCase
         }
         
         //移除响应
@@ -291,14 +297,16 @@ extension KMSearchViewController {
     }
     
     @IBAction func searchHistoryAction(sender: NSMenuItem) {
-        self.delegate?.searchAction?(searchString: sender.title, isCase:self.isCase)
+//        self.delegate?.searchAction?(searchString: sender.title, isCase:self.isCase)
         self.searchTextField.stringValue = sender.title
+        self.searchDoneAction()
     }
     
     @IBAction func caseSetAction(sender:Any) {
         self.isCase = !self.isCase
         UserDefaults.standard.set(self.isCase, forKey: "CPDFOfficeSearchIgnoreCaseKey")
         self.updateSearchMenu()
+        self.searchDoneAction()
     }
     
     @IBAction func clearSearchHistoryAction(sender:Any) {
@@ -545,7 +553,7 @@ extension KMSearchViewController: NSTextFieldDelegate {
     func controlTextDidEndEditing(_ obj: Notification) {
         let object = obj.object as! NSTextField
         if object == self.searchTextField {
-            self.searchDoneAction()
+//            self.searchDoneAction()
 //            self.sortResults = []
 //            self.reloadData()
         }
@@ -562,6 +570,22 @@ extension KMSearchViewController: NSTextFieldDelegate {
             }
         }
     }
+    
+    func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
+        switch commandSelector {
+        case #selector(NSResponder.insertNewline(_:)):
+            if let inputView = control as? NSTextField {
+                //当当前TextField按下enter
+                if inputView == searchTextField {
+                    print("按下 enter")
+                    self.searchDoneAction()
+                }
+            }
+            return true
+        default:
+            return false
+        }
+    }
 }
 
 extension KMSearchViewController: NSMenuDelegate, NSMenuItemValidation {

+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Thumbnail/KMThumbnailViewController.swift

@@ -530,13 +530,13 @@ class KMThumbnailViewController: NSViewController {
                 let _ = KMComparativeTableViewController.show(window: self.view.window!)
                 return
             }
-        }
-        
-        let indexs = self.thumbnailView.collectionView.selectionIndexes
-        if indexs.count > 0 {
-            self.deletePageItemWithIndexs(indexs: indexs)
-            // 事件外面传递
-            self.delegate?.controller?(controller: self, itemClick: menu, itemKey: .delete, params: nil)
+            
+            let indexs = self.thumbnailView.collectionView.selectionIndexes
+            if indexs.count > 0 {
+                self.deletePageItemWithIndexs(indexs: indexs)
+                // 事件外面传递
+                self.delegate?.controller?(controller: self, itemClick: menu, itemKey: .delete, params: nil)
+            }
         }
     }
     

+ 16 - 34
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -8,7 +8,7 @@
 import Foundation
 
 extension KMMainViewController {
-    func search(searchString:String,isCase:Bool) {
+    func search(searchString: String, isCase: Bool) {
         let document = self.listView.document
         if ((document?.isFinding) != nil) {
             document?.cancelFindString()
@@ -19,42 +19,24 @@ extension KMMainViewController {
             self.leftSideViewController.searchViewController.reloadData()
         } else {
             mwcFlags.wholeWordSearch = isCase == true ? 1 : 0
-            if mwcFlags.wholeWordSearch != 0 {
-                let words = KMOCToolClass.scannerCharaterString(searchString)!
-                var string = words.firstObject as? String
-                if string == nil {
-                    string = ""
-                }
-                let findArray : [[CPDFSelection]] = self.listView.document.findString(string) ?? []
-                self.searchResults.removeAll()
-                for selections in findArray {
-                    for selection in selections {
-//                        if KMOCToolClass.wholeWord(with: selection, keyword: searchString) {
-                            let mode : KMSearchMode = KMSearchMode()
-                            mode.selection = selection
-                            mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
-                            mode.selectionPageIndex = self.listView.document.index(for: selection.page)
-                            self.searchResults.insert(mode, at: self.searchResults.count)
-//                        }
-                    }
-                }
-                self.leftSideViewController.searchViewController.searchResults = self.searchResults
-                self.leftSideViewController.searchViewController.reloadData()
+            var findArray : [[CPDFSelection]]
+            if isCase {
+                findArray = self.listView.document.findString(searchString) ?? []
             } else {
-                let findArray : [[CPDFSelection]] = self.listView.document.findString(searchString) ?? []
-                self.searchResults.removeAll()
-                for selections in findArray {
-                    for selection in selections {
-                        let mode : KMSearchMode = KMSearchMode()
-                        mode.selection = selection
-                        mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
-                        mode.selectionPageIndex = self.listView.document.index(for: selection.page)
-                        self.searchResults.insert(mode, at: self.searchResults.count)
-                    }
+                findArray = self.listView.document.findString(searchString, with: .caseSensitive) ?? []
+            }
+            self.searchResults.removeAll()
+            for selections in findArray {
+                for selection in selections {
+                    let mode : KMSearchMode = KMSearchMode()
+                    mode.selection = selection
+                    mode.attributedString = KMOCToolClass.getAttributedString(with: selection, keyword: searchString)
+                    mode.selectionPageIndex = self.listView.document.index(for: selection.page)
+                    self.searchResults.insert(mode, at: self.searchResults.count)
                 }
-                self.leftSideViewController.searchViewController.searchResults = self.searchResults
-                self.leftSideViewController.searchViewController.reloadData()
             }
+            self.leftSideViewController.searchViewController.searchResults = self.searchResults
+            self.leftSideViewController.searchViewController.reloadData()
         }
     }