Permalink
Browse files

HistoryView: Change the way the HEAD is displayed

It used to be displayed in bold, but this can be easily overlooked when
visualizing all branches. It's easier to see the HEAD when it has its own
colour.
  • Loading branch information...
1 parent c00f736 commit 58ac6ed1ff46816a31c2a326ae24413573ca9d87 @hardkrash hardkrash committed with Jun 8, 2009
Showing with 10 additions and 13 deletions.
  1. +9 −12 PBGitRevisionCell.m
  2. +1 −1 html/views/history/history.css
View
@@ -108,20 +108,14 @@ - (void) drawTriangleInRect: (NSRect) r sign: (char) sign
[path stroke];
}
-- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected isCurrentBranch: (BOOL) curBranch
+- (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected
{
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:fontName size:9] forKey:NSFontAttributeName];
+ [attributes setObject:[NSFont fontWithName:@"Helvetica" size:9] forKey:NSFontAttributeName];
//if (selected)
// [attributes setObject:[NSColor alternateSelectedControlTextColor] forKey:NSForegroundColorAttributeName];
@@ -131,6 +125,11 @@ - (NSMutableDictionary*) attributesForRefLabelSelected: (BOOL) selected isCurren
- (NSColor*) colorForRef: (PBGitRef*) ref
{
+ BOOL isHEAD = [ref.ref isEqualToString:[[[controller repository] headRef] simpleRef]];
+
+ if (isHEAD)
+ return [NSColor colorWithCalibratedRed: 0Xfc/256.0 green:0Xa6/256.0 blue: 0X4f/256.0 alpha: 1.0];
+
NSString* type = [ref type];
if ([type isEqualToString:@"head"])
return [NSColor colorWithCalibratedRed: 0Xaa/256.0 green:0Xf2/256.0 blue: 0X54/256.0 alpha: 1.0];
@@ -154,7 +153,7 @@ -(NSArray *)rectsForRefsinRect:(NSRect) rect;
lastRect.origin.y = round(lastRect.origin.y) - 0.5;
for (PBGitRef *ref in self.objectValue.refs) {
- NSMutableDictionary* attributes = [self attributesForRefLabelSelected:NO isCurrentBranch:NO];
+ NSMutableDictionary* attributes = [self attributesForRefLabelSelected:NO];
NSSize textSize = [[ref shortName] sizeWithAttributes:attributes];
NSRect newRect = lastRect;
@@ -174,10 +173,8 @@ - (void) drawLabelAtIndex:(int)index inRect:(NSRect)rect
{
NSArray *refs = self.objectValue.refs;
PBGitRef *ref = [refs objectAtIndex:index];
- BOOL isCurBranch = [ref.ref isEqualToString:[[[controller repository] headRef] simpleRef]];
- NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]
- isCurrentBranch:isCurBranch];
+ NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]];
NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:rect cornerRadius: 2.0];
[[self colorForRef:ref] set];
[border fill];
@@ -135,7 +135,7 @@ a.showdiff {
}
.refs.currentBranch {
- font-weight: bold;
+ background-color: #fca64f;
}
div.button

0 comments on commit 58ac6ed

Please sign in to comment.