aboutsummaryrefslogtreecommitdiff
path: root/Flat Bezel
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-09-04 11:11:37 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-09-04 11:11:37 +0200
commitbb5daa2e90623691a5259700b9d388d2d21f46d3 (patch)
treef5629e81bedc6cdd35ee9a79628997c5e14ffa7c /Flat Bezel
parent3dfeb86c5c3b72acc59919c7a198fcf76a54c35c (diff)
Rename to Liquid Glass Bezel, add preferences
Diffstat (limited to 'Flat Bezel')
-rw-r--r--Flat Bezel/BBFlatBezelInterface.h9
-rw-r--r--Flat Bezel/BBFlatBezelInterface.m99
-rw-r--r--Flat Bezel/BBFlatBezelInterface.xib103
-rw-r--r--Flat Bezel/BBObjectCell.h4
-rw-r--r--Flat Bezel/BBObjectCell.m211
-rw-r--r--Flat Bezel/BackgroundView.swift88
-rw-r--r--Flat Bezel/FlatBezel-Bridging-Header.h2
-rw-r--r--Flat Bezel/FlatBezelCollectingSearchObjectView.swift38
-rw-r--r--Flat Bezel/FlatBezelObjectCell.swift164
-rw-r--r--Flat Bezel/FlatBezelSearchObjectView.swift6
-rw-r--r--Flat Bezel/en.lproj/InfoPlist.strings2
11 files changed, 0 insertions, 726 deletions
diff --git a/Flat Bezel/BBFlatBezelInterface.h b/Flat Bezel/BBFlatBezelInterface.h
deleted file mode 100644
index 301542d..0000000
--- a/Flat Bezel/BBFlatBezelInterface.h
+++ /dev/null
@@ -1,9 +0,0 @@
-@interface BBFlatBezelInterface : QSResizingInterfaceController {
- NSRect standardRect;
-}
-
-@end
-
-@interface NSWindow (QSBCInterfaceController)
-- (NSTimeInterval)animationResizeTime:(NSRect)newWindowFrame;
-@end
diff --git a/Flat Bezel/BBFlatBezelInterface.m b/Flat Bezel/BBFlatBezelInterface.m
deleted file mode 100644
index 47af67f..0000000
--- a/Flat Bezel/BBFlatBezelInterface.m
+++ /dev/null
@@ -1,99 +0,0 @@
-#import "BBFlatBezelInterface.h"
-
-@interface BBFlatBezelInterface () {
- CGRect initialRect;
-}
-@end
-
-@implementation BBFlatBezelInterface
-
-- (id)init {
- return [self initWithWindowNibName:@"BBFlatBezelInterface"];
-}
-
-- (void)windowDidLoad {
- initialRect = centerRectInRect([[self window] frame], [[NSScreen mainScreen] frame]);
-
- [super windowDidLoad];
-
- QSWindow *window = (QSWindow *)[self window];
- [window setLevel:NSPopUpMenuWindowLevel];
- [window setBackgroundColor:[NSColor clearColor]];
- [window setOpaque:NO];
-
- [window setHideOffset:NSMakePoint(0, 0)];
- [window setShowOffset:NSMakePoint(0, 0)];
-
- [window setMovableByWindowBackground:NO];
- [window setFastShow:YES];
- [window setHasShadow:YES];
-
- [window setFrame:standardRect display:YES];
-
- NSArray *theControls = [NSArray arrayWithObjects:dSelector, aSelector, iSelector, nil];
- for(QSSearchObjectView *theControl in theControls) {
- QSObjectCell *theCell = [theControl cell];
-
- [theControl setPreferredEdge:NSMinYEdge];
- [(QSWindow *)[(theControl)->resultController window] setHideOffset:NSMakePoint(0, NSMinY([iSelector frame]))];
- [(QSWindow *)[(theControl)->resultController window] setShowOffset:NSMakePoint(0, NSMinY([dSelector frame]))];
-
- [theCell setBackgroundColor:[NSColor clearColor]];
- [theCell setFont:[NSFont systemFontOfSize:11 weight:NSFontWeightLight]];
- [theCell setCellRadiusFactor:32];
-
- [theCell setHighlightColor:[NSColor colorWithRed:1 green:1 blue:1 alpha:.15]];
- [theCell setTextColor:[NSColor textColor]];
- [theCell setShowDetails:NO];
- [theCell setState:NSControlStateValueOn];
- [theCell setIconSize:QSSize128];
- [theCell setImagePosition:NSImageAbove];
- }
-
- [self contractWindow:nil];
-}
-
-- (NSSize) maxIconSize {
- return QSSize32;
-}
-
-- (void)showMainWindow:(id)sender {
- [[self window] setFrame:[self rectForState:[self expanded]] display:YES];
- if ([[self window] isVisible]) [[self window] pulse:self];
- [super showMainWindow:sender];
- // Does this need to be here?
- [[[self window] contentView] setNeedsDisplay:YES];
-}
-
-- (void)expandWindow:(id)sender {
- if (![self expanded])
- [[self window] setFrame:[self rectForState:YES] display:YES animate:YES];
- [super expandWindow:sender];
-}
-
-- (void)contractWindow:(id)sender {
- if ([self expanded])
- [[self window] setFrame:[self rectForState:NO] display:YES animate:YES];
- [super contractWindow:sender];
-}
-
-- (NSRect)rectForState:(BOOL)shouldExpand {
- NSRect newRect = initialRect;
- NSRect screenRect = [[NSScreen mainScreen] frame];
-
- if (!shouldExpand) {
- newRect.size.width -= 192;
- }
-
- return NSOffsetRect(centerRectInRect(newRect, screenRect), 0, (NSHeight(screenRect) / 5));
-}
-
-- (NSRect)window:(NSWindow *)window willPositionSheet:(NSWindow *)sheet usingRect:(NSRect)rect {
- return NSOffsetRect(NSInsetRect(rect, 8, 0), 0, 0);
-}
-
-- (NSTimeInterval)animationResizeTime:(NSRect)newWindowFrame {
- return 0.01;
-}
-
-@end
diff --git a/Flat Bezel/BBFlatBezelInterface.xib b/Flat Bezel/BBFlatBezelInterface.xib
deleted file mode 100644
index b6fd59e..0000000
--- a/Flat Bezel/BBFlatBezelInterface.xib
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
- <dependencies>
- <deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
- <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
- </dependencies>
- <objects>
- <customObject id="-2" userLabel="File's Owner" customClass="BBFlatBezelInterface">
- <connections>
- <outlet property="aSelector" destination="69" id="79"/>
- <outlet property="dSelector" destination="68" id="75"/>
- <outlet property="iSelector" destination="70" id="80"/>
- <outlet property="menuButton" destination="209" id="210"/>
- <outlet property="progressIndicator" destination="192" id="211"/>
- <outlet property="window" destination="9" id="78"/>
- </connections>
- </customObject>
- <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
- <customObject id="-3" userLabel="Application" customClass="NSObject"/>
- <window title="Bezel Interface" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="9" userLabel="mainWindow" customClass="QSBorderlessWindow">
- <windowStyleMask key="styleMask" titled="YES" closable="YES" nonactivatingPanel="YES"/>
- <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
- <rect key="contentRect" x="530" y="653" width="608" height="200"/>
- <rect key="screenRect" x="0.0" y="0.0" width="1512" height="944"/>
- <value key="minSize" type="size" width="440" height="200"/>
- <view key="contentView" id="6" customClass="BackgroundView" customModule="Flat_Bezel" customModuleProvider="target">
- <rect key="frame" x="0.0" y="0.0" width="608" height="200"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <customView translatesAutoresizingMaskIntoConstraints="NO" id="68" customClass="FlatBezelCollectingSearchObjectView" customModule="Flat_Bezel" customModuleProvider="target">
- <rect key="frame" x="8" y="8" width="184" height="184"/>
- <constraints>
- <constraint firstAttribute="height" constant="184" id="SwQ-fC-3aw"/>
- <constraint firstAttribute="width" constant="184" id="Zol-hr-3Bk"/>
- </constraints>
- <connections>
- <outlet property="nextKeyView" destination="69" id="105"/>
- </connections>
- </customView>
- <customView translatesAutoresizingMaskIntoConstraints="NO" id="69" customClass="FlatBezelSearchObjectView" customModule="Flat_Bezel" customModuleProvider="target">
- <rect key="frame" x="200" y="8" width="184" height="184"/>
- <constraints>
- <constraint firstAttribute="width" constant="184" id="O3w-M3-b05"/>
- <constraint firstAttribute="height" constant="184" id="XPL-72-l7r"/>
- </constraints>
- <connections>
- <outlet property="nextKeyView" destination="70" id="106"/>
- </connections>
- </customView>
- <customView translatesAutoresizingMaskIntoConstraints="NO" id="70" customClass="FlatBezelCollectingSearchObjectView" customModule="Flat_Bezel" customModuleProvider="target">
- <rect key="frame" x="392" y="8" width="184" height="184"/>
- <constraints>
- <constraint firstAttribute="width" constant="184" id="Jbn-VW-sSJ"/>
- <constraint firstAttribute="height" constant="184" id="X3X-S6-KrY"/>
- </constraints>
- <connections>
- <outlet property="nextKeyView" destination="68" id="104"/>
- </connections>
- </customView>
- <progressIndicator horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="192">
- <rect key="frame" x="584" y="8" width="16" height="16"/>
- <constraints>
- <constraint firstAttribute="width" constant="16" id="Py4-hV-7HG"/>
- </constraints>
- </progressIndicator>
- <button translatesAutoresizingMaskIntoConstraints="NO" id="209" customClass="QSMenuButton">
- <rect key="frame" x="584" y="173.5" width="16" height="21"/>
- <constraints>
- <constraint firstAttribute="height" constant="16" id="cvg-xh-bvD"/>
- <constraint firstAttribute="width" constant="16" id="w12-Bf-x2f"/>
- </constraints>
- <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="arrowtriangle.down.square.fill" catalog="system" imagePosition="only" alignment="center" inset="2" id="216">
- <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
- <font key="font" metaFont="system"/>
- </buttonCell>
- <color key="contentTintColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
- </button>
- </subviews>
- <constraints>
- <constraint firstItem="209" firstAttribute="top" secondItem="6" secondAttribute="top" constant="8" id="1uj-pU-uJB"/>
- <constraint firstItem="70" firstAttribute="leading" secondItem="69" secondAttribute="trailing" constant="8" id="3iK-bw-ky1"/>
- <constraint firstAttribute="bottom" secondItem="192" secondAttribute="bottom" constant="8" id="ASY-5E-0bJ"/>
- <constraint firstAttribute="trailing" secondItem="192" secondAttribute="trailing" constant="8" id="S36-iH-Apn"/>
- <constraint firstItem="69" firstAttribute="leading" secondItem="68" secondAttribute="trailing" constant="8" id="VOZ-kp-hVQ"/>
- <constraint firstAttribute="trailing" secondItem="209" secondAttribute="trailing" constant="8" id="ZBS-80-x88"/>
- <constraint firstItem="69" firstAttribute="top" secondItem="6" secondAttribute="top" constant="8" id="Zec-BE-M9X"/>
- <constraint firstItem="70" firstAttribute="top" secondItem="6" secondAttribute="top" constant="8" id="jQN-Vd-Qm0"/>
- <constraint firstItem="68" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="8" id="m72-ls-RGc"/>
- <constraint firstItem="68" firstAttribute="top" secondItem="6" secondAttribute="top" constant="8" id="msf-m2-n1U"/>
- </constraints>
- </view>
- <connections>
- <outlet property="delegate" destination="-2" id="81"/>
- <outlet property="initialFirstResponder" destination="68" id="111"/>
- </connections>
- <point key="canvasLocation" x="76" y="-42"/>
- </window>
- </objects>
- <resources>
- <image name="arrowtriangle.down.square.fill" catalog="system" width="15" height="14"/>
- </resources>
-</document>
diff --git a/Flat Bezel/BBObjectCell.h b/Flat Bezel/BBObjectCell.h
deleted file mode 100644
index 3fa67c6..0000000
--- a/Flat Bezel/BBObjectCell.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#import <QSInterface/QSInterface.h>
-
-@interface BBObjectCell : QSObjectCell
-@end
diff --git a/Flat Bezel/BBObjectCell.m b/Flat Bezel/BBObjectCell.m
deleted file mode 100644
index 7bf1b3c..0000000
--- a/Flat Bezel/BBObjectCell.m
+++ /dev/null
@@ -1,211 +0,0 @@
-#import "BBObjectCell.h"
-
-@implementation BBObjectCell
-
-- (NSCellImagePosition)preferredImagePosition {
- return NSImageAbove;
-}
-
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- BOOL isFirstResponder = [[controlView window] firstResponder] == controlView && ![controlView isKindOfClass:[NSTableView class]];
- BOOL dropTarget = ([self isHighlighted] && ([self highlightsBy] & NSChangeBackgroundCellMask) && ![self isBezeled]);
-
- NSColor *fillColor;
- NSColor *strokeColor = [NSColor clearColor];
-
- if (isFirstResponder) {
- fillColor = [NSColor selectedTextBackgroundColor];
- } else {
- fillColor = [NSColor clearColor];
- }
-
- if (dropTarget) {
- fillColor = [NSColor controlAccentColor];
- }
-
- [fillColor setFill];
- [strokeColor setStroke];
-
- NSBezierPath *roundRect = [NSBezierPath bezierPath];
- [roundRect appendBezierPathWithRoundedRectangle:cellFrame withRadius:NSHeight(cellFrame)/cellRadiusFactor];
- [roundRect fill];
-
- [self drawInteriorWithFrame:[self drawingRectForBounds:cellFrame] inView:controlView];
-}
-
-- (NSRect)titleRectForBounds:(NSRect)theRect
-{
- NSRect rect = theRect;
- rect = NSOffsetRect(rect, 0, -4);
- return [super titleRectForBounds: rect];
-}
-
-- (void)drawTextForObject:(QSObject *)drawObject withFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- if ([self imagePosition] == NSImageOnly) return;
-
- NSString *abbrString = nil;
- if ([controlView respondsToSelector:@selector(matchedString)])
- abbrString = [(QSSearchObjectView *)controlView matchedString];
-
- NSString *nameString = nil;
- NSIndexSet *hitMask = nil;
-
- id ranker = [drawObject ranker];
- if (ranker && abbrString)
- nameString = [ranker matchedStringForAbbreviation:abbrString hitmask:&hitMask inContext:nil];
-
- if (!nameString)
- nameString = [drawObject displayName];
-
- BOOL rankedStringIsName = [nameString isEqualToString:[drawObject displayName]] || nameString == nil;
- if (!nameString) {
- // fall back to the identifier if no reasonable name can be found
- nameString = [drawObject identifier];
- }
- if (!nameString) {
- // Couldn't find anything sensible to use for the name, fallback to avoid a crash
- nameString = @"Unknown";
- }
-
- BOOL useAlternateColor = [controlView isKindOfClass:[NSTableView class]] && [(NSTableView *)controlView isRowSelected:[(NSTableView *)controlView rowAtPoint:cellFrame.origin]];
- NSColor *mainColor = (textColor ? textColor : (useAlternateColor ? [NSColor alternateSelectedControlTextColor] : [NSColor controlTextColor]));
- NSColor *fadedColor = [mainColor colorWithAlphaComponent:0.50];
- NSRect textDrawRect = [self titleRectForBounds:cellFrame];
-
- NSMutableAttributedString *titleString = [[[NSMutableAttributedString alloc] initWithString:nameString] autorelease];
- [titleString setAttributes:rankedStringIsName ? nameAttributes : detailsAttributes range:NSMakeRange(0, [titleString length])];
-
- // Bring out the matched letters
- if (abbrString && ![abbrString hasPrefix:@"QSActionMnemonic"]) {
- [titleString addAttribute:NSForegroundColorAttributeName value:rankedStringIsName ? fadedColor : [fadedColor colorWithAlphaComponent:0.8] range:NSMakeRange(0, [titleString length])];
-
- NSUInteger i = 0;
- NSUInteger j = 0;
- NSUInteger hits[[titleString length]];
- NSUInteger count = [hitMask getIndexes:(NSUInteger *)&hits maxCount:[titleString length] inIndexRange:nil];
- NSDictionary *attributes = @{
- NSForegroundColorAttributeName: rankedStringIsName ? mainColor : fadedColor
- };
- for(i = 0; i<count; i += j) {
- for (j = 1; i+j<count && hits[i+j-1] +1 == hits[i+j]; j++);
- [titleString addAttributes:attributes range:NSMakeRange(hits[i], j)];
- }
- } else {
- [titleString addAttribute:NSBaselineOffsetAttributeName value:[NSNumber numberWithDouble:-1.0] range:NSMakeRange(0, [titleString length])];
- }
-//
-// // Ranked string and nameString aren't the same. Show 'nameString ⟷ rankedString' in the UI
-// if (!rankedStringIsName && [drawObject displayName].length) {
-// [titleString addAttribute:NSFontAttributeName value:detailsFont range:NSMakeRange(0,[titleString length])];
-// NSMutableAttributedString *attributedNameString = [[NSMutableAttributedString alloc] initWithString:[drawObject displayName]];
-// [attributedNameString setAttributes:nameAttributes range:NSMakeRange(0, [[drawObject displayName] length])];
-//
-// [attributedNameString appendAttributedString:[[[NSAttributedString alloc] initWithString:@" ⟷ " attributes:rankedNameAttributes] autorelease]];
-// // the replaceCharacters... method inserts the new string into the receiver at the start of the work (range.location and range.length are 0)
-// [titleString replaceCharactersInRange:NSMakeRange(0,0) withAttributedString:attributedNameString];
-// [attributedNameString release];
-// }
-
- if (showDetails) {
- NSString *detailsString = [drawObject details];
-
- NSRange returnRange = [detailsString rangeOfString:@"\n"];
- if (returnRange.location != NSNotFound) {
- detailsString = [detailsString substringToIndex:returnRange.location];
- }
-
- detailsAttributes = [detailsAttributes mutableCopy];
- [detailsAttributes setValue:[NSColor grayColor] forKey:NSForegroundColorAttributeName];
-
- if (detailsString && detailsString.length && ![detailsString isEqualToString:nameString]) {
- [titleString appendAttributedString:[[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@",detailsString] attributes:detailsAttributes] autorelease]];
- }
- }
-
- NSRect centerRect = rectFromSize([titleString size]);
- centerRect.size.width = NSWidth(textDrawRect);
- centerRect.size.height = MIN(NSHeight(textDrawRect), centerRect.size.height);
- [titleString drawInRect:centerRectInRect(centerRect, textDrawRect)];
-}
-
-- (void)drawSearchPlaceholderWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- NSString *defaultText = NSLocalizedStringWithDefaultValue(@"Type to search", nil, [NSBundle mainBundle], @"Type to search", @"Hint that appears in the first pane of the QS interface when it's empty.");
- NSSize textSize = [defaultText sizeWithAttributes:nameAttributes];
- NSRect textRect = centerRectInRect(rectFromSize(textSize), cellFrame);
- BOOL isFirstResponder = [[controlView window] firstResponder] == controlView && ![controlView isKindOfClass:[NSTableView class]];
-
- if (isFirstResponder && [controlView isKindOfClass:[QSSearchObjectView class]]) {
- NSImage *find = [NSImage imageWithSystemSymbolName:@"magnifyingglass.circle.fill" accessibilityDescription:nil];
-
-
- [find setSize:QSSize16];
- NSRect findImageRect = expelRectFromRectOnEdge(centerRectInRect(rectFromSize([find size]), cellFrame), textRect, NSRectEdgeMinX, -2);
-
-
- NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
- [graphicsContext saveGraphicsState];
- CGContextRef context = [graphicsContext CGContext];
- CGContextBeginTransparencyLayerWithRect(context, findImageRect, nil);
- CGContextSetBlendMode(context, kCGBlendModeNormal);
- [find drawInRect:findImageRect fromRect:rectFromSize([find size]) operation:NSCompositingOperationSourceOver fraction:1];
- CGContextSetBlendMode(context, kCGBlendModeSourceIn);
- CGContextSetFillColorWithColor(context, [[NSColor textColor] CGColor]);
- CGContextFillRect(context, findImageRect);
- CGContextEndTransparencyLayer(context);
-
- [defaultText drawInRect:textRect withAttributes:nameAttributes];
- }
-}
-
-- (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
diff --git a/Flat Bezel/BackgroundView.swift b/Flat Bezel/BackgroundView.swift
deleted file mode 100644
index e5f4c86..0000000
--- a/Flat Bezel/BackgroundView.swift
+++ /dev/null
@@ -1,88 +0,0 @@
-import Foundation
-import Cocoa
-
-
-class BackgroundView: QSBezelBackgroundView {
-
- private var glassView: NSGlassEffectView?
-
- override func awakeFromNib() {
- super.awakeFromNib()
- configureParentView()
- setupGlassEffect()
- }
-
- override init(frame frameRect: NSRect) {
- super.init(frame: frameRect)
- configureParentView()
- setupGlassEffect()
- }
-
- required init?(coder: NSCoder) {
- super.init(coder: coder)
- configureParentView()
- setupGlassEffect()
- }
-
- private func configureParentView() {
- // Make the parent background much more transparent so glass effect shows through
- setColor(NSColor.clear) // Try completely transparent first
- setIsGlass(NSNumber(value: false)) // Disable the parent's glass rendering
-
- // Alternative: if clear doesn't work, try a very transparent background
- // setColor(NSColor.black.withAlphaComponent(0.1))
- }
-
- private func setupGlassEffect() {
- let glassView = NSGlassEffectView(frame: bounds)
- glassView.autoresizingMask = [.width, .height]
- glassView.cornerRadius = 12.0
- glassView.style = .clear
-
- // Create a content view for the glass effect
- let contentView = NSView(frame: glassView.bounds)
- contentView.autoresizingMask = [.width, .height]
- glassView.contentView = contentView
-
- // Add subtle tint based on appearance
- updateGlassTint()
-
- // Insert the glass view at the bottom of the view hierarchy
- addSubview(glassView, positioned: .below, relativeTo: nil)
- self.glassView = glassView
- }
-
- private func updateGlassTint() {
- guard let glassView = glassView else { return }
-
- let darkMode = effectiveAppearance.name == .darkAqua
- if darkMode {
- // Very subtle tint for dark mode to maintain translucency
- glassView.tintColor = NSColor.black.withAlphaComponent(0.05)
- } else {
- // Even lighter tint for light mode
- glassView.tintColor = NSColor.white.withAlphaComponent(0.02)
- }
- }
-
- override func viewDidMoveToWindow() {
- super.viewDidMoveToWindow()
-
- // Ensure the window is configured for transparency
- if let window = self.window {
- window.backgroundColor = NSColor.clear
- window.isOpaque = false
- }
- }
-
- override func draw(_ rect: NSRect) {
- // Don't call super.draw(rect) to avoid the parent's opaque background
- // The glass effect will handle the visual appearance
- return
- }
-
- override func viewDidChangeEffectiveAppearance() {
- super.viewDidChangeEffectiveAppearance()
- updateGlassTint()
- }
-}
diff --git a/Flat Bezel/FlatBezel-Bridging-Header.h b/Flat Bezel/FlatBezel-Bridging-Header.h
deleted file mode 100644
index f216cf4..0000000
--- a/Flat Bezel/FlatBezel-Bridging-Header.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#import "Quicksilver.pch"
-#import "BBObjectCell.h"
diff --git a/Flat Bezel/FlatBezelCollectingSearchObjectView.swift b/Flat Bezel/FlatBezelCollectingSearchObjectView.swift
deleted file mode 100644
index 26586be..0000000
--- a/Flat Bezel/FlatBezelCollectingSearchObjectView.swift
+++ /dev/null
@@ -1,38 +0,0 @@
-class FlatBezelCollectingSearchObjectView: QSCollectingSearchObjectView {
- override static var cellClass : AnyClass? {
- get { return BBObjectCell.self }
- set { super.cellClass = newValue }
- }
-
- override func draw(_ rect: NSRect) {
- var frame = frame
-
- // These properties aren't available to Swift, so they need to be accessed in this way.
- let collection = (value(forKey: "collection") as! NSMutableArray)
- let collecting = (value(forKey: "collecting") as! Bool)
-
- let count = collection.count
- if self.currentEditor() == nil && count != 0 {
- frame.origin = NSZeroPoint
- cell?.draw(withFrame: frame, in: self)
- let iconSize = collectionSpace() != 0 ? collectionSpace() : 16
- let opacity = collecting ? 1.0 : 0.75
- let totalWidth = iconSize + 2
- for i in 0..<count {
- let object = collection.object(at: i) as! QSObject
- var icon = object.icon()
- let size = NSMakeSize(16, 16)
- icon?.size = size
- let inRect = NSMakeRect(
- frame.size.width - totalWidth * CGFloat(count - i),
- frame.origin.y + 2,
- iconSize,
- iconSize
- )
- icon?.draw(in: inRect, from: rectFromSize(size), operation: .sourceOver, fraction: opacity)
- }
- } else {
- super.draw(rect)
- }
- }
-}
diff --git a/Flat Bezel/FlatBezelObjectCell.swift b/Flat Bezel/FlatBezelObjectCell.swift
deleted file mode 100644
index da38a1b..0000000
--- a/Flat Bezel/FlatBezelObjectCell.swift
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-import Foundation
-
-class FlatBezelObjectCell: QSObjectCell {
- override func preferredImagePosition() -> NSControl.ImagePosition {
- return .imageAbove
- }
-
- override func draw(withFrame cellFrame: NSRect, in controlView: NSView?) {
- if let controlView {
-
- let isFirstResponder = controlView.window?.firstResponder == controlView && !(controlView is NSTableView)
- let dropTarget = isHighlighted && ((highlightsBy.rawValue & NSCell.StyleMask.changeBackgroundCellMask.rawValue) != 0) && !isBezeled
-
- var fillColor: NSColor?
- let strokeColor = NSColor.clear
-
- if isFirstResponder {
- fillColor = self.highlightColor()
- } else {
- fillColor = self.backgroundColor
- }
-
- if dropTarget {
- fillColor = NSColor(red: 0.77, green: 0.91, blue: 0.96, alpha: 1)
- }
-
- fillColor?.setFill()
- strokeColor.setStroke()
-
- let roundRect = NSBezierPath()
- roundRect.append(withRoundedRectangle: cellFrame, withRadius: cellRadiusFactor())
- roundRect.fill()
-
- drawInterior(withFrame: drawingRect(forBounds: cellFrame), in: controlView)
- }
- }
-
- override func titleRect(forBounds _rect: NSRect) -> NSRect {
- var rect = _rect
- rect = NSOffsetRect(rect, 0, -4)
- return super.titleRect(forBounds: rect)
- }
-
- override func drawText(for drawObject: QSObject!, withFrame cellFrame: NSRect, in controlView: NSView!) {
- if imagePosition == .imageOnly {
- return
- }
-
- var abbrString: String? = nil
-
- if controlView.responds(to: #selector(QSSearchObjectView.matchedString)) {
- abbrString = (controlView as! QSSearchObjectView).matchedString()
- }
-
- var nameString: String? = nil
- var hitMask: NSIndexSet? = nil
-
- let ranker = drawObject.ranker()
- if ranker != nil && abbrString != nil {
- nameString = ranker?.matchedString(forAbbreviation: abbrString, hitmask: &hitMask, inContext: nil)
- }
-
- if (nameString == nil) {
- nameString = drawObject.displayName()
- }
-
- let rankedStringIsName = nameString == drawObject.displayName() || nameString == nil
-
- if nameString == nil {
- nameString = drawObject.identifier() ?? "Unknown"
- }
-
- let useAlternateColor = controlView is NSTableView && (controlView as! NSTableView).isRowSelected((controlView as! NSTableView).row(at: cellFrame.origin))
- let mainColor = textColor() ?? (useAlternateColor ? .alternateSelectedControlTextColor : .controlTextColor)
- let fadedColor = mainColor.withAlphaComponent(0.50)
- let textDrawRect = titleRect(forBounds: cellFrame)
-
-
- let titleString = NSMutableAttributedString(string: nameString!)
- let nameAttributes = (value(forKey: "nameAttributes") as? [NSAttributedString.Key : Any])
- let detailsAttributes = (value(forKey: "detailsAttributes") as? [NSAttributedString.Key : Any])
- titleString.setAttributes(rankedStringIsName ? nameAttributes : detailsAttributes, range: NSMakeRange(0, titleString.length))
-
- if abbrString != nil && abbrString!.hasPrefix("QSActionMnemonic") {
- titleString.addAttribute(.foregroundColor, value: rankedStringIsName ? fadedColor : fadedColor.withAlphaComponent(0.8), range: NSMakeRange(0, titleString.length))
-
- var hits: Int = 0
- let count = hitMask?.getIndexes(&hits, maxCount: titleString.length, inIndexRange: nil)
- for i in 0..<(count ?? 0) {
- for j in 1.. {
- }
- }
- }
-}
-
- NSUInteger i = 0;
- NSUInteger j = 0;
- NSUInteger hits[[titleString length]];
- NSUInteger count = [hitMask getIndexes:(NSUInteger *)&hits maxCount:[titleString length] inIndexRange:nil];
- NSDictionary *attributes = @{
- NSForegroundColorAttributeName: rankedStringIsName ? mainColor : fadedColor
- };
- for(i = 0; i<count; i += j) {
- for (j = 1; i+j<count && hits[i+j-1] +1 == hits[i+j]; j++);
- [titleString addAttributes:attributes range:NSMakeRange(hits[i], j)];
- }
- } else {
- [titleString addAttribute:NSBaselineOffsetAttributeName value:[NSNumber numberWithDouble:-1.0] range:NSMakeRange(0, [titleString length])];
- }
-
- if (showDetails) {
- NSString *detailsString = [drawObject details];
-
- NSRange returnRange = [detailsString rangeOfString:@"\n"];
- if (returnRange.location != NSNotFound) {
- detailsString = [detailsString substringToIndex:returnRange.location];
- }
-
- detailsAttributes = [detailsAttributes mutableCopy];
- [detailsAttributes setValue:[NSColor grayColor] forKey:NSForegroundColorAttributeName];
-
- if (detailsString && detailsString.length && ![detailsString isEqualToString:nameString]) {
- [titleString appendAttributedString:[[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"\n%@",detailsString] attributes:detailsAttributes] autorelease]];
- }
- }
-
- NSRect centerRect = rectFromSize([titleString size]);
- centerRect.size.width = NSWidth(textDrawRect);
- centerRect.size.height = MIN(NSHeight(textDrawRect), centerRect.size.height);
- [titleString drawInRect:centerRectInRect(centerRect, textDrawRect)];
-}
-
-- (void)drawSearchPlaceholderWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
- NSString *defaultText = NSLocalizedStringWithDefaultValue(@"Type to search", nil, [NSBundle mainBundle], @"Type to search", @"Hint that appears in the first pane of the QS interface when it's empty.");
- NSSize textSize = [defaultText sizeWithAttributes:nameAttributes];
- NSRect textRect = centerRectInRect(rectFromSize(textSize), cellFrame);
- BOOL isFirstResponder = [[controlView window] firstResponder] == controlView && ![controlView isKindOfClass:[NSTableView class]];
-
- if (isFirstResponder && [controlView isKindOfClass:[QSSearchObjectView class]]) {
- NSImage *find = [NSImage imageWithSystemSymbolName:@"magnifyingglass.circle.fill" accessibilityDescription:nil];
-
-
- [find setSize:QSSize16];
- NSRect findImageRect = expelRectFromRectOnEdge(centerRectInRect(rectFromSize([find size]), cellFrame), textRect, NSRectEdgeMinX, -2);
-
-
- NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
- [graphicsContext saveGraphicsState];
- CGContextRef context = [graphicsContext CGContext];
- CGContextBeginTransparencyLayerWithRect(context, findImageRect, nil);
- CGContextSetBlendMode(context, kCGBlendModeNormal);
- [find drawInRect:findImageRect fromRect:rectFromSize([find size]) operation:NSCompositingOperationSourceOver fraction:1];
- CGContextSetBlendMode(context, kCGBlendModeSourceIn);
- CGContextSetFillColorWithColor(context, [[NSColor textColor] CGColor]);
- CGContextFillRect(context, findImageRect);
- CGContextEndTransparencyLayer(context);
-
- [defaultText drawInRect:textRect withAttributes:nameAttributes];
- }
-}
-
-@end
-*/
diff --git a/Flat Bezel/FlatBezelSearchObjectView.swift b/Flat Bezel/FlatBezelSearchObjectView.swift
deleted file mode 100644
index 902bede..0000000
--- a/Flat Bezel/FlatBezelSearchObjectView.swift
+++ /dev/null
@@ -1,6 +0,0 @@
-class FlatBezelSearchObjectView: QSSearchObjectView {
- override static var cellClass : AnyClass? {
- get { return BBObjectCell.self }
- set { super.cellClass = newValue }
- }
-}
diff --git a/Flat Bezel/en.lproj/InfoPlist.strings b/Flat Bezel/en.lproj/InfoPlist.strings
deleted file mode 100644
index 477b28f..0000000
--- a/Flat Bezel/en.lproj/InfoPlist.strings
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Localized versions of Info.plist keys */
-