Revision: 15567
          http://sourceforge.net/p/skim-app/code/15567
Author:   hofman
Date:     2025-06-29 16:38:51 +0000 (Sun, 29 Jun 2025)
Log Message:
-----------
observe view changes only when we care about it

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2025-06-29 16:20:01 UTC (rev 15566)
+++ trunk/SKMainWindowController_UI.m   2025-06-29 16:38:51 UTC (rev 15567)
@@ -138,6 +138,7 @@
 
 @interface SKMainWindowController (UIPrivate)
 - (void)changeColorProperty:(id)sender;
+- (void)handleNoteViewFrameDidChangeNotification:(NSNotification 
*)notification;
 @end
 
 #pragma mark -
@@ -1199,10 +1200,15 @@
 
 - (void)toggleAutoResizeNoteRows:(id)sender {
     mwcFlags.autoResizeNoteRows = (0 == mwcFlags.autoResizeNoteRows);
-    if (mwcFlags.autoResizeNoteRows)
+    if (mwcFlags.autoResizeNoteRows) {
         [self resetNoteRowHeights];
-    else
+        [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleNoteViewFrameDidChangeNotification:)
+ name:NSViewFrameDidChangeNotification 
object:[rightSideController.noteOutlineView enclosingScrollView]];
+    } else {
         [self autoSizeNoteRows:nil];
+        [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:NSViewFrameDidChangeNotification 
object:[rightSideController.noteOutlineView enclosingScrollView]];
+    }
 }
 
 - (void)menuNeedsUpdate:(NSMenu *)menu {
@@ -2110,9 +2116,6 @@
                              
name:SKPDFViewCurrentAnnotationChangedNotification object:pdfView];
     [nc addObserver:self 
selector:@selector(handleReadingBarDidChangeNotification:) 
                              name:SKPDFViewReadingBarDidChangeNotification 
object:pdfView];
-    // View
-    [nc addObserver:self 
selector:@selector(handleNoteViewFrameDidChangeNotification:) 
-                             name:NSViewFrameDidChangeNotification 
object:[rightSideController.noteOutlineView enclosingScrollView]];
     //  UndoManager
     NSUndoManager *undoManager = [[self document] undoManager];
     [nc addObserver:self selector:@selector(observeUndoManagerCheckpoint:)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to