Skip to content

Commit 708c08a

Browse files
committed
First part of splitting views
1 parent 53636f4 commit 708c08a

14 files changed

+2274
-2005
lines changed

ApplicationController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import "ApplicationController.h"
1010
#import "PBGitRevisionCell.h"
11-
#import "PBDetailController.h"
11+
#import "PBGitWindowController.h"
1212
#import "PBRepositoryDocumentController.h"
1313
#import "PBCLIProxy.h"
1414

Documentation/GraphingAPI.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ drawn on the top or bottom part of the row. Furthermore, it has a colorIndex
1313
to indicate the color the line should be given. Note that this number
1414
increases forever, so you can modulo it with the number of colors you have.
1515

16-
In the PBDetailController, the -
16+
In the PBGitWindowController, the -
1717
(void)tableView:willDisplayCell:forTableColumn:row: is implemented which sets
1818
the correct PBGraphCellInfo for the cell to be drawn. This cell is of the
1919
class PBGitRevisionCell, which has the actual drawing implementation.

English.lproj/MainMenu.xib

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
33
<data>
44
<int key="IBDocument.SystemTarget">1050</int>
5-
<string key="IBDocument.SystemVersion">9E17</string>
5+
<string key="IBDocument.SystemVersion">9F33</string>
66
<string key="IBDocument.InterfaceBuilderVersion">670</string>
7-
<string key="IBDocument.AppKitVersion">949.33</string>
7+
<string key="IBDocument.AppKitVersion">949.34</string>
88
<string key="IBDocument.HIToolboxVersion">352.00</string>
99
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
1010
<bool key="EncodedWithXMLCoder">YES</bool>
11-
<integer value="57"/>
1211
</object>
1312
<object class="NSArray" key="IBDocument.PluginDependencies">
1413
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2238,7 +2237,7 @@
22382237
</object>
22392238
</object>
22402239
<object class="IBPartialClassDescription">
2241-
<string key="className">PBDetailController</string>
2240+
<string key="className">PBGitWindowController</string>
22422241
<string key="superclassName">NSWindowController</string>
22432242
<object class="NSMutableDictionary" key="actions">
22442243
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2281,8 +2280,8 @@
22812280
</object>
22822281
</object>
22832282
<object class="IBClassDescriptionSource" key="sourceIdentifier">
2284-
<string key="majorKey">IBProjectSource</string>
2285-
<string key="minorKey">PBDetailController.h</string>
2283+
<string key="majorKey">IBUserSource</string>
2284+
<string key="minorKey"/>
22862285
</object>
22872286
</object>
22882287
<object class="IBPartialClassDescription">

English.lproj/RepositoryWindow.xib

+140-1,942
Large diffs are not rendered by default.

GitX.xcodeproj/project.pbxproj

