History view: Make lozenge of currently checked out branch (HEAD) bold, same as gitk.

This commit is contained in:
Christian Jacobsen
2008-10-09 07:59:35 +02:00
committed by Pieter de Bie
parent 4b27186a83
commit 63523d00e8
5 changed files with 19 additions and 5 deletions
+1
View File
@@ -37,6 +37,7 @@ extern NSString* PBGitRepositoryErrorDomain;
- (void) addRef:(PBGitRef *)ref fromParameters:(NSArray *)params;
- (BOOL) removeRef:(NSString *)ref;
- (void) lazyReload;
- (PBGitRevSpecifier*) headRef;
- (void) readCurrentBranch;
- (PBGitRevSpecifier*) addBranch: (PBGitRevSpecifier*) rev;
+12 -4
View File
@@ -109,14 +109,20 @@
[path stroke];
}
- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected
- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected isCurrentBranch: (BOOL) curBranch
{
NSMutableDictionary *attributes = [[[NSMutableDictionary alloc] initWithCapacity:2] autorelease];
NSMutableParagraphStyle* style = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
NSString *fontName;
if(curBranch)
fontName = @"Helvetica-Bold";
else
fontName = @"Helvetica";
[style setAlignment:NSCenterTextAlignment];
[attributes setObject:style forKey:NSParagraphStyleAttributeName];
[attributes setObject:[NSFont fontWithName:@"Helvetica" size:9] forKey:NSFontAttributeName];
[attributes setObject:[NSFont fontWithName:fontName size:9] forKey:NSFontAttributeName];
//if (selected)
// [attributes setObject:[NSColor alternateSelectedControlTextColor] forKey:NSForegroundColorAttributeName];
@@ -149,9 +155,11 @@
int index;
for (index = 0; index < [refs count]; ++index) {
PBGitRef* ref = [refs objectAtIndex:index];
PBGitRef *ref = [refs objectAtIndex:index];
BOOL isCurBranch = [ref.ref isEqualToString:[[[controller repository] headRef] simpleRef]];
NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]];
NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]
isCurrentBranch:isCurBranch];
NSSize refSize = [[ref shortName] sizeWithAttributes:attributes];
refRect.size.width = refSize.width + ref_padding;
+1
View File
@@ -49,6 +49,7 @@
id script = [view windowScriptObject];
[script setValue: content forKey:@"CommitObject"];
[script setValue:[[[historyController repository] headRef] simpleRef] forKey:@"CurrentBranch"];
// The sha is the same, but refs may have changed.. reload it lazy
if ([currentSha isEqualToString: content.sha])
+2 -1
View File
@@ -108,7 +108,8 @@ var showRefs = function() {
$('refs').parentNode.style.display = "";
$('refs').innerHTML = "";
$A(commit.refs).each(function(ref) {
$('refs').innerHTML += '<span class="refs ' + ref.type() + '">' + ref.shortName() + '</span>';
curBranch = "";
$('refs').innerHTML += '<span class="refs ' + ref.type() + (CurrentBranch == ref.ref ? ' currentBranch' : '') + '">' + ref.shortName() + '</span>';
});
} else
$('refs').parentNode.style.display = "none";
+3
View File
@@ -81,3 +81,6 @@ a.showdiff {
background-color: #fced4f;
}
.refs.currentBranch {
font-weight: bold;
}