Permalink
Browse files

First part of splitting views

  • Loading branch information...
1 parent 53636f4 commit 708c08a293e7e858a79f3a5dd5948f1d508d8506 @pieter committed Sep 19, 2008
View
@@ -8,7 +8,7 @@
#import "ApplicationController.h"
#import "PBGitRevisionCell.h"
-#import "PBDetailController.h"
+#import "PBGitWindowController.h"
#import "PBRepositoryDocumentController.h"
#import "PBCLIProxy.h"
@@ -13,7 +13,7 @@ drawn on the top or bottom part of the row. Furthermore, it has a colorIndex
to indicate the color the line should be given. Note that this number
increases forever, so you can modulo it with the number of colors you have.
-In the PBDetailController, the -
+In the PBGitWindowController, the -
(void)tableView:willDisplayCell:forTableColumn:row: is implemented which sets
the correct PBGraphCellInfo for the cell to be drawn. This cell is of the
class PBGitRevisionCell, which has the actual drawing implementation.
View
@@ -2,13 +2,12 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9E17</string>
+ <string key="IBDocument.SystemVersion">9F33</string>
<string key="IBDocument.InterfaceBuilderVersion">670</string>
- <string key="IBDocument.AppKitVersion">949.33</string>
+ <string key="IBDocument.AppKitVersion">949.34</string>
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="57"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2238,7 +2237,7 @@
</object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">PBDetailController</string>
+ <string key="className">PBGitWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2281,8 +2280,8 @@
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">PBDetailController.h</string>
+ <string key="majorKey">IBUserSource</string>
+ <string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -21,6 +21,8 @@
D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; };
F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */; };
F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */; };
+ F52BCE030E84208300AA3741 /* PBGitHistoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */; };
+ F52BCE070E84211300AA3741 /* PBGitHistoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = F52BCE060E84211300AA3741 /* PBGitHistoryController.m */; };
F53FF2050E7ABB5300389171 /* PBGitRevSpecifier.m in Sources */ = {isa = PBXBuildFile; fileRef = F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */; };
F561727F0E056A11001DCD79 /* diff_style.css in Resources */ = {isa = PBXBuildFile; fileRef = F561727C0E056A11001DCD79 /* diff_style.css */; };
F56173280E056ED2001DCD79 /* diffHighlighter.js in Resources */ = {isa = PBXBuildFile; fileRef = F56173270E056ED2001DCD79 /* diffHighlighter.js */; };
@@ -37,7 +39,7 @@
F57ABE0B0E0442DD00A088B8 /* commit.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABDDE0E0441DE00A088B8 /* commit.js */; };
F57ABE2B0E04435100A088B8 /* prototype.js in Resources */ = {isa = PBXBuildFile; fileRef = F57ABE180E04431D00A088B8 /* prototype.js */; };
F57CC3910E05DDF2000472E2 /* PBEasyPipe.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC3900E05DDF2000472E2 /* PBEasyPipe.m */; };
- F57CC4410E05E496000472E2 /* PBDetailController.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC4400E05E496000472E2 /* PBDetailController.m */; };
+ F57CC4410E05E496000472E2 /* PBGitWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = F57CC4400E05E496000472E2 /* PBGitWindowController.m */; };
F580E6AE0E733276009E2D3F /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F580E6AD0E733276009E2D3F /* Sparkle.framework */; };
F580E6B10E73328C009E2D3F /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = F580E6AD0E733276009E2D3F /* Sparkle.framework */; };
F58A8F280E043698007E3FC0 /* commits.css in Resources */ = {isa = PBXBuildFile; fileRef = F58A8F270E043698007E3FC0 /* commits.css */; };
@@ -100,6 +102,9 @@
F50FE0E20E07BE9600854FCD /* PBGitRevisionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevisionCell.m; sourceTree = "<group>"; };
F51308590E0740F2000C8BCD /* PBQLOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBQLOutlineView.h; sourceTree = "<group>"; };
F513085A0E0740F2000C8BCD /* PBQLOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBQLOutlineView.m; sourceTree = "<group>"; };
+ F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBGitHistoryView.xib; sourceTree = "<group>"; };
+ F52BCE050E84211300AA3741 /* PBGitHistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitHistoryController.h; sourceTree = "<group>"; };
+ F52BCE060E84211300AA3741 /* PBGitHistoryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitHistoryController.m; sourceTree = "<group>"; };
F53EE3590E06BBA00022B925 /* CWQuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CWQuickLook.h; sourceTree = "<group>"; };
F53FF2030E7ABB5300389171 /* PBGitRevSpecifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRevSpecifier.h; sourceTree = "<group>"; };
F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRevSpecifier.m; sourceTree = "<group>"; };
@@ -125,8 +130,8 @@
F57ABE180E04431D00A088B8 /* prototype.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = prototype.js; path = html/prototype.js; sourceTree = "<group>"; };
F57CC38F0E05DDF2000472E2 /* PBEasyPipe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBEasyPipe.h; sourceTree = "<group>"; };
F57CC3900E05DDF2000472E2 /* PBEasyPipe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBEasyPipe.m; sourceTree = "<group>"; };
- F57CC43F0E05E496000472E2 /* PBDetailController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBDetailController.h; sourceTree = "<group>"; };
- F57CC4400E05E496000472E2 /* PBDetailController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBDetailController.m; sourceTree = "<group>"; };
+ F57CC43F0E05E496000472E2 /* PBGitWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitWindowController.h; sourceTree = "<group>"; };
+ F57CC4400E05E496000472E2 /* PBGitWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitWindowController.m; sourceTree = "<group>"; };
F580E6AD0E733276009E2D3F /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
F58A8F270E043698007E3FC0 /* commits.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = commits.css; path = html/commits.css; sourceTree = "<group>"; };
F5945E150E02B0C200706420 /* PBGitRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRepository.h; sourceTree = "<group>"; };
@@ -241,6 +246,7 @@
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
F5B721C20E05CF7E00AF29DC /* MainMenu.xib */,
911111E00E58BD5A00BF76B4 /* RepositoryWindow.xib */,
+ F52BCE020E84208300AA3741 /* PBGitHistoryView.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -297,12 +303,14 @@
F565262A0E03D89B00F03B52 /* PBWebGitController.m */,
77C8280B06725ACE000B614F /* ApplicationController.h */,
77C8280C06725ACE000B614F /* ApplicationController.m */,
- F57CC43F0E05E496000472E2 /* PBDetailController.h */,
- F57CC4400E05E496000472E2 /* PBDetailController.m */,
+ F57CC43F0E05E496000472E2 /* PBGitWindowController.h */,
+ F57CC4400E05E496000472E2 /* PBGitWindowController.m */,
911111F60E594F3F00BF76B4 /* PBRepositoryDocumentController.h */,
911111F70E594F3F00BF76B4 /* PBRepositoryDocumentController.m */,
913D5E5D0E556A9300CECEA2 /* PBCLIProxy.h */,
913D5E5E0E556A9300CECEA2 /* PBCLIProxy.mm */,
+ F52BCE050E84211300AA3741 /* PBGitHistoryController.h */,
+ F52BCE060E84211300AA3741 /* PBGitHistoryController.m */,
);
name = Controllers;
sourceTree = "<group>";
@@ -431,6 +439,7 @@
F5B721C40E05CF7E00AF29DC /* MainMenu.xib in Resources */,
911111E20E58BD5A00BF76B4 /* RepositoryWindow.xib in Resources */,
D26DC6450E782C9000C777B2 /* gitx.icns in Resources */,
+ F52BCE030E84208300AA3741 /* PBGitHistoryView.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -450,7 +459,7 @@
F565262B0E03D89B00F03B52 /* PBWebGitController.m in Sources */,
F56174570E058893001DCD79 /* PBGitTree.m in Sources */,
F57CC3910E05DDF2000472E2 /* PBEasyPipe.m in Sources */,
- F57CC4410E05E496000472E2 /* PBDetailController.m in Sources */,
+ F57CC4410E05E496000472E2 /* PBGitWindowController.m in Sources */,
F513085B0E0740F2000C8BCD /* PBQLOutlineView.m in Sources */,
F5DFFA6C0E075D8800617813 /* PBEasyFS.m in Sources */,
F50FE0E30E07BE9600854FCD /* PBGitRevisionCell.m in Sources */,
@@ -464,6 +473,7 @@
F5C007750E731B48007B84B2 /* PBGitRef.m in Sources */,
F5AD56790E79B78100EDAAFE /* PBCommitList.m in Sources */,
F53FF2050E7ABB5300389171 /* PBGitRevSpecifier.m in Sources */,
+ F52BCE070E84211300AA3741 /* PBGitHistoryController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1,39 +1,42 @@
//
-// PBDetailController.h
+// PBGitHistoryView.h
// GitX
//
-// Created by Pieter de Bie on 16-06-08.
+// Created by Pieter de Bie on 19-09-08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
-#import "PBGitRepository.h"
#import "PBGitCommit.h"
#import "PBGitTree.h"
+#import "PBGitRepository.h"
+#import "PBGitWindowController.h"
+
+@interface PBGitHistoryController : NSViewController {
+ PBGitRepository* repository;
+ PBGitWindowController *superController;
-@interface PBDetailController : NSWindowController {
+ IBOutlet NSSearchField* searchField;
IBOutlet NSArrayController* commitController;
IBOutlet NSTreeController* treeController;
IBOutlet NSOutlineView* fileBrowser;
- IBOutlet NSSearchField* searchField;
- IBOutlet NSTableView* commitList;
-
+ IBOutlet NSTableView* commitList;
int selectedTab;
-
- PBGitRepository* repository;
+
PBGitTree* gitTree;
PBGitCommit* webCommit;
PBGitCommit* rawCommit;
PBGitCommit* realCommit;
+
}
+- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller;
+
@property (assign) int selectedTab;
-@property (retain) PBGitRepository* repository;
-@property (retain) PBGitCommit* webCommit;
-@property (retain) PBGitCommit* rawCommit;
+@property (retain) PBGitCommit *webCommit, *rawCommit;
+@property (retain) PBGitRepository *repository;
@property (retain) PBGitTree* gitTree;
-
-- (id)initWithRepository:(PBGitRepository*)theRepository;
+@property (readonly) NSArrayController *commitController;
- (IBAction) setDetailedView: sender;
- (IBAction) setRawView: sender;
@@ -1,53 +1,52 @@
//
-// PBDetailController.m
+// PBGitHistoryView.m
// GitX
//
-// Created by Pieter de Bie on 16-06-08.
+// Created by Pieter de Bie on 19-09-08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
-#import "PBDetailController.h"
+#import "PBGitHistoryController.h"
#import "CWQuickLook.h"
#import "PBGitGrapher.h"
#import "PBGitRevisionCell.h"
#define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
-@implementation PBDetailController
+@implementation PBGitHistoryController
+@synthesize repository, selectedTab, webCommit, rawCommit, gitTree, commitController;
-@synthesize repository, selectedTab, webCommit, rawCommit, gitTree;
-
-- (id)initWithRepository:(PBGitRepository*)theRepository;
+- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
{
- if(self = [self initWithWindowNibName:@"RepositoryWindow"])
- {
+ if(self = [self initWithNibName:@"PBGitHistoryView" bundle:nil]) {
self.repository = theRepository;
- [self showWindow:nil];
+ superController = controller;
}
+
return self;
}
- (void)awakeFromNib
{
- [fileBrowser setTarget:self];
- [fileBrowser setDoubleAction:@selector(openSelectedFile:)];
self.selectedTab = [[NSUserDefaults standardUserDefaults] integerForKey:@"Repository Window Selected Tab Index"];;
[commitController addObserver:self forKeyPath:@"selection" options:(NSKeyValueObservingOptionNew,NSKeyValueObservingOptionOld) context:@"commitChange"];
[treeController addObserver:self forKeyPath:@"selection" options:0 context:@"treeChange"];
NSSize cellSpacing = [commitList intercellSpacing];
cellSpacing.height = 0;
[commitList setIntercellSpacing:cellSpacing];
+ [fileBrowser setTarget:self];
+ [fileBrowser setDoubleAction:@selector(openSelectedFile:)];
}
- (void) updateKeys
{
NSArray* selection = [commitController selectedObjects];
-
+
// Remove any references in the QLPanel
- [[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray array] currentIndex:0 preservingDisplayState:YES];
+ //[[QLPreviewPanel sharedPreviewPanel] setURLs:[NSArray array] currentIndex:0 preservingDisplayState:YES];
// We have to do this manually, as NSTreeController leaks memory?
- [treeController setSelectionIndexPaths:[NSArray array]];
-
+ //[treeController setSelectionIndexPaths:[NSArray array]];
+
if ([selection count] > 0)
realCommit = [selection objectAtIndex:0];
else
@@ -56,7 +55,7 @@ - (void) updateKeys
self.webCommit = nil;
self.rawCommit = nil;
self.gitTree = nil;
-
+
switch (self.selectedTab) {
case 0: self.webCommit = realCommit; break;
case 1: self.rawCommit = realCommit; break;
@@ -79,9 +78,9 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
return;
}
else if ([(NSString *)context isEqualToString: @"treeChange"]) {
- [self updateQuicklookForce: NO];
+ [self updateQuicklookForce: NO];
}
-
+
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
@@ -109,8 +108,9 @@ - (IBAction) setTreeView: sender {
- (void)keyDown:(NSEvent*)event
{
+ NSLog(@"Key down!");
if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
- [[self window] makeFirstResponder:searchField];
+ [superController focusOnSearchField];
else
[super keyDown: event];
}
@@ -132,7 +132,7 @@ - (void) updateQuicklookForce: (BOOL) force
return;
NSArray* selectedFiles = [treeController selectedObjects];
-
+
if ([selectedFiles count] == 0)
return;
@@ -142,9 +142,9 @@ - (void) updateQuicklookForce: (BOOL) force
if (s)
[fileNames addObject:[NSURL fileURLWithPath: s]];
}
-
+
[[QLPreviewPanel sharedPreviewPanel] setURLs:fileNames currentIndex:0 preservingDisplayState:YES];
-
+
}
- (IBAction) refresh: sender
@@ -161,4 +161,5 @@ - (void) selectCommit: (NSString*) commit
int index = [[commitController selectionIndexes] firstIndex];
[commitList scrollRowToVisible: index];
}
+
@end
Oops, something went wrong.

0 comments on commit 708c08a

Please sign in to comment.