Browse Source

【偏好设置】KMNotesPreferences调式UI

tangchao 1 year ago
parent
commit
76e6f69432

+ 16 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -436,5 +436,21 @@
             landmarkType = "24">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "071F2A72-5E2C-4C2E-B5EB-2FCEDE57E6F3"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/Preference/View/KMLineWell.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "209"
+            endingLineNumber = "209"
+            landmarkName = "encode(with:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 11 - 0
PDF Office/PDF Master/Class/Common/Category/NSObject+KMExtension.swift

@@ -284,6 +284,17 @@ func KMShiftAndResizeView(_ view: NSView, dx: CGFloat, dw: CGFloat) {
     view.frame = frame
 }
 
+func KMDrawTextFieldBezel(_ rect: NSRect, _ controlView: NSView) {
+    let cell = NSTextFieldCell(textCell: "")
+    cell.isBezeled = true
+    
+    NSColor.controlColor.setFill()
+//    NSRectFill(rect);
+    rect.fill()
+    cell.draw(withFrame: rect, in: controlView)
+    cell.controlView = nil
+}
+
 
 // MARK: - CGContext 相关
 

+ 17 - 32
PDF Office/PDF Master/Class/Preference/Controller/KMNotesPreferences.swift

@@ -22,15 +22,18 @@ class KMNotesPreferences: NSViewController {
         NSArray *lineWells1;
         NSArray *lineWells2;
     }
-
-    // fontWells
-    @property (nonatomic, retain) IBOutlet NSArray *labels1, *colorLabels2, *colorLabels3, *lineLabels2, *colorWells1, *colorWells2, *colorWells3, *lineWells1, *lineWells2;
-
     */
     
     @IBOutlet var fontWell1: KMFontWell!
     @IBOutlet var fontWell2: KMFontWell!
     
+    @IBOutlet weak var lineWells1_1: KMLineWell!
+    @IBOutlet weak var lineWells1_2: KMLineWell!
+    @IBOutlet weak var lineWells1_3: KMLineWell!
+    
+    @IBOutlet weak var lineWells2_1: KMLineWell!
+    @IBOutlet weak var lineWells2_2: KMLineWell!
+    
     override var nibName: NSNib.Name? {
         return "NotesPreferences"
     }
