Revision: 16286
          http://sourceforge.net/p/skim-app/code/16286
Author:   hofman
Date:     2026-05-11 21:34:00 +0000 (Mon, 11 May 2026)
Log Message:
-----------
single note outlineview conveenience method to update rowheights

Modified Paths:
--------------
    trunk/SKMainWindowController_UI.m
    trunk/SKNoteOutlineView.h
    trunk/SKNoteOutlineView.m
    trunk/SKNotesDocument.m

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2026-05-11 21:16:20 UTC (rev 16285)
+++ trunk/SKMainWindowController_UI.m   2026-05-11 21:34:00 UTC (rev 16286)
@@ -945,7 +945,7 @@
     
     if (mwcFlags.autoResizeNoteRows && [[notification object] 
isEqual:rightSideController.noteOutlineView] &&
         [(SKScrollView *)[rightSideController.noteOutlineView 
enclosingScrollView] isResizingSubviews] == NO)
-        [rightSideController.noteOutlineView 
performSelectorOnce:@selector(resetRowHeightsAnimating) afterDelay:0.0];
+        [rightSideController.noteOutlineView 
performSelectorOnce:@selector(updateRowHeights) afterDelay:0.0];
 }
 
 - (void)outlineViewColumnDidMove:(NSNotification *)notification {
@@ -960,7 +960,7 @@
                 break;
         }
         if (oldColumn == firstColumn || newColumn == firstColumn)
-            [rightSideController.noteOutlineView 
performSelectorOnce:@selector(resetRowHeightsAnimating) afterDelay:0.0];
+            [rightSideController.noteOutlineView 
performSelectorOnce:@selector(updateRowHeights) afterDelay:0.0];
     }
 }
 
@@ -1259,7 +1259,7 @@
 - (void)resetHeightOfNoteRows:(id)sender {
     NSArray *items = [sender representedObject];
     if (items == nil) {
-        [rightSideController.noteOutlineView resetRowHeightsAnimating];
+        [rightSideController.noteOutlineView updateRowHeights];
     } else {
         SKNoteOutlineView *ov = rightSideController.noteOutlineView;
         NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
@@ -1325,7 +1325,7 @@
     NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
     NSView *view = [rightSideController.noteOutlineView enclosingScrollView];
     if (mwcFlags.autoResizeNoteRows) {
-        [rightSideController.noteOutlineView resetRowHeightsAnimating];
+        [rightSideController.noteOutlineView updateRowHeights];
         [nc addObserver:self 
selector:@selector(handleNoteViewFrameDidChangeNotification:)
  name:NSViewFrameDidChangeNotification object:view];
         [nc addObserver:self 
selector:@selector(handleNoteViewDidEndLiveResizeNotification:)
@@ -2067,8 +2067,10 @@
         if ([[notification object] inLiveResize]) {
             mwcFlags.noteRowHeightsNeedUpdate = YES;
         } else {
-            [rightSideController.noteOutlineView resetRowHeights];
-            [rightSideController.noteOutlineView 
noteHeightOfRowsChangedAnimating:NO];
+            [NSAnimationContext beginGrouping];
+            [[NSAnimationContext currentContext] setDuration:0.0];
+            [rightSideController.noteOutlineView updateRowHeights];
+            [NSAnimationContext beginGrouping];
         }
     }
 }
@@ -2075,7 +2077,7 @@
 
 - (void)handleNoteViewDidEndLiveResizeNotification:(NSNotification 
*)notification {
     if (mwcFlags.noteRowHeightsNeedUpdate && mwcFlags.autoResizeNoteRows) {
-        [rightSideController.noteOutlineView resetRowHeightsAnimating];
+        [rightSideController.noteOutlineView updateRowHeights];
     }
 }
 

Modified: trunk/SKNoteOutlineView.h
===================================================================
--- trunk/SKNoteOutlineView.h   2026-05-11 21:16:20 UTC (rev 16285)
+++ trunk/SKNoteOutlineView.h   2026-05-11 21:34:00 UTC (rev 16286)
@@ -53,12 +53,10 @@
 
 @property (nonatomic, readonly, getter=isDropping) BOOL dropping;
 
-- (void)noteHeightOfRowsChangedAnimating:(BOOL)animate;
-
 - (CGFloat)rowHeightForItem:(id)item;
 - (void)setRowHeight:(CGFloat)rowHeight forItem:(id)item;
 - (void)resetRowHeights;
-- (void)resetRowHeightsAnimating;
+- (void)updateRowHeights;
 
 @end
 

Modified: trunk/SKNoteOutlineView.m
===================================================================
--- trunk/SKNoteOutlineView.m   2026-05-11 21:16:20 UTC (rev 16285)
+++ trunk/SKNoteOutlineView.m   2026-05-11 21:34:00 UTC (rev 16286)
@@ -103,17 +103,6 @@
     return self;
 }
 
-- (void)noteHeightOfRowsChangedAnimating:(BOOL)animate {
-    if (animate == NO) {
-        [NSAnimationContext beginGrouping];
-        [[NSAnimationContext currentContext] setDuration:0.0];
-    }
-    [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]];
-    if (animate == NO) {
-        [NSAnimationContext endGrouping];
-    }
-}
-
 - (CGFloat)rowHeightForItem:(id)item {
     return (NSInteger)NSMapGet(rowHeights, (__bridge void *)item);
 }
