Explorar o código

【fix】【夜间模式】打开APP的情况下切换成夜间模式,注释工具有部分图标不兼容

tangchao hai 5 meses
pai
achega
e4710ec33a

+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameInkDrakIcon.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "ic_sidebar_annotation_pen.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameInkIcon.imageset/ic_sidebar_annotation_pen.pdf → PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameInkDrakIcon.imageset/ic_sidebar_annotation_pen.pdf


+ 0 - 10
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameInkIcon.imageset/Contents.json

@@ -3,16 +3,6 @@
     {
       "filename" : "light_ic_sidebar_annotation_pen.pdf",
       "idiom" : "universal"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "ic_sidebar_annotation_pen.pdf",
-      "idiom" : "universal"
     }
   ],
   "info" : {

+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameStikeoutDrakIcon.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "ic_sidebar_annotation_hightlight.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameStikeoutIcon.imageset/ic_sidebar_annotation_hightlight.pdf → PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameStikeoutDrakIcon.imageset/ic_sidebar_annotation_hightlight.pdf


+ 0 - 10
PDF Office/PDF Master/Class/Appearance/Image.xcassets/LeftSide/KMImageNameStikeoutIcon.imageset/Contents.json

@@ -3,16 +3,6 @@
     {
       "filename" : "light_ic_sidebar_annotation_stikeout.pdf",
       "idiom" : "universal"
-    },
-    {
-      "appearances" : [
-        {
-          "appearance" : "luminosity",
-          "value" : "dark"
-        }
-      ],
-      "filename" : "ic_sidebar_annotation_hightlight.pdf",
-      "idiom" : "universal"
     }
   ],
   "info" : {

+ 4 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/LeftSide/Annotation/View/KMNoteTypeImageView.swift

@@ -72,13 +72,15 @@ class KMNoteTypeImageView: NSImageView {
         var underline = "KMImageNameAnnotationUnderline"
         var inkImagePath = Bundle.main.path(forResource: "KMImageNameAnnotationFreehand", ofType: "pdf")
         
+        var inkIcon = "KMImageNameInkIcon"
         if #available(macOS 10.14, *) {
             let appearanceName = NSApp.effectiveAppearance.bestMatch(from: [.aqua, .darkAqua])
             if appearanceName == .darkAqua {
                 strikePath = "KMImageNameAnnotationStrikeout"
-                highlight = "KMImageNameStikeoutIcon"
+                highlight = "KMImageNameStikeoutDrakIcon"
                 underline = "KMImageNameAnnotationUnderline"
                 inkImagePath = "KMImageNameAnnotationFreehandDrak"
+                inkIcon = "KMImageNameInkDrakIcon"
             }
         }
 
@@ -208,7 +210,7 @@ class KMNoteTypeImageView: NSImageView {
             }
             image?.unlockFocus()
         } else if type == SKNInkString {
-            if let baseImage = NSImage(named: "KMImageNameInkIcon")?.copy() as? NSImage {
+            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)

+ 24 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -614,6 +614,30 @@ class KMToolbarController: NSViewController {
         
         self.mainToolBarView?.interfaceThemeDidChanged(appearance)
         self.childToolBarView?.interfaceThemeDidChanged(appearance)
+        
+        for item in self.childToolBarView?.toolbar?.items ?? [] {
+            if item.itemIdentifier == KMToolbarHighlightAnnotationItemIdentifier {
+                let color = KMPreference.shared.markupHighlightColor
+                let imageV = KMNoteTypeImageView()
+                item.image = imageV.noteTypeImage(withType: SKNHighlightString, color: color)
+            } else if item.itemIdentifier == KMToolbarUnderlineAnnotationItemIdentifier {
+                let color = KMPreference.shared.markupUnderlineColor
+                let imageV = KMNoteTypeImageView()
+                item.image = imageV.noteTypeImage(withType: SKNUnderlineString, color: color)
+            } else if item.itemIdentifier == KMToolbarStrikeOutAnnotationItemIdentifier {
+                let color = KMPreference.shared.markupStrikthroughColor
+                let imageV = KMNoteTypeImageView()
+                item.image = imageV.noteTypeImage(withType: SKNStrikeOutString, color: color)
+            } else if item.itemIdentifier == KMToolbarSquigglyAnnotationItemIdentifier {
+                let color = UserDefaults.standard.PDFListViewColor(forKey: CSquigglyNoteColorKey) ?? kAnnotationSquigglyDefaultColor
+                let imageV = KMNoteTypeImageView()
+                item.image = imageV.noteTypeImage(withType: CPDFAnnotation.kType.squiggly, color: color)
+            } else if item.itemIdentifier == KMToolbarInkAnnotationItemIdentifier {
+                let color = KMPreference.shared.markupPenColor
+                let imageV = KMNoteTypeImageView()
+                item.image = imageV.noteTypeImage(withType: SKNInkString, color: color)
+            }
+        }
     }
 }
 

+ 5 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -885,6 +885,11 @@ extension KMToolbarViewController : KMToolbarViewDelegate,NSToolbarItemValidatio
                     if itemIdentifiers.contains(identifier) && annotationToolIdentifiers.contains(identifier) == false {
                         create = true
                     }
+                    if create == false {
+                        if pId == KMDocumentAnnotationToolbarItemIdentifier {
+                            create = NSAppearance.current != self.view.window?.appearance
+                        }
+                    }
                 }
             }
         }