Merge pull request #1478 from cacaodev/CPTableView-dragging-perf

CPTableView: make dragged views reusable when dragging ends
This commit is contained in:
aparajita committed 2013-02-19 07:33:29 -08:00
commit 84d8e1ceb7
2 files changed
+18 -1

No files matched your search

+2
View File
@@ -551,6 +551,8 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
[self stopTrackingTableColumn:_activeColumn at:aLocation];
[self setNeedsDisplay:YES];
[_tableView _enqueueDraggingViews];
}
- (BOOL)shouldResizeTableColumn:(int)aColumnIndex at:(CGPoint)aPoint
+16 -1
View File
@@ -250,6 +250,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
CPDragOperation _dragOperationDefaultMask;
int _retargetedDropRow;
CPDragOperation _retargetedDropOperation;
CPArray _draggingViews;
BOOL _disableAutomaticResizing @accessors(property=disableAutomaticResizing);
BOOL _lastColumnShouldSnap;
@@ -389,6 +390,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
[self addSubview:_tableDrawView];
_draggedColumn = nil;
_draggingViews = [CPArray array];
/* //gradients for the source list when CPTableView is NOT first responder or the window is NOT key
// FIX ME: we need to actually implement this.
@@ -2880,7 +2882,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
[self _setObjectValueForTableColumn:tableColumn row:row forView:dataView];
[view addSubview:dataView];
[_draggingViews addObject:dataView];
row = [theDraggedRows indexGreaterThanIndex:row];
}
}
@@ -2922,6 +2925,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
[self _setObjectValueForTableColumn:tableColumn row:row forView:dataView];
[dragView addSubview:dataView];
[_draggingViews addObject:dataView];
row = [_exposedRows indexGreaterThanIndex:row];
}
@@ -4348,6 +4352,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
_retargetedDropRow = nil;
_draggedRowIndexes = [CPIndexSet indexSet];
[_dropOperationFeedbackView removeFromSuperview];
[self _enqueueDraggingViews];
}
/*
@@ -4536,6 +4541,16 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
[self draggedImage:aView endedAt:aLocation operation:anOperation];
}
- (void)_enqueueDraggingViews
{
[_draggingViews enumerateObjectsUsingBlock:function(dataView, idx)
{
[self _enqueueReusableDataView:dataView];
}];
[_draggingViews removeAllObjects];
}
/*!
@ignore
*/