diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h
index fadb6cd..5808b31 100644
--- a/PBGitHistoryController.h
+++ b/PBGitHistoryController.h
@@ -27,12 +27,15 @@
PBGitCommit* webCommit;
PBGitCommit* rawCommit;
PBGitCommit* realCommit;
+
+ CGFloat fontSize;
}
@property (assign) int selectedTab;
@property (retain) PBGitCommit *webCommit, *rawCommit;
@property (retain) PBGitTree* gitTree;
@property (readonly) NSArrayController *commitController;
+@property (assign) CGFloat fontSize;
- (IBAction) setDetailedView: sender;
- (IBAction) setRawView: sender;
diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m
index a9fde36..397e14b 100644
--- a/PBGitHistoryController.m
+++ b/PBGitHistoryController.m
@@ -13,12 +13,21 @@
#import "PBCommitList.h"
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
+static NSString* HistoryFontSize=@"History Font Size";
@implementation PBGitHistoryController
-@synthesize selectedTab, webCommit, rawCommit, gitTree, commitController;
+@synthesize selectedTab, webCommit, rawCommit, gitTree,
commitController, fontSize;
+
++(void)initialize {
+ if (self == [PBGitHistoryController class]) {
+ NSDictionary* defaults = [NSDictionary
dictionaryWithObject:[NSNumber numberWithFloat:[NSFont
systemFontSize]] forKey:HistoryFontSize];
+ [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
+ }
+}
- (void)awakeFromNib
{
+ self.fontSize = [[NSUserDefaults standardUserDefaults]
floatForKey:HistoryFontSize];
self.selectedTab = [[NSUserDefaults standardUserDefaults]
integerForKey:@"Repository Window Selected Tab Index"];;
[commitController addObserver:self forKeyPath:@"selection"
options:(NSKeyValueObservingOptionNew,NSKeyValueObservingOptionOld)
context:@"commitChange"];
[treeController addObserver:self forKeyPath:@"selection" options:0
context:@"treeChange"];
@@ -78,6 +87,11 @@ - (void) setSelectedTab: (int) number
[self updateKeys];
}
+-(void)setFontSize:(CGFloat)newSize {
+ fontSize = newSize;
+ [commitList setRowHeight:ceil(fontSize*1.3)];
+}
+
- (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object change:(NSDictionary *)change context:(void
*)context
{
if ([(NSString *)context isEqualToString: @"commitChange"]) {
diff --git a/PBGitRevisionCell.h b/PBGitRevisionCell.h
index d6aa4ed..f0072ab 100644
--- a/PBGitRevisionCell.h
+++ b/PBGitRevisionCell.h
@@ -16,6 +16,7 @@
PBGitCommit *objectValue;
PBGraphCellInfo *cellInfo;
NSTextFieldCell *textCell;
+ CGFloat fontSize;
IBOutlet PBGitHistoryController *controller;
IBOutlet id<PBRefContextDelegate> contextMenuDelegate;
}
diff --git a/PBGitRevisionCell.m b/PBGitRevisionCell.m
index 98f978b..87c187a 100644
--- a/PBGitRevisionCell.m
+++ b/PBGitRevisionCell.m
@@ -62,7 +62,8 @@ - (void) drawCircleInRect: (NSRect) r
NSPoint origin = r.origin;
NSPoint columnOrigin = { origin.x + columnWidth * c, origin.y};
- NSRect oval = { columnOrigin.x - 5, columnOrigin.y + r.size.height *
0.5 - 5, 10, 10};
+ CGFloat radius = fontSize*0.4;
+ NSRect oval = { columnOrigin.x - radius, columnOrigin.y +
r.size.height * 0.5 - radius, radius*2, radius*2};
NSBezierPath * path = [NSBezierPath bezierPathWithOvalInRect:oval];
@@ -70,7 +71,8 @@ - (void) drawCircleInRect: (NSRect) r
[[NSColor blackColor] set];
[path fill];
- NSRect smallOval = { columnOrigin.x - 3, columnOrigin.y +
r.size.height * 0.5 - 3, 6, 6};
+ CGFloat smallRadius = radius*0.6;
+ NSRect smallOval = { columnOrigin.x - smallRadius, columnOrigin.y +
r.size.height * 0.5 - smallRadius, smallRadius*2, smallRadius*2};
[[NSColor whiteColor] set];
path = [NSBezierPath bezierPathWithOvalInRect:smallOval];
[path fill];
@@ -115,7 +117,7 @@ - (NSMutableDictionary*)
attributesForRefLabelSelected: (BOOL) selected
[style setAlignment:NSCenterTextAlignment];
[attributes setObject:style forKey:NSParagraphStyleAttributeName];
- [attributes setObject:[NSFont fontWithName:@"Helvetica" size:9]
forKey:NSFontAttributeName];
+ [attributes setObject:[NSFont fontWithName:@"Helvetica"
size:ceil(fontSize*0.75)] forKey:NSFontAttributeName];
//if (selected)
// [attributes setObject:[NSColor alternateSelectedControlTextColor]
forKey:NSForegroundColorAttributeName];
@@ -236,6 +238,10 @@ - (void) drawWithFrame: (NSRect) rect inView:(NSView *)view
[textCell setHighlighted: [self isHighlighted]];
[textCell drawWithFrame:rect inView: view];
}
+-(void)setFont:(NSFont*)font {
+ fontSize = font.pointSize;
+ [textCell setFont:font];
+}
- (void) setObjectValue: (PBGitCommit*)object {
[super setObjectValue:[NSValue valueWithNonretainedObject:object]];
--
1.6.5.rc1.44.ga1675.dirty
- Pieter