Selaa lähdekoodia

【综合】暗黑 页面编辑(已修复)

tangchao 11 kuukautta sitten
vanhempi
commit
7b6f4b6a8b

+ 23 - 2
PDF Office/PDF Master/Class/PDFTools/PageEdit/Controller/KMPDFEditViewController.swift

@@ -149,7 +149,12 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
 //        self.thumbnailView.dragMoveEffectAnimated = true
 //        self.thumbnailView.dragMoveEffectAnimated = true
 //        self.thumbnailView.collectionView.backgroundColor(NSColor.km_init(hex: "#CED0D4"))
 //        self.thumbnailView.collectionView.backgroundColor(NSColor.km_init(hex: "#CED0D4"))
         self.thumbnailView.collectionView.wantsLayer = true
         self.thumbnailView.collectionView.wantsLayer = true
-        self.thumbnailView.collectionView.layer?.backgroundColor = KMAppearance.PDFViewBackgroundColor().cgColor
+//        self.thumbnailView.collectionView.layer?.backgroundColor = KMAppearance.PDFViewBackgroundColor().cgColor
+        if KMAppearance.isDarkMode() {
+            self.thumbnailView.collectionView.layer?.backgroundColor = NSColor.km_init(hex: "#5F5F60").cgColor
+        } else {
+            self.thumbnailView.collectionView.layer?.backgroundColor = NSColor.km_init(hex: "#DADBDE").cgColor
+        }
         
         
         self.thumbnailSizeView.wantsLayer = true
         self.thumbnailSizeView.wantsLayer = true
         self.thumbnailSizeView.layer?.backgroundColor = KMAppearance.Layout.b80Color().cgColor
         self.thumbnailSizeView.layer?.backgroundColor = KMAppearance.Layout.b80Color().cgColor
@@ -253,7 +258,7 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
             indexs.sort(){$0 < $1}
             indexs.sort(){$0 < $1}
             self.toolBar.setPageRangeString(KMPageRangeTools.newParseSelectedIndexs(selectedIndex: indexs))
             self.toolBar.setPageRangeString(KMPageRangeTools.newParseSelectedIndexs(selectedIndex: indexs))
             
             
-            if let view = self.listView { // 存储阅读视图的当前页面索引
+            if self.listView != nil { // 存储阅读视图的当前页面索引
                 if indexs.count != 0 {
                 if indexs.count != 0 {
                     self._listViewCurrentIndex = indexs.last!
                     self._listViewCurrentIndex = indexs.last!
                 }
                 }
@@ -261,6 +266,22 @@ class KMPDFEditViewController: KMPDFThumbViewBaseController {
         }
         }
     }
     }
     
     
+    override func interfaceThemeDidChanged(_ appearance: NSAppearance.Name) {
+        super.interfaceThemeDidChanged(appearance)
+        
+        self.thumbnailView.collectionView.wantsLayer = true
+        if KMAppearance.isDarkMode() {
+            self.thumbnailView.collectionView.layer?.backgroundColor = NSColor.km_init(hex: "#5F5F60").cgColor
+        } else {
+            self.thumbnailView.collectionView.layer?.backgroundColor = NSColor.km_init(hex: "#DADBDE").cgColor
+        }
+        Task { @MainActor in
+            let ips = self.thumbnailView.selectionIndexPaths
+            self.thumbnailView.collectionView.reloadData()
+            self.thumbnailView.selectionIndexPaths = ips
+        }
+    }
+    
     // MARK: Private Methods
     // MARK: Private Methods
     
     
     private func getSelecteIndex() -> Int {
     private func getSelecteIndex() -> Int {

+ 5 - 1
PDF Office/PDF Master/Class/PDFTools/PageEdit/View/KMPageEditThumbnailItem.swift

@@ -146,7 +146,11 @@ class KMPageEditThumbnailItem: NSCollectionViewItem {
 //                 self.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#1770F4").cgColor
 //                 self.backgroundView.layer?.borderColor = NSColor.km_init(hex: "#1770F4").cgColor
                  self.pageTextLabel.textColor = .white
                  self.pageTextLabel.textColor = .white
                  self.pageTextLabel.layer?.backgroundColor = NSColor.systemBlue.cgColor
                  self.pageTextLabel.layer?.backgroundColor = NSColor.systemBlue.cgColor
-                 self.pageBox.layer?.backgroundColor = NSColor(white: 192.0/255.0, alpha: 1.0).cgColor
+                 if KMAppearance.isDarkMode() {
+                     self.pageBox.layer?.backgroundColor = NSColor(white: 84.0/255.0, alpha: 1.0).cgColor
+                 } else {
+                     self.pageBox.layer?.backgroundColor = NSColor(white: 192.0/255.0, alpha: 1.0).cgColor
+                 }
              } else {
              } else {
 //                 self.backgroundView.layer?.backgroundColor = NSColor.clear.cgColor
 //                 self.backgroundView.layer?.backgroundColor = NSColor.clear.cgColor
 //                 self.backgroundView.layer?.borderColor = NSColor.clear.cgColor
 //                 self.backgroundView.layer?.borderColor = NSColor.clear.cgColor

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+UI.swift

@@ -104,6 +104,8 @@ extension KMMainViewController {
         self.leftSideViewController.interfaceThemeDidChanged(appearance)
         self.leftSideViewController.interfaceThemeDidChanged(appearance)
         self.rightSideViewController.interfaceThemeDidChanged(appearance)
         self.rightSideViewController.interfaceThemeDidChanged(appearance)
         
         
+        self.pdfEditController?.interfaceThemeDidChanged(appearance)
+        
         self.mianSplitView.superview?.wantsLayer = true
         self.mianSplitView.superview?.wantsLayer = true
 //        let sView = self.listView.documentView()
 //        let sView = self.listView.documentView()
         if KMAppearance.isDarkMode() {
         if KMAppearance.isDarkMode() {