瀏覽代碼

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

# Conflicts:
#	PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
niehaoyu 1 年之前
父節點
當前提交
3af43e1e3f

+ 1 - 0
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -152,6 +152,7 @@ import Cocoa
         } else {
             self.window?.appearance = .init(named: .darkAqua)
         }
+        self.window?.contentView?.appearance = self.window?.appearance ?? .init(named: .aqua)
         
         self.interfaceThemeDidChanged(self.window?.appearance?.name ?? .aqua)
     }

+ 23 - 0
PDF Office/PDF Master/Class/Common/Category/CPDFKit/CPDFPage+KMExtension.swift

@@ -22,4 +22,27 @@ import Foundation
             return "\(self.pageIndex() + 1)"
         }
     }
+    
+    @objc func km_affineTransform(for box: CPDFDisplayBox) -> NSAffineTransform {
+        let bounds = self.bounds(for: box)
+        let transform = NSAffineTransform()
+        transform.rotate(byDegrees: -CGFloat(self.rotation))
+        switch self.rotation {
+        case 0:
+            transform.translateX(by: -NSMinX(bounds), yBy: -NSMinY(bounds))
+            break
+        case 90:
+            transform.translateX(by: -NSMaxX(bounds), yBy: -NSMinY(bounds))
+            break
+        case 180:
+            transform.translateX(by: -NSMaxX(bounds), yBy: -NSMaxY(bounds))
+            break
+        case 270:
+            transform.translateX(by: -NSMinX(bounds), yBy: -NSMaxY(bounds))
+            break
+        default:
+            break
+        }
+        return transform
+    }
 }

+ 12 - 0
PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift

@@ -675,6 +675,18 @@ extension NSApplication {
     @objc optional func interfaceThemeDidChanged(_ appearance: NSAppearance.Name)
 }
 
+extension NSView: KMInterfaceThemeChangedProtocol {
+    func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        self.appearance = .init(named: appearance)
+    }
+}
+
+extension NSViewController: KMInterfaceThemeChangedProtocol {
+    func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        self.view.appearance = .init(named: appearance)
+    }
+}
+
 // MARK: - NSOutlineView
 
 extension NSOutlineView {

+ 14 - 4
PDF Office/PDF Master/Class/PDFTools/Convert/NewController/KMConvertWindowController.swift

@@ -79,6 +79,7 @@ class KMConvertWindowController: NSWindowController, NSTextFieldDelegate, NSWind
     var currentPage: CPDFPage?
     var savePath: String = ""
     var lockPassword: String = ""
+    var tempPDFDocument: CPDFDocument?
     
     var excelContentOption: CPDFConvertExcelContentOptions?
     var excelWorksheetOption: CPDFConvertExcelWorksheetOptions?
@@ -539,14 +540,20 @@ class KMConvertWindowController: NSWindowController, NSTextFieldDelegate, NSWind
         alert.runModal()
     }
     func produceNewPDF(with pagesArray: [CPDFPage]) {
-        let tPDFDocument = CPDFDocument()
+        if tempPDFDocument != nil{
+            tempPDFDocument = nil
+        }
+        tempPDFDocument = CPDFDocument()
+        for i in 0..<(self.pdfDocument?.pageCount ?? 0) {
+            tempPDFDocument?.removePage(at: i)
+        }
         for addedPage in pagesArray {
-            tPDFDocument?.insertPageObject(addedPage, at: tPDFDocument!.pageCount)
+            tempPDFDocument?.insertPageObject(addedPage, at: tempPDFDocument!.pageCount)
         }
-        self.prePDFView.document = tPDFDocument
+        self.prePDFView.document = tempPDFDocument
         self.prePDFView.goToFirstPage(nil)
         self.currentPageIndexTextField.stringValue = "1"
-        self.totalPageCountLabel.stringValue = " / \(tPDFDocument!.pageCount)"
+        self.totalPageCountLabel.stringValue = " / \(tempPDFDocument!.pageCount)"
     }
     func pageRangeSetON(_ sender: NSButton) {
         allPageButton.state = .off
@@ -625,6 +632,9 @@ class KMConvertWindowController: NSWindowController, NSTextFieldDelegate, NSWind
             }
         }
         produceNewPDF(with: pagesArray as! [CPDFPage])
