From 12d03a51288e8b9ab6fcfaed15c68fac087de880 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Wed, 22 Jul 2009 19:34:44 -0700 Subject: [PATCH 1/3] Fix for custom objects. Reviewed by me. --- AppKit/Cib/_CPCibCustomObject.j | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/AppKit/Cib/_CPCibCustomObject.j b/AppKit/Cib/_CPCibCustomObject.j index 631efbc3d..1422aa96d 100644 --- a/AppKit/Cib/_CPCibCustomObject.j +++ b/AppKit/Cib/_CPCibCustomObject.j @@ -47,10 +47,21 @@ var _CPCibCustomObjectClassName = @"_CPCibCustomObjectClassName"; { var theClass = CPClassFromString(_className); -#if DEBUG + // Hey this is us! + if (theClass === [self class]) + { + _className = @"CPObject"; + + return self; + } + if (!theClass) + { +#if DEBUG CPLog("Unknown class \"" + _className + "\" in cib file"); #endif + theClass = [CPObject class]; + } if (theClass === [CPApplication class]) return [CPApplication sharedApplication]; From 4824f22e3ce0880d526338751e6a1ec0c7402baa Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 24 Jul 2009 11:22:32 -0700 Subject: [PATCH 2/3] Fix for super not working for class methods. Closes #227. Reviewed by me. --- Objective-J/preprocess.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Objective-J/preprocess.js b/Objective-J/preprocess.js index 0032ed203..47218a9ca 100644 --- a/Objective-J/preprocess.js +++ b/Objective-J/preprocess.js @@ -170,6 +170,7 @@ var objj_preprocessor = function(aString, aSourceFile, aBundle, flags) { this._currentClass = ""; this._currentSuperClass = ""; + this._currentSuperMetaClass = ""; this._file = aSourceFile; this._fragments = []; @@ -177,6 +178,7 @@ var objj_preprocessor = function(aString, aSourceFile, aBundle, flags) this._tokens = new objj_lexer(aString); this._flags = flags; this._bundle = aBundle; + this._classMethod = false; this.preprocess(this._tokens, this._preprocessed); //alert(this._preprocessed + ""); @@ -262,8 +264,7 @@ objj_preprocessor.prototype.brackets = function(/*objj_lexer*/ tokens, /*objj_st if (tuples[0][0].atoms[0] == TOKEN_SUPER) { CONCAT(aStringBuffer, "objj_msgSendSuper("); - CONCAT(aStringBuffer, "{ receiver:self, super_class:" + this._currentSuperClass + " }"); - + CONCAT(aStringBuffer, "{ receiver:self, super_class:" + (this._classMethod ? this._currentSuperMetaClass : this._currentSuperClass ) + " }"); } else { @@ -350,7 +351,7 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe category = NO, class_name = tokens.skip_whitespace(), superclass_name = "Nil", - + instance_methods = new objj_stringBuffer(), class_methods = new objj_stringBuffer(); @@ -358,6 +359,7 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected class name, found \"" + class_name + "\".")); this._currentSuperClass = NULL; + this._currentSuperMetaClass = NULL; this._currentClass = class_name; // If we reach an open parenthesis, we are declaring a category. @@ -376,12 +378,18 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe CONCAT(buffer, "var meta_class = the_class.isa;"); var superclass_name = dictionary_getValue(SUPER_CLASSES, class_name); - + // FIXME: We should have a better solution for this case, although it's actually not much slower than the real case. if (!superclass_name) + { this._currentSuperClass = "objj_getClass(\"" + class_name + "\").super_class"; + this._currentSuperMetaClass = "objj_getMetaClass(\"" + class_name + "\").super_class"; + } else + { this._currentSuperClass = "objj_getClass(\"" + superclass_name + "\")"; + this._currentSuperMetaClass = "objj_getMeraClass(\"" + superclass_name + "\")"; + } } else { @@ -394,7 +402,9 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected class name, found \"" + token + "\".")); superclass_name = token; + this._currentSuperClass = "objj_getClass(\"" + superclass_name + "\")"; + this._currentSuperMetaClass = "objj_getMetaClass(\"" + superclass_name + "\")"; dictionary_setValue(SUPER_CLASSES, class_name, superclass_name); @@ -503,6 +513,8 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe { if (token == TOKEN_PLUS) { + this._classMethod = true; + if (IS_NOT_EMPTY(class_methods)) CONCAT(class_methods, ", "); @@ -511,6 +523,8 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe else if (token == TOKEN_MINUS) { + this._classMethod = false; + if (IS_NOT_EMPTY(instance_methods)) CONCAT(instance_methods, ", "); From 57ee7bcfce4a4a46116c3859671426c93e38503d Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 16 Jul 2009 01:53:04 +0800 Subject: [PATCH 3/3] Fixed bug reported by Paul Tomlin http://groups.google.com/group/objectivej/browse_thread/thread/e4bc41026a8f100f/6b14f3b74189df18 Signed-off-by: Francisco Ryan Tolmasky I --- AppKit/CPSearchField.j | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/AppKit/CPSearchField.j b/AppKit/CPSearchField.j index 8adc431aa..d4c575197 100644 --- a/AppKit/CPSearchField.j +++ b/AppKit/CPSearchField.j @@ -143,8 +143,7 @@ var CPSearchFieldSearchImage = nil, // Managing Buttons /*! Sets the button used to display the search-button image - @param button - @param The search button. + @param button The search button. */ - (void)setSearchButton:(CPButton)button { @@ -567,7 +566,7 @@ var CPSearchFieldSearchImage = nil, - (void)_showMenu:(id)sender { - if(_searchMenu == nil) + if(_searchMenu == nil || ![self isEnabled]) return; [super selectText:nil]; @@ -690,13 +689,15 @@ var CPSearchButtonKey = @"CPSearchButtonKey", self = [super initWithCoder:coder]; _searchButton = [coder decodeObjectForKey:CPSearchButtonKey]; - _searchButton = [coder decodeObjectForKey:CPCancelButtonKey]; + _cancelButton = [coder decodeObjectForKey:CPCancelButtonKey]; _recentsAutosaveName = [coder decodeObjectForKey:CPRecentsAutosaveNameKey]; _sendsWholeSearchString = [coder decodeBoolForKey:CPSendsWholeSearchStringKey]; _sendsSearchStringImmediately = [coder decodeBoolForKey:CPSendsSearchStringImmediatelyKey]; _maximumRecents = [coder decodeIntForKey:CPMaximumRecentsKey]; [self setSearchMenuTemplate:[coder decodeObjectForKey:CPSearchMenuTemplateKey]]; - + [self resetCancelButton]; + [self setDelegate:self]; + return self; }