Add code to track if a view has been rendered, fix issue with duplication of the view, I am not sure if this method of tracking that the view has been rendered is correct, but it works for now

This commit is contained in:
Gregory John Casamento 2024-02-13 08:32:35 -05:00
parent 20f29b2d1d
commit a73c3cc876
3 changed files with 22 additions and 0 deletions

View file

@ -185,7 +185,10 @@ APPKIT_EXPORT_CLASS
NSDragOperation _draggingSourceOperationMaskForRemote;
NSInteger _beginEndUpdates;
/* Supporting ivars for view based tables */
BOOL _viewBased;
NSMutableArray *_renderedViewPaths;
}
/* Data Source */

View file

@ -78,6 +78,7 @@
row: (NSInteger)index;
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
row: (NSInteger)index;
- (NSMutableArray *) _renderedViewPaths;
@end
@interface NSTableColumn (Private)
@ -3539,7 +3540,17 @@ static NSDictionary *titleTextAttributes[3] = {nil, nil, nil};
frameOfCellAtColumn: i
row: rowIndex];
NSTableColumn *tb = nil;
NSIndexPath *path = [NSIndexPath indexPathForItem: i
inSection: rowIndex];
NSMutableArray *paths = [tableView _renderedViewPaths];
// If the path has been rendered, move on...
if ([paths containsObject: path])
continue;
// Store the path...
[paths addObject: path];
// drawingRect.origin.y += headerHeight;
tb = [tableColumns objectAtIndex: i];
if (hasMethod)

View file

@ -2044,7 +2044,9 @@ static void computeNewSelection
| NSDragOperationLink | NSDragOperationGeneric | NSDragOperationPrivate;
_draggingSourceOperationMaskForRemote = NSDragOperationNone;
ASSIGN(_sortDescriptors, [NSArray array]);
_viewBased = NO;
_renderedViewPaths = [[NSMutableArray alloc] init];
}
- (id) initWithFrame: (NSRect)frameRect
@ -2076,6 +2078,7 @@ static void computeNewSelection
RELEASE (_selectedColumns);
RELEASE (_selectedRows);
RELEASE (_sortDescriptors);
RELEASE (_renderedViewPaths);
TEST_RELEASE (_headerView);
TEST_RELEASE (_cornerView);
if (_autosaveTableColumns == YES)
@ -7087,4 +7090,9 @@ For a more detailed explanation, -setSortDescriptors:. */
}
}
- (NSMutableArray *) _renderedViewPaths
{
return _renderedViewPaths;
}
@end