aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-02-11 10:45:58 +0000
committerBibiko <bibiko@eva.mpg.de>2011-02-11 10:45:58 +0000
commit224719bd0ed05f6ce757c08c3602808929f621cf (patch)
tree9bb5c5603f6c8c4f9504ad9e3b20023cf3e36bab
parente3ac547a6fb5b73581e61bb35ac2f3f7fca67a96 (diff)
downloadsequelpro-224719bd0ed05f6ce757c08c3602808929f621cf.tar.gz
sequelpro-224719bd0ed05f6ce757c08c3602808929f621cf.tar.bz2
sequelpro-224719bd0ed05f6ce757c08c3602808929f621cf.zip
• show in Content tables' header comments and ENUM/SET values
- addresses i977 • suppress editing of ENUM/SET fields in Field Editor sheet since it doesn't make sense yet • corrected method tableView:toolTipForCell: since aCell can be a NSComboCell
-rw-r--r--Source/SPTableContent.m42
1 files changed, 25 insertions, 17 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 7acc0187..7d64ed4b 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -445,7 +445,13 @@
// Set up the column
theCol = [[NSTableColumn alloc] initWithIdentifier:[columnDefinition objectForKey:@"datacolumnindex"]];
[[theCol headerCell] setStringValue:[columnDefinition objectForKey:@"name"]];
- [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@", [columnDefinition objectForKey:@"name"], [columnDefinition objectForKey:@"type"], ([columnDefinition objectForKey:@"length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"length"]] : @""]];
+ [theCol setHeaderToolTip:[NSString stringWithFormat:@"%@ – %@%@%@%@",
+ [columnDefinition objectForKey:@"name"],
+ [columnDefinition objectForKey:@"type"],
+ ([columnDefinition objectForKey:@"length"]) ? [NSString stringWithFormat:@"(%@)", [columnDefinition objectForKey:@"length"]] : @"",
+ ([columnDefinition objectForKey:@"values"]) ? [NSString stringWithFormat:@"(\n- %@\n)", [[columnDefinition objectForKey:@"values"] componentsJoinedByString:@"\n- "]] : @"",
+ ([columnDefinition objectForKey:@"comment"] && [[columnDefinition objectForKey:@"comment"] length]) ? [NSString stringWithFormat:@"\n%@", [[columnDefinition objectForKey:@"comment"] stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"]] : @""
+ ]];
[theCol setEditable:YES];
// Set up column for filterTable
@@ -3455,7 +3461,7 @@
* - if blob data can be interpret as image data display the image as transparent thumbnail
* (up to now using base64 encoded HTML data)
*/
-- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(SPTextAndLinkCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation
+- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:(id)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row mouseLocation:(NSPoint)mouseLocation
{
if(aTableView == filterTableView) {
@@ -4063,9 +4069,17 @@
BOOL isBlob = [tableDataInstance columnIsBlobOrText:[[aTableColumn headerCell] stringValue]];
BOOL isFieldEditable = YES;
+ // Retrieve the column defintion
+ NSDictionary *columnDefinition = nil;
+ for(id c in cqColumnDefinition) {
+ if([[c objectForKey:@"datacolumnindex"] isEqualToNumber:[aTableColumn identifier]]) {
+ columnDefinition = [NSDictionary dictionaryWithDictionary:c];
+ break;
+ }
+ }
// Open the sheet if the multipleLineEditingButton is enabled or the column was a blob or a text.
- if ([multipleLineEditingButton state] == NSOnState || isBlob) {
+ if (([multipleLineEditingButton state] == NSOnState || isBlob) && ![[columnDefinition objectForKey:@"typegrouping"] isEqualToString:@"enum"]) {
// A table is per definitionem editable
isFieldEditable = YES;
@@ -4081,19 +4095,13 @@
NSString *fieldEncoding = nil;
BOOL allowNULL = YES;
- // Retrieve the column defintion
- for(id c in cqColumnDefinition) {
- if([[c objectForKey:@"datacolumnindex"] isEqualToNumber:[aTableColumn identifier]]) {
- fieldType = [c objectForKey:@"type"];
- if([c objectForKey:@"char_length"])
- fieldLength = [[c objectForKey:@"char_length"] integerValue];
- if([c objectForKey:@"null"])
- allowNULL = (![[c objectForKey:@"null"] integerValue]);
- if([c objectForKey:@"charset_name"] && ![[c objectForKey:@"charset_name"] isEqualToString:@"binary"])
- fieldEncoding = [c objectForKey:@"charset_name"];
- break;
- }
- }
+ fieldType = [columnDefinition objectForKey:@"type"];
+ if([columnDefinition objectForKey:@"char_length"])
+ fieldLength = [[columnDefinition objectForKey:@"char_length"] integerValue];
+ if([columnDefinition objectForKey:@"null"])
+ allowNULL = (![[columnDefinition objectForKey:@"null"] integerValue]);
+ if([columnDefinition objectForKey:@"charset_name"] && ![[columnDefinition objectForKey:@"charset_name"] isEqualToString:@"binary"])
+ fieldEncoding = [columnDefinition objectForKey:@"charset_name"];
if(fieldEditor) [fieldEditor release], fieldEditor = nil;
fieldEditor = [[SPFieldEditorController alloc] init];
@@ -4393,7 +4401,7 @@
// Check if current edited field is a blob
if ((fieldType = [[tableDataInstance columnWithName:[[NSArrayObjectAtIndex([tableContentView tableColumns], column) headerCell] stringValue]] objectForKey:@"typegrouping"])
- && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"] || [multipleLineEditingButton state] == NSOnState))
+ && ![fieldType isEqualToString:@"enum"] && ([fieldType isEqualToString:@"textdata"] || [fieldType isEqualToString:@"blobdata"] || [multipleLineEditingButton state] == NSOnState))
{
[tableContentView setFieldEditorSelectedRange:[fieldEditor selectedRange]];