+//        perform(#selector(produceNewPDF(with:)), with: pagesArray, afterDelay: 2)
+//        performSelector(produceNewPDF(with:), withObject: pagesArray, afterDelay: 2)
+        
     }
     @IBAction func buttonClicked_DpiSelect(_ sender: NSPopUpButton) {
         let index = sender.indexOfSelectedItem

+ 12 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMBotaLeftView.swift

@@ -57,8 +57,18 @@ class KMBotaLeftView: NSView {
 
     override func draw(_ dirtyRect: NSRect) {
         super.draw(dirtyRect)
-
+    }
+ 
+    override func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        super.interfaceThemeDidChanged(appearance)
         
+        self.segmentedControl.appearance = .init(named: appearance)
+        self.segmentedControl.wantsLayer = true
+//        self.segmentedControl.layer?.backgroundColor = KMAppearance.Layout.l_1Color().cgColor
+        if KMAppearance.isDarkMode() {
+            self.segmentedControl.layer?.backgroundColor = NSColor.km_init(hex: "#393B3E", alpha: 1).cgColor
+        } else {
+            self.segmentedControl.layer?.backgroundColor = NSColor.km_init(hex: "#EBECF0", alpha: 1).cgColor
+        }
     }
-    
 }

+ 77 - 70
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMImageToolTipContext.swift

@@ -17,85 +17,92 @@ extension NSAttributedString: KMImageToolTipContext {
     }
 }
 
