Revision: 13672
http://sourceforge.net/p/skim-app/code/13672
Author: hofman
Date: 2023-09-28 16:39:10 +0000 (Thu, 28 Sep 2023)
Log Message:
-----------
Set undo actions for page rotation and crop discardable, and ignore change
count update for discardable actions, rather tham generating cancelling change
counts
Modified Paths:
--------------
trunk/NSDocument_SKExtensions.h
trunk/NSDocument_SKExtensions.m
trunk/SKMainDocument.m
trunk/SKMainWindowController_Actions.m
Modified: trunk/NSDocument_SKExtensions.h
===================================================================
--- trunk/NSDocument_SKExtensions.h 2023-09-28 15:00:18 UTC (rev 13671)
+++ trunk/NSDocument_SKExtensions.h 2023-09-28 16:39:10 UTC (rev 13672)
@@ -53,8 +53,6 @@
- (SKInteractionMode)systemInteractionMode;
-- (void)undoableActionIsDiscardable;
-
- (NSWindow *)mainWindow;
- (IBAction)copyURL:(id)sender;
Modified: trunk/NSDocument_SKExtensions.m
===================================================================
--- trunk/NSDocument_SKExtensions.m 2023-09-28 15:00:18 UTC (rev 13671)
+++ trunk/NSDocument_SKExtensions.m 2023-09-28 16:39:10 UTC (rev 13672)
@@ -68,14 +68,6 @@
- (SKInteractionMode)systemInteractionMode { return SKNormalMode; }
-- (void)undoableActionIsDiscardable {
- // This action, while undoable, shouldn't mark the document dirty
- NSDocumentChangeType changeType = [[self undoManager] isUndoing] ?
NSChangeRedone : NSChangeUndone;
- dispatch_async(dispatch_get_main_queue(), ^{
- [self updateChangeCount:changeType];
- });
-}
-
- (NSWindow *)mainWindow {
return [[[self windowControllers] firstObject] window];
}
Modified: trunk/SKMainDocument.m
===================================================================
--- trunk/SKMainDocument.m 2023-09-28 15:00:18 UTC (rev 13671)
+++ trunk/SKMainDocument.m 2023-09-28 16:39:10 UTC (rev 13672)
@@ -191,6 +191,11 @@
[self addWindowController:mainWindowController];
}
+- (void)updateChangeCount:(NSDocumentChangeType)change {
+ if ((change & NSChangeDiscardable) == 0)
+ [super updateChangeCount:change];
+}
+
- (void)setDataFromTmpData {
PDFDocument *pdfDoc = [tmpData pdfDocument];
Modified: trunk/SKMainWindowController_Actions.m
===================================================================
--- trunk/SKMainWindowController_Actions.m 2023-09-28 15:00:18 UTC (rev
13671)
+++ trunk/SKMainWindowController_Actions.m 2023-09-28 16:39:10 UTC (rev
13672)
@@ -503,7 +503,7 @@
NSUndoManager *undoManager = [[self document] undoManager];
[[undoManager prepareWithInvocationTarget:self] rotatePageAtIndex:idx
by:-rotation];
[undoManager setActionName:NSLocalizedString(@"Rotate Page", @"Undo action
name")];
- [[self document] undoableActionIsDiscardable];
+ [undoManager setActionIsDiscardable:YES];
PDFPage *page = [[pdfView document] pageAtIndex:idx];
[page setRotation:[page rotation] + rotation];
@@ -516,7 +516,7 @@
NSUndoManager *undoManager = [[self document] undoManager];
[[undoManager prepareWithInvocationTarget:self] rotateAllBy:-rotation];
[undoManager setActionName:NSLocalizedString(@"Rotate", @"Undo action
name")];
- [[self document] undoableActionIsDiscardable];
+ [undoManager setActionIsDiscardable:YES];
if (([pdfView displayMode] & kPDFDisplaySinglePageContinuous))
[pdfView setNeedsRewind:YES];
@@ -550,7 +550,7 @@
NSUndoManager *undoManager = [[self document] undoManager];
[[undoManager prepareWithInvocationTarget:self] cropPageAtIndex:anIndex
toRect:oldRect];
[undoManager setActionName:NSLocalizedString(@"Crop Page", @"Undo action
name")];
- [[self document] undoableActionIsDiscardable];
+ [undoManager setActionIsDiscardable:YES];
PDFPage *page = [[pdfView document] pageAtIndex:anIndex];
rect = NSIntersectionRect(rect, [page
boundsForBox:kPDFDisplayBoxMediaBox]);
@@ -589,7 +589,7 @@
NSUndoManager *undoManager = [[self document] undoManager];
[[undoManager prepareWithInvocationTarget:self] cropPagesToRects:oldRects];
[undoManager setActionName:NSLocalizedString(@"Crop", @"Undo action
name")];
- [[self document] undoableActionIsDiscardable];
+ [undoManager setActionIsDiscardable:YES];
[[NSNotificationCenter defaultCenter]
postNotificationName:SKPDFPageBoundsDidChangeNotification
object:[pdfView
document] userInfo:@{SKPDFPageActionKey:SKPDFPageActionCrop}];
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