Skip to content

Commit 36adc91

Browse files
committed
Vertical SplitView
1 parent 0e60b28 commit 36adc91

File tree

3 files changed

+655
-1632
lines changed

3 files changed

+655
-1632
lines changed

PBGitHistoryController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
IBOutlet NSOutlineView* fileBrowser;
3232
NSArray *currentFileBrowserSelectionPath;
3333
IBOutlet PBCommitList* commitList;
34-
IBOutlet PBCollapsibleSplitView *historySplitView;
34+
IBOutlet NSSplitView *historySplitView;
3535
IBOutlet PBWebHistoryController *webHistoryController;
3636
QLPreviewPanel* previewPanel;
3737
IBOutlet PBHistorySearchController *searchController;

PBGitHistoryController.m

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ - (void)awakeFromNib
8181
// Add a menu that allows a user to select which columns to view
8282
[[commitList headerView] setMenu:[self tableColumnMenu]];
8383

84-
[historySplitView setTopMin:58.0 andBottomMin:100.0];
8584
[historySplitView setHidden:YES];
8685
[self performSelector:@selector(restoreSplitViewPositiion) withObject:nil afterDelay:0];
8786

@@ -620,54 +619,7 @@ - (NSArray *)menuItemsForPaths:(NSArray *)paths
620619

621620
- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
622621
{
623-
return TRUE;
624-
}
625-
626-
- (BOOL)splitView:(NSSplitView *)splitView shouldCollapseSubview:(NSView *)subview forDoubleClickOnDividerAtIndex:(NSInteger)dividerIndex
627-
{
628-
NSUInteger index = [[splitView subviews] indexOfObject:subview];
629-
// this method (and canCollapse) are called by the splitView to decide how to collapse on double-click
630-
// we compare our two subviews, so that always the smaller one is collapsed.
631-
if([[[splitView subviews] objectAtIndex:index] frame].size.height < [[[splitView subviews] objectAtIndex:((index+1)%2)] frame].size.height) {
632-
return TRUE;
633-
}
634-
return FALSE;
635-
}
636-
637-
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
638-
{
639-
return historySplitView.topViewMin;
640-
}
641-
642-
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
643-
{
644-
return [splitView frame].size.height - [splitView dividerThickness] - historySplitView.bottomViewMin;
645-
}
646-
647-
// while the user resizes the window keep the upper (history) view constant and just resize the lower view
648-
// unless the lower view gets too small
649-
- (void)splitView:(NSSplitView *)splitView resizeSubviewsWithOldSize:(NSSize)oldSize
650-
{
651-
NSRect newFrame = [splitView frame];
652-
653-
float dividerThickness = [splitView dividerThickness];
654-
655-
NSView *upperView = [[splitView subviews] objectAtIndex:0];
656-
NSRect upperFrame = [upperView frame];
657-
upperFrame.size.width = newFrame.size.width;
658-
659-
if ((newFrame.size.height - upperFrame.size.height - dividerThickness) < historySplitView.bottomViewMin) {
660-
upperFrame.size.height = newFrame.size.height - historySplitView.bottomViewMin - dividerThickness;
661-
}
662-
663-
NSView *lowerView = [[splitView subviews] objectAtIndex:1];
664-
NSRect lowerFrame = [lowerView frame];
665-
lowerFrame.origin.y = upperFrame.size.height + dividerThickness;
666-
lowerFrame.size.height = newFrame.size.height - lowerFrame.origin.y;
667-
lowerFrame.size.width = newFrame.size.width;
668-
669-
[upperView setFrame:upperFrame];
670-
[lowerView setFrame:lowerFrame];
622+
return NO;
671623
}
672624

673625
// NSSplitView does not save and restore the position of the SplitView correctly so do it manually

0 commit comments

Comments
 (0)