Преглед изворни кода

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

tangchao пре 2 година
родитељ
комит
b191f3bd50

+ 8 - 0
PDF Office/PDF Office.xcodeproj/project.pbxproj

@@ -1481,6 +1481,9 @@
 		ADCB9971292C65EE00B51A03 /* KMGOCROperation.m in Sources */ = {isa = PBXBuildFile; fileRef = ADCB9969292C65EE00B51A03 /* KMGOCROperation.m */; };
 		ADCB9972292C65EE00B51A03 /* KMGOCROperation.m in Sources */ = {isa = PBXBuildFile; fileRef = ADCB9969292C65EE00B51A03 /* KMGOCROperation.m */; };
 		ADCB9973292C65EE00B51A03 /* KMGOCROperation.m in Sources */ = {isa = PBXBuildFile; fileRef = ADCB9969292C65EE00B51A03 /* KMGOCROperation.m */; };
+		ADCFFC0229C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCFFC0129C004AD007D3657 /* KMBookMarkTableRowView.swift */; };
+		ADCFFC0329C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCFFC0129C004AD007D3657 /* KMBookMarkTableRowView.swift */; };
+		ADCFFC0429C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADCFFC0129C004AD007D3657 /* KMBookMarkTableRowView.swift */; };
 		ADD1B6A529416FE800C3FFF7 /* KMOCRPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD1B6A429416FE800C3FFF7 /* KMOCRPresenter.swift */; };
 		ADD1B6A629416FE800C3FFF7 /* KMOCRPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD1B6A429416FE800C3FFF7 /* KMOCRPresenter.swift */; };
 		ADD1B6A729416FE800C3FFF7 /* KMOCRPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD1B6A429416FE800C3FFF7 /* KMOCRPresenter.swift */; };
@@ -3663,6 +3666,7 @@
 		ADCB9968292C65EE00B51A03 /* KMOCROperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMOCROperation.m; sourceTree = "<group>"; };
 		ADCB9969292C65EE00B51A03 /* KMGOCROperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMGOCROperation.m; sourceTree = "<group>"; };
 		ADCB996A292C65EE00B51A03 /* KMGOCRManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMGOCRManager.h; sourceTree = "<group>"; };
+		ADCFFC0129C004AD007D3657 /* KMBookMarkTableRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMBookMarkTableRowView.swift; sourceTree = "<group>"; };
 		ADD1B6A429416FE800C3FFF7 /* KMOCRPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMOCRPresenter.swift; sourceTree = "<group>"; };
 		ADD1B6A92941E97F00C3FFF7 /* KMPrintWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPrintWindowController.swift; sourceTree = "<group>"; };
 		ADD1B6AA2941E97F00C3FFF7 /* KMPrintWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMPrintWindowController.xib; sourceTree = "<group>"; };
@@ -4496,6 +4500,7 @@
 				BBA19F4229ADE6A2001A285A /* KMBookMarkRowView.swift */,
 				BBA19F3D29ADE40A001A285A /* KMCellEmptyView.h */,
 				BBA19F3E29ADE40A001A285A /* KMCellEmptyView.m */,
+				ADCFFC0129C004AD007D3657 /* KMBookMarkTableRowView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -9560,6 +9565,7 @@
 				ADCB98E92924778C00B51A03 /* KMBatchProcessingStateTableCell.swift in Sources */,
 				F373230B292DF9410013862C /* CPDFTextWidgetAnnotation+PDFListView.m in Sources */,
 				9F0CB45F2966C9E200007028 /* KMFormPropertPanelViewController.swift in Sources */,
+				ADCFFC0229C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */,
 				9FAAA339290F72CC0046FFCE /* KMHistoryFileCollectionView.swift in Sources */,
 				BB99ACCA292DEE6E0048AFD9 /* KMMergeTitleBar.swift in Sources */,
 				BB4DD043299B291A00E80DF6 /* KMCloudNoNetworkView.swift in Sources */,
