From 936a3b4cae75f4def9c2a7cff02e2e2b27e377c4 Mon Sep 17 00:00:00 2001 From: glaullon Date: Tue, 15 Jun 2010 20:17:07 -0700 Subject: [PATCH] diff working --- FileViewer/FileViewerController.m | 30 ++++++++++++++++++++++-------- GitX.xcodeproj/project.pbxproj | 12 ++++++++++++ PBGitCommitController.m | 2 +- html/lib/diffHighlighter.js | 8 ++------ 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/FileViewer/FileViewerController.m b/FileViewer/FileViewerController.m index 626facf..bc814f4 100644 --- a/FileViewer/FileViewerController.m +++ b/FileViewer/FileViewerController.m @@ -56,8 +56,9 @@ items, GROUP_ITEMS, nil]]; [scopeBar reloadData]; + [webViewFileViwer setUIDelegate:self]; [webViewFileViwer setFrameLoadDelegate:self]; -} + [webViewFileViwer setResourceLoadDelegate:self];} - (void)dealloc @@ -68,11 +69,6 @@ #pragma mark JavaScript log.js methods -+ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel -{ - if (sel == @selector(selectCommit:)) return NO; - return YES; -} - (void) selectCommit:(NSString*)c { @@ -140,6 +136,25 @@ [self scopeBar:scopeBar selectedStateChanged:true forItem:show inGroup:0]; } +# pragma mark WebKitDelegate methods + ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)sel +{ + return NO; //![controller respondsToSelector:sel]; +// if (sel == @selector(selectCommit:)) return NO; +// return YES; +} + +- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame +{ + id script = [sender windowScriptObject]; + [script setValue:controller forKey:@"Controller"]; +} + +- (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)dictionary +{ + NSLog(@"Error from webkit: %@", dictionary); +} - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame { @@ -147,7 +162,7 @@ NSString *path = [NSString stringWithFormat:@"html/views/%@", show]; NSString *formatFile = [[NSBundle mainBundle] pathForResource:@"format" ofType:@"html" inDirectory:path]; - NSString *testFile = [NSString stringWithFormat:@"%@/test.html",NSHomeDirectory()]; + //NSString *testFile = [NSString stringWithFormat:@"%@/test.html",NSHomeDirectory()]; NSString *format; if(formatFile!=nil) format=[NSString stringWithContentsOfURL:[NSURL fileURLWithPath:formatFile] encoding:NSUTF8StringEncoding error:nil]; @@ -167,7 +182,6 @@ 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]]; diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 7b5ef6c..db203f4 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -2039,6 +2039,10 @@ isa = XCBuildConfiguration; baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; }; name = Debug; }; @@ -2046,11 +2050,15 @@ isa = XCBuildConfiguration; baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = c99; GCC_ENABLE_OBJC_GC = required; GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = DEBUG_BUILD; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; }; name = Release; }; @@ -2130,6 +2138,10 @@ isa = XCBuildConfiguration; baseConfigurationReference = 656F3B0A115C042D00CA816E /* Common.xcconfig */; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; }; name = Install; }; diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 2ee7098..ade187d 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -65,7 +65,7 @@ fileViewerController=[[FileViewerController alloc] retain]; [fileViewerController setCommit:true]; - [fileViewerController initWithRepository:repository andController:self]; + [fileViewerController initWithRepository:repository andController:webController]; [fileViewerController loadView]; // XXXX :( ? diff --git a/html/lib/diffHighlighter.js b/html/lib/diffHighlighter.js index 37a008f..8e1a7da 100644 --- a/html/lib/diffHighlighter.js +++ b/html/lib/diffHighlighter.js @@ -1,10 +1,6 @@ // If we run from a Safari instance, we don't // have a Controller object. Instead, we fake it by // using the console -if (typeof Controller == 'undefined') { - Controller = console; - Controller.log_ = console.log; -} var highlightDiff = function(diff, element, callbacks) { if (!diff || diff == "") @@ -188,7 +184,7 @@ var highlightDiff = function(diff, element, callbacks) { sindex = "index=" + lindex.toString() + " "; if (firstChar == "+") { - if (Controller.isFeatureEnabled_("showWhitespaceDifferences")) { + if (window.Controller.isFeatureEnabled_("showWhitespaceDifferences")) { // Highlight trailing whitespace if (m = l.match(/\s+$/)) l = l.replace(/\s+$/, "" + m + ""); @@ -228,5 +224,5 @@ var highlightDiff = function(diff, element, callbacks) { // TODO: Replace this with a performance pref call if (false) - Controller.log_("Total time:" + (new Date().getTime() - start)); + alert("Total time:" + (new Date().getTime() - start)); } \ No newline at end of file