+var _km_dest_labelAttributes: [NSAttributedString.Key : Any]?
+var _km_dest_labelColor: NSColor?
+
+var _km_text_margin_x: CGFloat = 2
+var _km_text_margin_y: CGFloat = 2
+
 extension CPDFDestination: KMImageToolTipContext {
     func toolTipImage() -> NSImage? {
-        return nil
-        //        static NSDictionary *labelAttributes = nil;
-        //        static NSColor *labelColor = nil;
-        //        if (labelAttributes == nil)
-                let style = NSMutableParagraphStyle()
-                style.lineBreakMode = .byClipping
-                let labelAttributes: [NSAttributedString.Key : Any] = [.font : NSFont.boldSystemFont(ofSize: 11), .foregroundColor : NSColor.white, .paragraphStyle : style]
-        //        if (labelColor == nil)
-                let labelColor = NSColor(calibratedWhite: 0.5, alpha: 0.8)
+        return self._toolTipImage(offset: NSMakePoint(-50.0, 20.0))
+    }
+
+    @objc private func _toolTipImage(offset: NSPoint) -> NSImage? {
+        guard let page = self.page() else {
+            return nil
+        }
+        
+        if _km_dest_labelAttributes == nil {
+            let style = NSMutableParagraphStyle()
+            style.lineBreakMode = .byClipping
+            _km_dest_labelAttributes = [.font : NSFont.boldSystemFont(ofSize: 11), .foregroundColor : NSColor.white, .paragraphStyle : style]
+        }
+        let attri = _km_dest_labelAttributes ?? [:]
+        
+        if _km_dest_labelColor == nil {
+            _km_dest_labelColor = NSColor(calibratedWhite: 0.5, alpha: 0.8)
+        }
+        let labelColor = _km_dest_labelColor ?? NSColor(calibratedWhite: 0.5, alpha: 0.8)
                 
-        //        PDFPage *page = [self page];
-        let page = self.page()
         //        NSImage *pageImage = [page thumbnailWithSize:0.0 forBox:kPDFDisplayBoxCropBox shadowBlurRadius:0.0 readingBar:nil];
-        //        NSRect pageImageRect = {NSZeroPoint, [pageImage size]};
-        //        NSRect bounds = [page boundsForBox:kPDFDisplayBoxCropBox];
-        let bounds = page?.bounds(for: .cropBox) ?? .zero
-                var sourceRect: NSRect = .zero
-        //        PDFSelection *selection = [page selectionForRect:bounds];
-        let selection = page?.selection(for: bounds)
-        //        NSAffineTransform *transform = [page affineTransformForBox:kPDFDisplayBoxCropBox];
-        let transform = page?.transform()
-                
+        let pageImage = page.thumbnail(of: page.bounds(for: .cropBox).size)
+        let pageSize = page.bounds(for: .cropBox)
+        let pageImageRect = NSMakeRect(0, 0, pageSize.width, pageSize.height)
+        let bounds = page.bounds(for: .cropBox)
+        var sourceRect: NSRect = .zero
+        let selection = page.selection(for: bounds)
+        
+        let transform = page.km_affineTransform(for: .cropBox)
+
         //        sourceRect.size.width = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipWidthKey];
-                sourceRect.size.width = 260
+        sourceRect.size.width = 260
         //        sourceRect.size.height = [[NSUserDefaults standardUserDefaults] doubleForKey:SKToolTipHeightKey];
-                sourceRect.size.height = 120
-        //        sourceRect.origin = SKAddPoints([transform transformPoint:[self point]], offset);
-        sourceRect.origin = self.point
-                sourceRect.origin.y -= NSHeight(sourceRect)
-                
-                
-//                if ([selection hasCharacters]) {
-//                    NSRect selBounds = [selection boundsForPage:page];
-//                    selBounds = SKRectFromPoints([transform transformPoint:SKBottomLeftPoint(selBounds)], [transform transformPoint:SKTopRightPoint(selBounds)]);
-//                    CGFloat top = ceil(fmax(NSMaxY(selBounds), NSMinY(selBounds) + NSHeight(sourceRect)));
-//                    CGFloat left = floor(fmin(NSMinX(selBounds), NSMaxX(selBounds) - NSWidth(sourceRect)));
-//                    if (top < NSMaxY(sourceRect))
-//                        sourceRect.origin.y = top - NSHeight(sourceRect);
-//                    if (left > NSMinX(sourceRect))
-//                        sourceRect.origin.x = left;
-//                }
+        sourceRect.size.height = 120
+        sourceRect.origin = KMAddPoints(transform.transform(self.point), offset)
+        sourceRect.origin.y -= NSHeight(sourceRect)
                 
-//                sourceRect = SKConstrainRect(sourceRect, pageImageRect);
+        if let data = selection?.hasCharacters(), data {
+            var selBounds = selection?.bounds(for: page) ?? .zero
+            let blPoint = KMBottomLeftPoint(selBounds)
+            let trPoint = KMTopRightPoint(selBounds)
+            selBounds = KMRectFromPoints(aPoint: blPoint, bPoint: trPoint)
+            let top = ceil(fmax(NSMaxY(selBounds), NSMinY(selBounds) + NSHeight(sourceRect)))
+            let left = floor(fmin(NSMinX(selBounds), NSMaxX(selBounds) - NSWidth(sourceRect)))
+            if (top < NSMaxY(sourceRect)) {
+                sourceRect.origin.y = top - NSHeight(sourceRect)
+            }
+            if (left > NSMinX(sourceRect)) {
+                sourceRect.origin.x = left
+            }
+        }
                 
-//                NSAttributedString *labelString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"Page %@", @"Tool tip label format"), [page displayLabel]] attributes:labelAttributes];
-//                NSRect labelRect = [labelString boundingRectWithSize:NSZeroSize options:NSStringDrawingUsesLineFragmentOrigin];
-//
-//                labelRect.size.width = floor(NSWidth(labelRect));
-//                labelRect.size.height = 2.0 * floor(0.5 * NSHeight(labelRect)); // make sure the cap radius is integral
-//                labelRect.origin.x = NSWidth(sourceRect) - NSWidth(labelRect) - 0.5 * NSHeight(labelRect) - TEXT_MARGIN_X;
-//                labelRect.origin.y = TEXT_MARGIN_Y;
-//                labelRect = NSIntegralRect(labelRect);
-//
-//                NSImage *image = [NSImage bitmapImageWithSize:sourceRect.size drawingHandler:^(NSRect rect){
-//
-//                    [pageImage drawInRect:rect fromRect:sourceRect operation:NSCompositeCopy fraction:1.0];
-//
-//                    CGFloat radius = 0.5 * NSHeight(labelRect);
-//                    NSBezierPath *path = [NSBezierPath bezierPath];
-//
-//                    [path moveToPoint:SKTopLeftPoint(labelRect)];
-//                    [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMinX(labelRect), NSMidY(labelRect)) radius:radius startAngle:90.0 endAngle:270.0];
-//                    [path appendBezierPathWithArcWithCenter:NSMakePoint(NSMaxX(labelRect), NSMidY(labelRect)) radius:radius startAngle:-90.0 endAngle:90.0];
-//                    [path closePath];
-//
-//                    [labelColor setFill];
-//                    [path fill];
-//
-//                    [labelString drawWithRect:labelRect options:NSStringDrawingUsesLineFragmentOrigin];
-//
-//                }];
-//
-//                [labelString release];
-        let image = page?.thumbnail(of: sourceRect.size)
+        sourceRect = KMConstrainRect(rect: sourceRect, boundary: pageImageRect)
                 
-                return image
-//        return nil
+        let labelString = NSAttributedString(string: String(format: KMLocalizedString("Page %@", "Tool tip label format"), page.km_displayLabel), attributes: attri)
+        var labelRect = labelString.boundingRect(with: .zero, options: [.usesLineFragmentOrigin])
+        labelRect.size.width = floor(NSWidth(labelRect))
+        labelRect.size.height = 2.0 * floor(0.5 * NSHeight(labelRect)) // make sure the cap radius is integral
+        labelRect.origin.x = NSWidth(sourceRect) - NSWidth(labelRect) - 0.5 * NSHeight(labelRect) - _km_text_margin_x
+        labelRect.origin.y = _km_text_margin_y
+        labelRect = NSIntegralRect(labelRect)
+
+        let image = NSImage.bitmapImage(with: sourceRect.size) { rect in
+            pageImage?.draw(in: rect, from: sourceRect, operation: .copy, fraction: 1)
+            let radius = 0.5 * NSHeight(labelRect)
+            let path = NSBezierPath()
+            path.move(to: KMTopLeftPoint(labelRect))
+            path.appendArc(withCenter: NSMakePoint(NSMinX(labelRect), NSMidY(labelRect)), radius: radius, startAngle: 90.0, endAngle: 270.0)
+            path.appendArc(withCenter: NSMakePoint(NSMaxX(labelRect), NSMidY(labelRect)), radius: radius, startAngle: -90, endAngle: 90)
+            path.close()
+
+            labelColor.setFill()
+            path.fill()
+
+            labelString.draw(with: labelRect, options: [.usesLineFragmentOrigin])
+        }
+
+        return image
     }
 }
 

