Revision: 13607
http://sourceforge.net/p/skim-app/code/13607
Author: hofman
Date: 2023-08-25 22:30:45 +0000 (Fri, 25 Aug 2023)
Log Message:
-----------
separate accessor for temporary undo manager in pdfview, to avoid method loop
if use changes, because getting the undoManager of a responder will get it from
the window and its controller in default implementation.
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.h
trunk/SKPDFView.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2023-08-25 09:08:25 UTC (rev 13606)
+++ trunk/SKMainWindowController_UI.m 2023-08-25 22:30:45 UTC (rev 13607)
@@ -314,7 +314,7 @@
- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)sender {
if ([self interactionMode] == SKPresentationMode)
- return [pdfView undoManager];
+ return [pdfView temporaryUndoManager];
return nil;
}
Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h 2023-08-25 09:08:25 UTC (rev 13606)
+++ trunk/SKPDFView.h 2023-08-25 22:30:45 UTC (rev 13607)
@@ -201,6 +201,7 @@
@property (nonatomic, readonly) BOOL hasPacer;
@property (nonatomic, readonly) SKTransitionController *transitionController;
@property (nonatomic, retain) SKTypeSelectHelper *typeSelectHelper;
+@property (nonatomic, readonly) NSUndoManager *temporaryUndoManager;
@property (nonatomic) BOOL needsRewind;
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2023-08-25 09:08:25 UTC (rev 13606)
+++ trunk/SKPDFView.m 2023-08-25 22:30:45 UTC (rev 13607)
@@ -274,7 +274,7 @@
@implementation SKPDFView
@synthesize toolMode, annotationMode, temporaryToolMode, interactionMode,
currentAnnotation, readingBar, pacerSpeed, transitionController,
typeSelectHelper, syncDot, zooming;
-@dynamic extendedDisplayMode, displaysHorizontally, displaysRightToLeft,
hideNotes, hasReadingBar, hasPacer, currentSelectionPage, currentSelectionRect,
currentMagnification, needsRewind, editing;
+@dynamic extendedDisplayMode, displaysHorizontally, displaysRightToLeft,
hideNotes, hasReadingBar, hasPacer, currentSelectionPage, currentSelectionRect,
currentMagnification, needsRewind, editing, temporaryUndoManager;
+ (void)initialize {
SKINITIALIZE;
@@ -663,11 +663,8 @@
}
- (NSUndoManager *)undoManager {
- if (interactionMode == SKPresentationMode) {
- if (temporaryUndoManager == nil)
- temporaryUndoManager = [[NSUndoManager alloc] init];
- return temporaryUndoManager;
- }
+ if (interactionMode == SKPresentationMode)
+ return [self temporaryUndoManager];
NSUndoManager *undoManager = [super undoManager];
if (undoManager == nil && [[self delegate]
respondsToSelector:@selector(documentForPDFView:)])
undoManager = [[[self delegate] documentForPDFView:self] undoManager];
@@ -674,6 +671,12 @@
return undoManager;
}
+- (NSUndoManager *)temporaryUndoManager {
+ if (temporaryUndoManager == nil)
+ temporaryUndoManager = [[NSUndoManager alloc] init];
+ return temporaryUndoManager;
+}
+
- (void)setBackgroundColor:(NSColor *)newBackgroundColor {
[super setBackgroundColor:newBackgroundColor];
[loupeController updateBackgroundColor];
@@ -2944,7 +2947,7 @@
}
- (void)addTemporaryAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage
*)page {
- [[[self undoManager] prepareWithInvocationTarget:self]
removeTemporaryAnnotation:annotation];
+ [[[self temporaryUndoManager] prepareWithInvocationTarget:self]
removeTemporaryAnnotation:annotation];
if (temporaryAnnotations == nil)
temporaryAnnotations = [[NSMutableArray alloc] init];
[annotation setShouldPrint:NO];
@@ -2959,7 +2962,7 @@
PDFAnnotation *wasAnnotation = [annotation retain];
PDFPage *page = [[wasAnnotation page] retain];
- [[[self undoManager] prepareWithInvocationTarget:self]
addTemporaryAnnotation:wasAnnotation toPage:page];
+ [[[self temporaryUndoManager] prepareWithInvocationTarget:self]
addTemporaryAnnotation:wasAnnotation toPage:page];
[self setNeedsDisplayForAnnotation:wasAnnotation];
[temporaryAnnotations removeObject:annotation];
[page removeAnnotation:wasAnnotation];
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