Skip to content

Commit 4005f22

Browse files
committed
XPC service splitted into two services.
1 parent 4893dbd commit 4005f22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2302
-1437
lines changed

Application/AppDelegate.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4242
return service
4343
}()
4444

45+
private (set) var documentsOpenedAtStart = false
4546
private var firstAppear = false
4647
func applicationDidFinishLaunching(_ aNotification: Notification) {
4748
// Insert code here to initialize your application
@@ -58,15 +59,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5859
}
5960

6061
func applicationDidBecomeActive(_ notification: Notification) {
61-
if firstAppear, NSApplication.shared.windows.first(where: { $0.contentViewController is ViewController }) == nil, let menu = NSApp.menu?.item(at: 0)?.submenu?.item(withTag: 100), let a = menu.action {
62-
// Open the settings window if there are no windows opened.
63-
NSApp.sendAction(a, to: menu.target, from: menu)
62+
if firstAppear {
63+
if NSApplication.shared.windows.first(where: { $0.contentViewController is ViewController }) == nil, let menu = NSApp.menu?.item(at: 0)?.submenu?.item(withTag: 100), let a = menu.action {
64+
// Open the settings window if there are no windows opened.
65+
NSApp.sendAction(a, to: menu.target, from: menu)
66+
documentsOpenedAtStart = false
67+
} else {
68+
documentsOpenedAtStart = true
69+
}
6470
}
6571
firstAppear = false
6672
}
6773

6874
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
69-
return false
75+
return true
7076
}
7177

7278
/// Get the url of the quicklook extension.

Application/Base.lproj/Main.storyboard

Lines changed: 70 additions & 65 deletions
Large diffs are not rendered by default.

Application/CSSControlView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ class CSSControlView: NSViewController {
5252
override func viewDidLoad() {
5353
warningMessage.isHidden = isUTIWarningHidden
5454
textView?.string = cssCode
55+
56+
textView.font = NSFont.monospacedSystemFont(ofSize: 11, weight: NSFont.Weight.regular)
57+
textView.textColor = NSColor.textColor
58+
textView.backgroundColor = NSColor.textBackgroundColor
5559
}
5660
}

Application/InfoHighlightController.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ class InfoHighlightController: NSViewController {
3535
override func viewDidLoad() {
3636
super.viewDidLoad()
3737
textView.string = text
38-
if #available(OSX 10.15, *) {
39-
textView.font = NSFont.monospacedSystemFont(ofSize: 11, weight: NSFont.Weight.regular)
40-
} else {
41-
// Fallback on earlier versions
42-
textView.font = NSFont(name: "Menlo", size: 11) ?? NSFont.systemFont(ofSize: 11)
43-
}
38+
textView.font = NSFont.monospacedSystemFont(ofSize: 11, weight: NSFont.Weight.regular)
39+
textView.textColor = NSColor.textColor
40+
textView.backgroundColor = NSColor.textBackgroundColor
4441

4542
if text.isEmpty {
4643
progressIndicator.startAnimation(self)

Application/NSColor+ext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extension NSColor {
4141
let red = CGFloat((theInt & 0xFF0000) >> 16) / 255.0
4242
let green = CGFloat((theInt & 0xFF00) >> 8) / 255.0
4343
let blue = CGFloat((theInt & 0xFF)) / 255.0
44-
self.init(calibratedRed: red, green: green, blue: blue, alpha: alpha)
44+
self.init(srgbRed: red, green: green, blue: blue, alpha: alpha)
4545
} else {
4646
return nil
4747
}

Application/PreferencesViewController.swift

Lines changed: 77 additions & 45 deletions
Large diffs are not rendered by default.

Application/SyntaxHighlight.help/Contents/Resources/English.lproj/index.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
<a name="SyntaxHighlight_INDEX"></a>
1515
<h1>Syntax Highlight</h1>
1616

17-
<p>This application offers a quicklook extension for MacOS 10.15 Catalina for previewing source files.
18-
It's based on the <a href="https://github.com/anthonygelibert/QLColorCode">anthonygelibert/QLColorCode</a>.<br />
17+
<p>This application offers a quicklook extension for MacOS 10.15 Catalina for previewing source files.<br />
1918
Inside it uses <a href="http://www.andre-simon.de/doku/highlight/en/highlight.php">Highlight</a> to render source code with syntax highlighting. <br />
2019
The application is distributed with a version of the <code>highlight</code>. If you want you can use a different version customizing the preferences.</p>
2120

@@ -64,6 +63,11 @@ <h2><a name="SyntaxHighlight_UTI"></a>File format management</h2>
6463
<pre>$ mdls -name kMDItemContentType -name kMDItemContentTypeTree filename.ext</pre>
6564

6665
<p>If you found an unhandled format please send me the output of above command.</p>
66+
<p><b>Only the formats supported by <code>highlight</code> can be managed by this application.</b></p>
67+
68+
<p>To view the info about <code>highlight</code> with the supported file formats and extensions go to the menu <code>Syntax Highlight/About highlight…</code>, or in the Preferences window click the <i>i</i> info button near the highlight popup button.</p>
69+
<div><img src="images/about_highlight.png" alt="About highlight info panel."></div>
70+
6771
<br />
6872
<hr />
6973

@@ -73,6 +77,10 @@ <h2><a name="SyntaxHighlight_UTI"></a>File format management</h2>
7377
<li><a href="help:anchor=SyntaxHighlight_CUSTOMCSS bookID=org.sbarex.SourceCodeSyntaxHighlight.help">Custom style sheet</a></li>
7478
<li><a href="help:anchor=SyntaxHighlight_THEMES bookID=org.sbarex.SourceCodeSyntaxHighlight.help">Theme editor</a></li>
7579
</ul>
80+
81+
82+
<h2>Credits</h2>
83+
<p>This application has originated from the <a href="https://github.com/anthonygelibert/QLColorCode">anthonygelibert/QLColorCode</a>.</p>
7684

7785
<br />
7886

Application/ThemesViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class ThemesViewController: NSViewController {
200200
/// Show a file.
201201
var settings: [String: Any] = [
202202
SCSHSettings.Key.theme: theme.name,
203-
SCSHSettings.Key.inline_theme: theme.toDictionary(),
203+
SCSHSettings.Key.inlineTheme: theme.toDictionary(),
204204
SCSHSettings.Key.renderForExtension: false,
205205
SCSHSettings.Key.lineNumbers: true,
206206
SCSHSettings.Key.customCSS: "* { box-sizing: border-box; } html, body { height: 100%; margin: 0; } body { padding: 0; }"

0 commit comments

Comments
 (0)