Revision: 12679
          http://sourceforge.net/p/skim-app/code/12679
Author:   hofman
Date:     2022-01-04 15:04:54 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Make sure pdfview returns an undoManager, even if it is not in a window, use 
delegate if not available.

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

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2022-01-04 13:18:29 UTC (rev 12678)
+++ trunk/SKPDFView.m   2022-01-04 15:04:54 UTC (rev 12679)
@@ -586,6 +586,13 @@
         [self updateMagnifyWithEvent:nil];
 }
 
+- (NSUndoManager *)undoManager {
+    NSUndoManager *undoManager = [super undoManager];
+    if (undoManager == nil && [[self delegate] 
respondsToSelector:@selector(document)])
+        undoManager = [[(NSWindowController *)[self delegate] document] 
undoManager];
+    return undoManager;
+}
+
 - (void)setBackgroundColor:(NSColor *)newBackgroundColor {
     [super setBackgroundColor:newBackgroundColor];
     [self updateLoupeBackgroundColor];
@@ -2160,7 +2167,8 @@
     NSUndoManager *undoManager = [self undoManager];
     [[undoManager prepareWithInvocationTarget:self] rotatePageAtIndex:idx 
by:-rotation];
     [undoManager setActionName:NSLocalizedString(@"Rotate Page", @"Undo action 
name")];
-    [[[[self window] windowController] document] undoableActionIsDiscardable];
+    NSDocument *doc = [[self delegate] respondsToSelector:@selector(document)] 
? [(NSWindowController *)[self delegate] document] : [[[self window] 
windowController] document];
+    [doc undoableActionIsDiscardable];
     
     PDFPage *page = [[self document] pageAtIndex:idx];
     [page setRotation:[page rotation] + rotation];

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

Reply via email to