Revision: 14798 http://sourceforge.net/p/skim-app/code/14798 Author: hofman Date: 2024-12-09 09:58:25 +0000 (Mon, 09 Dec 2024) Log Message: ----------- rename method for annotation updates
Modified Paths: -------------- trunk/PDFView_SKExtensions.h trunk/PDFView_SKExtensions.m trunk/SKMainWindowController.m trunk/SKMainWindowController_UI.m trunk/SKPDFView.h trunk/SKPDFView.m trunk/SKSnapshotWindowController.h trunk/SKSnapshotWindowController.m Modified: trunk/PDFView_SKExtensions.h =================================================================== --- trunk/PDFView_SKExtensions.h 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/PDFView_SKExtensions.h 2024-12-09 09:58:25 UTC (rev 14798) @@ -55,9 +55,9 @@ - (BOOL)isPageAtIndexDisplayed:(NSUInteger)pageIndex; - (void)setNeedsDisplayInRect:(NSRect)rect ofPage:(PDFPage *)page; -- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation; -- (void)setNeedsDisplayForAddedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page; -- (void)setNeedsDisplayForRemovedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page; +- (void)updatedAnnotation:(PDFAnnotation *)annotation; +- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page; +- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page; - (void)requiresDisplay; - (void)doPdfsyncWithEvent:(NSEvent *)theEvent; Modified: trunk/PDFView_SKExtensions.m =================================================================== --- trunk/PDFView_SKExtensions.m 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/PDFView_SKExtensions.m 2024-12-09 09:58:25 UTC (rev 14798) @@ -113,7 +113,7 @@ } } -- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation { +- (void)updatedAnnotation:(PDFAnnotation *)annotation { PDFPage *page = [annotation page]; NSView *pageView = [self safePageViewForPage:page]; if (pageView) @@ -124,13 +124,13 @@ [self setNeedsDisplay:YES]; } -- (void)setNeedsDisplayForAddedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page { +- (void)addedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page { NSView *pageView = [self safePageViewForPage:page]; if (pageView) [pageView addAnnotation:annotation]; } -- (void)setNeedsDisplayForRemovedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page { +- (void)removedAnnotation:(PDFAnnotation *)annotation onPage:(PDFPage *)page { NSView *pageView = [self safePageViewForPage:page]; if (pageView) [pageView removeAnnotation:annotation]; Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKMainWindowController.m 2024-12-09 09:58:25 UTC (rev 14798) @@ -2172,7 +2172,7 @@ if ([wc isPageVisible:page]) [self snapshotNeedsUpdate:wc placeholder:NO]; } - [secondaryPdfView setNeedsDisplayForAddedAnnotation:annotation onPage:page]; + [secondaryPdfView addedAnnotation:annotation onPage:page]; if ([self interactionMode] == SKPresentationMode && [presentationView page] == page) [presentationView setNeedsDisplay:YES]; } @@ -2217,7 +2217,7 @@ if ([wc isPageVisible:page]) [self snapshotNeedsUpdate:wc placeholder:NO]; } - [secondaryPdfView setNeedsDisplayForRemovedAnnotation:annotation onPage:page]; + [secondaryPdfView removedAnnotation:annotation onPage:page]; if ([self interactionMode] == SKPresentationMode && [presentationView page] == page) [presentationView setNeedsDisplay:YES]; } @@ -2241,8 +2241,8 @@ if ([wc isPageVisible:oldPage] || [wc isPageVisible:newPage]) [self snapshotNeedsUpdate:wc placeholder:NO]; } - [secondaryPdfView setNeedsDisplayForRemovedAnnotation:annotation onPage:oldPage]; - [secondaryPdfView setNeedsDisplayForAddedAnnotation:annotation onPage:newPage]; + [secondaryPdfView removedAnnotation:annotation onPage:oldPage]; + [secondaryPdfView addedAnnotation:annotation onPage:newPage]; if ([self interactionMode] == SKPresentationMode && ([presentationView page] == oldPage || [presentationView page] == newPage)) [presentationView setNeedsDisplay:YES]; } @@ -2695,12 +2695,12 @@ for (SKSnapshotWindowController *wc in snapshots) { if ([wc isPageVisible:[note page]]) { [self snapshotNeedsUpdate:wc placeholder:NO]; - [wc setNeedsDisplayForAnnotation:note]; + [wc updatedAnnotation:note]; } } - [pdfView setNeedsDisplay:([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] || [keyPath isEqualToString:SKNPDFAnnotationDrawsImageKey]) forAnnotation:note fromRect:oldRect]; - [secondaryPdfView setNeedsDisplayForAnnotation:note]; + [pdfView updatedAnnotation:note affectingHighlight:([keyPath isEqualToString:SKNPDFAnnotationBoundsKey] || [keyPath isEqualToString:SKNPDFAnnotationDrawsImageKey]) fromRect:oldRect]; + [secondaryPdfView updatedAnnotation:note]; if ([keyPath isEqualToString:SKNPDFAnnotationBoundsKey]) { if ([note isNote]) { Modified: trunk/SKMainWindowController_UI.m =================================================================== --- trunk/SKMainWindowController_UI.m 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKMainWindowController_UI.m 2024-12-09 09:58:25 UTC (rev 14798) @@ -1143,7 +1143,7 @@ [page addAnnotation:note]; - [pdfView setNeedsDisplayForAnnotation:note]; + [pdfView updatedAnnotation:note]; } - (void)autoSizeNoteRows:(id)sender { Modified: trunk/SKPDFView.h =================================================================== --- trunk/SKPDFView.h 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKPDFView.h 2024-12-09 09:58:25 UTC (rev 14798) @@ -256,7 +256,7 @@ - (void)undoManagerDidOpenOrCloseUndoGroup; -- (void)setNeedsDisplay:(BOOL)needsRedraw forAnnotation:(PDFAnnotation *)annotation fromRect:(NSRect)oldRect; +- (void)updatedAnnotation:(PDFAnnotation *)annotation affectingHighlight:(BOOL)affectingHighlight fromRect:(NSRect)oldRect; @end Modified: trunk/SKPDFView.m =================================================================== --- trunk/SKPDFView.m 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKPDFView.m 2024-12-09 09:58:25 UTC (rev 14798) @@ -655,7 +655,7 @@ // Will need to redraw old active anotation. if (currentAnnotation != nil) { - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; if (editor && [self commitEditing] == NO) [self discardEditing]; } @@ -666,7 +666,7 @@ } if (newAnnotation) { // Force redisplay. - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; } NSDictionary *userInfo = wasAnnotation ? @{SKPDFViewAnnotationKey:wasAnnotation} : nil; @@ -2689,7 +2689,7 @@ [[self window] makeFirstResponder:self]; [editor layoutWithEvent:theEvent]; - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; } - (void)textNoteEditorDidBeginEditing:(SKTextNoteEditor *)textNoteEditor { @@ -2700,7 +2700,7 @@ - (void)textNoteEditorDidEndEditing:(SKTextNoteEditor *)textNoteEditor { editor = nil; - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; if ([[self delegate] respondsToSelector:@selector(PDFViewDidEndEditing:)]) [[self delegate] PDFViewDidEndEditing:self]; @@ -2834,8 +2834,8 @@ [self goToRect:[annotation bounds] onPage:[annotation page]]; } -- (void)setNeedsDisplay:(BOOL)needsRedraw forAnnotation:(PDFAnnotation *)annotation fromRect:(NSRect)oldRect { - if (annotation == currentAnnotation && atomic_load(&highlightLayerState) != SKLayerUse && needsRedraw) { +- (void)updatedAnnotation:(PDFAnnotation *)annotation affectingHighlight:(BOOL)affectingHighlight fromRect:(NSRect)oldRect { + if (annotation == currentAnnotation && atomic_load(&highlightLayerState) != SKLayerUse && affectingHighlight) { PDFPage *page = [annotation page]; NSRect rect = NSUnionRect([annotation bounds], oldRect); CGFloat margin = (([annotation isResizable] || [annotation isNote]) ? HANDLE_SIZE : 1.0) / [self scaleFactor]; @@ -2846,8 +2846,8 @@ } } -- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation { - [self setNeedsDisplay:YES forAnnotation:annotation fromRect:NSZeroRect]; +- (void)updatedAnnotation:(PDFAnnotation *)annotation { + [self updatedAnnotation:annotation affectingHighlight:YES fromRect:NSZeroRect]; } - (void)setNeedsDisplayForReadingBarBounds:(NSRect)rect onPage:(PDFPage *)page { @@ -3015,7 +3015,7 @@ - (void)handleDidAddAnnotationNotification:(NSNotification *)notification { PDFAnnotation *annotation = [[notification userInfo] objectForKey:SKPDFDocumentAnnotationKey]; - [self setNeedsDisplayForAnnotation:annotation]; + [self updatedAnnotation:annotation]; if ([annotation isNote]) [self resetPDFToolTipRects]; } @@ -3028,7 +3028,7 @@ [self beginNewUndoGroupIfNeededWithCommit:NO]; } - [self setNeedsDisplayForAnnotation:annotation]; + [self updatedAnnotation:annotation]; } - (void)handleDidRemoveAnnotationNotification:(NSNotification *)notification { @@ -3042,7 +3042,7 @@ - (void)handleWillMoveAnnotationNotification:(NSNotification *)notification { PDFAnnotation *annotation = [[notification userInfo] objectForKey:SKPDFDocumentAnnotationKey]; - [self setNeedsDisplayForAnnotation:annotation]; + [self updatedAnnotation:annotation]; } - (void)handleDidMoveAnnotationNotification:(NSNotification *)notification { @@ -3049,7 +3049,7 @@ NSDictionary *userInfo = [notification userInfo]; PDFAnnotation *annotation = [userInfo objectForKey:SKPDFDocumentAnnotationKey]; - [self setNeedsDisplayForAnnotation:annotation]; + [self updatedAnnotation:annotation]; if ([annotation isNote]) [self resetPDFToolTipRects]; if ([self isEditingAnnotation:annotation]) @@ -3104,7 +3104,7 @@ [self setNeedsDisplayInRect:NSInsetRect(selectionRect, -margin, -margin) ofPage:page]; } if (currentAnnotation) - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; } if ([[notification name] isEqualToString:NSWindowDidResignKeyNotification]) { [self setTemporaryToolMode:SKToolModeNone]; @@ -3954,7 +3954,7 @@ atomic_store(&highlightLayerState, SKLayerAdd); if (currentAnnotation) - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; if (shouldAddAnnotation) { if (noteType == SKNoteTypeAnchored) { @@ -4027,7 +4027,7 @@ [self editCurrentAnnotation:self]; atomic_store(&highlightLayerState, SKLayerRemove); - [self setNeedsDisplayForAnnotation:currentAnnotation]; + [self updatedAnnotation:currentAnnotation]; } else { atomic_store(&highlightLayerState, SKLayerNone); [self removeHighlightLayer]; Modified: trunk/SKSnapshotWindowController.h =================================================================== --- trunk/SKSnapshotWindowController.h 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKSnapshotWindowController.h 2024-12-09 09:58:25 UTC (rev 14798) @@ -104,7 +104,7 @@ - (void)handleDidRemoveAnnotationNotification:(NSNotification *)notification; - (void)handleDidMoveAnnotationNotification:(NSNotification *)notification; -- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation; +- (void)updatedAnnotation:(PDFAnnotation *)annotation; @end Modified: trunk/SKSnapshotWindowController.m =================================================================== --- trunk/SKSnapshotWindowController.m 2024-12-09 09:45:57 UTC (rev 14797) +++ trunk/SKSnapshotWindowController.m 2024-12-09 09:58:25 UTC (rev 14798) @@ -130,8 +130,8 @@ return [displayName stringByAppendingEmDashAndString:[NSString stringWithFormat:NSLocalizedString(@"Page %@", @""), [self pageLabel]]]; } -- (void)setNeedsDisplayForAnnotation:(PDFAnnotation *)annotation { - [pdfView setNeedsDisplayForAnnotation:annotation]; +- (void)updatedAnnotation:(PDFAnnotation *)annotation { + [pdfView updatedAnnotation:annotation]; } - (void)redisplay { @@ -188,7 +188,7 @@ PDFAnnotation *annotation = [[notification userInfo] objectForKey:SKPDFDocumentAnnotationKey]; PDFPage *page = [[notification userInfo] objectForKey:SKPDFDocumentPageKey]; if ([self isPageVisible:page]) - [pdfView setNeedsDisplayForAddedAnnotation:annotation onPage:page]; + [pdfView addedAnnotation:annotation onPage:page]; } - (void)handleDidRemoveAnnotationNotification:(NSNotification *)notification { @@ -195,7 +195,7 @@ PDFAnnotation *annotation = [[notification userInfo] objectForKey:SKPDFDocumentAnnotationKey]; PDFPage *page = [[notification userInfo] objectForKey:SKPDFDocumentPageKey]; if ([self isPageVisible:page]) - [pdfView setNeedsDisplayForRemovedAnnotation:annotation onPage:page]; + [pdfView removedAnnotation:annotation onPage:page]; } - (void)handleDidMoveAnnotationNotification:(NSNotification *)notification { @@ -203,9 +203,9 @@ PDFPage *oldPage = [[notification userInfo] objectForKey:SKPDFDocumentOldPageKey]; PDFPage *newPage = [[notification userInfo] objectForKey:SKPDFDocumentPageKey]; if ([self isPageVisible:oldPage]) - [pdfView setNeedsDisplayForRemovedAnnotation:annotation onPage:oldPage]; + [pdfView removedAnnotation:annotation onPage:oldPage]; if ([self isPageVisible:newPage]) - [pdfView setNeedsDisplayForAddedAnnotation:annotation onPage:newPage]; + [pdfView addedAnnotation:annotation onPage:newPage]; } - (void)windowWillClose:(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 Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit