Skip to content
This repository was archived by the owner on Feb 21, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions VVDocumenter-Xcode/Commenter/VVBaseCommenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,38 @@ -(NSString *) startComment
NSString *descriptionTag =
[[VVDocumenterSetting defaultSetting] briefDescription] && !self.forSwift ? @"@brief " : @"";

NSString *authorInfo = @"";

if ([[VVDocumenterSetting defaultSetting] useAuthorInformation] && !self.forSwift) {
NSMutableString *authorCotent = @"".mutableCopy;

if ([[VVDocumenterSetting defaultSetting] authorInformation].length > 0) {
[authorCotent appendString:[[VVDocumenterSetting defaultSetting] authorInformation]];
}

if ([[VVDocumenterSetting defaultSetting] useDateInformation]) {
NSString *formatString = [[VVDocumenterSetting defaultSetting] dateInformationFormat];
if ([formatString length] <= 0) {
formatString = @"MM-dd-YYYY HH:MM:ss";
}
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:formatString];

if (authorCotent.length > 0) {
[authorCotent appendString:@", "];
}
[authorCotent appendString:[formatter stringFromDate:[NSDate date]]];
}

authorInfo = [NSString stringWithFormat:@"%@@Author %@\n%@\n", self.prefixString, authorCotent, self.prefixString];
}

if ([[VVDocumenterSetting defaultSetting] useHeaderDoc]) {
return [NSString stringWithFormat:@"%@/*!\n%@%@<#Description#>\n", self.indent, self.prefixString, descriptionTag];
return [NSString stringWithFormat:@"%@/*!\n%@%@%@<#Description#>\n", self.indent, authorInfo, self.prefixString, descriptionTag];
} else if ([[VVDocumenterSetting defaultSetting] prefixWithSlashes]) {
return [NSString stringWithFormat:@"%@%@<#Description#>\n", self.prefixString, descriptionTag];
return [NSString stringWithFormat:@"%@%@%@<#Description#>\n", self.prefixString, authorInfo, descriptionTag];
} else {
return [NSString stringWithFormat:@"%@/**\n%@%@<#Description#>\n", self.indent, self.prefixString, descriptionTag];
return [NSString stringWithFormat:@"%@/**\n%@%@%@<#Description#>\n", self.indent, authorInfo, self.prefixString, descriptionTag];
}
}

Expand Down
39 changes: 36 additions & 3 deletions VVDocumenter-Xcode/Setting/VVDSettingPanelWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ @interface VVDSettingPanelWindowController ()<NSTextFieldDelegate>
@property (weak) IBOutlet NSButton *btnUseHeaderDoc;
@property (weak) IBOutlet NSButton *btnBlankLinesBetweenSections;
@property (weak) IBOutlet NSButton *btnAlightArgumentComments;
@property (weak) IBOutlet NSButton *btnUseAuthorInformation;
@property (weak) IBOutlet NSButton *btnUseDateInformation;
@property (weak) IBOutlet NSTextField *tfAuthoInformation;
@property (weak) IBOutlet NSTextField *tfDateInformaitonFormat;

@end

@implementation VVDSettingPanelWindowController
Expand Down Expand Up @@ -53,7 +58,11 @@ - (void)windowDidLoad
self.btnUseHeaderDoc.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useHeaderDoc];
self.btnBlankLinesBetweenSections.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] blankLinesBetweenSections];
self.btnAlightArgumentComments.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] alignArgumentComments];

self.btnUseAuthorInformation.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useAuthorInformation];
self.tfAuthoInformation.stringValue = [[VVDocumenterSetting defaultSetting] authorInformation];
self.btnUseDateInformation.state = (NSCellStateValue)[[VVDocumenterSetting defaultSetting] useDateInformation];
self.tfDateInformaitonFormat.stringValue = [[VVDocumenterSetting defaultSetting] dateInformationFormat];

if ([[VVDocumenterSetting defaultSetting] prefixWithStar]) {
[self.mtxPrefixOptions selectCell:self.btnPrefixWithStar];
} else if ([[VVDocumenterSetting defaultSetting] prefixWithSlashes]) {
Expand All @@ -71,6 +80,8 @@ - (void)windowDidLoad
[self syncSpaceCount];

self.tfTrigger.delegate = self;
self.tfDateInformaitonFormat.delegate = self;
self.tfAuthoInformation.delegate = self;
}

- (IBAction)stepperPressed:(id)sender {
Expand All @@ -89,7 +100,11 @@ - (IBAction)btnResetPressed:(id)sender {
[[VVDocumenterSetting defaultSetting] setUseHeaderDoc:NO];
[[VVDocumenterSetting defaultSetting] setBlankLinesBetweenSections:YES];
[[VVDocumenterSetting defaultSetting] setAlignArgumentComments:YES];

[[VVDocumenterSetting defaultSetting] setUseAuthorInformation:NO];
[[VVDocumenterSetting defaultSetting] setAuthorInformation:VVDDefaultAuthorString];
[[VVDocumenterSetting defaultSetting] setUseDateInformation:NO];
[[VVDocumenterSetting defaultSetting] setDateInformationFormat:VVDDefaultDateInfomationFormat];

self.btnUseSpaces.state = NSOnState;
[self updateUseSpace:self.btnUseSpaces.state];
self.btnPrefixWithWhitespace.state = NSOffState;
Expand All @@ -101,7 +116,11 @@ - (IBAction)btnResetPressed:(id)sender {
self.btnUseHeaderDoc.state = NSOffState;
self.btnBlankLinesBetweenSections.state = NSOnState;
self.btnAlightArgumentComments.state = NSOnState;

self.btnUseAuthorInformation.state = NSOffState;
self.tfAuthoInformation.stringValue = VVDDefaultAuthorString;
self.btnUseDateInformation.state = NSOffState;
self.tfDateInformaitonFormat.stringValue = VVDDefaultDateInfomationFormat;

self.btnPrefixWithSlashes.enabled = YES;

[self syncSpaceCount];
Expand All @@ -128,6 +147,14 @@ - (IBAction)btnBriefDescriptionPressed:(id)sender {
[[VVDocumenterSetting defaultSetting] setBriefDescription:self.btnBriefDescription.state];
}

- (IBAction)btnUseAuthorInformationPressed:(id)sender {
[[VVDocumenterSetting defaultSetting] setUseAuthorInformation:self.btnUseAuthorInformation.state];
}

- (IBAction)btnUseDateInformationPressed:(id)sender {
[[VVDocumenterSetting defaultSetting] setUseDateInformation:self.btnUseDateInformation.state];
}

-(void) syncSpaceCount
{
NSInteger spaceCount = [[VVDocumenterSetting defaultSetting] spaceCount];
Expand All @@ -147,6 +174,12 @@ - (void)controlTextDidChange:(NSNotification *)notification
if([notification object] == self.tfTrigger) {
[[VVDocumenterSetting defaultSetting] setTriggerString:self.tfTrigger.stringValue];
}
if([notification object] == self.tfAuthoInformation) {
[[VVDocumenterSetting defaultSetting] setAuthorInformation:self.tfAuthoInformation.stringValue];
}
if([notification object] == self.tfDateInformaitonFormat) {
[[VVDocumenterSetting defaultSetting] setDateInformationFormat:self.tfDateInformaitonFormat.stringValue];
}
}

- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
Expand Down
Loading