Revision: 13647
http://sourceforge.net/p/skim-app/code/13647
Author: hofman
Date: 2023-09-08 16:23:44 +0000 (Fri, 08 Sep 2023)
Log Message:
-----------
use text undo manager in presentation, so we can undo in the document's
undomanager when no temporary notes were added, e.g. transitions. Make sure we
correctly add or remove notes when undoing or redoing through the document's
undomanager.
Modified Paths:
--------------
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2023-09-08 15:44:56 UTC (rev 13646)
+++ trunk/SKMainWindowController.m 2023-09-08 16:23:44 UTC (rev 13647)
@@ -109,6 +109,7 @@
#import "SKDocumentController.h"
#import "NSColor_SKExtensions.h"
#import "NSObject_SKExtensions.h"
+#import "SKTextUndoManager.h"
#define MULTIPLICATION_SIGN_CHARACTER (unichar)0x00d7
@@ -1589,7 +1590,7 @@
- (NSUndoManager *)presentationUndoManager {
if (presentationUndoManager == nil)
- presentationUndoManager = [[NSUndoManager alloc] init];
+ presentationUndoManager = [[SKTextUndoManager alloc]
initWithNextUndoManager:[[self document] undoManager]];
return presentationUndoManager;
}
@@ -2341,8 +2342,9 @@
NSDictionary *userInfo = [notification userInfo];
PDFAnnotation *annotation = [userInfo
objectForKey:SKPDFDocumentAnnotationKey];
PDFPage *page = [userInfo objectForKey:SKPDFDocumentPageKey];
+ NSUndoManager *undoManager = [[self document] undoManager];
- if ([self interactionMode] == SKPresentationMode) {
+ if ([self interactionMode] == SKPresentationMode && [undoManager
isUndoing] == NO && [undoManager isRedoing] == NO) {
[[[self presentationUndoManager]
prepareWithInvocationTarget:[notification object]] removeAnnotation:annotation];
if (presentationNotes == nil)
@@ -2351,7 +2353,7 @@
if (page)
[self updateThumbnailAtPageIndex:[page pageIndex]];
} else {
- [[[[self document] undoManager]
prepareWithInvocationTarget:[notification object]] removeAnnotation:annotation];
+ [[undoManager prepareWithInvocationTarget:[notification object]]
removeAnnotation:annotation];
if ([annotation isSkimNote] && mwcFlags.addOrRemoveNotesInBulk == 0) {
mwcFlags.updatingNoteSelection = 1;
@@ -2375,8 +2377,9 @@
NSDictionary *userInfo = [notification userInfo];
PDFAnnotation *annotation = [userInfo
objectForKey:SKPDFDocumentAnnotationKey];
PDFPage *page = [userInfo objectForKey:SKPDFDocumentPageKey];
+ NSUndoManager *undoManager = [[self document] undoManager];
- if ([self interactionMode] == SKPresentationMode) {
+ if ([self interactionMode] == SKPresentationMode && [undoManager
isUndoing] == NO && [undoManager isRedoing] == NO) {
[[[self presentationUndoManager]
prepareWithInvocationTarget:[notification object]] addAnnotation:annotation
toPage:page];
[presentationNotes removeObject:annotation];
@@ -2383,7 +2386,7 @@
if (page)
[self updateThumbnailAtPageIndex:[page pageIndex]];
} else {
- [[[[self document] undoManager]
prepareWithInvocationTarget:[notification object]] addAnnotation:annotation
toPage:page];
+ [[undoManager prepareWithInvocationTarget:[notification object]]
addAnnotation:annotation toPage:page];
if ([annotation isSkimNote] && mwcFlags.addOrRemoveNotesInBulk == 0) {
if ([[self selectedNotes] containsObject:annotation])
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