From c8cfe7acaa2c72d729ab3196b0e7ed1c307f1ba9 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Tue, 8 Sep 2009 13:09:40 +0200 Subject: [PATCH] Add start of a sourceview list This shows in a separate window for now, so we don't mess up the xibs. Once I'm satisfied with the result, I can put it into the main view with a single change :) --- GitX.xcodeproj/project.pbxproj | 24 ++ PBGitSidebarController.h | 20 ++ PBGitSidebarController.m | 29 +++ PBGitSidebarView.xib | 459 +++++++++++++++++++++++++++++++++ PBGitWindowController.h | 5 +- PBGitWindowController.m | 26 +- PBSourceViewItem.h | 20 ++ PBSourceViewItem.m | 29 +++ 8 files changed, 600 insertions(+), 12 deletions(-) create mode 100644 PBGitSidebarController.h create mode 100644 PBGitSidebarController.m create mode 100644 PBGitSidebarView.xib create mode 100644 PBSourceViewItem.h create mode 100644 PBSourceViewItem.m diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index be97512..a07e078 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -93,6 +93,9 @@ F5886A330ED5D5580066E74C /* PBGitRevSpecifier.m in Sources */ = {isa = PBXBuildFile; fileRef = F53FF2040E7ABB5300389171 /* PBGitRevSpecifier.m */; }; F5886A340ED5D55D0066E74C /* PBGitBinary.m in Sources */ = {isa = PBXBuildFile; fileRef = F53C4DF60E97FC630022AD59 /* PBGitBinary.m */; }; F5886A360ED5D56E0066E74C /* PBGitTree.m in Sources */ = {isa = PBXBuildFile; fileRef = F56174560E058893001DCD79 /* PBGitTree.m */; }; + F58DB55910566D3500CFDF4A /* PBGitSidebarController.m in Sources */ = {isa = PBXBuildFile; fileRef = F58DB55810566D3500CFDF4A /* PBGitSidebarController.m */; }; + F58DB56010566E3900CFDF4A /* PBGitSidebarView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F58DB55F10566E3900CFDF4A /* PBGitSidebarView.xib */; }; + F58DB5E8105671B600CFDF4A /* PBSourceViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = F58DB5E7105671B600CFDF4A /* PBSourceViewItem.m */; }; F59116E60E843BB50072CCB1 /* PBGitCommitView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F59116E50E843BB50072CCB1 /* PBGitCommitView.xib */; }; F59116E90E843BCB0072CCB1 /* PBGitCommitController.m in Sources */ = {isa = PBXBuildFile; fileRef = F59116E80E843BCB0072CCB1 /* PBGitCommitController.m */; }; F593DF780E9E636C003A8559 /* PBFileChangesTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = F593DF770E9E636C003A8559 /* PBFileChangesTableView.m */; }; @@ -243,6 +246,11 @@ F5886A0A0ED5D27A0066E74C /* speedtest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = speedtest.m; sourceTree = ""; }; F5886A100ED5D33D0066E74C /* SpeedTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpeedTest.app; sourceTree = BUILT_PRODUCTS_DIR; }; F5886A120ED5D33D0066E74C /* SpeedTest-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SpeedTest-Info.plist"; sourceTree = ""; }; + F58DB55710566D3500CFDF4A /* PBGitSidebarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitSidebarController.h; sourceTree = ""; }; + F58DB55810566D3500CFDF4A /* PBGitSidebarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitSidebarController.m; sourceTree = ""; }; + F58DB55F10566E3900CFDF4A /* PBGitSidebarView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBGitSidebarView.xib; sourceTree = ""; }; + F58DB5E6105671B600CFDF4A /* PBSourceViewItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBSourceViewItem.h; sourceTree = ""; }; + F58DB5E7105671B600CFDF4A /* PBSourceViewItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBSourceViewItem.m; sourceTree = ""; }; F59116E50E843BB50072CCB1 /* PBGitCommitView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PBGitCommitView.xib; sourceTree = ""; }; F59116E70E843BCB0072CCB1 /* PBGitCommitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitCommitController.h; sourceTree = ""; }; F59116E80E843BCB0072CCB1 /* PBGitCommitController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitCommitController.m; sourceTree = ""; }; @@ -415,6 +423,7 @@ F59116E50E843BB50072CCB1 /* PBGitCommitView.xib */, 47DBDB680E94EF6500671A1E /* Preferences.xib */, F569AE920F2CBD7C00C2FFA7 /* Credits.html */, + F58DB55F10566E3900CFDF4A /* PBGitSidebarView.xib */, ); name = Resources; sourceTree = ""; @@ -482,6 +491,7 @@ F57CC3850E05DDC1000472E2 /* Controllers */ = { isa = PBXGroup; children = ( + F58DB55610566D1F00CFDF4A /* Sidebar */, F5B161BB0EAB6E0C005A1DE1 /* Diff */, F5EF8C880E9D498F0050906B /* History */, F5E927F90E883EF600056E75 /* Commit */, @@ -549,6 +559,17 @@ name = SpeedTest; sourceTree = ""; }; + F58DB55610566D1F00CFDF4A /* Sidebar */ = { + isa = PBXGroup; + children = ( + F58DB55710566D3500CFDF4A /* PBGitSidebarController.h */, + F58DB55810566D3500CFDF4A /* PBGitSidebarController.m */, + F58DB5E6105671B600CFDF4A /* PBSourceViewItem.h */, + F58DB5E7105671B600CFDF4A /* PBSourceViewItem.m */, + ); + name = Sidebar; + sourceTree = ""; + }; F5B161BB0EAB6E0C005A1DE1 /* Diff */ = { isa = PBXGroup; children = ( @@ -743,6 +764,7 @@ 47DBDB6A0E94EF6500671A1E /* Preferences.xib in Resources */, 47DBDBB10E94F6CA00671A1E /* Updates.png in Resources */, F569AE930F2CBD7C00C2FFA7 /* Credits.html in Resources */, + F58DB56010566E3900CFDF4A /* PBGitSidebarView.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -854,6 +876,8 @@ 47DBDBCA0E95016F00671A1E /* PBNSURLPathUserDefaultsTransfomer.m in Sources */, F562C8870FE1766C000EC528 /* NSString_RegEx.m in Sources */, EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */, + F58DB55910566D3500CFDF4A /* PBGitSidebarController.m in Sources */, + F58DB5E8105671B600CFDF4A /* PBSourceViewItem.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h new file mode 100644 index 0000000..a2e180c --- /dev/null +++ b/PBGitSidebarController.h @@ -0,0 +1,20 @@ +// +// PBGitSidebar.h +// GitX +// +// Created by Pieter de Bie on 9/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import +#import "PBViewController.h" + +@interface PBGitSidebarController : PBViewController { + IBOutlet NSWindow *window; + IBOutlet NSOutlineView *sourceView; + + NSMutableArray *items; +} + +@property(readonly) NSMutableArray *items; +@end diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m new file mode 100644 index 0000000..8f325ac --- /dev/null +++ b/PBGitSidebarController.m @@ -0,0 +1,29 @@ +// +// PBGitSidebar.m +// GitX +// +// Created by Pieter de Bie on 9/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "PBGitSidebarController.h" +#import "PBSourceViewItem.h" + +@implementation PBGitSidebarController +@synthesize items; + +- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller +{ + self = [super initWithRepository:theRepository superController:controller]; + [sourceView setDelegate:self]; + items = [NSMutableArray array]; + return self; +} + +- (void)awakeFromNib +{ + window.contentView = self.view; + [super awakeFromNib]; +} + +@end diff --git a/PBGitSidebarView.xib b/PBGitSidebarView.xib new file mode 100644 index 0000000..c264858 --- /dev/null +++ b/PBGitSidebarView.xib @@ -0,0 +1,459 @@ + + + + 1050 + 9L31a + 677 + 949.54 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + PBGitSidebarController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 106}, {186, 404}} + 603979776 + Window + NSWindow + + {3.40282e+38, 3.40282e+38} + + + 274 + {186, 404} + + + {{0, 0}, {1280, 1002}} + {3.40282e+38, 3.40282e+38} + + + + 4370 + + YES + + + 2304 + + YES + + + 4352 + {151, 352} + + YES + + + 256 + {{197, 0}, {16, 17}} + + + YES + + 1.500000e+02 + 1.600000e+01 + 1.000000e+03 + + 75628032 + 0 + + + LucidaGrande + 1.100000e+01 + 3100 + + + 3 + MC4zMzMzMzI5OQA + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 337772096 + 2048 + Text Cell + + LucidaGrande + 1.300000e+01 + 1044 + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + + + 3 + YES + YES + + + + 3.000000e+00 + + 6 + System + _sourceListBackgroundColor + + 1 + MC44MzkyMTU3IDAuODY2NjY2NjcgMC44OTgwMzkyMgA + + + + 6 + System + gridColor + + 3 + MC41AA + + + 2.000000e+01 + -767557632 + 4 + 15 + 0 + YES + 1 + 1.400000e+01 + + + {153, 354} + + + + + 4 + + + + -2147483392 + {{137, 1}, {15, 338}} + + + _doScroller: + 9.969879e-01 + + + + 256 + {{-100, -100}, {196, 15}} + + 1 + + _doScroller: + 5.714286e-01 + + + {153, 354} + + + 528 + + + + QSAAAEEgAABBoAAAQaAAAA + + + YES + + + + + YES + + + window + + + + 5 + + + + view + + + + 25 + + + + sourceView + + + + 26 + + + + dataSource + + + + 34 + + + + delegate + + + + 35 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 2 + + + YES + + + + + + 3 + + + + + 8 + + + YES + + + + + + + + 9 + + + + + 10 + + + + + 11 + + + YES + + + + + + 13 + + + YES + + + + + + 16 + + + + + 21 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 10.IBPluginDependency + 11.IBPluginDependency + 13.IBPluginDependency + 16.CustomClassName + 16.IBPluginDependency + 2.IBEditorWindowLastContentRect + 2.IBPluginDependency + 2.IBWindowTemplateEditedContentRect + 2.NSWindowTemplate.visibleAtLaunch + 3.IBPluginDependency + 8.IBEditorWindowLastContentRect + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + PBIconAndTextCell + com.apple.InterfaceBuilder.CocoaPlugin + {{297, 477}, {186, 404}} + com.apple.InterfaceBuilder.CocoaPlugin + {{297, 477}, {186, 404}} + + com.apple.InterfaceBuilder.CocoaPlugin + {{105, 545}, {153, 354}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 35 + + + + YES + + PBGitSidebarController + PBViewController + + YES + + YES + sourceView + window + + + YES + NSOutlineView + NSWindow + + + + IBProjectSource + PBGitSidebarController.h + + + + PBIconAndTextCell + NSTextFieldCell + + IBProjectSource + PBIconAndTextCell.h + + + + PBViewController + NSViewController + + viewToolbar + NSToolbar + + + IBProjectSource + PBViewController.h + + + + + 0 + GitX.xcodeproj + 3 + + diff --git a/PBGitWindowController.h b/PBGitWindowController.h index ae2298b..5dcf5e0 100644 --- a/PBGitWindowController.h +++ b/PBGitWindowController.h @@ -9,7 +9,8 @@ #import #import "PBGitRepository.h" -@class PBViewController; +@class PBViewController, PBGitSidebarController; + @interface PBGitWindowController : NSWindowController { __weak PBGitRepository* repository; int selectedViewIndex; @@ -19,6 +20,8 @@ PBViewController *commitViewController; PBViewController* viewController; + + PBGitSidebarController *sidebarController; } @property (assign) __weak PBGitRepository *repository; diff --git a/PBGitWindowController.m b/PBGitWindowController.m index aba1987..087e3ad 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -9,6 +9,7 @@ #import "PBGitWindowController.h" #import "PBGitHistoryController.h" #import "PBGitCommitController.h" +#import "PBGitSidebarController.h" @implementation PBGitWindowController @@ -17,18 +18,21 @@ - (id)initWithRepository:(PBGitRepository*)theRepository displayDefault:(BOOL)displayDefault { - if(self = [self initWithWindowNibName:@"RepositoryWindow"]) - { - self.repository = theRepository; - [self showWindow:nil]; - } - - if (displayDefault) { - self.selectedViewIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"selectedViewIndex"]; - } else { - self.selectedViewIndex = -1; - } + if (!(self = [self initWithWindowNibName:@"RepositoryWindow"])) + return nil; + self.repository = theRepository; + [self showWindow:nil]; + + if (displayDefault) + self.selectedViewIndex = [[NSUserDefaults standardUserDefaults] integerForKey:@"selectedViewIndex"]; + else + self.selectedViewIndex = -1; + + // Sidebar + sidebarController = [[PBGitSidebarController alloc] initWithRepository:repository superController:self]; + // Hack for now + [sidebarController view]; return self; } diff --git a/PBSourceViewItem.h b/PBSourceViewItem.h new file mode 100644 index 0000000..3b722c7 --- /dev/null +++ b/PBSourceViewItem.h @@ -0,0 +1,20 @@ +// +// PBSourceViewItem.h +// GitX +// +// Created by Pieter de Bie on 9/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import + + +@interface PBSourceViewItem : NSObject { + NSString *name; +} + +- (id)initWithName:(NSString *)name; + +@property(retain) NSString *name; +@property(readonly) NSArray *children; +@end diff --git a/PBSourceViewItem.m b/PBSourceViewItem.m new file mode 100644 index 0000000..8629a50 --- /dev/null +++ b/PBSourceViewItem.m @@ -0,0 +1,29 @@ +// +// PBSourceViewItem.m +// GitX +// +// Created by Pieter de Bie on 9/8/09. +// Copyright 2009 __MyCompanyName__. All rights reserved. +// + +#import "PBSourceViewItem.h" + + +@implementation PBSourceViewItem +@synthesize name; +@dynamic children; + +- (id)initWithName:(NSString *)aName +{ + if (!(self = [super init])) + return nil; + + name = aName; + return self; +} + +- (NSArray *)children +{ + return [NSArray array]; +} +@end