mirror of
https://github.com/transmission/transmission
synced 2025-03-19 02:05:32 +00:00
same for torrent table, and fix a code placement issue
This commit is contained in:
parent
feb714f655
commit
d72a583163
2 changed files with 22 additions and 17 deletions
|
@ -676,13 +676,15 @@
|
||||||
//alternating rows - first row after group row is white
|
//alternating rows - first row after group row is white
|
||||||
- (void) highlightSelectionInClipRect: (NSRect) clipRect
|
- (void) highlightSelectionInClipRect: (NSRect) clipRect
|
||||||
{
|
{
|
||||||
NSColor * altColor = [[NSColor controlAlternatingRowBackgroundColors] objectAtIndex: 1];
|
|
||||||
[altColor set];
|
|
||||||
|
|
||||||
NSRect visibleRect = clipRect;
|
NSRect visibleRect = clipRect;
|
||||||
NSRange rows = [self rowsInRect: visibleRect];
|
NSRange rows = [self rowsInRect: visibleRect];
|
||||||
BOOL start = YES;
|
BOOL start = YES;
|
||||||
|
|
||||||
|
const CGFloat totalRowHeight = [self rowHeight] + [self intercellSpacing].height;
|
||||||
|
|
||||||
|
NSRect * gridRects = (NSRect *)alloca(sizeof(NSRect) * (ceil(visibleRect.size.height / totalRowHeight) / 2));
|
||||||
|
NSInteger rectNum = 0;
|
||||||
|
|
||||||
if (rows.length > 0)
|
if (rows.length > 0)
|
||||||
{
|
{
|
||||||
//determine what the first row color should be
|
//determine what the first row color should be
|
||||||
|
@ -711,30 +713,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!start && ![self isRowSelected: i])
|
if (!start && ![self isRowSelected: i])
|
||||||
NSRectFill([self rectOfRow: i]);
|
gridRects[rectNum++] = [self rectOfRow: i];
|
||||||
|
|
||||||
start = !start;
|
start = !start;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGFloat newY = NSMaxY([self rectOfRow: i-1]);
|
const CGFloat newY = NSMaxY([self rectOfRow: i-1]);
|
||||||
visibleRect.size.height -= newY - visibleRect.origin.y;
|
visibleRect.size.height -= newY - visibleRect.origin.y;
|
||||||
visibleRect.origin.y = newY;
|
visibleRect.origin.y = newY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NSInteger numberBlankRows = ceil(visibleRect.size.height / totalRowHeight);
|
||||||
|
|
||||||
//remaining visible rows continue alternating
|
//remaining visible rows continue alternating
|
||||||
const CGFloat height = [self rowHeight] + [self intercellSpacing].height;
|
visibleRect.size.height = totalRowHeight;
|
||||||
const NSInteger numberOfRects = ceil(visibleRect.size.height / height);
|
|
||||||
|
|
||||||
visibleRect.size.height = height;
|
|
||||||
if (start)
|
if (start)
|
||||||
visibleRect.origin.y += height;
|
visibleRect.origin.y += totalRowHeight;
|
||||||
|
for (NSInteger i = start ? 1 : 0; i < numberBlankRows; i += 2)
|
||||||
for (NSInteger i = start ? 1 : 0; i < numberOfRects; i += 2)
|
|
||||||
{
|
{
|
||||||
NSRectFill(visibleRect);
|
gridRects[rectNum++] = visibleRect;
|
||||||
visibleRect.origin.y += 2.0 * height;
|
visibleRect.origin.y += 2.0 * totalRowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSAssert([[NSColor controlAlternatingRowBackgroundColors] count] >= 2, @"There should be 2 alternating row colors");
|
||||||
|
|
||||||
|
[[[NSColor controlAlternatingRowBackgroundColors] objectAtIndex: 1] set];
|
||||||
|
NSRectFillList(gridRects, rectNum);
|
||||||
|
|
||||||
[super highlightSelectionInClipRect: clipRect];
|
[super highlightSelectionInClipRect: clipRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,12 +87,12 @@
|
||||||
visibleRect.origin.y = newY;
|
visibleRect.origin.y = newY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const NSInteger numberBlankRows = ceil(visibleRect.size.height / totalRowHeight);
|
||||||
|
|
||||||
//remaining visible rows continue alternating
|
//remaining visible rows continue alternating
|
||||||
visibleRect.size.height = totalRowHeight;
|
visibleRect.size.height = totalRowHeight;
|
||||||
if (start)
|
if (start)
|
||||||
visibleRect.origin.y += totalRowHeight;
|
visibleRect.origin.y += totalRowHeight;
|
||||||
|
|
||||||
const NSInteger numberBlankRows = ceil(visibleRect.size.height / totalRowHeight);
|
|
||||||
for (NSInteger i = start ? 1 : 0; i < numberBlankRows; i += 2)
|
for (NSInteger i = start ? 1 : 0; i < numberBlankRows; i += 2)
|
||||||
{
|
{
|
||||||
gridRects[rectNum++] = visibleRect;
|
gridRects[rectNum++] = visibleRect;
|
||||||
|
|
Loading…
Add table
Reference in a new issue