Skip to content

Commit 10b9fa0

Browse files
committed
working
1 parent fb95611 commit 10b9fa0

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

PBGitHistoryController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
}
5858

5959
@property (readonly) NSTreeController* treeController;
60+
@property (readonly) PBCollapsibleSplitView *historySplitView;
6061
@property (assign) int selectedCommitDetailsIndex;
6162
@property (retain) PBGitCommit *webCommit;
6263
@property (retain) PBGitTree* gitTree;

PBGitHistoryController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ @implementation PBGitHistoryController
4848
@synthesize searchController;
4949
@synthesize commitList;
5050
@synthesize treeController;
51+
@synthesize historySplitView;
5152

5253
- (void)awakeFromNib
5354
{

PBGitWindowController.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#import <Cocoa/Cocoa.h>
1010
#import "PBGitRepository.h"
1111

12+
#define kGitSplitViewMinWidth 150.0f
13+
#define kGitSplitViewMaxWidth 300.0f
14+
1215
@class PBViewController, PBGitSidebarController, PBGitCommitController;
1316

1417
@interface PBGitWindowController : NSWindowController {
@@ -39,6 +42,7 @@
3942
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
4043
- (void)showErrorSheet:(NSError *)error;
4144
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
45+
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show;
4246

4347
- (IBAction) showCommitView:(id)sender;
4448
- (IBAction) showHistoryView:(id)sender;

PBGitWindowController.m

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,38 @@ - (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode
217217

218218
- (IBAction) changeLayout:(id)sender{
219219
NSLog(@"selectedSegment=%ld (%d)",[sender selectedSegment],[sender isSelectedForSegment:[sender selectedSegment]]);
220+
NSSplitView *sp=nil;
221+
switch ([sender selectedSegment]) {
222+
case 0:
223+
sp=splitView;
224+
break;
225+
case 1:
226+
sp=[[sidebarController historyViewController] historySplitView];
227+
break;
228+
}
229+
NSLog(@"sp=%@",sp);
230+
if(sp!=nil) {
231+
[self collapseSplitView:sp show:[sender isSelectedForSegment:[sender selectedSegment]]];
232+
}
220233
}
221234

235+
- (void)collapseSplitView:(NSSplitView *)sp show:(BOOL)show{
236+
NSView *clipview = [[sp subviews] objectAtIndex:0];
237+
NSRect clipFrame = [clipview frame];
238+
239+
if ([sp isVertical]) {
240+
clipFrame.size.width = kGitSplitViewMinWidth * show;
241+
}else{
242+
clipFrame.size.height = kGitSplitViewMinWidth * show;
243+
}
244+
[clipview setFrame:clipFrame];
245+
[sp adjustSubviews];
246+
}
222247

223248

224249
#pragma mark -
225250
#pragma mark SplitView Delegates
226251

227-
#define kGitSplitViewMinWidth 150.0f
228-
#define kGitSplitViewMaxWidth 300.0f
229-
230252
#pragma mark min/max widths while moving the divider
231253

232254
- (CGFloat)splitView:(NSSplitView *)view constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex

0 commit comments

Comments
 (0)