@@ -129,9 +118,9 @@
     [rowHeights removeAllObjects];
 }
 
-- (void)resetRowHeightsAnimating {
-    [self resetRowHeights];
-    [self noteHeightOfRowsChangedAnimating:YES];
+- (void)updateRowHeights {
+    [rowHeights removeAllObjects];
+    [self noteHeightOfRowsWithIndexesChanged:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])]];
 }
 
 - (void)mouseDown:(NSEvent *)theEvent {

Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m     2026-05-11 21:16:20 UTC (rev 16285)
+++ trunk/SKNotesDocument.m     2026-05-11 21:34:00 UTC (rev 16286)
@@ -555,7 +555,7 @@
 - (void)resetHeightOfNoteRows:(id)sender {
     NSArray *items = [sender representedObject];
     if (items == nil) {
-        [outlineView resetRowHeightsAnimating];
+        [outlineView updateRowHeights];
     } else {
         NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
         for (id item in items) {
@@ -570,14 +570,16 @@
 
 - (void)handleScrollViewFrameDidChangeNotification:(NSNotification 
*)notification {
     if (ndFlags.autoResizeRows && [[notification object] inLiveResize] == NO) {
-        [outlineView resetRowHeights];
-        [outlineView noteHeightOfRowsChangedAnimating:NO];
+        [NSAnimationContext beginGrouping];
+        [[NSAnimationContext currentContext] setDuration:0.0];
+        [outlineView updateRowHeights];
+        [NSAnimationContext endGrouping];
     }
 }
 
 - (void)handleScrollViewDidEndLiveResizeNotification:(NSNotification 
*)notification {
     if (ndFlags.autoResizeRows) {
-        [outlineView resetRowHeightsAnimating];
+        [outlineView updateRowHeights];
     }
 }
 
@@ -586,7 +588,7 @@
     NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
     NSView *view = [outlineView enclosingScrollView];
     if (ndFlags.autoResizeRows) {
-        [outlineView resetRowHeightsAnimating];
+        [outlineView updateRowHeights];
         [nc addObserver:self 
selector:@selector(handleScrollViewFrameDidChangeNotification:)
  name:NSViewFrameDidChangeNotification object:view];
         [nc addObserver:self 
selector:@selector(handleScrollViewDidEndLiveResizeNotification:)
@@ -735,7 +737,7 @@
 
 - (void)outlineViewColumnDidResize:(NSNotification *)notification{
     if (ndFlags.autoResizeRows && [(SKScrollView *)[[notification object] 
enclosingScrollView] isResizingSubviews] == NO)
-        [outlineView performSelectorOnce:@selector(resetRowHeightsAnimating) 
afterDelay:0.0];
+        [outlineView performSelectorOnce:@selector(updateRowHeights) 
afterDelay:0.0];
 }
 
 - (void)outlineViewColumnDidMove:(NSNotification *)notification {
@@ -750,7 +752,7 @@
                 break;
         }
         if (oldColumn == firstColumn || newColumn == firstColumn)
-            [outlineView 
performSelectorOnce:@selector(resetRowHeightsAnimating) afterDelay:0.0];
+            [outlineView performSelectorOnce:@selector(updateRowHeights) 
afterDelay:0.0];
     }
 }
 

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