]> git.r.bdr.sh - rbdr/Flat-Bezel.qsplugin/commitdiff
Port BackgroundView to swift, use system darkmode
authorRuben Beltran del Rio <redacted>
Wed, 8 Feb 2023 16:25:34 +0000 (17:25 +0100)
committerRuben Beltran del Rio <redacted>
Wed, 8 Feb 2023 16:25:34 +0000 (17:25 +0100)
Flat Bezel.xcodeproj/project.pbxproj
Flat Bezel/BBBackgroundView.h [deleted file]
Flat Bezel/BBBackgroundView.m [deleted file]
Flat Bezel/BBFlatBezelInterface.m
Flat Bezel/BBFlatBezelInterface.xib
Flat Bezel/BackgroundView.swift [new file with mode: 0644]
Flat Bezel/FlatBezel-Bridging-Header.h [new file with mode: 0644]

index 6c886d5c9e39c082108adbf7825ea198324d6a84..1dc96c05c773774e246b89514f5049a4c5ba8dc7 100644 (file)
@@ -7,11 +7,11 @@
        objects = {
 
 /* Begin PBXBuildFile section */
-               42447D7A193F6C9D0077B4B2 /* BBBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42447D79193F6C9D0077B4B2 /* BBBackgroundView.m */; };
                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 */; };
                E470B7E31709F3A0000169F2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E470B7E21709F3A0000169F2 /* Cocoa.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
-               42447D78193F6C9D0077B4B2 /* BBBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BBBackgroundView.h; sourceTree = "<group>"; };
-               42447D79193F6C9D0077B4B2 /* BBBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BBBackgroundView.m; sourceTree = "<group>"; };
                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>"; };
                E470B7DF1709F3A0000169F2 /* Flat Bezel.qsplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Flat Bezel.qsplugin"; sourceTree = BUILT_PRODUCTS_DIR; };
                        children = (
                                E470B7EA1709F3A0000169F2 /* Configuration */,
                                E470B7E51709F3A0000169F2 /* Supporting Files */,
-                               42447D78193F6C9D0077B4B2 /* BBBackgroundView.h */,
-                               42447D79193F6C9D0077B4B2 /* BBBackgroundView.m */,
                                42447D7B19407DA00077B4B2 /* BBSearchObjectView.h */,
                                42447D7C19407DA00077B4B2 /* BBSearchObjectView.m */,
                                E470B7F61709F3A0000169F2 /* BBFlatBezelInterface.h */,
                                E470B7F71709F3A0000169F2 /* BBFlatBezelInterface.m */,
                                42663057193CC1FA00C0DD31 /* BBFlatBezelInterface.xib */,