@@ -10280,6 +10286,7 @@
 				F37322E2292DF9410013862C /* CPDFChoiceWidgetAnnotation+PDFListView.m in Sources */,
 				ADD1B6E92946C02600C3FFF7 /* KMPrintChoosePageSizeMultipageView.swift in Sources */,
 				9F0CB4602966C9E200007028 /* KMFormPropertPanelViewController.swift in Sources */,
+				ADCFFC0329C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */,
 				9F1FE4EE29406E4700E952CA /* ThrobberView.m in Sources */,
 				9FBA0EE228FEC253001117AF /* KMProductPromotionViewController.swift in Sources */,
 				BB4DD044299B291A00E80DF6 /* KMCloudNoNetworkView.swift in Sources */,
@@ -11016,6 +11023,7 @@
 				F37322FE292DF9410013862C /* CPDFWidgetAnnotation+PDFListView.m in Sources */,
 				ADCB9970292C65EE00B51A03 /* KMOCROperation.m in Sources */,
 				BBB14A552978DD5400936EDB /* KMRedactTools.swift in Sources */,
+				ADCFFC0429C004AD007D3657 /* KMBookMarkTableRowView.swift in Sources */,
 				BBEC00CE295C31F900A26C98 /* KMBatesModel.swift in Sources */,
 				9FAAA340290FECA70046FFCE /* NSImage+QuickLook.swift in Sources */,
 				BB147025299DC0D100784A6A /* OIDResponseTypes.m in Sources */,

+ 0 - 4
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Annotation/KMAnnotationViewController.swift

@@ -467,8 +467,6 @@ extension KMAnnotationViewController: NSTableViewDelegate,NSTableViewDataSource
     }
 
     func tableView(_ tableView: NSTableView, shouldSelectRow row: Int) -> Bool {
-        print("shouldSelectRow")
-        print(self.tableView.selectedRowIndexes)
         if self.annotations[row] is [String:Any] {
             return false
         }
@@ -477,8 +475,6 @@ extension KMAnnotationViewController: NSTableViewDelegate,NSTableViewDataSource
     }
     
     func tableViewSelectionDidChange(_ notification: Notification) {
-        print("tableViewSelectionDidChange")
-        print(self.tableView.selectedRowIndexes)
         for index in self.selectedRowIndexs {
             if self.tableView.selectedRowIndexes.contains(index) {
                 let rowView: KMAnnotationTableRowView = self.tableView.rowView(atRow: index, makeIfNecessary: false) as! KMAnnotationTableRowView

+ 57 - 46
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.swift

@@ -27,6 +27,8 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
     var listView : CPDFListView!
     let pdfView = PDFView.init()
     
+    var selectedRowIndexs : IndexSet = []
+    
     func dealloc() {
         NotificationCenter.default.removeObserver(self)
     }
@@ -44,6 +46,7 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
         if #available(macOS 11, *) {
             self.bookTableView.style = NSTableView.Style.plain
         }
+        self.bookTableView.allowsMultipleSelection = true
         self.bookTableView.doubleAction = #selector(renameBookAction)
 //        self.bookTableView.selectionHighlightStyle = NSTableView.SelectionHighlightStyle.none;
         
@@ -133,6 +136,11 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
         }
     }
     
