diff options
author | rowanbeentje <rowan@beent.je> | 2009-02-23 01:21:43 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-02-23 01:21:43 +0000 |
commit | 40e5f768c40608f6d661d32e6dec9fefe64608e2 (patch) | |
tree | c95301a9b724d38f83bd4f34a8c0df7edf7a4a5d /Source/TableSource.m | |
parent | bb8dfb0ad769b551ad2fd6944315c5292246ad7e (diff) | |
download | sequelpro-40e5f768c40608f6d661d32e6dec9fefe64608e2.tar.gz sequelpro-40e5f768c40608f6d661d32e6dec9fefe64608e2.tar.bz2 sequelpro-40e5f768c40608f6d661d32e6dec9fefe64608e2.zip |
A patch to improve View support, addressing Issue #130. This patch undoes the damage caused by r333, making views viewable again, and extends support by preventing errors in the info pane, by drawing views with a different icon to easily differentiate them, by making all source/index information non-editable to match GUI to behaviour, and to tweak the interface slightly to match.
Diffstat (limited to 'Source/TableSource.m')
-rw-r--r-- | Source/TableSource.m | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/Source/TableSource.m b/Source/TableSource.m index d9c7a595..33d3777b 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -165,7 +165,7 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab } // Determine the table type - if ( ![tableType isKindOfClass:[NSNull class]] ) { + if ( ![tableType isKindOfClass:[NSNull class]] && [tablesListInstance tableType] != SP_TABLETYPE_VIEW) { [tableTypeButton selectItemWithTitle:tableType]; [tableTypeButton setEnabled:YES]; } else { @@ -173,12 +173,13 @@ loads aTable, put it in an array, update the tableViewColumns and reload the tab [tableTypeButton setEnabled:NO]; } - //enable buttons - [addFieldButton setEnabled:YES]; - [copyFieldButton setEnabled:YES]; - [removeFieldButton setEnabled:YES]; - [addIndexButton setEnabled:YES]; - [removeIndexButton setEnabled:YES]; + // If a view is selected, disable the buttons; otherwise enable. + BOOL editingEnabled = ([tablesListInstance tableType] == SP_TABLETYPE_TABLE); + [addFieldButton setEnabled:editingEnabled]; + [copyFieldButton setEnabled:editingEnabled]; + [removeFieldButton setEnabled:editingEnabled]; + [addIndexButton setEnabled:editingEnabled]; + [removeIndexButton setEnabled:editingEnabled]; //add columns to indexedColumnsField [indexedColumnsField removeAllItems]; @@ -1036,6 +1037,14 @@ traps enter and esc and make/cancel editing without entering next row } +/* + * Modify cell display by disabling table cells when a view is selected, meaning structure/index + * is uneditable. + */ +- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { + [aCell setEnabled:([tablesListInstance tableType] == SP_TABLETYPE_TABLE)]; +} + #pragma mark SplitView delegate methods - (BOOL)splitView:(NSSplitView *)sender canCollapseSubview:(NSView *)subview |