Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build/revision
*.xcodeproj/*.tm_build_errors
*.tmproj
Nightly.app.zip

.DS_Store
7 changes: 7 additions & 0 deletions GitX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,14 @@
isa = PBXProject;
buildConfigurationList = 26FC0A880875C7B200E6366F /* Build configuration list for PBXProject "GitX" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
Japanese,
French,
German,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* GitTest */;
projectDirPath = "";
projectRoot = "";
Expand Down
3 changes: 2 additions & 1 deletion PBGitHistoryController.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ - (void)awakeFromNib
[[commitList headerView] setMenu:[self tableColumnMenu]];
[historySplitView setTopMin:33.0 andBottomMin:100.0];
[historySplitView uncollapse];
[historySplitView restoreDefault:@"splitpos"];
[super awakeFromNib];
}

Expand Down Expand Up @@ -205,7 +206,7 @@ - (void) removeView
[commitController removeObserver:self forKeyPath:@"selection"];
[treeController removeObserver:self forKeyPath:@"selection"];
[repository removeObserver:self forKeyPath:@"currentBranch"];

[historySplitView saveDefault:@"splitpos"];
[super removeView];
}

Expand Down
3 changes: 3 additions & 0 deletions PBNiceSplitView.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@

}

- (void) restoreDefault: (NSString *) defaultName;
- (void) saveDefault: (NSString *) defaultName;

@end
41 changes: 41 additions & 0 deletions PBNiceSplitView.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,45 @@ - (CGFloat)dividerThickness
return 10.0;
}

- (void) restoreDefault: (NSString *) defaultName
{
NSString * string = [[NSUserDefaults standardUserDefaults] objectForKey: defaultName];

if (string == nil)
return; // there was no saved default

NSScanner* scanner = [NSScanner scannerWithString: string];
NSRect r0, r1;

BOOL didScan =
[scanner scanFloat: &(r0.origin.x)] &&
[scanner scanFloat: &(r0.origin.y)] &&
[scanner scanFloat: &(r0.size.width)] &&
[scanner scanFloat: &(r0.size.height)] &&
[scanner scanFloat: &(r1.origin.x)] &&
[scanner scanFloat: &(r1.origin.y)] &&
[scanner scanFloat: &(r1.size.width)] &&
[scanner scanFloat: &(r1.size.height)];

if (didScan == NO)
return; // probably should throw an exception at this point

[[[self subviews] objectAtIndex: 0] setFrame: r0];
[[[self subviews] objectAtIndex: 1] setFrame: r1];

[self adjustSubviews];
}

- (void) saveDefault: (NSString *) defaultName
{
NSRect r0 = [[[self subviews] objectAtIndex: 0] frame];
NSRect r1 = [[[self subviews] objectAtIndex: 1] frame];

NSString * string = [NSString stringWithFormat: @"%f %f %f %f %f %f %f %f",
r0.origin.x, r0.origin.y, r0.size.width, r0.size.height,
r1.origin.x, r1.origin.y, r1.size.width, r1.size.height];

[[NSUserDefaults standardUserDefaults] setObject: string forKey: defaultName];
}

@end