Revision: 13255 http://sourceforge.net/p/skim-app/code/13255 Author: hofman Date: 2023-01-26 22:16:11 +0000 (Thu, 26 Jan 2023) Log Message: ----------- implicitly determine whether added notes from dicitonaries are converted
Modified Paths: -------------- trunk/SKMainDocument.m trunk/SKMainWindowController.h trunk/SKMainWindowController.m Modified: trunk/SKMainDocument.m =================================================================== --- trunk/SKMainDocument.m 2023-01-26 16:59:40 UTC (rev 13254) +++ trunk/SKMainDocument.m 2023-01-26 22:16:11 UTC (rev 13255) @@ -201,7 +201,7 @@ [[self mainWindowController] setPdfDocument:pdfDoc]; - [[self mainWindowController] addAnnotationsFromDictionaries:[tmpData noteDicts] removeAnnotations:[self notes] autoUpdate:NO]; + [[self mainWindowController] addAnnotationsFromDictionaries:[tmpData noteDicts] removeAnnotations:[self notes]]; if ([tmpData presentationOptions]) [[self mainWindowController] setPresentationOptions:[tmpData presentationOptions]]; @@ -1065,7 +1065,7 @@ } if (array) { - [[self mainWindowController] addAnnotationsFromDictionaries:array removeAnnotations:replace ? [self notes] : nil autoUpdate:NO]; + [[self mainWindowController] addAnnotationsFromDictionaries:array removeAnnotations:replace ? [self notes] : nil]; [[self undoManager] setActionName:replace ? NSLocalizedString(@"Replace Notes", @"Undo action name") : NSLocalizedString(@"Add Notes", @"Undo action name")]; } else NSBeep(); @@ -1183,7 +1183,7 @@ dispatch_async(dispatch_get_main_queue(), ^{ - [[self mainWindowController] addAnnotationsFromDictionaries:noteDicts removeAnnotations:annotations autoUpdate:YES]; + [[self mainWindowController] addAnnotationsFromDictionaries:noteDicts removeAnnotations:annotations]; [[self mainWindowController] registerWidgetValues]; Modified: trunk/SKMainWindowController.h =================================================================== --- trunk/SKMainWindowController.h 2023-01-26 16:59:40 UTC (rev 13254) +++ trunk/SKMainWindowController.h 2023-01-26 22:16:11 UTC (rev 13255) @@ -330,7 +330,7 @@ - (void)updateSnapshotsIfNeeded; - (void)updateSnapshot:(NSTimer *)timer; -- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts removeAnnotations:(NSArray *)notesToRemove autoUpdate:(BOOL)autoUpdate; +- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts removeAnnotations:(NSArray *)notesToRemove; - (void)registerWidgetValues; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2023-01-26 16:59:40 UTC (rev 13254) +++ trunk/SKMainWindowController.m 2023-01-26 22:16:11 UTC (rev 13255) @@ -1040,12 +1040,13 @@ return properties; } -- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts removeAnnotations:(NSArray *)notesToRemove autoUpdate:(BOOL)autoUpdate { +- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts removeAnnotations:(NSArray *)notesToRemove { PDFAnnotation *annotation; PDFDocument *pdfDoc = [pdfView document]; NSMutableArray *notesToAdd = [NSMutableArray array]; NSMutableArray *widgetProperties = [NSMutableArray array]; NSMutableIndexSet *pageIndexes = [NSMutableIndexSet indexSet]; + BOOL isConvert = [notesToRemove count] > 0 && [[notesToRemove firstObject] isSkimNote] == NO; if ([pdfDoc allowsNotes] == NO && [noteDicts count] > 0) { // there should not be any notesToRemove at this point @@ -1082,7 +1083,7 @@ if (removeAllNotes) [self removeAllObjectsFromNotes]; } - if (notesToRemove && autoUpdate == NO && widgets) { + if (notesToRemove && isConvert == NO && widgets) { for (PDFAnnotation *widget in widgets) { id origValue = [widgetValues objectForKey:widget]; if ([([widget objectValue] ?: @"") isEqual:(origValue ?: @"")] == NO) @@ -1104,7 +1105,7 @@ [pageIndexes addIndex:pageIndex]; PDFPage *page = [pdfDoc pageAtIndex:pageIndex]; [pdfView addAnnotation:annotation toPage:page]; - if (autoUpdate && [[annotation contents] length] == 0) + if (isConvert && [[annotation contents] length] == 0) [annotation autoUpdateString]; [notesToAdd addObject:annotation]; [annotation release]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit