Commit Graph
464 Commits
Author SHA1 Message Date
cacaodev a9ec90713e The FR can be a window, don't check if it's inside a table. 2013-03-24 20:33:22 +01:00
cacaodev 8663b7b3fa Merge remote-tracking branch 'upstream/master' into CPTableView-viewForRow-infinite-loop 2013-03-24 18:50:41 +01:00
cacaodev 3ef5cfe846 Fixed: Infinite loop when a first responder has a nil superview
This bug appears only if a table view have been added to the window.

CPTableView observes first responder changes and moves up in the view
hierarchy to determine the edited data view. If for some reason, a
superview in the hierarchy was nil, we entered an infinite loop.

This commit adds guards to the recursive method that searches the data
view. Also added an early return when the fr changes to a view outside
the table.

Fixes #1875
2013-03-24 18:37:12 +01:00
Aparajita Fishman 5d2e4bf7cc Fixed: theme build failed
Previously CPTableView -_init was trying to reference a theme value, but that doesn't work because the theme creates a CPTableView and during that _init the theme value is not yet defined.

This commit uses lazy instantiation to avoid this problem.

Also, column selection was added to the CPDictionaryControllerTest to better visualize unfocused selection highlight colors.
2013-03-18 08:21:02 -04:00
Aparajita Fishman a4fb2deece Fixed: unfocused selection highlight colors were hard coded
Previously, the colors used for unfocused selection highlighting were hard coded. In Cocoa, they seem to be desaturations of the focused selection highlight colors.

This commit calculates the unfocused highlight colors from the focused colors.

It also removes some dangling commas.
2013-03-17 18:29:47 -04:00
Aparajita Fishman afc2c17b5a Fixed: highlighted table cells with CPTableViewSelectionHighlightStyleNone had white text.
Previously, CPTableView was unconditionally setting the selected theme state for selected data views. When the selection highlight style is CPTableViewSelectionHighlightStyleNone, there is no row selection highlighting done. Since the default theme specifies white text for selected data views, we ended up with white text on a non-highlighted background, which was invisible on non-alternate rows and almost invisible on alternate rows.

This commit unsets the selected theme state flag for any redrawn data views when the selection highlight style is CPTableViewSelectionHighlightStyleNone, thus the text color does change at all when selected.

Fixes #1847
2013-03-16 15:41:24 -04:00
Blair DuncanandAparajita Fishman efdf0a6b84 Fixed: When editing a table cell, the row lost focus.
Previously, when a table cell was edited, the table thought it had lost focus and displayed the cell's row highlight in an unfocused state.

This fix updates the _isFocused test to include tests for cell editing in both cell-based and view-based tables.
2013-03-16 09:33:53 -04:00
Aparajita Fishman b36f8d794c Fixed: unfocused selection highlight in table upside down.
Previously the gradient in an unfocused selection highlight in CPTableViewSelectionHighlightStyleSourceList style was darker at the top and brighter at the bottom, which is the opposite direction of the gradient when focused.

This commit makes all of the unfocused highlight colors a strict 5% desaturation of the focused colors.

Refs #1839
2013-03-15 19:57:20 -04:00
Blair DuncanandAparajita Fishman fd20a8045e Fixed: table view selection color did not change when losing focus.
CPTableView has no focus ring, and currently gives no visual feedback of its firstResponder status. In Cocoa when the table view resigns firstResponder or its window loses key status, the selection color turns gray.

This commit sets the selection color to gray when a table view resign firstResponder or its window loses key status. A second window and a couple of textfields were added to the CPDictionaryControllerTest to demonstrate the changes.

Fixes #1839
2013-03-15 19:56:47 -04:00
Aparajita Fishman 9482d14160 Fixed: table view highlight update loop had high overhead
Previously the selection highlight update loop created two selectors and called an extra method for every row being updated.