+    
+    @IBAction func escButtonAction(_ sender: Any) {
+        self.bookTableView.deselectAll(nil)
+    }
+    
     @IBAction func addBookmarkAction(_ sender: Any) {
         
         
@@ -185,11 +193,14 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
     
     @objc func deleteBookAction() {
         if self.bookTableView.clickedRow >= 0 {
-            let item = self.dataSource[self.bookTableView.clickedRow]
-            if self.listView.document.removeBookmark(forPageIndex:UInt(item.pageIndex)) {
-                self.reloadData()
-                self.listView.setNeedsDisplayForVisiblePages()
+            for index in self.bookTableView.selectedRowIndexes {
+                let item = self.dataSource[index]
+                if self.listView.document.removeBookmark(forPageIndex:UInt(item.pageIndex)) {
+                    print("删除标签成功")
+                }
             }
+            self.listView.setNeedsDisplayForVisiblePages()
+            self.reloadData()
         } else {
             __NSBeep()
         }
@@ -218,20 +229,20 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
     
     //MARK: Noti
     @objc func KMPDFViewCurrentPageDidChangedNotification(notification: NSNotification) {
-        let pdfdocument : CPDFDocument = notification.object as! CPDFDocument
-        if pdfdocument.isEqual(self.listView.document) {
-            var containSelIndex:Bool = false
-            for (index, value) in self.dataSource.enumerated() {
-                if value == self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) {
-                    containSelIndex = true
-                    self.selectRow(index: index)
-                    break
-                }
-            }
-            if !containSelIndex {
-                self.selectRow(index: -1)
-            }
-        }
+//        let pdfdocument : CPDFDocument = notification.object as! CPDFDocument
+//        if pdfdocument.isEqual(self.listView.document) {
+//            var containSelIndex:Bool = false
+//            for (index, value) in self.dataSource.enumerated() {
+//                if value == self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) {
+//                    containSelIndex = true
+//                    self.selectRow(index: index)
+//                    break
+//                }
+//            }
+//            if !containSelIndex {
+//                self.selectRow(index: -1)
+//            }
+//        }
     }
     
     
@@ -251,14 +262,22 @@ class KMBookMarkViewController: NSViewController, NSTextFieldDelegate,NSMenuItem
         if action == #selector(renameBookAction) ||
             action == #selector(changeLocationAction) ||
             action == #selector(deleteBookAction) {
-            if self.bookTableView.clickedRow > -1 {
+            if self.bookTableView.selectedRowIndexes.count > 1 {
                 if action == #selector(changeLocationAction) {
-//                    if self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) != nil {
-//                        return false
-//                    }
+                    return false
+                } else if action == #selector(renameBookAction) {
+                    return false
                 }
             } else {
-                return false
+                if self.bookTableView.clickedRow > -1 {
+                    if action == #selector(changeLocationAction) {
+    //                    if self.listView.document.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) != nil {
+    //                        return false
+    //                    }
+                    }
+                } else {
+                    return false
+                }
             }
         }
         return true
@@ -287,37 +306,29 @@ extension KMBookMarkViewController : NSTableViewDelegate,NSTableViewDataSource {
     }
     
     func tableView(_ tableView: NSTableView, rowViewForRow row: Int) -> NSTableRowView? {
-        let rowView = KMBookMarkRowView()
-        
-        let rightBox = KMCellEmptyView()
-        rightBox.frame = rowView.bounds
-        rightBox.autoresizingMask = [.width, .height]
-        rightBox.wantsLayer = true
-        rightBox.layer?.backgroundColor = NSColor.clear.cgColor
-        rightBox.itemIndex = row
-        rightBox.mouseEventHandle = {(mouseEnter: Bool, mouseExit: Bool) -> Void in
-            if (self.bookTableView.selectedRowIndexes.contains(rightBox.itemIndex)) {
-                rightBox.layer?.backgroundColor = NSColor.clear.cgColor
-            } else {
-                if (mouseEnter) {
-                    rightBox.layer?.backgroundColor = NSColor(hex: "#EDEEF0").cgColor
-                } else if (mouseExit) {
-                    rightBox.layer?.backgroundColor = NSColor.clear.cgColor
-                }
-            }
-        }
-        rowView.addSubview(rightBox)
-        rowView.selectionColor = NSColor(hex: "#EDEEF0")
-        
+        let rowView = KMBookMarkTableRowView()
         return rowView
     }
     
     func tableViewSelectionDidChange(_ notification: Notification) {
+        for index in self.selectedRowIndexs {
+            if self.bookTableView.selectedRowIndexes.contains(index) {
+                guard let rowView: KMBookMarkTableRowView  = self.bookTableView.rowView(atRow: index, makeIfNecessary: false) as? KMBookMarkTableRowView else { return }
+                
+                rowView.itemSelect = true
+            } else {
+                guard let rowView: KMBookMarkTableRowView  = self.bookTableView.rowView(atRow: index, makeIfNecessary: false) as? KMBookMarkTableRowView else { return }
+                
+                rowView.itemSelect = false
+            }
+        }
+        
         if(self.bookTableView.selectedRow >= 0 && self.bookTableView.selectedRow < self.dataSource.count) {
             let selectBookMark = self.dataSource[self.bookTableView.selectedRow]
             self.listView.go(toPageIndex: selectBookMark.pageIndex, animated: true)
-            
         }
+        
+        self.selectedRowIndexs = self.bookTableView.selectedRowIndexes
     }
 }
 

