Previously, nib2cib would not correctly calculate the app/resource directories if the xib was in a subdirectory of Resources. Also, image resources in subdirectories did not have the subdirectory encoded with the image name.
Now xibs and images may be anywhere under Resources.
Fixes#1960.
This change adds nib2cib support for `NSValue` when the value represents a NSPoint, NSSize, NSRect or an NSRange, which enables user defined runtime attributes of these types to be set in Xcode and then properly decoded in a Cappuccino app.
Previously, if an image or framework in image@framework was missing, it was just a warning, and conversion would continue.
Now an exception is raised and conversion stops.
Previously users saw the generic "-[CPKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFoo)" message, which was not particularly instructive.
Now the message is: "NSFoo objects are not supported by nib2cib."
Closes#1923
Previously, attempting to nib2cib a xib with autolayout would give an error message that there was no class to archive NSLayoutConstraint, which was meaningless to most people.
Now an error message that says exactly why it failed and how to fix it is given.
Previously error messages would always be colorized, which doesn't work well if you are piping the output.
Passing --no-colors turns off all colors in the output.
- Added support for CPDateFormatter in Foundation
- Added support for CPTimeZone in Foundation
- Added support fo CPDateFormatter in nib2cib
Test app in Tests/Manual/CPDateFormatter
UnitTest in Tests/Foundation/CPTimeZoneTest.j
UnitTest in Tests/Foundation/CPDateFormatterTest.j
* State *
Previously the Converter class needlessly copied a whole bunch of state from the Nib2Cib class, which was not only poor factoring, but made for easy omissions of state when instantiating a new Converter, such as was done in NSNib.j.
This commit pushes all state not specific to Converter up to Nib2Cib. This allowed removal of redundant code in NSNib -NS_initWithCoder.
* Resources *
Previously it was not possible to use custom images that were located in a framework, because only the app's Resources directory was searched.
This commit automatically searches all frameworks for Resources directories. When a custom image is specified in Xcode, first the app's Resources directory is searched, then all framework Resource directories. Alternately, the specific framework to use can be specified in Xcode by using the form framework@image.
At runtime, the framework is loaded by its identifier (as specified in Info.plist), and if there is no identifier, by searching next to the current AppKit framework.
All of this renders the nib2cib -R option completely obsolete, so it was removed from the NibApplication/Jakefile template.
Previously, the enabled/disabled control for NSTextField in Interface Builder was ignored by nib2cib.
This change allows the enabled/disabled state on CPTextField to be set in interface builder.
Previously, NSNib would create a Converter instance for converting table cell views. Unfortunately Converter did not expect to be instantiated more than once, and the singleton SharedConverter was unconditionally being set in the initializer. This might not have caused problems, except that NSNib did not copy all of the shared Converter's state to the copy, especially the resource path, which caused custom images in table cell views to fail.
This commit correctly ensures that the shared Converter instance is set only once, and also copies all of the shared Converter state to the instance that is used for converting the table cell view.
Long ago it was required to use the -R option with nib2cib if custom images were used. nib2cib now infers the resource path, so there will always be at least a default resource path. Thus the check for no resource path was unnecessary.
This commit removes that check.
Previously, the enabled state of a CPComboBox could not be set in Interface Builder.
This commit allows Interface Builder to set the enabled state of a CPComboBox.
A modified test in Manual/CPComboBoxTest is included. This test simply adds a new disabled combo box to an existing window, and then checks to see if it is disabled, printing a descriptive message to the Javascript console.
Previously more work was done than necessary to initialize custom table text cells.
Now the theme state is set before initializing table cells, which allows fonts and colors to be set correctly. The selected colors still have to be set explicitly.
BREAKING CHANGE:
Because this operates within nib2cib, all xibs should be re-converted.
Previously, if a cell-based table had a custom font or color in a table cell, when the cell was selected it would not change color. Also, edited cells did not maintain the original font/color.
This commit ensures that table cells uses the theme setting for selected text color, while maintaining all font and color attributes when selected or being edited.
BREAKING CHANGE:
Because this fix operates at the level of nib2cib, xibs that use customized cell-based table text cells should be reconverted.
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
This is a second attempt to fix the problems addressed by 69bbe627a9.
Because table cell classes needed to use the same initialization code as the NS_initWithCoder methods, it was necessary to refactor the initialization code into separate NS_initWithCell methods and call them separately from NS_initWithCoder.
Previously, table view cells (non-view-based) were not being decoded with all of the available cell attributes in IB, and many attributes were hard-coded. In addition, there was a bunch of initialization code that has been made redundant by theming.
With this commit, decoding of all control classes has been refactored so that table view cells can use the same code, thus ensuring they decode all available cell attributes. In addition, the redundant code has been eliminated.
It is now possible to apply most table cell attributes such as font, color, alignment, sendsActionOnEndEditing, and so on, directly in IB.
Closes#1803
BREAKING CHANGE:
Changes have been made to table cell decoding in nib2cib. All xibs should be re-converted with `find . -name '*.xib' -exec nib2cib {} \;`.
This is an improved fix to the corrupted tab view state bug partially addressed by 0f347be.
Without either fix, NSTabView is converted to a CPTabView where tab view item views are subviews of the NSTabView, while in Cappuccino the selected view item is supposed to be a subview of a CPBox.
Without this fix, CPTabView decoding called addSubview: in initWithCoder: which can cause the superview of a view to become set, only to later be overwritten when the superview ivar is decoded.
This fix removes the tab item view as a subview from the tab view before encoding it in nib2cib, and then makes sure not to call addSubview: while still in the initWithCoder stage, but rather later in awakeFromCib.
Without this fix, a regular custom NSBox such as a simple box with a 1px border would become several pixels smaller in Cappuccino.
This fix makes sure we only try to adjust the size for primary and secondary type NSBoxes.
- Get the scroller orientation from the xib.
- Fix the nonsensical calculation of _isVertical when given bounds.
- Since orientation comes from the xib, had to re-nib2cib everything to be safe.