Revision: 15412
http://sourceforge.net/p/skim-app/code/15412
Author: hofman
Date: 2025-06-08 14:52:55 +0000 (Sun, 08 Jun 2025)
Log Message:
-----------
Check defaults before using autoUpdateStringForrPage:
Modified Paths:
--------------
trunk/PDFAnnotationCircle_SKExtensions.m
trunk/PDFAnnotationMarkup_SKExtensions.m
trunk/PDFAnnotationSquare_SKExtensions.m
trunk/PDFAnnotation_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKPDFView.m
Modified: trunk/PDFAnnotationCircle_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationCircle_SKExtensions.m 2025-06-08 14:42:15 UTC (rev
15411)
+++ trunk/PDFAnnotationCircle_SKExtensions.m 2025-06-08 14:52:55 UTC (rev
15412)
@@ -103,9 +103,12 @@
return dx * dx + dy * dy >= 1.0;
}
+- (void)autoUpdateString {
+ if (NO == [[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey] && [self page])
+ [self autoUpdateStringWithPage:[self page]];
+}
+
- (void)autoUpdateStringWithPage:(PDFPage *)page {
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey] || page == nil)
- return;
// this calculation is roughly the inverse of -[PDFView
addAnnotationWithType:context:]
NSRect bounds = NSInsetRect([self bounds], [self lineWidth] - 1.0, [self
lineWidth] - 1.0);
CGFloat t, w = NSWidth(bounds), h = NSWidth(bounds);
Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m 2025-06-08 14:42:15 UTC (rev
15411)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m 2025-06-08 14:52:55 UTC (rev
15412)
@@ -300,8 +300,6 @@
}
- (void)autoUpdateStringWithPage:(PDFPage *)page {
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey])
- return;
NSString *selString = [[self selectionWithPage:page] cleanedString];
if ([selString length])
[self setString:selString];
Modified: trunk/PDFAnnotationSquare_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationSquare_SKExtensions.m 2025-06-08 14:42:15 UTC (rev
15411)
+++ trunk/PDFAnnotationSquare_SKExtensions.m 2025-06-08 14:52:55 UTC (rev
15412)
@@ -93,9 +93,12 @@
return NSWidth(bounds) <= 2.0 * delta || NSHeight(bounds) <= 2.0 * delta
|| NSPointInRect(point, NSInsetRect(bounds, delta, delta)) == NO;
}
+- (void)autoUpdateString {
+ if (NO == [[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey] && [self page])
+ [self autoUpdateStringWithPage:[self page]];
+}
+
- (void)autoUpdateStringWithPage:(PDFPage *)page {
- if ([[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey] || page == nil)
- return;
NSRect bounds = NSInsetRect([self bounds], [self lineWidth] - 1.0, [self
lineWidth] - 1.0);
if (NSWidth(bounds) <= 0.0 || NSHeight(bounds) <= 0.0)
return;
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2025-06-08 14:42:15 UTC (rev 15411)
+++ trunk/PDFAnnotation_SKExtensions.m 2025-06-08 14:52:55 UTC (rev 15412)
@@ -505,7 +505,8 @@
[self setModificationDate:[NSDate date]];
}
-- (void)autoUpdateString { if ([self page]) [self
autoUpdateStringWithPage:[self page]]; }
+- (void)autoUpdateString {}
+
- (void)autoUpdateStringWithPage:(PDFPage *)page {}
- (NSString *)colorDefaultKey { return nil; }
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2025-06-08 14:42:15 UTC (rev 15411)
+++ trunk/SKMainWindowController.m 2025-06-08 14:52:55 UTC (rev 15412)
@@ -1062,7 +1062,8 @@
}
- (void)addConvertedAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove {
- NSArray *notesAndPagesToAdd = [self
annotationsAndPagesFromDictionaries:noteDicts forDocument:[pdfView document]
autoUpdate:YES widgetDictionaries:nil];
+ BOOL autoUpdate = NO == [[NSUserDefaults standardUserDefaults]
boolForKey:SKDisableUpdateContentsFromEnclosedTextKey];
+ NSArray *notesAndPagesToAdd = [self
annotationsAndPagesFromDictionaries:noteDicts forDocument:[pdfView document]
autoUpdate:autoUpdate widgetDictionaries:nil];
[self addAnnotations:notesAndPagesToAdd removeAnnotations:notesToRemove];
}
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2025-06-08 14:42:15 UTC (rev 15411)
+++ trunk/SKPDFView.m 2025-06-08 14:52:55 UTC (rev 15412)
@@ -2394,7 +2394,8 @@
- (BOOL)addAnnotationWithType:(SKNoteType)annotationType
selection:(PDFSelection *)selection page:(PDFPage *)page bounds:(NSRect)bounds {
PDFAnnotation *newAnnotation = nil;
NSArray *newAnnotations = nil;
- NSString *text = [selection cleanedString];
+ NSInteger disableUpdateString = [[NSUserDefaults standardUserDefaults]
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey];
+ NSString *text = disableUpdateString > 1 ? nil : [selection cleanedString];
BOOL isInitial = NSEqualSizes(bounds.size, NSZeroSize) && selection == nil;
// new note added by note tool mode, don't add actual zero sized notes
@@ -2401,9 +2402,6 @@
if (isInitial)
bounds = annotationType == SKNoteTypeAnchored ?
SKRectFromCenterAndSize(bounds.origin, SKNPDFAnnotationNoteSize) :
SKRectFromCenterAndSquareSize(bounds.origin, MIN_NOTE_SIZE);
- if ([[NSUserDefaults standardUserDefaults]
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey] > 1)
- text = nil;
-
// Create annotation and add to page.
NSString *type = nil;
BOOL isMarkup = NO;
@@ -2474,7 +2472,7 @@
if (annotationType != SKNoteTypeLine && annotationType !=
SKNoteTypeInk) {
if ([text length] > 0)
[newAnnotation setString:text];
- else if (isInitial == NO)
+ else if (isInitial == NO && disableUpdateString == 0)
[newAnnotation autoUpdateStringWithPage:page];
}
if ([newAnnotation string] == nil)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit