Merge GUI code with main branch revision 40273 - NSTableView{hm] GSFontInfo.m NSColorWell.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40274 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2016-12-22 17:14:27 +00:00
parent 8736e0b0d6
commit 49bf74a798
4 changed files with 224 additions and 209 deletions

View file

@ -102,7 +102,7 @@ typedef enum _NSTableViewAnimationOptions
NSColor *_gridColor;
NSColor *_backgroundColor;
NSTableViewSelectionHighlightStyle _selectionHighlightStyle;
float _rowHeight;
CGFloat _rowHeight;
NSSize _intercellSpacing;
id _delegate;
NSTableHeaderView *_headerView;
@ -110,13 +110,13 @@ typedef enum _NSTableViewAnimationOptions
SEL _action;
SEL _doubleAction;
id _target;
int _clickedRow;
int _clickedColumn;
NSInteger _clickedRow;
NSInteger _clickedColumn;
NSTableColumn *_highlightedTableColumn;
NSMutableIndexSet *_selectedColumns;
NSMutableIndexSet *_selectedRows;
int _selectedColumn;
int _selectedRow;
NSInteger _selectedColumn;
NSInteger _selectedRow;
BOOL _allowsMultipleSelection;
BOOL _allowsEmptySelection;
BOOL _allowsColumnSelection;
@ -125,15 +125,15 @@ typedef enum _NSTableViewAnimationOptions
BOOL _autoresizesAllColumnsToFit;
BOOL _selectingColumns;
NSText *_textObject;
int _editedRow;
int _editedColumn;
NSInteger _editedRow;
NSInteger _editedColumn;
NSCell *_editedCell;
BOOL _autosaveTableColumns;
NSString *_autosaveName;
BOOL _verticalMotionDrag;
NSArray *_sortDescriptors;
NSTableViewColumnAutoresizingStyle _columnAutoresizingStyle;
/*
* Ivars Acting as Control...
*/
@ -142,9 +142,9 @@ typedef enum _NSTableViewAnimationOptions
/*
* Ivars Acting as Cache
*/
BOOL _reloadNumberOfRows;
int _numberOfRows;
int _numberOfColumns;
BOOL _reloadNumberOfRows;
NSInteger _numberOfRows;
NSInteger _numberOfColumns;
/* YES if _delegate responds to
tableView:willDisplayCell:forTableColumn:row: */
BOOL _del_responds;
@ -163,7 +163,7 @@ typedef enum _NSTableViewAnimationOptions
* We keep the superview's width in order to know when to
* size the last column to fit
*/
float _superview_width;
CGFloat _superview_width;
/* if YES [which happens only during a sizeToFit], we are doing
computations on sizes so we ignore tile (produced for example by
@ -175,7 +175,6 @@ typedef enum _NSTableViewAnimationOptions
NSDragOperation _draggingSourceOperationMaskForRemote;
NSInteger _beginEndUpdates;
NSTableViewGridLineStyle _gridStyleMask;
}
@ -373,16 +372,16 @@ typedef enum _NSTableViewAnimationOptions
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (void)reloadDataForRowIndexes:(NSIndexSet *)rowIndexes columnIndexes:(NSIndexSet *)columnIndexes;
- (void) reloadDataForRowIndexes: (NSIndexSet*)rowIndexes columnIndexes: (NSIndexSet*)columnIndexes;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST)
- (void)beginUpdates;
- (void)endUpdates;
- (NSInteger)columnForView:(NSView *)view;
- (void)insertRowsAtIndexes:(NSIndexSet *)indexes withAnimation:(NSTableViewAnimationOptions)animationOptions;
- (void)removeRowsAtIndexes:(NSIndexSet *)indexes withAnimation:(NSTableViewAnimationOptions)animationOptions;
- (NSInteger)rowForView:(NSView *)view;
- (void) beginUpdates;
- (void) endUpdates;
- (NSInteger) columnForView: (NSView*)view;
- (void) insertRowsAtIndexes: (NSIndexSet*)indexes withAnimation: (NSTableViewAnimationOptions)animationOptions;
- (void) removeRowsAtIndexes: (NSIndexSet*)indexes withAnimation: (NSTableViewAnimationOptions)animationOptions;
- (NSInteger) rowForView: (NSView*)view;
#endif
@end /* interface of NSTableView */

View file

