Commit Graph
595 Commits
Author SHA1 Message Date
cacaodev 1a414ac69c view-based table: always use the proto UID as view identifier
-setDataView: was not working because the caching system was picking
views cached with the column identifier which is persistent.

Test: CPTableViewTest -testLayout
2014-09-23 13:56:52 +02:00
cacaodev f82099143f CPTableView: -_reloadDataViewsImmediately -> -reloadData
CPTableColumn: binder:-setValueFor:  is a simple data reload.
2014-09-23 12:17:52 +02:00
Alexandre Wilhelm 903cc8ee83 Fixed: CPThemeStateSelectedDataView still set when removing a view
Previously, when removing a view from a CPTableView, the themeState CPThemeStateSelectedDataView wasn't unset. Now it does.
2014-09-19 09:59:56 -07:00
cacaodev 2dccd2f30b NEW: ojtest for method - (void)getColumn:(Function)columnRef row:(Function)rowRef forView:(CPView)aView
This internal method is used for editing and public methods rowForView: and columnForView
2014-09-18 19:23:16 +02:00
cacaodev 3e8afaeae4 Fixed: -removeTableColumn: now works without error. OJTest in AppKit/CPTableColumnTest.j, manual test in TableTest/TestTanleColumn/
Fixed: Added an out of bounds check to _unloadDataViews:...
Revert: revert -reloadData to the previous behavior where views & data were reloaded, not only data. That's what cocoa does for view based tables.
2014-09-11 23:14:21 +02:00
Alexandre Wilhelm 1fcf13d149 Fixed: added optimization for releasing observers 2014-08-20 16:13:59 -07:00
Alexandre Wilhelm abdf1156d4 Fixed: memory leaks with CPNotifications
Previously, when removing a view, Cappuccino didn't clean the notification center. The notification center kept in reference old views.

This PR fix this issue. When a CPView is added to a view, the methods _removeObservers and _addObservers are called. In these both methods we remove and add the observer to the notification center if needed. _removeObservers and _addObservers are called for the view and its subviews. These both methods are called through the method viewWillMoveToSuperview.

When a CPView is removed, we only call the method _removeObservers.
When a CPWindow is closed, we call the method _removeObservers on its contentView.
When a CPWindow is about to be opened, we call the method _removeObservers and _addObservers on its contentView.

Refs #1880
Refs #2024

Test app in Tests/Manual/AttachedSheet2/SheetWindowController.j
2014-08-19 17:45:01 -07:00
cacaodev 78c5522966 Merge remote-tracking branch 'upstream/master' into CPTableView-enumerateRows
Conflicts:
	AppKit/CPTableView.j
2014-06-11 19:42:33 +02:00
Alexander Ljungberg 2a78da6d07 Formatting and comment on table view first responder change.
Refs #2133.
2014-06-10 11:03:08 +02:00
Alexandre Wilhelm c64e5a5799 Fixed: font cell of a CPTableView comes black when editing another cell
Previously, when editing a cell, the other cells of the tableView lost the themeState of the firstResponder.
Now the other cells, as the tableView, keep this state when a cell is editing.

Fixed #2133
2014-06-04 11:19:32 -07:00
cacaodev da82887cc0 Merge remote-tracking branch 'upstream/master' into CPTableView-enumerateRows 2014-05-12 18:41:41 +02:00
Alexander Ljungberg a4702d48b4 Fixed: illegible white on grey text in table view.
If a table view row is selected its text will turn white to offset against the blue selection colour. However, when the table is not the first responder, or the window is in is not the key window, the light grey highlight colour is used instead, but the text remains white.

This fix ensures the text becomes black in this case by utilising the new first responder and key window theme states.

Fixes #2009, fixes #2001.
2014-05-12 15:21:08 +01:00
Aparajita Fishman 5923f7d859 Fixed: oops, it should have been single backslashes. 2014-05-08 17:40:51 -04:00
Aparajita Fishman 57f6a5ca8c Tweak: use continuation lines so the tmLanguage symbol parser works correctly. 2014-05-08 17:08:27 -04:00
cacaodev 45a59f9aec Code style
Rename _numberOfRowsDidChange -> _dataViewsNeedReloadAfterContentChange.
Subclasses use this method to tell if a full view reloading is needed
when calling -reloadData.
Currently CPOutlineView returns YES - this is the previous behavior.

Added private - (void)_reloadDataForRowIndexes:(CPIndexSet)rowIndexes
columnIndexes:(CPIndexSet)columnIndexes
This is the internal method for reloading objectValues only.
2014-04-19 09:10:51 +02:00
cacaodev 3a97db804f Merge remote-tracking branch 'upstream/master' into CPTableView-enumerateRows
Possible regression from #fe260a8
Regression: -reloadData does not reload views any more even if the table is empty (see CPOutlineViewCibTest).
BUG: -removeTableColumn: error.

Conflicts:
	AppKit/CPOutlineView.j
	AppKit/CPTableHeaderView.j
	AppKit/CPTableView.j
2014-04-18 18:12:55 +02:00
Antoine Mercadal 8bdaeab998 FIXED: Selection behavior when implementing selectionIndexesForProposedSelection
Previously, when delegates implemented tableView:selectionIndexesForProposedSelection:, the selection with arrow were broken. This patch ensure to try to select next/previous row if the current row cannot be selected.
It also cleans up the selection indexes when sending selectAll: as Cocoa does.
2014-04-03 14:10:00 -07:00
Alexandre Wilhelm c1fb54ecad New: Added delegate tableView:willRemoveView:forTableColumn:row
Added delegate tableView:willRemoveView:forTableColumn:row in CPTableView
2014-04-02 13:55:39 -07:00
Saikat Chakrabarti 2fd8940c02 Allow array arguments to various methods that take ThemeStates 2014-03-01 23:11:24 -08:00
Antoine Mercadal 1814f6b545 FIXED: Crash when clicking on an empty CPTableView with variable row height.
Previously, clicking anywhere in an empty CPTableView with variable row height was causing a crash due to the code trying to find the latest cached row height. This patch adds a check to ensure the last cached row height is not nil.
2014-01-23 12:56:39 -08:00
Alexandre Wilhelm 68310bb479 Fixed: objectValueForTableColumn and numberOfRowsInTableView are required methods 2013-12-10 11:01:49 -08:00
Alexandre Wilhelm b9c0c89a24 Fixed: CPTableViewDelegate and CPTableViewDataSource protocol do not implement CPObject protocol 2013-12-09 01:20:11 -08:00
Alexandre Wilhelm 7b86465d7b New : Added protocols CPTableViewDelegate and CPTableViewDataSource
This PR adds protocols CPTableViewDelegate and CPTableViewDataSource

Unit test in Tests/AppKit/CPTableViewTest.j
2013-12-08 17:48:41 -08:00
Martin Carlberg e511638962 Fixed: Cleaned up return and parameter types on methods. 2013-11-24 22:21:56 +01:00
Antoine Mercadal 616f0c61ef Fixed: Typo introduced in previous PR merge 2013-11-18 16:26:50 -08:00
Antoine Mercadal 6c8a21c1cc Merge pull request #1971 from mrcarlberg/table_view_grid_line_thickness
New: Added themable attribute for grid line thickness in table view
2013-11-18 16:06:01 -08:00
Antoine Mercadal 4a82dbc34d FIXED: Previous commit was actually missing to fill the drop view with the background color.
This patch restore the correct behavior and display corectly colors set as dropview-*-on-background-color
2013-11-15 17:59:41 -08:00
Antoine Mercadal 1cec1b0637 NEW: CPTableView drop view now supports theming
Previously, the style of the blueish view that shows up on CPTableView when user is about to drop something on it was hard coded.
This patch adds the following theme attributes in CPTableView

    // theme of the drop view for CPDragOperationOn on a non selected row
    dropview-on-background-color
    dropview-on-border-color
    dropview-on-border-width
    dropview-on-border-radius

    // theme of the drop view for CPDragOperationOn on a selected row
    dropview-on-selected-background-color
    dropview-on-selected-border-color
    dropview-on-selected-border-width
    dropview-on-selected-border-radius

    // theme of the drop view for CPDragOperationAbove on a non selected row
    dropview-above-border-color
    dropview-above-border-width

    // theme of the drop view for CPDragOperationAbove on a selected row
    dropview-above-selected-border-color
    dropview-above-selected-border-width

Aristo and Aristo2 have been updated, and use the same old hardcoded values.
2013-11-15 17:48:57 -08:00
Alexandre Wilhelm c22f489ee9 Fixed: shouldSelectTableColumn isn't called in CPTableView and CPOutlineView
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/
2013-10-24 22:13:35 -07:00
Alexandre Wilhelm ab1c689e4e Optimization with menu. Fixed issue with unsigned bit and delegate Fixed #1994 2013-10-18 12:01:33 -07:00
Alexandre Wilhelm 7bdedca350 Delegate WillDisplayView is called before setNeedsDisplay now 2013-10-18 11:55:40 -07:00
Alexandre Wilhelm e1eac245a7 Changed naming of the private delegate call. Fixed small bugs 2013-10-18 11:47:46 -07:00
Alexandre Wilhelm d6e40332c4 Removed comments 2013-10-17 14:32:34 -07:00
Alexandre Wilhelm 4b8a6ee674 Fixed: shouldSelectRow was called with selectionIndexesForProposedSelection
Previously the method shouldSelectRow was called even it's the method selectionIndexesForProposedSelection was implemented by the delegate. Now it works as in Cocoa.
The method selectionIndexesForProposedSelection is called when it has to be called, like in Cocoa.
This PR adds new methods to check and call the delegate/datasource methods more easily

