HistoryView: Don't show the 'loading commit' thing until after 500 ms.
[GitX.git] / PBCommitMessageView.m
blob02714c089561450b8d912eefce5153f70d435dac
1 //
2 //  PBCommitMessageView.m
3 //  GitX
4 //
5 //  Created by Jeff Mesnil on 13/10/08.
6 //  Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved.
7 //
9 #import "PBCommitMessageView.h"
10 #import "PBGitDefaults.h"
12 @implementation PBCommitMessageView
14 - (void)drawRect:(NSRect)aRect
16         NSColor *originalColor = [self backgroundColor];
17         [originalColor set];
18         NSRectFill(aRect);
20         // draw a vertical line after the given size (used as an indicator
21         // for the first line of the commit message)
22         float characterWidth = [@" " sizeWithAttributes:[self typingAttributes]].width;
23         float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength];
25     [[NSColor lightGrayColor] set];
26         // This depends upon the fact that NSTextView always redraws complete lines.
27         float padding = [[self textContainer] lineFragmentPadding];
28         NSRect line;
29         line.origin.x = padding + aRect.origin.x + lineWidth;
30     line.origin.y = aRect.origin.y;
31         line.size.width = 1;
32         line.size.height = aRect.size.height;
33         NSRectFill(line);
35         [self setBackgroundColor:nil];
36         [super drawRect:aRect];
37         [self setBackgroundColor:originalColor];
40 @end