+ 7 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController+Action.swift

@@ -224,13 +224,14 @@ extension KMLeftSideViewController {
         columnIndexSet.insert(0)
         self.snapshotTableView.reloadData(forRowIndexes: rowIndexSet, columnIndexes: columnIndexSet)
     }
-}
-
-// MARK: - KMInterfaceThemeChangedProtocol
-
-extension KMLeftSideViewController: KMInterfaceThemeChangedProtocol {
-    func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+    
+    // MARK: - KMInterfaceThemeChangedProtocol
+    
+    override func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        super.interfaceThemeDidChanged(appearance)
+        
         self.updateViewColor()
+        self.leftView.interfaceThemeDidChanged(appearance)
     }
 }
 

+ 0 - 6
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMLeftSideViewController.swift

@@ -1129,8 +1129,6 @@ extension KMLeftSideViewController {
             self.snapshotSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
             self.outlineSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
             self.noteSearchField.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1)
-//            self.leftView.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
-//            self.leftView.layer?.backgroundColor = NSColor.red.cgColor
         } else {
             self.leftListView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
             self.snapshotNormalView.layer?.backgroundColor = NSColor(red: 0.988, green: 0.992, blue: 1, alpha: 1).cgColor
@@ -1152,11 +1150,7 @@ extension KMLeftSideViewController {
             self.snapshotSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
             self.outlineSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
             self.noteSearchField.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1)
-//            self.leftView.layer?.backgroundColor = .white
         }
-        
-        self.leftView.wantsLayer = true
-        self.leftView.layer?.backgroundColor = KMAppearance.controlBackgroundColor().cgColor
     }
     
     private func _hasContainString(_ searchString: String, rootOutline outline: CPDFOutline) -> Bool {

+ 82 - 72
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/KMSegmentedControl.swift

@@ -22,8 +22,8 @@ class KMSegmentedControl: NSControl {
             self._segmentCount = newValue
             self.setSegmentCount(self.segmentCount, with: 55)
         }
-  
     }
