|
@@ -24,17 +24,7 @@ class KMPreferenceMarkupController: NSViewController {
|
|
|
@IBOutlet weak var aligementView: KMPreferenceAligementView!
|
|
|
var currentColorItemView: KMPreferenceMarkupColorItemView?
|
|
|
|
|
|
- var fontNames: [String] {
|
|
|
- get {
|
|
|
- var fontNames: Array<String> = []
|
|
|
- for font in CPDFAnnotationModel.supportFonts() {
|
|
|
- let fontDict: NSDictionary = font as! NSDictionary
|
|
|
- let fontName: String = fontDict.allKeys.first as! String
|
|
|
- fontNames.append(fontName)
|
|
|
- }
|
|
|
- return fontNames
|
|
|
- }
|
|
|
- }
|
|
|
+ lazy var fontNames = KMPreferenceManager.supportFonts
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
@@ -162,17 +152,9 @@ class KMPreferenceMarkupController: NSViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- let fontNames = self.fontNames
|
|
|
- var value = KMPreferenceManager.shared.markupFontTextType
|
|
|
- if (value == 0) {
|
|
|
- self.textComboBox.stringValue = fontNames[0]
|
|
|
- } else if (value == 1) {
|
|
|
- self.textComboBox.stringValue = fontNames[1]
|
|
|
- } else if (value == 2) {
|
|
|
- self.textComboBox.stringValue = fontNames[2]
|
|
|
- }
|
|
|
+ self.textComboBox.stringValue = KMPreferenceManager.shared.markupFontTextString
|
|
|
|
|
|
- value = KMPreferenceManager.shared.markupFontTextAligmentType
|
|
|
+ var value = KMPreferenceManager.shared.markupFontTextAligmentType
|
|
|
if (value == 0) {
|
|
|
self.aligementView.selectIndex(index: 0)
|
|
|
} else if (value == 1) {
|
|
@@ -181,6 +163,7 @@ class KMPreferenceMarkupController: NSViewController {
|
|
|
self.aligementView.selectIndex(index: 2)
|
|
|
}
|
|
|
|
|
|
+ let fontNames = self.fontNames
|
|
|
value = KMPreferenceManager.shared.markupFontNoteType
|
|
|
if (value == 0) {
|
|
|
self.noteComboBox.stringValue = fontNames[0]
|
|
@@ -233,7 +216,7 @@ extension KMPreferenceMarkupController: NSComboBoxDelegate {
|
|
|
if (index < 0) {
|
|
|
index = 0
|
|
|
}
|
|
|
- KMPreferenceManager.shared.markupFontTextType = index
|
|
|
+ KMPreferenceManager.shared.markupFontTextString = self.fontNames[index]
|
|
|
} else if (self.noteComboBox.isEqual(to: notification.object)) {
|
|
|
var index = self.noteComboBox.indexOfSelectedItem
|
|
|
if (index < 0) {
|