The selectors are now calculated beforehand, and the method call has been eliminated.
2013-03-15 16:37:15 -04:00
cacaodevandAparajita Fishman 33858cfc3b Fixed: incorrect table column highlighting and row selection after column sort.
Previously in CPTableView, after clicking a sortable column, data views of the sorted column ended up in a selected state and a row was selected instead of the sorted column. As a result, the text of the rows would turn white as if they were selected, but there was no highlight, so the text was basically invisible.

This commit fixes that by reversing the order of operations when clicking a column. First the sort is done, then the selection.

Fixes #1337, #1688, #1779.
2013-03-15 08:26:37 -04:00
cacaodevandAparajita Fishman 7225e7e038 New: deprecate -tableView:dataViewForTableColumn:row: and -outlineView:dataViewForTableColumn:item:
-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
2013-03-15 08:16:02 -04:00
Aparajita Fishman bf36c40f88 Fixed: optimized selector creation
Use @selector, that happens at compile time, instead of CPSelectorFromString, which happens at runtime.
2013-03-14 17:06:23 -04:00
cacaodev c8b812bbb5 FIXED: A data view edited in a table view was duplicated after a reload.
Previously in CPTableTView, a view being edited was not cached when unloaded, for example when made invisible after scrolling or when calling -reloadData.
This situation was causing a duplicated view to be added at the same place when the data view was loaded again.
After this commit, edited data views are cached and resign their first responder status just before they are added to the queue because they can be reused at another place.

Test: Added a "reload data" button in ViewBasedCib example.
2013-03-14 19:28:45 +01:00
Aparajita Fishman afd5925499 Fixed: _CG and _CP macros were confusing and could degrade performance
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.
2013-03-13 12:22:10 -04:00
Andrew Hankinson b274c63395 CPTableView formatting
Formatting, whitespace and typo correction.
2013-03-11 10:01:46 -04:00
cacaodev ac3a45aec5 CPTableView: force the mask to CPViewNotSizable for IB made CPTableCellView.
Added documentation for tableView:dataViewForTableColum:row: delegate method. Document other cases, when we expect the data view to have a CPViewNotSizable mask.
ViewBasedCib example: added variable row heights.
2013-03-04 20:03:20 +01:00
Blair Duncan 9730e066b8 fix for issue #1819 tableview infinate loop 2013-03-01 17:00:38 -05:00
cacaodev 7d03483210 Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	AppKit/CPView.j
2013-02-26 11:56:18 +01:00
Alexander Ljungberg 5b05dc92a1 More dictionary literals. 2013-02-25 18:27:44 +00:00
cacaodev fb3fe24567 Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	Tests/Manual/CPOutlineViewCibTest/Resources/MainMenu.cib
2013-02-23 20:55:54 +01:00
Aparajita Fishman a011596231 CGContext fixes/enhancements
- 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).
2013-02-23 13:53:20 -05:00
cacaodev 5355c4935c Merge remote-tracking branch 'upstream/master' into CPTableViewLion 2013-02-23 14:51:46 +01:00
Aparajita Fishman f54f2e7b13 selectNone: is not part of the NSTableView API, not sure why we need it since it is the same as deselectAll: 2013-02-23 08:26:36 -05:00
cacaodev 16bb194019 Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	Tests/Manual/TableTest/TableBindings/Resources/MainMenu.cib
	Tests/Manual/TableTest/TableBindings/Resources/MainMenu.xib
2013-02-23 10:55:08 +01:00
Aparajita Fishman 47ade360d5 Formatting 2013-02-22 12:40:43 -05:00
Blair Duncan 5c3d3bbc2e updated added a menu to tablebindings test and doxygen comments 2013-02-22 09:45:26 -05:00
Blair Duncan 92c2ed970c tableview add support for selectAll: deSelectAll: selectNone: #1594 2013-02-22 00:37:34 -05:00
Aparajita Fishman fb01ceb2a9 Formatting 2013-02-21 07:39:57 -05:00
Aparajita Fishman 109f59ab6c Merge branch 'autosaveTableColumnsFix' 2013-02-21 07:37:09 -05:00
cacaodev 3aadc958eb Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	Foundation/CPURLConnection.j
	Tests/Manual/CPOutlineViewCibTest/Resources/MainMenu.cib
	Tests/Manual/TableTest/TableBindings/Resources/MainMenu.cib
