From d8ed82a8a8902777ede68020a5e78589cf6fd625 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 19 Dec 2011 00:18:58 +0000 Subject: [PATCH] * Source/NSTableView.m (-_isCellEditableColumn:row:): Tweak criteria for determining cell editability:: - the delegate (if present) must say YES - and the cell itself must return YES for isEditable - and the table column must return YES for isEditable Previously you could edit cells that returned NO for isEditable if the column they were in was editable. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34320 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 ++++++++++ Source/NSTableView.m | 18 ++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25d8d68e4..7b70d0bc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-12-18 Eric Wasylishen + + * Source/NSTableView.m (-_isCellEditableColumn:row:): Tweak + criteria for determining cell editability:: + - the delegate (if present) must say YES + - and the cell itself must return YES for isEditable + - and the table column must return YES for isEditable + Previously you could edit cells that returned NO for + isEditable if the column they were in was editable. + 2011-12-18 Eric Wasylishen * Source/NSTableHeaderView.m (-initWithCoder:): Remove unneeded diff --git a/Source/NSTableView.m b/Source/NSTableView.m index fa5cc0e24..0221f10a6 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -6530,17 +6530,15 @@ For a more detailed explanation, -setSortDescriptors:. */ row: (int) rowIndex { - NSTableColumn *tableColumn; + NSTableColumn *tableColumn = [_tableColumns objectAtIndex: columnIndex]; + NSCell *cell = [tableColumn dataCellForRow: rowIndex]; + + BOOL cellIsEditable = [cell isEditable]; + BOOL columnIsEditable = [tableColumn isEditable]; + BOOL delegateAllowsEditing = [self _shouldEditTableColumn: tableColumn + row: rowIndex]; - tableColumn = [_tableColumns objectAtIndex: columnIndex]; - // If the column is editable, the cell always is - if ([tableColumn isEditable]) - { - // otherwise ask the delegate, if any. - return [self _shouldEditTableColumn: tableColumn row: rowIndex]; - } - - return NO; + return cellIsEditable && columnIsEditable && delegateAllowsEditing; } - (void) _willDisplayCell: (NSCell*)cell