Revision: 16340
http://sourceforge.net/p/skim-app/code/16340
Author: hofman
Date: 2026-06-01 16:48:24 +0000 (Mon, 01 Jun 2026)
Log Message:
-----------
don't use cconvenience method to create skim notes from a selection
Modified Paths:
--------------
trunk/PDFAnnotation_SKExtensions.h
trunk/PDFAnnotation_SKExtensions.m
trunk/PDFPage_SKExtensions.m
trunk/SKPDFView.m
Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h 2026-06-01 16:32:36 UTC (rev 16339)
+++ trunk/PDFAnnotation_SKExtensions.h 2026-06-01 16:48:24 UTC (rev 16340)
@@ -63,10 +63,8 @@
+ (nullable PDFAnnotation *)newSkimNoteWithPaths:(NSArray<NSBezierPath *>
*)paths;
-+ (nullable PDFAnnotation *)newSkimNoteWithSelection:(PDFSelection *)selection
forType:(NSString *)type;
++ (nullable PDFAnnotation *)newSkimNoteWithSelection:(PDFSelection *)selection
forPage:(nullable PDFPage *)page forType:(NSString *)type;
-+ (nullable NSArray<NSArray *> *)SkimNotesAndPagesWithSelection:(PDFSelection
*)selection forType:(NSString *)type;
-
+ (NSDictionary<NSString *, id>
*)normalizedSkimNoteProperties:(NSDictionary<NSString *, id> *)properties;
@property (nonatomic, nullable, readonly) NSString *fdfString;
Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m 2026-06-01 16:32:36 UTC (rev 16339)
+++ trunk/PDFAnnotation_SKExtensions.m 2026-06-01 16:48:24 UTC (rev 16340)
@@ -144,9 +144,10 @@
return annotation;
}
-+ (PDFAnnotation *)newSkimNoteWithSelection:(PDFSelection *)selection
forType:(NSString *)type {
- PDFPage *page = [selection safeFirstPage];
++ (PDFAnnotation *)newSkimNoteWithSelection:(PDFSelection *)selection
forPage:(PDFPage *)page forType:(NSString *)type {
if (page == nil)
+ page = [selection safeFirstPage];
+ if (page == nil)
return nil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -154,20 +155,6 @@
#pragma clang diagnostic pop
}
-+ (NSArray *)SkimNotesAndPagesWithSelection:(PDFSelection *)selection
forType:(NSString *)type {
- NSMutableArray *annotations = [NSMutableArray array];
- for (PDFPage *page in [selection pages]) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- PDFAnnotation *annotation = [[PDFAnnotationMarkup alloc]
initSkimNoteWithSelection:selection forPage:page forType:type];
-#pragma clang diagnostic pop
- if (annotation) {
- [annotations addObject:@[annotation, page]];
- }
- }
- return [annotations count] > 0 ? annotations : nil;
-}
-
+ (PDFAnnotation *)newSkimNoteWithPaths:(NSArray *)paths {
NSRect bounds = NSZeroRect;
NSAffineTransform *transform = [NSAffineTransform transform];
Modified: trunk/PDFPage_SKExtensions.m
===================================================================
--- trunk/PDFPage_SKExtensions.m 2026-06-01 16:32:36 UTC (rev 16339)
+++ trunk/PDFPage_SKExtensions.m 2026-06-01 16:48:24 UTC (rev 16340)
@@ -715,7 +715,7 @@
[[NSScriptCommand currentCommand]
setScriptErrorNumber:NSRequiredArgumentsMissingScriptError];
[[NSScriptCommand currentCommand] setScriptErrorString:@"New
markup notes need a selection."];
} else if (selection) {
- annotation = [PDFAnnotation newSkimNoteWithSelection:selection
forType:type];
+ annotation = [PDFAnnotation newSkimNoteWithSelection:selection
forPage:self forType:type];
if ([props
objectForKey:SKPDFAnnotationScriptingTextContentsKey] == nil &&
[[NSUserDefaults standardUserDefaults]
integerForKey:SKDisableUpdateContentsFromEnclosedTextKey] != 2)
[props setValue:[selection cleanedString]
forKey:SKPDFAnnotationScriptingTextContentsKey];
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2026-06-01 16:32:36 UTC (rev 16339)
+++ trunk/SKPDFView.m 2026-06-01 16:48:24 UTC (rev 16340)
@@ -2360,7 +2360,7 @@
string = string2;
}
- newAnnotation = [PDFAnnotation newSkimNoteWithSelection:sel
forType:type];
+ newAnnotation = [PDFAnnotation newSkimNoteWithSelection:sel
forPage:page forType:type];
if ([string length] > 0)
[newAnnotation setString:string];
} else if ([currentAnnotation isInk]) {
@@ -2404,15 +2404,18 @@
NSString *type = typeForNoteType(annotationType);
if (IS_MARKUP(annotationType)) {
- NSArray *newAnnotations = [PDFAnnotation
SkimNotesAndPagesWithSelection:selection forType:type];
- if ([newAnnotations count] == 0)
- return NO;
-
- for (NSArray *annotationAndPage in newAnnotations)
- [[annotationAndPage firstObject] setString:text ?: @""];
- [self addAnnotations:newAnnotations];
-
- return YES;
+ NSMutableArray *newAnnotations = [NSMutableArray array];
+ for (PDFPage *page in [selection pages]) {
+ PDFAnnotation *newAnnotation = [PDFAnnotation
newSkimNoteWithSelection:selection forPage:page forType:type];
+ if (newAnnotation) {
+ [newAnnotation setString:text ?: @""];
+ [newAnnotations addObject:@[newAnnotation, page]];
+ }
+ }
+ if ([newAnnotations count] > 0) {
+ [self addAnnotations:newAnnotations];
+ return YES;
+ }
} else if (annotationType != SKNoteTypeInk) {
// we need a drawn path to add an ink note
PDFAnnotation *newAnnotation = [PDFAnnotation
newSkimNoteWithBounds:bounds forType:type];
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