2013-02-20 17:15:24 +01:00
aparajita 84d8e1ceb7 Merge pull request #1478 from cacaodev/CPTableView-dragging-perf
CPTableView: make dragged views reusable when dragging ends
2013-02-19 07:33:29 -08:00
cacaodev 9a58efaa07 Merge remote-tracking branch 'upstream/master' into CPTableViewLion 2013-02-18 13:09:46 +01:00
cacaodev 3e942dbdbd Added CPCib import in CPTableView.j
Fix warning in NSNib.j
2013-02-18 12:59:47 +01:00
Randall Luecke 5427e9a402 Fixed column drag and drop in the tableview. 2013-02-18 04:00:40 -05:00
cacaodev 3fd39ea0c8 Code formatting, cleaned zombie outlets, added outlets to the CPTableCellView owner 2013-02-16 19:00:44 +01:00
cacaodev 108042c190 Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	AppKit/CPTableView.j
	Tests/Manual/TableTest/TableCibTest/AppController.j
2013-02-13 19:27:53 +01:00
Aparajita Fishman d8e4769972 Misc. tweaks
- 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
2013-02-03 08:39:30 +08:00
Aparajita Fishman 93fb849296 Import fixes 2013-01-24 19:18:39 +08:00
Aparajita Fishman 866e1f00f7 Objj2 compiler fixes
- Each file compiles individually with no errors or warnings.
- Added missing imports.
- Fixed imports to remove circularity.
- Removed unnecessary imports.
- Added missing headers.
- Added missing action_button.png.
- Replace CPMakeRect with CGRectMake.
2013-01-23 15:48:56 +07:00
Aparajita Fishman 4f377bcebe Objj2 compiler fixes
Compiled all files individually:

- Added missing imports.
- Added @class/@global declarations to break circular dependencies.
- Misc. code cleanup.

Conflicts:
	AppKit/CPWindow/_CPWindow.j
	AppKit/Platform/DOM/CPPlatformWindow+DOM.j
2013-01-23 15:48:55 +07:00
Antoine Mercadal f8c9466d04 Add other missing imports 2013-01-22 15:47:33 -08:00
Antoine Mercadal ef62191e6b Fix missing imports and @global and @class 2013-01-22 15:44:56 -08:00
Antoine Mercadal 94439f0d10 Add new found warnings fixes 2013-01-22 12:47:29 -08:00
Antoine Mercadal 2385f48fe4 Add missing imports 2013-01-22 12:27:19 -08:00
Alexander Ljungberg 3c684404ed Eliminate mystery CGPointPointer. 2013-01-20 16:44:40 +00:00
Aparajita Fishman 7c831fa19d capp_lint flags deprecated CPPoint/Rect/Size types/functions
- Changed to corresponding CG types/functions in all files
- Fixed some demo app bugs
2013-01-19 16:51:56 +07:00
cacaodev ce62e32dfa Removed isa in CPTableCellView (Objj2 compat). nib2cibed all examples (Aristo2 compat). 2013-01-18 17:28:36 +01:00
cacaodev 2cc3521989 Merge remote-tracking branch 'upstream/master' into CPTableViewLion
Conflicts:
	Tests/Manual/CPOutlineViewCibTest/Resources/MainMenu.cib
	Tests/Manual/TableTest/TableBindings/Resources/MainMenu.cib
2013-01-18 16:57:46 +01:00
Martin Carlberg 458fa9d02e Fixed a lot of small bugs found by new warning message from compiler 2013-01-18 14:24:37 +01:00