Tiny format tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11265 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-10-28 10:18:50 +00:00
parent dab1ab0c88
commit 90a732eb5a
2 changed files with 103 additions and 86 deletions

View file

@ -38,7 +38,8 @@ static Class defaultCellClass = nil;
+ (void) initialize + (void) initialize
{ {
if (self == [NSForm class]) { if (self == [NSForm class])
{
/* Set the initial version */ /* Set the initial version */
[self setVersion: 1]; [self setVersion: 1];
@ -72,6 +73,7 @@ static Class defaultCellClass = nil;
[self setIntercellSpacing: NSMakeSize (0, 4)]; [self setIntercellSpacing: NSMakeSize (0, 4)];
return self; return self;
} }
- (id) initWithFrame: (NSRect)frameRect - (id) initWithFrame: (NSRect)frameRect
mode: (int)aMode mode: (int)aMode
prototype: (NSCell*)prototype prototype: (NSCell*)prototype

View file

@ -360,8 +360,10 @@ static SEL getSel;
_selectedCells[i][column] = NO; _selectedCells[i][column] = NO;
} }
if (_selectedCell && (_selectedColumn >= column)) if (_selectedCell && (_selectedColumn >= column))
{
_selectedColumn++; _selectedColumn++;
} }
}
/* /*
* Now put the new cells from the array into the matrix. * Now put the new cells from the array into the matrix.
@ -376,7 +378,8 @@ static SEL getSel;
} }
} }
if (_mode == NSRadioModeMatrix && !_allowsEmptySelection && _selectedCell == nil) if (_mode == NSRadioModeMatrix && _allowsEmptySelection == NO
&& _selectedCell == nil)
[self selectCellAtRow: 0 column: 0]; [self selectCellAtRow: 0 column: 0];
} }
@ -460,8 +463,10 @@ static SEL getSel;
if (_mode == NSRadioModeMatrix && !_allowsEmptySelection if (_mode == NSRadioModeMatrix && !_allowsEmptySelection
&& _selectedCell == nil) && _selectedCell == nil)
{
[self selectCellAtRow: 0 column: 0]; [self selectCellAtRow: 0 column: 0];
} }
}
- (NSCell*) makeCellAtRow: (int)row - (NSCell*) makeCellAtRow: (int)row
column: (int)column column: (int)column
@ -497,9 +502,14 @@ static SEL getSel;
rect.origin.x = column * (_cellSize.width + _intercell.width); rect.origin.x = column * (_cellSize.width + _intercell.width);
if (_rFlags.flipped_view) if (_rFlags.flipped_view)
{
rect.origin.y = row * (_cellSize.height + _intercell.height); rect.origin.y = row * (_cellSize.height + _intercell.height);
}
else else
rect.origin.y = (_numRows - row - 1) * (_cellSize.height + _intercell.height); {
rect.origin.y = (_numRows - row - 1)
* (_cellSize.height + _intercell.height);
}
rect.size = _cellSize; rect.size = _cellSize;
return rect; return rect;
} }
@ -523,7 +533,9 @@ static SEL getSel;
if ((row == _selectedRow) && (column == _selectedColumn) if ((row == _selectedRow) && (column == _selectedColumn)
&& (_selectedCell != nil)) && (_selectedCell != nil))
{
_selectedCell = newCell; _selectedCell = newCell;
}
ASSIGN(_cells[row][column], newCell); ASSIGN(_cells[row][column], newCell);
@ -893,7 +905,8 @@ static SEL getSel;
{ {
int i,j; int i,j;
if (!_selectedCell || (!_allowsEmptySelection && (_mode == NSRadioModeMatrix))) if (!_selectedCell
|| (!_allowsEmptySelection && (_mode == NSRadioModeMatrix)))
return; return;
/* /*
@ -995,8 +1008,10 @@ static SEL getSel;
if (lastRow != -1 && lastColumn != -1 if (lastRow != -1 && lastColumn != -1
&& (lastRow != row || lastColumn != column) && (lastRow != row || lastColumn != column)
&& [self window] != nil) && [self window] != nil)
{
[self drawCellAtRow: lastRow column: lastColumn]; [self drawCellAtRow: lastRow column: lastColumn];
} }
}
[_selectedCell setState: NSOnState]; [_selectedCell setState: NSOnState];
@ -3531,6 +3546,7 @@ static SEL getSel;
column: (int)column column: (int)column
{ {
int i,j; int i,j;
if (row > -1) if (row > -1)
{ {
// First look for cells in the same row // First look for cells in the same row
@ -3568,6 +3584,7 @@ static SEL getSel;
column: (int)column column: (int)column
{ {
int i,j; int i,j;
if (row < _numRows) if (row < _numRows)
{ {
// First look for cells in the same row // First look for cells in the same row
@ -3575,8 +3592,7 @@ static SEL getSel;
{ {
if ([_cells[row][j] isEnabled] && [_cells[row][j] isSelectable]) if ([_cells[row][j] isEnabled] && [_cells[row][j] isSelectable])
{ {
_selectedCell = [self selectTextAtRow: row _selectedCell = [self selectTextAtRow: row column: j];
column: j];
_selectedRow = row; _selectedRow = row;
_selectedColumn = j; _selectedColumn = j;
return YES; return YES;
@ -3590,8 +3606,7 @@ static SEL getSel;
{ {
if ([_cells[i][j] isEnabled] && [_cells[i][j] isSelectable]) if ([_cells[i][j] isEnabled] && [_cells[i][j] isSelectable])
{ {
_selectedCell = [self selectTextAtRow: i _selectedCell = [self selectTextAtRow: i column: j];
column: j];
_selectedRow = i; _selectedRow = i;
_selectedColumn = j; _selectedColumn = j;
return YES; return YES;