From cbabb544ab2da64d61c4b9a2af91113cf81b164c Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 15 Jun 2011 12:54:11 -0700 Subject: [PATCH 1/8] bootstrap should have a +x bit. --- bootstrap.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh old mode 100644 new mode 100755 From 6c34bec51ef58e93c2985aeb14397bbe0d3755f6 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Sun, 19 Jun 2011 19:27:58 +0200 Subject: [PATCH 2/8] do not return 0 if any conversion fail (return 2 instead) --- Tools/nib2cib/main.j | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Tools/nib2cib/main.j b/Tools/nib2cib/main.j index 7ab91ef33..9fe1edbbf 100644 --- a/Tools/nib2cib/main.j +++ b/Tools/nib2cib/main.j @@ -51,18 +51,21 @@ function main(args) { try { - var options = parseOptions(args); + var options = parseOptions(args), + ret = 0; if (options.watch) watch(options); else - convert(options); + if (!convert(options)) + ret = 2; } catch (anException) { CPLog.fatal(exceptionReason(anException)); OS.exit(1); } + OS.exit(ret); } function convert(options, inputFile) From fc81483371b59f64a38719d002b98c30ecc9ef05 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Sat, 25 Jun 2011 00:45:07 -0700 Subject: [PATCH 3/8] Fix typeo in CPToolbar.j CPToolbarItems to not respect maxSize. Closes #1305. --- AppKit/CPToolbar.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index eebd8a168..ff18129e2 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -1015,7 +1015,7 @@ var TOP_MARGIN = 5.0, _labelSize = [_labelField frame].size; _minSize = CGSizeMake(MAX(_labelSize.width, minSize.width), _labelSize.height + minSize.height + LABEL_MARGIN + TOP_MARGIN); - _maxSize = CGSizeMake(MAX(_labelSize.width, minSize.width), 100000000.0); + _maxSize = CGSizeMake(MIN(_labelSize.width, maxSize.width), 100000000.0); [_toolbar tile]; } From 55e07536d9d4f5b30c11c5bfaf7f5f98739ab71c Mon Sep 17 00:00:00 2001 From: Klaas Pieter Annema Date: Wed, 29 Jun 2011 16:03:48 +0200 Subject: [PATCH 4/8] don't start dragging if there are no rows --- AppKit/CPTableView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 8e4e25c56..0677dca7d 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -2770,7 +2770,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad */ - (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes atPoint:(CGPoint)mouseDownPoint { - return YES; + return [rowIndexes count] > 0 && [self numberOfRows] > 0; } /*! From 63710d5fae5cc6d7f81d89d84dd5188106f593b6 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Wed, 29 Jun 2011 09:06:22 -0700 Subject: [PATCH 5/8] Added missing type in method signature --- AppKit/Themes/BlendKit/BKThemeDescriptor.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/Themes/BlendKit/BKThemeDescriptor.j b/AppKit/Themes/BlendKit/BKThemeDescriptor.j index 96fa4cff9..5c42e8582 100644 --- a/AppKit/Themes/BlendKit/BKThemeDescriptor.j +++ b/AppKit/Themes/BlendKit/BKThemeDescriptor.j @@ -225,7 +225,7 @@ var ItemSizes = { }, } } -+ (void)registerThemeValues:(CPArray)themeValues forView:aView inherit:(CPArray)inheritedValues ++ (void)registerThemeValues:(CPArray)themeValues forView:(CPView)aView inherit:(CPArray)inheritedValues { // Register inherited values first, then override those with the subtheme values. if (inheritedValues) From 47f40eb04b8fcd53e3ef19e63a4b3097befcb010 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Fri, 1 Jul 2011 00:04:09 -0700 Subject: [PATCH 6/8] Added left/right arrow key expand and collapse... just for you @tolmasky. --- AppKit/CPOutlineView.j | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 36c756129..2c5c745a1 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -1458,6 +1458,44 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, userInfo:[CPDictionary dictionaryWithObject:item forKey:"CPObject"]]; } + +- (void)keyDown:(CPEvent)anEvent +{ + var character = [anEvent charactersIgnoringModifiers], + modifierFlags = [anEvent modifierFlags]; + + // Check for the key events manually, as opposed to waiting for CPWindow to sent the actual action message + // in _processKeyboardUIKey:, because we might not want to handle the arrow events. + + if (character !== CPRightArrowFunctionKey && character !== CPLeftArrowFunctionKey) + return [super keyDown:anEvent]; + + var rows = [self selectedRowIndexes], + indexes = [], + items = []; + + [rows getIndexes:indexes maxCount:-1 inIndexRange:nil]; + + var i = 0, + c = [indexes count]; + + for (; i < c; i++) + items.push([self itemAtRow:indexes[i]]); + + + if (character === CPRightArrowFunctionKey) + { + for (var i = 0; i < c; i++) + [self expandItem:items[i]]; + } + else if (character === CPLeftArrowFunctionKey) + { + for (var i = 0; i < c; i++) + [self collapseItem:items[i]]; + } + + [super keyDown:anEvent]; +} @end // FIX ME: We're using with() here because Safari fails if we use anOutlineView._itemInfosForItems or whatever... From 80c8fd97942e55f08a6526c9f6ab688696d4f8bd Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 2 Jul 2011 08:36:55 -0700 Subject: [PATCH 7/8] Fix bundletask to include .js files. Reviewed by @tolmasky. --- .../lib/objective-j/jake/bundletask.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js index 76f7abb92..156c855ab 100644 --- a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js +++ b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js @@ -836,8 +836,7 @@ BundleTask.prototype.defineSourceTasks = function() environmentSources.forEach(function(/*String*/ aFilename) { - // if this file doesn't exist or isn't a .j file, don't preprocess it. - if (!FILE.exists(aFilename) || FILE.extension(aFilename) !== '.j') + if (!FILE.exists(aFilename)) return; var relativePath = aFilename.substring(basePathLength ? basePathLength + 1 : basePathLength), @@ -845,8 +844,19 @@ BundleTask.prototype.defineSourceTasks = function() filedir (compiledEnvironmentSource, [aFilename], function() { - TERM.stream.write("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)").flush(); - var compiled = require("objective-j/compiler").compile(aFilename, environmentCompilerFlags); + var compile + // if this file doesn't exist or isn't a .j file, don't preprocess it. + if (FILE.extension(aFilename) !== ".j") + { + TERM.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)").flush(); + var compiled = FILE.read(aFilename, { charset:"UTF-8" }); + } + else + { + TERM.stream.write("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)").flush(); + var compiled = require("objective-j/compiler").compile(aFilename, environmentCompilerFlags); + } + TERM.stream.print(Array(Math.round(compiled.length / 1024) + 3).join(".")); FILE.write(compiledEnvironmentSource, compiled, { charset:"UTF-8" }); }); From 420606d8e82a7526f34409c150031036d396f761 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sat, 2 Jul 2011 13:33:53 -0700 Subject: [PATCH 8/8] Tests for forward invocation. Reviewed by @tolmasky. --- Tests/Objective-J/MethodDispatchTest.j | 326 +++++++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 Tests/Objective-J/MethodDispatchTest.j diff --git a/Tests/Objective-J/MethodDispatchTest.j b/Tests/Objective-J/MethodDispatchTest.j new file mode 100644 index 000000000..99732d967 --- /dev/null +++ b/Tests/Objective-J/MethodDispatchTest.j @@ -0,0 +1,326 @@ + +@import + + +@implementation RootClass +{ +} + ++ (id)alloc +{ + return class_createInstance(self); +} + +@end + +@implementation RootClassWithDoesNotRecognizeSelector +{ +} + ++ (id)alloc +{ + return class_createInstance(self); +} + +- (void)doesNotRecognizeSelector:(SEL)aSelector +{ + throw "ERROR"; +} + +@end + +@implementation Subclass : CPObject +{ +} + +@end + +@implementation RootClassWithForwardingTarget +{ +} + ++ (void)initialize +{ +} + ++ (id)alloc +{ + return class_createInstance(self); +} + +- (id)forwardingTargetForSelector:(SEL)aSelector +{ + if (aSelector !== @selector(doesNotExist)) + return nil; + + if (class_isMetaClass(isa)) + return GlobalMethodDispatchTest; + + return GlobalMethodDispatchTest; +} + +@end + +@implementation SubclassWithForwardingTarget : CPObject +{ +} + ++ (id)forwardingTargetForSelector:(SEL)aSelector +{ + if (aSelector !== @selector(doesNotExist)) + return [super forwardingTargetForSelector:aSelector]; + + return GlobalMethodDispatchTest; +} + +- (id)forwardingTargetForSelector:(SEL)aSelector +{ + if (aSelector !== @selector(doesNotExist)) + return [super forwardingTargetForSelector:aSelector]; + + return GlobalMethodDispatchTest; +} + +@end + +@implementation RootClassWithForwardInvocation +{ +} + ++ (void)initialize +{ +} + ++ (id)alloc +{ + return class_createInstance(self); +} + +- (CPMethodSignature)methodSignatureForSelector:(SEL)aSelector +{ + if (aSelector === @selector(doesNotExist)) + return 1; + + return nil; +} + +- (void)forwardInvocation:(CPInvocation)anInvocation +{ + [anInvocation setTarget:GlobalMethodDispatchTest]; + [anInvocation invoke]; +} + +@end + +@implementation SubclassWithForwardInvocation : CPObject +{ +} + ++ (CPMethodSignature)methodSignatureForSelector:(SEL)aSelector +{ + if (aSelector === @selector(doesNotExist)) + return 1; + + return nil; +} + ++ (void)forwardInvocation:(CPInvocation)anInvocation +{ + [anInvocation setTarget:GlobalMethodDispatchTest]; + [anInvocation invoke]; +} + +- (CPMethodSignature)methodSignatureForSelector:(SEL)aSelector +{ + if (aSelector === @selector(doesNotExist)) + return 1; + + return nil; +} + +- (void)forwardInvocation:(CPInvocation)anInvocation +{ + [anInvocation setTarget:GlobalMethodDispatchTest]; + [anInvocation invoke]; +} + +@end + +var GlobalMethodDispatchTest; + +@implementation MethodDispatchTest : OJTestCase +{ +} + +- (id)init +{ + self = [super init]; + + if (self) + GlobalMethodDispatchTest = self; + + return self; +} + +- (BOOL)doesNotExist +{ + return YES; +} + +- (void)test_RootClass_class_doesNotRecognizeSelector_ +{ + try + { + [RootClass doesNotExist]; + } + catch (anException) + { + [self assert:anException equals:"RootClass does not implement doesNotRecognizeSelector:. Did you forget a superclass for RootClass?"]; + } +} + +- (void)test_RootClass_instance_doesNotRecognizeSelector_ +{ + var object = [RootClass alloc]; + + try + { + [object doesNotExist]; + } + catch (anException) + { + [self assert:anException equals:"RootClass does not implement doesNotRecognizeSelector:. Did you forget a superclass for RootClass?"]; + } +} + +- (void)test_RootClassWithDoesNotRecognizeSelector_class_doesNotRecognizeSelector_ +{ + try + { + [RootClassWithDoesNotRecognizeSelector doesNotExist]; + } + catch (anException) + { + [self assert:anException equals:"ERROR"]; + } +} + +- (void)test_RootClassWithDoesNotRecognizeSelector_instance_doesNotRecognizeSelector_ +{ + var object = [RootClassWithDoesNotRecognizeSelector alloc]; + + try + { + [object doesNotExist]; + } + catch (anException) + { + [self assert:anException equals:"ERROR"]; + } +} + +- (void)test_CPObject_class_doesNotRecognizeSelector_ +{ + try + { + [CPObject doesNotExist]; + } + catch (anException) + { + [self assert:[anException name] equals:CPInvalidArgumentException]; + [self assert:[anException reason] equals:@"+ [CPObject doesNotExist] unrecognized selector sent to class CPObject"]; + } +} + +- (void)test_CPObject_instance_doesNotRecognizeSelector_ +{ + var object = [CPObject alloc]; + + try + { + [object doesNotExist]; + } + catch (anException) + { + [self assert:[anException name] equals:CPInvalidArgumentException]; + [self assert:[anException reason] equals:@"- [CPObject doesNotExist] unrecognized selector sent to instance 0x" + [CPString stringWithHash:[object UID]]]; + } +} + +- (void)test_Subclass_class_doesNotRecognizeSelector_ +{ + try + { + [Subclass doesNotExist]; + } + catch (anException) + { + [self assert:[anException name] equals:CPInvalidArgumentException]; + [self assert:[anException reason] equals:@"+ [Subclass doesNotExist] unrecognized selector sent to class Subclass"]; + } +} + +- (void)test_Subclass_instance_doesNotRecognizeSelector_ +{ + var object = [Subclass alloc]; + + try + { + [object doesNotExist]; + } + catch (anException) + { + [self assert:[anException name] equals:CPInvalidArgumentException]; + [self assert:[anException reason] equals:@"- [Subclass doesNotExist] unrecognized selector sent to instance 0x" + [CPString stringWithHash:[object UID]]]; + } +} + +- (void)test_RootClassWithForwardingTarget_class_forwardingTargetForSelector_ +{ + [self assert:YES equals:[RootClassWithForwardingTarget doesNotExist]]; +} + +- (void)test_RootClassWithForwardingTarget_instance_forwardingTargetForSelector_ +{ + var object = [RootClassWithForwardingTarget alloc]; + + [self assert:YES equals:[object doesNotExist]]; +} + +- (void)test_SubclassWithForwardingTarget_class_forwardingTargetForSelector_ +{ + [self assert:YES equals:[SubclassWithForwardingTarget doesNotExist]]; +} + +- (void)test_SubclassWithForwardingTarget_instance_forwardingTargetForSelector_ +{ + var object = [[SubclassWithForwardingTarget alloc] init]; + + [self assert:YES equals:[object doesNotExist]]; +} + +- (void)test_RootClassWithForwardInvocation_class_forwardInvocation_ +{ + [self assert:YES equals:[RootClassWithForwardInvocation doesNotExist]]; +} + +- (void)test_RootClassWithForwardInvocation_instance_forwardInvocation_ +{ + var object = [RootClassWithForwardInvocation alloc]; + + [self assert:YES equals:[object doesNotExist]]; +} + +- (void)test_SubclassWithForwardInvocation_class_forwardInvocation_ +{ + [self assert:YES equals:[SubclassWithForwardInvocation doesNotExist]]; +} + +- (void)test_SubclassWithForwardInvocation_instance_forwardInvocation_ +{ + var object = [[SubclassWithForwardInvocation alloc] init]; + + [self assert:YES equals:[object doesNotExist]]; +} + +@end