+    
     private var _selectedSegment: UInt8 = 0
     var selectedSegment: UInt8 {
         get {
@@ -34,78 +34,12 @@ class KMSegmentedControl: NSControl {
             if (self.block != nil) {
                 self.block!(self.selectedSegment)
             }
-
-            for i in 0 ..< self.segments.count {
-                let button = self.segments[i]
-                if (self.isBackgroundHighlighted) {
-                    if (i == self.selectedSegment) {
-                        button.wantsLayer = true
-                        button.layer?.cornerRadius = 6.0
-                        if (KMAppearance.isDarkMode()) {
-                            button.layer?.backgroundColor = NSColor(red: 0.133, green: 0.478, blue: 1, alpha: 0.3).cgColor
-                        } else {
-                            button.layer?.backgroundColor = NSColor(red: 0.286, green: 0.510, blue: 0.902, alpha: 0.2).cgColor
-                        }
-
-                        if (i == 0) {
-                            button.image = NSImage(named: KMImageNameUXIconBtnSidebarListPre)
-                        } else if (i == 1) {
-                            button.image = NSImage(named: KMImageNameUXIconBtnSidebarPagePre)
-                        }
-                    } else {
-                        button.wantsLayer = true;
-                        button.layer?.backgroundColor = .clear
-                        if (i == 0) {
-                            button.image = NSImage(named: KMImageNameUXIconBtnSidebarListNor)
-                        } else if (i == 1) {
-                            button.image = NSImage(named: KMImageNameUXIconBtnSidebarPageNor)
-                        }
-                    }
-                } else {
-                    if (i == self.selectedSegment) {
-                        if (i == 0) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarThumbnailSel)
-                        } else if (i == 1) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarOutlineSel)
-                        } else if (i == 2) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarAnnotationSel)
-                        } else if (i == 3) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarSnapshotSel)
-                        } else if (i == 4) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarSearchSel)
-                        }
-                        button.wantsLayer = true
-                        if (KMAppearance.isDarkMode()) {
-                            button.layer?.backgroundColor = NSColor(red: 0.133, green: 0.478, blue: 1.000, alpha: 1).cgColor
-                        } else {
-                            button.layer?.backgroundColor = NSColor(red: 0.286, green: 0.510, blue: 0.902, alpha: 1).cgColor
-                        }
-                    } else {
-                        if (i == 0) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarThumbnailNor)
-                        } else if (i == 1) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarOutlineNor)
-                        } else if (i == 2) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarAnnotationNor)
-                        } else if (i == 3) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarSnapshotNor)
-                        } else if (i == 4) {
-                            button.image = NSImage(named: KMImageNameUXIconSidetabbarSearchNor)
-                        }
-                        button.wantsLayer = true
-                        if (KMAppearance.isDarkMode()) {
-                            button.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
-                        } else {
-                            button.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
-                        }
-                    }
-                }
-            }
+            
+            self.reloadData()
         }
     }
     var isBackgroundHighlighted = false
     var block: ((_ segmentCount: UInt8) -> Void)?
-    var buttonActionHandle: ((_ segmentCount: UInt8) -> Void)?
     
     private var _segments: [NSButton] = []
     var segments: [NSButton] {
@@ -132,8 +66,9 @@ class KMSegmentedControl: NSControl {
         super.updateLayer()
         
         if #available(macOS 10.14, *) {
-            self.selectedSegment = self._selectedSegment
+//            self.selectedSegment = self._selectedSegment
         }
+        self.reloadData()
     }
     
     // MARK: - Public Methods
@@ -161,6 +96,7 @@ class KMSegmentedControl: NSControl {
             button.isBordered = false
             button.imageScaling = .scaleProportionallyDown
             button.imagePosition = .imageOnly
+//            button.layer?.cornerRadius = 6.0
             button.frame = NSMakeRect((Float(i)*width).cgFloat, 0, width.cgFloat, height)
             button.tag = Int(i)
             button.target = self
@@ -220,6 +156,19 @@ class KMSegmentedControl: NSControl {
             }
         }
     }
+    
+    func reloadData() {
+        let block = {
+            self._reloadData()
+        }
+        if Thread.isMainThread {
+            block()
+        } else {
+            Task { @MainActor in
+                block()
+            }
+        }
+    }
 }
 
 // MARK: - Private Methods
