remove the custom alternating row code in the tracker table, since it isn't futureproof

This commit is contained in:
Mitchell Livingston
2011-06-13 22:32:55 +00:00
parent 4458697259
commit 3e7521963d
2 changed files with 26 additions and 685 deletions
-71
View File
@@ -126,75 +126,4 @@
return YES;
}
//alternating rows - first row after group row is white
- (void) highlightSelectionInClipRect: (NSRect) clipRect
{
NSRect visibleRect = clipRect;
NSRange rows = [self rowsInRect: visibleRect];
BOOL start = YES;
const CGFloat totalRowHeight = [self rowHeight] + [self intercellSpacing].height;
NSRect gridRects[(NSInteger)(ceil(NSHeight(visibleRect) / totalRowHeight / 2.0)) + 1]; //add one if partial rows at top and bottom
NSInteger rectNum = 0;
if (rows.length > 0)
{
//determine what the first row color should be
if ([[fTrackers objectAtIndex: rows.location] isKindOfClass: [TrackerNode class]] || [self editedRow] == rows.location)
{
for (NSInteger i = rows.location-1; i>=0; i--)
{
if (![[fTrackers objectAtIndex: i] isKindOfClass: [TrackerNode class]])
break;
start = !start;
}
}
else
{
rows.location++;
rows.length--;
}
NSInteger i;
for (i = rows.location; i < NSMaxRange(rows); i++)
{
if (![[fTrackers objectAtIndex: i] isKindOfClass: [TrackerNode class]] && [self editedRow] != i)
{
start = YES;
continue;
}
if (!start && ![self isRowSelected: i])
gridRects[rectNum++] = [self rectOfRow: i];
start = !start;
}
const CGFloat newY = NSMaxY([self rectOfRow: i-1]);
visibleRect.size.height -= newY - visibleRect.origin.y;
visibleRect.origin.y = newY;
}
const NSInteger numberBlankRows = ceil(visibleRect.size.height / totalRowHeight);
//remaining visible rows continue alternating
visibleRect.size.height = totalRowHeight;
if (start)
visibleRect.origin.y += totalRowHeight;
for (NSInteger i = start ? 1 : 0; i < numberBlankRows; i += 2)
{
gridRects[rectNum++] = visibleRect;
visibleRect.origin.y += 2.0 * totalRowHeight;
}
NSAssert([[NSColor controlAlternatingRowBackgroundColors] count] >= 2, @"There should be 2 alternating row colors");
[(NSColor *)[[NSColor controlAlternatingRowBackgroundColors] objectAtIndex: 1] set];
NSRectFillList(gridRects, rectNum);
[super highlightSelectionInClipRect: clipRect];
}
@end