Revision: 12681
http://sourceforge.net/p/skim-app/code/12681
Author: hofman
Date: 2022-01-04 15:34:45 +0000 (Tue, 04 Jan 2022)
Log Message:
-----------
Add observer for undomanager in setDelegate, so we can observe the actual
undoManager
Modified Paths:
--------------
trunk/SKPDFView.m
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2022-01-04 15:17:20 UTC (rev 12680)
+++ trunk/SKPDFView.m 2022-01-04 15:34:45 UTC (rev 12681)
@@ -327,10 +327,6 @@
name:PDFViewPageChangedNotification object:self];
[nc addObserver:self selector:@selector(handleScaleChangedNotification:)
name:PDFViewScaleChangedNotification object:self];
- [nc addObserver:self
selector:@selector(handleUndoGroupOpenedOrClosedNotification:)
-
name:NSUndoManagerDidOpenUndoGroupNotification object:nil];
- [nc addObserver:self
selector:@selector(handleUndoGroupOpenedOrClosedNotification:)
-
name:NSUndoManagerDidCloseUndoGroupNotification object:nil];
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeys:[[self class] defaultKeysToObserve]
context:&SKPDFViewDefaultsObservationContext];
}
@@ -3069,8 +3065,7 @@
}
- (void)handleUndoGroupOpenedOrClosedNotification:(NSNotification
*)notification {
- if ([notification object] == [self undoManager])
- pdfvFlags.wantsNewUndoGroup = NO;
+ pdfvFlags.wantsNewUndoGroup = NO;
}
- (void)handleKeyStateChangedNotification:(NSNotification *)notification {
@@ -5300,6 +5295,14 @@
}
- (void)setDelegate:(id <SKPDFViewDelegate>)newDelegate {
+ if (newDelegate) {
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ NSUndoManager *undoManager = [self undoManager];
+ [nc addObserver:self
selector:@selector(handleUndoGroupOpenedOrClosedNotification:)
+
name:NSUndoManagerDidOpenUndoGroupNotification object:undoManager];
+ [nc addObserver:self
selector:@selector(handleUndoGroupOpenedOrClosedNotification:)
+
name:NSUndoManagerDidCloseUndoGroupNotification object:undoManager];
+ }
if ([self delegate] && newDelegate == nil)
[self cleanup];
[super setDelegate:newDelegate];
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