|
6 | 6 | // Copyright 2010 __MyCompanyName__. All rights reserved.
|
7 | 7 | //
|
8 | 8 |
|
9 |
| -#import <MGScopeBar/MGScopeBar.h> |
10 |
| - |
11 | 9 | #import "GLFileView.h"
|
12 | 10 | #import "PBGitTree.h"
|
13 | 11 | #import "PBGitCommit.h"
|
@@ -41,29 +39,6 @@ - (void) awakeFromNib
|
41 | 39 | [super awakeFromNib];
|
42 | 40 | [historyController.treeController addObserver:self forKeyPath:@"selection" options:0 context:@"treeController"];
|
43 | 41 |
|
44 |
| - self.groups = [NSMutableArray arrayWithCapacity:0]; |
45 |
| - |
46 |
| - NSArray *items = [NSArray arrayWithObjects: |
47 |
| - [NSDictionary dictionaryWithObjectsAndKeys: |
48 |
| - startFile, ITEM_IDENTIFIER, |
49 |
| - @"Source", ITEM_NAME, |
50 |
| - nil], |
51 |
| - [NSDictionary dictionaryWithObjectsAndKeys: |
52 |
| - GROUP_ID_BLAME, ITEM_IDENTIFIER, |
53 |
| - @"Blame", ITEM_NAME, |
54 |
| - nil], |
55 |
| - [NSDictionary dictionaryWithObjectsAndKeys: |
56 |
| - GROUP_ID_LOG, ITEM_IDENTIFIER, |
57 |
| - @"History", ITEM_NAME, |
58 |
| - nil], |
59 |
| - nil]; |
60 |
| - [self.groups addObject:[NSDictionary dictionaryWithObjectsAndKeys: |
61 |
| - [NSNumber numberWithBool:NO], GROUP_SEPARATOR, |
62 |
| - [NSNumber numberWithInt:MGScopeBarGroupSelectionModeRadio], GROUP_SELECTION_MODE, // single selection group. |
63 |
| - items, GROUP_ITEMS, |
64 |
| - nil]]; |
65 |
| - [typeBar reloadData]; |
66 |
| - |
67 | 42 | [fileListSplitView setHidden:YES];
|
68 | 43 | [self performSelector:@selector(restoreSplitViewPositiion) withObject:nil afterDelay:0];
|
69 | 44 | }
|
@@ -107,60 +82,6 @@ - (void) selectCommit:(NSString*)c
|
107 | 82 | [historyController selectCommit: [GTOID oidWithSHA: c]];
|
108 | 83 | }
|
109 | 84 |
|
110 |
| -#pragma mark MGScopeBarDelegate methods |
111 |
| - |
112 |
| -- (NSInteger)numberOfGroupsInScopeBar:(MGScopeBar *)theScopeBar |
113 |
| -{ |
114 |
| - return [self.groups count]; |
115 |
| -} |
116 |
| - |
117 |
| - |
118 |
| -- (NSArray *)scopeBar:(MGScopeBar *)theScopeBar itemIdentifiersForGroup:(NSInteger)groupNumber |
119 |
| -{ |
120 |
| - return [[self.groups objectAtIndex:groupNumber] valueForKeyPath:[NSString stringWithFormat:@"%@.%@", GROUP_ITEMS, ITEM_IDENTIFIER]]; |
121 |
| -} |
122 |
| - |
123 |
| - |
124 |
| -- (NSString *)scopeBar:(MGScopeBar *)theScopeBar labelForGroup:(NSInteger)groupNumber |
125 |
| -{ |
126 |
| - return [[self.groups objectAtIndex:groupNumber] objectForKey:GROUP_LABEL]; // might be nil, which is fine (nil means no label). |
127 |
| -} |
128 |
| - |
129 |
| - |
130 |
| -- (NSString *)scopeBar:(MGScopeBar *)theScopeBar titleOfItem:(NSString *)identifier inGroup:(NSInteger)groupNumber |
131 |
| -{ |
132 |
| - NSArray *items = [[self.groups objectAtIndex:groupNumber] objectForKey:GROUP_ITEMS]; |
133 |
| - if (items) { |
134 |
| - for (NSDictionary *item in items) { |
135 |
| - if ([[item objectForKey:ITEM_IDENTIFIER] isEqualToString:identifier]) { |
136 |
| - return [item objectForKey:ITEM_NAME]; |
137 |
| - break; |
138 |
| - } |
139 |
| - } |
140 |
| - } |
141 |
| - return nil; |
142 |
| -} |
143 |
| - |
144 |
| - |
145 |
| -- (MGScopeBarGroupSelectionMode)scopeBar:(MGScopeBar *)theScopeBar selectionModeForGroup:(NSInteger)groupNumber |
146 |
| -{ |
147 |
| - return [[[self.groups objectAtIndex:groupNumber] objectForKey:GROUP_SELECTION_MODE] intValue]; |
148 |
| -} |
149 |
| - |
150 |
| -- (void)scopeBar:(MGScopeBar *)theScopeBar selectedStateChanged:(BOOL)selected forItem:(NSString *)identifier inGroup:(NSInteger)groupNumber |
151 |
| -{ |
152 |
| - startFile=identifier; |
153 |
| - NSString *path = [NSString stringWithFormat:@"html/views/%@", identifier]; |
154 |
| - NSString *html = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:path]; |
155 |
| - NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:html]]; |
156 |
| - [self.view.mainFrame loadRequest:request]; |
157 |
| -} |
158 |
| - |
159 |
| -- (NSView *)accessoryViewForScopeBar:(MGScopeBar *)scopeBar |
160 |
| -{ |
161 |
| - return accessoryView; |
162 |
| -} |
163 |
| - |
164 | 85 | - (void) didLoad
|
165 | 86 | {
|
166 | 87 | [self showFile];
|
|
0 commit comments