Skip to content

Commit

Permalink
#2485: Fix display of encoding and collation default markers.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuconnolly committed Oct 2, 2018
1 parent ab7f302 commit e4804ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Source/SPPillAttachmentCell.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ - (NSSize)cellSize


- (NSDictionary *)attributes - (NSDictionary *)attributes
{ {
return @{NSFontAttributeName: [self font],NSForegroundColorAttributeName: [NSColor controlTextColor]}; return @{NSFontAttributeName: [self font]};
} }


@end @end
28 changes: 21 additions & 7 deletions Source/SPTableStructure.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2920,31 +2920,45 @@ + (SPFieldTypeHelp *)helpForFieldType:(NSString *)typeName


#pragma mark - #pragma mark -


void _BuildMenuWithPills(NSMenu *menu,struct _cmpMap *map,size_t mapEntries) void _BuildMenuWithPills(NSMenu *menu, struct _cmpMap *map, size_t mapEntries)
{ {
NSDictionary *baseAttrs = @{NSFontAttributeName:[menu font],NSParagraphStyleAttributeName: [NSParagraphStyle defaultParagraphStyle]}; NSDictionary *baseAttrs = @{NSFontAttributeName: [menu font], NSParagraphStyleAttributeName: [NSParagraphStyle defaultParagraphStyle]};


for(NSMenuItem *item in [menu itemArray]) { for (NSMenuItem *item in [menu itemArray])
{
NSMutableAttributedString *itemStr = [[NSMutableAttributedString alloc] initWithString:[item title] attributes:baseAttrs]; NSMutableAttributedString *itemStr = [[NSMutableAttributedString alloc] initWithString:[item title] attributes:baseAttrs];
NSString *value = [item representedObject]; NSString *value = [item representedObject];


NSMutableArray *tooltipParts = [NSMutableArray array]; NSMutableArray *tooltipParts = [NSMutableArray array];
for (unsigned int i = 0; i < mapEntries; ++i) {
for (unsigned int i = 0; i < mapEntries; ++i)
{
struct _cmpMap *cmp = &map[i]; struct _cmpMap *cmp = &map[i];
if([cmp->cmpWith isEqualToString:value]) {
if ([cmp->cmpWith isEqualToString:value]) {

SPPillAttachmentCell *cell = [[SPPillAttachmentCell alloc] init]; SPPillAttachmentCell *cell = [[SPPillAttachmentCell alloc] init];

[cell setStringValue:cmp->title]; [cell setStringValue:cmp->title];

NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; NSTextAttachment *attachment = [[NSTextAttachment alloc] init];

[attachment setAttachmentCell:[cell autorelease]]; [attachment setAttachmentCell:[cell autorelease]];

NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:[attachment autorelease]]; NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:[attachment autorelease]];


[[itemStr mutableString] appendString:@" "]; [[itemStr mutableString] appendString:@" "];
[itemStr appendAttributedString:attachmentString]; [itemStr appendAttributedString:attachmentString];


if(cmp->tooltipPart) [tooltipParts addObject:cmp->tooltipPart]; if (cmp->tooltipPart) {
[tooltipParts addObject:cmp->tooltipPart];
}
} }
} }
if([tooltipParts count]) [item setToolTip:[tooltipParts componentsJoinedByString:@" "]];
if ([tooltipParts count]) {
[item setToolTip:[tooltipParts componentsJoinedByString:@" "]];
}


[item setAttributedTitle:[itemStr autorelease]]; [item setAttributedTitle:[itemStr autorelease]];
} }
Expand Down

0 comments on commit e4804ee

Please sign in to comment.