+                               B576D2F42993FBD400A8B645 /* BackgroundView.swift */,
                                CD3B1BE1285F2E8C004862D7 /* gear-white.png */,
                                CD3B1BE0285F2E8C004862D7 /* search-white.png */,
                                42447D7F1940935E0077B4B2 /* gear-black.png */,
                        children = (
                                E470B7E61709F3A0000169F2 /* Info.plist */,
                                E470B7E71709F3A0000169F2 /* InfoPlist.strings */,
+                               B576D2F62993FD7500A8B645 /* FlatBezel-Bridging-Header.h */,
                        );
                        name = "Supporting Files";
                        sourceTree = "<group>";
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               42447D7A193F6C9D0077B4B2 /* BBBackgroundView.m in Sources */,
+                               B576D2F52993FBD400A8B645 /* BackgroundView.swift in Sources */,
                                42447D7D19407DA00077B4B2 /* BBSearchObjectView.m in Sources */,
                                E470B7F81709F3A0000169F2 /* BBFlatBezelInterface.m in Sources */,
                        );
                        buildSettings = {
                                CLANG_ENABLE_MODULES = YES;
                                CLANG_ENABLE_OBJC_WEAK = YES;
+                               DEFINES_MODULE = YES;
                                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
                                MACOSX_DEPLOYMENT_TARGET = 12.0;
                                PRODUCT_BUNDLE_IDENTIFIER = "pizza.unlimited.${PRODUCT_NAME:rfc1034identifier}";
                        buildSettings = {
                                CLANG_ENABLE_MODULES = YES;
                                CLANG_ENABLE_OBJC_WEAK = YES;
+                               DEFINES_MODULE = YES;
                                LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
                                MACOSX_DEPLOYMENT_TARGET = 12.0;
                                PRODUCT_BUNDLE_IDENTIFIER = "pizza.unlimited.${PRODUCT_NAME:rfc1034identifier}";
diff --git a/Flat Bezel/BBBackgroundView.h b/Flat Bezel/BBBackgroundView.h
deleted file mode 100644 (file)
index 1c699a2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#import <QSInterface/QSInterface.h>
-
-@interface BBBackgroundView : QSBezelBackgroundView
-
-@end
diff --git a/Flat Bezel/BBBackgroundView.m b/Flat Bezel/BBBackgroundView.m
deleted file mode 100644 (file)
index 7aff10b..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#import "BBBackgroundView.h"
-
-@implementation BBBackgroundView
-
-- (void)drawRect:(NSRect)rect {
-  rect = [self bounds];
-  
-  NSBezierPath *roundRect = [NSBezierPath bezierPath];
-  
-  [roundRect appendBezierPathWithRoundedRectangle:rect withRadius:8];
-  [roundRect addClip];
-  
-  BOOL darkMode = [[NSUserDefaults standardUserDefaults] boolForKey:@"QSFlatBezelDarkMode"];
-  if (darkMode) {
-      [[NSColor colorWithRed:.1 green:.1 blue:.1 alpha:.99] set];
-  } else {
-      [[NSColor colorWithRed:1 green:1 blue:1 alpha:.99] set];
-  }
-  NSRectFill(rect);
-
-  [super drawRect:rect];
-}
-
-@end
index a191f8149056d0f36bde07ba4d8c37e078d556fe..a05a9247df653be82e5438f9b77bbc2f96933f66 100644 (file)
@@ -43,7 +43,7 @@
         [theCell setCellRadiusFactor:8];
       
         [theCell setHighlightColor:[NSColor colorWithRed:1 green:1 blue:1 alpha:.15]];
-        [theCell setTextColor:[NSColor colorWithWhite:.8 alpha:1]];
+        [theCell setTextColor:[NSColor textColor]];
         [theCell setShowDetails:NO];
         [theCell setState:NSControlStateValueOn];
         [theCell setIconSize:QSSize128];
index 75378c660af38fe7d31c7651f28e92bc1018423b..dae62227f4114b5aee9cbebb40cc2fce6bbf5b75 100644 (file)
@@ -25,7 +25,7 @@
             <rect key="contentRect" x="530" y="653" width="648" 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="BBBackgroundView">
+            <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"/>
                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
@@ -85,7 +85,7 @@
                         </constraints>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" state="on" alignment="center" title="⏷" id="214">
                             <font key="font" metaFont="system"/>
-                            <color key="textColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                             <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
diff --git a/Flat Bezel/BackgroundView.swift b/Flat Bezel/BackgroundView.swift
new file mode 100644 (file)
index 0000000..041874a
--- /dev/null
@@ -0,0 +1,31 @@
+//
+//  BBBackgroundView.swift
+//  Flat Bezel
+//
+//  Created by Ruben Beltran del Rio on 2/8/23.
+//  Copyright © 2023 BRNBW. All rights reserved.
+//
+
+import Foundation
+import Cocoa
+
+class BackgroundView: QSBezelBackgroundView {
+  
+  override func draw(_ rect: NSRect) {
+    let boundsRect = self.bounds
+    
+    let roundRect = NSBezierPath()
+    roundRect.appendRoundedRect(boundsRect, xRadius: 8.0, yRadius: 8.0)
+    roundRect.addClip()
+    
+    let darkMode = self.effectiveAppearance.name == .darkAqua
+    if (darkMode) {
+      NSColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.99).setFill()
+    } else {
+      NSColor(red: 1, green: 1, blue: 1, alpha: 0.99).setFill()
+    }
+    boundsRect.fill(using: .copy)
+    
+    super.draw(boundsRect)
+  }
+}
diff --git a/Flat Bezel/FlatBezel-Bridging-Header.h b/Flat Bezel/FlatBezel-Bridging-Header.h
new file mode 100644 (file)
index 0000000..d3e20b0
--- /dev/null
@@ -0,0 +1 @@
+#import "Quicksilver.pch"