This commit is contained in:
German Laullon
2010-06-15 08:54:22 -07:00
parent 5a7dd3fac1
commit 8b357d40e9
7 changed files with 34 additions and 21 deletions
+2 -2
View File
@@ -21,11 +21,11 @@
NSString *sha;
PBGitRepository *repository;
id controller;
bool commit;
}
- (id)initWithRepository:(PBGitRepository *)theRepository;
- (id)initWithRepository:(PBGitRepository *)theRepository andController:(id)theController;
- (void)showFile:(NSString *)file sha:(NSString *)sha;
- (NSString*)refSpec;
+22 -6
View File
@@ -7,6 +7,7 @@
//
#import "FileViewerController.h"
#import "PBGitHistoryController.h"
#define GROUP_LABEL @"Label" // string
#define GROUP_SEPARATOR @"HasSeparator" // BOOL as NSNumber
@@ -20,9 +21,10 @@
#pragma mark Setup and teardown
- (id)initWithRepository:(PBGitRepository *)theRepository
- (id)initWithRepository:(PBGitRepository *)theRepository andController:(id)theController;
{
repository=theRepository;
controller=theController;
return [self initWithNibName:@"FileViewer" bundle:[NSBundle mainBundle]];
}
@@ -65,6 +67,21 @@
}
#pragma mark JavaScript log.js methods
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel
{
if (sel == @selector(selectCommit:)) return NO;
return YES;
}
- (void) selectCommit:(NSString*)c
{
NSLog(@"[FileViewerController controller:%@]",controller);
if([(PBGitHistoryController *)controller selectCommit:sha])
NSLog(@"---");
NSLog(@"[FileViewerController selectCommit:%@]",c);
}
#pragma mark MGScopeBarDelegate methods
@@ -133,7 +150,7 @@
NSString *testFile = [NSString stringWithFormat:@"%@/test.html",NSHomeDirectory()];
NSString *format;
if(formatFile!=nil)
format=[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:formatFile] encoding:nil error:nil];
format=[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:formatFile] encoding:NSUTF8StringEncoding error:nil];
NSString *txt;
if(show==@"source")
@@ -147,15 +164,14 @@
else
return; // XXXX controlar mejor.
NSLog(@"didFinishLoadForFrame -> txt: '%@'",[txt substringToIndex:80]);
NSLog(@"didFinishLoadForFrame -> path: '%@'",path);
NSLog(@"didFinishLoadForFrame -> testFile: '%@'",testFile);
NSLog(@"didFinishLoadForFrame -> txt: '%@'",([txt length]>180)?[txt substringToIndex:180]:txt);
id script = [webViewFileViwer windowScriptObject];
[script setValue:self forKey:@"Controler"];
[script callWebScriptMethod:@"showFile"
withArguments:[NSArray arrayWithObjects:txt, nil]];
[[[[[sender mainFrame] DOMDocument] documentElement] outerHTML] writeToFile:testFile atomically:YES encoding:NSUTF8StringEncoding error:nil];
//[[[[[sender mainFrame] DOMDocument] documentElement] outerHTML] writeToFile:testFile atomically:YES encoding:NSUTF8StringEncoding error:nil];
}
- (NSString*)refSpec
+1 -1
View File
@@ -65,7 +65,7 @@
fileViewerController=[[FileViewerController alloc] retain];
[fileViewerController setCommit:true];
[fileViewerController initWithRepository:repository];
[fileViewerController initWithRepository:repository andController:self];
[fileViewerController loadView];
// XXXX :( ?
+3 -3
View File
@@ -119,7 +119,7 @@
// [webViewFileViwer setFrameLoadDelegate:self];
fileViewerController=[[FileViewerController alloc] retain];
[fileViewerController initWithRepository:repository];
[fileViewerController initWithRepository:repository andController:self];
[fileViewerController loadView];
//[fileViewer setAutoresizesSubviews:YES];
@@ -478,7 +478,7 @@
if (appController.launchedFromGitx && [appController.cliArgs isEqualToString:@"--commit"]) {
return NO;
}
// NSLog(@"[%@ %s]: SHA = %@", [self class], _cmd, commitSHA);
NSLog(@"[%@ %s]: SHA = %@", [self class], _cmd, commitSHA);
if (!forceSelectionUpdate && [[selectedCommit realSha] isEqualToString:commitSHA])
return NO;
@@ -493,7 +493,7 @@
[commitController setSelectedObjects:selectedCommits];
if (repository.currentBranchFilter != kGitXSelectedBranchFilter) {
// NSLog(@"[%@ %s] currentBranchFilter = %@", [self class], _cmd, PBStringFromBranchFilterType(repository.currentBranchFilter));
NSLog(@"[%@ %s] currentBranchFilter = %@", [self class], _cmd, PBStringFromBranchFilterType(repository.currentBranchFilter));
[self scrollSelectionToTopOfViewFrom:oldIndex];
}
+1 -3
View File
@@ -3,8 +3,6 @@
<table>
<tr><td>Author:</td><td>%an</td></tr>
<tr><td>Date:</td><td>%ar</td></tr>
<tr><td>Commit:</td><td>%H</td></tr>
<tr><td>Commit:</td><td><a href='' onclick='selectCommit(this.innerHTML);'>%H</a></td></tr>
</table>
</div>
file:///Users/laullon/xcode/gitx/build/Release/GitX.app/Contents/Resources/html/views/history/index.html
-6
View File
@@ -9,12 +9,6 @@
<link rel="stylesheet" href="log.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="log.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var showDiff = function(diff) {
highlightDiff(diff, $("diff"));
}
</script>
</head>
<body>
+5
View File
@@ -1,3 +1,8 @@
var selectCommit = function(a) {
window.Controler.selectCommit_(a);
return false;
}
var showFile = function(txt) {
$("log").style.display = "";
$("log").innerHTML=txt;