mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-01 16:33:35 +00:00
Merge branch 'jake' into outlineview
Conflicts: AppKit/CPTableView.j
This commit is contained in:
@@ -74,7 +74,8 @@ CPTableColumnUserResizingMask = 2;
|
||||
var header = [[_CPTableColumnHeaderView alloc] initWithFrame:CGRectMakeZero()];
|
||||
[self setHeaderView:header];
|
||||
|
||||
var textDataView = [[CPTextField alloc] init];
|
||||
var textDataView = [CPTextField new];
|
||||
[textDataView setValue:[CPColor colorWithHexString:@"333333"] forThemeAttribute:@"text-color"];
|
||||
[textDataView setValue:[CPColor whiteColor] forThemeAttribute:@"text-color" inState:CPThemeStateHighlighted];
|
||||
[textDataView setValue:[CPFont boldSystemFontOfSize:12] forThemeAttribute:@"font" inState:CPThemeStateHighlighted];
|
||||
[textDataView setValue:CPCenterVerticalTextAlignment forThemeAttribute:@"vertical-alignment"];
|
||||
|
||||
+14
-46
@@ -161,8 +161,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
CGSize _intercellSpacing;
|
||||
float _rowHeight;
|
||||
|
||||
BOOL _hasVariableRowHeight;
|
||||
|
||||
BOOL _usesAlternatingRowBackgroundColors;
|
||||
CPArray _alternatingRowBackgroundColors;
|
||||
|
||||
@@ -1040,24 +1038,11 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
- (CGRect)rectOfRow:(CPInteger)aRowIndex
|
||||
{
|
||||
if (aRowIndex < 0)
|
||||
return CPRectMakeZero();
|
||||
|
||||
var rowHeight = _rowHeight;
|
||||
|
||||
if ((_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_))
|
||||
{
|
||||
rowHeight = [_delegate tableView:self heightOfRow:aRowIndex];
|
||||
if (NO)
|
||||
return NULL;
|
||||
|
||||
if (rowHeight !== _rowHeight)
|
||||
_hasVariableRowHeight = YES;
|
||||
}
|
||||
else
|
||||
_hasVariableRowHeight = NO;
|
||||
|
||||
// FIXME: WRONG: ASK TABLE COLUMN RANGE
|
||||
var previousRowRect = [self rectOfRow:aRowIndex - 1];
|
||||
return CPRectMake(0.0, CPRectGetMaxY(previousRowRect) + _intercellSpacing.height, CPRectGetWidth([self bounds]), _rowHeight);
|
||||
return _CGRectMake(0.0, (aRowIndex * (_rowHeight + _intercellSpacing.height)), _CGRectGetWidth([self bounds]), _rowHeight);
|
||||
}
|
||||
|
||||
// Complexity:
|
||||
@@ -1174,34 +1159,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
- (CPInteger)rowAtPoint:(CGPoint)aPoint
|
||||
{
|
||||
var row = -1;
|
||||
var y = aPoint.y;
|
||||
|
||||
// Check if we are using variable sized rows so we can use the quicker way to determine the row at point
|
||||
if (!_hasVariableRowHeight)
|
||||
row = FLOOR(aPoint.y / (_rowHeight + _intercellSpacing.height));
|
||||
else
|
||||
{
|
||||
// We are using variable sized rows so we'll have to loop over all the rows and determine if it's at the point
|
||||
var rowArray = [];
|
||||
[_exposedRows getIndexes:rowArray maxCount:-1 inIndexRange:nil];
|
||||
|
||||
var rowIndex = [rowArray count];
|
||||
|
||||
while (rowIndex--)
|
||||
{
|
||||
row = [rowArray objectAtIndex:rowIndex];
|
||||
|
||||
if (CPRectContainsPoint([self rectOfRow:row], aPoint))
|
||||
break;
|
||||
}
|
||||
var row = FLOOR(y / (_rowHeight + _intercellSpacing.height));
|
||||
|
||||
// Make sure we return -1 if we could not find a row
|
||||
row = -1;
|
||||
}
|
||||
|
||||
if (row > [self numberOfRows])
|
||||
if (row >= _numberOfRows)
|
||||
return -1;
|
||||
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -2359,17 +2323,21 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint
|
||||
{
|
||||
var row = [self rowAtPoint:aPoint];
|
||||
var row = [self rowAtPoint:aPoint],
|
||||
canSelect = YES;
|
||||
|
||||
if ((_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_))
|
||||
canSelect = [_delegate tableView:self shouldSelectRow:row];
|
||||
|
||||
// begin the drag is the datasource lets us, we've move at least +-3px vertical or horizontal, or we're dragging from selected rows and we haven't begun a drag session
|
||||
if
|
||||
(
|
||||
!_isSelectingSession &&
|
||||
!canSelect || (!_isSelectingSession &&
|
||||
(_implementedDataSourceMethods & CPTableViewDataSource_tableView_writeRowsWithIndexes_toPasteboard_) &&
|
||||
(
|
||||
(lastPoint.x - aPoint.x > 3 || (_verticalMotionCanDrag && ABS(lastPoint.y - aPoint.y) > 3))
|
||||
|| ([_selectedRowIndexes containsIndex:row])
|
||||
)
|
||||
))
|
||||
)
|
||||
{
|
||||
if ([_selectedRowIndexes containsIndex:row])
|
||||
|
||||
@@ -241,7 +241,7 @@ CPLogRegister(CPLogConsole);
|
||||
// if(rowIndex % 2 == 1)
|
||||
// return true;
|
||||
// else
|
||||
return true;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)selectionShouldChangeInTableView:(CPTableView)aTableView
|
||||
|
||||
Reference in New Issue
Block a user