mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
dcd8369ade
This is not complete and perhaps should not have been committed. However, .xib files being what they are, rewriting history or merging is getting very difficult so I'll just disable it for now. If anyone wants to take a look at this: we should probably do some rev-parsing to create a graph representation in ApplicationController. That class already is a delegate for our table and can tell individual cells what to display. There we should tell how many lines to draw, what color, if there are merges or splitoffs etc.
68 lines
1.5 KiB
Objective-C
68 lines
1.5 KiB
Objective-C
//
|
|
// PBGitRevisionCell.m
|
|
// GitX
|
|
//
|
|
// Created by Pieter de Bie on 17-06-08.
|
|
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
//
|
|
|
|
#import "PBGitRevisionCell.h"
|
|
|
|
|
|
@implementation PBGitRevisionCell
|
|
@synthesize commit;
|
|
|
|
- (void) drawWithFrame: (NSRect) rect inView:(NSView *)view
|
|
{
|
|
|
|
// Don't do all this drawing for now.
|
|
[super drawWithFrame:rect inView:view];
|
|
return;
|
|
float pathWidth = 20;
|
|
|
|
NSRect ownRect;
|
|
NSDivideRect(rect, &ownRect, &rect, pathWidth, NSMinXEdge);
|
|
|
|
// Adjust by removing the border
|
|
ownRect.size.height += 2;
|
|
ownRect.origin.y -= 1;
|
|
|
|
NSPoint origin = ownRect.origin;
|
|
NSPoint middle = { origin.x + pathWidth / 2, origin.y + ownRect.size.height * 0.5 };
|
|
|
|
[[NSColor redColor] set];
|
|
NSBezierPath * path = [NSBezierPath bezierPath];
|
|
[path moveToPoint:NSMakePoint(middle.x, origin.y)];
|
|
[path setLineWidth:2];
|
|
[path lineToPoint: NSMakePoint(middle.x, origin.y + ownRect.size.height)];
|
|
[path stroke];
|
|
[path setLineWidth:1];
|
|
|
|
|
|
NSRect oval = { middle.x - 5, middle.y -5, 10, 10};
|
|
[[NSColor orangeColor] set];
|
|
path = [NSBezierPath bezierPathWithOvalInRect:oval];
|
|
[path fill];
|
|
|
|
if ([self.commit intValue] == 0)
|
|
[[NSColor redColor] set];
|
|
else
|
|
[[NSColor blueColor] set];
|
|
|
|
[path stroke];
|
|
|
|
NSRect smallOval = { middle.x - 3, middle.y - 3, 6, 6};
|
|
[[NSColor whiteColor] set];
|
|
path = [NSBezierPath bezierPathWithOvalInRect:smallOval];
|
|
[path fill];
|
|
[[NSColor blackColor] set];
|
|
[path stroke];
|
|
|
|
|
|
[super drawWithFrame:rect inView:view];
|
|
[[NSColor blueColor] set];
|
|
//[path stroke];
|
|
}
|
|
|
|
@end
|