Test app in Tests/Manual/TableTest/DelegateSelectionTest/
2013-10-17 14:26:19 -07:00
Antoine Mercadal 406a049380 Fixed: Previous commit was preventing to select in the void if selectionShouldChangeInTableView: was not implemented
This patch restore the correct behavior
2013-10-16 16:48:50 -07:00
Alexandre Wilhelm f0a9696634 Fixed typo 2013-10-16 15:03:35 -07:00
Alexandre Wilhelm 016c267e69 Fixed: Delegate method of CPTableView aren't call in the good order
Previously the call of the delegate method of a CPTableView weren't call in the good order, specially the selecting method.
Now it works as in Cocoa.
Fixed typos

Test app in Tests/Manual/TableTest/DelegateSelectionTest
2013-10-16 15:01:28 -07:00
Martin Carlberg 5a7c2e5617 New: Added themable attribute for grid line thickness in table view 2013-08-06 11:53:13 +02:00
Aparajita Fishman f3f1f72ae2 Fixed: variable move in previous commit broke selection notifications. 2013-07-26 12:17:52 -04:00
Aparajita Fishman 5b62773a39 Fixed: off-by-one in row calculation caused drawing problems with variable-height rows in CPTableView.
Previously, if the last row's height was increased, empty rows below would not be pushed down. This was due to an off-by-one in -_unboundedRowsInRect (now _exposedRowsInRect) which caused the incorrect rect of the last row to be retrieved.

This commit fixes that bug and also makes the following changes:

- Added FULL_ROW_HEIGHT(), ROW_BOTTOM() and HAS_VARIABLE_ROW_HEIGHTS() macros to make the code clearer.
- Documentation cleanup.
- Eliminated some intermediate variables.
- Rewrote -_rectOfRow to reduce redundant code and fixed some logic errors.
- Renamed some variables to make their intention clearer (to me at least).
- Added an out of bounds check in -rowAtPoint: before doing the relatively expensive binary search.
- In -noteHeightOfRowsWithIndexesChanged:, the first valid index is used instead of the first index (which might be invalid).
- Fixed a bug in -noteHeightOfRowsWithIndexesChanged: where row height was not set correctly if a row was not in the index set.
- Fixed incorrect use of CEIL in -_unboundedRowsInRect, it was wrapped around the divisor instead of the entire expression.
- Fixed drawBackgroundInClipRect: drawing one too many rows.
- Fixed -rowAtPoint not checking for x in bounds.

BREAKING CHANGE:
Previously, CPTableView -rowAtPoint would incorrectly return a valid row index when the x value was outside of the table's bounds. Now an out of bounds x value will return -1, which is consistent with Cocoa (and the intent of the method).
2013-07-25 10:48:11 -04:00
Aparajita Fishman 771370e64b Docs: typos 2013-07-21 22:30:20 -04:00
Alexander Ljungberg b0b0452647 Merge pull request #1943 from Dogild/EmptyTableView
Fixed: selection in a tableView without column
2013-06-12 13:07:40 +01:00
Alexander Ljungberg 36c2672064 Merge pull request #1939 from Dogild/RemovedColumn
Fixed: removeTableColumn does not removes column from tableColumns array
2013-06-12 13:01:47 +01:00
Alexandre Wilhelm 8bf2118b6e Fixed: selection in a tableView without column
Previously it was possible to select rows in a CPTableView even if there wasn't columns. It was also possible to make a drag/drop.
This PR fixes theses both problems.
2013-06-03 15:36:59 -07:00
Alexandre Wilhelm 566521f854 capp_lint 2013-06-03 11:32:05 -07:00
Alexandre Wilhelm c7c3bdd543 Fixed: CPTableView Drag and drop in void causes a crash
Previously the drag and drop and multiple selection from a void cells caused an exception.
With this fix, you can start a drag/drop and a multiple selection from a empty row.

Fixes #1857
2013-06-03 11:27:10 -07:00
Alexandre Wilhelm 827b9c4c57 Fixed small bugs with _reloadAllRows 2013-05-31 16:21:56 -07:00
Alexandre Wilhelm 3b48aafe66 Fixed: removeTableColumn does not removes column from tableColumns array
Previously the tableView didn't correctly remove a given tableColumn. It was removed in the method load (who is called by the layoutSubviews).
Now the tableColumns is removed before the layoutSubviews (as in cocoa).
It fixed also another problem, before this fixe it wasn't possible to remove all of the columns of a tableView (the last column was always displayed). This is fixed also

Fixes #1913

You can test that with the app of t00f
2013-05-31 16:11:11 -07:00
Aparajita Fishman 391ff7279d Fixed: capp_lint errors. 2013-05-16 15:02:45 -04:00
Alexander Ljungberg 626e1e770e Fixed: in the last few revisions, table rows could be selected despite delegate shouldSelectRow: returning NO.
This error was caused by 3612565e3a dropping the return statement.

Refs #1905.
2013-05-09 14:05:53 -07:00