Browse Source

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

tangchao 11 months ago
parent
commit
6bd6b9f068

+ 2 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.swift

@@ -68,6 +68,8 @@ typealias popCellViewDownCallback = (_ downEntered: Bool, _ count: String) -> Vo
     // MARK: Private
     
     func updateUI() {
+        customBox.fillColor = background
+        
         var widthMax: Float = 0;
         let subViews: [NSView] = self.customBox.contentView!.subviews
         for subView in subViews {

+ 18 - 0
PDF Office/PDF Master/Class/Home/ViewController/customViewController/KMDesignSelect.swift

@@ -157,6 +157,9 @@ class KMSelectCell: NSTextFieldCell {
     var createFilePopover: NSPopover = NSPopover.init()
     var popoverBehavior: NSPopover.Behavior = .semitransient
     var popViewController: KMHomePopViewController?
+    var popViewControllerBackground: NSColor?
+    var popViewControllerTextColor: NSColor?
+    var popViewControllerEnterFillColor: NSColor?
     
     init(withType type: SelectType) {
         super.init(nibName: "KMDesignSelect", bundle: nil)
@@ -414,6 +417,8 @@ class KMSelectCell: NSTextFieldCell {
         textField.isEditable = editable
 //        textField.placeholderString = placeholderString
         textField.lineBreakMode = lineBreakMode
+        
+        popViewController?.updateUI()
     }
     
     func removeAllItems() {
@@ -445,6 +450,19 @@ class KMSelectCell: NSTextFieldCell {
             } else {
                 vc = KMHomePopViewController()
             }
+            
+            if (self.popViewControllerBackground != nil) {
+                vc?.background = self.popViewControllerBackground!
+            }
+            
+            if self.popViewControllerBackground != nil {
+                vc?.textColor = self.popViewControllerTextColor!
+            }
+            
+            if self.popViewControllerBackground != nil {
+                vc?.enterFillColor = self.popViewControllerEnterFillColor!
+            }
+            
             let _ = vc?.initWithPopViewDataArr(items)
             self.popViewController = vc
             

+ 47 - 8
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/KMEditPDFTextPropertyViewController.swift

@@ -187,6 +187,7 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         centerAlignmentVC?.action = #selector(centerAlignmentAction)
         centerAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignCenter")!
         centerAlignmentVC?.image_sel = NSImage(named: "KMImageNameEditPDFAlignCenterSelect")!
+        centerAlignmentVC?.updateUI()
         
         rightAlignmentVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
         rightAlignmentBox.contentView = rightAlignmentVC?.view
@@ -195,23 +196,27 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         rightAlignmentVC?.action = #selector(rightAlignmentAction)
         rightAlignmentVC?.image = NSImage(named: "KMImageNameEditPDFAlignRight")!
         rightAlignmentVC?.image_sel = NSImage(named: "KMImageNameEditPDFAlignRightSelect")!
-        
-        //font
-//        var fontNameArray: [String] = []
-//        for font in CPDFAnnotationModel.supportFonts() {
-//            let fontName = (font as? NSDictionary)!.allKeys.first
-//            fontNameArray.append(fontName as! String)
-//        }
+        rightAlignmentVC?.updateUI()
         
         var fontNameArray = KMEditPDFTextManager.manager.fetchTextFontNames()
         
         fontNameVC = KMDesignSelect.init(withType: .PopButton)
-        fontNameVC?.isScrollPop = true
+//        fontNameVC?.isScrollPop = true
         fontNameBox.contentView = fontNameVC?.view
         fontNameBox.fillColor = NSColor.clear
         fontNameVC?.addItems(withObjectValues: fontNameArray)
         fontNameVC?.selectItem(at: 0)
         fontNameVC?.delete = self
+        fontNameVC?.background = KMAppearance.Layout.l1Color()
+        fontNameVC?.background_hov = KMAppearance.Layout.l1Color()
+        fontNameVC?.background_focus = KMAppearance.Layout.l1Color()
+        fontNameVC?.textColor = KMAppearance.Layout.h1Color()
+        fontNameVC?.textColor_hov = KMAppearance.Layout.h1Color()
+        fontNameVC?.textColor_focus = KMAppearance.Layout.h1Color()
+        fontNameVC?.popViewControllerBackground = KMAppearance.Layout.bgColor()
+        fontNameVC?.popViewControllerTextColor = KMAppearance.Layout.h0Color()
+        fontNameVC?.popViewControllerEnterFillColor = KMAppearance.Interactive.s0Color()
+        fontNameVC?.updateUI()
         
         let styleArray = defaultFontStyles //KMEditPDFTextManager.manager.fetchFontStyleWithFontName(fontName: fontName)
         fontStyleVC = KMDesignSelect.init(withType: .PopButton)
@@ -220,6 +225,16 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         fontStyleVC?.addItems(withObjectValues: styleArray)
         fontStyleVC?.selectItem(at: 0)
         fontStyleVC?.delete = self
+        fontStyleVC?.background = KMAppearance.Layout.l1Color()
+        fontStyleVC?.background_hov = KMAppearance.Layout.l1Color()
+        fontStyleVC?.background_focus = KMAppearance.Layout.l1Color()
+        fontStyleVC?.textColor = KMAppearance.Layout.h1Color()
+        fontStyleVC?.textColor_hov = KMAppearance.Layout.h1Color()
+        fontStyleVC?.textColor_focus = KMAppearance.Layout.h1Color()
+        fontStyleVC?.popViewControllerBackground = KMAppearance.Layout.bgColor()
+        fontStyleVC?.popViewControllerTextColor = KMAppearance.Layout.h0Color()
+        fontStyleVC?.popViewControllerEnterFillColor = KMAppearance.Interactive.s0Color()
+        fontStyleVC?.updateUI()
         
         fontSizeVC = KMDesignSelect.init(withType: .PopButton)
         fontSizeBox.contentView = fontSizeVC?.view
@@ -228,6 +243,16 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         fontSizeVC?.addItems(withObjectValues: self.supportFontSize())
         fontSizeVC?.selectItem(at: 0)
         fontSizeVC?.delete = self
+        fontSizeVC?.background = KMAppearance.Layout.l1Color()
+        fontSizeVC?.background_hov = KMAppearance.Layout.l1Color()
+        fontSizeVC?.background_focus = KMAppearance.Layout.l1Color()
+        fontSizeVC?.textColor = KMAppearance.Layout.h1Color()
+        fontSizeVC?.textColor_hov = KMAppearance.Layout.h1Color()
+        fontSizeVC?.textColor_focus = KMAppearance.Layout.h1Color()
+        fontSizeVC?.popViewControllerBackground = KMAppearance.Layout.bgColor()
+        fontSizeVC?.popViewControllerTextColor = KMAppearance.Layout.h0Color()
+        fontSizeVC?.popViewControllerEnterFillColor = KMAppearance.Interactive.s0Color()
+        fontSizeVC?.updateUI()
         
         //textPresupposition
         textPresuppositionVC = KMDesignSelect.init(withType: .PopButton)
@@ -236,6 +261,16 @@ class KMEditPDFTextPropertyViewController: NSViewController {
         textPresuppositionVC?.addItems(withObjectValues: KMEditPDFTextManager.manager.updateTextPresuppositionFontNameArray())
         textPresuppositionVC?.selectItem(at: 0)
         textPresuppositionVC?.delete = self
+        textPresuppositionVC?.background = KMAppearance.Layout.l1Color()
+        textPresuppositionVC?.background_hov = KMAppearance.Layout.l1Color()
+        textPresuppositionVC?.background_focus = KMAppearance.Layout.l1Color()
+        textPresuppositionVC?.textColor = KMAppearance.Layout.h1Color()
+        textPresuppositionVC?.textColor_hov = KMAppearance.Layout.h1Color()
+        textPresuppositionVC?.textColor_focus = KMAppearance.Layout.h1Color()
+        textPresuppositionVC?.popViewControllerBackground = KMAppearance.Layout.bgColor()
+        textPresuppositionVC?.popViewControllerTextColor = KMAppearance.Layout.h0Color()
+        textPresuppositionVC?.popViewControllerEnterFillColor = KMAppearance.Interactive.s0Color()
+        textPresuppositionVC?.updateUI()
         
         textPresuppositionResetVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
         resetTextPresuppositionBox.contentView = textPresuppositionResetVC?.view
@@ -469,6 +504,10 @@ extension KMEditPDFTextPropertyViewController {
         }
         
         let vc: KMHomePopViewController = KMHomePopViewController().initWithPopViewDataArr(popViewDataArr)
+        vc.background = KMAppearance.Layout.bgColor()
+        vc.textColor = KMAppearance.Layout.h0Color()
+        vc.enterFillColor = KMAppearance.Interactive.s0Color()
+        
         vc.disItems = disItems
         let createFilePopover: NSPopover = NSPopover.init()
         createFilePopover.contentViewController = vc

+ 11 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/EditPDF/Manager/KMEditPDFTextManager.swift

@@ -126,10 +126,18 @@ extension KMEditPDFTextManager {
     
     func updateTextFontNames(listView: CPDFListView?) -> [String] {
         if textFontNames.count == 0 {
-            if listView != nil {
-                textFontNames = listView!.getEditFontList() as? [String] ?? []
-                textFontNames.sort()
+            
+            var fontNameArray: [String] = []
+            for font in CPDFAnnotationModel.supportFonts() {
+                let fontName = (font as? NSDictionary)!.allKeys.first
+                fontNameArray.append(fontName as! String)
             }
+            textFontNames = fontNameArray
+            
+//            if listView != nil {
+//                textFontNames = listView!.getEditFontList() as? [String] ?? []
+//                textFontNames.sort()
+//            }
         }
         return textFontNames
     }