+ 65 - 33
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/KMBookMarkViewController.xib

@@ -29,10 +29,10 @@
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                     <subviews>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="ZOC-6Y-3av">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="439"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="428"/>
                             <subviews>
                                 <view translatesAutoresizingMaskIntoConstraints="NO" id="bIK-U7-Zqf">
-                                    <rect key="frame" x="0.0" y="391" width="260" height="48"/>
+                                    <rect key="frame" x="0.0" y="380" width="260" height="48"/>
                                     <subviews>
                                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3oi-0L-gXH">
                                             <rect key="frame" x="14" y="16" width="35" height="16"/>
@@ -60,12 +60,27 @@
                                             <rect key="frame" x="0.0" y="0.0" width="260" height="1"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                         </customView>
+                                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bsc-ME-Qqh">
+                                            <rect key="frame" x="130" y="24" width="0.0" height="0.0"/>
+                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" imageScaling="proportionallyDown" inset="2" id="Zio-I4-Bjd">
+                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                <font key="font" metaFont="system"/>
+                                                <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                                            </buttonCell>
+                                            <connections>
+                                                <action selector="escButtonAction:" target="-2" id="2IE-Dn-73t"/>
+                                            </connections>
+                                        </button>
                                     </subviews>
                                     <constraints>
                                         <constraint firstItem="3oi-0L-gXH" firstAttribute="centerY" secondItem="bIK-U7-Zqf" secondAttribute="centerY" id="Dx4-hO-Mw9"/>
+                                        <constraint firstItem="Bsc-ME-Qqh" firstAttribute="centerX" secondItem="bIK-U7-Zqf" secondAttribute="centerX" id="MB5-w1-b95"/>
                                         <constraint firstAttribute="trailing" secondItem="3yQ-un-hNE" secondAttribute="trailing" constant="8" id="SeY-1V-RIE"/>
                                         <constraint firstAttribute="height" constant="48" id="VqR-5n-kaA"/>
                                         <constraint firstItem="3oi-0L-gXH" firstAttribute="leading" secondItem="bIK-U7-Zqf" secondAttribute="leading" constant="16" id="Zaz-F0-rX0"/>
+                                        <constraint firstItem="Bsc-ME-Qqh" firstAttribute="centerY" secondItem="bIK-U7-Zqf" secondAttribute="centerY" id="b5q-EM-BXf"/>
                                         <constraint firstItem="3yQ-un-hNE" firstAttribute="centerY" secondItem="bIK-U7-Zqf" secondAttribute="centerY" id="kXJ-wD-hOY"/>
                                     </constraints>
                                 </view>
@@ -77,26 +92,26 @@
                             </constraints>
                         </customView>
                         <box borderType="none" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="QXl-f3-0nT">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="391"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="380"/>
                             <view key="contentView" id="5Km-Gq-7Y6">
