diff --git a/English.lproj/RepositoryWindow.xib b/English.lproj/RepositoryWindow.xib
index a8aaea2..6cd49fa 100644
--- a/English.lproj/RepositoryWindow.xib
+++ b/English.lproj/RepositoryWindow.xib
@@ -8,7 +8,7 @@
352.00
-
+
NSToolbarSeparatorItem
Separator
@@ -521,11 +269,11 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
1048576
2147483647
-
-
+
+
-
+
NSToolbarShowColorsItem
Colors
Colors
@@ -617,7 +365,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
-
+
orderFrontColorPanel:
@@ -629,7 +377,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
YES
0
-
+
NSToolbarShowFontsItem
Fonts
Fonts
@@ -721,7 +469,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
-
+
orderFrontFontPanel:
@@ -733,7 +481,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
YES
0
-
+
NSToolbarSpaceItem
Space
@@ -756,33 +504,23 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
1048576
2147483647
-
-
+
+
-
+
YES
-
-
-
-
-
-
-
-
-
-
-
-
-
- YES
-
-
-
-
+
+
+
+
+
+
+
+
YES
@@ -796,97 +534,63 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
{{0, 0}, {1440, 878}}
- {213, 179}
+ {213, 185}
{3.40282e+38, 3.40282e+38}
GitX
-
-
- YES
- branches.refs
- refs
- ref
- value
- shortName
- description
+
+
+ B6D80172-2D01-49BD-8E3A-2F1D9F672390
- PBGitRevSpecifier
- YES
-
- YES
- YES
- YES
- YES
+ View
+ View selector
+
+
+
+ 268
+ {{0, 14}, {142, 25}}
+ 3
+ YES
+
+ 67239424
+ 0
+
+ LucidaGrande
+ 1.300000e+01
+ 1044
+
+
+
+ YES
+
+ History
+ 0
+
+
+ Commit
+ YES
+ 0
+
+
+ 1
+ 2
+
+
+
+
+
+ {142, 25}
+ {142, 25}
+ YES
+ YES
+ 3
+ YES
+ 0
YES
-
-
- delegate
-
-
-
- 121
-
-
-
- searchField
-
-
-
- 132
-
-
-
- contentArray: repository.branches
-
-
-
-
-
- contentArray: repository.branches
- contentArray
- repository.branches
- 2
-
-
- 171
-
-
-
- contentValues: arrangedObjects.description
-
-
-
-
-
- contentValues: arrangedObjects.description
- contentValues
- arrangedObjects.description
- 2
-
-
- 212
-
-
-
- selectedIndex: selectionIndex
-
-
-
-
-
- selectedIndex: selectionIndex
- selectedIndex
- selectionIndex
-
- 2
-
-
- 215
-
contentView
@@ -895,13 +599,21 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
245
+
+
+ window
+
+
+
+ 292
+
selectedIndex: selectedViewIndex
-
+
-
+
selectedIndex: selectedViewIndex
selectedIndex
@@ -909,112 +621,15 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
2
- 275
-
-
-
- predicate: searchController.filterPredicate
-
-
-
-
-
- predicate: searchController.filterPredicate
- predicate
- searchController.filterPredicate
-
- YES
-
- YES
- NSDisplayName
- NSPredicateFormat
-
-
- YES
- Subject
- subject contains $value
-
-
- 2
-
-
- 279
-
-
-
- predicate2: searchController.filterPredicate
-
-
-
-
-
- predicate2: searchController.filterPredicate
- predicate2
- searchController.filterPredicate
-
- YES
-
- YES
- NSDisplayName
- NSPredicateFormat
-
-
- YES
- Author
- author contains $value
-
-
-
- 2
-
-
- 285
-
-
-
- predicate3: searchController.filterPredicate
-
-
-
-
-
- predicate3: searchController.filterPredicate
- predicate3
- searchController.filterPredicate
-
- YES
-
- YES
- NSDisplayName
- NSPredicateFormat
-
-
- YES
- SHA
- sha contains $value
-
-
-
- 2
-
-
- 290
+ 329
- branchesController
+ viewSelector
-
+
- 291
-
-
-
- window
-
-
-
- 292
+ 350
@@ -1051,31 +666,12 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
YES
-
+
Window
-
- 4
-
-
- YES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
5
@@ -1085,149 +681,77 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
- 47
-
+ 324
+
YES
-
+
-
-
-
- 48
-
-
- YES
-
-
-
-
-
- 49
-
-
-
-
- 50
-
-
- YES
-
-
-
-
-
- 51
-
-
-
-
- 52
-
-
-
-
- 53
-
-
-
-
- 54
-
-
-
-
- 55
-
-
-
-
- 56
-
-
-
-
- 57
-
-
-
-
- 58
-
-
- YES
-
-
-
-
-
- 59
-
-
-
-
- 60
-
-
- YES
-
-
-
-
-
- 61
-
-
- YES
-
-
-
-
-
- 62
-
-
- YES
-
-
-
-
-
-
-
- 63
-
-
-
-
- 64
-
-
-
-
- 65
-
-
-
-
- 66
-
-
- YES
-
-
-
-
-
- 67
-
-
-
-
- 169
-
- BranchesController
+
+
+ 325
+
+
+ YES
+
+
+
+
+
+ 326
+
+
+
+
+ 342
+
+
+ YES
+
+
+
+
+
+
+
+
+
+
+
+ 343
+
+
+
+
+ 344
+
+
+
+
+ 345
+
+
+
+
+ 346
+
+
+
+
+ 347
+
+
+
+
+ 348
+
+
+
+
+ 349
+
+
@@ -1238,7 +762,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
-1.IBPluginDependency
-2.IBPluginDependency
-3.IBPluginDependency
- 169.IBPluginDependency
3.IBEditorWindowLastContentRect
3.IBPluginDependency
3.IBWindowTemplateEditedContentRect
@@ -1249,73 +772,46 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
3.windowTemplate.hasMinSize
3.windowTemplate.maxSize
3.windowTemplate.minSize
- 4.IBEditorWindowLastContentRect
- 4.IBPluginDependency
- 4.editorWindowContentRectSynchronizationRect
- 49.IBPluginDependency
+ 325.IBPluginDependency
+ 326.IBPluginDependency
+ 342.IBPluginDependency
+ 343.IBPluginDependency
+ 344.IBPluginDependency
+ 345.IBPluginDependency
+ 346.IBPluginDependency
+ 347.IBPluginDependency
+ 348.IBPluginDependency
+ 349.IBPluginDependency
5.IBPluginDependency
5.ImportedFromIB2
- 51.IBPluginDependency
- 52.IBPluginDependency
- 53.IBPluginDependency
- 54.IBPluginDependency
- 55.IBPluginDependency
- 56.IBPluginDependency
- 57.IBPluginDependency
- 58.IBPluginDependency
- 59.IBPluginDependency
- 60.IBPluginDependency
- 61.IBPluginDependency
- 62.IBEditorWindowLastContentRect
- 62.IBPluginDependency
- 62.editorWindowContentRectSynchronizationRect
- 63.IBPluginDependency
- 64.IBPluginDependency
- 65.IBPluginDependency
- 66.IBPluginDependency
- 67.IBPluginDependency
YES
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilderKit
com.apple.InterfaceBuilderKit
+ {{312, 315}, {850, 418}}
com.apple.InterfaceBuilder.CocoaPlugin
- {{368, 321}, {850, 418}}
- com.apple.InterfaceBuilder.CocoaPlugin
- {{368, 321}, {850, 418}}
-
+ {{312, 315}, {850, 418}}
+
{{15, 196}, {850, 418}}
{3.40282e+38, 3.40282e+38}
{213, 107}
- {{429, 871}, {616, 0}}
com.apple.InterfaceBuilder.CocoaPlugin
- {{132, 614}, {616, 0}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- {{725, 616}, {134, 63}}
- com.apple.InterfaceBuilder.CocoaPlugin
- {{848, 458}, {116, 63}}
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
- com.apple.InterfaceBuilder.CocoaPlugin
@@ -1338,7 +834,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
- 295
+ 350
@@ -1346,21 +842,30 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ
PBGitWindowController
NSWindowController
+
+ YES
+
+ YES
+ showCommitView:
+ showHistoryView:
+
+
+ YES
+ id
+ id
+
+
YES
YES
- branchesController
contentView
- searchController
- searchField
+ viewSelector
YES
- NSArrayController
NSView
- NSArrayController
- NSSearchField
+ NSToolbarItem
diff --git a/PBGitCommitController.m b/PBGitCommitController.m
index 24f275b..e300a0d 100644
--- a/PBGitCommitController.m
+++ b/PBGitCommitController.m
@@ -16,6 +16,7 @@
- (void)awakeFromNib
{
+ [super awakeFromNib];
self.busy = 0;
[unstagedButtonCell setAction:@selector(cellClicked:)];
diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h
index 9eb6107..86201bd 100644
--- a/PBGitHistoryController.h
+++ b/PBGitHistoryController.h
@@ -12,7 +12,9 @@
#import "PBViewController.h"
@interface PBGitHistoryController : PBViewController {
+ IBOutlet NSSearchField *searchField;
IBOutlet NSArrayController* commitController;
+ IBOutlet NSArrayController *branchesController;
IBOutlet NSTreeController* treeController;
IBOutlet NSOutlineView* fileBrowser;
IBOutlet NSTableView* commitList;
diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m
index 97d6f54..6410e11 100644
--- a/PBGitHistoryController.m
+++ b/PBGitHistoryController.m
@@ -34,6 +34,10 @@
}
else
[repository lazyReload];
+
+ [super awakeFromNib];
+ // We bind this ourselves because otherwise we would lose our selection
+ [branchesController bind:@"selectionIndexes" toObject:repository withKeyPath:@"currentBranch" options:nil];
}
- (void) updateKeys
@@ -110,7 +114,7 @@
- (void)keyDown:(NSEvent*)event
{
if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
- [superController focusOnSearchField];
+ [superController.window makeFirstResponder: searchField];
else
[super keyDown: event];
}
diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib
index 61fb4e0..beb5385 100644
--- a/PBGitHistoryView.xib
+++ b/PBGitHistoryView.xib
@@ -8,7 +8,7 @@
352.00
YES
-
+
YES
@@ -42,6 +42,21 @@
children
leaf
+
+
+ YES
+ a
+ shortName
+ description
+
+ YES
+
+ YES
+ YES
+ YES
+ YES
+ YES
+
YES
@@ -66,6 +81,7 @@
authorDate
date
dateString
+ arran
PBGitCommit
@@ -77,6 +93,261 @@
PBWebGitController
+
+
+ B9F1B847-0DC3-4C13-A685-5F5A2D64BC93
+
+
+ YES
+ YES
+ NO
+ NO
+ 1
+ 1
+
+ YES
+
+ YES
+ 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1
+ 99C2C9EB-AE16-42A9-BE52-46CE903E9AF9
+ NSToolbarFlexibleSpaceItem
+
+
+ YES
+
+
+ 7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1
+
+
+ Search Field
+
+
+
+
+
+ 265
+ {{0, 14}, {183, 22}}
+ YES
+
+ 343014976
+ 268436480
+
+ LucidaGrande
+ 1.300000e+01
+ 1044
+
+ Subject
+
+ YES
+ 1
+
+ 6
+ System
+ textBackgroundColor
+
+ 3
+ MQA
+
+
+
+ 6
+ System
+ controlTextColor
+
+ 3
+ MAA
+
+
+
+ 130560
+ 0
+ search
+ _searchFieldSearch:
+
+
+ 138690815
+ 0
+
+ 400
+ 75
+
+
+ 130560
+ 0
+ clear
+
+ YES
+
+ YES
+
+ YES
+ AXDescription
+ NSAccessibilityEncodedAttributesValueType
+
+
+ YES
+ cancel
+
+
+
+
+ _searchFieldCancel:
+
+
+ 138690815
+ 0
+
+ 400
+ 75
+
+ 255
+ CAAAAA
+
+
+
+
+
+ {183, 22}
+ {183, 22}
+ YES
+ YES
+ 0
+ YES
+ 0
+
+
+
+ 99C2C9EB-AE16-42A9-BE52-46CE903E9AF9
+
+ Branch
+ Branch
+
+
+
+
+
+ {134, 26}
+ {134, 26}
+ YES
+ YES
+ 0
+ YES
+ 0
+
+
+ NSToolbarFlexibleSpaceItem
+
+ Flexible Space
+
+
+
+
+
+ {1, 5}
+ {20000, 32}
+ YES
+ YES
+ -1
+ YES
+ 0
+
+
+
+
+
+ YES
+
+
+
+
+
+ YES
+
+
+
+
+
+ YES
+
+
274
@@ -100,7 +371,7 @@
256
- {835, 133}
+ {835, 176}
YES
337772096
2048
Text Cell
-
- LucidaGrande
- 1.300000e+01
- 1044
-
+
6
@@ -165,12 +429,7 @@
MC42NjY2NjY2OQA
-
- 6
- System
- controlTextColor
-
-
+
3
YES
@@ -214,10 +473,7 @@
6
System
headerColor
-
- 3
- MQA
-
+
@@ -256,7 +512,7 @@
YES
- {{1, 17}, {835, 133}}
+ {{1, 17}, {835, 176}}
@@ -266,7 +522,7 @@
256
- {{836, 17}, {15, 133}}
+ {{836, 17}, {15, 176}}
_doScroller:
@@ -276,7 +532,7 @@
256
- {{1, 150}, {835, 15}}
+ {{1, 193}, {835, 15}}
1
@@ -299,7 +555,7 @@
- {852, 166}
+ {852, 209}
50
@@ -312,8 +568,8 @@
- 36
- {{0, 167}, {852, 229}}
+ 18
+ {{0, 210}, {852, 186}}
YES
@@ -321,7 +577,7 @@
1
- 256
+ 274
YES
@@ -346,7 +602,7 @@
public.url-name
- {{1, 0}, {851, 229}}
+ {{1, 0}, {851, 1}}
@@ -365,7 +621,7 @@
YES
-
+
@@ -373,7 +629,7 @@
YES
- {852, 229}
+ {852, 0}
Details
@@ -1336,6 +1592,168 @@
112
+
+
+ viewToolbar
+
+
+
+ 160
+
+
+
+ searchField
+
+
+
+ 185
+
+
+
+ contentArray: repository.branches
+
+
+
+
+
+ contentArray: repository.branches
+ contentArray
+ repository.branches
+ 2
+
+
+ 193
+
+
+
+ branchesController
+
+
+
+ 198
+
+
+
+ contentValues: arrangedObjects.description
+
+
+
+
+
+ contentValues: arrangedObjects.description
+ contentValues
+ arrangedObjects.description
+ 2
+
+
+ 199
+
+
+
+ selectedIndex: selectionIndex
+
+
+
+
+
+ selectedIndex: selectionIndex
+ selectedIndex
+ selectionIndex
+
+ 2
+
+
+ 203
+
+
+
+ predicate: filterPredicate
+
+
+
+
+
+ predicate: filterPredicate
+ predicate
+ filterPredicate
+
+ YES
+
+ YES
+ NSDisplayName
+ NSPredicateFormat
+
+
+ YES
+ Subject
+ subject contains[c] $value
+
+
+ 2
+
+
+ 214
+
+
+
+ predicate2: filterPredicate
+
+
+
+
+
+ predicate2: filterPredicate
+ predicate2
+ filterPredicate
+
+ YES
+
+ YES
+ NSDisplayName
+ NSPredicateFormat
+
+
+ YES
+ Author
+ author contains[c] $value
+
+
+
+ 2
+
+
+ 215
+
+
+
+ predicate3: filterPredicate
+
+
+
+
+
+ predicate3: filterPredicate
+ predicate3
+ filterPredicate
+
+ YES
+
+ YES
+ NSDisplayName
+ NSPredicateFormat
+
+
+ YES
+ SHA
+ sha contains $value
+
+
+
+ 2
+
+
+ 216
+
@@ -1399,24 +1817,12 @@
YES
-
+
History View
-
- 3
-
-
- YES
-
-
-
-
-
-
-
4
@@ -1596,75 +2002,6 @@
-
- 27
-
-
- YES
-
-
-
-
-
- Commit List
-
-
- 28
-
-
-
-
- 29
-
-
-
-
- 30
-
-
-
-
- 31
-
-
- YES
-
-
-
-
-
- 32
-
-
- YES
-
-
-
-
-
- 33
-
-
- YES
-
-
-
-
-
- 34
-
-
-
-
- 35
-
-
-
-
- 36
-
-
-
47
@@ -1707,6 +2044,186 @@
+
+ 113
+
+
+ YES
+
+
+
+
+
+ History Toolbar
+
+
+ 114
+
+
+ YES
+
+
+
+
+
+ 115
+
+
+
+
+ 116
+
+
+ YES
+
+
+
+
+
+ 117
+
+
+ YES
+
+
+
+
+
+ 118
+
+
+
+
+ 119
+
+
+ YES
+
+
+
+
+
+ 120
+
+
+ YES
+
+
+
+
+
+ 121
+
+
+ YES
+
+
+
+
+
+
+
+ 122
+
+
+
+
+ 123
+
+
+
+
+ 124
+
+
+
+
+ 3
+
+
+ YES
+
+
+
+
+
+
+
+
+ 30
+
+
+
+
+ 29
+
+
+
+
+ 28
+
+
+
+
+ 27
+
+
+ YES
+
+
+
+
+
+ Commit List
+
+
+ 33
+
+
+ YES
+
+
+
+
+
+ 32
+
+
+ YES
+
+
+
+
+
+ 31
+
+
+ YES
+
+
+
+
+
+ 36
+
+
+
+
+ 35
+
+
+
+
+ 34
+
+
+
+
+ 190
+
+
+ Branches Controller
+
@@ -1718,7 +2235,21 @@
-3.IBPluginDependency
10.IBPluginDependency
11.IBPluginDependency
+ 113.IBEditorWindowLastContentRect
+ 113.IBPluginDependency
+ 113.editorWindowContentRectSynchronizationRect
+ 115.IBPluginDependency
+ 117.IBPluginDependency
+ 118.IBPluginDependency
+ 119.IBPluginDependency
12.IBPluginDependency
+ 120.IBPluginDependency
+ 121.IBEditorWindowLastContentRect
+ 121.IBPluginDependency
+ 121.editorWindowContentRectSynchronizationRect
+ 122.IBPluginDependency
+ 123.IBPluginDependency
+ 124.IBPluginDependency
13.IBPluginDependency
14.IBPluginDependency
15.CustomClassName
@@ -1727,6 +2258,7 @@
17.IBPluginDependency
18.IBPluginDependency
19.IBPluginDependency
+ 190.IBPluginDependency
2.IBEditorWindowLastContentRect
2.IBPluginDependency
2.ImportedFromIB2
@@ -1778,6 +2310,20 @@
com.apple.InterfaceBuilderKit
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ {{244, 901}, {616, 0}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+ {{132, 614}, {616, 0}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
+ {{725, 616}, {134, 63}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+ {{848, 458}, {116, 63}}
+ com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -1787,6 +2333,7 @@
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
+ com.apple.InterfaceBuilder.CocoaPlugin
{{312, 577}, {852, 384}}
com.apple.InterfaceBuilder.CocoaPlugin
@@ -1838,7 +2385,7 @@
com.apple.InterfaceBuilder.CocoaPlugin
- {{423, 120}, {852, 432}}
+ {{359, 261}, {852, 432}}
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
com.apple.InterfaceBuilder.CocoaPlugin
@@ -1868,7 +2415,7 @@
- 112
+ 216
@@ -1924,17 +2471,21 @@
YES
YES
+ branchesController
commitController
commitList
fileBrowser
+ searchField
treeController
webView
YES
NSArrayController
+ NSArrayController
NSTableView
NSOutlineView
+ NSSearchField
NSTreeController
id
@@ -1988,6 +2539,10 @@
PBViewController
NSViewController
+
+ viewToolbar
+ NSToolbar
+
IBProjectSource
PBViewController.h
diff --git a/PBGitWindowController.h b/PBGitWindowController.h
index 4f7e3ac..accde05 100644
--- a/PBGitWindowController.h
+++ b/PBGitWindowController.h
@@ -10,24 +10,22 @@
#import "PBGitRepository.h"
@interface PBGitWindowController : NSWindowController {
- IBOutlet NSSearchField* searchField;
- IBOutlet NSArrayController* searchController;
- IBOutlet NSArrayController *branchesController;
__weak PBGitRepository* repository;
int selectedViewIndex;
IBOutlet NSView* contentView;
NSViewController* viewController;
+
+ IBOutlet NSToolbarItem *viewSelector;
}
@property (assign) __weak PBGitRepository *repository;
@property (readonly) NSViewController *viewController;
@property (assign) int selectedViewIndex;
-@property (retain) NSArrayController *searchController;
- (id)initWithRepository:(PBGitRepository*)theRepository displayDefault:(BOOL)display;
- (void)changeViewController:(NSInteger)whichViewTag;
-- (void) focusOnSearchField;
+- (void)useToolbar:(NSToolbar *)toolbar;
- (IBAction) showCommitView:(id)sender;
- (IBAction) showHistoryView:(id)sender;
diff --git a/PBGitWindowController.m b/PBGitWindowController.m
index ddde56c..db530c0 100644
--- a/PBGitWindowController.m
+++ b/PBGitWindowController.m
@@ -14,7 +14,7 @@
@implementation PBGitWindowController
-@synthesize repository, viewController, searchController, selectedViewIndex;
+@synthesize repository, viewController, selectedViewIndex;
- (id)initWithRepository:(PBGitRepository*)theRepository displayDefault:(BOOL)displayDefault
{
@@ -33,11 +33,6 @@
return self;
}
-- (void) focusOnSearchField
-{
- [[self window] makeFirstResponder:searchField];
-}
-
- (void) setSelectedViewIndex: (int) i
{
selectedViewIndex = i;
@@ -48,11 +43,10 @@
- (void)changeViewController:(NSInteger)whichViewTag
{
[self willChangeValueForKey:@"viewController"];
- self.searchController = nil;
- [self unbind:@"searchController"];
+
if ([viewController view] != nil)
[(PBViewController *)viewController removeView];
-
+
switch (whichViewTag)
{
case 0: // swap in the "CustomImageViewController - NSImageView"
@@ -60,31 +54,25 @@
break;
case 1:
viewController = [[PBGitCommitController alloc] initWithRepository:repository superController:self];
+ break;
}
-
+
// make sure we automatically resize the controller's view to the current window size
[[viewController view] setFrame: [contentView bounds]];
//// embed the current view to our host view
[contentView addSubview: [viewController view]];
-
+
// Allow the viewcontroller to catch actions
[self setNextResponder: viewController];
- if ([viewController respondsToSelector:@selector(commitController)])
- [self bind:@"searchController" toObject:viewController withKeyPath:@"commitController" options:nil];
-
-
[self didChangeValueForKey:@"viewController"]; // this will trigger the NSTextField's value binding to change
}
- (void)awakeFromNib
{
- // We bind this ourselves because otherwise we would lose our selection
- [branchesController bind:@"selectionIndexes" toObject:repository withKeyPath:@"currentBranch" options:nil];
-
[[self window] setAutorecalculatesContentBorderThickness:NO forEdge:NSMinYEdge];
[[self window] setContentBorderThickness:35.0f forEdge:NSMinYEdge];
-
+ [self showHistoryView:nil];
}
- (void) showCommitView:(id)sender
@@ -97,4 +85,45 @@
self.selectedViewIndex = 0;
}
+#pragma mark -
+#pragma mark Toolbar Delegates
+- (NSToolbarItem *) toolbar:(NSToolbar *)toolbar
+ itemForItemIdentifier:(NSString *)itemIdentifier
+ willBeInsertedIntoToolbar:(BOOL)flag
+{
+ if ([itemIdentifier isEqualToString:[viewSelector itemIdentifier]])
+ return viewSelector;
+
+ return nil;
+}
+
+- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
+{
+ NSMutableArray *array = [NSMutableArray array];
+ for (NSToolbarItem *item in [toolbar items])
+ [array addObject:[item itemIdentifier]];
+ return array;
+}
+
+- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
+{
+ NSMutableArray *array = [NSMutableArray array];
+ for (NSToolbarItem *item in [toolbar items])
+ [array addObject:[item itemIdentifier]];
+ return array;
+}
+
+- (void) useToolbar:(NSToolbar *)toolbar
+{
+ [toolbar setDelegate:self];
+
+ [toolbar insertItemWithItemIdentifier:NSToolbarSeparatorItemIdentifier atIndex:0];
+ [toolbar insertItemWithItemIdentifier:[viewSelector itemIdentifier] atIndex:0];
+
+ NSSegmentedControl *viewSelect = (NSSegmentedControl *)[[[toolbar items] objectAtIndex:0] view];
+ [viewSelect bind:@"selectedIndex" toObject:self withKeyPath:@"selectedViewIndex" options:0];
+
+ [self.window setToolbar:toolbar];
+}
+
@end
diff --git a/PBViewController.h b/PBViewController.h
index ac09746..6996ad6 100644
--- a/PBViewController.h
+++ b/PBViewController.h
@@ -13,9 +13,12 @@
@interface PBViewController : NSViewController {
__weak PBGitRepository *repository;
__weak PBGitWindowController *superController;
+
+ IBOutlet NSToolbar *viewToolbar;
}
@property (readonly) __weak PBGitRepository *repository;
+@property (readonly) NSToolbar *viewToolbar;
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller;
- (void) removeView;
diff --git a/PBViewController.m b/PBViewController.m
index 287d6df..971eb36 100644
--- a/PBViewController.m
+++ b/PBViewController.m
@@ -11,7 +11,7 @@
@implementation PBViewController
-@synthesize repository;
+@synthesize repository, viewToolbar;
- (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller
{
@@ -29,4 +29,12 @@
{
[[self view] removeFromSuperview]; // remove the current view
}
+
+- (void) awakeFromNib
+{
+ if (viewToolbar)
+ [superController useToolbar:viewToolbar];
+ else
+ [superController useToolbar:[[NSToolbar alloc] initWithIdentifier:@"EmptyBar"]];
+}
@end