From f222d7bfe7a51ae6b8247977b7c43c19284cf01d Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 8 Mar 2012 01:19:17 +0100 Subject: [PATCH 1/8] CPBinder: move placeholder handling to superclass, add 2 subclassable methods for appying the regular value or a placeholder value. Update binder subclasses for CPTextField, CPCheckBox, CPColorWeel. --- AppKit/CPCheckBox.j | 39 +++++++------------------------------- AppKit/CPKeyValueBinding.j | 33 ++++++++++++++++++++++++++++---- AppKit/CPTextField.j | 31 +++++++----------------------- 3 files changed, 43 insertions(+), 60 deletions(-) diff --git a/AppKit/CPCheckBox.j b/AppKit/CPCheckBox.j index d58c49402..c13c3b5cc 100644 --- a/AppKit/CPCheckBox.j +++ b/AppKit/CPCheckBox.j @@ -110,40 +110,15 @@ CPCheckBoxImageOffset = 4.0; [self _setPlaceholder:CPOffState forMarker:CPNullMarker isDefault:YES]; } -- (void)setValueFor:(CPString)theBinding +- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding { - var destination = [_info objectForKey:CPObservedObjectKey], - keyPath = [_info objectForKey:CPObservedKeyPathKey], - options = [_info objectForKey:CPOptionsKey], - newValue = [destination valueForKeyPath:keyPath], - isPlaceholder = CPIsControllerMarker(newValue); + [_source setAllowsMixedState:(aValue === CPMixedState)]; + [_source setState:aValue]; +} - if (isPlaceholder) - { - if (newValue === CPNotApplicableMarker && [options objectForKey:CPRaisesForNotApplicableKeysBindingOption]) - { - [CPException raise:CPGenericException - reason:@"can't transform non applicable key on: " + _source + " value: " + newValue]; - } - - newValue = [self _placeholderForMarker:newValue]; - - if (newValue === CPMixedState) - { - [_source setAllowsMixedState:YES]; - } - else - { - // Cocoa will always set allowsMixedState to NO - // This behavior will be fine for Cappuccino as well if we (like Cocoa) - // default the CPConditionallySetsEnabledBindingOption to YES - [_source setAllowsMixedState:NO]; - } - } - else - newValue = [self transformValue:newValue withOptions:options]; - - [_source setState:newValue]; +- (void)setValue:(id)aValue forBinding:(CPString)aBinding +{ + [_source setState:aValue]; } @end diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 89b4214e2..d7518026d 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -149,15 +149,40 @@ var CPBindingOperationAnd = 0, return self; } -- (void)setValueFor:(CPString)aBinding +- (void)setValueFor:(CPString)theBinding { var destination = [_info objectForKey:CPObservedObjectKey], keyPath = [_info objectForKey:CPObservedKeyPathKey], options = [_info objectForKey:CPOptionsKey], - newValue = [destination valueForKeyPath:keyPath]; + newValue = [destination valueForKeyPath:keyPath], + isPlaceholder = CPIsControllerMarker(newValue); - newValue = [self transformValue:newValue withOptions:options]; - [_source setValue:newValue forKey:aBinding]; + if (isPlaceholder) + { + if (newValue === CPNotApplicableMarker && [options objectForKey:CPRaisesForNotApplicableKeysBindingOption]) + { + [CPException raise:CPGenericException + reason:@"Can't transform non applicable key on: " + _source + " Key Path:" + keyPath + " value: " + newValue]; + } + + var value = [self _placeholderForMarker:newValue]; + [self setPlaceholderValue:value withMarker:newValue forBinding:theBinding]; + } + else + { + var value = [self transformValue:newValue withOptions:options]; + [self setValue:value forBinding:theBinding]; + } +} + +- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding +{ + [_source setValue:aValue forKey:aBinding]; +} + +- (void)setValue:(id)aValue forBinding:(CPString)aBinding +{ + [_source setValue:aValue forKey:aBinding]; } - (void)reverseSetValueFor:(CPString)aBinding diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 5f3197720..0145649c2 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -1521,32 +1521,15 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey", [self _setPlaceholder:@"" forMarker:CPNullMarker isDefault:YES]; } -- (void)setValueFor:(CPString)theBinding +- (void)setPlaceholderValue:(id)aValue withMarker:(CPString)aMarker forBinding:(CPString)aBinding { - var destination = [_info objectForKey:CPObservedObjectKey], - keyPath = [_info objectForKey:CPObservedKeyPathKey], - options = [_info objectForKey:CPOptionsKey], - newValue = [destination valueForKeyPath:keyPath], - isPlaceholder = CPIsControllerMarker(newValue); + [_source setPlaceholderString:aValue]; + [_source setObjectValue:nil]; +} - if (isPlaceholder) - { - if (newValue === CPNotApplicableMarker && [options objectForKey:CPRaisesForNotApplicableKeysBindingOption]) - { - [CPException raise:CPGenericException - reason:@"can't transform non applicable key on: " + _source + " value: " + newValue]; - } - - newValue = [self _placeholderForMarker:newValue]; - - [_source setPlaceholderString:newValue]; - [_source setObjectValue:nil]; - } - else - { - newValue = [self transformValue:newValue withOptions:options]; - [_source setObjectValue:newValue]; - } +- (void)setValue:(id)aValue forBinding:(CPString)aBinding +{ + [_source setObjectValue:aValue]; } @end From 742bfcb0e77e62b56add2615fcca41628f9ac8db Mon Sep 17 00:00:00 2001 From: cacaodev Date: Tue, 10 Apr 2012 22:05:34 +0200 Subject: [PATCH 2/8] Fix non-applicable syntax --- AppKit/CPKeyValueBinding.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index d7518026d..ffb33f9ea 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -162,7 +162,7 @@ var CPBindingOperationAnd = 0, if (newValue === CPNotApplicableMarker && [options objectForKey:CPRaisesForNotApplicableKeysBindingOption]) { [CPException raise:CPGenericException - reason:@"Can't transform non applicable key on: " + _source + " Key Path:" + keyPath + " value: " + newValue]; + reason:@"Cannot transform non-applicable key on: " + _source + " key path: " + keyPath + " value: " + newValue]; } var value = [self _placeholderForMarker:newValue]; From 6b6c44c4d5495967a132c71cf27157a8fa4c4272 Mon Sep 17 00:00:00 2001 From: Blair Duncan Date: Tue, 10 Apr 2012 16:11:31 -0400 Subject: [PATCH 3/8] Fix for issue 1425 CPOutlineView expand all items when option key is pressed while clicking the disclosure triangle --- AppKit/CPOutlineView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 20fd434fd..d7058cf04 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -1365,7 +1365,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, [self collapseItem:item]; else - [self expandItem:item]; + [self expandItem:item expandChildren:([[CPApp currentEvent] modifierFlags] & CPAlternateKeyMask)]; } /*! From 6ede1ccb04c81c32ce18a841af95819b01a7d8c7 Mon Sep 17 00:00:00 2001 From: Blair Duncan Date: Tue, 10 Apr 2012 17:25:46 -0400 Subject: [PATCH 4/8] Unnecessary globals --- AppKit/CPAnimation.j | 1 + AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 4 +--- AppKit/CPOutlineView.j | 1 - AppKit/CPRuleEditor/CPPredicateEditor.j | 3 ++- AppKit/CPTableView.j | 12 ++++-------- AppKit/CPWindow/_CPHUDWindowView.j | 2 +- AppKit/CPWindow/_CPStandardWindowView.j | 2 +- Foundation/CPArray/CPArray.j | 2 +- Foundation/CPArray/_CPJavaScriptArray.j | 2 +- 9 files changed, 12 insertions(+), 17 deletions(-) diff --git a/AppKit/CPAnimation.j b/AppKit/CPAnimation.j index c8321ab7b..148db1f6f 100644 --- a/AppKit/CPAnimation.j +++ b/AppKit/CPAnimation.j @@ -122,6 +122,7 @@ ACTUAL_FRAME_RATE = 0; */ - (void)setAnimationCurve:(CPAnimationCurve)anAnimationCurve { + var timingFunctionName; switch (anAnimationCurve) { case CPAnimationEaseInOut: timingFunctionName = kCAMediaTimingFunctionEaseInEaseOut; diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 06ee3eb29..179c084e9 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -148,10 +148,8 @@ var SelectionColor = nil, [_submenuIndicatorView setFrame:submenuViewFrame]; } - _minSize = CGSizeMake(x + HORIZONTAL_MARGIN, height); - [self setAutoresizesSubviews:NO]; - [self setFrameSize:_minSize]; + [self setFrameSize:CGSizeMake(x + HORIZONTAL_MARGIN, height)]; [self setAutoresizesSubviews:YES]; } diff --git a/AppKit/CPOutlineView.j b/AppKit/CPOutlineView.j index 20fd434fd..0d107d101 100644 --- a/AppKit/CPOutlineView.j +++ b/AppKit/CPOutlineView.j @@ -151,7 +151,6 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0, _retargedChildIndex = nil; _shouldRetargetChildIndex = NO; - _startHoverTime = nil; [self setIndentationPerLevel:16.0]; [self setIndentationMarkerFollowsDataView:YES]; diff --git a/AppKit/CPRuleEditor/CPPredicateEditor.j b/AppKit/CPRuleEditor/CPPredicateEditor.j index 61b5ee498..5c4aadb64 100644 --- a/AppKit/CPRuleEditor/CPPredicateEditor.j +++ b/AppKit/CPRuleEditor/CPPredicateEditor.j @@ -345,7 +345,8 @@ { var rootRowsArray = [super _rootRowsArray], subpredicates = [CPMutableArray array], - count = count2 = [rootRowsArray count], + count, + count2 = count = [rootRowsArray count], predicate; while (count--) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 5898b759e..9d5c8d369 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -321,7 +321,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; */ - (void)_init { - _tableViewFlags = 0; _lastSelectedRow = -1; _selectedColumnIndexes = [CPIndexSet indexSet]; @@ -335,15 +334,12 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5; if (!_alternatingRowBackgroundColors) _alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]]; - _selectionHighlightColor = [CPColor colorWithHexString:@"5f83b9"]; - _tableColumnRanges = []; _dirtyTableColumnRangeIndex = 0; _numberOfHiddenColumns = 0; _objectValues = { }; _dataViewsForTableColumns = { }; - _dataViews = []; _numberOfRows = 0; _exposedRows = [CPIndexSet indexSet]; _exposedColumns = [CPIndexSet indexSet]; @@ -3696,7 +3692,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad [_selectedColumnIndexes getIndexes:indexes maxCount:-1 inIndexRange:exposedRange]; } - var count = count2 = [indexes count]; + var count, + count2 = count == [indexes count]; if (!count) return; @@ -4852,9 +4849,8 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey", while (index != CPNotFound) { - var indexSet = (switchFlag) ? otherSet : self; - - otherIndex = [indexSet indexGreaterThanOrEqualToIndex:index]; + var indexSet = (switchFlag) ? otherSet : self, + otherIndex = [indexSet indexGreaterThanOrEqualToIndex:index]; if (otherIndex == index) { diff --git a/AppKit/CPWindow/_CPHUDWindowView.j b/AppKit/CPWindow/_CPHUDWindowView.j index 1f3a391bf..b668e865f 100644 --- a/AppKit/CPWindow/_CPHUDWindowView.j +++ b/AppKit/CPWindow/_CPHUDWindowView.j @@ -105,7 +105,7 @@ var HUD_TITLEBAR_HEIGHT = 26.0; if ([[[self window] toolbar] isVisible]) { - toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); + var toolbarHeight = CGRectGetHeight([[self toolbarView] frame]); frameRect.origin.y -= toolbarHeight; frameRect.size.height += toolbarHeight; diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index 03c44a6c0..47cf61ddb 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -197,7 +197,7 @@ var STANDARD_GRADIENT_HEIGHT = 41.0, if ([theToolbar isVisible]) { - toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); + var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); frameRect.origin.y -= toolbarHeight; frameRect.size.height += toolbarHeight; diff --git a/Foundation/CPArray/CPArray.j b/Foundation/CPArray/CPArray.j index 5a27eca97..78c462aae 100755 --- a/Foundation/CPArray/CPArray.j +++ b/Foundation/CPArray/CPArray.j @@ -522,7 +522,7 @@ var concat = Array.prototype.concat, if ([objects count]) { - argumentsArray = [[nil, aSelector] arrayByAddingObjectsFromArray:objects]; + var argumentsArray = [[nil, aSelector] arrayByAddingObjectsFromArray:objects]; for (; index < count; ++index) { diff --git a/Foundation/CPArray/_CPJavaScriptArray.j b/Foundation/CPArray/_CPJavaScriptArray.j index 2cadc2113..7860a9adc 100644 --- a/Foundation/CPArray/_CPJavaScriptArray.j +++ b/Foundation/CPArray/_CPJavaScriptArray.j @@ -163,7 +163,7 @@ var concat = Array.prototype.concat, if ([objects count]) { - argumentsArray = [[nil, aSelector] arrayByAddingObjectsFromArray:objects]; + var argumentsArray = [[nil, aSelector] arrayByAddingObjectsFromArray:objects]; for (; index < count; ++index) { From 5c0e079873aa0f833d4919cd9f6754e2622cc1cf Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 10 Apr 2012 17:28:20 -0400 Subject: [PATCH 5/8] CPBinder: In reverseSetValueFor:, suspend observation to avoid unwanted setValueFor: isssue #1463 Manual test and ojtest. --- AppKit/CPKeyValueBinding.j | 7 +- Tests/AppKit/CPKeyValueBindingTest.j | 32 +++++- .../Manual/CPBinder-echo-bug/AppController.j | 65 +++++++++++ Tests/Manual/CPBinder-echo-bug/Info.plist | 12 ++ Tests/Manual/CPBinder-echo-bug/Jakefile | 93 +++++++++++++++ .../CPBinder-echo-bug/Resources/spinner.gif | Bin 0 -> 1849 bytes .../Manual/CPBinder-echo-bug/index-debug.html | 107 ++++++++++++++++++ Tests/Manual/CPBinder-echo-bug/index.html | 77 +++++++++++++ Tests/Manual/CPBinder-echo-bug/main.j | 18 +++ 9 files changed, 408 insertions(+), 3 deletions(-) create mode 100644 Tests/Manual/CPBinder-echo-bug/AppController.j create mode 100644 Tests/Manual/CPBinder-echo-bug/Info.plist create mode 100644 Tests/Manual/CPBinder-echo-bug/Jakefile create mode 100644 Tests/Manual/CPBinder-echo-bug/Resources/spinner.gif create mode 100644 Tests/Manual/CPBinder-echo-bug/index-debug.html create mode 100644 Tests/Manual/CPBinder-echo-bug/index.html create mode 100644 Tests/Manual/CPBinder-echo-bug/main.j diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index ffb33f9ea..a7aeff913 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -193,7 +193,10 @@ var CPBindingOperationAnd = 0, newValue = [_source valueForKeyPath:aBinding]; newValue = [self reverseTransformValue:newValue withOptions:options]; + + [self suppressSpecificNotificationFromObject:destination keyPath:keyPath]; [destination setValue:newValue forKeyPath:keyPath]; + [self unsuppressSpecificNotificationFromObject:destination keyPath:keyPath]; } - (void)observeValueForKeyPath:(CPString)aKeyPath ofObject:(id)anObject change:(CPDictionary)changes context:(id)context @@ -468,7 +471,7 @@ var CPBindingOperationAnd = 0, @end -var resolveMultipleValues = function resolveMultipleValues(/*CPString*/key, /*CPDictionary*/bindings, /*GSBindingOperationKind*/operation) +var resolveMultipleValues = function(/*CPString*/key, /*CPDictionary*/bindings, /*GSBindingOperationKind*/operation) { var bindingName = key, theBinding, @@ -492,7 +495,7 @@ var resolveMultipleValues = function resolveMultipleValues(/*CPString*/key, /*CP return !operation; }; -var invokeAction = function invokeAction(/*CPString*/targetKey, /*CPString*/argumentKey, /*CPDictionary*/bindings) +var invokeAction = function(/*CPString*/targetKey, /*CPString*/argumentKey, /*CPDictionary*/bindings) { var theBinding = [bindings objectForKey:targetKey], infoDictionary = theBinding._info, diff --git a/Tests/AppKit/CPKeyValueBindingTest.j b/Tests/AppKit/CPKeyValueBindingTest.j index 3886e7512..9f2860a91 100644 --- a/Tests/AppKit/CPKeyValueBindingTest.j +++ b/Tests/AppKit/CPKeyValueBindingTest.j @@ -297,6 +297,36 @@ [self assert:@"octarine" equals:[control stringValue] message:@"binding update no longer suppressed"]; } +- (void)testReverseSetValueForDoesNotSetObjectValueOnSource +{ + var control = [[TextField alloc] init]; + [control setStringValue:@"brown"]; + + var oc = [[CPObjectController alloc] initWithContent:[CPDictionary dictionaryWithObject:@"toto" forKey:@"foo"]]; + [oc setAutomaticallyPreparesContent:YES]; + + [control bind:CPValueBinding toObject:oc withKeyPath:@"selection.foo" options:nil]; + + [control setObjectValueSetterCount:0]; + // This will force a binding update -reverseSetValueFor: + [control sendAction:nil to:nil]; + + [self assert:0 equals:[control objectValueSetterCount] message:@"-setObjectValue should not be called"]; +} + +@end + +@implementation TextField : CPTextField +{ + CPInteger objectValueSetterCount @accessors; +} + +- (void)setObjectValue:(id)aValue +{ + objectValueSetterCount++; + [super setObjectValue:aValue]; +} + @end @implementation BindingTester : CPObject @@ -371,4 +401,4 @@ return valueB; } -@end +@end \ No newline at end of file diff --git a/Tests/Manual/CPBinder-echo-bug/AppController.j b/Tests/Manual/CPBinder-echo-bug/AppController.j new file mode 100644 index 000000000..1d6682e60 --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/AppController.j @@ -0,0 +1,65 @@ +/* + * AppController.j + * CPBinder-echo-bug + * + * Created by You on March 29, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +@import + + +@implementation AppController : CPObject +{ +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], + contentView = [theWindow contentView]; + + var message = [[CPTextField alloc] initWithFrame:CGRectMake(10,10,1000,32)]; + [message setFont:[CPFont boldSystemFontOfSize:16.0]]; + [message setStringValue:@"Type some text in the text field and press enter. You should NOT see any new call to -setObjectValue: in the console"]; + [contentView addSubview:message]; + + var label = [[TextField alloc] initWithFrame:CGRectMake(0,0,400,22)]; + [label setPlaceholderString:@"Type some text and hit enter"]; + [label setBezeled:YES]; + [label setBezelStyle:CPTextFieldSquareBezel]; + [label setBordered:YES]; + [label setEditable:YES]; + + var oc = [[CPObjectController alloc] initWithContent:[CPDictionary dictionaryWithObject:@"" forKey:@"foo"]]; + [oc setAutomaticallyPreparesContent:YES]; + + [label bind:CPValueBinding toObject:oc withKeyPath:@"selection.foo" options:nil]; + [label setFont:[CPFont boldSystemFontOfSize:24.0]]; + [label setBackgroundColor:[CPColor greenColor]]; + [label sizeToFit]; + + [label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; + [label setCenter:[contentView center]]; + + [contentView addSubview:label]; + + [theWindow orderFront:self]; + + // Uncomment the following line to turn on the standard menu bar. + //[CPMenu setMenuBarVisible:YES]; +} + +@end + +@implementation TextField : CPTextField +{ +} + +- (void)setObjectValue:(id)aValue +{ + CPLogConsole(_cmd + [super objectValue] + " > " + aValue); + [self setBackgroundColor:[CPColor redColor]]; + [super setObjectValue:aValue]; +} + +@end diff --git a/Tests/Manual/CPBinder-echo-bug/Info.plist b/Tests/Manual/CPBinder-echo-bug/Info.plist new file mode 100644 index 000000000..6937aee46 --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/Info.plist @@ -0,0 +1,12 @@ + + + + + CPApplicationDelegateClass + AppController + CPBundleName + CPBinder-echo-bug + CPPrincipalClass + CPApplication + + diff --git a/Tests/Manual/CPBinder-echo-bug/Jakefile b/Tests/Manual/CPBinder-echo-bug/Jakefile new file mode 100644 index 000000000..eb1b44f6f --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/Jakefile @@ -0,0 +1,93 @@ +/* + * Jakefile + * CPBinder-echo-bug + * + * Created by You on March 29, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +var ENV = require("system").env, + FILE = require("file"), + JAKE = require("jake"), + task = JAKE.task, + FileList = JAKE.FileList, + app = require("cappuccino/jake").app, + configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", + OS = require("os"); + +app ("CPBinderEchoBug", function(task) +{ + task.setBuildIntermediatesPath(FILE.join("Build", "CPBinderEchoBug.build", configuration)); + task.setBuildPath(FILE.join("Build", configuration)); + + task.setProductName("CPBinder-echo-bug"); + task.setIdentifier("com.yourcompany.CPBinderEchoBug"); + task.setVersion("1.0"); + task.setAuthor("Your Company"); + task.setEmail("feedback @nospam@ yourcompany.com"); + task.setSummary("CPBinder-echo-bug"); + task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**"))); + task.setResources(new FileList("Resources/**")); + task.setIndexFilePath("index.html"); + task.setInfoPlistPath("Info.plist"); + + if (configuration === "Debug") + task.setCompilerFlags("-DDEBUG -g"); + else + task.setCompilerFlags("-O"); +}); + +task ("default", ["CPBinderEchoBug"], function() +{ + printResults(configuration); +}); + +task ("build", ["default"]); + +task ("debug", function() +{ + ENV["CONFIGURATION"] = "Debug"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("release", function() +{ + ENV["CONFIGURATION"] = "Release"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("run", ["debug"], function() +{ + OS.system(["open", FILE.join("Build", "Debug", "CPBinderEchoBug", "index.html")]); +}); + +task ("run-release", ["release"], function() +{ + OS.system(["open", FILE.join("Build", "Release", "CPBinderEchoBug", "index.html")]); +}); + +task ("deploy", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Deployment", "CPBinderEchoBug")); + OS.system(["press", "-f", FILE.join("Build", "Release", "CPBinderEchoBug"), FILE.join("Build", "Deployment", "CPBinderEchoBug")]); + printResults("Deployment") +}); + +task ("desktop", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Desktop", "CPBinderEchoBug")); + require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPBinderEchoBug"), FILE.join("Build", "Desktop", "CPBinderEchoBug", "CPBinderEchoBug.app")); + printResults("Desktop") +}); + +task ("run-desktop", ["desktop"], function() +{ + OS.system([FILE.join("Build", "Desktop", "CPBinderEchoBug", "CPBinderEchoBug.app", "Contents", "MacOS", "NativeHost"), "-i"]); +}); + +function printResults(configuration) +{ + print("----------------------------"); + print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPBinderEchoBug")); + print("----------------------------"); +} diff --git a/Tests/Manual/CPBinder-echo-bug/Resources/spinner.gif b/Tests/Manual/CPBinder-echo-bug/Resources/spinner.gif new file mode 100644 index 0000000000000000000000000000000000000000..06dbc2bc21dddcf0e09b566d5b211aee89570f52 GIT binary patch literal 1849 zcma*odr(tX9tZHtz31lM+(&Y`A`Ou`NeG&R#DrIfV%?hng21vs6v>ooRQQFbk7E_K!V( z{?5!fpZWgIZ%*d6t%i*j24bL}AZUJm9)h6R*;%L4IWse3G#VWaN1#$zSSXcBhlYlH zJ|D}n{r&w2f+Qp)SS*&n?*G4}{}!h?td_mjU6Kad-rW*QwWYCUk7d^e+sjpZAn6kT z5rM;`{~_}-wm+L@%+E;JphLm}C3WzQAQD0wBoY|rOTQX{(@pp-WAA8Iw0HKl|15j) zhGh(SFWu#5zUCw^T!}C~eC}~?{xG-r7ugQC>taC+|L^xr&a%{#cgUOZXIM&v?)k^2 z1i5%0!U00wq)r4vlAwXBA_m5J5WNeuBm-XJQ5pG4GD%vc|K){+TJ{AkHqN@SJKczX zU}QRd9n*_bf^h94)6Ctv{CUfz_;qs#RDuQ$DR%y1&5G-a6rhf*4Y zl+UOD1*GE{GQ7vv;c-tTIMkz0ovO>9j%b5hpa@a*CBJ#W!0@ndSwF|%hMkdFtXiU) z`BEp+yhkt8ZY>tg&uyH@%^%K4jDrbA;et&vnnzZ3z22@e6<27z2Vk13kb7OtISyxv z(XoO-LNQCZe3lfzc%*pNqU<9T+p~teThOEB+~e&U0mC|zS{Q)dJZ)!^1f7L(zg*L> z*vSW%?dR~@@0(}x6-V^A`~ImD;)NaBUnP8;RH=bS2@pk`wp>>8r&jGjmGPy%1BW}v zoPo}ca$~bze@efc3kapuEVW1!%teOZT3j2Tw5=hjiAf02d}7dL0oFC%@=RXp5Ow#% z@a>+AM|YWt$n&e`>sB-32gBcuTi>R>*|8@lp`y6thc7ydyqDsuUn~YzZf|{-R@-3y zL#wx{Ii}xxL_csiW*LBn0-A$>zp4WOmkf6=ilrjlW?-l9+bCd7|i?*b5NTmy<<6NZ0T8$SN@mwdC2f z6jqK=N@bS@!=YSj%>h0}*4p+%0HbTIrE$w7UMT6+AZZ&DAo*qZAAi(OtNbIfl#Dw^ zJWeiCp~zi#&t6x}m9)O^eR4HiLV3QA<<0>HZ8%$^lrSE94Wb}=+MM^!b>n#5&-JQR zkr-CEu9C;_F*7DqDisulV6Pmg$nFL0TPn%~*m^-`Z3^BgU(sNpnx%nW(!eV9A&FvI zHL3X3lw8Wji^6=8KbQDE-e%b?svdFxxdh$8r97@7$ojeI`6AL8Ob6QC$qh&>ZWVDX1F{0vJnT%%mE;GveKWR%C} zM&4d;Jf3s9|HAA)yVUPo`Aq;0do#)uHSXi5*QF*)x@MVVHr+cN)uMZ__F|&Ta#p8d z53TOKtce!PJUuie8UWol-S(`c2nH?UGqJP{!4RR4u$LCfn)q-hj0^f=h(VYy)T6eN zhRO!ja-aDBTcgeyP(8Ua4IdiOog^*CQa?R(cP#9AgL9`j>EX-6Yf1lzX(!~``M1XC zNmM<4<6d~wWZ$Xrk0K}UteTrq@LBBk#MsjkK;pbuVhe)NI7(7Pf(l?lxC7=1Z7Pzl zMbS;nV4NI5_N{1$P)&XC)huOGQ+h^zpYUZfb*1n6>!`#*b3y52LGmi+<4sY5jyD#- zw&$d}DTguLAfnRtjrM*JfqtHqUu6rQoU=g%1E9xk%;)TDm^2<8n-0IhTsQFaek)MY}>PK4;nBk=ow4pF>vzkO& gna%Org-kgQCf=+BeMi^RbuY;YE~rTjend;_cdi8t>i_@% literal 0 HcmV?d00001 diff --git a/Tests/Manual/CPBinder-echo-bug/index-debug.html b/Tests/Manual/CPBinder-echo-bug/index-debug.html new file mode 100644 index 000000000..2f3319b88 --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/index-debug.html @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + CPBinder-echo-bug + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPBinder-echo-bug/index.html b/Tests/Manual/CPBinder-echo-bug/index.html new file mode 100644 index 000000000..2d67d3934 --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/index.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + CPBinder-echo-bug + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPBinder-echo-bug/main.j b/Tests/Manual/CPBinder-echo-bug/main.j new file mode 100644 index 000000000..e91513816 --- /dev/null +++ b/Tests/Manual/CPBinder-echo-bug/main.j @@ -0,0 +1,18 @@ +/* + * AppController.j + * CPBinder-echo-bug + * + * Created by You on March 29, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +@import +@import + +@import "AppController.j" + + +function main(args, namedArgs) +{ + CPApplicationMain(args, namedArgs); +} From f4f4554cde2bee682c2d93419aeaee0ed00ff9d7 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 10 Apr 2012 18:42:26 -0400 Subject: [PATCH 6/8] Fixed test of result of sudo() --- common.jake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.jake b/common.jake index 7c7f18dc3..d40edfa7c 100644 --- a/common.jake +++ b/common.jake @@ -488,14 +488,14 @@ global.copyManPage = function(/*String*/ name, /*int*/ section) { if (!FILE.isDirectory(manDir)) { - if (!sudo(["mkdir", "-p", "-m", "0755", manDir])) + if (sudo(["mkdir", "-p", "-m", "0755", manDir])) { stream.print("\0red(Unable to create the man directory.\0)"); OS.exit(1); } } - if (!sudo(["cp", "-f", pageFile, manDir])) + if (sudo(["cp", "-f", pageFile, manDir])) stream.print("\0red(Unable to copy the man file.\0)"); } } From 71cfeae5f15a9d1d0ad4e9ce0d57a137a5312057 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Tue, 10 Apr 2012 16:08:17 -0700 Subject: [PATCH 7/8] fix typo preventing the highlighting color to be draw. --- AppKit/CPTableView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 9d5c8d369..5191d2443 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -3693,7 +3693,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad } var count, - count2 = count == [indexes count]; + count2 = count = [indexes count]; if (!count) return; From 6293380406eb5140531806b8dd07d3594f3e1229 Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Tue, 10 Apr 2012 22:42:46 -0400 Subject: [PATCH 8/8] Let jake proceed if a man page cannot be copied --- common.jake | 3 --- 1 file changed, 3 deletions(-) diff --git a/common.jake b/common.jake index d40edfa7c..720f7d923 100644 --- a/common.jake +++ b/common.jake @@ -489,10 +489,7 @@ global.copyManPage = function(/*String*/ name, /*int*/ section) if (!FILE.isDirectory(manDir)) { if (sudo(["mkdir", "-p", "-m", "0755", manDir])) - { stream.print("\0red(Unable to create the man directory.\0)"); - OS.exit(1); - } } if (sudo(["cp", "-f", pageFile, manDir]))