-                                <rect key="frame" x="0.0" y="0.0" width="260" height="391"/>
+                                <rect key="frame" x="0.0" y="0.0" width="260" height="380"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
                                     <scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="35" horizontalPageScroll="10" verticalLineScroll="35" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P2v-Ak-LWO">
-                                        <rect key="frame" x="0.0" y="2" width="260" height="389"/>
+                                        <rect key="frame" x="0.0" y="2" width="260" height="378"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <clipView key="contentView" drawsBackground="NO" id="KFG-R9-2uc">
-                                            <rect key="frame" x="0.0" y="0.0" width="260" height="389"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="260" height="378"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
-                                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowHeight="35" rowSizeStyle="automatic" viewBased="YES" id="jMm-Al-ZqF">
-                                                    <rect key="frame" x="0.0" y="0.0" width="260" height="389"/>
+                                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="plain" multipleSelection="NO" autosaveColumns="NO" rowHeight="35" rowSizeStyle="automatic" viewBased="YES" id="jMm-Al-ZqF">
+                                                    <rect key="frame" x="0.0" y="0.0" width="260" height="378"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                     <size key="intercellSpacing" width="17" height="0.0"/>
-                                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <color key="gridColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                                     <tableColumns>
-                                                        <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="228" minWidth="40" maxWidth="1000" id="5vi-WM-WUD">
+                                                        <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="243" minWidth="40" maxWidth="1000" id="5vi-WM-WUD">
                                                             <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
                                                                 <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
                                                                 <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -109,26 +124,43 @@
                                                             <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                             <prototypeCellViews>
                                                                 <tableCellView identifier="KMBookCellView" id="qIV-zJ-BTn" customClass="KMBookCellView" customModule="PDF_Office" customModuleProvider="target">
-                                                                    <rect key="frame" x="18" y="0.0" width="223" height="35"/>
+                                                                    <rect key="frame" x="8" y="0.0" width="243" height="35"/>
                                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                                     <subviews>
-                                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rcv-Rq-TyR">
-                                                                            <rect key="frame" x="25" y="10" width="197" height="16"/>
-                                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
-                                                                            <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="f2w-oF-jeX">
-                                                                                <font key="font" usesAppearanceFont="YES"/>
-                                                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
-                                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                                            </textFieldCell>
-                                                                        </textField>
-                                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jVn-Rk-t92">
-                                                                            <rect key="frame" x="0.0" y="10" width="16" height="16"/>
-                                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameSidebarBookCellMark" id="8wC-vm-GhN"/>
-                                                                        </imageView>
+                                                                        <customView translatesAutoresizingMaskIntoConstraints="NO" id="Jiw-dQ-fQm">
+                                                                            <rect key="frame" x="8" y="0.0" width="227" height="35"/>
+                                                                            <subviews>
+                                                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="rcv-Rq-TyR">
+                                                                                    <rect key="frame" x="22" y="10" width="199" height="16"/>
+                                                                                    <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="f2w-oF-jeX">
+                                                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                                                        <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                                    </textFieldCell>
+                                                                                </textField>
+                                                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jVn-Rk-t92">
+                                                                                    <rect key="frame" x="0.0" y="10" width="16" height="16"/>
+                                                                                    <constraints>
+                                                                                        <constraint firstAttribute="width" constant="16" id="HmH-sE-Qta"/>
+                                                                                        <constraint firstAttribute="height" constant="16" id="w4f-op-qPO"/>
+                                                                                    </constraints>
+                                                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameSidebarBookCellMark" id="8wC-vm-GhN"/>
+                                                                                </imageView>
+                                                                            </subviews>
+                                                                            <constraints>
+                                                                                <constraint firstItem="jVn-Rk-t92" firstAttribute="centerY" secondItem="Jiw-dQ-fQm" secondAttribute="centerY" id="3rn-5T-ztd"/>
+                                                                                <constraint firstItem="rcv-Rq-TyR" firstAttribute="centerY" secondItem="Jiw-dQ-fQm" secondAttribute="centerY" id="5bl-Wy-ZZ2"/>
+                                                                                <constraint firstItem="rcv-Rq-TyR" firstAttribute="leading" secondItem="jVn-Rk-t92" secondAttribute="trailing" constant="8" id="TSf-Z5-etZ"/>
+                                                                                <constraint firstItem="jVn-Rk-t92" firstAttribute="leading" secondItem="Jiw-dQ-fQm" secondAttribute="leading" id="Xbn-6J-OZl"/>
+                                                                                <constraint firstAttribute="trailing" secondItem="rcv-Rq-TyR" secondAttribute="trailing" constant="8" id="tuu-Fs-E1S"/>
+                                                                            </constraints>
+                                                                        </customView>
                                                                     </subviews>
                                                                     <constraints>
