Revision: 13623
          http://sourceforge.net/p/skim-app/code/13623
Author:   hofman
Date:     2023-09-01 09:23:36 +0000 (Fri, 01 Sep 2023)
Log Message:
-----------
no need for undoManager local variable

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

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2023-08-31 16:30:10 UTC (rev 13622)
+++ trunk/SKMainWindowController.m      2023-09-01 09:23:36 UTC (rev 13623)
@@ -2331,11 +2331,10 @@
     NSDictionary *userInfo = [notification userInfo];
     PDFAnnotation *annotation = [userInfo 
objectForKey:SKPDFDocumentAnnotationKey];
     PDFPage *page = [userInfo objectForKey:SKPDFDocumentPageKey];
-    NSUndoManager *undoManager = [self interactionMode] == SKPresentationMode 
? [self presentationUndoManager] : [[self document] undoManager];
     
-    [[undoManager prepareWithInvocationTarget:[notification object]] 
removeAnnotation:annotation];
-    
     if ([self interactionMode] == SKPresentationMode) {
+        [[[self presentationUndoManager] 
prepareWithInvocationTarget:[notification object]] removeAnnotation:annotation];
+        
         if (presentationNotes == nil)
             presentationNotes = [[NSMutableArray alloc] init];
         [presentationNotes addObject:annotation];
@@ -2342,6 +2341,8 @@
         if (page)
             [self updateThumbnailAtPageIndex:[page pageIndex]];
     } else {
+        [[[[self document] undoManager] 
prepareWithInvocationTarget:[notification object]] removeAnnotation:annotation];
+        
         if ([annotation isSkimNote] && mwcFlags.addOrRemoveNotesInBulk == 0) {
             mwcFlags.updatingNoteSelection = 1;
             [[self mutableArrayValueForKey:NOTES_KEY] addObject:annotation];
@@ -2364,15 +2365,16 @@
     NSDictionary *userInfo = [notification userInfo];
     PDFAnnotation *annotation = [userInfo 
objectForKey:SKPDFDocumentAnnotationKey];
     PDFPage *page = [userInfo objectForKey:SKPDFDocumentPageKey];
-    NSUndoManager *undoManager = [self interactionMode] == SKPresentationMode 
? [self presentationUndoManager] : [[self document] undoManager];
-
-    [[undoManager prepareWithInvocationTarget:[notification object]] 
addAnnotation:annotation toPage:page];
     
     if ([self interactionMode] == SKPresentationMode) {
+        [[[self presentationUndoManager] 
prepareWithInvocationTarget:[notification object]] addAnnotation:annotation 
toPage:page];
+        
         [presentationNotes removeObject:annotation];
         if (page)
             [self updateThumbnailAtPageIndex:[page pageIndex]];
     } else {
+        [[[[self document] undoManager] 
prepareWithInvocationTarget:[notification object]] addAnnotation:annotation 
toPage:page];
+        
         if ([annotation isSkimNote] && mwcFlags.addOrRemoveNotesInBulk == 0) {
             if ([[self selectedNotes] containsObject:annotation])
                 [rightSideController.noteOutlineView deselectAll:self];
@@ -2401,10 +2403,9 @@
     PDFAnnotation *annotation = [userInfo 
objectForKey:SKPDFDocumentAnnotationKey];
     PDFPage *oldPage = [userInfo objectForKey:SKPDFDocumentOldPageKey];
     PDFPage *newPage = [userInfo objectForKey:SKPDFDocumentPageKey];
-    NSUndoManager *undoManager = [[self document] undoManager];
-
-    [[undoManager prepareWithInvocationTarget:[notification object]] 
moveAnnotation:annotation toPage:oldPage];
     
+    [[[[self document] undoManager] prepareWithInvocationTarget:[notification 
object]] moveAnnotation:annotation toPage:oldPage];
+    
     if (oldPage || newPage) {
         if (oldPage)
             [self updateThumbnailAtPageIndex:[oldPage pageIndex]];

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