Revision: 16373
          http://sourceforge.net/p/skim-app/code/16373
Author:   hofman
Date:     2026-06-08 16:16:22 +0000 (Mon, 08 Jun 2026)
Log Message:
-----------
move pdfview updating for annotations to base pdfview class

Modified Paths:
--------------
    trunk/PDFView_SKExtensions.h
    trunk/PDFView_SKExtensions.m
    trunk/SKBasePDFView.h
    trunk/SKBasePDFView.m

Modified: trunk/PDFView_SKExtensions.h
===================================================================
--- trunk/PDFView_SKExtensions.h        2026-06-08 15:54:25 UTC (rev 16372)
+++ trunk/PDFView_SKExtensions.h        2026-06-08 16:16:22 UTC (rev 16373)
@@ -57,10 +57,6 @@
 - (BOOL)isPageAtIndexDisplayed:(NSUInteger)pageIndex;
 - (BOOL)isPageAtIndexesDisplayed:(NSIndexSet *)pageIndexes;
 
-- (void)updatedAnnotation:(PDFAnnotation *)annotation;
-- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page;
-- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page;
-
 - (void)doPdfsyncWithEvent:(NSEvent *)theEvent;
 - (void)doDragContentWithEvent:(NSEvent *)theEvent;
 - (BOOL)doDragSelectedTextWithEvent:(NSEvent *)theEvent;

Modified: trunk/PDFView_SKExtensions.m
===================================================================
--- trunk/PDFView_SKExtensions.m        2026-06-08 15:54:25 UTC (rev 16372)
+++ trunk/PDFView_SKExtensions.m        2026-06-08 16:16:22 UTC (rev 16373)
@@ -53,16 +53,6 @@
 
 const NSPoint SKUnspecifiedPoint = (NSPoint){FLT_MAX, FLT_MAX};
 
-@interface PDFView (SKPrivatePageViewDeclarations)
-- (id)pageViewForPageAtIndex:(NSUInteger)index;
-@end
-
-@interface NSView (SKPDFPageViewPrivateDeclarations)
-- (void)addAnnotation:(PDFAnnotation *)annotation;
-- (void)updateAnnotation:(PDFAnnotation *)annotation;
-- (void)removeAnnotation:(PDFAnnotation *)annotation;
-@end
-
 #define PAGE_BREAK_MARGIN 4.0
 
 @implementation PDFView (SKExtensions)
@@ -92,27 +82,6 @@
     return [self descendantOfClass:[NSScrollView class]];
 }
 
-- (NSView *)safePageViewForPage:(PDFPage *)page forSelector:(SEL)selector {
-    if ([self respondsToSelector:@selector(pageViewForPageAtIndex:)] == NO || 
[self isPageAtIndexDisplayed:[page pageIndex]] == NO)
-        return nil;
-    id pageView = [self pageViewForPageAtIndex:[page pageIndex]];
-    if ([pageView respondsToSelector:selector])
-        return pageView;
-    return nil;
-}
-
-- (void)updatedAnnotation:(PDFAnnotation *)annotation {
-    [[self safePageViewForPage:[annotation page] 
forSelector:@selector(updateAnnotation:)] updateAnnotation:annotation];
-}
-
-- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page {
-    [[self safePageViewForPage:page forSelector:@selector(addAnnotation:)] 
addAnnotation:annotation];
-}
-
-- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page {
-    [[self safePageViewForPage:page forSelector:@selector(removeAnnotation:)] 
removeAnnotation:annotation];
-}
-
 - (void)doPdfsyncWithEvent:(NSEvent *)theEvent {
     // eat up mouseDragged/mouseUp events, so we won't get their event handlers
     while (YES) {

Modified: trunk/SKBasePDFView.h
===================================================================
--- trunk/SKBasePDFView.h       2026-06-08 15:54:25 UTC (rev 16372)
+++ trunk/SKBasePDFView.h       2026-06-08 16:16:22 UTC (rev 16373)
@@ -53,6 +53,10 @@
 
 - (void)resetHistory;
 
+- (void)updatedAnnotation:(PDFAnnotation *)annotation;
+- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page;
+- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page;
+
 @end
 
 NS_ASSUME_NONNULL_END

Modified: trunk/SKBasePDFView.m
===================================================================
--- trunk/SKBasePDFView.m       2026-06-08 15:54:25 UTC (rev 16372)
+++ trunk/SKBasePDFView.m       2026-06-08 16:16:22 UTC (rev 16373)
@@ -56,10 +56,17 @@
 @end
 #endif
 
-@interface PDFView (SKHistoryPrivateDeclarations)
+@interface PDFView (SKBasePrivateDeclarations)
 - (NSInteger)currentHistoryIndex;
+- (id)pageViewForPageAtIndex:(NSUInteger)index;
 @end
 
+@interface NSView (SKPDFPageViewPrivateDeclarations)
+- (void)addAnnotation:(PDFAnnotation *)annotation;
+- (void)updateAnnotation:(PDFAnnotation *)annotation;
+- (void)removeAnnotation:(PDFAnnotation *)annotation;
+@end
+
 @interface SKBasePDFView ()
 
 - (void)handleScrollerStyleChangedNotification:(NSNotification *)notification;
@@ -164,6 +171,31 @@
     }
 }
 
+#pragma mark Annotation updating
+
+- (NSView *)safePageViewForPage:(PDFPage *)page forSelector:(SEL)selector {
+    if ([self respondsToSelector:@selector(pageViewForPageAtIndex:)] == NO || 
[self isPageAtIndexDisplayed:[page pageIndex]] == NO)
+        return nil;
+    id pageView = [self pageViewForPageAtIndex:[page pageIndex]];
+    if ([pageView respondsToSelector:selector])
+        return pageView;
+    return nil;
+}
+
+- (void)updatedAnnotation:(PDFAnnotation *)annotation {
+    [[self safePageViewForPage:[annotation page] 
forSelector:@selector(updateAnnotation:)] updateAnnotation:annotation];
+}
+
+- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page {
+    [[self safePageViewForPage:page forSelector:@selector(addAnnotation:)] 
addAnnotation:annotation];
+}
+
+- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page {
+    [[self safePageViewForPage:page forSelector:@selector(removeAnnotation:)] 
removeAnnotation:annotation];
+}
+
+#pragma mark Page shadows
+
 - (void)setDisplaysPageBreaks:(BOOL)pageBreaks {
     [super setDisplaysPageBreaks:pageBreaks];
     if (@available(macOS 10.14, *))
@@ -170,6 +202,8 @@
         [self enablePageShadows:pageBreaks];
 }
 
+#pragma mark History
+
 - (BOOL)canGoBack {
     BOOL canGoBack = [super canGoBack];
     if (minHistoryIndex > 0) {
@@ -196,6 +230,8 @@
     }
 }
 
+#pragma mark Responding overrides
+
 - (BOOL)respondsToSelector:(SEL)aSelector {
     return aSelector != @selector(printDocument:) && [super 
respondsToSelector:aSelector];
 }

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

Reply via email to