-                                                                        <constraint firstItem="jVn-Rk-t92" firstAttribute="centerY" secondItem="qIV-zJ-BTn" secondAttribute="centerY" id="fuR-xg-pTe"/>
-                                                                        <constraint firstItem="jVn-Rk-t92" firstAttribute="leading" secondItem="qIV-zJ-BTn" secondAttribute="leading" id="x3B-Pd-T0N"/>
+                                                                        <constraint firstAttribute="bottom" secondItem="Jiw-dQ-fQm" secondAttribute="bottom" id="4n5-bF-fib"/>
+                                                                        <constraint firstItem="Jiw-dQ-fQm" firstAttribute="top" secondItem="qIV-zJ-BTn" secondAttribute="top" id="Gk0-nJ-e2v"/>
+                                                                        <constraint firstItem="Jiw-dQ-fQm" firstAttribute="leading" secondItem="qIV-zJ-BTn" secondAttribute="leading" constant="8" id="SVX-ay-53c"/>
+                                                                        <constraint firstAttribute="trailing" secondItem="Jiw-dQ-fQm" secondAttribute="trailing" constant="8" id="xdS-9w-MMP"/>
                                                                     </constraints>
                                                                     <connections>
                                                                         <outlet property="bookTitle" destination="rcv-Rq-TyR" id="MR2-sT-XU9"/>
@@ -144,7 +176,7 @@
                                                     </connections>
                                                 </tableView>
                                             </subviews>
-                                            <nil key="backgroundColor"/>
+                                            <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                         </clipView>
                                         <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="UbR-Pn-9tg">
                                             <rect key="frame" x="1" y="361" width="258" height="15"/>
@@ -159,14 +191,14 @@
                             </view>
                         </box>
                         <customView translatesAutoresizingMaskIntoConstraints="NO" id="H5X-YQ-dvn">
-                            <rect key="frame" x="0.0" y="0.0" width="260" height="391"/>
+                            <rect key="frame" x="0.0" y="0.0" width="260" height="380"/>
                             <subviews>
                                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="8R5-DW-bXb">
-                                    <rect key="frame" x="64" y="112" width="132" height="128"/>
+                                    <rect key="frame" x="64" y="101" width="132" height="128"/>
                                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameBookMarkEmpty" id="6Kl-9F-c8Y"/>
                                 </imageView>
                                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="BO0-hw-zv2">
-                                    <rect key="frame" x="62" y="82" width="136" height="17"/>
+                                    <rect key="frame" x="62" y="71" width="136" height="17"/>
                                     <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="No bookmark found" id="6Wq-yY-yuD">
                                         <font key="font" metaFont="system" size="14"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -174,7 +206,7 @@
                                     </textFieldCell>
                                 </textField>
                                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Msu-u0-gPn">
-                                    <rect key="frame" x="33" y="67" width="194" height="15"/>
+                                    <rect key="frame" x="33" y="56" width="194" height="15"/>
                                     <textFieldCell key="cell" alignment="center" id="bpF-T2-SUC">
                                         <font key="font" metaFont="cellTitle"/>
                                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -218,7 +250,7 @@
                 <constraint firstItem="Pzi-Vp-0aL" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="rYP-sd-AtW"/>
                 <constraint firstItem="Pzi-Vp-0aL" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="zTJ-d0-rbP"/>
             </constraints>
