From 262bd5b7c1e2cef57a8020f8e42e97eb11650805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Wallstro=CC=88m?= Date: Wed, 6 Mar 2013 19:30:17 +0100 Subject: [PATCH 01/10] Use dedicated class, _CPStateMarker, instead of CPString for selection markers. --- AppKit/CPKeyValueBinding.j | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index e48f9fc22..705ec8be6 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -347,7 +347,7 @@ var CPBindingOperationAnd = 0, - (void)_placeholderForMarker:aMarker { - var placeholder = _placeholderForMarker[aMarker]; + var placeholder = _placeholderForMarker[[aMarker hash]]; if (placeholder) return placeholder['value']; @@ -359,14 +359,14 @@ var CPBindingOperationAnd = 0, { if (isDefault) { - var existingPlaceholder = _placeholderForMarker[aMarker]; + var existingPlaceholder = _placeholderForMarker[[aMarker hash]]; // Don't overwrite an explicitly set placeholder with a default. if (existingPlaceholder && !existingPlaceholder['isDefault']) return; } - _placeholderForMarker[aMarker] = { 'isDefault': isDefault, 'value': aPlaceholder }; + _placeholderForMarker[[aMarker hash]] = { 'isDefault': isDefault, 'value': aPlaceholder }; } @end @@ -802,6 +802,26 @@ var CPBindingOperationAnd = 0, @end +@implementation _CPStateMarker : CPObject +{ + CPString _name; +} + +- (id)initWithName:(CPString)aName +{ + if (self = [super init]) + _name = aName + + return self; +} + +- (CPString)description +{ + return "<" + _name + ">"; +} + +@end + // Keys in options dictionary @@ -811,10 +831,10 @@ CPObservedKeyPathKey = @"CPObservedKeyPathKey"; CPOptionsKey = @"CPOptionsKey"; // special markers -CPMultipleValuesMarker = @"CPMultipleValuesMarker"; -CPNoSelectionMarker = @"CPNoSelectionMarker"; -CPNotApplicableMarker = @"CPNotApplicableMarker"; -CPNullMarker = @"CPNullMarker"; +CPNoSelectionMarker = [[_CPStateMarker alloc] initWithName:@"NO SELECTION MARKER"]; +CPMultipleValuesMarker = [[_CPStateMarker alloc] initWithName:@"MULTIPLE VALUES MARKER"]; +CPNotApplicableMarker = [[_CPStateMarker alloc] initWithName:@"NOT APPLICABLE MARKER"]; +CPNullMarker = [[_CPStateMarker alloc] initWithName:@"NULL MARKER"]; // Binding name constants CPAlignmentBinding = @"alignment"; From 51e682335bb66c0ab163eb9fc48e41e43c3fac6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Wallstro=CC=88m?= Date: Thu, 7 Mar 2013 12:37:35 +0100 Subject: [PATCH 02/10] Use UID instead of hash. --- AppKit/CPKeyValueBinding.j | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 705ec8be6..ab9a9f369 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -347,7 +347,7 @@ var CPBindingOperationAnd = 0, - (void)_placeholderForMarker:aMarker { - var placeholder = _placeholderForMarker[[aMarker hash]]; + var placeholder = _placeholderForMarker[[aMarker UID]]; if (placeholder) return placeholder['value']; @@ -359,14 +359,14 @@ var CPBindingOperationAnd = 0, { if (isDefault) { - var existingPlaceholder = _placeholderForMarker[[aMarker hash]]; + var existingPlaceholder = _placeholderForMarker[[aMarker UID]]; // Don't overwrite an explicitly set placeholder with a default. if (existingPlaceholder && !existingPlaceholder['isDefault']) return; } - _placeholderForMarker[[aMarker hash]] = { 'isDefault': isDefault, 'value': aPlaceholder }; + _placeholderForMarker[[aMarker UID]] = { 'isDefault': isDefault, 'value': aPlaceholder }; } @end From 455ff57eeca48c16f865bd054bbefbc72a65187a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Wallstro=CC=88m?= Date: Thu, 7 Mar 2013 12:39:04 +0100 Subject: [PATCH 03/10] Fixed return type for _placeholderForMarker: --- AppKit/CPKeyValueBinding.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index ab9a9f369..96bc70687 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -345,7 +345,7 @@ var CPBindingOperationAnd = 0, [self _updatePlaceholdersWithOptions:options]; } -- (void)_placeholderForMarker:aMarker +- (JSObject)_placeholderForMarker:aMarker { var placeholder = _placeholderForMarker[[aMarker UID]]; From bd269501ace03d37117e031fef44820bad077440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Wallstro=CC=88m?= Date: Thu, 7 Mar 2013 12:49:19 +0100 Subject: [PATCH 04/10] Fixed parameter type for _placeholderForMarker: --- AppKit/CPKeyValueBinding.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 96bc70687..524f7e0dd 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -345,7 +345,7 @@ var CPBindingOperationAnd = 0, [self _updatePlaceholdersWithOptions:options]; } -- (JSObject)_placeholderForMarker:aMarker +- (JSObject)_placeholderForMarker:(id)aMarker { var placeholder = _placeholderForMarker[[aMarker UID]]; From c381672aeecd19ba1ad645619ae36f5b7cd8df84 Mon Sep 17 00:00:00 2001 From: Kjell Nilsson Date: Fri, 8 Mar 2013 09:52:55 +0100 Subject: [PATCH 05/10] Added localization of tooltips with the standard localizer --- AppKit/CPRuleEditor/CPRuleEditor.j | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index 107e8c972..e001a103e 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -1877,17 +1877,17 @@ TODO: implement - (CPString)_toolTipForAddCompoundRowButton { - return @"Add Compound row"; + return [_standardLocalizer localizedStringForString:@"Add Compound row"]; } - (CPString)_toolTipForAddSimpleRowButton { - return @"Add row"; + return [_standardLocalizer localizedStringForString:@"Add row"]; } - (CPString)_toolTipForDeleteRowButton { - return @"Delete row"; + return [_standardLocalizer localizedStringForString:@"Delete row"]; } - (void)_updateSliceIndentations From 197decc84220a86ce9202be4489c3ba1b683bf71 Mon Sep 17 00:00:00 2001 From: Kjell Nilsson Date: Fri, 8 Mar 2013 13:47:46 +0100 Subject: [PATCH 06/10] Changed tooltip word to lowercase to follow other tooltip formatting --- AppKit/CPRuleEditor/CPRuleEditor.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPRuleEditor/CPRuleEditor.j b/AppKit/CPRuleEditor/CPRuleEditor.j index e001a103e..50e2905b8 100644 --- a/AppKit/CPRuleEditor/CPRuleEditor.j +++ b/AppKit/CPRuleEditor/CPRuleEditor.j @@ -1877,7 +1877,7 @@ TODO: implement - (CPString)_toolTipForAddCompoundRowButton { - return [_standardLocalizer localizedStringForString:@"Add Compound row"]; + return [_standardLocalizer localizedStringForString:@"Add compound row"]; } - (CPString)_toolTipForAddSimpleRowButton From 7fab8d9782d4604c4441e48701f9207e4a2b4229 Mon Sep 17 00:00:00 2001 From: Blair Duncan Date: Fri, 8 Mar 2013 12:27:19 -0500 Subject: [PATCH 07/10] don't allow views from another window to be next/previouskeyViews --- AppKit/CPView.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 49e0e4aea..2827158ab 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -2557,7 +2557,7 @@ setBoundsOrigin: - (void)_setPreviousKeyView:(CPView)previous { - if ([previous isEqual:self]) + if ([previous isEqual:self] || ![[previous window] isEqual:[self window]]) _previousKeyView = nil; else _previousKeyView = previous; @@ -2565,7 +2565,7 @@ setBoundsOrigin: - (void)setNextKeyView:(CPView)next { - if ([next isEqual:self]) + if ([next isEqual:self] || ![[next window] isEqual:[self window]]) _nextKeyView = nil; else { From 5fd241f7d7c83e03b8e261b5ec3ab17ce41fa2c3 Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Fri, 8 Mar 2013 23:04:23 -0500 Subject: [PATCH 08/10] Fix #1284: Update Emacs documentation Small fix to update documentation for emacs. Fixes #1284. --- Tools/Editors/Emacs/README.txt | 3 +-- Tools/Editors/Emacs/objj-mode.el | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Tools/Editors/Emacs/README.txt b/Tools/Editors/Emacs/README.txt index 2e4d9e506..0ae28549d 100644 --- a/Tools/Editors/Emacs/README.txt +++ b/Tools/Editors/Emacs/README.txt @@ -18,8 +18,7 @@ Installation Add objc-c-mode.el and objj-mode.el to your load path and require objj-mode. - (add-to-list 'load-path "/path/to/objc-c-mode.el") - (add-to-list 'load-path "/path/to/objj-mode.el") + (add-to-list 'load-path "/path/to/cappuccino/Tools/Editors/Emacs/") (require 'objj-mode) Other diff --git a/Tools/Editors/Emacs/objj-mode.el b/Tools/Editors/Emacs/objj-mode.el index 6ffea6da0..6a80cbd7e 100644 --- a/Tools/Editors/Emacs/objj-mode.el +++ b/Tools/Editors/Emacs/objj-mode.el @@ -5,8 +5,7 @@ ;;; To install, save this somewhere and add the following to your .emacs file: ;;; -;;; (add-to-list 'load-path "/path/to/objc-c-mode.el") -;;; (add-to-list 'load-path "/path/to/objj-mode.el") +;;; (add-to-list 'load-path "/path/to/cappuccino/Tools/Editors/Emacs/") ;;; (require 'objj-mode) ;;; ;;; Features: From a01de54b652189152e9bcede4eb06d5f81a31b3e Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Sat, 9 Mar 2013 14:34:58 -0500 Subject: [PATCH 09/10] Fixed: optimize access to object property Accessing a property via dot notation is faster than indexing via a string. --- AppKit/CPKeyValueBinding.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 524f7e0dd..db0b238da 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -350,7 +350,7 @@ var CPBindingOperationAnd = 0, var placeholder = _placeholderForMarker[[aMarker UID]]; if (placeholder) - return placeholder['value']; + return placeholder.value; return nil; } @@ -362,7 +362,7 @@ var CPBindingOperationAnd = 0, var existingPlaceholder = _placeholderForMarker[[aMarker UID]]; // Don't overwrite an explicitly set placeholder with a default. - if (existingPlaceholder && !existingPlaceholder['isDefault']) + if (existingPlaceholder && !existingPlaceholder.isDefault) return; } From eb6cdfe97c4376b03be5782eabec38880870792e Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Sat, 9 Mar 2013 14:35:16 -0500 Subject: [PATCH 10/10] Typo: fixed spelling in comment --- Objective-J/Runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js index 5014fb2f8..7b1929384 100644 --- a/Objective-J/Runtime.js +++ b/Objective-J/Runtime.js @@ -400,7 +400,7 @@ GLOBAL(objj_allocateClassPair) = function(/*Class*/ superclass, /*String*/ aName // Give our current allocator all the instance variables of our super class' allocator. classObject.allocator.prototype = new superclass.allocator; - // "Inheret" parent properties. + // "Inherit" parent properties. classObject.ivar_dtable = classObject.ivar_store.prototype = new superclass.ivar_store; classObject.method_dtable = classObject.method_store.prototype = new superclass.method_store;