Kaynağa Gözat

【偏好设置】批注模块处理多语和UI

tangchao 1 yıl önce
ebeveyn
işleme
01d7079bb9

+ 100 - 21
PDF Office/PDF Master/Class/Preference/Controller/KMNotesPreferences.swift

@@ -92,35 +92,90 @@ class KMNotesPreferences: NSViewController {
     override func loadView() {
         super.loadView()
         
-//        NSMutableArray * = [NSMutableArray array];
-        var controls: [NSView] = []
-//        CGFloat , dw1, dw2;
+        var controls: [NSControl] = []
         var dw: CGFloat = 0
         var dw1: CGFloat = 0
         var dw2: CGFloat = 0
         
-//        [controls addObjectsFromArray:colorWells3];
-    //    dw = SKAutoSizeLabelFields(colorLabels3, controls, NO);
-        
-//        [controls addObjectsFromArray:colorWells2];
-//        [controls addObjectsFromArray:colorLabels3];
-    //    dw += SKAutoSizeLabelFields(colorLabels2, controls, NO);
+        for view in [self.highlightColorWell, self.underlineColorWell, self.strikeThroughColorWell, self.freehandLineWell] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        var colorLabels3: [NSTextField] = []
+        for view in [self.highlightLabel, self.underlineLabel, self.strikeThroughLabel, self.freehandLabel] {
+            if let data = view {
+                colorLabels3.append(data)
+            }
+        }
+        dw = KMAutoSizeLabelFields(colorLabels3, controls, false)
         
-//        [controls addObjectsFromArray:colorWells1];
-//        [controls addObjectsFromArray:colorLabels2];
-    //    [controls addObjectsFromArray:fontWells];
-//    [controls addObject:self.fontWell1];
-//    [controls addObject:self.fontWell2];
-//        [controls addObjectsFromArray:lineWells1];
-    //    dw += dw1 = SKAutoSizeLabelFields(labels1, controls, NO);
+        for view in [self.circleColorWell, self.circleInteriorColorWell, self.rectColorWell, self.rectInteriorColorWell] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        for view in [self.highlightLabel, self.underlineLabel, self.strikeThroughLabel, self.freehandLabel] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
         
-    //    dw2 = SKAutoSizeLabelFields(lineLabels2, lineWells2, NO);
+        var colorLabels2: [NSTextField] = []
+        for view in [self.circleLabel, self.circleInteriorLabel, self.rectLabel, self.rectInteriorLabel] {
+            if let data = view {
+                colorLabels2.append(data)
+            }
+        }
+        dw += KMAutoSizeLabelFields(colorLabels2, controls, false)
         
-    //    SKShiftAndResizeViews(fontWells, 0.0, dw - dw1);
+        for view in [self.textLineWell, self.anchoredColorWell, self.lineLineWell, self.lineInteriorColorWell] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        for view in [self.circleLabel, self.circleInteriorLabel, self.rectLabel, self.rectInteriorLabel] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        for view in [self.fontWell1, self.fontWell2] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        for view in [self.textLineWell, self.lineLineWell, self.freehandLineWell] {
+            if let data = view {
+                controls.append(data)
+            }
+        }
+        var labels1: [NSTextField] = []
+        for view in [self.textLabel, self.anchoredLabel, self.lineLabel, self.lineInteriorLabel, self.textFontLabel, self.anchoredFontLabel, self.lbTextLabel, self.ibLineLabel, self.ibFreehandLabel] {
+            if let data = view {
+                labels1.append(data)
+            }
+        }
+
+        dw1 = KMAutoSizeLabelFields(labels1, controls, false)
+        dw += dw1
         
-    //    SKShiftAndResizeViews([lineLabels2 arrayByAddingObjectsFromArray:lineWells2], dw - dw2, 0.0);
+        var lineLabels2: [NSTextField] = []
+        for view in [self.ibCircleLabel, self.ibRectLabel] {
+            if let data = view {
+                lineLabels2.append(data)
+            }
+        }
+        var lineWells2: [NSControl] = []
+        for view in [self.circleLineWell, self.rectLineWell] {
+            if let data = view {
+                lineWells2.append(data)
+            }
+        }
+        dw2 = KMAutoSizeLabelFields(lineLabels2, lineWells2, false)
         
-    //    SKShiftAndResizeView([self view], 0.0, dw);
+        KMShiftAndResizeViews([self.fontWell1, self.fontWell2], dx: 0.0, dw: dw - dw1)
+        KMShiftAndResizeViews([self.ibCircleLabel, self.ibRectLabel, self.circleLineWell, self.rectLineWell], dx: dw - dw2, dw: 0.0)
+        KMShiftAndResizeView(self.view, dx: 0.0, dw: dw)
         
 //        NSUserDefaultsController *sudc = [NSUserDefaultsController sharedUserDefaultsController];
         
@@ -173,7 +228,31 @@ class KMNotesPreferences: NSViewController {
     
     override func viewDidLoad() {
         super.viewDidLoad()
-        // Do view setup here.
+        
+        self.noteLabel.stringValue = NSLocalizedString("Note colors:", comment: "")
+        self.textLabel.stringValue = NSLocalizedString("Text:", comment: "")
+        self.anchoredLabel.stringValue = NSLocalizedString("Anchored:", comment: "")
+        self.lineLabel.stringValue = NSLocalizedString("Line:", comment: "")
+        self.lineInteriorLabel.stringValue = NSLocalizedString("Line interior:", comment: "")
+        self.circleLabel.stringValue = NSLocalizedString("Circle:", comment: "")
+        self.circleInteriorLabel.stringValue = NSLocalizedString("Circle interior:", comment: "")
+        self.rectLabel.stringValue = NSLocalizedString("Rect:", comment: "")
+        self.rectInteriorLabel.stringValue = NSLocalizedString("Rect interior:", comment: "")
+        self.highlightLabel.stringValue = NSLocalizedString("Highlight:", comment: "")
+        self.underlineLabel.stringValue = NSLocalizedString("Underline:", comment: "")
+        self.strikeThroughLabel.stringValue = NSLocalizedString("Strikethrough:", comment: "")
+        self.freehandLabel.stringValue = NSLocalizedString("Freehand:", comment: "")
+        
+        self.fontLabel.stringValue = NSLocalizedString("Note fonts:", comment: "")
+        self.textFontLabel.stringValue = NSLocalizedString("Text:", comment: "")
+        self.anchoredFontLabel.stringValue = NSLocalizedString("Anchored:", comment: "")
+        
+        self.lineAndBorderLabel.stringValue = NSLocalizedString("Note lines and borders:", comment: "")
+        self.lbTextLabel.stringValue = NSLocalizedString("Text:", comment: "")
+        self.ibLineLabel.stringValue = NSLocalizedString("Line:", comment: "")
+        self.ibFreehandLabel.stringValue = NSLocalizedString("Freehand:", comment: "")
+        self.ibCircleLabel.stringValue = NSLocalizedString("Circle:", comment: "")
+        self.ibRectLabel.stringValue = NSLocalizedString("Rect:", comment: "")
     }
 }