diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-02-16 19:15:53 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2023-02-16 19:15:53 +0100 |
| commit | 80583e8f2fb92146b8c59e36636f690af7f13eb0 (patch) | |
| tree | 9bfa2a07fe827053df1a13bbb2892aafbc4f65b9 /Flat Bezel | |
| parent | 6c2cdbc5ffb3ec1775c25d122751bddc5d205b6a (diff) | |
New icons + fix version
Diffstat (limited to 'Flat Bezel')
| -rw-r--r-- | Flat Bezel/BBFlatBezelInterface.m | 2 | ||||
| -rw-r--r-- | Flat Bezel/BBObjectCell.m | 53 |
2 files changed, 53 insertions, 2 deletions
diff --git a/Flat Bezel/BBFlatBezelInterface.m b/Flat Bezel/BBFlatBezelInterface.m index bac396f..47af67f 100644 --- a/Flat Bezel/BBFlatBezelInterface.m +++ b/Flat Bezel/BBFlatBezelInterface.m @@ -40,7 +40,7 @@ [theCell setBackgroundColor:[NSColor clearColor]]; [theCell setFont:[NSFont systemFontOfSize:11 weight:NSFontWeightLight]]; - [theCell setCellRadiusFactor:4]; + [theCell setCellRadiusFactor:32]; [theCell setHighlightColor:[NSColor colorWithRed:1 green:1 blue:1 alpha:.15]]; [theCell setTextColor:[NSColor textColor]]; diff --git a/Flat Bezel/BBObjectCell.m b/Flat Bezel/BBObjectCell.m index 40bde4d..7bf1b3c 100644 --- a/Flat Bezel/BBObjectCell.m +++ b/Flat Bezel/BBObjectCell.m @@ -27,7 +27,7 @@ [strokeColor setStroke]; NSBezierPath *roundRect = [NSBezierPath bezierPath]; - [roundRect appendBezierPathWithRoundedRectangle:cellFrame withRadius:cellRadiusFactor]; + [roundRect appendBezierPathWithRoundedRectangle:cellFrame withRadius:NSHeight(cellFrame)/cellRadiusFactor]; [roundRect fill]; [self drawInteriorWithFrame:[self drawingRectForBounds:cellFrame] inView:controlView]; @@ -157,4 +157,55 @@ } } +- (void)drawIconForObject:(QSObject *)object withFrame:(NSRect)cellFrame inView:(NSView *)controlView { + NSImage *image = [object icon]; + NSString *iconName = nil; + NSImageSymbolConfiguration *iconConfig = nil; + if ([[image name] isEqualToString: @"defaultAction"]) { + iconName = @"gearshape.circle"; + } + else if ([[image name] isEqualToString: @"Find"]) { + iconName = @"magnifyingglass"; + } + else if ([[image name] isEqualToString: @"Object"]) { + iconName = @"cube.transparent"; + iconConfig = [NSImageSymbolConfiguration configurationWithHierarchicalColor:[NSColor controlAccentColor]]; + } + else if ([[image name] isEqualToString: @"ContactAddress"]) { + iconName = @"mappin.circle"; + } + else if ([[image name] isEqualToString: @"ContactEmail"]) { + iconName = @"envelope.circle"; + } + else if ([[image name] isEqualToString: @"ContactPhone"]) { + iconName = @"phone.circle"; + } + else if ([[image name] isEqualToString: @"DefaultBookmarkIcon"]) { + iconName = @"link.circle"; + } + else if ([[image name] isEqualToString: @"Catalog"]) { + iconName = @"sparkles.rectangle.stack"; + } + else if ([[image name] isEqualToString: @"Triggers"]) { + iconName = @"bolt.fill"; + } + + + if (iconName != nil) { + NSImage *newIcon = [NSImage imageWithSystemSymbolName:iconName accessibilityDescription:[image name]]; + + if (iconConfig == nil) { + NSArray *colors = [NSArray arrayWithObjects:[NSColor textColor], [NSColor controlAccentColor], nil]; + iconConfig = [NSImageSymbolConfiguration configurationWithPaletteColors:colors]; + } + + QSObject *newObject = [QSObject objectWithName:[object name]]; + [newObject setIcon:[newIcon imageWithSymbolConfiguration:iconConfig]]; + [newObject setIconLoaded:[object iconLoaded]]; + return [super drawIconForObject: newObject withFrame:cellFrame inView:controlView]; + } + + [super drawIconForObject: object withFrame:cellFrame inView:controlView]; +} + @end |