Revision: 13606
          http://sourceforge.net/p/skim-app/code/13606
Author:   hofman
Date:     2023-08-25 09:08:25 +0000 (Fri, 25 Aug 2023)
Log Message:
-----------
get document for pdfview through delegate method ratherthan assuming window 
controller

Modified Paths:
--------------
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2023-08-24 14:40:16 UTC (rev 13605)
+++ trunk/SKMainWindowController_UI.m   2023-08-25 09:08:25 UTC (rev 13606)
@@ -1513,6 +1513,10 @@
     [self toggleLeftSidePane:sender];
 }
 
+- (NSDocument *)documentForPDFView:(PDFView *)sender {
+    return [self document];
+}
+
 #pragma mark NSSplitView delegate protocol
 
 - (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview {

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2023-08-24 14:40:16 UTC (rev 13605)
+++ trunk/SKPDFView.h   2023-08-25 09:08:25 UTC (rev 13606)
@@ -286,4 +286,5 @@
 - (void)PDFViewToggleContents:(PDFView *)sender;
 - (void)PDFViewPerformHideFind:(PDFView *)sender;
 - (BOOL)PDFViewIsFindVisible:(PDFView *)sender;
+- (NSDocument *)documentForPDFView:(PDFView *)sender;
 @end

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2023-08-24 14:40:16 UTC (rev 13605)
+++ trunk/SKPDFView.m   2023-08-25 09:08:25 UTC (rev 13606)
@@ -669,8 +669,8 @@
         return temporaryUndoManager;
     }
     NSUndoManager *undoManager = [super undoManager];
-    if (undoManager == nil && [[self delegate] 
respondsToSelector:@selector(document)])
-        undoManager = [[(NSWindowController *)[self delegate] document] 
undoManager];
+    if (undoManager == nil && [[self delegate] 
respondsToSelector:@selector(documentForPDFView:)])
+        undoManager = [[[self delegate] documentForPDFView:self] undoManager];
     return undoManager;
 }
 
@@ -2391,7 +2391,7 @@
     NSUndoManager *undoManager = [self undoManager];
     [[undoManager prepareWithInvocationTarget:self] rotatePageAtIndex:idx 
by:-rotation];
     [undoManager setActionName:NSLocalizedString(@"Rotate Page", @"Undo action 
name")];
-    NSDocument *doc = [[self delegate] respondsToSelector:@selector(document)] 
? [(NSWindowController *)[self delegate] document] : [[[self window] 
windowController] document];
+    NSDocument *doc = [[self delegate] 
respondsToSelector:@selector(documentForPDFView:)] ? [[self delegate] 
documentForPDFView:self] : [[[self window] windowController] document];
     [doc undoableActionIsDiscardable];
     
     PDFPage *page = [[self document] pageAtIndex:idx];

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