Without this fix, `- CPNumberFormatter getObjectValue:forString:errorDescription:` would return `YES` for string @"", like if it was properly converted to an object value, but then actually leave object value unchanged.
With this fix object value is set to nil like in Cocoa.
Refs #1829.
Previously, minimum and maximum were not supported in CPNumberFormatter.
This commit adds support for these in IB and via code. Updated unit tests included.
Fixes#1829
Without this fix, CPDecimal will return NaN for numbers that have leading zeros, e.g., 0123.
This fix changes the matching regex to allow leading zeros to pass. This is then converted to a proper number later on, e.g., "0123" => 123. This is in line with Cocoa behaviour.
This commit also includes updated unit tests.
objj_backtrace_print is only available in debug frameworks. Previously we were not ensuring that objj_backtrace_print was available, which caused an error when running with release frameworks.
Now objj_backtrace_print is checked for availability.
Originally the initializer had coerced the parameter to a string, even though it is clearly documented that it should be a string. A later commit removed that coercion.
This commit reinstates the type coercion and thus saves the world from those who would pass non-string types in a parameter that says "withString".
Previously CPAttributedString did not provide an -init method,
with the result that an attributed string created with [[CPAttributedString alloc] init]
would not be correctly initialized.
Also, some methods that took indexes into the string were not checking for an invalid index and were not raising exceptions when the documentation said they should.
Finally, some methods that were supposed to return empty dictionaries were returning nil.
This commit fixes all of these problems. Empty strings should no longer cause errors.
Closes#533
In Cocoa, viewWillMoveToSuperview: and viewDidMoveToSuperview: are called when views are instantiated from code or from a nib.
Previously in Cappuccino, when a view was instantiated from a cib, the _subviews of the view were directly set from the decoded subview array. This short-circuited all of the normal notifications a view receives when added to a superview, including viewWillMoveToSuperview: and viewDidMoveToSuperview:. As a result, some views that override these methods, such as CPSearchField, were not set up correctly when instantiated from a cib.
With this commit, subviews instantiated from a cib are manually added to their superview, thus ensuring they go through the same cycle as views instantiated from code, and ensuring that viewWillMoveToSuperview: and viewDidMoveToSuperview: are called.
Closes#1699
Contrary to what the previous documentation said, removeObjectIdenticalTo: should remove all instances of the argument from the receiver, not just the first one.
- CPView and subclasses support multiple-value hidden bindings.
- CPControl and subclasses support multiple-value enabled bindings.
- CPWindow and CPBox support multiple-value title with pattern bindings.
- CPButton supports multiple argument + target bindings.
- CPImageView and CPTextField support multiple-value editable bindings.
- CPMenuItem supports multiple-value enabled bindings.
- Fixed bugs in CPObjectController with simple collection operators.
- CPColorWell uses black as the placeholder color.
- Runtime object attributes from a cib are applied as they are read, not deferred.
- NSNumberFormatter now reads the number style from the xib.
- Normalized some parameter names.
- Formatting.
- Test app for all binding types.
- Removed stray console.error
- Made border of tooltips darker, they were almost invisible, even over a white background
- Added CGAlignStroke and CGAlignCoordinate, they are of general use
mutableArrayValueForKey: … removeObjectsInArray should remove all instances of the found objects. Without this fix, only the first instance was removed.
This change makes CPDictionary descriptions exactly like Objective-C literals. Later when Objective-J adds support for such literals too, it'll be possible to just copy and paste a CPDictionary description into code.
Also updated CPArray to look similar for consistency.
Without this fix, KVCArray could try to remove an out of bounds index at CPNotFound from its target array.
This fix makes it so that only found objects are removed.
- Made CPDescriptionOfObject smarter about detecting CG objects
- CPObject, CPArray, CPDictionary do a better (as in perfect) job of indenting nested objects
- CPDictionary is displayed using Cocoa-style key = value; notation
The `cs == nil` to `cs === nil` change introduced by 64a0fb2 was incorrect. Since `CPCharacterSet` is used widely through Cappuccino this broke many unit tests and much functionality.
The fix is to again consider both `nil` and `undefined` as cause for initing a new character set.
Without this fix, CPNumberFormatter didn't format negative values well. E.g. with thousands separators on it could generate, "-,999.00".
This fix generally improves handling of negative numbers by CPNumberFormatter.