Highlight the current commit with an orange circle

This commit is contained in:
ngu
2010-04-10 20:46:17 +03:00
committed by Nathan Kinsinger
parent 2ad624f7a8
commit 83e7c42ab4
3 changed files with 25 additions and 2 deletions
+1
View File
@@ -50,6 +50,7 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
NSMutableDictionary *refs;
PBGitRevSpecifier *_headRef; // Caching
NSString* _headSha;
}
- (void) cloneRepositoryToPath:(NSString *)path bare:(BOOL)isBare;
+7 -1
View File
@@ -234,6 +234,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
- (void) reloadRefs
{
_headRef = nil;
_headSha = nil;
refs = [NSMutableDictionary dictionary];
NSMutableArray *oldBranches = [branches mutableCopy];
@@ -287,12 +288,17 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
else
_headRef = [[PBGitRevSpecifier alloc] initWithRef:[PBGitRef refFromString:@"HEAD"]];
_headSha = [self shaForRef:[_headRef ref]];
return _headRef;
}
- (NSString *) headSHA
{
return [self shaForRef:[[self headRef] ref]];
if (! _headSha)
[self headRef];
return _headSha;
}
- (PBGitCommit *) headCommit
+17 -1
View File
@@ -54,6 +54,16 @@
}
- (BOOL) isCurrentCommit
{
NSString* thisSha = [self.objectValue realSha];
PBGitRepository* repository = [self.objectValue repository];
NSString* currentSha = [repository headSHA];
return [ currentSha isEqualToString : thisSha ];
}
- (void) drawCircleInRect: (NSRect) r
{
@@ -71,7 +81,13 @@
[path fill];
NSRect smallOval = { columnOrigin.x - 3, columnOrigin.y + r.size.height * 0.5 - 3, 6, 6};
[[NSColor whiteColor] set];
if ( [self isCurrentCommit ] ) {
[[NSColor colorWithCalibratedRed: 0Xfc/256.0 green:0Xa6/256.0 blue: 0X4f/256.0 alpha: 1.0] set];
} else {
[[NSColor whiteColor] set];
}
path = [NSBezierPath bezierPathWithOvalInRect:smallOval];
[path fill];
}