Ivar type change on NSTableView and selection cleanup.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18929 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
FredKiefer 2004-03-27 17:48:00 +00:00
parent e05da2217a
commit 94fdd2a17c
4 changed files with 765 additions and 1668 deletions

View file

@ -1,3 +1,12 @@
2004-03-27 Fred Kiefer <FredKiefer@gmx.de>
* Header/AppKit/NSTableView.h:
Added ivars _selectedColumns and _selectedRows to NSMutableIndexSet.
* Source/NSTableView.m:
* Source/NSOutlineView.m:
Chnaged all the uses of these ivars and started to restructure the
row selection code. Also removed some (not all) dead code.
2004-03-23 23:52 Alexander Malmberg <alexander@malmberg.org> 2004-03-23 23:52 Alexander Malmberg <alexander@malmberg.org>
* Headers/Additions/GNUstepGUI/GSToolbar.h, * Headers/Additions/GNUstepGUI/GSToolbar.h,

View file

@ -35,6 +35,7 @@
@class NSArray; @class NSArray;
@class NSIndexSet; @class NSIndexSet;
@class NSMutableIndexSet;
@class NSTableColumn; @class NSTableColumn;
@class NSTableHeaderView; @class NSTableHeaderView;
@class NSText; @class NSText;
@ -72,8 +73,8 @@ enum {
int _clickedRow; int _clickedRow;
int _clickedColumn; int _clickedColumn;
NSTableColumn *_highlightedTableColumn; NSTableColumn *_highlightedTableColumn;
NSMutableArray *_selectedColumns; NSMutableIndexSet *_selectedColumns;
NSMutableArray *_selectedRows; NSMutableIndexSet *_selectedRows;
int _selectedColumn; int _selectedColumn;
int _selectedRow; int _selectedRow;
BOOL _allowsMultipleSelection; BOOL _allowsMultipleSelection;

View file

@ -31,6 +31,7 @@
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
#include <Foundation/NSException.h> #include <Foundation/NSException.h>
#include <Foundation/NSIndexSet.h>
#include <Foundation/NSMapTable.h> #include <Foundation/NSMapTable.h>
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSNull.h> #include <Foundation/NSNull.h>
@ -350,7 +351,7 @@ static NSImage *unexpandable = nil;
if([self isExpandable: item] && [self isItemExpanded: item] && canCollapse) if([self isExpandable: item] && [self isItemExpanded: item] && canCollapse)
{ {
NSMutableDictionary *infoDict = [NSMutableDictionary dictionary]; NSMutableDictionary *infoDict = [NSMutableDictionary dictionary];
int i, count, row; unsigned int row;
[infoDict setObject: item forKey: @"NSObject"]; [infoDict setObject: item forKey: @"NSObject"];
@ -362,16 +363,14 @@ static NSImage *unexpandable = nil;
// We save the selection // We save the selection
[_selectedItems removeAllObjects]; [_selectedItems removeAllObjects];
count = [_selectedRows count]; row = [_selectedRows firstIndex];
while (row != NSNotFound)
for (i = 0; i < count; i++) {
{
row = [[_selectedRows objectAtIndex: i] intValue];
if ([self itemAtRow: row]) if ([self itemAtRow: row])
{ {
[_selectedItems addObject: [self itemAtRow: row]]; [_selectedItems addObject: [self itemAtRow: row]];
} }
row = [_selectedRows indexGreaterThanIndex: row];
} }
// collapse... // collapse...
@ -439,7 +438,7 @@ static NSImage *unexpandable = nil;
if(![self isItemExpanded: item] && canExpand) if(![self isItemExpanded: item] && canExpand)
{ {
NSMutableDictionary *infoDict = [NSMutableDictionary dictionary]; NSMutableDictionary *infoDict = [NSMutableDictionary dictionary];
int i, count, row; unsigned int row;
[infoDict setObject: item forKey: @"NSObject"]; [infoDict setObject: item forKey: @"NSObject"];
@ -451,16 +450,14 @@ static NSImage *unexpandable = nil;
// We save the selection // We save the selection
[_selectedItems removeAllObjects]; [_selectedItems removeAllObjects];
count = [_selectedRows count]; row = [_selectedRows firstIndex];
while (row != NSNotFound)
for (i = 0; i < count; i++)
{ {
row = [[_selectedRows objectAtIndex: i] intValue];
if ([self itemAtRow: row]) if ([self itemAtRow: row])
{ {
[_selectedItems addObject: [self itemAtRow: row]]; [_selectedItems addObject: [self itemAtRow: row]];
} }
row = [_selectedRows indexGreaterThanIndex: row];
} }
// insert the root element, if necessary otherwise insert the // insert the root element, if necessary otherwise insert the
@ -745,7 +742,7 @@ static NSImage *unexpandable = nil;
int i, count, row; int i, count, row;
/* We restore the selection */ /* We restore the selection */
[_selectedRows removeAllObjects]; [_selectedRows removeAllIndexes];
count = [_selectedItems count]; count = [_selectedItems count];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -754,7 +751,7 @@ static NSImage *unexpandable = nil;
if (row >= 0 && row < _numberOfRows) if (row >= 0 && row < _numberOfRows)
{ {
[_selectedRows addObject: [NSNumber numberWithInt: row]]; [_selectedRows addIndex: row];
} }
} }
} }

File diff suppressed because it is too large Load diff