Previously, when reloading the CPOutlineView and changing an item to another parentItem, the CPOutlineView deleted the reference of the item.
Now, when removing old data to avoid memory leaks, the CPOutlineView checks if the pending item to delete doesn't have another parent item.
Previously, when reloading a CPOutlineView with different datas than before, the CPOutlineView kept a reference of the previous datas.
Now, when reloading, the CPOutlineView will delete these references when we don't need it anymore. For that, the CPOutlineView will only try to delete the previous reference when we have reloaded the children of a node, otherwise it will keep the other references.
This PR fix some issue with the following methods :
- (BOOL)isExpandable:(id)anItem;
- (BOOL)isItemExpanded:(id)anItem;
- (CPInteger)rowForItem:(id)anItem;
- (CPInteger)levelForItem:(id)anItem;
- (id)itemAtRow:(CPInteger)aRow;
- (CPInteger)levelForItem:(id)anItem;
- (CPInteger)levelForRow:(CPInteger)aRow;
Previously these methods took care about not displayed items. Now they just work with displayed items.
Added unit-tests in Test/AppKit/CPOutlineViewTest.j
Test app in Test/Manual/CPOutlineViewTestCib
Previously shouldSelectTableColumn wasn't called in CPTableView and CPOutlineView.
This PR resolves this issue, shouldSelectTableColumn is now called between selectionShouldChangeInTableView and tableViewSelectionIsChanging as in COCOA.
Test app Tests/Manual/TableTest/DelegateSelectionTest/
Previously the delegate method shouldSelectItem didn't work in CPOutlineView.
It didn't work because the checking method _delegateRespondsToSelectionIndexesForProposedSelection and _delegateRespondsToShouldSelectRow didn't check if the real delegate of the outlineView implemented the methods
Previously, when a row with a disclosure control (triangle) was selected, the row was selected
but the control remained in the unselected themestate. Disclosure control themestate was only being
changed when the control itself was clicked on. This fix changes the controls themestate whenever
the row selection changes.
-tableView:dataViewForTableColumn:row: and -outlineView:dataViewForTableColumn:item: are deprecated in favor of ...viewForTableColumn:...
Using the previous delegate API and not caching the view with an identifier was degrading performance. With this change, developers are encouraged to use the new caching system and the CPTableView method -makeViewWithIdentifier:owner: to get the view.
Also fixed a condition where a view-based outline view was not always asking for the view from its delegate. In some circumstances, an outline view could be considered as view-based instead of cell-based.
Test for deprecated delegate methods in CPOutlineViewViewBasedCib and TableTest/ViewBased examples.
Fixes#1823
Previously, Cappuccino was using preprocessor macros internally for the CGPoint/Size/Rect/Inset/Affine functions, as well as for CPRange. These macros had the same name as the corresponding function, but began with _. The functions were actually defined using the macros.
The motivation behind using macros was to increase performance by reducing function calls. However, there were a number of problems with this approach:
- There was an artificial dichotomy between _CG macros and the corresponding CG functions. We never completely replaced CG function calls with _CG macros. In fact, they were often mixed up in the same file. There was an extra burden on the programmer to remember to use the macro instead of the function.
- If a method call was passed as an argument to a macro, performance could actually be significantly *worse* than a function call. For example, _CGGetRectMakeCopy([view frame]) would expand to `{ origin:{ x:[view frame].origin.x, y:[view frame].origin.y }, size:{ width:[view frame].size.width, height:[view frame].size.height } }`. So instead of a single objj_msgSend and a single simple function call, we ended up with 4 objj_msgSend calls, which are way more expensive than simple function calls.
- Because of this expansion problem, to use macros efficiently required us to remember to use variables for all macro parameters. This didn't happen, and shouldn't have to happen.
- Finally, with modern Javascript engines, function call overhead is so small that it really isn't worth using the macros.
This commit eliminates the _CGGeometry, CGAffineTransformation and CPRange macros and replaces them with function calls.
BREAKING CHANGE:
The macros are no longer available. They could only be used with compiled code, but if there is any user code that used them, they will have to be replaced with the corresponding functions.
- NEW: Retrieve the underlying Image element from a CPImage with -image.
- NEW: You can now render any arbitrary drawing to a pattern context and use that as a fill or stroke pattern. See CGContextCreatePatternContext, CGContextSetFillPattern and CGContextSetStrokePattern. Works in all canvas-enabled browsers, including IE 9+.
- NEW: An example of using a custom rendered pattern is in Tests/Manual/PatternFillTest.
- NEW: Test if a CPImage is a single image (vs. three/nine part) with -isSingleImage.
- FIXED: With canvas, we have to track ourselves whether the context has a path or not.
- FIXED: All shapes except rects may not be added to a path with no context. If you attempt to do so, an error is logged.
- FIXED: CGPath was not setting the start and current point correctly in some cases.
- FIXED: CGContextAddPath was not moving to the path's start point at the beginning.
- FIXED: Removed superfluous CGContextClosePath commands, fixed some drawing sequences.
- FIXED: Misc. formatting.
Sorry, these changes are canvas only (including IE 9+)! I am not going to spend the time to port these fixes to VML (IE 8).
A CPOutlineView without a delegate `outlineView:menuForTableColumn:item` method, would not display its context menu as specified by `setMenu:` or in IB.
Added : -makeViewWithIdentifier:owner:
-rowForView: columnForView: less performant tahn cocoa because we cycle through all visible rows. But these methods are generally used once when editing manually.
Added identifier property to CPView.
retro and forward (in IB) compatible with the existing API. You can use IB table view based without the new API. Existing table views / Nib won't break.
CPTableView view based example. Featuring: IB made data views, different views in the same column, subviews binding in IB
When the view is found automatically in the cib, instantiate with _delegate as the owner (cocoa behavior).