@@ -227,8 +176,69 @@ class KMSegmentedControl: NSControl {
 extension KMSegmentedControl {
     @objc private func _buttonAction(_ sender: NSButton) {
         self.selectedSegment = UInt8(sender.tag)
-        if (self.buttonActionHandle != nil) {
-            self.buttonActionHandle!(self.selectedSegment)
+    }
+    
+    private func _reloadData() {
+        for (i, button) in self.segments.enumerated() {
+            if (self.isBackgroundHighlighted) {
+                if (i == self.selectedSegment) {
+                    if (KMAppearance.isDarkMode()) {
+                        button.layer?.backgroundColor = NSColor(red: 0.133, green: 0.478, blue: 1, alpha: 0.3).cgColor
+                    } else {
+                        button.layer?.backgroundColor = NSColor(red: 0.286, green: 0.510, blue: 0.902, alpha: 0.2).cgColor
+                    }
+                    
+                    if (i == 0) {
+                        button.image = NSImage(named: KMImageNameUXIconBtnSidebarListPre)
+                    } else if (i == 1) {
+                        button.image = NSImage(named: KMImageNameUXIconBtnSidebarPagePre)
+                    }
+                } else {
+                    button.layer?.backgroundColor = .clear
+                    if (i == 0) {
+                        button.image = NSImage(named: KMImageNameUXIconBtnSidebarListNor)
+                    } else if (i == 1) {
+                        button.image = NSImage(named: KMImageNameUXIconBtnSidebarPageNor)
+                    }
+                }
+            } else {
+                if (i == self.selectedSegment) {
+                    if (i == 0) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarThumbnailSel)
+                    } else if (i == 1) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarOutlineSel)
+                    } else if (i == 2) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarAnnotationSel)
+                    } else if (i == 3) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarSnapshotSel)
+                    } else if (i == 4) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarSearchSel)
+                    }
+                    if (KMAppearance.isDarkMode()) {
+                        button.layer?.backgroundColor = NSColor(red: 0.133, green: 0.478, blue: 1.000, alpha: 1).cgColor
+                    } else {
+                        button.layer?.backgroundColor = NSColor(red: 0.286, green: 0.510, blue: 0.902, alpha: 1).cgColor
+                    }
+                } else {
+                    if (i == 0) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarThumbnailNor)
+                    } else if (i == 1) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarOutlineNor)
+                    } else if (i == 2) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarAnnotationNor)
+                    } else if (i == 3) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarSnapshotNor)
+                    } else if (i == 4) {
+                        button.image = NSImage(named: KMImageNameUXIconSidetabbarSearchNor)
+                    }
+                    button.wantsLayer = true
+                    if (KMAppearance.isDarkMode()) {
+                        button.layer?.backgroundColor = NSColor(red: 0.224, green: 0.235, blue: 0.243, alpha: 1).cgColor
+                    } else {
+                        button.layer?.backgroundColor = NSColor(red: 0.922, green: 0.925, blue: 0.941, alpha: 1).cgColor
+                    }
+                }
+            }
         }
     }
     

+ 8 - 7
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -94,6 +94,14 @@ extension KMMainViewController {
             self.readContentView.addSubview(self.tipCurrentPageBox, positioned: .above, relativeTo: self.readContentView)
         }
     }
+    
+    // MARK: - KMInterfaceThemeChangedProtocol
+    
+    override func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        super.interfaceThemeDidChanged(appearance)
+        
+        self.leftSideViewController.interfaceThemeDidChanged(appearance)
+    }
 }
 
 extension KMMainViewController: KMToolbarControllerDelegate {
@@ -706,10 +714,3 @@ extension KMMainViewController {
 //    }
 }
 
-// MARK: - KMInterfaceThemeChangedProtocol
-
-extension KMMainViewController: KMInterfaceThemeChangedProtocol {
-    func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
-        
-    }
-}

+ 142 - 17
PDF Office/PDF Reader Pro.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -32,8 +32,40 @@
             endingColumnNumber = "9223372036854775807"
             startingLineNumber = "293"
             endingLineNumber = "293"
-            landmarkName = "splitView(_:shouldCollapseSubview:forDoubleClickOnDividerAt:)"
+            landmarkName = "splitView(_:canCollapseSubview:)"
             landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "C2FF957C-635A-4EF6-9DB8-378CE1DB1B31 - 62964c3b4ba698ba"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.splitView(_: __C.NSSplitView, shouldCollapseSubview: __C.NSView, forDoubleClickOnDividerAt: Swift.Int) -&gt; Swift.Bool"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "293"
