Revision: 15593
http://sourceforge.net/p/skim-app/code/15593
Author: hofman
Date: 2025-07-03 09:33:54 +0000 (Thu, 03 Jul 2025)
Log Message:
-----------
let pdfview observe undomanager notifications
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKPDFView.h
trunk/SKPDFView.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2025-07-03 09:23:10 UTC (rev 15592)
+++ trunk/SKMainWindowController_UI.m 2025-07-03 09:33:54 UTC (rev 15593)
@@ -2095,10 +2095,6 @@
undoGroupOldPropertiesPerNote = nil;
}
-- (void)handleOpenOrCloseUndoGroupNotification:(NSNotification *)notification {
- [pdfView undoManagerDidOpenOrCloseUndoGroup];
-}
-
#pragma mark Observer registration
- (void)registerForNotifications {
@@ -2117,13 +2113,8 @@
[nc addObserver:self
selector:@selector(handleReadingBarDidChangeNotification:)
name:SKPDFViewReadingBarDidChangeNotification
object:pdfView];
// UndoManager
- NSUndoManager *undoManager = [[self document] undoManager];
[nc addObserver:self selector:@selector(observeUndoManagerCheckpoint:)
- name:NSUndoManagerCheckpointNotification
object:undoManager];
- [nc addObserver:self
selector:@selector(handleOpenOrCloseUndoGroupNotification:)
- name:NSUndoManagerDidOpenUndoGroupNotification
object:undoManager];
- [nc addObserver:self
selector:@selector(handleOpenOrCloseUndoGroupNotification:)
- name:NSUndoManagerDidCloseUndoGroupNotification
object:undoManager];
+ name:NSUndoManagerCheckpointNotification
object:[[self document] undoManager]];
// SKDocumentController
[nc addObserver:self
selector:@selector(handleWillRemoveDocumentNotification:)
name:SKDocumentControllerWillRemoveDocumentNotification object:nil];
Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h 2025-07-03 09:23:10 UTC (rev 15592)
+++ trunk/SKPDFView.h 2025-07-03 09:33:54 UTC (rev 15593)
@@ -253,8 +253,6 @@
- (nullable NSString *)currentColorDefaultKeyForAlternate:(BOOL)isAlt;
-- (void)undoManagerDidOpenOrCloseUndoGroup;
-
- (void)updatedAnnotation:(PDFAnnotation *)annotation forKey:(nullable
NSString *)key fromValue:(nullable id)oldValue;
- (void)setNeedsDisplayInRect:(NSRect)rect ofPage:(PDFPage *)page;
Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m 2025-07-03 09:23:10 UTC (rev 15592)
+++ trunk/SKPDFView.m 2025-07-03 09:33:54 UTC (rev 15593)
@@ -243,6 +243,7 @@
- (void)handlePageChangedNotification:(NSNotification *)notification;
- (void)handleScaleChangedNotification:(NSNotification *)notification;
- (void)handleUpdateTrackingAreasNotification:(NSNotification *)notification;
+- (void)handleOpenOrCloseUndoGroupNotification:(NSNotification *)notification;
- (void)registerForDocumentNotifications;
- (void)unregisterForDocumentNotifications;
@@ -3233,7 +3234,7 @@
[self setTemporaryToolMode:SKToolModeNone];
}
-- (void)undoManagerDidOpenOrCloseUndoGroup {
+- (void)handleOpenOrCloseUndoGroupNotification:(NSNotification *)notification {
wantsNewUndoGroup = NO;
}
@@ -5151,6 +5152,11 @@
if (newDelegate == nil)
[self cleanup];
[super setDelegate:newDelegate];
+ if (newDelegate) {
+ NSUndoManager *undoManager = [self undoManager];
+ [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleOpenOrCloseUndoGroupNotification:)
name:NSUndoManagerDidOpenUndoGroupNotification object:undoManager];
+ [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleOpenOrCloseUndoGroupNotification:)
name:NSUndoManagerDidCloseUndoGroupNotification object:undoManager];
+ }
}
- (NSString *)currentColorDefaultKeyForAlternate:(BOOL)isAlt {
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