@ -767,40 +767,34 @@ static GSFontEnumerator *sharedEnumerator = nil;
if (fontDescriptor == nil)
{
// Create a new one
NSAffineTransform *transform = [NSAffineTransform new];
NSAffineTransformStruct ats;
NSDictionary *attributes;
NSDictionary *fontTraits;
float fweight = (weight - 6) / 6.0;
float fslant = italicAngle / 30.0;
ats.m11 = matrix[0];
ats.m12 = matrix[1];
ats.m21 = matrix[2];
ats.m22 = matrix[3];
ats.tX = matrix[4];
ats.tY = matrix[5];
[transform setTransformStruct: ats];
fontTraits = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithUnsignedInt: traits],
NSFontSymbolicTrait,
[NSNumber numberWithFloat: fweight],
NSFontWeightTrait,
[NSNumber numberWithFloat: fslant],
NSFontSlantTrait,
nil];
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
familyName, NSFontFamilyAttribute,
fontName, NSFontNameAttribute,
//fontFace, NSFontFaceAttribute,
fontTraits, NSFontTraitsAttribute,
transform, NSFontMatrixAttribute,
nil];
RELEASE(transform);
fontDescriptor = [[NSFontDescriptor alloc] initWithFontAttributes: attributes];
if ((matrix[0] == matrix[3]) && (matrix[1] == 0.0) &&
(matrix[2] == 0.0) && (matrix[4] == 0.0) && (matrix[5] == 0.0))
{
ASSIGN(fontDescriptor, [NSFontDescriptor fontDescriptorWithName: fontName
size: matrix[0]]);
}
else
{
NSAffineTransform *transform = [NSAffineTransform new];
NSAffineTransformStruct ats;
NSDictionary *attributes;
ats.m11 = matrix[0];
ats.m12 = matrix[1];
ats.m21 = matrix[2];
ats.m22 = matrix[3];
ats.tX = matrix[4];
ats.tY = matrix[5];
[transform setTransformStruct: ats];
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
fontName, NSFontNameAttribute,
transform, NSFontMatrixAttribute,
nil];
RELEASE(transform);
fontDescriptor = [[NSFontDescriptor alloc] initWithFontAttributes: attributes];
}
}
return fontDescriptor;
}

View file

