@@ -53,14 +53,40 @@ - (void) awakeFromNib
53
53
@" log" , ITEM_IDENTIFIER,
54
54
@" History" , ITEM_NAME,
55
55
nil ],
56
+ [NSDictionary dictionaryWithObjectsAndKeys:
57
+ @" diff" , ITEM_IDENTIFIER,
58
+ @" Diff" , ITEM_NAME,
59
+ nil ],
56
60
nil ];
57
61
[self .groups addObject: [NSDictionary dictionaryWithObjectsAndKeys:
58
62
[NSNumber numberWithBool: NO ], GROUP_SEPARATOR,
59
63
[NSNumber numberWithInt: MGRadioSelectionMode], GROUP_SELECTION_MODE, // single selection group.
60
64
items, GROUP_ITEMS,
61
65
nil ]];
66
+
67
+ NSArray *difft = [NSArray arrayWithObjects:
68
+ [NSDictionary dictionaryWithObjectsAndKeys:
69
+ @" l" , ITEM_IDENTIFIER,
70
+ @" Local" , ITEM_NAME,
71
+ nil ],
72
+ [NSDictionary dictionaryWithObjectsAndKeys:
73
+ @" h" , ITEM_IDENTIFIER,
74
+ @" HEAD" , ITEM_NAME,
75
+ nil ],
76
+ [NSDictionary dictionaryWithObjectsAndKeys:
77
+ @" p" , ITEM_IDENTIFIER,
78
+ @" Previous" , ITEM_NAME,
79
+ nil ],
80
+ nil ];
81
+ [self .groups addObject: [NSDictionary dictionaryWithObjectsAndKeys:
82
+ [NSNumber numberWithBool: NO ], GROUP_SEPARATOR,
83
+ [NSNumber numberWithInt: MGRadioSelectionMode], GROUP_SELECTION_MODE, // single selection group.
84
+ difft, GROUP_ITEMS,
85
+ @" Diff with:" ,GROUP_LABEL,
86
+ nil ]];
87
+
62
88
[typeBar reloadData ];
63
-
89
+
64
90
[fileListSplitView setHidden: YES ];
65
91
[self performSelector: @selector (restoreSplitViewPositiion ) withObject: nil afterDelay: 0 ];
66
92
}
@@ -76,18 +102,20 @@ - (void) showFile
76
102
NSArray *files=[historyController.treeController selectedObjects ];
77
103
if ([files count ]>0 ) {
78
104
PBGitTree *file=[files objectAtIndex: 0 ];
79
-
105
+
80
106
NSString *fileTxt = @" " ;
81
107
if (startFile==@" fileview" )
82
108
fileTxt=[self parseHTML: [file textContents ]];
83
109
else if (startFile==@" blame" )
84
110
fileTxt=[self parseBlame: [file blame ]];
85
111
else if (startFile==@" log" )
86
- fileTxt=[file log: logFormat];
87
-
112
+ fileTxt=[file log: logFormat];
113
+ else if (startFile==@" diff" )
114
+ fileTxt=[file diff: diffType];
115
+
88
116
id script = [view windowScriptObject ];
89
117
NSString *filePath = [file fullPath ];
90
- [script callWebScriptMethod: @" showFile" withArguments: [NSArray arrayWithObjects: fileTxt, filePath, nil ]];
118
+ [script callWebScriptMethod: @" showFile" withArguments: [NSArray arrayWithObjects: fileTxt, filePath, nil ]];
91
119
}
92
120
93
121
#if 0
@@ -146,11 +174,18 @@ - (MGScopeBarGroupSelectionMode)scopeBar:(MGScopeBar *)theScopeBar selectionMode
146
174
147
175
- (void )scopeBar : (MGScopeBar *)theScopeBar selectedStateChanged : (BOOL )selected forItem : (NSString *)identifier inGroup : (int )groupNumber
148
176
{
149
- startFile=identifier;
150
- NSString *path = [NSString stringWithFormat: @" html/views/%@ " , identifier];
151
- NSString *html = [[NSBundle mainBundle ] pathForResource: @" index" ofType: @" html" inDirectory: path];
152
- NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL fileURLWithPath: html]];
153
- [[view mainFrame ] loadRequest: request];
177
+ if (groupNumber==0 ){
178
+ NSString *path = [NSString stringWithFormat: @" html/views/%@ " , identifier];
179
+ NSString *html = [[NSBundle mainBundle ] pathForResource: @" index" ofType: @" html" inDirectory: path];
180
+ NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL fileURLWithPath: html]];
181
+ [[view mainFrame ] loadRequest: request];
182
+ startFile=identifier;
183
+ }else if (groupNumber==1 ){
184
+ diffType=identifier;
185
+ if (startFile==@" diff" ){
186
+ [[view mainFrame ] reload ];
187
+ }
188
+ }
154
189
}
155
190
156
191
- (NSView *)accessoryViewForScopeBar : (MGScopeBar *)scopeBar
@@ -167,7 +202,7 @@ - (void)closeView
167
202
{
168
203
[historyController.treeController removeObserver: self forKeyPath: @" selection" ];
169
204
[self saveSplitViewPosition ];
170
-
205
+
171
206
[super closeView ];
172
207
}
173
208
@@ -277,23 +312,23 @@ - (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)pr
277
312
- (void )splitView : (NSSplitView *)splitView resizeSubviewsWithOldSize : (NSSize )oldSize
278
313
{
279
314
NSRect newFrame = [splitView frame ];
280
-
315
+
281
316
float dividerThickness = [splitView dividerThickness ];
282
-
317
+
283
318
NSView *leftView = [[splitView subviews ] objectAtIndex: 0 ];
284
319
NSRect leftFrame = [leftView frame ];
285
320
leftFrame.size .height = newFrame.size .height ;
286
-
321
+
287
322
if ((newFrame.size .width - leftFrame.size .width - dividerThickness) < kFileListSplitViewRightMin ) {
288
323
leftFrame.size .width = newFrame.size .width - kFileListSplitViewRightMin - dividerThickness;
289
324
}
290
-
325
+
291
326
NSView *rightView = [[splitView subviews ] objectAtIndex: 1 ];
292
327
NSRect rightFrame = [rightView frame ];
293
328
rightFrame.origin .x = leftFrame.size .width + dividerThickness;
294
329
rightFrame.size .width = newFrame.size .width - rightFrame.origin .x ;
295
330
rightFrame.size .height = newFrame.size .height ;
296
-
331
+
297
332
[leftView setFrame: leftFrame];
298
333
[rightView setFrame: rightFrame];
299
334
}
@@ -312,7 +347,7 @@ - (void)restoreSplitViewPositiion
312
347
float position = [[NSUserDefaults standardUserDefaults ] floatForKey: kHFileListSplitViewPositionDefault ];
313
348
if (position < 1.0 )
314
349
position = 200 ;
315
-
350
+
316
351
[fileListSplitView setPosition: position ofDividerAtIndex: 0 ];
317
352
[fileListSplitView setHidden: NO ];
318
353
}
0 commit comments