-            <point key="canvasLocation" x="-296" y="229.5"/>
+            <point key="canvasLocation" x="-296" y="229"/>
         </customView>
     </objects>
     <resources>

+ 64 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/BookMarks/View/KMBookMarkTableRowView.swift

@@ -0,0 +1,64 @@
+//
+//  KMBookMarkTableRowView.swift
+//  PDF Office
+//
+//  Created by lizhe on 2023/3/14.
+//
+
+import Cocoa
+
+class KMBookMarkTableRowView: NSTableRowView {
+        var box: KMBox?
+        var hover: Bool = false
+        var itemSelect: Bool = false {
+            didSet {
+                self.needsDisplay = true
+            }
+        }
+        
+        override func draw(_ dirtyRect: NSRect) {
+            super.draw(dirtyRect)
+            
+            self.addBox()
+            self.drawView()
+        }
+        
+        func addBox() {
+            if self.box == nil {
+                var rect = self.bounds
+                rect.origin.x = self.bounds.origin.x + 8.0
+                rect.size.width = self.bounds.size.width - 16.0
+                
+                self.box?.wantsLayer = true
+                self.box?.layer?.masksToBounds = true
+                self.box = KMBox(frame: rect)
+                self.box?.borderWidth = 0
+//                self.box?.borderColor = NSColor(hex: "#EDEEF0")
+                self.box?.layer?.cornerRadius = 8
+                self.box?.boxType = .custom
+                self.addSubview(self.box!, positioned: NSWindow.OrderingMode.below, relativeTo: self)
+                self.box?.autoresizingMask = [.width, .height]
+                self.box?.moveCallback = { [unowned self] (mouseEntered, mouseBox) in
+                    if mouseEntered {
+                        self.hover = true
+                    } else {
+                        self.hover = false
+                    }
+                    self.needsDisplay = true
+                }
+            }
+        }
+        
+        override func drawSelection(in dirtyRect: NSRect) {
+            self.itemSelect = true
+        }
+        
+        func drawView(_ color: NSColor = NSColor(hex: "#EDEEF0")) {
+            if hover || itemSelect {
+                self.box?.backgroundColor(NSColor(hex: "#EDEEF0"))
+                self.box?.layer?.cornerRadius = 4
+            } else {
+                self.box?.backgroundColor(NSColor.clear)
+            }
+        }
+    }

+ 1 - 0
PDF Office/PDF Office/Class/PDFWindowController/Side/LeftSide/Outline/KMOutlineViewController.xib

@@ -240,6 +240,7 @@ Gw
                         <constraint firstAttribute="trailing" secondItem="kbI-MU-S56" secondAttribute="trailing" id="dvS-fQ-8Z1"/>
                         <constraint firstAttribute="bottom" secondItem="bBy-ta-1Eq" secondAttribute="bottom" id="fwh-IN-vKp"/>
                         <constraint firstAttribute="trailing" secondItem="bBy-ta-1Eq" secondAttribute="trailing" id="iDw-5t-drO"/>
+                        <constraint firstItem="kbI-MU-S56" firstAttribute="top" secondItem="1cE-e7-OJl" secondAttribute="bottom" id="oEZ-Co-Win"/>
                         <constraint firstAttribute="bottom" secondItem="kbI-MU-S56" secondAttribute="bottom" id="piw-bE-XYl"/>
                         <constraint firstItem="1cE-e7-OJl" firstAttribute="top" secondItem="WVb-1G-NNy" secondAttribute="top" id="uAO-Nc-JAe"/>
                         <constraint firstAttribute="trailing" secondItem="1cE-e7-OJl" secondAttribute="trailing" id="ukO-lN-30T"/>