+                  endingLineNumber = "293"
+                  offsetFromSymbolStart = "524">
+               </Location>
+               <Location
+                  uuid = "C2FF957C-635A-4EF6-9DB8-378CE1DB1B31 - 1969a2f10519636d"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.splitView(_: __C.NSSplitView, canCollapseSubview: __C.NSView) -&gt; Swift.Bool"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "293"
+                  endingLineNumber = "293"
+                  offsetFromSymbolStart = "864">
+               </Location>
+            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -50,22 +82,38 @@
             endingLineNumber = "457"
             landmarkName = "splitViewWillResizeSubviews(_:)"
             landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "9967D950-6AC5-4881-A605-309CA31FCFDE"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "474"
-            endingLineNumber = "474"
-            landmarkName = "splitViewDidResizeSubviews(_:)"
-            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "89774907-7FA0-48FD-BCA3-928211F8258C - 53cda87a65f1bdca"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.splitViewWillResizeSubviews(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "457"
+                  endingLineNumber = "457"
+                  offsetFromSymbolStart = "3228">
+               </Location>
+               <Location
+                  uuid = "89774907-7FA0-48FD-BCA3-928211F8258C - 53cda87a65f1bdca"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMMainViewController.splitViewWillResizeSubviews(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "457"
+                  endingLineNumber = "457"
+                  offsetFromSymbolStart = "1884">
+               </Location>
+            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -145,6 +193,21 @@
                   endingLineNumber = "2197"
                   offsetFromSymbolStart = "108">
                </Location>
+               <Location
+                  uuid = "5A7CC821-F96A-419E-BE13-8EB874EE6C2B - 120ee39fb5485f3e"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMBrowserWindowController.removeAllAnnotation(Swift.Optional&lt;Any&gt;) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/ChromiumTabs/KMBrowserWindowController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "2196"
+                  endingLineNumber = "2196"
+                  offsetFromSymbolStart = "1144">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>
@@ -577,6 +640,38 @@
             endingLineNumber = "808"
             landmarkName = "uniqueChewableItemsDirectoryURL()"
             landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "AA0F8A1F-CDB4-49C4-8D7B-6E08BC7F52C0 - 5b1d44b6b25ab349"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "__C.NSFileManager.uniqueChewableItemsDirectoryURL() -&gt; Foundation.URL"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/Common/Category/NSObject+KMExtension.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "808"
+                  endingLineNumber = "808"
+                  offsetFromSymbolStart = "884">
+               </Location>
+               <Location
+                  uuid = "AA0F8A1F-CDB4-49C4-8D7B-6E08BC7F52C0 - de480df33b2aee88"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "(1) suspend resume partial function for closure #2 @Swift.MainActor @Sendable () async -&gt; () in __C.NSTableView.ks_reloadData() -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/Common/Category/NSObject+KMExtension.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "808"
+                  endingLineNumber = "808"
+                  offsetFromSymbolStart = "88">
+               </Location>
+            </Locations>
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
@@ -763,6 +858,36 @@
                   endingLineNumber = "150"
                   offsetFromSymbolStart = "404">
                </Location>
+               <Location
+                  uuid = "DB926723-14B1-4358-AF9B-3BC932A40699 - 804018a15d171c1b"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMBrowserWindowController._themeChanged(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/ChromiumTabs/KMBrowserWindowController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "150"
+                  endingLineNumber = "150"
+                  offsetFromSymbolStart = "92">
+               </Location>
+               <Location
+                  uuid = "DB926723-14B1-4358-AF9B-3BC932A40699 - 804018a15d171c1b"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "PDF_Reader_Pro.KMBrowserWindowController._themeChanged(Foundation.Notification) -&gt; ()"
+                  moduleName = "PDF Reader Pro"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/kdanmobile/Documents/Git/PDF_Office/PDF%20Office/PDF%20Master/Class/ChromiumTabs/KMBrowserWindowController.swift"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "150"
+                  endingLineNumber = "150"
+                  offsetFromSymbolStart = "416">
+               </Location>
             </Locations>
          </BreakpointContent>
       </BreakpointProxy>