Skip to content

Commit

Permalink
Merge branch 'stable' of git://github.com/pieter/gitx
Browse files Browse the repository at this point in the history
Conflicts:
	PBViewController.m
  • Loading branch information
rastersize committed Sep 23, 2009
2 parents 15b394b + e901894 commit 68ea0b1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 14 deletions.
10 changes: 10 additions & 0 deletions PBGitHistoryController.m
Expand Up @@ -180,6 +180,13 @@ - (void) updateView
[self refresh:nil];
}

- (void)viewLoaded
{
float position = [[NSUserDefaults standardUserDefaults] floatForKey:@"PBGitSplitViewPosition"];
if (position)
[historySplitView setPosition:position ofDividerAtIndex:0];
}

- (NSResponder *)firstResponder;
{
return commitList;
Expand All @@ -201,6 +208,9 @@ - (BOOL) hasNonlinearPath

- (void) removeView
{
float position = [[[historySplitView subviews] objectAtIndex:0] frame].size.height;
[[NSUserDefaults standardUserDefaults] setFloat:position forKey:@"PBGitSplitViewPosition"];
[[NSUserDefaults standardUserDefaults] synchronize];
[webView close];
[commitController removeObserver:self forKeyPath:@"selection"];
[treeController removeObserver:self forKeyPath:@"selection"];
Expand Down
22 changes: 13 additions & 9 deletions PBGitWindowController.m
Expand Up @@ -70,28 +70,32 @@ - (void)changeViewController:(NSInteger)whichViewTag
selectedViewIndex = whichViewTag;
[[NSUserDefaults standardUserDefaults] setInteger:whichViewTag forKey:@"selectedViewIndex"];

BOOL justLoaded = NO;
switch (whichViewTag)
{
case 0: // swap in the "CustomImageViewController - NSImageView"
if (!historyViewController)
case 0:
if (!historyViewController) {
historyViewController = [[PBGitHistoryController alloc] initWithRepository:repository superController:self];
else
[historyViewController updateView];
justLoaded = YES;
}
viewController = historyViewController;
break;
case 1:
if (!commitViewController)
if (!commitViewController) {
commitViewController = [[PBGitCommitController alloc] initWithRepository:repository superController:self];
else
[commitViewController updateView];

justLoaded = YES;
}
viewController = commitViewController;
break;
}

// make sure we automatically resize the controller's view to the current window size
[[viewController view] setFrame: [contentView bounds]];

if (justLoaded)
[viewController viewLoaded];
else
[viewController updateView];

//// embed the current view to our host view
[contentView addSubview: [viewController view]];

Expand Down
12 changes: 12 additions & 0 deletions PBViewController.h
Expand Up @@ -21,8 +21,20 @@
@property (readonly) NSToolbar *viewToolbar;

- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller;

/* removeView is called whenever the view is removed, either to be swapped
* with a different view, or when the repository window will be destroyed
*/
- (void) removeView;

/* Updateview is called every time it is loaded into the main view */
- (void) updateView;

/* Called after awakeFromNib:, and the view has been loaded into the main view.
* Useful for resizing stuff after everything has been set in the right position
*/
- (void)viewLoaded;

- (NSResponder *)firstResponder;

- (IBAction) refresh:(id)sender;
Expand Down
14 changes: 9 additions & 5 deletions PBViewController.m
Expand Up @@ -35,19 +35,23 @@ - (void) awakeFromNib
{
}

// This is called when the view is displayed again; it
// should be updated to show the most recent information
- (void) updateView
- (NSResponder *)firstResponder;
{
return nil;
}

- (NSResponder *)firstResponder;
// The next methods should be implemented in the subclass if necessary
- (void)updateView
{
return nil;
}

- (IBAction) refresh:(id)sender
{
return;
}

- (void)viewLoaded
{
}

@end

0 comments on commit 68ea0b1

Please sign in to comment.