change click and double-click behavior related to editing of cells to match Cocoa

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38739 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Doug Simons 2015-07-02 16:11:58 +00:00
parent 2ec1378144
commit 05b324b8fd
2 changed files with 26 additions and 1 deletions

View file

@ -1,4 +1,12 @@
2015-07-01 Doug Simons <doug.simons@testplant.com>
2015-07-02 Doug Simons <doug.simons@testplant.com>
* Source/NSTableView.m: Changed click and double-click behavior
to match Cocoa: A single-click on an already-selected editable
cell will now begin editing. A double-click will send the
doubleAction if there is one, and only begin editing if there is
no doubleAction assigned.
2015-07-01 Doug Simons <doug.simons@testplant.com>
* Source/NSTextStorage.m: Fixed a bug with setting _editedRange for
multiple edits when the first one is a delete (which results in

View file

@ -3717,6 +3717,16 @@ static inline float computePeriod(NSPoint mouseLocationWin,
// Check for grouped row...
if ([self _isGroupRow: _clickedRow])
theColumn = -1;
// Check for single click on already-selected editable cell to begin editing
if (clickCount == 1 && [self isRowSelected: _clickedRow] && [self _isCellEditableColumn: _clickedColumn row: _clickedRow ])
{
[self editColumn: _clickedColumn
row: _clickedRow
withEvent: theEvent
select: YES];
return;
}
// Application specific hit test processing is handled within the delegate's should select callbacks
// if they're implemented...however - I'm not sure when this SHOULD be invoked...
@ -3734,6 +3744,13 @@ static inline float computePeriod(NSPoint mouseLocationWin,
return;
}
// If we have a doubleAction, send that on a double-click, even for editable cells
if (clickCount == 2 && _doubleAction != (SEL)0 && _clickedRow != -1)
{
[self sendAction: _doubleAction to: _target];
return;
}
if (![self _isCellEditableColumn: _clickedColumn row: _clickedRow ])
{
// Send double-action but don't edit