From 6cf789288ef2e42460d011f2bb7d7a81f9f99a55 Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 8 Nov 2001 22:49:56 +0000 Subject: [PATCH] Replaced inefficient call to [matrix sizeToFit] with much more efficient determination of the browsercell height git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11348 72102866-910b-0410-8b05-ffd578937521 --- Source/NSBrowser.m | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Source/NSBrowser.m b/Source/NSBrowser.m index f8acc536e..3f48aec24 100644 --- a/Source/NSBrowser.m +++ b/Source/NSBrowser.m @@ -2896,21 +2896,17 @@ static double rint(double a) if (_passiveDelegate || [_browserDelegate respondsToSelector: @selector(browser:willDisplayCell:atRow:column:)]) { - SEL sel1 = - @selector(browser:willDisplayCell:atRow:column:); - IMP imp1 = - [_browserDelegate methodForSelector: sel1]; - SEL sel2 = - @selector(cellAtRow:column:); - IMP imp2 = - [matrix methodForSelector: sel2]; + SEL sel1 = @selector(browser:willDisplayCell:atRow:column:); + IMP imp1 = [_browserDelegate methodForSelector: sel1]; + SEL sel2 = @selector(cellAtRow:column:); + IMP imp2 = [matrix methodForSelector: sel2]; for (i = 0; i < n; i++) { aCell = (*imp2)(matrix, sel2, i, 0); if (![aCell isLoaded]) { - (*imp1)(_browserDelegate, sel1, - self, aCell, i, column); + (*imp1)(_browserDelegate, sel1, self, aCell, i, + column); [aCell setLoaded: YES]; } } @@ -2961,7 +2957,17 @@ static double rint(double a) } } - [matrix sizeToFit]; + /* Determine the height of a cell in the matrix, and set that as the + cellSize of the matrix. */ + { + NSBrowserCell *b = [matrix cellAtRow: 0 column: 0]; + + if (b != nil) + { + [matrix setCellSize: [b cellSize]]; + } + } + [sc setNeedsDisplay: YES]; [bc setIsLoaded: YES]; }