+16-6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; };
2222
F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */; };
2323
F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; };
24+
F52BCE030E84208300AA3741 /* PBGitHistoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */; };
25+
F52BCE070E84211300AA3741 /* PBGitHistoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = F52BCE060E84211300AA3741 /* PBGitHistoryController.m */; };
2426
F53FF2050E7ABB5300389171 /* PBGitRevSpecifier.m in Sources */ = {isa = PBXBuildFile; fileRef = F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */; };
2527
F561727F0E056A11001DCD79 /* diff_style.css in Resources */ = {isa = PBXBuildFile; fileRef = F561727C0E056A11001DCD79 /* diff_style.css */; };
2628
F56173280E056ED2001DCD79 /* diffHighlighter.js in Resources */ = {isa = PBXBuildFile; fileRef = F56173270E056ED2001DCD79 /* diffHighlighter.js */; };
@@ -37,7 +39,7 @@
3739
F57ABE0B0E0442DD00A088B8 /* commit.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABDDE0E0441DE00A088B8 /* commit.js */; };
3840
F57ABE2B0E04435100A088B8 /* prototype.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABE180E04431D00A088B8 /* prototype.js */; };
3941
F57CC3910E05DDF2000472E2 /* PBEasyPipe.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC3900E05DDF2000472E2 /* PBEasyPipe.m */; };
40-
F57CC4410E05E496000472E2 /* PBDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC4400E05E496000472E2 /* PBDetailController.m */; };
42+
F57CC4410E05E496000472E2 /* PBGitWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC4400E05E496000472E2 /* PBGitWindowController.m */; };
4143
F580E6AE0E733276009E2D3F /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F580E6AD0E733276009E2D3F /* Sparkle.framework */; };
4244
F580E6B10E73328C009E2D3F /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F580E6AD0E733276009E2D3F /* Sparkle.framework */; };
4345
F58A8F280E043698007E3FC0 /* commits.css in Resources */ = {isa = PBXBuildFile; fileRef = F58A8F270E043698007E3FC0 /* commits.css */; };
@@ -100,6 +102,9 @@
100102
F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevisionCell.m; sourceTree = "<group>"; };
101103
F51308590E0740F2000C8BCD /* PBQLOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBQLOutlineView.h; sourceTree = "<group>"; };
102104
F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBQLOutlineView.m; sourceTree = "<group>"; };
105+
F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBGitHistoryView.xib; sourceTree = "<group>"; };
106+
F52BCE050E84211300AA3741 /* PBGitHistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitHistoryController.h; sourceTree = "<group>"; };
107+
F52BCE060E84211300AA3741 /* PBGitHistoryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitHistoryController.m; sourceTree = "<group>"; };
103108
F53EE3590E06BBA00022B925 /* CWQuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWQuickLook.h; sourceTree = "<group>"; };
104109
F53FF2030E7ABB5300389171 /* PBGitRevSpecifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevSpecifier.h; sourceTree = "<group>"; };
105110
F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevSpecifier.m; sourceTree = "<group>"; };
@@ -125,8 +130,8 @@
125130
F57ABE180E04431D00A088B8 /* prototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = prototype.js; path = html/prototype.js; sourceTree = "<group>"; };
126131
F57CC38F0E05DDF2000472E2 /* PBEasyPipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBEasyPipe.h; sourceTree = "<group>"; };
127132
F57CC3900E05DDF2000472E2 /* PBEasyPipe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBEasyPipe.m; sourceTree = "<group>"; };
128-
F57CC43F0E05E496000472E2 /* PBDetailController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBDetailController.h; sourceTree = "<group>"; };
129-
F57CC4400E05E496000472E2 /* PBDetailController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBDetailController.m; sourceTree = "<group>"; };
133+
F57CC43F0E05E496000472E2 /* PBGitWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitWindowController.h; sourceTree = "<group>"; };
134+
F57CC4400E05E496000472E2 /* PBGitWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitWindowController.m; sourceTree = "<group>"; };
130135
F580E6AD0E733276009E2D3F /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
131136
F58A8F270E043698007E3FC0 /* commits.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = commits.css; path = html/commits.css; sourceTree = "<group>"; };
132137
F5945E150E02B0C200706420 /* PBGitRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRepository.h; sourceTree = "<group>"; };
@@ -241,6 +246,7 @@
241246
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
242247
F5B721C20E05CF7E00AF29DC /* MainMenu.xib */,
243248
911111E00E58BD5A00BF76B4 /* RepositoryWindow.xib */,
249+
F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */,
244250
);
245251
name = Resources;
246252
sourceTree = "<group>";
@@ -297,12 +303,14 @@
297303
F565262A0E03D89B00F03B52 /* PBWebGitController.m */,
298304
77C8280B06725ACE000B614F /* ApplicationController.h */,
299305
77C8280C06725ACE000B614F /* ApplicationController.m */,
300-
F57CC43F0E05E496000472E2 /* PBDetailController.h */,
301-
F57CC4400E05E496000472E2 /* PBDetailController.m */,
306+
F57CC43F0E05E496000472E2 /* PBGitWindowController.h */,
307+
F57CC4400E05E496000472E2 /* PBGitWindowController.m */,
302308
911111F60E594F3F00BF76B4 /* PBRepositoryDocumentController.h */,
303309
911111F70E594F3F00BF76B4 /* PBRepositoryDocumentController.m */,
304310
913D5E5D0E556A9300CECEA2 /* PBCLIProxy.h */,
305311
913D5E5E0E556A9300CECEA2 /* PBCLIProxy.mm */,
312+
F52BCE050E84211300AA3741 /* PBGitHistoryController.h */,
313+
F52BCE060E84211300AA3741 /* PBGitHistoryController.m */,
306314
);
307315
name = Controllers;
308316
sourceTree = "<group>";
@@ -431,6 +439,7 @@
431439
F5B721C40E05CF7E00AF29DC /* MainMenu.xib in Resources */,
432440
911111E20E58BD5A00BF76B4 /* RepositoryWindow.xib in Resources */,
433441
D26DC6450E782C9000C777B2 /* gitx.icns in Resources */,
442+
F52BCE030E84208300AA3741 /* PBGitHistoryView.xib in Resources */,
434443
);
435444
runOnlyForDeploymentPostprocessing = 0;
436445
};
@@ -450,7 +459,7 @@
450459
F565262B0E03D89B00F03B52 /* PBWebGitController.m in Sources */,
451460
F56174570E058893001DCD79 /* PBGitTree.m in Sources */,
452461
F57CC3910E05DDF2000472E2 /* PBEasyPipe.m in Sources */,
453-
F57CC4410E05E496000472E2 /* PBDetailController.m in Sources */,
462+
F57CC4410E05E496000472E2 /* PBGitWindowController.m in Sources */,
454463
F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */,
455464
F5DFFA6C0E075D8800617813 /* PBEasyFS.m in Sources */,
456465
F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */,
@@ -464,6 +473,7 @@
464473
F5C007750E731B48007B84B2 /* PBGitRef.m in Sources */,
465474
F5AD56790E79B78100EDAAFE /* PBCommitList.m in Sources */,
466475
F53FF2050E7ABB5300389171 /* PBGitRevSpecifier.m in Sources */,
476+
F52BCE070E84211300AA3741 /* PBGitHistoryController.m in Sources */,
467477
);
468478
runOnlyForDeploymentPostprocessing = 0;
469479
};