@ -289,7 +289,6 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
- (BOOL) isOpaque
{
// Testplant-MAL-2015-06-25: main branch code merge...
// May not be opaque, due to themes
return NO;
}
@ -367,14 +366,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
if (inside)
{
if (_is_active == NO)
{
[self activate: YES];
}
else
{
[self deactivate];
}
[self performClick: self];
}
}
@ -383,6 +375,18 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
return [self color];
}
- (void) performClick: (id)sender
{
if ([self isActive])
{
[self deactivate];
}
else
{
[self activate: YES];
}
}
- (BOOL) performDragOperation: (id <NSDraggingInfo>)sender
{
NSPasteboard *pb = [sender draggingPasteboard];

View file

@ -77,11 +77,11 @@ static NSNotificationCenter *nc = nil;
static const int currentVersion = 5;
static NSRect oldDraggingRect;
static int oldDropRow;
static NSInteger oldDropRow;
static NSTableViewDropOperation oldDropOperation;
static NSTableViewDropOperation currentDropOperation;
static int currentDropRow;
static int lastQuarterPosition;
static NSInteger currentDropRow;
static NSInteger lastQuarterPosition;
static NSDragOperation currentDragOperation;
/*
@ -98,7 +98,6 @@ typedef struct _tableViewFlags
unsigned int emptySelection:1;
unsigned int multipleSelection:1;
unsigned int columnSelection:1;
unsigned int unknown1:1;
unsigned int columnAutosave:1;
unsigned int _unused:24;
#else
@ -123,47 +122,47 @@ typedef struct _tableViewFlags
@interface NSTableView (NotificationRequestMethods)
- (void) _postSelectionIsChangingNotification;
- (void) _postSelectionDidChangeNotification;
- (void) _postColumnDidMoveNotificationWithOldIndex: (int) oldIndex
newIndex: (int) newIndex;
- (void) _postColumnDidMoveNotificationWithOldIndex: (NSInteger) oldIndex
newIndex: (NSInteger) newIndex;
- (void) _postColumnDidResizeNotification;
- (BOOL) _shouldSelectTableColumn: (NSTableColumn *)tableColumn;
- (BOOL) _shouldSelectRow: (int)rowIndex;
- (BOOL) _shouldSelectRow: (NSInteger)rowIndex;
- (BOOL) _shouldSelectionChange;
- (void) _didChangeSortDescriptors: (NSArray *)oldSortDescriptors;
- (void) _didClickTableColumn: (NSTableColumn *)tc;
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
row: (int) rowIndex;
row: (NSInteger) rowIndex;
- (void) _willDisplayCell: (NSCell*)cell
forTableColumn: (NSTableColumn *)tb
row: (int)index;
row: (NSInteger)index;
- (BOOL) _writeRows: (NSIndexSet *)rows
toPasteboard: (NSPasteboard *)pboard;
- (BOOL) _isDraggingSource;
- (id)_objectValueForTableColumn: (NSTableColumn *)tb
row: (int)index;
row: (NSInteger)index;
- (void)_setObjectValue: (id)value
forTableColumn: (NSTableColumn *)tb
row: (int)index;
row: (NSInteger)index;
- (BOOL) _isEditableColumn: (int)columnIndex
row: (int)rowIndex;
- (BOOL) _isCellSelectableColumn: (int)columnIndex
row: (int)rowIndex;
- (BOOL) _isCellEditableColumn: (int)columnIndex
row: (int)rowIndex;
- (int) _numRowsFromBindingOrDatasource;
- (int) _numberOfRows;
- (BOOL) _isEditableColumn: (NSInteger)columnIndex
row: (NSInteger)rowIndex;
- (BOOL) _isCellSelectableColumn: (NSInteger)columnIndex
row: (NSInteger)rowIndex;
- (BOOL) _isCellEditableColumn: (NSInteger)columnIndex
row: (NSInteger)rowIndex;
- (NSInteger) _numRowsFromBindingOrDatasource;
- (NSInteger) _numberOfRows;
@end
@interface NSTableView (SelectionHelper)
- (void) _setSelectingColumns: (BOOL)flag;
- (NSArray *) _indexSetToArray: (NSIndexSet*)indexSet;
- (NSArray *) _selectedRowArray;
- (BOOL) _selectRow: (int)rowIndex;
- (BOOL) _selectUnselectedRow: (int)rowIndex;
- (BOOL) _unselectRow: (int)rowIndex;
- (BOOL) _selectRow: (NSInteger)rowIndex;
- (BOOL) _selectUnselectedRow: (NSInteger)rowIndex;
- (BOOL) _unselectRow: (NSInteger)rowIndex;
- (void) _unselectAllRows;
- (NSArray *) _selectedColumArray;
- (void) _unselectAllColumns;
@ -242,10 +241,10 @@ static void computeNewSelection
(NSTableView *tv,
NSIndexSet *_oldSelectedRows,
NSMutableIndexSet *_selectedRows,
int _originalRow,
int _oldRow,
int _currentRow,
int *_selectedRow,
NSInteger _originalRow,
NSInteger _oldRow,
NSInteger _currentRow,
NSInteger *_selectedRow,
unsigned selectionMode)
{
if (!(selectionMode & ALLOWS_MULTIPLE))
@ -256,7 +255,7 @@ static void computeNewSelection
// we will unselect the selected row
// ic, sc : ok
{
int count = [_selectedRows count];
NSUInteger count = [_selectedRows count];
if ((count == 0) && (_oldRow == -1))
{
@ -312,7 +311,7 @@ static void computeNewSelection
// we'll be selecting exactly one row
// ic, sc : ok
{
int count = [_selectedRows count];
NSUInteger count = [_selectedRows count];
if ([tv _shouldSelectRow: _currentRow] == NO)
{
@ -380,8 +379,8 @@ static void computeNewSelection
// this is the first pass
{
BOOL notified = NO;
int i;
int diff = _currentRow - _originalRow;
NSInteger i;
NSInteger diff = _currentRow - _originalRow;
if (diff >= 0)
{
@ -416,7 +415,7 @@ static void computeNewSelection
}
else // new multiple selection, after first pass
{
int oldDiff, newDiff, i;
NSInteger oldDiff, newDiff, i;
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
if (oldDiff >= 0 && newDiff >= 0)
@ -648,8 +647,8 @@ static void computeNewSelection
// this is the first pass
// we'll clear the selection first
{
int diff, i;
int count = [_selectedRows count];
NSInteger diff, i;
NSUInteger count = [_selectedRows count];
BOOL notified = NO;
diff = _currentRow - _originalRow;
@ -688,7 +687,7 @@ static void computeNewSelection
}
else // new multiple selection, after first pass
{
int oldDiff, newDiff, i;
NSInteger oldDiff, newDiff, i;
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
if (oldDiff >= 0 && newDiff >= 0)
@ -892,8 +891,8 @@ static void computeNewSelection
// let's clear the old selection
// this code is copied from another case
// (AM = 1, SD=0, AE=1, AR=*, first pass)
int diff, i;
int count = [_selectedRows count];
NSInteger diff, i;
NSUInteger count = [_selectedRows count];
BOOL notified = NO;
diff = _currentRow - _originalRow;
@ -934,7 +933,7 @@ static void computeNewSelection
// let's add to the old selection
// this code is copied from another case
// (AM=1, SD=1, AE=*, AR=1)
int diff, i;
NSInteger diff, i;
BOOL notified = NO;
diff = _currentRow - _originalRow;
@ -975,7 +974,7 @@ static void computeNewSelection
{
// this code is copied from another case
// (AM=1, SD=0, AE=1, AR=*, after first pass)
int oldDiff, newDiff, i;
NSInteger oldDiff, newDiff, i;
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
if (oldDiff >= 0 && newDiff >= 0)
@ -1161,7 +1160,7 @@ static void computeNewSelection
{
// this code is copied from another case
// (AM=1, SD=1, AE=*, AR=1, after first pass)
int oldDiff, newDiff, i;
NSInteger oldDiff, newDiff, i;
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
@ -1388,7 +1387,7 @@ static void computeNewSelection
if (_oldRow == -1)
// this is the first pass
{
int diff, i;
NSInteger diff, i;
BOOL notified = NO;
diff = _currentRow - _originalRow;
@ -1447,7 +1446,7 @@ static void computeNewSelection
}
else // new multiple antiselection, after first pass
{
int oldDiff, newDiff, i;
NSInteger oldDiff, newDiff, i;
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
@ -1675,8 +1674,8 @@ static void computeNewSelection
if (_oldRow == -1)
// this is the first pass
{
int diff, i;
int count = [_selectedRows count];
NSInteger diff, i;
NSUInteger count = [_selectedRows count];
BOOL notified = NO;
diff = _currentRow - _originalRow;
@ -1738,8 +1737,8 @@ static void computeNewSelection
}
else // new multiple antiselection, after first pass
{
int oldDiff, newDiff, i;
int count = [_selectedRows count];
NSInteger oldDiff, newDiff, i;
NSUInteger count = [_selectedRows count];
oldDiff = _oldRow - _originalRow;
newDiff = _currentRow - _originalRow;
if (oldDiff >= 0 && newDiff >= 0)
@ -1986,16 +1985,16 @@ static void computeNewSelection
@interface NSTableView (TableViewInternalPrivate)
- (void) _setSelectingColumns: (BOOL)flag;
- (BOOL) _editNextEditableCellAfterRow: (int)row
column: (int)column;
- (BOOL) _editPreviousEditableCellBeforeRow: (int)row
column: (int)column;
- (void) _editNextCellAfterRow:(int)row inColumn:(int)column;
- (BOOL) _editNextEditableCellAfterRow: (NSInteger)row
column: (NSInteger)column;
- (BOOL) _editPreviousEditableCellBeforeRow: (NSInteger)row
column: (NSInteger)column;
- (void) _editNextCellAfterRow:(NSInteger)row inColumn:(NSInteger)column;
- (void) _autosaveTableColumns;
- (void) _autoloadTableColumns;
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
row: (int) rowIndex;
- (NSString *) _objectStringForTableColumn:(NSTableColumn *)column row:(int)row;
row: (NSInteger) rowIndex;
- (NSString *) _objectStringForTableColumn:(NSTableColumn *)column row:(NSInteger)row;
- (BOOL)_isGroupRow: (NSInteger)rowIndex;
@end
@ -2112,7 +2111,7 @@ static void computeNewSelection
return _numberOfColumns;
}
- (int)_numberOfRows
- (NSInteger)_numberOfRows
{
// numberOfRows can be overridden and we NEED to cache the overridden value...
// Invoke numberOfRows from here and store the result...
@ -2154,7 +2153,7 @@ static void computeNewSelection
- (void) removeTableColumn: (NSTableColumn *)aColumn
{
int columnIndex = [self columnWithIdentifier: [aColumn identifier]];
NSInteger columnIndex = [self columnWithIdentifier: [aColumn identifier]];
if (columnIndex == -1)
{
@ -2195,9 +2194,9 @@ static void computeNewSelection
{
/* The range of columns which need to be shifted,
extremes included */
int minRange, maxRange;
NSInteger minRange, maxRange;
/* Amount of shift for these columns */
int shift;
NSInteger shift;
BOOL selected = NO;
if ((columnIndex < 0) || (columnIndex > (_numberOfColumns - 1)))
@ -2292,7 +2291,7 @@ static void computeNewSelection
{
NSEnumerator *enumerator = [_tableColumns objectEnumerator];
NSTableColumn *tb;
int return_value = 0;
NSInteger return_value = 0;
while ((tb = [enumerator nextObject]) != nil)
{
@ -2308,7 +2307,7 @@ static void computeNewSelection
- (NSTableColumn *) tableColumnWithIdentifier:(id)anObject
{
int indexOfColumn = [self columnWithIdentifier: anObject];
NSInteger indexOfColumn = [self columnWithIdentifier: anObject];
if (indexOfColumn == -1)
return nil;
@ -3387,6 +3386,8 @@ byExtendingSelection: (BOOL)flag
if (validatedOK)
{
// TESTPLANT-MAL: keeping branch code...
// Generate an attributed string per Cocoa behavior...
id object = string;
if ([_editedCell allowsEditingTextAttributes])
@ -3532,15 +3533,15 @@ byExtendingSelection: (BOOL)flag
}
static inline float computePeriod(NSPoint mouseLocationWin,
float minYVisible,
float maxYVisible)
static inline NSTimeInterval computePeriod(NSPoint mouseLocationWin,
CGFloat minYVisible,
CGFloat maxYVisible)
{
/* We have three zones of speed.
0 - 50 pixels: period 0.2 <zone 1>
50 - 100 pixels: period 0.1 <zone 2>
100 - 150 pixels: period 0.01 <zone 3> */
float distance = 0;
CGFloat distance = 0;
if (mouseLocationWin.y < minYVisible)
{
@ -3613,6 +3614,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
RELEASE(cell);
}
// TESTPLANT-MAL: Keeping branch code...
- (BOOL) _startDragOperationWithEvent: (NSEvent *) theEvent clickedRow:(NSUInteger)clickedRow
{
if (clickedRow >= _numberOfRows)
@ -3692,7 +3694,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
NSPoint initialLocation = [theEvent locationInWindow];
NSPoint location;
BOOL clickedRowSelectedBeforeClick = NO;
int clickCount = [theEvent clickCount];
NSInteger clickCount = [theEvent clickCount];
// Pathological case -- ignore mouse down
if ((_numberOfRows == 0) || (_numberOfColumns == 0))
@ -3720,6 +3722,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if ([theEvent type] == NSLeftMouseDown)
{
// TESTPLANT-MAL: Keeping branch code...
// If clicked outside of row(s)...
if (_clickedRow == -1)
{
@ -3754,6 +3757,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
return;
}
// TESTPLANT-MAL: Keeping branch code...
// If we have a doubleAction, send that on a double-click, even for editable cells
if (clickCount == 2 && _doubleAction != (SEL)0 && _clickedRow != -1)
{
@ -3781,6 +3785,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
}
else
{
// TESTPLANT-MAL: Keeping branch code definition of this for fix...
#define COMPUTE_NEW_SELECTION do \
{ \
if (originalRow == -1) \
@ -3827,10 +3832,10 @@ static inline float computePeriod(NSPoint mouseLocationWin,
toView: nil];
CGFloat minYVisible = NSMinY (visibleRect);
CGFloat maxYVisible = NSMaxY (visibleRect);
float oldPeriod = 0;
int originalRow = _clickedRow;
int oldRow = -1;
int currentRow = -1;
NSTimeInterval oldPeriod = 0;
NSInteger originalRow = _clickedRow;
NSInteger oldRow = -1;
NSInteger currentRow = -1;
BOOL getNextEvent = YES;
BOOL sendAction = NO;
@ -3946,6 +3951,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
if (dragOperationPossible == YES)
{
// TESTPLANT-MAL: Keeping branch code...not sure who put this in...
if (/*[_selectedRows containsIndex:_clickedRow] == NO
|| */ (_verticalMotionDrag == NO
&& fabs(mouseLocationWin.y - initialLocation.y) > 2))
@ -4021,7 +4027,7 @@ static inline float computePeriod(NSPoint mouseLocationWin,
else
{
// Mouse dragged out of the table
float period = computePeriod(mouseLocationWin,
NSTimeInterval period = computePeriod(mouseLocationWin,
minYVisible,
maxYVisible);
@ -4154,13 +4160,13 @@ if (!x) \
}
static BOOL selectContiguousRegion(NSTableView *self,
NSIndexSet *_selectedRows,
int originalRow,
int oldRow,
int currentRow)
NSInteger originalRow,
NSInteger oldRow,
NSInteger currentRow)
{
int first = (oldRow < currentRow) ? oldRow : currentRow;
int last = (oldRow < currentRow) ? currentRow : oldRow;
int row;
NSInteger first = (oldRow < currentRow) ? oldRow : currentRow;
NSInteger last = (oldRow < currentRow) ? currentRow : oldRow;
NSInteger row;
BOOL notified = NO;
if (![_selectedRows containsIndex: currentRow])
@ -4394,8 +4400,8 @@ static BOOL selectContiguousRegion(NSTableView *self,
if ((!(modifiers & NSShiftKeyMask && _allowsMultipleSelection)))
{
int first = [_selectedRows firstIndex];
int last = [_selectedRows lastIndex];
NSUInteger first = [_selectedRows firstIndex];
NSUInteger last = [_selectedRows lastIndex];
if ((first == last && first == currentRow) == 0)
{
@ -4525,7 +4531,7 @@ Hidden table columns are never tested. */
{
NSRange range = [self columnsInRect: aRect];
NSMutableIndexSet *indexes = [NSMutableIndexSet indexSetWithIndexesInRange: range];
int i;
NSUInteger i;
for (i = range.location; i < range.length; i++)
{
@ -4560,7 +4566,7 @@ This method is deprecated, use -columnIndexesInRect:. */
- (NSRange) rowsInRect: (NSRect)aRect
{
NSRange range;
int lastRowInRect;
NSInteger lastRowInRect;
range.location = [self rowAtPoint: aRect.origin];
lastRowInRect = [self rowAtPoint:
@ -4585,7 +4591,7 @@ This method is deprecated, use -columnIndexesInRect:. */
}
else
{
int i = 0;
NSInteger i = 0;
while ((i < _numberOfColumns) && (aPoint.x >= _columnOrigins[i]))
{
@ -4604,10 +4610,10 @@ This method is deprecated, use -columnIndexesInRect:. */
}
else
{
int return_value;
NSInteger return_value;
aPoint.y -= _bounds.origin.y;
return_value = (int) (aPoint.y / _rowHeight);
return_value = (NSInteger) (aPoint.y / _rowHeight);
/* This could happen if point lies on the grid line or below the last row */
if (return_value >= _numberOfRows)
{
@ -4687,13 +4693,15 @@ This method is deprecated, use -columnIndexesInRect:. */
{
if ((_super_view != nil) && (_numberOfColumns > 0))
{
float excess_width;
float last_column_width;
CGFloat excess_width;
CGFloat last_column_width;
NSTableColumn *lastColumn;
lastColumn = [_tableColumns objectAtIndex: (_numberOfColumns - 1)];
if ([lastColumn isResizable] == NO)
return;
{
return;
}
excess_width = NSMaxX([self convertRect: [_super_view bounds]
fromView: _super_view]) - NSMaxX(_bounds);
last_column_width = [lastColumn width] + excess_width;
@ -4708,7 +4716,7 @@ This method is deprecated, use -columnIndexesInRect:. */
if ([_super_view respondsToSelector: @selector(documentVisibleRect)])
{
float rowsHeight = ((_numberOfRows * _rowHeight) + 1);
CGFloat rowsHeight = ((_numberOfRows * _rowHeight) + 1);
NSRect docRect = [(NSClipView *)_super_view documentVisibleRect];
if (rowsHeight < docRect.size.height)
@ -4730,7 +4738,7 @@ This method is deprecated, use -columnIndexesInRect:. */
if ([_super_view respondsToSelector: @selector(documentVisibleRect)])
{
float rowsHeight = ((_numberOfRows * _rowHeight) + 1);
CGFloat rowsHeight = ((_numberOfRows * _rowHeight) + 1);
NSRect docRect = [(NSClipView *)_super_view documentVisibleRect];
if (rowsHeight < docRect.size.height)
@ -4756,17 +4764,17 @@ This method is deprecated, use -columnIndexesInRect:. */
- (void) sizeToFit
{
NSTableColumn *tb;
int i, j;
float remainingWidth;
NSInteger i, j;
CGFloat remainingWidth;
columnSorting *columnInfo;
float *currentWidth;
float *maxWidth;
float *minWidth;
CGFloat *currentWidth;
CGFloat *maxWidth;
CGFloat *minWidth;
BOOL *isResizable;
int numberOfCurrentColumns = 0;
float previousPoint;
float nextPoint;
float toAddToCurrentColumns;
NSInteger numberOfCurrentColumns = 0;
CGFloat previousPoint;
CGFloat nextPoint;
CGFloat toAddToCurrentColumns;
if ((_super_view == nil) || (_numberOfColumns == 0))
return;
@ -4775,11 +4783,11 @@ This method is deprecated, use -columnIndexesInRect:. */
sizeof(columnSorting) * 2
* _numberOfColumns);
currentWidth = NSZoneMalloc(NSDefaultMallocZone(),
sizeof(float) * _numberOfColumns);
sizeof(CGFloat) * _numberOfColumns);
maxWidth = NSZoneMalloc(NSDefaultMallocZone(),
sizeof(float) * _numberOfColumns);
sizeof(CGFloat) * _numberOfColumns);
minWidth = NSZoneMalloc(NSDefaultMallocZone(),
sizeof(float) * _numberOfColumns);
sizeof(CGFloat) * _numberOfColumns);
isResizable = NSZoneMalloc(NSDefaultMallocZone(),
sizeof(BOOL) * _numberOfColumns);
@ -4844,7 +4852,7 @@ This method is deprecated, use -columnIndexesInRect:. */
if (numberOfCurrentColumns > 0 &&
(nextPoint - previousPoint) > 0.)
{
int verification = 0;
NSInteger verification = 0;
if ((nextPoint - previousPoint) * numberOfCurrentColumns
<= remainingWidth)
@ -5103,7 +5111,7 @@ This method is deprecated, use -columnIndexesInRect:. */
{
/* We shouldn't allow empty selection - try
selecting the last row */
int lastRow = _numberOfRows - 1;
NSInteger lastRow = _numberOfRows - 1;
if (lastRow > -1)
{
@ -5154,7 +5162,7 @@ This method is deprecated, use -columnIndexesInRect:. */
if (_numberOfColumns > 0)
{
int i;
NSInteger i;
CGFloat width;
_columnOrigins[0] = _bounds.origin.x;
@ -5338,7 +5346,7 @@ This method is deprecated, use -columnIndexesInRect:. */
- (void) textDidEndEditing: (NSNotification *)aNotification
{
id textMovement;
int row, column;
NSInteger row, column;
/* Save values */
row = _editedRow;
@ -5740,6 +5748,9 @@ This method is deprecated, use -columnIndexesInRect:. */
}
else
{
float rowHeight;
int number;
[super encodeWithCoder: aCoder];
[aCoder encodeConditionalObject: _dataSource];
[aCoder encodeObject: _tableColumns];
@ -5750,11 +5761,14 @@ This method is deprecated, use -columnIndexesInRect:. */
[aCoder encodeConditionalObject: _delegate];
[aCoder encodeConditionalObject: _target];
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfRows];
[aCoder encodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
number = _numberOfRows;
[aCoder encodeValueOfObjCType: @encode(int) at: &number];
number = _numberOfColumns;
[aCoder encodeValueOfObjCType: @encode(int) at: &number];
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_drawsGrid];
[aCoder encodeValueOfObjCType: @encode(float) at: &_rowHeight];
rowHeight = _rowHeight;
[aCoder encodeValueOfObjCType: @encode(float) at: &rowHeight];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
[aCoder encodeSize: _intercellSpacing];
@ -5959,6 +5973,8 @@ This method is deprecated, use -columnIndexesInRect:. */
int version = [aDecoder versionForClassName:
@"NSTableView"];
id aDelegate;
float rowHeight;
int number;
[self _initDefaults];
_dataSource = [aDecoder decodeObject];
@ -5975,10 +5991,13 @@ This method is deprecated, use -columnIndexesInRect:. */
[_tableColumns makeObjectsPerformSelector: @selector(setTableView:)
withObject: self];
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfRows];
[aDecoder decodeValueOfObjCType: @encode(int) at: &_numberOfColumns];
[aDecoder decodeValueOfObjCType: @encode(int) at: &number];
_numberOfRows = number;
[aDecoder decodeValueOfObjCType: @encode(int) at: &number];
_numberOfColumns = number;
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_drawsGrid];
[aDecoder decodeValueOfObjCType: @encode(float) at: &_rowHeight];
[aDecoder decodeValueOfObjCType: @encode(float) at: &rowHeight];
_rowHeight = rowHeight;
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_doubleAction];
_intercellSpacing = [aDecoder decodeSize];
@ -6017,7 +6036,7 @@ This method is deprecated, use -columnIndexesInRect:. */
- (void) updateCell: (NSCell*)aCell
{
int i, j;
NSInteger i, j;
NSTableColumn *tb;
if (aCell == nil)
return;
@ -6041,8 +6060,8 @@ This method is deprecated, use -columnIndexesInRect:. */
NSMinY(visibleRect));
NSPoint bottom = NSMakePoint(NSMinX(visibleRect),
NSMaxY(visibleRect));
int firstVisibleRow = [self rowAtPoint: top];
int lastVisibleRow = [self rowAtPoint: bottom];
NSInteger firstVisibleRow = [self rowAtPoint: top];
NSInteger lastVisibleRow = [self rowAtPoint: bottom];
if (firstVisibleRow == -1)
firstVisibleRow = 0;
@ -6063,8 +6082,8 @@ This method is deprecated, use -columnIndexesInRect:. */
}
}
- (void) _userResizedTableColumn: (int)index
width: (float)width
- (void) _userResizedTableColumn: (NSInteger)index
width: (CGFloat)width
{
[[_tableColumns objectAtIndex: index] setWidth: width];
}
@ -6122,8 +6141,8 @@ This method is deprecated, use -columnIndexesInRect:. */
[self _didClickTableColumn: tc];
}
- (void) _editNextCellAfterRow: (int) row
inColumn: (int) column
- (void) _editNextCellAfterRow: (NSInteger) row
inColumn: (NSInteger) column
{
if (++row >= _numberOfRows)
row = 0;
@ -6143,10 +6162,10 @@ This method is deprecated, use -columnIndexesInRect:. */
}
}
-(BOOL) _editNextEditableCellAfterRow: (int)row
column: (int)column
-(BOOL) _editNextEditableCellAfterRow: (NSInteger)row
column: (NSInteger)column
{
int i, j;
NSInteger i, j;
if (row > -1)
{
@ -6211,10 +6230,10 @@ This method is deprecated, use -columnIndexesInRect:. */
return NO;
}
-(BOOL) _editPreviousEditableCellBeforeRow: (int)row
column: (int)column
-(BOOL) _editPreviousEditableCellBeforeRow: (NSInteger)row
column: (NSInteger)column
{
int i, j;
NSInteger i, j;
if (row > -1)
{
@ -6365,7 +6384,7 @@ This method is deprecated, use -columnIndexesInRect:. */
}
- (NSCell *) _dataCellForTableColumn: (NSTableColumn *)tb
row: (int) rowIndex
row: (NSInteger) rowIndex
{
NSCell *cell = nil;
if ([_delegate respondsToSelector: @selector(tableView:dataCellForTableColumn:row:)])
@ -6379,7 +6398,7 @@ This method is deprecated, use -columnIndexesInRect:. */
return cell;
}
- (NSString *) _objectStringForTableColumn:(NSTableColumn *)column row:(int)row
- (NSString *) _objectStringForTableColumn:(NSTableColumn *)column row:(NSInteger)row
{
NSString *draggedItemString = nil;
if ([_dataSource respondsToSelector:@selector(tableView:objectValueForTableColumn:row:)])
@ -6401,9 +6420,9 @@ This method is deprecated, use -columnIndexesInRect:. */
{
if (_autoresizesAllColumnsToFit == YES)
{
float visible_width = [self convertRect: [_super_view bounds]
CGFloat visible_width = [self convertRect: [_super_view bounds]
fromView: _super_view].size.width;
float table_width = 0;
CGFloat table_width = 0;
if (_numberOfColumns > 0)
{
@ -6447,9 +6466,9 @@ This method is deprecated, use -columnIndexesInRect:. */
}
else if (_columnAutoresizingStyle == NSTableViewLastColumnOnlyAutoresizingStyle)
{
float visible_width = [self convertRect: [_super_view bounds]
CGFloat visible_width = [self convertRect: [_super_view bounds]
fromView: _super_view].size.width;
float table_width = 0;
CGFloat table_width = 0;
if (_numberOfColumns > 0)
{
@ -6666,7 +6685,7 @@ view to drag. */
- (NSDragOperation) draggingUpdated: (id <NSDraggingInfo>) sender
{
NSPoint p = [self convertPoint: [sender draggingLocation] fromView: nil];
NSInteger positionInRow = (NSInteger)(p.y - _bounds.origin.y) % (int)_rowHeight;
NSInteger positionInRow = (NSInteger)(p.y - _bounds.origin.y) % (NSInteger)_rowHeight;
NSInteger quarterPosition = (NSInteger)([self _computedRowAtPoint: p] * 4.);
NSInteger row = [self _dropRowFromQuarterPosition: quarterPosition];
NSDragOperation dragOperation = [sender draggingSourceOperationMask];
@ -6823,16 +6842,16 @@ For a more detailed explanation, -setSortDescriptors:. */
object: self];
}
- (void) _postColumnDidMoveNotificationWithOldIndex: (int) oldIndex
newIndex: (int) newIndex
- (void) _postColumnDidMoveNotificationWithOldIndex: (NSInteger) oldIndex
newIndex: (NSInteger) newIndex
{
[nc postNotificationName: NSTableViewColumnDidMoveNotification
object: self
userInfo: [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: newIndex],
[NSNumber numberWithInteger: newIndex],
@"NSNewColumn",
[NSNumber numberWithInt: oldIndex],
[NSNumber numberWithInteger: oldIndex],
@"NSOldColumn",
nil]];
}
@ -6863,7 +6882,7 @@ For a more detailed explanation, -setSortDescriptors:. */
return YES;
}
- (BOOL) _shouldSelectRow: (int)rowIndex
- (BOOL) _shouldSelectRow: (NSInteger)rowIndex
{
BOOL shouldSelectRow = YES;
@ -6925,7 +6944,7 @@ For a more detailed explanation, -setSortDescriptors:. */
}
- (BOOL) _shouldEditTableColumn: (NSTableColumn *)tableColumn
row: (int) rowIndex
row: (NSInteger) rowIndex
{
if ([_delegate respondsToSelector:
@selector(tableView:shouldEditTableColumn:row:)])
@ -6937,9 +6956,8 @@ For a more detailed explanation, -setSortDescriptors:. */
return YES;
}
- (BOOL) _isCellEditableColumn: (int) columnIndex
row: (int) rowIndex
- (BOOL) _isEditableColumn: (NSInteger) columnIndex
row: (NSInteger) rowIndex
{
NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex];
NSCell *cell = [self _dataCellForTableColumn: tableColumn row: rowIndex];
@ -6952,8 +6970,8 @@ For a more detailed explanation, -setSortDescriptors:. */
return cellIsEditable && columnIsEditable && delegateAllowsEditing;
}
- (BOOL) _isCellSelectableColumn: (int) columnIndex
row: (int) rowIndex
- (BOOL) _isCellSelectableColumn: (NSInteger) columnIndex
row: (NSInteger) rowIndex
{
if (![self _isEditableColumn: columnIndex row: rowIndex])
{
@ -6969,7 +6987,7 @@ For a more detailed explanation, -setSortDescriptors:. */
- (void) _willDisplayCell: (NSCell*)cell
forTableColumn: (NSTableColumn *)tb
row: (int)index
row: (NSInteger)index
{
if (_del_responds)
{
@ -6981,7 +6999,7 @@ For a more detailed explanation, -setSortDescriptors:. */
}
- (id) _objectValueForTableColumn: (NSTableColumn *)tb
row: (int) index
row: (NSInteger) index
{
id result = nil;
GSKeyValueBinding *theBinding = nil;
@ -7006,7 +7024,7 @@ For a more detailed explanation, -setSortDescriptors:. */
- (void) _setObjectValue: (id)value
forTableColumn: (NSTableColumn *)tb
row: (int) index
row: (NSInteger) index
{
if ([_dataSource respondsToSelector:
@selector(tableView:setObjectValue:forTableColumn:row:)])
@ -7022,7 +7040,7 @@ For a more detailed explanation, -setSortDescriptors:. */
* implemented in NSTableView and subclasses
* by default returns the DataSource's -numberOfRowsInTableView:
*/
- (int) _numRowsFromBindingOrDatasource
- (NSInteger) _numRowsFromBindingOrDatasource
{
GSKeyValueBinding *theBinding;
@ -7174,7 +7192,7 @@ For a more detailed explanation, -setSortDescriptors:. */
while (index != NSNotFound)
{
NSNumber *num = [NSNumber numberWithInt: index];
NSNumber *num = [NSNumber numberWithUnsignedInteger: index];
[array addObject: num];
index = [indexSet indexGreaterThanIndex: index];
@ -7188,7 +7206,7 @@ For a more detailed explanation, -setSortDescriptors:. */
return [self _indexSetToArray: _selectedRows];
}
- (BOOL) _selectRow: (int)rowIndex
- (BOOL) _selectRow: (NSInteger)rowIndex
{
if (![self _shouldSelectRow: rowIndex])
{
@ -7201,7 +7219,7 @@ For a more detailed explanation, -setSortDescriptors:. */
return YES;
}
- (BOOL) _selectUnselectedRow: (int)rowIndex
- (BOOL) _selectUnselectedRow: (NSInteger)rowIndex
{
if ([_selectedRows containsIndex: rowIndex])
{
@ -7214,7 +7232,7 @@ For a more detailed explanation, -setSortDescriptors:. */
return YES;
}
- (BOOL) _unselectRow: (int)rowIndex
- (BOOL) _unselectRow: (NSInteger)rowIndex
{
if (![_selectedRows containsIndex: rowIndex])
{