diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 7be28b4..b639e3a 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -20,6 +20,9 @@ 913D5E500E55645900CECEA2 /* gitx in Resources */ = {isa = PBXBuildFile; fileRef = 913D5E490E55644600CECEA2 /* gitx */; }; 913D5E5F0E556A9300CECEA2 /* PBCLIProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 913D5E5E0E556A9300CECEA2 /* PBCLIProxy.mm */; }; 91B103CC0E898EC300C84364 /* PBIconAndTextCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = 91B103CB0E898EC300C84364 /* PBIconAndTextCell.mm */; }; + 93CB42C20EAB7B2200530609 /* PBGitDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB42C10EAB7B2200530609 /* PBGitDefaults.m */; }; + 93F7857F0EA3ABF100C1F443 /* PBCommitMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */; }; + 93FCCBA90EA8AF450061B02B /* PBGitConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 93FCCBA80EA8AF450061B02B /* PBGitConfig.m */; }; D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; }; F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */; }; F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; }; @@ -59,7 +62,6 @@ F5B721C40E05CF7E00AF29DC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F5B721C20E05CF7E00AF29DC /* MainMenu.xib */; }; F5C007750E731B48007B84B2 /* PBGitRef.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C007740E731B48007B84B2 /* PBGitRef.m */; }; F5C6F68D0E65FF9300478D97 /* PBGitLane.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C6F68C0E65FF9300478D97 /* PBGitLane.m */; }; - F5D2DC870EA401A80034AD24 /* PBGitConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = F5D2DC860EA401A80034AD24 /* PBGitConfig.m */; }; F5DFFA6C0E075D8800617813 /* PBEasyFS.m in Sources */ = {isa = PBXBuildFile; fileRef = F5DFFA6B0E075D8800617813 /* PBEasyFS.m */; }; F5E4DBFB0EAB58D90013FAFC /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5E4DBFA0EAB58D90013FAFC /* SystemConfiguration.framework */; }; F5E926060E8827D300056E75 /* PBViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F5E926050E8827D300056E75 /* PBViewController.m */; }; @@ -122,6 +124,11 @@ 913D5E5E0E556A9300CECEA2 /* PBCLIProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PBCLIProxy.mm; sourceTree = ""; }; 91B103CA0E898EC300C84364 /* PBIconAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBIconAndTextCell.h; sourceTree = ""; }; 91B103CB0E898EC300C84364 /* PBIconAndTextCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PBIconAndTextCell.mm; sourceTree = ""; }; + 93CB42C00EAB7B2200530609 /* PBGitDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitDefaults.h; sourceTree = ""; }; + 93CB42C10EAB7B2200530609 /* PBGitDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitDefaults.m; sourceTree = ""; }; + 93F7857D0EA3ABF100C1F443 /* PBCommitMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitMessageView.h; sourceTree = ""; }; + 93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitMessageView.m; sourceTree = ""; }; + 93FCCBA80EA8AF450061B02B /* PBGitConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitConfig.m; sourceTree = ""; }; D26DC6440E782C9000C777B2 /* gitx.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = gitx.icns; sourceTree = ""; }; F50FE0E10E07BE9600854FCD /* PBGitRevisionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevisionCell.h; sourceTree = ""; }; F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevisionCell.m; sourceTree = ""; }; @@ -181,7 +188,6 @@ F5C6F68B0E65FF9300478D97 /* PBGitLane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitLane.h; sourceTree = ""; }; F5C6F68C0E65FF9300478D97 /* PBGitLane.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitLane.m; sourceTree = ""; }; F5D2DC850EA401A80034AD24 /* PBGitConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitConfig.h; sourceTree = ""; }; - F5D2DC860EA401A80034AD24 /* PBGitConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitConfig.m; sourceTree = ""; }; F5DFFA6A0E075D8800617813 /* PBEasyFS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBEasyFS.h; sourceTree = ""; }; F5DFFA6B0E075D8800617813 /* PBEasyFS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBEasyFS.m; sourceTree = ""; }; F5E4DBFA0EAB58D90013FAFC /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = /System/Library/Frameworks/SystemConfiguration.framework; sourceTree = ""; }; @@ -348,7 +354,7 @@ F53C4DF50E97FC630022AD59 /* PBGitBinary.h */, F53C4DF60E97FC630022AD59 /* PBGitBinary.m */, F5D2DC850EA401A80034AD24 /* PBGitConfig.h */, - F5D2DC860EA401A80034AD24 /* PBGitConfig.m */, + 93FCCBA80EA8AF450061B02B /* PBGitConfig.m */, ); name = Git; sourceTree = ""; @@ -360,6 +366,8 @@ F5E927F90E883EF600056E75 /* Commit */, 77C8280B06725ACE000B614F /* ApplicationController.h */, 77C8280C06725ACE000B614F /* ApplicationController.m */, + 93CB42C00EAB7B2200530609 /* PBGitDefaults.h */, + 93CB42C10EAB7B2200530609 /* PBGitDefaults.m */, F57CC43F0E05E496000472E2 /* PBGitWindowController.h */, F57CC4400E05E496000472E2 /* PBGitWindowController.m */, 911111F60E594F3F00BF76B4 /* PBRepositoryDocumentController.h */, @@ -466,6 +474,8 @@ F59116E80E843BCB0072CCB1 /* PBGitCommitController.m */, F5E927FA0E883F0700056E75 /* PBWebChangesController.h */, F5E927FB0E883F0700056E75 /* PBWebChangesController.m */, + 93F7857D0EA3ABF100C1F443 /* PBCommitMessageView.h */, + 93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */, ); name = Commit; sourceTree = ""; @@ -609,7 +619,9 @@ F56244090E9684B0002B6C44 /* PBUnsortableTableHeader.m in Sources */, F53C4DF70E97FC630022AD59 /* PBGitBinary.m in Sources */, F593DF780E9E636C003A8559 /* PBFileChangesTableView.m in Sources */, - F5D2DC870EA401A80034AD24 /* PBGitConfig.m in Sources */, + 93F7857F0EA3ABF100C1F443 /* PBCommitMessageView.m in Sources */, + 93FCCBA90EA8AF450061B02B /* PBGitConfig.m in Sources */, + 93CB42C20EAB7B2200530609 /* PBGitDefaults.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PBCommitMessageView.h b/PBCommitMessageView.h new file mode 100644 index 0000000..0dbe073 --- /dev/null +++ b/PBCommitMessageView.h @@ -0,0 +1,15 @@ +// +// PBCommitMessageView.h +// GitX +// +// Created by Jeff Mesnil on 13/10/08. +// Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved. +// + +#import + +@interface PBCommitMessageView : NSTextView { + +} + +@end diff --git a/PBCommitMessageView.m b/PBCommitMessageView.m new file mode 100644 index 0000000..02714c0 --- /dev/null +++ b/PBCommitMessageView.m @@ -0,0 +1,40 @@ +// +// PBCommitMessageView.m +// GitX +// +// Created by Jeff Mesnil on 13/10/08. +// Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved. +// + +#import "PBCommitMessageView.h" +#import "PBGitDefaults.h" + +@implementation PBCommitMessageView + +- (void)drawRect:(NSRect)aRect +{ + NSColor *originalColor = [self backgroundColor]; + [originalColor set]; + NSRectFill(aRect); + + // draw a vertical line after the given size (used as an indicator + // for the first line of the commit message) + float characterWidth = [@" " sizeWithAttributes:[self typingAttributes]].width; + float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength]; + + [[NSColor lightGrayColor] set]; + // This depends upon the fact that NSTextView always redraws complete lines. + float padding = [[self textContainer] lineFragmentPadding]; + NSRect line; + line.origin.x = padding + aRect.origin.x + lineWidth; + line.origin.y = aRect.origin.y; + line.size.width = 1; + line.size.height = aRect.size.height; + NSRectFill(line); + + [self setBackgroundColor:nil]; + [super drawRect:aRect]; + [self setBackgroundColor:originalColor]; +} + +@end diff --git a/PBGitCommitView.xib b/PBGitCommitView.xib index 281a669..76d760e 100644 --- a/PBGitCommitView.xib +++ b/PBGitCommitView.xib @@ -3,12 +3,12 @@ 1050 9F33 - 670 + 672 949.34 352.00 YES - + YES @@ -1421,6 +1421,7 @@ 130.IBPluginDependency 131.IBPluginDependency 132.IBPluginDependency + 133.CustomClassName 133.IBPluginDependency 163.IBPluginDependency 164.IBPluginDependency @@ -1453,7 +1454,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilderKit com.apple.InterfaceBuilderKit - {{358, 206}, {852, 432}} + {{37, 206}, {852, 432}} com.apple.InterfaceBuilder.CocoaPlugin @@ -1463,6 +1464,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + PBCommitMessageView com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1516,6 +1518,14 @@ YES + + PBCommitMessageView + NSTextView + + IBProjectSource + PBCommitMessageView.h + + PBFileChangesTableView NSTableView @@ -1601,14 +1611,12 @@ YES cachedFilesController controller - previousFile unstagedFilesController YES NSArrayController PBGitCommitController - id NSArrayController diff --git a/PBGitDefaults.h b/PBGitDefaults.h new file mode 100644 index 0000000..baf4912 --- /dev/null +++ b/PBGitDefaults.h @@ -0,0 +1,16 @@ +// +// PBGitDefaults.h +// GitX +// +// Created by Jeff Mesnil on 19/10/08. +// Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved. +// + +@interface PBGitDefaults : NSObject +{ + +} + ++ (int) commitMessageViewVerticalLineLength; + +@end diff --git a/PBGitDefaults.m b/PBGitDefaults.m new file mode 100644 index 0000000..61662ca --- /dev/null +++ b/PBGitDefaults.m @@ -0,0 +1,30 @@ +// +// PBGitDefaults.m +// GitX +// +// Created by Jeff Mesnil on 19/10/08. +// Copyright 2008 Jeff Mesnil (http://jmesnil.net/). All rights reserved. +// + +#import "PBGitDefaults.h" + +#define kDefaultVerticalLineLength 50 +#define kCommitMessageViewVerticalLineLength @"PBCommitMessageViewVerticalLineLength" + +@implementation PBGitDefaults + ++ (void)initialize +{ + NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; + [defaultValues setObject:[NSNumber numberWithInt:kDefaultVerticalLineLength] + forKey:kCommitMessageViewVerticalLineLength]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; + NSLog(@"registered defaults: %@", defaultValues); +} + ++ (int) commitMessageViewVerticalLineLength +{ + return [[NSUserDefaults standardUserDefaults] integerForKey:kCommitMessageViewVerticalLineLength]; +} + +@end