PBDetailController.h renamed to PBGitHistoryController.h

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
11
//
2-
// PBDetailController.h
2+
// PBGitHistoryView.h
33
// GitX
44
//
5-
// Created by Pieter de Bie on 16-06-08.
5+
// Created by Pieter de Bie on 19-09-08.
66
// Copyright 2008 __MyCompanyName__. All rights reserved.
77
//
88

99
#import <Cocoa/Cocoa.h>
10-
#import "PBGitRepository.h"
1110
#import "PBGitCommit.h"
1211
#import "PBGitTree.h"
12+
#import "PBGitRepository.h"
13+
#import "PBGitWindowController.h"
14+
15+
@interface PBGitHistoryController : NSViewController {
16+
PBGitRepository* repository;
17+
PBGitWindowController *superController;
1318

14-
@interface PBDetailController : NSWindowController {
19+
IBOutlet NSSearchField* searchField;
1520
IBOutlet NSArrayController* commitController;
1621
IBOutlet NSTreeController* treeController;
1722
IBOutlet NSOutlineView* fileBrowser;
18-
IBOutlet NSSearchField* searchField;
19-
IBOutlet NSTableView* commitList;
20-
23+
IBOutlet NSTableView* commitList;
2124
int selectedTab;
22-
23-
PBGitRepository* repository;
25+
2426
PBGitTree* gitTree;
2527
PBGitCommit* webCommit;
2628
PBGitCommit* rawCommit;
2729
PBGitCommit* realCommit;
30+
2831
}
2932

33+
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller;
34+
3035
@property (assign) int selectedTab;
31-
@property (retain) PBGitRepository* repository;
32-
@property (retain) PBGitCommit* webCommit;
33-
@property (retain) PBGitCommit* rawCommit;
36+
@property (retain) PBGitCommit *webCommit, *rawCommit;
37+
@property (retain) PBGitRepository *repository;
3438
@property (retain) PBGitTree* gitTree;
35-
36-
- (id)initWithRepository:(PBGitRepository*)theRepository;
39+
@property (readonly) NSArrayController *commitController;
3740

3841
- (IBAction) setDetailedView: sender;
3942
- (IBAction) setRawView: sender;

PBDetailController.m renamed to PBGitHistoryController.m

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
11
//
2-
// PBDetailController.m
2+
// PBGitHistoryView.m
33
// GitX
44
//
5-
// Created by Pieter de Bie on 16-06-08.
5+
// Created by Pieter de Bie on 19-09-08.
66
// Copyright 2008 __MyCompanyName__. All rights reserved.
77
//
88

9-
#import "PBDetailController.h"
9+
#import "PBGitHistoryController.h"
1010
#import "CWQuickLook.h"
1111
#import "PBGitGrapher.h"
1212
#import "PBGitRevisionCell.h"
1313
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
1414

1515

16-
@implementation PBDetailController
16+
@implementation PBGitHistoryController
17+
@synthesize repository, selectedTab, webCommit, rawCommit, gitTree, commitController;
1718

18-
@synthesize repository, selectedTab, webCommit, rawCommit, gitTree;
19-
20-
- (id)initWithRepository:(PBGitRepository*)theRepository;
19+
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
2120
{
22-
if(self = [self initWithWindowNibName:@"RepositoryWindow"])
23-
{
21+
if(self = [self initWithNibName:@"PBGitHistoryView" bundle:nil]) {
2422
self.repository = theRepository;
25-
[self showWindow:nil];
23+
superController = controller;
2624
}
25+
2726
return self;
2827
}
2928

3029
- (void)awakeFromNib
3130
{
32-
[fileBrowser setTarget:self];
33-
[fileBrowser setDoubleAction:@selector(openSelectedFile:)];
3431
self.selectedTab = [[NSUserDefaults standardUserDefaults] integerForKey:@"Repository Window Selected Tab Index"];;
3532
[commitController addObserver:self forKeyPath:@"selection" options:(NSKeyValueObservingOptionNew,NSKeyValueObservingOptionOld) context:@"commitChange"];
3633
[treeController addObserver:self forKeyPath:@"selection" options:0 context:@"treeChange"];
3734
NSSize cellSpacing = [commitList intercellSpacing];
3835
cellSpacing.height = 0;
3936
[commitList setIntercellSpacing:cellSpacing];
37+
[fileBrowser setTarget:self];
38+
[fileBrowser setDoubleAction:@selector(openSelectedFile:)];
4039
}
4140

4241
- (void) updateKeys
4342
{
4443
NSArray* selection = [commitController selectedObjects];
45-
44+
4645
// Remove any references in the QLPanel
47-
[[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray array] currentIndex:0 preservingDisplayState:YES];
46+
//[[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray array] currentIndex:0 preservingDisplayState:YES];
4847
// We have to do this manually, as NSTreeController leaks memory?
49-
[treeController setSelectionIndexPaths:[NSArray array]];
50-
48+
//[treeController setSelectionIndexPaths:[NSArray array]];
49+
5150
if ([selection count] > 0)
5251
realCommit = [selection objectAtIndex:0];
5352
else
@@ -56,7 +55,7 @@ - (void) updateKeys
5655
self.webCommit = nil;
5756
self.rawCommit = nil;
5857
self.gitTree = nil;
59-
58+
6059
switch (self.selectedTab) {
6160
case 0: self.webCommit = realCommit; break;
6261
case 1: self.rawCommit = realCommit; break;
@@ -79,9 +78,9 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
7978
return;
8079
}
8180
else if ([(NSString *)context isEqualToString: @"treeChange"]) {
82-
[self updateQuicklookForce: NO];
81+
[self updateQuicklookForce: NO];
8382
}
84-
83+
8584
else {
8685
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
8786
}
@@ -109,8 +108,9 @@ - (IBAction) setTreeView: sender {
109108

110109
- (void)keyDown:(NSEvent*)event
111110
{
111+
NSLog(@"Key down!");
112112
if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
113-
[[self window] makeFirstResponder:searchField];
113+
[superController focusOnSearchField];
114114
else
115115
[super keyDown: event];
116116
}
@@ -132,7 +132,7 @@ - (void) updateQuicklookForce: (BOOL) force
132132
return;
133133

134134
NSArray* selectedFiles = [treeController selectedObjects];
135-
135+
136136
if ([selectedFiles count] == 0)
137137
return;
138138

@@ -142,9 +142,9 @@ - (void) updateQuicklookForce: (BOOL) force
142142
if (s)
143143
[fileNames addObject:[NSURL fileURLWithPath: s]];
144144
}
145-
145+
146146
[[QLPreviewPanel sharedPreviewPanel] setURLs:fileNames currentIndex:0 preservingDisplayState:YES];
147-
147+
148148
}
149149

150150
- (IBAction) refresh: sender
@@ -161,4 +161,5 @@ - (void) selectCommit: (NSString*) commit
161161
int index = [[commitController selectionIndexes] firstIndex];
162162
[commitList scrollRowToVisible: index];
163163
}
164+
164165
@end

0 commit comments

Comments
 (0)