Revision: 13625
http://sourceforge.net/p/skim-app/code/13625
Author: hofman
Date: 2023-09-01 14:57:38 +0000 (Fri, 01 Sep 2023)
Log Message:
-----------
add initial notes to pdfdocument before setting it in the pdfview
Modified Paths:
--------------
trunk/SKMainDocument.m
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2023-09-01 14:34:23 UTC (rev 13624)
+++ trunk/SKMainDocument.m 2023-09-01 14:57:38 UTC (rev 13625)
@@ -198,10 +198,8 @@
[self tryToUnlockDocument:pdfDoc];
- [[self mainWindowController] setPdfDocument:pdfDoc];
+ [[self mainWindowController] addAnnotationsFromDictionaries:[tmpData
noteDicts] removeAnnotations:[self notes] setDocument:pdfDoc];
- [[self mainWindowController] addAnnotationsFromDictionaries:[tmpData
noteDicts] removeAnnotations:[self notes]];
-
if ([tmpData presentationOptions])
[[self mainWindowController] setPresentationOptions:[tmpData
presentationOptions]];
@@ -1081,7 +1079,7 @@
}
if (array) {
- [[self mainWindowController] addAnnotationsFromDictionaries:array
removeAnnotations:replace ? [self notes] : nil];
+ [[self mainWindowController] addAnnotationsFromDictionaries:array
removeAnnotations:replace ? [self notes] : nil setDocument:nil];
[[self undoManager] setActionName:replace ?
NSLocalizedString(@"Replace Notes", @"Undo action name") :
NSLocalizedString(@"Add Notes", @"Undo action name")];
} else
NSBeep();
@@ -1199,7 +1197,7 @@
dispatch_async(dispatch_get_main_queue(), ^{
- [[self mainWindowController]
addAnnotationsFromDictionaries:noteDicts removeAnnotations:annotations];
+ [[self mainWindowController]
addAnnotationsFromDictionaries:noteDicts removeAnnotations:annotations
setDocument:nil];
[self setPDFData:data pageOffsets:offsets];
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2023-09-01 14:34:23 UTC (rev 13624)
+++ trunk/SKMainWindowController.h 2023-09-01 14:57:38 UTC (rev 13625)
@@ -335,7 +335,7 @@
- (void)updateSnapshotsIfNeeded;
- (void)updateSnapshot:(NSTimer *)timer;
-- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove;
+- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove setDocument:(PDFDocument
*)pdfDocument;
- (void)applySetup:(NSDictionary *)setup;
- (NSDictionary *)currentSetup;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2023-09-01 14:34:23 UTC (rev 13624)
+++ trunk/SKMainWindowController.m 2023-09-01 14:57:38 UTC (rev 13625)
@@ -1024,9 +1024,9 @@
return properties;
}
-- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove {
+- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove setDocument:(PDFDocument
*)pdfDocument {
PDFAnnotation *annotation;
- PDFDocument *pdfDoc = [pdfView document];
+ PDFDocument *pdfDoc = pdfDocument ?: [pdfView document];
NSMutableArray *notesToAdd = [NSMutableArray array];
NSMutableArray *widgetProperties = [NSMutableArray array];
NSMutableIndexSet *pageIndexes = [NSMutableIndexSet indexSet];
@@ -1101,7 +1101,10 @@
if ([notesToAdd count] > 0)
[self insertNotes:notesToAdd atIndexes:[NSIndexSet
indexSetWithIndexesInRange:NSMakeRange([notes count], [notesToAdd count])]];
- if ([[self pdfDocument] isLocked]) {
+ if (pdfDocument)
+ [self setPdfDocument:pdfDocument];
+
+ if ([[pdfView document] isLocked]) {
[placeholderWidgetProperties release];
placeholderWidgetProperties = [widgetProperties count] ?
[widgetProperties copy] : nil;
} else {
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