diff --git a/AppKit/CPTextField.j b/AppKit/CPTextField.j index 6672a4596..b4dc02792 100644 --- a/AppKit/CPTextField.j +++ b/AppKit/CPTextField.j @@ -656,7 +656,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder"); #endif //post CPControlTextDidEndEditingNotification - [self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidBeginEditingNotification object:self userInfo:nil]]; + [self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]]; return YES; } diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index bb90723e4..00dd41a04 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -1849,7 +1849,10 @@ CPTexturedBackgroundWindowMask _autorecalculatesKeyViewLoop = shouldRecalculate; - [self _dirtyKeyViewLoop]; + if (_keyViewLoopIsDirty) + [self recalculateKeyViewLoop]; + else if (_autorecalculatesKeyViewLoop) + [self _dirtyKeyViewLoop]; } - (BOOL)autorecalculatesKeyViewLoop diff --git a/Objective-J/preprocess.js b/Objective-J/preprocess.js index ad96215f9..44478a14e 100644 --- a/Objective-J/preprocess.js +++ b/Objective-J/preprocess.js @@ -169,6 +169,7 @@ objj_stringBuffer.prototype.isEmpty = function() var objj_preprocessor = function(aString, aSourceFile, aBundle, flags) { + this._currentSelector = ""; this._currentClass = ""; this._currentSuperClass = ""; this._currentSuperMetaClass = ""; @@ -209,19 +210,19 @@ objj_preprocessor.prototype.accessors = function(tokens) value = true; if (!IS_WORD(name)) - objj_exception_throw(new objj_exception(OBJJParseException, "*** @property attribute name not valid.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property attribute name not valid."))); if ((token = tokens.skip_whitespace()) == TOKEN_EQUAL) { value = tokens.skip_whitespace(); if (!IS_WORD(value)) - objj_exception_throw(new objj_exception(OBJJParseException, "*** @property attribute value not valid.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property attribute value not valid."))); if (name == "setter") { if ((token = tokens.next()) != TOKEN_COLON) - objj_exception_throw(new objj_exception(OBJJParseException, "*** @property setter attribute requires argument with \":\" at end of selector name.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** @property setter attribute requires argument with \":\" at end of selector name."))); value += ":"; } @@ -235,7 +236,7 @@ objj_preprocessor.prototype.accessors = function(tokens) break; if (token != TOKEN_COMMA) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected ',' or ')' in @property attribute list.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ',' or ')' in @property attribute list."))); } return attributes; @@ -357,22 +358,23 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe class_methods = new objj_stringBuffer(); if (!(/^\w/).test(class_name)) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected class name, found \"" + class_name + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected class name, found \"" + class_name + "\"."))); this._currentSuperClass = NULL; this._currentSuperMetaClass = NULL; this._currentClass = class_name; - + this._currentSelector = ""; + // If we reach an open parenthesis, we are declaring a category. if((token = tokens.skip_whitespace()) == TOKEN_OPEN_PARENTHESIS) { token = tokens.skip_whitespace(); if (token == TOKEN_CLOSE_PARENTHESIS) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Can't Have Empty Category Name for class \"" + class_name + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Can't Have Empty Category Name for class \"" + class_name + "\"."))); if (tokens.skip_whitespace() != TOKEN_CLOSE_PARENTHESIS) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Improper Category Definition for class \"" + class_name + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Improper Category Definition for class \"" + class_name + "\"."))); CONCAT(buffer, "{\nvar the_class = objj_getClass(\"" + class_name + "\")\n"); CONCAT(buffer, "if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, \"*** Could not find definition for class \\\"" + class_name + "\\\"\"));\n"); @@ -400,7 +402,7 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe token = tokens.skip_whitespace(); if (!TOKEN_IDENTIFIER.test(token)) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected class name, found \"" + token + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected class name, found \"" + token + "\"."))); superclass_name = token; @@ -453,13 +455,13 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe // If we have objects in our declaration, the user forgot a ';'. if (declaration.length) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected ';' in ivar declaration, found '}'.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ';' in ivar declaration, found '}'."))); if (ivar_count) CONCAT(buffer, "]);\n"); if (!token) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected '}'")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected '}'"))); for (ivar_name in accessors) { @@ -540,7 +542,7 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe break; else - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected \"@end\", found \"@" + token + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected \"@end\", found \"@" + token + "\"."))); } } @@ -559,6 +561,8 @@ objj_preprocessor.prototype.implementation = function(tokens, /*objj_stringBuffe } CONCAT(buffer, '}'); + + this._currentClass = ""; } objj_preprocessor.prototype._import = function(tokens) @@ -576,14 +580,14 @@ objj_preprocessor.prototype._import = function(tokens) path += token; if(!token) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Unterminated import statement.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unterminated import statement."))); } else if (token.charAt(0) == TOKEN_DOUBLE_QUOTE) path = token.substr(1, token.length - 2); else - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expecting '<' or '\"', found \"" + token + "\".")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expecting '<' or '\"', found \"" + token + "\"."))); this._fragments.push(fragment_create_file(path, NULL, isLocal, this._file)); } @@ -640,7 +644,7 @@ objj_preprocessor.prototype.method = function(tokens) { // At this point, "..." MUST follow. if ((token = tokens.skip_whitespace()) != TOKEN_PERIOD || tokens.next() != TOKEN_PERIOD || tokens.next() != TOKEN_PERIOD) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Argument list expected after ','.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Argument list expected after ','."))); // FIXME: Shouldn't allow any more after this. } @@ -656,7 +660,9 @@ objj_preprocessor.prototype.method = function(tokens) CONCAT(buffer, "new objj_method(sel_getUid(\""); CONCAT(buffer, selector); CONCAT(buffer, "\"), function"); - + + this._currentSelector = selector; + if (this._flags & OBJJ_PREPROCESSOR_DEBUG_SYMBOLS) CONCAT(buffer, " $" + this._currentClass + "__" + selector.replace(/:/g, "_")); @@ -676,6 +682,8 @@ objj_preprocessor.prototype.method = function(tokens) CONCAT(buffer, ","+JSON.stringify(types)); CONCAT(buffer, ")"); + this._currentSelector = ""; + return buffer; } @@ -884,7 +892,7 @@ objj_preprocessor.prototype.preprocess = function(tokens, /*objj_stringBuffer*/ // If we get this far and we're parsing an objj_msgSend (or array), then we have a problem. if (tuple) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected ']' - Unterminated message send or array.")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected ']' - Unterminated message send or array."))); if (!aStringBuffer) return buffer; @@ -898,13 +906,13 @@ objj_preprocessor.prototype.selector = function(tokens, aStringBuffer) // Swallow open parenthesis. if (tokens.skip_whitespace() != TOKEN_OPEN_PARENTHESIS) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Expected '('")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Expected '('"))); // Eat leading whitespace var selector = tokens.skip_whitespace(); if (selector == TOKEN_CLOSE_PARENTHESIS) - objj_exception_throw(new objj_exception(OBJJParseException, "*** Unexpected ')', can't have empty @selector()")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unexpected ')', can't have empty @selector()"))); CONCAT(aStringBuffer, selector); @@ -920,9 +928,9 @@ objj_preprocessor.prototype.selector = function(tokens, aStringBuffer) if (tokens.skip_whitespace() == TOKEN_CLOSE_PARENTHESIS) break; else - objj_exception_throw(new objj_exception(OBJJParseException, "*** Unexpected whitespace in @selector().")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Unexpected whitespace in @selector()."))); else - objj_exception_throw(new objj_exception(OBJJParseException, "*** Illegal character '" + token + "' in @selector().")); + objj_exception_throw(new objj_exception(OBJJParseException, this.error_message("*** Illegal character '" + token + "' in @selector()."))); } CONCAT(buffer, token); @@ -934,3 +942,10 @@ objj_preprocessor.prototype.selector = function(tokens, aStringBuffer) if (!aStringBuffer) return buffer; } + +objj_preprocessor.prototype.error_message = function(errorMessage) +{ + return errorMessage + " "; +}