diff options
author | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-01-27 20:38:23 +0000 |
commit | 8db2f78294982e89fce5a162d92b2be6d9291aa1 (patch) | |
tree | b8dc7736f4af896aa3ed3fa9a96d1f3c4bfd0e59 /Source/SPTablesList.m | |
parent | fa7cff57548edc51420693e6909fe2adb3c18951 (diff) | |
parent | 7cc062247ff23496dd0390cf07b5d45d6bc49777 (diff) | |
download | sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.gz sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.tar.bz2 sequelpro-8db2f78294982e89fce5a162d92b2be6d9291aa1.zip |
Bring outline view branch up to date with trunk (r3056:r3162).
Diffstat (limited to 'Source/SPTablesList.m')
-rw-r--r-- | Source/SPTablesList.m | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index da787a6d..a0a9bf92 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -1477,34 +1477,51 @@ /** * Table view delegate method */ -- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex +- (void)tableView:(NSTableView *)aTableView willDisplayCell:(ImageAndTextCell*)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - if (rowIndex > 0 && rowIndex < [filteredTableTypes count] - && [[aTableColumn identifier] isEqualToString:@"tables"]) { - if(![[filteredTables objectAtIndex:rowIndex] isKindOfClass:[NSString class]]) { - [(ImageAndTextCell*)aCell setImage:nil]; - [(ImageAndTextCell*)aCell setIndentationLevel:0]; - } - else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeView) { - [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-view-small"]]; - } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeTable) { - [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"table-small"]]; - } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeProc) { - [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"proc-small"]]; - } else if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeFunc) { - [(ImageAndTextCell*)aCell setImage:[NSImage imageNamed:@"func-small"]]; + if (rowIndex > 0 && rowIndex < [filteredTableTypes count] && [[aTableColumn identifier] isEqualToString:@"tables"]) { + + id item = NSArrayObjectAtIndex(filteredTables, rowIndex); + + if(![item isKindOfClass:[NSString class]]) { + [aCell setImage:nil]; + [aCell setIndentationLevel:0]; + return; } - if ([[filteredTableTypes objectAtIndex:rowIndex] integerValue] == SPTableTypeNone) { - [(ImageAndTextCell*)aCell setImage:nil]; - [(ImageAndTextCell*)aCell setIndentationLevel:0]; - } else { - [(ImageAndTextCell*)aCell setIndentationLevel:1]; - [(ImageAndTextCell*)aCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]]; + switch([NSArrayObjectAtIndex(filteredTableTypes, rowIndex) integerValue]) { + case SPTableTypeView: + [aCell setImage:[NSImage imageNamed:@"table-view-small"]]; + [aCell setIndentationLevel:1]; + [aCell setFont:smallSystemFont]; + break; + case SPTableTypeTable: + [aCell setImage:[NSImage imageNamed:@"table-small"]]; + [aCell setIndentationLevel:1]; + [aCell setFont:smallSystemFont]; + break; + case SPTableTypeProc: + [aCell setImage:[NSImage imageNamed:@"proc-small"]]; + [aCell setIndentationLevel:1]; + [aCell setFont:smallSystemFont]; + break; + case SPTableTypeFunc: + [aCell setImage:[NSImage imageNamed:@"func-small"]]; + [aCell setIndentationLevel:1]; + [aCell setFont:smallSystemFont]; + break; + case SPTableTypeNone: + [aCell setImage:nil]; + [aCell setIndentationLevel:0]; + break; + default: + [aCell setIndentationLevel:1]; + [aCell setFont:smallSystemFont]; } + } else { - [(ImageAndTextCell*)aCell setImage:nil]; - [(ImageAndTextCell*)aCell setIndentationLevel:0]; + [aCell setImage:nil]; + [aCell setIndentationLevel:0]; } } @@ -1775,6 +1792,7 @@ selectedTableType = SPTableTypeNone; selectedTableName = nil; [tables addObject:NSLocalizedString(@"TABLES",@"header for table list")]; + smallSystemFont = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]; } return self; @@ -2007,7 +2025,7 @@ // If there is a type selected other than the default we must specify it in CREATE TABLE statement if ([tableTypeButton indexOfSelectedItem] > 0) { - engineStatement = [NSString stringWithFormat:@"ENGINE = %@", [tableType backtickQuotedString]]; + engineStatement = [NSString stringWithFormat:@"%@ = %@", [[tableDocumentInstance serverSupport] engineTypeQueryName], [tableType backtickQuotedString]]; } NSString *createStatement = [NSString stringWithFormat:@"CREATE TABLE %@ (%@) %@ %@", [tableName backtickQuotedString], ([tableType isEqualToString:@"CSV"]) ? @"id INT NOT NULL" : @"id INT", charSetStatement, engineStatement]; |