Revision: 15395
http://sourceforge.net/p/skim-app/code/15395
Author: hofman
Date: 2025-06-07 09:16:04 +0000 (Sat, 07 Jun 2025)
Log Message:
-----------
add or remove popup annotation implicitly when adding or removing parent, don't
register popups in undo as they can be added implicitly by PDFKKit
Modified Paths:
--------------
trunk/PDFDocument_SKExtensions.m
trunk/SKMainWindowController.m
trunk/SKSnapshotWindowController.m
Modified: trunk/PDFDocument_SKExtensions.m
===================================================================
--- trunk/PDFDocument_SKExtensions.m 2025-06-06 22:28:49 UTC (rev 15394)
+++ trunk/PDFDocument_SKExtensions.m 2025-06-07 09:16:04 UTC (rev 15395)
@@ -300,16 +300,22 @@
- (NSArray *)detectedWidgets { return nil; }
- (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page {
+ PDFAnnotation *popup = [annotation popup];
NSDictionary *userInfo = @{SKPDFDocumentAnnotationKey:annotation,
SKPDFDocumentPageKey:page};
[page addAnnotation:annotation];
+ if (popup && [popup page] == nil)
+ [page addAnnotation:popup];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFDocumentDidAddAnnotationNotification object:self
userInfo:userInfo];
}
- (void)removeAnnotation:(PDFAnnotation *)annotation {
PDFPage *page = [annotation page];
+ PDFAnnotation *popup = [annotation popup];
NSDictionary *userInfo = @{SKPDFDocumentAnnotationKey:annotation,
SKPDFDocumentPageKey:page};
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFDocumentWillRemoveAnnotationNotification object:self
userInfo:userInfo];
[page removeAnnotation:annotation];
+ if (popup && [popup page])
+ [page removeAnnotation:popup];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFDocumentDidRemoveAnnotationNotification object:self
userInfo:userInfo];
}
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2025-06-06 22:28:49 UTC (rev 15394)
+++ trunk/SKMainWindowController.m 2025-06-07 09:16:04 UTC (rev 15395)
@@ -1018,9 +1018,6 @@
mwcFlags.addOrRemoveNotesInBulk = 1;
for (PDFAnnotation *annotation in [notesToRemove copy]) {
[pageIndexes addIndex:[annotation pageIndex]];
- PDFAnnotation *popup = [annotation popup];
- if ([popup page])
- [pdfDoc removeAnnotation:popup];
[pdfDoc removeAnnotation:annotation];
}
mwcFlags.addOrRemoveNotesInBulk = 0;
Modified: trunk/SKSnapshotWindowController.m
===================================================================
--- trunk/SKSnapshotWindowController.m 2025-06-06 22:28:49 UTC (rev 15394)
+++ trunk/SKSnapshotWindowController.m 2025-06-07 09:16:04 UTC (rev 15395)
@@ -187,17 +187,25 @@
}
- (void)handleDidAddAnnotationNotification:(NSNotification *)notification {
- PDFAnnotation *annotation = [[notification userInfo]
objectForKey:SKPDFDocumentAnnotationKey];
PDFPage *page = [[notification userInfo]
objectForKey:SKPDFDocumentPageKey];
- if ([self isPageVisible:page])
+ if ([self isPageVisible:page]) {
+ PDFAnnotation *annotation = [[notification userInfo]
objectForKey:SKPDFDocumentAnnotationKey];
+ PDFAnnotation *popup = [annotation popup];
[pdfView addedAnnotation:annotation onPage:page];
+ if (popup)
+ [pdfView addedAnnotation:popup onPage:page];
+ }
}
- (void)handleDidRemoveAnnotationNotification:(NSNotification *)notification {
- PDFAnnotation *annotation = [[notification userInfo]
objectForKey:SKPDFDocumentAnnotationKey];
PDFPage *page = [[notification userInfo]
objectForKey:SKPDFDocumentPageKey];
- if ([self isPageVisible:page])
+ if ([self isPageVisible:page]) {
+ PDFAnnotation *annotation = [[notification userInfo]
objectForKey:SKPDFDocumentAnnotationKey];
+ PDFAnnotation *popup = [annotation popup];
[pdfView removedAnnotation:annotation onPage:page];
+ if (popup)
+ [pdfView removedAnnotation:popup onPage:page];
+ }
}
- (void)handleDidMoveAnnotationNotification:(NSNotification *)notification {
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