Revision: 16724
          http://sourceforge.net/p/skim-app/code/16724
Author:   hofman
Date:     2026-10-27 14:13:07 +0000 (Tue, 27 Oct 2026)
Log Message:
-----------
method to create snapshot window controller without setup and display

Modified Paths:
--------------
    trunk/SKMainWindowController.h
    trunk/SKMainWindowController.m
    trunk/SKMainWindowController_FullScreen.m
    trunk/SKMainWindowController_UI.m

Modified: trunk/SKMainWindowController.h
===================================================================
--- trunk/SKMainWindowController.h      2026-10-26 22:54:49 UTC (rev 16723)
+++ trunk/SKMainWindowController.h      2026-10-27 14:13:07 UTC (rev 16724)
@@ -204,9 +204,8 @@
 
 - (SKTransitionController *)transitionControllerCreating:(BOOL)create;
 
-- (void)showSnapshotAtPage:(PDFPage *)page forRect:(NSRect)rect 
scaleFactor:(CGFloat)scaleFactor autoFits:(BOOL)autoFits;
+- (SKSnapshotWindowController *)makeSnapshot;
 - (void)showSnapshotsWithSetups:(NSArray<NSDictionary<NSString *, id> *> 
*)setups;
-- (void)showSnapshotAtPage:(PDFPage *)page previewOnScreen:(NSScreen *)screen;
 - (void)showNote:(PDFAnnotation *)annotation;
 
 - (nullable NSWindowController *)windowControllerForNote:(PDFAnnotation 
*)annotation;

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2026-10-26 22:54:49 UTC (rev 16723)
+++ trunk/SKMainWindowController.m      2026-10-27 14:13:07 UTC (rev 16724)
@@ -2434,47 +2434,27 @@
 
 #pragma mark Subwindows
 
-- (void)showSnapshotAtPage:(PDFPage *)page forRect:(NSRect)rect 
scaleFactor:(CGFloat)scaleFactor autoFits:(BOOL)autoFits {
+- (SKSnapshotWindowController *)makeSnapshot {
     SKSnapshotWindowController *swc = [[SKSnapshotWindowController alloc] 
init];
     
     [swc setDelegate:self];
     
     [swc loadPdfDocument:[pdfView document]];
-    [swc displayPage:page rect:rect scaleFactor:scaleFactor autoFits:autoFits];
     
     [swc setForceOnTop:[self interactionMode] == SKFullScreenMode];
     
     [[self document] addWindowController:swc];
+    
+    return swc;
 }
 
 - (void)showSnapshotsWithSetups:(NSArray *)setups {
     [setups enumerateObjectsUsingBlock:^(NSDictionary *setup, NSUInteger i, 
BOOL *stop){
-        SKSnapshotWindowController *swc = [[SKSnapshotWindowController alloc] 
init];
-        
-        [swc setDelegate:self];
-        
-        [swc loadPdfDocument:[pdfView document]];
+        SKSnapshotWindowController *swc = [self makeSnapshot];
         [swc displaySetup:setup];
-
-        [swc setForceOnTop:[self interactionMode] == SKFullScreenMode];
-        
-        [[self document] addWindowController:swc];
     }];
 }
 
-- (void)showSnapshotAtPage:(PDFPage *)page previewOnScreen:(NSScreen *)screen {
-    SKSnapshotWindowController *swc = [[SKSnapshotWindowController alloc] 
init];
-    
-    [presentationNotesAuxiliary setPreviewController:swc];
-    
-    [swc setDelegate:self];
-    
-    [swc loadPdfDocument:[pdfView document]];
-    [swc previewPage:page displayOnScreen:screen];
-    
-    [[self document] addWindowController:swc];
-}
-
 - (void)snapshotController:(SKSnapshotWindowController *)controller 
didFinishSetup:(SKSnapshotOpenType)openType {
     if (openType == SKSnapshotOpenPreview)
         return;

Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m   2026-10-26 22:54:49 UTC (rev 
16723)
+++ trunk/SKMainWindowController_FullScreen.m   2026-10-27 14:13:07 UTC (rev 
16724)
@@ -294,7 +294,8 @@
         PDFPage *page = [self pageForPresentationNotes];
         if (notesDocument == [self document]) {
             screen = [self screenForPresentationWindowAvoidingScreen:screen 
preferExternal:NO];
-            [self showSnapshotAtPage:page previewOnScreen:screen];
+            SKSnapshotWindowController *preview = [self makeSnapshot];
+            [preview previewPage:page displayOnScreen:screen];
         } else {
             [notesDocument setCurrentPage:page];
         }

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-10-26 22:54:49 UTC (rev 16723)
+++ trunk/SKMainWindowController_UI.m   2026-10-27 14:13:07 UTC (rev 16724)
@@ -573,7 +573,8 @@
         
         rect.origin.y = NSMidY(rect) - 0.5 * SNAPSHOT_HEIGHT;
         rect.size.height = SNAPSHOT_HEIGHT;
-        [self showSnapshotAtPage:[[pdfView document] pageAtIndex:row] 
forRect:rect scaleFactor:[pdfView scaleFactor] autoFits:NO];
+        SKSnapshotWindowController *swc = [self makeSnapshot];
+        [swc displayPage:[[pdfView document] pageAtIndex:row] rect:rect 
scaleFactor:[pdfView scaleFactor] autoFits:NO];
         return YES;
     }
     return NO;
@@ -1736,7 +1737,8 @@
 }
 
 - (void)PDFView:(PDFView *)aPDFView showSnapshotAtPage:(PDFPage *)page 
forRect:(NSRect)rect scaleFactor:(CGFloat)scaleFactor autoFits:(BOOL)autoFits {
-    [self showSnapshotAtPage:page forRect:rect scaleFactor:scaleFactor 
autoFits:autoFits];
+    SKSnapshotWindowController *swc = [self makeSnapshot];
+    [swc displayPage:page rect:rect scaleFactor:scaleFactor autoFits:autoFits];
 }
 
 - (void)PDFView:(PDFView *)aPDFView didRotatePageAtIndex:(NSUInteger)idx 
by:(NSInteger)rotation {

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