Revision: 15407
http://sourceforge.net/p/skim-app/code/15407
Author: hofman
Date: 2025-06-08 08:57:19 +0000 (Sun, 08 Jun 2025)
Log Message:
-----------
pass whether to replace existing notes rather than notes
Modified Paths:
--------------
trunk/SKMainDocument.m
trunk/SKMainWindowController.h
trunk/SKMainWindowController.m
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2025-06-08 08:46:45 UTC (rev 15406)
+++ trunk/SKMainDocument.m 2025-06-08 08:57:19 UTC (rev 15407)
@@ -1104,7 +1104,7 @@
}
if (array) {
- [[self mainWindowController] addAnnotationsFromDictionaries:array
removeAnnotations:replace ? [self notes] : nil];
+ [[self mainWindowController] addAnnotationsFromDictionaries:array
replacing:replace];
[[self undoManager] setActionName:replace ?
NSLocalizedString(@"Replace Notes", @"Undo action name") :
NSLocalizedString(@"Add Notes", @"Undo action name")];
} else
NSBeep();
Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h 2025-06-08 08:46:45 UTC (rev 15406)
+++ trunk/SKMainWindowController.h 2025-06-08 08:57:19 UTC (rev 15407)
@@ -317,7 +317,7 @@
- (void)allSnapshotsNeedUpdate;
- (void)setPdfDocument:(nullable PDFDocument *)pdfDocument
addAnnotationsFromDictionaries:(nullable NSArray<NSDictionary<NSString *, id>
*> *)noteDicts;
-- (void)addAnnotationsFromDictionaries:(NSArray<NSDictionary<NSString *, id>
*> *)noteDicts removeAnnotations:(nullable NSArray<PDFAnnotation *>
*)notesToRemove;
+- (void)addAnnotationsFromDictionaries:(NSArray<NSDictionary<NSString *, id>
*> *)noteDicts replacing:(BOOL)replacing;
- (void)addConvertedAnnotationsFromDictionaries:(NSArray<NSDictionary<NSString
*, id> *> *)noteDicts removeAnnotations:(nullable NSArray<PDFAnnotation *>
*)notesToRemove;
- (void)applySetup:(NSDictionary<NSString *, id> *)setup;
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2025-06-08 08:46:45 UTC (rev 15406)
+++ trunk/SKMainWindowController.m 2025-06-08 08:57:19 UTC (rev 15407)
@@ -1038,17 +1038,17 @@
return notesAndPagesToAdd;
}
-- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove {
+- (void)addAnnotationsFromDictionaries:(NSArray *)noteDicts
replacing:(BOOL)replacing {
NSMutableArray *widgetDicts = [NSMutableArray array];
NSArray *notesAndPagesToAdd = [self
annotationsAndPagesFromDictionaries:noteDicts forDocument:[pdfView document]
autoUpdate:NO widgetDictionaries:widgetDicts];
- if ([notesToRemove count]) {
+ if (replacing && [notes count]) {
[pdfView removePDFToolTipRects];
// remove the current annotations
[pdfView setCurrentAnnotation:nil];
}
- if (notesToRemove && [widgets count]) {
+ if (replacing && [widgets count]) {
for (PDFAnnotation *widget in widgets) {
id origValue = [widgetValues objectForKey:widget];
if ([([widget objectValue] ?: @"") isEqual:(origValue ?: @"")] ==
NO)
@@ -1058,7 +1058,7 @@
if ([widgetDicts count])
[self changeWidgetsFromDictionaries:widgetDicts];
- [self addAnnotations:notesAndPagesToAdd removeAnnotations:notesToRemove];
+ [self addAnnotations:notesAndPagesToAdd removeAnnotations:replacing ?
[self notes] : nil];
}
- (void)addConvertedAnnotationsFromDictionaries:(NSArray *)noteDicts
removeAnnotations:(NSArray *)notesToRemove {
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