ComPDFUIConfig.swift 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // ComPDFUIConfig.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2023/10/11.
  6. //
  7. import Cocoa
  8. class ComPDFUIConfig: NSObject {
  9. class func initializeUIConfig() {
  10. if let initialUserDefaultsURL = Bundle.main.url(forResource: "InitialUserDefaults", withExtension: "plist"),
  11. let initialUserDefaultsDict = NSDictionary(contentsOf: initialUserDefaultsURL) as? [String: Any],
  12. let initialValuesDict = initialUserDefaultsDict["RegisteredDefaults"] as? [String: Any] {
  13. // Set the defaults in the standard user defaults
  14. UserDefaults.standard.register(defaults: initialValuesDict)
  15. NSImage.makePDFListViewCursorImages()
  16. CPDFListViewConfig.defaultManager.annotationBorderOffset = 2
  17. CPDFListViewConfig.defaultManager.annotationBorderColor = NSColor(red: 48.0/255.0, green: 145.0/255.0, blue: 255.0/255.0, alpha: 1.0)
  18. CPDFKitConfig.sharedInstance().isShowFormRequiredFlagColor = false
  19. CPDFListViewConfig.defaultManager.isSaveDefault = true
  20. let sud = UserDefaults.standard
  21. if sud.object(forKey: CHighlightNoteColorKey) == nil {
  22. CPDFAnnotationConfig.standard.setColor(CPDFMarkupAnnotation.defaultColor(.highlight), toType: .highlight)
  23. }
  24. if sud.object(forKey: CStrikeOutNoteColorKey) == nil {
  25. CPDFAnnotationConfig.standard.setColor(CPDFMarkupAnnotation.defaultColor(.strikeOut), toType: .strikeOut)
  26. }
  27. if sud.object(forKey: CUnderlineNoteColorKey) == nil {
  28. CPDFAnnotationConfig.standard.setColor(CPDFMarkupAnnotation.defaultColor(.underline), toType: .underline)
  29. }
  30. if sud.object(forKey: CSquigglyNoteColorKey) == nil {
  31. CPDFAnnotationConfig.standard.setColor(CPDFMarkupAnnotation.defaultColor(.squiggly), toType: .squiggly)
  32. }
  33. }
  34. }
  35. }