Revision: 16209
http://sourceforge.net/p/skim-app/code/16209
Author: hofman
Date: 2026-05-03 17:37:15 +0000 (Sun, 03 May 2026)
Log Message:
-----------
just do no autosize of note row heights during live resize, add a custom
notification on viewDidEndLiveResize in our scroll view to do the delayed auto
resizing
Modified Paths:
--------------
trunk/SKMainWindowController_UI.m
trunk/SKNotesDocument.m
trunk/SKScrollView.h
trunk/SKScrollView.m
Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m 2026-05-03 16:02:55 UTC (rev 16208)
+++ trunk/SKMainWindowController_UI.m 2026-05-03 17:37:15 UTC (rev 16209)
@@ -138,6 +138,7 @@
@interface SKMainWindowController (UIPrivate)
- (void)changeColorProperty:(id)sender;
- (void)handleNoteViewFrameDidChangeNotification:(NSNotification
*)notification;
+- (void)handleNoteViewDidEndLiveResizeNotification:(NSNotification
*)notification;
@end
#pragma mark -
@@ -1274,14 +1275,20 @@
- (void)toggleAutoResizeNoteRows:(id)sender {
mwcFlags.autoResizeNoteRows = (0 == mwcFlags.autoResizeNoteRows);
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ NSView *view = [rightSideController.noteOutlineView enclosingScrollView];
if (mwcFlags.autoResizeNoteRows) {
[self resetNoteRowHeights];
- [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleNoteViewFrameDidChangeNotification:)
- name:NSViewFrameDidChangeNotification
object:[rightSideController.noteOutlineView enclosingScrollView]];
+ [nc addObserver:self
selector:@selector(handleNoteViewFrameDidChangeNotification:)
+ name:NSViewFrameDidChangeNotification object:view];
+ [nc addObserver:self
selector:@selector(handleNoteViewDidEndLiveResizeNotification:)
+ name:SKScrollViewDidEndLiveResizeNotification object:view];
} else {
[self autoSizeNoteRows:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self
- name:NSViewFrameDidChangeNotification
object:[rightSideController.noteOutlineView enclosingScrollView]];
+ [nc removeObserver:self
+ name:NSViewFrameDidChangeNotification object:view];
+ [nc removeObserver:self
+ name:SKScrollViewDidEndLiveResizeNotification object:view];
}
}
@@ -2017,13 +2024,15 @@
}
- (void)handleNoteViewFrameDidChangeNotification:(NSNotification
*)notification {
+ if (mwcFlags.autoResizeNoteRows && [[notification object] inLiveResize] ==
NO) {
+ [rightSideController.noteOutlineView resetRowHeights];
+ [rightSideController.noteOutlineView
noteHeightOfRowsChangedAnimating:NO];
+ }
+}
+
+- (void)handleNoteViewDidEndLiveResizeNotification:(NSNotification
*)notification {
if (mwcFlags.autoResizeNoteRows) {
- if ([[notification object] inLiveResize]) {
- [self performSelectorOnce:@selector(resetNoteRowHeights)
afterDelay:0.0];
- } else {
- [rightSideController.noteOutlineView resetRowHeights];
- [rightSideController.noteOutlineView
noteHeightOfRowsChangedAnimating:NO];
- }
+ [self resetNoteRowHeights];
}
}
Modified: trunk/SKNotesDocument.m
===================================================================
--- trunk/SKNotesDocument.m 2026-05-03 16:02:55 UTC (rev 16208)
+++ trunk/SKNotesDocument.m 2026-05-03 17:37:15 UTC (rev 16209)
@@ -192,22 +192,6 @@
[self saveRecentDocumentInfo];
}
-- (void)resetRowHeights {
- [outlineView resetRowHeights];
- [outlineView noteHeightOfRowsChangedAnimating:YES];
-}
-
-- (void)windowDidResize:(NSNotification *)notification {
- if (ndFlags.autoResizeRows) {
- if ([[[notification object] contentView] inLiveResize]) {
- [self performSelectorOnce:@selector(resetRowHeights)
afterDelay:0.0];
- } else {
- [outlineView resetRowHeights];
- [outlineView noteHeightOfRowsChangedAnimating:NO];
- }
- }
-}
-
- (NSArray *)writableTypesForSaveOperation:(NSSaveOperationType)saveOperation {
NSArray *writableTypes = [super
writableTypesForSaveOperation:saveOperation];
if (saveOperation == NSSaveToOperation) {
@@ -568,10 +552,15 @@
[outlineView noteHeightOfRowsWithIndexesChanged:rowIndexes ?: [NSIndexSet
indexSetWithIndexesInRange:NSMakeRange(0, [outlineView numberOfRows])]];
}
+- (void)resetRowHeights {
+ [outlineView resetRowHeights];
+ [outlineView noteHeightOfRowsChangedAnimating:YES];
+}
+
- (void)resetHeightOfNoteRows:(id)sender {
NSArray *items = [sender representedObject];
if (items == nil) {
- [self resetRowHeights];
+ [self resetRowHeights];
} else {
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSet];
for (id item in items) {
@@ -584,12 +573,36 @@
}
}
+- (void)handleScrollViewFrameDidChangeNotification:(NSNotification
*)notification {
+ if (ndFlags.autoResizeRows && [[notification object] inLiveResize] == NO) {
+ [outlineView resetRowHeights];
+ [outlineView noteHeightOfRowsChangedAnimating:NO];
+ }
+}
+
+- (void)handleScrollViewDidEndLiveResizeNotification:(NSNotification
*)notification {
+ if (ndFlags.autoResizeRows) {
+ [self resetRowHeights];
+ }
+}
+
- (void)toggleAutoResizeNoteRows:(id)sender {
ndFlags.autoResizeRows = (0 == ndFlags.autoResizeRows);
- if (ndFlags.autoResizeRows)
- [self resetRowHeights];
- else
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ NSView *view = [outlineView enclosingScrollView];
+ if (ndFlags.autoResizeRows) {
+ [self resetRowHeights];
+ [nc addObserver:self
selector:@selector(handleScrollViewFrameDidChangeNotification:)
+ name:NSViewFrameDidChangeNotification object:view];
+ [nc addObserver:self
selector:@selector(handleScrollViewDidEndLiveResizeNotification:)
+ name:SKScrollViewDidEndLiveResizeNotification object:view];
+ } else {
[self autoSizeNoteRows:nil];
+ [nc removeObserver:self
+ name:NSViewFrameDidChangeNotification object:view];
+ [nc removeObserver:self
+ name:SKScrollViewDidEndLiveResizeNotification object:view];
+ }
}
- (IBAction)toggleCaseInsensitiveSearch:(id)sender {
@@ -735,7 +748,7 @@
NSInteger oldColumn = [[[notification userInfo]
objectForKey:@"NSOldColumn"] integerValue];
NSInteger newColumn = [[[notification userInfo]
objectForKey:@"NSNewColumn"] integerValue];
if (oldColumn == 0 || newColumn == 0)
- [self performSelectorOnce:@selector(resetRowHeights)
afterDelay:0.0];
+ [self performSelectorOnce:@selector(resetRowHeights)
afterDelay:0.0];
}
}
Modified: trunk/SKScrollView.h
===================================================================
--- trunk/SKScrollView.h 2026-05-03 16:02:55 UTC (rev 16208)
+++ trunk/SKScrollView.h 2026-05-03 17:37:15 UTC (rev 16209)
@@ -40,6 +40,8 @@
NS_ASSUME_NONNULL_BEGIN
+extern NSNotificationName const SKScrollViewDidEndLiveResizeNotification;
+
@interface SKScrollView : NSScrollView {
BOOL resizingSubviews;
}
Modified: trunk/SKScrollView.m
===================================================================
--- trunk/SKScrollView.m 2026-05-03 16:02:55 UTC (rev 16208)
+++ trunk/SKScrollView.m 2026-05-03 17:37:15 UTC (rev 16209)
@@ -38,6 +38,7 @@
#import "SKScrollView.h"
+NSNotificationName const SKScrollViewDidEndLiveResizeNotification =
@"SKScrollViewDidEndLiveResizeNotification";
@implementation SKScrollView
@@ -49,4 +50,9 @@
resizingSubviews = NO;
}
+- (void)viewDidEndLiveResize {
+ [super viewDidEndLiveResize];
+ [[NSNotificationCenter defaultCenter]
postNotificationName:SKScrollViewDidEndLiveResizeNotification object:self];
+}
+
@end
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