Переглянути джерело

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

tangchao 6 місяців тому
батько
коміт
a3cc9f8cf7

+ 7 - 7
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFKitExtensions/CPDFAnnotationExtensions/CPDFAnnotationModel.m

@@ -1775,22 +1775,22 @@
         NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
         switch (_annotationType) {
             case CAnnotationTypeTextField:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationTextWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationTextWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeRadioButton:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationRadioButtonWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationRadioButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             case CAnnotationTypeCheckBox:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationCheckBoxWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationCheckBoxWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             case CAnnotationTypeComboBox:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeListMenu:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationChoiceListWidgetBackgroundColorKey] ? : NSColor.grayColor;
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationChoiceListWidgetBackgroundColorKey] ? : NSColor.clearColor;
                 break;
             case CAnnotationTypeActionButton:
-                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey];
+                backgroundColor = [userDefaults PDFListViewColorForKey:CAnnotationActionButtonWidgetBackgroundColorKey] ? : NSColor.clearColor;;
                 break;
             default:
                 break;
@@ -1800,7 +1800,7 @@
         CGFloat red,green,blue,alpha;
         [[backgroundColor colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red green:&green blue:&blue alpha:&alpha];
         if ((fabs(alpha - 0) < 0.001)) {
-            backgroundColor = nil;
+            backgroundColor = [NSColor clearColor];
         }
     }
     return backgroundColor;

+ 8 - 1
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListView.m

@@ -439,7 +439,14 @@ NSNotificationName const KMPDFViewTableAnnotationDidChangeNotification = @"KMPDF
 
 - (void)setCurrentSelection:(CPDFSelection *)currentSelection {
     if (self.toolMode == CNoteToolMode && self.annotationType == CAnnotationTypeHighlight) {
-        [currentSelection setColor:[[NSUserDefaults standardUserDefaults] colorForKey:CHighlightNoteColorKey]];
+        NSColor *color = [[NSUserDefaults standardUserDefaults] colorForKey:CHighlightNoteColorKey];
+        CGFloat red = 0, green = 0, blue = 0, alpha = 0.7;
+        [[color colorUsingColorSpaceName:NSCalibratedRGBColorSpace] getRed:&red
+                                                                     green:&green
+                                                                      blue:&blue
+                                                                     alpha:nil];
+        
+        [currentSelection setColor:[NSColor colorWithRed:red green:green blue:blue alpha:alpha]/*[[NSUserDefaults standardUserDefaults] colorForKey:CHighlightNoteColorKey]*/];
     }
     if (currentSelection == nil) {
 //        selection = [[[PDFSelection alloc] initWithDocument:[self document]] autorelease];

+ 2 - 0
PDF Office/PDF Master/Class/PDFWindowController/PDFListView/CPDFListViewExtension/CPDFListView+Event.m

@@ -3655,8 +3655,10 @@ static inline CPDFAreaOfInterest CAreaOfInterestForResizeHandle(CRectEdges mask,
             NSColor* backgroundColor = [sud colorForKey:CAnnotationTextWidgetBackgroundColorKey];
             if (backgroundColor) {
                 textWidget.backgroundColor = backgroundColor;
+                textWidget.backgroundOpacity = 1;
             } else {
                 textWidget.backgroundColor = [NSColor clearColor];
+                textWidget.backgroundOpacity = 0;
             }
             
             NSColor* fontColor = [sud colorForKey:CAnnotationTextWidgetFontColorKey];

+ 8 - 2
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/AnnotationProperty/ViewController/FormProperties/KMAnnotationFromViewController.swift

@@ -405,12 +405,18 @@ import Cocoa
     }
 
     @IBAction func fillColorPickerViewAction(_ sender: Any) {
+        let color = fillColorPickerView.color
         if annotations.count > 0 {
             for tAnnotation in annotations {
-                tAnnotation.backgroundColor = fillColorPickerView.color
+                tAnnotation.backgroundColor = color
+                if color == NSColor.clear {
+                    tAnnotation.backgroundOpacity = 0
+                } else {
+                    tAnnotation.backgroundOpacity = 1
+                }
             }
         } else {
-            annotationModel.setBackgroundColor(fillColorPickerView.color)
+            annotationModel.setBackgroundColor(color)
             updateAnnotationMode()
         }
         updateAnnotation()