@@ -89,18 +92,23 @@ class KMNotesPreferences: NSViewController {
 //        [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteLineStyleKey) options:nil];
 //        [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteDashPatternKey) options:nil];
 //        [lineWell setDisplayStyle:SKLineWellDisplayStyleRectangle];
+        self.lineWells1_1.lineWidth = 0
 //
 //        lineWell = [lineWells2 objectAtIndex:0];
 //        [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteLineWidthKey) options:nil];
 //        [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteLineStyleKey) options:nil];
 //        [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.circleNoteDashPatternKey) options:nil];
 //        [lineWell setDisplayStyle:SKLineWellDisplayStyleOval];
+        self.lineWells2_1.displayStyle = .oval
+        self.lineWells2_1.lineWidth = 2
 //
 //        lineWell = [lineWells2 objectAtIndex:1];
 //        [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteLineWidthKey) options:nil];
 //        [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteLineStyleKey) options:nil];
 //        [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.squareNoteDashPatternKey) options:nil];
 //        [lineWell setDisplayStyle:SKLineWellDisplayStyleRectangle];
+        self.lineWells2_2.displayStyle = .rectangle
+        self.lineWells2_2.lineWidth = 2
 //
 //        lineWell = [lineWells1 objectAtIndex:1];
 //        [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteLineWidthKey) options:nil];
@@ -108,46 +116,23 @@ class KMNotesPreferences: NSViewController {
 //        [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteDashPatternKey) options:nil];
 //        [lineWell bind:SKLineWellStartLineStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteStartLineStyleKey) options:nil];
 //        [lineWell bind:SKLineWellEndLineStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.lineNoteEndLineStyleKey) options:nil];
+        self.lineWells1_2.displayStyle = .line
+        self.lineWells1_2.lineWidth = 2
+        self.lineWells1_2.endLineStyle = .openArrow
 //
 //        lineWell = [lineWells1 objectAtIndex:2];
 //        [lineWell bind:SKLineWellLineWidthKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteLineWidthKey) options:nil];
 //        [lineWell bind:SKLineWellStyleKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteLineStyleKey) options:nil];
 //        [lineWell bind:SKLineWellDashPatternKey toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.inkNoteDashPatternKey) options:nil];
 //        [lineWell setDisplayStyle:SKLineWellDisplayStyleSimpleLine];
+        self.lineWells1_3.displayStyle = .simpleLine
+        self.lineWells1_3.lineWidth = 2
         
 //    let fontWell = self.fontWell1
 //        NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:NSUnarchiveFromDataTransformerName, NSValueTransformerNameBindingOption, nil];
 //        [fontWell setHasTextColor:YES];
 //        [fontWell bind:@"textColor" toObject:sudc withKeyPath:VALUES_KEY_PATH(SKStringConstants.freeTextNoteFontColorKey) options:options];
     }
-    
-    /*
-     @implementation SKNotesPreferences
-
-     @synthesize labels1, colorLabels2, colorLabels3, lineLabels2, colorWells1, colorWells2, colorWells3, lineWells1, lineWells2;
-
-     - (void)dealloc {
-     //    SKDESTROY(labels1);
-     //    SKDESTROY(colorLabels2);
-     //    SKDESTROY(colorLabels3);
-     //    SKDESTROY(lineLabels2);
-     //    SKDESTROY(colorWells1);
-     //    SKDESTROY(colorWells2);
-     //    SKDESTROY(colorWells3);
-     //    SKDESTROY(fontWells);
-     //    SKDESTROY(lineWells1);
-     //    SKDESTROY(lineWells2);
-     //    [super dealloc];
-     }
-
-     - (NSString *)nibName {
-         return @"";
-     }
-
-
-
-     */
-    
 }
 
 extension KMNotesPreferences: KMPreferencePane {

+ 7 - 13
PDF Office/PDF Master/Class/Preference/Controller/NotesPreferences.xib

@@ -18,7 +18,12 @@
                 <outlet property="labels1" destination="179" id="256"/>
                 <outlet property="lineLabels2" destination="177" id="178"/>
                 <outlet property="lineWells1" destination="207" id="250"/>
+                <outlet property="lineWells1_1" destination="23" id="GeP-cl-1jV"/>
+                <outlet property="lineWells1_2" destination="25" id="gkJ-Ks-DdN"/>
+                <outlet property="lineWells1_3" destination="27" id="yhh-8h-4M1"/>
                 <outlet property="lineWells2" destination="208" id="251"/>
+                <outlet property="lineWells2_1" destination="29" id="NPy-Xh-Hpp"/>
+                <outlet property="lineWells2_2" destination="31" id="F2f-7g-oY9"/>
                 <outlet property="view" destination="1" id="112"/>
             </connections>
         </customObject>
@@ -546,19 +551,8 @@
             </connections>
         </customObject>
         <customObject id="206" userLabel="Font Wells" customClass="SKIBArray" customModule="PDF_Master" customModuleProvider="target"/>
-        <customObject id="207" userLabel="Line Wells 1" customClass="SKIBArray">
-            <connections>
-                <outlet property="object1" destination="23" id="241"/>
-                <outlet property="object2" destination="25" id="242"/>
-                <outlet property="object3" destination="27" id="243"/>
-            </connections>
-        </customObject>
-        <customObject id="208" userLabel="Line Wells 2" customClass="SKIBArray">
-            <connections>
-                <outlet property="object1" destination="29" id="244"/>
-                <outlet property="object2" destination="31" id="245"/>
-            </connections>
-        </customObject>
+        <customObject id="207" userLabel="Line Wells 1" customClass="SKIBArray"/>
+        <customObject id="208" userLabel="Line Wells 2" customClass="SKIBArray"/>
     </objects>
     <resources>
         <image name="TextAlignCenter" width="128" height="128"/>

+ 1 - 1
PDF Office/PDF Master/Class/Preference/View/KMFontWell.swift

@@ -59,7 +59,7 @@ class KMFontWellCell: NSButtonCell {
     }
     
     override func drawBezel(withFrame frame: NSRect, in controlView: NSView) {
-        //    SKDrawTextFieldBezel(frame, controlView);
+        KMDrawTextFieldBezel(frame, controlView)
         if (self.state == .on) {
             NSGraphicsContext.saveGraphicsState()
             NSColor.selectedControlColor.setFill()

+ 3 - 6
PDF Office/PDF Master/Class/Preference/View/KMLineWell.swift

@@ -38,7 +38,7 @@ class KMLineWell: NSControl {
     public static let startLineStyleKey = SKLineWellStartLineStyleKey
     public static let endLineStyleKey = SKLineWellEndLineStyleKey
     
-    private var _lineWidth: CGFloat = 0
+    private var _lineWidth: CGFloat = 2
     var lineWidth: CGFloat {
         get {
             return self._lineWidth
@@ -243,7 +243,7 @@ class KMLineWell: NSControl {
 
         let bounds = self.bounds
         
-    //    SKDrawTextFieldBezel(bounds, self);
+        KMDrawTextFieldBezel(bounds, self)
         
         if (self.isActive) {
             NSGraphicsContext.saveGraphicsState()
@@ -624,9 +624,6 @@ extension KMLineWell {
     //    CGFloat scale = [self backingScale];
         let scale = 1.0
         
-//        let image = [NSImage bitmapImageWithSize: scale:scale drawingHandler:^(NSRect rect){
-//
-//        }];
         let image =  NSImage.bitmapImage(with: bounds.size, scale: scale) { rect in
             KMContextSetAlpha(NSGraphicsContext.current?.cgContext, 0.7)
             NSColor.darkGray.setFill()
@@ -642,7 +639,7 @@ extension KMLineWell {
     
     private func _path() -> NSBezierPath {
         let path = NSBezierPath()
-        var bounds = self.bounds
+        let bounds = self.bounds
         
         if self.displayStyle == .line {
             let offset = 0.5 * lineWidth - floor(0.5 * lineWidth)