diff --git a/English.lproj/Preferences.xib b/English.lproj/Preferences.xib index 73cdd074e..6487b92e3 100644 --- a/English.lproj/Preferences.xib +++ b/English.lproj/Preferences.xib @@ -2,13 +2,13 @@ 1050 - 11A459e - 1565 - 1121.2 - 557.00 + 11D50d + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 1565 + 2182 YES @@ -33,11 +33,8 @@ com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - - + PluginDependencyRecalculationVersion + YES @@ -58,7 +55,7 @@ 268 - {{18, 197}, {158, 18}} + {{18, 206}, {158, 18}} @@ -91,7 +88,7 @@ 268 - {{17, 34}, {166, 17}} + {{17, 22}, {166, 17}} @@ -125,7 +122,7 @@ 268 - {{182, 24}, {137, 32}} + {{182, 12}, {137, 32}} @@ -145,20 +142,20 @@ 75 - + 268 - {{248, 129}, {41, 22}} + {{275, 113}, {41, 22}} YES - + -1804468671 272630784 - + YES 6 @@ -169,7 +166,7 @@ MQA - + 6 System textColor @@ -177,10 +174,47 @@ + + + 268 + {{74, 116}, {196, 17}} + + + + YES + + 68288064 + 272630784 + Display body guide at column: + + + + + + + + + 268 + {{290, 138}, {41, 22}} + + + + YES + + -1804468671 + 272630784 + + + + YES + + + + 268 - {{121, 131}, {122, 17}} + {{74, 143}, {211, 17}} @@ -188,7 +222,7 @@ 68288064 272630784 - Display at column: + Display subject guide at column: @@ -198,7 +232,7 @@ 268 - {{18, 157}, {273, 18}} + {{18, 166}, {322, 18}} @@ -206,7 +240,7 @@ -2080244224 0 - Show column guide in commit message + Show vertical column guide in commit message 1211912703 @@ -222,7 +256,7 @@ 268 - {{17, 104}, {99, 17}} + {{17, 88}, {99, 17}} @@ -248,7 +282,7 @@ NSFilenamesPboardType - {{121, 100}, {179, 22}} + {{121, 84}, {179, 22}} @@ -272,7 +306,7 @@ 268 - {{118, 64}, {192, 28}} + {{118, 48}, {192, 28}} @@ -290,7 +324,7 @@ 268 - {{306, 104}, {54, 14}} + {{306, 88}, {54, 14}} @@ -317,7 +351,7 @@ 268 - {{18, 177}, {203, 18}} + {{18, 186}, {203, 18}} @@ -341,7 +375,7 @@ 268 - {{18, 217}, {279, 18}} + {{18, 226}, {279, 18}} @@ -365,7 +399,7 @@ 268 - {{18, 237}, {279, 18}} + {{18, 246}, {279, 18}} @@ -389,7 +423,7 @@ 268 - {{18, 257}, {207, 18}} + {{18, 266}, {207, 18}} @@ -413,7 +447,7 @@ 268 - {{18, 277}, {207, 18}} + {{18, 286}, {207, 18}} @@ -435,7 +469,7 @@ - {401, 313} + {401, 322} @@ -608,7 +642,7 @@ formatterBehavior timeStyle - + YES %m/%d/%y @@ -616,7 +650,7 @@ - EEEE, d MMMM, y h:mm:ss a + EEEE, MMMM d, y h:mm:ss a NO @@ -859,6 +893,62 @@ 8 + + + checkGitValidity: + + + + 58 + + + + gitPathController + + + + 59 + + + + gitPathOpenAccessory + + + + 65 + + + + showHideAllFiles: + + + + 66 + + + + resetGitPath: + + + + 79 + + + + integrationPrefsView + + + + 92 + + + + resetAllDialogWarnings: + + + + 140 + value: automaticallyChecksForUpdates @@ -939,14 +1029,6 @@ 41 - - - delegate - - - - 54 - checkForUpdates: @@ -955,73 +1037,13 @@ 55 - - - checkGitValidity: - - - - 58 - - - - gitPathController - - - - 59 - delegate - + - 61 - - - - gitPathOpenAccessory - - - - 65 - - - - showHideAllFiles: - - - - 66 - - - - resetGitPath: - - - - 79 - - - - hidden: values.gitExecutable - - - - - - hidden: values.gitExecutable - hidden - values.gitExecutable - - NSValueTransformerName - NSIsNil - - 2 - - - 83 + 54 @@ -1042,7 +1064,7 @@ NSNullPlaceholder NSValueTransformerName - + YES No Executable set @@ -1056,27 +1078,31 @@ - integrationPrefsView - - + delegate + + - 92 + 61 - value: values.PBEnableGist - + hidden: values.gitExecutable + - + - value: values.PBEnableGist - value - values.PBEnableGist + hidden: values.gitExecutable + hidden + values.gitExecutable + + NSValueTransformerName + NSIsNil + 2 - 94 + 83 @@ -1094,6 +1120,22 @@ 96 + + + value: values.PBEnableGist + + + + + + value: values.PBEnableGist + value + values.PBEnableGist + 2 + + + 94 + value: values.PBConfirmPublicGists @@ -1233,18 +1275,14 @@ value: values.PBCommitMessageViewVerticalLineLength value values.PBCommitMessageViewVerticalLineLength + + NSContinuouslyUpdatesValue + + 2 - 135 - - - - resetAllDialogWarnings: - - - - 140 + 181 @@ -1326,13 +1364,35 @@ 165 + + + value: values.PBCommitMessageViewVerticalBodyLineLength + + + + + + value: values.PBCommitMessageViewVerticalBodyLineLength + value + values.PBCommitMessageViewVerticalBodyLineLength + + NSContinuouslyUpdatesValue + + + 2 + + + 182 + YES 0 - + + YES + @@ -1365,15 +1425,17 @@ + + + - General @@ -1708,20 +1770,6 @@ - - 130 - - - YES - - - - - - 131 - - - 136 @@ -1860,18 +1908,59 @@ + + 167 + + + YES + + + + + + 168 + + + YES + + + + + + 169 + + + + + 170 + + + + + 130 + + + YES + + + + + + 131 + + + YES YES + -1.IBPluginDependency + -2.IBPluginDependency -3.IBPluginDependency - 1.IBEditorWindowLastContentRect 1.IBPluginDependency 1.IBUserGuides - 1.WindowOrigin - 1.editorWindowContentRectSynchronizationRect 10.IBPluginDependency 108.IBPluginDependency 109.IBPluginDependency @@ -1892,26 +1981,26 @@ 131.IBPluginDependency 136.IBAttributePlaceholdersKey 136.IBPluginDependency - 136.IBViewBoundsToFrameTransform 137.IBPluginDependency - 137.IBViewBoundsToFrameTransform 138.IBPluginDependency 139.IBPluginDependency 14.IBPluginDependency 141.IBPluginDependency - 141.IBViewBoundsToFrameTransform 142.IBPluginDependency - 145.IBViewBoundsToFrameTransform + 145.IBPluginDependency 146.IBPluginDependency 147.IBPluginDependency - 15.IBEditorWindowLastContentRect 15.IBPluginDependency 155.IBPluginDependency 156.IBPluginDependency 16.IBPluginDependency 162.IBPluginDependency 163.IBPluginDependency + 167.IBPluginDependency + 168.IBPluginDependency + 169.IBPluginDependency 17.IBPluginDependency + 170.IBPluginDependency 18.IBPluginDependency 19.IBPluginDependency 20.IBPluginDependency @@ -1920,8 +2009,8 @@ 23.IBPluginDependency 24.IBPluginDependency 25.IBPluginDependency + 26.IBPluginDependency 28.IBPluginDependency - 4.IBEditorWindowLastContentRect 4.IBPluginDependency 4.IBUserGuides 42.IBPluginDependency @@ -1931,16 +2020,13 @@ 46.IBPluginDependency 47.IBPluginDependency 48.IBPluginDependency - 62.IBEditorWindowLastContentRect 62.IBPluginDependency 63.IBPluginDependency 64.IBPluginDependency 77.IBPluginDependency 78.IBPluginDependency - 87.IBEditorWindowLastContentRect 87.IBPluginDependency 88.IBPluginDependency - 88.IBViewBoundsToFrameTransform 89.IBPluginDependency 9.IBPluginDependency 90.IBPluginDependency @@ -1948,21 +2034,25 @@ 97.IBPluginDependency 98.IBPluginDependency - + YES com.apple.InterfaceBuilder.CocoaPlugin - {{511, 477}, {401, 279}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + YES 121 0 + + + 76 + 0 + - {628, 654} - {{217, 442}, {480, 272}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1990,27 +2080,14 @@ com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABDXwAAwggAAA - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCaAAAwegAAA - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAADBcAAAw3QAAA - com.apple.InterfaceBuilder.CocoaPlugin - - AUKaAABCvgAAA - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{443, 712}, {103, 71}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2027,7 +2104,12 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{324, 683}, {400, 139}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin YES @@ -2044,18 +2126,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{505, 405}, {239, 54}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{329, 400}, {400, 136}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCYAAAwoIAAA - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2076,7 +2153,7 @@ - 165 + 182 @@ -2101,7 +2178,7 @@ resetGitPath: showHideAllFiles: - + YES id id @@ -2118,7 +2195,7 @@ resetGitPath: showHideAllFiles: - + YES checkGitValidity: @@ -2149,7 +2226,7 @@ integrationPrefsView updatesPrefsView - + YES NSImageView NSView @@ -2170,7 +2247,7 @@ integrationPrefsView updatesPrefsView - + YES badGitPathIcon @@ -2241,10 +2318,6 @@ com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 @@ -2260,10 +2333,10 @@ NSStopProgressFreestandingTemplate NSSwitch - + YES - {9, 8} - {7, 2} + {11, 11} + {10, 3} {83, 83} {15, 15} diff --git a/PBCommitMessageView.m b/PBCommitMessageView.m index da24242c2..ec412bb60 100644 --- a/PBCommitMessageView.m +++ b/PBCommitMessageView.m @@ -11,23 +11,61 @@ @implementation PBCommitMessageView +- (void) awakeFromNib +{ + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + [defaults addObserver:self + forKeyPath:@"PBCommitMessageViewHasVerticalLine" + options:NSKeyValueObservingOptionNew + context:NULL]; + + [defaults addObserver:self + forKeyPath:@"PBCommitMessageViewVerticalLineLength" + options:NSKeyValueObservingOptionNew + context:NULL]; + + [defaults addObserver:self + forKeyPath:@"PBCommitMessageViewVerticalBodyLineLength" + options:NSKeyValueObservingOptionNew + context:NULL]; +} + +-(void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +{ + [self setNeedsDisplay:YES]; +} + - (void)drawRect:(NSRect)aRect { [super drawRect:aRect]; - // draw a vertical line after the given size (used as an indicator - // for the first line of the commit message) if ([PBGitDefaults commitMessageViewHasVerticalLine]) { + float characterWidth = [@" " sizeWithAttributes:[self typingAttributes]].width; float lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalLineLength]; + NSRect line; + float padding; + float textViewHeight = [self bounds].size.height; + // draw a vertical line after the given size (used as an indicator + // for the first line of the commit message) [[NSColor lightGrayColor] set]; - float padding = [[self textContainer] lineFragmentPadding]; - NSRect line; + padding = [[self textContainer] lineFragmentPadding]; + line.origin.x = padding + lineWidth; + line.origin.y = 0; + line.size.width = 1; + line.size.height = textViewHeight; + NSRectFill(line); + + // and one for the body of the commit message + lineWidth = lineWidth = characterWidth * [PBGitDefaults commitMessageViewVerticalBodyLineLength]; + [[NSColor darkGrayColor] set]; + padding = [[self textContainer] lineFragmentPadding]; line.origin.x = padding + lineWidth; line.origin.y = 0; line.size.width = 1; - line.size.height = [self bounds].size.height; + line.size.height = textViewHeight; NSRectFill(line); } } diff --git a/PBGitDefaults.h b/PBGitDefaults.h index b23a2ee6b..86c18037b 100644 --- a/PBGitDefaults.h +++ b/PBGitDefaults.h @@ -12,6 +12,7 @@ } + (int) commitMessageViewVerticalLineLength; ++ (int) commitMessageViewVerticalBodyLineLength; + (BOOL) commitMessageViewHasVerticalLine; + (BOOL) isGistEnabled; + (BOOL) isGravatarEnabled; diff --git a/PBGitDefaults.m b/PBGitDefaults.m index 13895d79f..c0aee1460 100644 --- a/PBGitDefaults.m +++ b/PBGitDefaults.m @@ -11,6 +11,8 @@ #define kDefaultVerticalLineLength 50 #define kCommitMessageViewVerticalLineLength @"PBCommitMessageViewVerticalLineLength" +#define kDefaultVerticalBodyLineLength 72 +#define kCommitMessageViewVerticalBodyLineLength @"PBCommitMessageViewVerticalBodyLineLength" #define kCommitMessageViewHasVerticalLine @"PBCommitMessageViewHasVerticalLine" #define kEnableGist @"PBEnableGist" #define kEnableGravatar @"PBEnableGravatar" @@ -40,6 +42,8 @@ + (void)initialize NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary]; [defaultValues setObject:[NSNumber numberWithInt:kDefaultVerticalLineLength] forKey:kCommitMessageViewVerticalLineLength]; + [defaultValues setObject:[NSNumber numberWithInt:kDefaultVerticalBodyLineLength] + forKey:kCommitMessageViewVerticalBodyLineLength]; [defaultValues setObject:[NSNumber numberWithBool:YES] forKey:kCommitMessageViewHasVerticalLine]; [defaultValues setObject:[NSNumber numberWithBool:YES] @@ -83,6 +87,11 @@ + (BOOL) commitMessageViewHasVerticalLine return [[NSUserDefaults standardUserDefaults] boolForKey:kCommitMessageViewHasVerticalLine]; } ++ (int) commitMessageViewVerticalBodyLineLength +{ + return [[NSUserDefaults standardUserDefaults] integerForKey:kCommitMessageViewVerticalBodyLineLength]; +} + + (BOOL) isGistEnabled { return [[NSUserDefaults standardUserDefaults] boolForKey:kEnableGist];