3100 |
if (_textObject) |
if (_textObject) |
3101 |
{ |
{ |
3102 |
[_editedCell endEditing: _textObject]; |
[_editedCell endEditing: _textObject]; |
3103 |
RELEASE (_editedCell); |
DESTROY(_editedCell); |
3104 |
[self setNeedsDisplayInRect: |
[self setNeedsDisplayInRect: |
3105 |
[self frameOfCellAtColumn: _editedColumn row: _editedRow]]; |
[self frameOfCellAtColumn: _editedColumn row: _editedRow]]; |
3106 |
_editedRow = -1; |
_editedRow = -1; |
3107 |
_editedColumn = -1; |
_editedColumn = -1; |
|
_editedCell = nil; |
|
3108 |
_textObject = nil; |
_textObject = nil; |
3109 |
return YES; |
return YES; |
3110 |
} |
} |
3374 |
{ |
{ |
3375 |
// It is OK to edit column. Go on, do it. |
// It is OK to edit column. Go on, do it. |
3376 |
[self editColumn: _clickedColumn row: _clickedRow |
[self editColumn: _clickedColumn row: _clickedRow |
3377 |
withEvent: theEvent select: NO]; |
withEvent: theEvent select: YES]; |
3378 |
} |
} |
3379 |
} |
} |
3380 |
else |
else |
3448 |
|
|
3449 |
// let's sort the _selectedRows |
// let's sort the _selectedRows |
3450 |
oldSelectedRows = [_selectedRows copy]; |
oldSelectedRows = [_selectedRows copy]; |
|
|
|
3451 |
mouseLocationView = location; |
mouseLocationView = location; |
3452 |
lastEvent = theEvent; |
lastEvent = theEvent; |
3453 |
|
|
3454 |
if ([self mouse: mouseLocationView inRect: _bounds]) |
if ([self mouse: mouseLocationView inRect: _bounds]) |
3455 |
{ |
{ |
3456 |
NSTableColumn *tb; |
NSTableColumn *tb; |
3457 |
NSCell *cell; |
NSCell *cell; |
3458 |
NSRect cellFrame; |
NSRect cellFrame; |
3459 |
int actionMaskForCurrentEvent; |
id originalValue; |
3460 |
|
|
|
switch ([lastEvent type]) |
|
|
{ |
|
|
case NSLeftMouseDown: |
|
|
actionMaskForCurrentEvent = NSLeftMouseDownMask |
|
|
| NSLeftMouseUpMask |
|
|
| NSLeftMouseDraggedMask; |
|
|
break; |
|
|
case NSRightMouseDown: |
|
|
actionMaskForCurrentEvent = NSRightMouseDownMask |
|
|
| NSRightMouseUpMask |
|
|
| NSRightMouseDraggedMask; |
|
|
break; |
|
|
case NSOtherMouseDown: |
|
|
actionMaskForCurrentEvent = NSOtherMouseDownMask |
|
|
| NSOtherMouseUpMask |
|
|
| NSOtherMouseDraggedMask; |
|
|
break; |
|
|
default: |
|
|
/* Can't happen */ |
|
|
actionMaskForCurrentEvent = -1; |
|
|
break; |
|
|
} |
|
|
|
|
3461 |
// Prepare the cell |
// Prepare the cell |
3462 |
tb = [_tableColumns objectAtIndex: _clickedColumn]; |
tb = [_tableColumns objectAtIndex: _clickedColumn]; |
3463 |
cell = [tb dataCellForRow: _clickedRow]; |
cell = [[tb dataCellForRow: _clickedRow] copy]; |
3464 |
if ([cell _sendsActionOn: actionMaskForCurrentEvent]) |
originalValue = RETAIN([self _objectValueForTableColumn:tb row:_clickedRow]); |
3465 |
{ |
[cell setObjectValue: originalValue]; |
3466 |
[cell setObjectValue: [self _objectValueForTableColumn: tb |
cellFrame = [self frameOfCellAtColumn: _clickedColumn |
|
row: _clickedRow]]; |
|
|
cellFrame = [self frameOfCellAtColumn: _clickedColumn |
|
3467 |
row: _clickedRow]; |
row: _clickedRow]; |
3468 |
[cell setHighlighted: YES]; |
[cell setHighlighted: YES]; |
3469 |
[self setNeedsDisplayInRect: cellFrame]; |
[self setNeedsDisplayInRect: cellFrame]; |
3470 |
/* give delegate a chance to i.e set target */ |
/* give delegate a chance to i.e set target */ |
3471 |
[self _willDisplayCell: cell |
[self _willDisplayCell: cell |
3472 |
forTableColumn: tb |
forTableColumn: tb |
3473 |
row: _clickedRow]; |
row: _clickedRow]; |
3474 |
if ([cell trackMouse: lastEvent |
if ([cell trackMouse: lastEvent |
3475 |
inRect: cellFrame |
inRect: cellFrame |
3476 |
ofView: self |
ofView: self |
3477 |
untilMouseUp: [[cell class] prefersTrackingUntilMouseUp]]) |
untilMouseUp: [[cell class] prefersTrackingUntilMouseUp]]) |
3478 |
|
{ |
3479 |
|
id newValue = [cell objectValue]; |
3480 |
|
|
3481 |
|
if ([tb isEditable] && ![originalValue isEqual: newValue]) |
3482 |
{ |
{ |
3483 |
if ([tb isEditable]) |
[self _setObjectValue: newValue |
3484 |
{ |
forTableColumn: tb |
3485 |
[self _setObjectValue: [cell objectValue] |
row: _clickedRow]; |
3486 |
forTableColumn: tb |
} |
3487 |
row: _clickedRow]; |
done = YES; |
3488 |
} |
currentRow = _clickedRow; |
3489 |
done = YES; |
computeNewSelection(self, |
3490 |
currentRow = _clickedRow; |
oldSelectedRows, |
3491 |
computeNewSelection(self, |
_selectedRows, |
3492 |
oldSelectedRows, |
originalRow, |
3493 |
_selectedRows, |
oldRow, |
3494 |
originalRow, |
currentRow, |
3495 |
oldRow, |
&_selectedRow, |
3496 |
currentRow, |
selectionMode); |
|
&_selectedRow, |
|
|
selectionMode); |
|
|
} |
|
|
|
|
|
[cell setHighlighted: NO]; |
|
|
[self setNeedsDisplayInRect: cellFrame]; |
|
|
lastEvent = [NSApp currentEvent]; |
|
3497 |
} |
} |
3498 |
|
RELEASE(originalValue); |
3499 |
|
[cell setHighlighted: NO]; |
3500 |
|
RELEASE(cell); |
3501 |
|
[self setNeedsDisplayInRect: cellFrame]; |
3502 |
|
lastEvent = [NSApp currentEvent]; |
3503 |
} |
} |
3504 |
|
|
3505 |
while (done != YES) |
while (done != YES) |