mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 16:11:56 +00:00
Restore the selected cells in reload column
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9046 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c52757aa8e
commit
56ccc9e5e7
1 changed files with 41 additions and 0 deletions
|
@ -1024,6 +1024,10 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
||||||
- (void)reloadColumn: (int)column
|
- (void)reloadColumn: (int)column
|
||||||
{
|
{
|
||||||
id bc;
|
id bc;
|
||||||
|
NSArray *selectedCells;
|
||||||
|
NSMatrix *matrix;
|
||||||
|
int i, count, max;
|
||||||
|
int *selectedIndexes = NULL;
|
||||||
|
|
||||||
#if defined NSBTRACE_reloadColumn || defined NSBTRACE_all
|
#if defined NSBTRACE_reloadColumn || defined NSBTRACE_all
|
||||||
fprintf(stderr, "NSBrowser - (void)reloadColumn: %d\n", column);
|
fprintf(stderr, "NSBrowser - (void)reloadColumn: %d\n", column);
|
||||||
|
@ -1049,10 +1053,47 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save the index of the previously selected cells
|
||||||
|
matrix = [self matrixInColumn: column];
|
||||||
|
selectedCells = [matrix selectedCells];
|
||||||
|
count = [selectedCells count];
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
selectedIndexes = NSZoneMalloc (NSDefaultMallocZone (),
|
||||||
|
sizeof (int) * count);
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
NSCell *cell = [selectedCells objectAtIndex: i];
|
||||||
|
int sRow, sColumn;
|
||||||
|
|
||||||
|
[matrix getRow: &sRow column: &sColumn ofCell: cell];
|
||||||
|
selectedIndexes[i] = sRow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Perform the data load
|
// Perform the data load
|
||||||
[self _performLoadOfColumn: column];
|
[self _performLoadOfColumn: column];
|
||||||
[self _adjustMatrixOfColumn: column];
|
[self _adjustMatrixOfColumn: column];
|
||||||
|
|
||||||
|
// Restore the selected cells
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
matrix = [self matrixInColumn: column];
|
||||||
|
max = [matrix numberOfRows];
|
||||||
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
// Abort when it stops making sense
|
||||||
|
if (selectedIndexes[i] > max)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
[matrix selectCellAtRow: selectedIndexes[i] column: 0];
|
||||||
|
}
|
||||||
|
NSZoneFree (NSDefaultMallocZone (), selectedIndexes);
|
||||||
|
}
|
||||||
|
|
||||||
// set last column loaded
|
// set last column loaded
|
||||||
[self setLastColumn: column];
|
[self setLastColumn: column];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue