/* Begin PBXBuildFile section */
42447D7D19407DA00077B4B2 /* BBSearchObjectView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42447D7C19407DA00077B4B2 /* BBSearchObjectView.m */; };
- 42447D821940935E0077B4B2 /* gear-black.png in Resources */ = {isa = PBXBuildFile; fileRef = 42447D7F1940935E0077B4B2 /* gear-black.png */; };
- 42447D831940935E0077B4B2 /* search-black.png in Resources */ = {isa = PBXBuildFile; fileRef = 42447D801940935E0077B4B2 /* search-black.png */; };
42663058193CC1FA00C0DD31 /* BBFlatBezelInterface.xib in Resources */ = {isa = PBXBuildFile; fileRef = 42663057193CC1FA00C0DD31 /* BBFlatBezelInterface.xib */; };
B576D2F52993FBD400A8B645 /* BackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B576D2F42993FBD400A8B645 /* BackgroundView.swift */; };
- CD3B1BE2285F2E8C004862D7 /* search-white.png in Resources */ = {isa = PBXBuildFile; fileRef = CD3B1BE0285F2E8C004862D7 /* search-white.png */; };
- CD3B1BE3285F2E8C004862D7 /* gear-white.png in Resources */ = {isa = PBXBuildFile; fileRef = CD3B1BE1285F2E8C004862D7 /* gear-white.png */; };
+ B57F7B90299405B7005F64AC /* FlatBezelSearchObjectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57F7B8F299405B7005F64AC /* FlatBezelSearchObjectView.swift */; };
+ B57F7B922994063C005F64AC /* FlatBezelObjectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B57F7B912994063C005F64AC /* FlatBezelObjectCell.swift */; };
E470B7E31709F3A0000169F2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E470B7E21709F3A0000169F2 /* Cocoa.framework */; };
E470B7E91709F3A0000169F2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = E470B7E71709F3A0000169F2 /* InfoPlist.strings */; };
E470B7F81709F3A0000169F2 /* BBFlatBezelInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = E470B7F71709F3A0000169F2 /* BBFlatBezelInterface.m */; };
/* Begin PBXFileReference section */
42447D7B19407DA00077B4B2 /* BBSearchObjectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBSearchObjectView.h; sourceTree = "<group>"; };
42447D7C19407DA00077B4B2 /* BBSearchObjectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBSearchObjectView.m; sourceTree = "<group>"; };
- 42447D7F1940935E0077B4B2 /* gear-black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "gear-black.png"; sourceTree = "<group>"; };
- 42447D801940935E0077B4B2 /* search-black.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "search-black.png"; sourceTree = "<group>"; };
42663057193CC1FA00C0DD31 /* BBFlatBezelInterface.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BBFlatBezelInterface.xib; sourceTree = "<group>"; };
B576D2F42993FBD400A8B645 /* BackgroundView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundView.swift; sourceTree = "<group>"; };
B576D2F62993FD7500A8B645 /* FlatBezel-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FlatBezel-Bridging-Header.h"; sourceTree = "<group>"; };
- CD3B1BE0285F2E8C004862D7 /* search-white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "search-white.png"; sourceTree = "<group>"; };
- CD3B1BE1285F2E8C004862D7 /* gear-white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "gear-white.png"; sourceTree = "<group>"; };
+ B57F7B8F299405B7005F64AC /* FlatBezelSearchObjectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlatBezelSearchObjectView.swift; sourceTree = "<group>"; };
+ B57F7B912994063C005F64AC /* FlatBezelObjectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlatBezelObjectCell.swift; sourceTree = "<group>"; };
E470B7DF1709F3A0000169F2 /* Flat Bezel.qsplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Flat Bezel.qsplugin"; sourceTree = BUILT_PRODUCTS_DIR; };
E470B7E21709F3A0000169F2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
E470B7E61709F3A0000169F2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; };
E470B7F61709F3A0000169F2 /* BBFlatBezelInterface.h */,
E470B7F71709F3A0000169F2 /* BBFlatBezelInterface.m */,
42663057193CC1FA00C0DD31 /* BBFlatBezelInterface.xib */,
+ B57F7B8F299405B7005F64AC /* FlatBezelSearchObjectView.swift */,
+ B57F7B912994063C005F64AC /* FlatBezelObjectCell.swift */,
B576D2F42993FBD400A8B645 /* BackgroundView.swift */,
- CD3B1BE1285F2E8C004862D7 /* gear-white.png */,
- CD3B1BE0285F2E8C004862D7 /* search-white.png */,
- 42447D7F1940935E0077B4B2 /* gear-black.png */,
- 42447D801940935E0077B4B2 /* search-black.png */,
);
path = "Flat Bezel";
sourceTree = "<group>";
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- CD3B1BE3285F2E8C004862D7 /* gear-white.png in Resources */,
42663058193CC1FA00C0DD31 /* BBFlatBezelInterface.xib in Resources */,
E470B7E91709F3A0000169F2 /* InfoPlist.strings in Resources */,
- CD3B1BE2285F2E8C004862D7 /* search-white.png in Resources */,
- 42447D821940935E0077B4B2 /* gear-black.png in Resources */,
- 42447D831940935E0077B4B2 /* search-black.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
buildActionMask = 2147483647;
files = (
B576D2F52993FBD400A8B645 /* BackgroundView.swift in Sources */,
+ B57F7B90299405B7005F64AC /* FlatBezelSearchObjectView.swift in Sources */,
42447D7D19407DA00077B4B2 /* BBSearchObjectView.m in Sources */,
E470B7F81709F3A0000169F2 /* BBFlatBezelInterface.m in Sources */,
+ B57F7B922994063C005F64AC /* FlatBezelObjectCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
NSRect screenRect = [[NSScreen mainScreen] frame];
if (!shouldExpand) {
- newRect.size.width -= 208;
+ newRect.size.width -= 192;
}
return NSOffsetRect(centerRectInRect(newRect, screenRect), 0, (NSHeight(screenRect) / 5));
<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="648" height="200"/>
+ <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="648" height="200"/>
+ <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="BBCollectingSearchObjectView">
- <rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
+ <rect key="frame" x="8" y="8" width="184" height="184"/>
<constraints>
- <constraint firstAttribute="height" constant="200" id="SwQ-fC-3aw"/>
- <constraint firstAttribute="width" constant="200" id="Zol-hr-3Bk"/>
+ <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="BBSearchObjectView">
- <rect key="frame" x="208" y="0.0" width="200" height="200"/>
+ <rect key="frame" x="200" y="8" width="184" height="184"/>
<constraints>
- <constraint firstAttribute="width" constant="200" id="O3w-M3-b05"/>
- <constraint firstAttribute="height" constant="200" id="XPL-72-l7r"/>
+ <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="BBCollectingSearchObjectView">
- <rect key="frame" x="416" y="0.0" width="200" height="200"/>
+ <rect key="frame" x="392" y="8" width="184" height="184"/>
<constraints>
- <constraint firstAttribute="width" constant="200" id="Jbn-VW-sSJ"/>
- <constraint firstAttribute="height" constant="200" id="X3X-S6-KrY"/>
+ <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="624" y="8" width="16" height="16"/>
+ <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="624" y="176" width="16" height="16"/>
+ <rect key="frame" x="584" y="176" width="16" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="cvg-xh-bvD"/>
<constraint firstAttribute="width" constant="16" id="w12-Bf-x2f"/>
<color key="contentTintColor" name="labelColor" catalog="System" colorSpace="catalog"/>
</button>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="191">
- <rect key="frame" x="622" y="176" width="20" height="16"/>
+ <rect key="frame" x="582" y="176" width="20" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="16" id="Yy8-MR-Hc2"/>
<constraint firstAttribute="width" constant="16" id="coj-vh-kaj"/>
<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" id="Zec-BE-M9X"/>
- <constraint firstItem="70" firstAttribute="top" secondItem="6" secondAttribute="top" id="jQN-Vd-Qm0"/>
+ <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="191" firstAttribute="top" secondItem="209" secondAttribute="bottom" constant="-16" id="jqz-xK-7Wg"/>
- <constraint firstItem="68" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="m72-ls-RGc"/>
- <constraint firstItem="68" firstAttribute="top" secondItem="6" secondAttribute="top" id="msf-m2-n1U"/>
+ <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>
[titleString drawInRect:centerRectInRect(centerRect, textDrawRect)];
}
-@end
-
-
-
+- (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
--- /dev/null
+//
+// FlatBezelObjectCell.swift
+// Flat Bezel
+//
+// Created by Ruben Beltran del Rio on 2/8/23.
+// Copyright © 2023 BRNBW. All rights reserved.
+//
+/*
+import Foundation
+import Cocoa
+
+class FlatBezelObjectCell: QSObjectCell {
+ let preferredImagePosition: NSControl.ImagePosition = .imageAbove
+
+ override func draw(withFrame cellFrame: NSRect, in controlView: NSView!) {
+ let isFirstResponder = controlView.window?.firstResponder == controlView && !controlView.isKind(of: NSTableView.self)
+
+ let dropTarget = self.isHighlighted && self.highlightsBy.contains(NSCell.StyleMask.changeBackgroundCellMask) && !self.isBezeled
+
+ var fillColor: NSColor = self.backgroundColor ?? .textBackgroundColor
+ if (isFirstResponder) {
+ fillColor = self.highlightColor()
+ }
+ if (dropTarget) {
+ fillColor = NSColor(red: 0.77, green: 0.91, blue: 0.96, alpha: 1)
+ }
+
+ var strokeColor: NSColor = .clear
+
+ fillColor.setFill()
+ strokeColor.setStroke()
+
+ let roundRect = NSBezierPath()
+ roundRect.appendRoundedRect(cellFrame, xRadius: cellRadiusFactor(), yRadius: cellRadiusFactor())
+ roundRect.fill()
+
+ self.drawInterior(withFrame: self.drawingRect(forBounds: cellFrame), in: controlView)
+ }
+
+ override func titleRect(forBounds rect: NSRect) -> NSRect {
+ super.titleRect(forBounds: rect.offsetBy(dx: 0, dy: -4))
+ }
+
+ override func drawText(for drawObject: QSObject!, withFrame cellFrame: NSRect, in controlView: NSView!) {
+ if self.imagePosition == .imageOnly {
+ return;
+ }
+
+ var abbrString: String? = nil
+ if controlView.responds(to: #selector(QSSearchObjectView.matchedString)) {
+ abbrString = (controlView as! QSSearchObjectView).matchedString()
+ }
+
+ var nameString: String? = drawObject.displayName()
+ var hitMask: AutoreleasingUnsafeMutablePointer<NSIndexSet?>? = nil
+
+ var ranker = drawObject.ranker()
+ if let ranker, let abbrString {
+ nameString = ranker.matchedString(forAbbreviation: abbrString, hitmask: hitMask, inContext: nil)
+ }
+
+ var rankedStringIsName = nameString == drawObject.displayName()
+ if nameString == nil {
+ nameString = drawObject.identifier() ?? "Unknown"
+ }
+
+ var useAlternateColor = false
+ if let controlView = controlView as? NSTableView {
+ useAlternateColor = controlView.isRowSelected(controlView.row(at: cellFrame.origin))
+ }
+
+ var mainColor: NSColor? = textColor()
+ if mainColor == nil {
+ mainColor = useAlternateColor ? .alternateSelectedControlTextColor : .controlTextColor
+ }
+
+ var fadedColor = mainColor!.withAlphaComponent(0.50)
+ var textDrawRect = titleRect(forBounds: cellFrame)
+
+ var titleString = NSMutableAttributedString(string: nameString!)
+ titleString.setAttributes(rankedStringIsName ? nameAttributes : detailAttributes, 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))
+ } else {
+ var i = 0
+ var j = 0
+ var hits: [Int] = []
+ count = hitMask?.
+ }
+ }
+}
+
+
+ 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)];
+}
+
+@end
+*/
--- /dev/null
+//
+// SearchObjectView.swift
+// Flat Bezel
+//
+// Created by Ruben Beltran del Rio on 2/8/23.
+// Copyright © 2023 BRNBW. All rights reserved.
+//
+/*
+import Foundation
+
+class FlatBezelSearchObjectView: QSSearchObjectView {
+ static func cellClass() -> AnyClass {
+ return FlatBezelObjectCell.self
+ }
+}
+*/