Browse Source

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

niehaoyu 2 months ago
parent
commit
e330e70924

+ 5 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/Controller/KMNoteOutlineFilterViewController.swift

@@ -48,14 +48,16 @@ class KMNoteOutlineFilterViewController: KMNBaseViewController {
             }
             if _anno.isKind(of: CPDFLinkAnnotation.self) == false {
                 let noteColor = _anno.color
-                let noteType = _anno.type ?? ""
+                var noteType = _anno.type ?? ""
+                if(noteType == "Polyline" || noteType == "Polygon") { //所有测量都归为一种类型
+                    noteType = "Measure"
+                }
                 let authorString = _anno.userName() ?? ""
-                
                     
                 self._addNoteColorWith(noteColor)
                 if let data = _anno as? CPDFLineAnnotation {
                     if data.isMeasure {
-                        self._addNoteTypeWith(CPDFAnnotation.kType.measureArrow)
+                        self._addNoteTypeWith("Measure") //所有测量都归为一种类型
                     } else {
                         self._addNoteTypeWith(noteType)
                     }

+ 1 - 4
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTypeCollectionViewItem.swift

@@ -48,9 +48,7 @@ class KMNoteTypeCollectionViewItem: NSCollectionViewItem {
                 typeButton.properties.iconImage = NSImage(named: "KMNImageNameFilterInk")
             } else if (self.typeString == "Stamp") {
                 typeButton.properties.iconImage = NSImage(named: "KMNImageNameFilterStamp")
-            } else if (self.typeString == "Polyline") {
-                typeButton.properties.iconImage = NSImage(named: "KMNImageNameFilterMeasure")
-            } else if (self.typeString == "Polygon") {
+            } else if (self.typeString == "Measure") {
                 typeButton.properties.iconImage = NSImage(named: "KMNImageNameFilterMeasure")
             } else if (self.typeString == CPDFAnnotation.KSquigglyType) {
                 typeButton.properties.iconImage = NSImage(named: "KMNImageNameFilterSquiggly")
@@ -71,7 +69,6 @@ class KMNoteTypeCollectionViewItem: NSCollectionViewItem {
     }
     
     func selectButton(_ isSelect: Bool, type: String) {
-        print(type)
         self.typeString = type
         self.selectButton(isSelect)
     }

+ 40 - 122
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTypeImageView.swift

@@ -85,7 +85,12 @@ class KMNoteTypeImageView: NSImageView {
         }
 
         if type == SKNNoteString {
-            image = NSImage(named: KMImageNameUXIconSubtoolbarMytoolsNote)
+            image = NSImage(named: "markup_note_base")
+            let upImage = NSImage(named: "markup_note_Cover")
+            
+            if let img = NSImage.combineImages(images: [image?.filled(with: color), upImage]) {
+                image = img
+            }
         } else if type == SKNFreeTextString {
             image = NSImage(named: KMImageNameUXIconSidebarAnnotationText)
         } else if type == SKNCircleString {
@@ -119,62 +124,25 @@ class KMNoteTypeImageView: NSImageView {
             }
             image?.unlockFocus()
         } else if type == SKNHighlightString {
-            if let baseImage = NSImage(named: highlight) {
-                var size = NSMakeSize(20, 20)
-                image = NSImage(size: size)
-                image?.lockFocus()
-                if let context = NSGraphicsContext.current?.cgContext {
-                    let newColor = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)
-                    let newUnderlineColor = NSColor(red: newColor!.redComponent, green: newColor!.greenComponent, blue: newColor!.blueComponent, alpha: newColor?.alphaComponent ?? 0.7)
-                    newUnderlineColor.setFill()
-                    context.setStrokeColor(NSColor.clear.cgColor)
-                    let fw = image!.size.width
-                    let fh = image!.size.height
-                    context.move(to: CGPoint(x: 0, y: fh - 4))
-                    context.addArc(tangent1End: CGPoint(x: 0, y: 0), tangent2End: CGPoint(x: 4, y: 0), radius: 2)
-                    context.addArc(tangent1End: CGPoint(x: fw, y: 0), tangent2End: CGPoint(x: fw, y: 4), radius: 2)
-                    context.addArc(tangent1End: CGPoint(x: fw, y: fh), tangent2End: CGPoint(x: fw - 4, y: fh), radius: 2)
-                    context.addArc(tangent1End: CGPoint(x: 0, y: fh), tangent2End: CGPoint(x: 0, y: fh - 4), radius: 2)
-                    context.drawPath(using: .fillStroke)
-                    baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
-                }
-                image?.unlockFocus()
+            image = NSImage(named: "markup_highlight_base")
+            let upImage = NSImage(named: "markup_highlight_Cover")
+            
+            if let img = NSImage.combineImages(images: [image?.filled(with: color), upImage]) {
+                image = img
             }
         } else if type == SKNUnderlineString {
-            if let baseImage = NSImage(named: underline) {
-                var size = NSMakeSize(20, 20)
-                image = NSImage(size: size)
-                image?.lockFocus()
-                if let context = NSGraphicsContext.current?.cgContext {
-                    context.beginPath()
-                    context.move(to: CGPoint(x: 0, y: 1))
-                    context.addLine(to: CGPoint(x: image!.size.width, y: 1))
-                    let newColor = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)
-                    let newUnderlineColor = NSColor(red: newColor!.redComponent, green: newColor!.greenComponent, blue: newColor!.blueComponent, alpha: 1)
-                    newUnderlineColor.setStroke()
-                    context.setLineWidth(2)
-                    context.strokePath()
-                    baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
-                }
-                image?.unlockFocus()
+             image = NSImage(named: "markup_underline_Cover")
+            let upImage = NSImage(named: "markup_underline_base")
+            
+            if let img = NSImage.combineImages(images: [(image?.filled(with: color))!, upImage!]) {
+                return img
             }
         } else if type == SKNStrikeOutString {
-            if let strikeImage = NSImage(named: highlight) {
-                var size = NSMakeSize(20, 20)
-                image = NSImage(size: size)
-                image?.lockFocus()
-                if let context = NSGraphicsContext.current?.cgContext {
-                    context.beginPath()
-                    context.move(to: CGPoint(x: 0, y: size.height / 2 ))
-                    context.addLine(to: CGPoint(x: size.width, y: size.height / 2 ))
-                    let newColor = color.usingColorSpaceName(NSColorSpaceName.calibratedRGB)
-                    let strikenColor = NSColor(red: newColor!.redComponent, green: newColor!.greenComponent, blue: newColor!.blueComponent, alpha: 1)
-                    strikenColor.setStroke()
-                    context.setLineWidth(2)
-                    context.strokePath()
-                    strikeImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
-                }
-                image?.unlockFocus()
+             image = NSImage(named: "markup_strikethrough_Cover")
+            let upImage = NSImage(named: "markup_strikethrough_base")
+            
+            if let img = NSImage.combineImages(images: [(image?.filled(with: color))!, upImage!]) {
+                image = img
             }
         } else if type == SKNLine_NoneString {
             image = NSImage(size: CGSize(width: 16, height: 16))
@@ -209,25 +177,11 @@ class KMNoteTypeImageView: NSImageView {
             }
             image?.unlockFocus()
         } else if type == SKNInkString {
-            if let baseImage = NSImage(named: inkIcon)?.copy() as? NSImage {
-                // baseImage.size.offset(x: 1.5, y: 1.5)
-                var size = NSMakeSize(20, 20)
-                image = NSImage(size: size)
-                image?.lockFocus()
-                let ref3 = NSGraphicsContext.current?.cgContext
-                KMContextSaveGState(ref3)
-                KMContextBeginPath(ref3)
-                KMContextMoveToPoint(ref3, 2, 3)
-                KMContextAddCurveToPoint(ref3, image!.size.width/2, -5,  3 * image!.size.width/4, 3 * image!.size.width/4, image!.size.width, 4)
-                KMContextSetLineWidth(ref3, 1);
-                if let newColor = color.usingColorSpaceName(.calibratedRGB) {
-                    let newInkColor = NSColor(red: newColor.redComponent, green: newColor.greenComponent, blue: newColor.blueComponent, alpha: 1)
-                    newInkColor.set()
-                }
-                KMContextStrokePath(ref3);
-                KMContextRestoreGState(ref3);
-                baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
-                image?.unlockFocus()
+             image = NSImage(named: "markup_pen_Cover")
+            let upImage = NSImage(named: "markup_pen_base")
+            
+            if let img = NSImage.combineImages(images: [(image?.filled(with: color))!, upImage!]) {
+                image = img
             }
         } else if type == SKNStampString {
             image = NSImage(named: KMImageNameUXIconSidebarAnnotationStamp)?.copy() as? NSImage
@@ -236,69 +190,35 @@ class KMNoteTypeImageView: NSImageView {
         } else if type == SKNStamp_ImageString {
             image = NSImage(named: "KMImageNameAnnotationImage")?.copy() as? NSImage
         } else if type == SKNSignFalseString {
-            image = NSImage(named: "KMImageNameToolbarForx")?.copy() as? NSImage
+            image = NSImage(named: "fill_tick")
         } else if type == SKNSignTureString {
-            image = NSImage(named: "KMImageNameToolbarTick")?.copy() as? NSImage
+            image = NSImage(named: "fill_fork")
         } else if type == SKNSignCircleString {
-            image = NSImage(named: "KMImageNameToolbarRoundedrec")?.copy() as? NSImage
+            image = NSImage(named: "fill_rectangle")
         } else if type == SKNSignLineString {
-            image = NSImage(named: "KMImageNameToolbarSignLine")?.copy() as? NSImage
+            image = NSImage(named: "fill_line")
         } else if type == SKNSignDotString {
-            image = NSImage(named: "KMImageNameToolbarPoint")?.copy() as? NSImage
+            image = NSImage(named: "fill_dot")
         } else if type == SKNRedactString {
             image = NSImage(named: "KMImageNameUXIconSubtoolbarRedactPoint")?.copy() as? NSImage
         } else if type == SKNSignatureString {
-            image = NSImage(named: "KMImageNameSidetabbarSignatureNor")?.copy() as? NSImage
+            image = NSImage(named: "markup_sign")
         } else if type == "Ink_Table" {
             image = NSImage(named: KMImageNameUXIconSubtoolbarMytoolsTable)?.copy() as? NSImage
         } else if type == SKMeasurePolygonString {
-            image = NSImage(named: "KMImageNameListPolygon")?.copy() as? NSImage
+            image = NSImage(named: "KMNImageNameFilterMeasure")?.copy() as? NSImage
         } else if type == SKMeasureMultilinesString {
-            image = NSImage(named: "KMImageNameListPolyline")?.copy() as? NSImage
+            image = NSImage(named: "KMNImageNameFilterMeasure")?.copy() as? NSImage
         } else if type == SKMeasureLineString {
-            image = NSImage(named: "KMImageNameUXIconMeasureNor")?.copy() as? NSImage
+            image = NSImage(named: "KMNImageNameFilterMeasure")?.copy() as? NSImage
         } else if type == SKMeasureRectangleString {
             image = NSImage(named: "KMImageNameListMeasureSquare")?.copy() as? NSImage
         } else if type == "Squiggly" {
-            if let baseImage = NSImage(named: underline)?.copy() as? NSImage {
-                // baseImage.size.offset(x: 1.5, y: 1.5)
-                var size = NSMakeSize(20, 20)
-                image = NSImage(size: size)
-                image?.lockFocus()
-                let ref3 = NSGraphicsContext.current?.cgContext
-                KMContextSaveGState(ref3)
-                KMContextBeginPath(ref3)
-                
-                let length = 24.0
-                let stepLength = 6.0
-                var count = Int(round(length / CGFloat(stepLength)))
-
-                if count == 0 {
-                    count = 1
-                }
-                KMContextSetLineWidth(ref3, 2);
-                if let newColor = color.usingColorSpaceName(.calibratedRGB) {
-                    let newInkColor = NSColor(red: newColor.redComponent, green: newColor.greenComponent, blue: newColor.blueComponent, alpha: 1)
-                    newInkColor.set()
-                }
-                var initX = 0.0
-                for i in 0..<count {
-                    let s = CGPoint(x: initX, y: 2)
-                    let e = CGPoint(x: initX + stepLength, y: 2)
-                    let cp1 = CGPoint(x: initX + CGFloat(stepLength) / 2, y: 2 + 4)
-                    let cp2 = CGPoint(x: initX + CGFloat(stepLength) - CGFloat(stepLength) / 2, y: 0)
-                    
-                    ref3?.move(to: s)
-                    ref3?.addCurve(to: e, control1: cp1, control2: cp2)
-                    ref3?.strokePath()
-                    
-                    initX += CGFloat(stepLength)
-                }
-
-                KMContextStrokePath(ref3);
-                KMContextRestoreGState(ref3);
-                baseImage.draw(in: CGRect(x: 0, y: 0, width: image!.size.width, height: image!.size.height))
-                image?.unlockFocus()
+            image = NSImage(named: "markup_wavyline_Cover")
+            let upImage = NSImage(named: "markup_wavyline_base")
+            
+            if let img = NSImage.combineImages(images: [(image?.filled(with: CPDFMarkupAnnotation.defaultColor(.squiggly)))!, upImage!]) {
+                image = img
             }
         } else if type == "eraser" {
             image = NSImage(named: "KMImageNameEraserIcon")?.copy() as? NSImage
@@ -324,8 +244,6 @@ class KMNoteTypeImageView: NSImageView {
     }
 }
 
-
-
 func KMPDFAnnotationNoteType(_ anno: CPDFAnnotation?) -> String {
     guard let inAnno = anno else {
         return ""

+ 10 - 3
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -1033,6 +1033,9 @@ struct KMNMWCFlags {
         if listView.document?.isModified() == true {
             listView.layoutDocumentView()
             botaViewController?.thumnailViewController?.reloadDatas()
+            
+            botaViewController?.annoController.note_reloadDataIfNeed()
+
         }
     }
     
@@ -5102,7 +5105,7 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
         
         //
         pdfToolbarController?.pdfViewActiveAnnotationsChanged()
-        
+        botaViewController?.annoController.note_reloadDataIfNeed()
     }
     
     func pdfListViewMenu(forEvent pdfListView: CPDFListView!, for theEvent: NSEvent!, click menu: AutoreleasingUnsafeMutablePointer<NSMenu?>!, isMoveSelectAnno: Bool) {
@@ -5586,12 +5589,14 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
         var pageIndexes = IndexSet()
         pageIndexes.insert(Int(pdfPage.pageIndex()))
         botaViewController?.thumnailViewController?.reloadDataWithIndexs(pageIndexs: pageIndexes)
+        botaViewController?.annoController.note_reloadDataIfNeed()
     }
     
     func pdfListViewRemoveAnnotations(_ pdfListView: CPDFListView!, forRemove annotations: [CPDFAnnotation]!, in pdfPage: CPDFPage!) {
         var pageIndexes = IndexSet()
         pageIndexes.insert(Int(pdfPage.pageIndex()))
         botaViewController?.thumnailViewController?.reloadDataWithIndexs(pageIndexs: pageIndexes)
+        botaViewController?.annoController.note_reloadDataIfNeed()
     }
     
     func pdfListViewEditAnnotation(_ pdfListView: CPDFListView!, for anotation: CPDFAnnotation!) {
@@ -5849,14 +5854,16 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
                 var pageIndexes = IndexSet()
                 pageIndexes.insert(Int(anno.page.pageIndex()))
                 botaViewController?.thumnailViewController?.reloadDataWithIndexs(pageIndexs: pageIndexes)
-                
+                botaViewController?.annoController.note_reloadDataIfNeed()
+
                 reloadPopUIWindow()
             } else {
                 if value != CPDFAnnotationBoundsKey && value != CPDFAnnotationStartPointKey && value != CPDFAnnotationEndPointKey && value != CPDFAnnotationPathsKey { // 改变bounds(箭头、直线注释 开始点和结束点, 手绘注释的paths)的操作会卡顿,比如移动
                     var pageIndexes = IndexSet()
                     pageIndexes.insert(Int(anno.page.pageIndex()))
                     botaViewController?.thumnailViewController?.reloadDataWithIndexs(pageIndexs: pageIndexes)
-                    
+                    botaViewController?.annoController.note_reloadDataIfNeed()
+
                     reloadPopUIWindow()
                 }
             }

+ 26 - 32
PDF Office/PDF Master/KMClass/Left/Annotaion/Controller/KMLeftSideViewController+Note.swift

@@ -122,33 +122,33 @@ extension KMLeftSideViewController {
     }
     
     private func _addExportPDFMenu(_ menu: NSMenu) -> NSMenu {
-        var item = menu.addItem(title: NSLocalizedString("Export Annotations…", tableName: "", comment: ""), action: nil, target: self)
+        var item = menu.addItem(title: KMLocalizedString("Export Annotations…"), action: nil, target: self)
         
         let subMenu = NSMenu()
         item?.submenu = subMenu
-        item = subMenu.addItem(title: NSLocalizedString("PDF", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("PDF", comment: ""), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 0
-        item = subMenu.addItem(title: NSLocalizedString("PDF Bundle", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("PDF Bundle"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 1
-        item = subMenu.addItem(title: NSLocalizedString("PDF Reader Pro Edition Notes", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("PDF Reader Pro Edition Notes"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 2
-        item = subMenu.addItem(title: NSLocalizedString("Notes as Text", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("Notes as Text"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 3
-        item = subMenu.addItem(title: NSLocalizedString("Notes as RTF", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("Notes as RTF"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 4
-        item = subMenu.addItem(title: NSLocalizedString("Notes as RTFD", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("Notes as RTFD"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 5
-        item = subMenu.addItem(title: NSLocalizedString("Notes as FDF", tableName: "", comment: ""), action: #selector(exportAnnotationNotes), target: self)
+        item = subMenu.addItem(title: KMLocalizedString("Notes as FDF"), action: #selector(exportAnnotationNotes), target: self)
         item?.tag = 6
         return menu
     }
     
     private func _addDeleteAllAnnoItem(_ menu: NSMenu) -> NSMenuItem? {
-        return menu.addItem(title: NSLocalizedString("Remove All Annotations", tableName: "", comment: ""), action: #selector(removeAllAnnotations), target: self)
+        return menu.addItem(title: KMLocalizedString("Remove All Annotations"), action: #selector(removeAllAnnotations), target: self)
     }
     
     private func _addDeleteAllReplyAnnoItem(_ menu: NSMenu) -> NSMenuItem? {
-        return menu.addItem(title: NSLocalizedString("Delete All Reply", tableName: "", comment: ""), action: #selector(removeAllReplyAnnotations), target: self)
+        return menu.addItem(title: KMLocalizedString("Delete All Reply"), action: #selector(removeAllReplyAnnotations), target: self)
     }
     
     @IBAction func note_expandAllComments(_ sender: AnyObject?) {
@@ -258,7 +258,7 @@ extension KMLeftSideViewController {
                 NSWorkspace.shared.selectFile(filePath, inFileViewerRootedAtPath: "")
             } else {
                 Task {
-                    _ = await KMAlertTool.runModel(message: NSLocalizedString("Export Failure!", comment: ""), buttons: ["OK"])
+                    _ = await KMAlertTool.runModel(message: KMLocalizedString("Export Failure!"), buttons: [KMLocalizedString("OK")])
                 }
             }
         }
@@ -546,26 +546,10 @@ extension KMLeftSideViewController {
     }
     
     func showNoteEmptyView() {
-        headerView.sortButton.properties.isDisabled = true
-        headerView.searchButton.properties.isDisabled = true
-        headerView.moreButton.properties.isDisabled = true
-
-        headerView.sortButton.reloadData()
-        headerView.searchButton.reloadData()
-        headerView.moreButton.reloadData()
-
         self.emptyView.isHidden = false
     }
     
     func hideNoteEmptyView() {
-        headerView.sortButton.properties.isDisabled = false
-        headerView.searchButton.properties.isDisabled = false
-        headerView.moreButton.properties.isDisabled = false
-
-        headerView.sortButton.reloadData()
-        headerView.searchButton.reloadData()
-        headerView.moreButton.reloadData()
-        
         self.emptyView.isHidden = true
     }
 }
@@ -707,7 +691,13 @@ extension KMLeftSideViewController {
                     
                     if typeArr.count > 0 {
                         var theTypes = typeArr
-                        if typeArr.contains(CPDFAnnotation.kType.measureArrow) && typeArr.contains(CPDFAnnotation.kType.arrow) == false {
+                        if typeArr.contains("Measure") { //包含测量的话
+                            theTypes.append("Polygon")
+                            theTypes.append("Polyline")
+                            theTypes.append(CPDFAnnotation.kType.measureArrow)
+                        }
+                        
+                        if theTypes.contains(CPDFAnnotation.kType.measureArrow) && theTypes.contains(CPDFAnnotation.kType.arrow) == false {
                             theTypes.append(CPDFAnnotation.kType.arrow)
                         }
                         filterAnnos = (KMOCToolClass.filterAnnotation(annotations: filterAnnos, types: theTypes) as? [CPDFAnnotation]) ?? []
@@ -720,7 +710,7 @@ extension KMLeftSideViewController {
                     }
                     
                     if typeArr.isEmpty == false {
-                        if typeArr.contains(CPDFAnnotation.kType.measureArrow) {
+                        if typeArr.contains("Measure") {
                             if typeArr.contains(CPDFAnnotation.kType.arrow) == false {
                                 for anno in filterAnnos {
                                     if let data = anno as? CPDFLineAnnotation, data.type == CPDFAnnotation.kType.arrow && data.isMeasure == false {
@@ -773,6 +763,11 @@ extension KMLeftSideViewController {
                         if annotationArray.contains(annotation) {
                             annotationArray.removeObject(annotation)
                         }
+                    } else if annotation.isKind(of: CPDFRedactAnnotation.self) {
+                        annos.removeObject(annotation)
+                        if annotationArray.contains(annotation) {
+                            annotationArray.removeObject(annotation)
+                        }
                     } else if annotation.isForm() {
                         annos.removeObject(annotation)
                         if annotationArray.contains(annotation) {
@@ -839,7 +834,6 @@ extension KMLeftSideViewController {
                 item.showTime = self.annoListIsShowTime()
                 item.showAuthor = self.annoListIsShowAnther()
                 
-//                datas.append(item)
                 if self.noteSortType == .page {
                     let pageIdx = Int(anno.pageIndex())
                     if pageIdx != prePageIdx { // 不是同一个页面
@@ -867,11 +861,11 @@ extension KMLeftSideViewController {
                     let replyM = KMBotaAnnotationReplyModel()
                     replyM.anno = anno
                     replyM.replyAnno = replyAnno
-//                    secM?.items.append(replyM)
+                    //                    secM?.items.append(replyM)
                     replyM.annoModel = item
                     item.replyAnnos.append(replyM)
                 }
-            
+                
                 let footerI = KMBotaAnnotationFooterModel()
                 footerI.anno = anno
                 secM?.items.append(footerI)

+ 58 - 1
PDF Office/PDF Master/KMClass/Left/Annotaion/Controller/KMLeftSideViewController.swift

@@ -545,6 +545,20 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
             }
                 
             self.noteOutlineView.usesAlternatingRowBackgroundColors = false
+            let hasAnno = self.allAnnotations.count >= 1
+            if(!hasAnno) {
+                headerView.sortButton.properties.isDisabled = true
+                headerView.searchButton.properties.isDisabled = true
+                headerView.moreButton.properties.isDisabled = true
+            } else {
+                headerView.sortButton.properties.isDisabled = false
+                headerView.searchButton.properties.isDisabled = false
+                headerView.moreButton.properties.isDisabled = false
+            }
+            headerView.sortButton.reloadData()
+            headerView.searchButton.reloadData()
+            headerView.moreButton.reloadData()
+
             if cnt < 1 {
                 self.showNoteEmptyView()
             } else {
@@ -650,7 +664,7 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
                 cell?.isExpand = data.isExpand
                 if self.noteSortType == .page {
                     let pageIndex = data.items.first?.anno?.page.pageIndex() ?? 0
-                    cell?.titleLabel.stringValue = NSLocalizedString("Page", comment: "") + " \(pageIndex + 1)"
+                    cell?.titleLabel.stringValue = KMLocalizedString("Page") + " \(pageIndex + 1)"
                 } else {
                     if let date = data.items.first?.anno?.modificationDate() {
                         let string = KMTools.timeString(timeDate: date, formatString: "yyyy-MM-dd")
@@ -952,7 +966,50 @@ extension KMLeftSideViewController: NSOutlineViewDelegate, NSOutlineViewDataSour
     }
     
     func outlineViewSelectionDidChange(_ notification: Notification) {
+        if self.hideNotes() == false {
+            let selectedNotes = self.selectedNotes()
+            if selectedNotes.count == 1 {
+                let annotation = selectedNotes.last!
+                self.listView?.go(to: annotation.bounds, on: annotation.page, animated: true)
+                
+                self.listView?.updateActiveAnnotations([annotation])
+                self.listView?.setNeedsDisplayAnnotationViewForVisiblePages()
+                if annotation is CPDFPolygonAnnotation || annotation is CPDFPolylineAnnotation {
+                    self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: annotation)
+                } else if let anno = annotation as? CPDFLineAnnotation {
+                    if anno.isMeasure {
+                        self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: annotation)
+                    }
+                }
+                
+            } else if(selectedNotes.count > 1){
+                let lastSelectedNote = selectedNotes.last!
+                let firstSelectedNote = selectedNotes.first!
+                self.listView?.go(to: lastSelectedNote.bounds, on: lastSelectedNote.page, animated: true)
 
+                if lastSelectedNote.page == firstSelectedNote.page {//同页的话支持多选选中
+                    var activeAnnotations:[CPDFAnnotation] = listView?.activeAnnotations as! [CPDFAnnotation]
+                    activeAnnotations.append(lastSelectedNote)
+                    self.listView?.updateActiveAnnotations(activeAnnotations)
+                } else {
+                    self.listView?.updateActiveAnnotations([lastSelectedNote])
+                    let rowIndexes = self.noteOutlineView.selectedRowIndexes
+
+                    for i in 0 ..< rowIndexes.count - 1 {
+                        noteOutlineView.deselectRow(i)
+                    }
+                }
+                self.listView?.setNeedsDisplayAnnotationViewForVisiblePages()
+                if lastSelectedNote is CPDFPolygonAnnotation || lastSelectedNote is CPDFPolylineAnnotation {
+                    self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: lastSelectedNote)
+                } else if let anno = lastSelectedNote as? CPDFLineAnnotation {
+                    if anno.isMeasure {
+                        self.listView?.pdfListViewDelegate.pdfListViewAnnotationMeasureInfoChange?(self.listView, with: lastSelectedNote)
+                    }
+                }
+
+            }
+        }
     }
     
     func outlineView(_ outlineView: NSOutlineView, validateDrop info: NSDraggingInfo, proposedItem item: Any?, proposedChildIndex index: Int) -> NSDragOperation {