Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
043C321427E31FF6006AE443 /* CodeEditDocumentController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043C321327E31FF6006AE443 /* CodeEditDocumentController.swift */; };
043C321627E3201F006AE443 /* WorkspaceDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = 043C321527E3201F006AE443 /* WorkspaceDocument.swift */; };
043C321A27E32295006AE443 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 043C321927E32295006AE443 /* MainMenu.xib */; };
04540D5B27DD08C300E91B77 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2BF0E27DBB28E0024EAB1 /* SettingsView.swift */; };
04540D5C27DD08C300E91B77 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F2BF1127DBB3C10024EAB1 /* GeneralSettingsView.swift */; };
04540D5E27DD08C300E91B77 /* WorkspaceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */; };
04660F6427E3ACAF00477777 /* Appearances.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04660F6327E3ACAF00477777 /* Appearances.swift */; };
Expand All @@ -36,6 +35,10 @@
5C403B8F27E20F8000788241 /* WorkspaceClient in Frameworks */ = {isa = PBXBuildFile; productRef = 5C403B8E27E20F8000788241 /* WorkspaceClient */; };
5CF38A5E27E48E6C0096A0F7 /* CodeFile in Frameworks */ = {isa = PBXBuildFile; productRef = 5CF38A5D27E48E6C0096A0F7 /* CodeFile */; };
5CFA753B27E896B60002F01B /* GitClient in Frameworks */ = {isa = PBXBuildFile; productRef = 5CFA753A27E896B60002F01B /* GitClient */; };
90626FA727EB2FD1008926FE /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = 90626FA627EB2FD1008926FE /* Preferences */; };
90626FA927EB3017008926FE /* PreferencesIdentifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90626FA827EB3017008926FE /* PreferencesIdentifier.swift */; };
90626FAB27EB3254008926FE /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90626FAA27EB3254008926FE /* Theme.swift */; };
90626FB027EB3789008926FE /* ThemeSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90626FAF27EB3789008926FE /* ThemeSettingsView.swift */; };
B658FB3427DA9E1000EA4DBD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3327DA9E1000EA4DBD /* Assets.xcassets */; };
B658FB3727DA9E1000EA4DBD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3627DA9E1000EA4DBD /* Preview Assets.xcassets */; };
B65E614627E6765D00255275 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = B65E614527E6765D00255275 /* Introspect */; };
Expand Down Expand Up @@ -89,7 +92,6 @@
0485EB2227E7791400138301 /* QuickOpenPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickOpenPreviewView.swift; sourceTree = "<group>"; };
04ADA0C827E5D29000BF00B2 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
04ADA0CA27E5D41F00BF00B2 /* be */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = be; path = be.lproj/Localizable.strings; sourceTree = "<group>"; };
04F2BF0E27DBB28E0024EAB1 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
04F2BF1127DBB3C10024EAB1 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
12F71F7127E833A000095416 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
20F8067027E65A5200EB7827 /* af */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = af; path = af.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand All @@ -103,13 +105,16 @@
289978EC27E4E97E00BB0357 /* FileIconStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileIconStyle.swift; sourceTree = "<group>"; };
28B0A19727E385C300B73177 /* NavigatorSidebarToolbarTop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigatorSidebarToolbarTop.swift; sourceTree = "<group>"; };
28FFE1BE27E3A441001939DB /* NavigatorSidebarToolbarBottom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigatorSidebarToolbarBottom.swift; sourceTree = "<group>"; };
2B7C962F27EA5D4000DF58C5 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
2B772A4C27EA6AF800AFCD7E /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };
2B7C962F27EA5D4000DF58C5 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = "<group>"; };
34EE19BD27E0469C00F152CE /* BlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurView.swift; sourceTree = "<group>"; };
5E3C6A3427E72AE000A7CA0D /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };
70F2E28327E848720002BA81 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
7A4D129627E8E7BD00D4AE07 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
85D7EE9527E928B900CB9F10 /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
90626FA827EB3017008926FE /* PreferencesIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesIdentifier.swift; sourceTree = "<group>"; };
90626FAA27EB3254008926FE /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
90626FAF27EB3789008926FE /* ThemeSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeSettingsView.swift; sourceTree = "<group>"; };
B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeEdit.app; sourceTree = BUILT_PRODUCTS_DIR; };
B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceView.swift; sourceTree = "<group>"; };
B658FB3327DA9E1000EA4DBD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -146,6 +151,7 @@
D7F72DEB27EA3574000C3064 /* Search in Frameworks */,
5CFA753B27E896B60002F01B /* GitClient in Frameworks */,
28CE5EA027E6493D0065D29C /* StatusBar in Frameworks */,
90626FA727EB2FD1008926FE /* Preferences in Frameworks */,
5CF38A5E27E48E6C0096A0F7 /* CodeFile in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -185,6 +191,8 @@
04660F6327E3ACAF00477777 /* Appearances.swift */,
04660F6527E3ACEF00477777 /* ReopenBehavior.swift */,
289978EC27E4E97E00BB0357 /* FileIconStyle.swift */,
90626FA827EB3017008926FE /* PreferencesIdentifier.swift */,
90626FAA27EB3254008926FE /* Theme.swift */,
);
path = Models;
sourceTree = "<group>";
Expand All @@ -203,8 +211,8 @@
isa = PBXGroup;
children = (
04660F6227E3ACA300477777 /* Models */,
04F2BF0E27DBB28E0024EAB1 /* SettingsView.swift */,
04F2BF1127DBB3C10024EAB1 /* GeneralSettingsView.swift */,
90626FAF27EB3789008926FE /* ThemeSettingsView.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -373,6 +381,7 @@
0485EB2427E7B9C800138301 /* Overlays */,
5CFA753A27E896B60002F01B /* GitClient */,
D7F72DEA27EA3574000C3064 /* Search */,
90626FA627EB2FD1008926FE /* Preferences */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -460,6 +469,7 @@
mainGroup = B658FB2327DA9E0F00EA4DBD;
packageReferences = (
B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
90626FA527EB2FD1008926FE /* XCRemoteSwiftPackageReference "Preferences" */,
);
productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -547,9 +557,9 @@
2B7A583527E4BA0100D25D4E /* AppDelegate.swift in Sources */,
2875A46D27E3BE5B007805F8 /* BreadcrumbsView.swift in Sources */,
0485EB1D27E7338100138301 /* QuickOpenItem.swift in Sources */,
90626FB027EB3789008926FE /* ThemeSettingsView.swift in Sources */,
D7012EE827E757850001E1EF /* SidebarSearch.swift in Sources */,
D7E201AE27E8B3C000CB86D0 /* String+Ranges.swift in Sources */,
04540D5B27DD08C300E91B77 /* SettingsView.swift in Sources */,
D7E201B027E8C07300CB86D0 /* SearchBar.swift in Sources */,
D72E1A8927E44D7C00EB11B9 /* WelcomeWindowView.swift in Sources */,
04540D5C27DD08C300E91B77 /* GeneralSettingsView.swift in Sources */,
Expand All @@ -562,6 +572,7 @@
D7211D4327E066CE008F2ED7 /* Localized+Ex.swift in Sources */,
D7E201B227E8D50000CB86D0 /* SearchModeSelector.swift in Sources */,
287776E927E34BC700D46668 /* TabBar.swift in Sources */,
90626FAB27EB3254008926FE /* Theme.swift in Sources */,
0485EB1F27E7458B00138301 /* WorkspaceCodeFileView.swift in Sources */,
0485EB1927E70F4900138301 /* QuickOpenView.swift in Sources */,
D7E201BD27EA00E200CB86D0 /* SearchResultFileItem.swift in Sources */,
Expand All @@ -579,6 +590,7 @@
289978ED27E4E97E00BB0357 /* FileIconStyle.swift in Sources */,
04660F6627E3ACEF00477777 /* ReopenBehavior.swift in Sources */,
D72E1A8327E3B0D400EB11B9 /* WelcomeView.swift in Sources */,
90626FA927EB3017008926FE /* PreferencesIdentifier.swift in Sources */,
043C321627E3201F006AE443 /* WorkspaceDocument.swift in Sources */,
28B0A19827E385C300B73177 /* NavigatorSidebarToolbarTop.swift in Sources */,
28FFE1BF27E3A441001939DB /* NavigatorSidebarToolbarBottom.swift in Sources */,
Expand Down Expand Up @@ -956,6 +968,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
90626FA527EB2FD1008926FE /* XCRemoteSwiftPackageReference "Preferences" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/Preferences";
requirement = {
branch = main;
kind = branch;
};
};
B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect";
Expand Down Expand Up @@ -987,6 +1007,11 @@
isa = XCSwiftPackageProductDependency;
productName = GitClient;
};
90626FA627EB2FD1008926FE /* Preferences */ = {
isa = XCSwiftPackageProductDependency;
package = 90626FA527EB2FD1008926FE /* XCRemoteSwiftPackageReference "Preferences" */;
productName = Preferences;
};
B65E614527E6765D00255275 /* Introspect */ = {
isa = XCSwiftPackageProductDependency;
package = B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
Expand Down
11 changes: 10 additions & 1 deletion CodeEdit.xcworkspace/xcshareddata/swiftpm/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 35 additions & 19 deletions CodeEdit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import Preferences

class CodeEditApplication: NSApplication {
let strongDelegate = AppDelegate()
Expand Down Expand Up @@ -86,27 +87,42 @@ class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
}

// MARK: - Open windows
private lazy var preferencesWindowController = PreferencesWindowController(
panes: [
Preferences.Pane(
identifier: Preferences.PaneIdentifier.general,
title: "General",
toolbarIcon: NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
) {
GeneralSettingsView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier.theme,
title: "Theme",
toolbarIcon: NSImage(systemSymbolName: "paintbrush", accessibilityDescription: nil)!
) {
ThemeSettingsView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier.execution,
title: "Execution",
toolbarIcon: NSImage(systemSymbolName: "arrowtriangle.forward", accessibilityDescription: nil)!
) {
GeneralSettingsView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier.extension,
title: "Extension",
toolbarIcon: NSImage(systemSymbolName: "shippingbox", accessibilityDescription: nil)!
) {
GeneralSettingsView()
},
]
)

@IBAction func openPreferences(_ sender: Any) {
if let window = NSApp.windows.filter({ window in
return (window.contentView as? NSHostingView<SettingsView>) != nil
}).first {
window.makeKeyAndOrderFront(self)
return
}

let window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 500, height: 400),
styleMask: [.titled, .closable],
backing: .buffered, defer: false)
window.center()
window.toolbar = NSToolbar()
window.title = "Settings"
window.toolbarStyle = .unifiedCompact
_ = NSWindowController(window: window)
let contentView = SettingsView()
window.contentView = NSHostingView(rootView: contentView)
window.makeKeyAndOrderFront(sender)
preferencesWindowController.show()
preferencesWindowController.window?.center()
}

@IBAction func openWelcome(_ sender: Any) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions CodeEdit/Assets.xcassets/Agate.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions CodeEdit/Assets.xcassets/Ocean.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "CleanShot 2022-03-23 at [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 8 additions & 3 deletions CodeEdit/Settings/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ struct GeneralSettingsView: View {
.onChange(of: appearance) { tag in
tag.applyAppearance()
}
.fixedSize()

Picker("File Icon Style".localized(), selection: $fileIconStyle) {
Text("Color".localized())
.tag(FileIconStyle.color)
Text("Monochrome".localized())
.tag(FileIconStyle.monochrome)
}
.fixedSize()

Picker("Reopen Behavior".localized(), selection: $reopenBehavior) {
Text("Welcome Screen".localized())
Expand All @@ -49,6 +51,7 @@ struct GeneralSettingsView: View {
Text("New Document".localized())
.tag(ReopenBehavior.newDocument)
}
.fixedSize()

Picker("Editor Theme".localized(), selection: $editorTheme) {
Text("Atelier Savanna (Auto)")
Expand All @@ -57,14 +60,12 @@ struct GeneralSettingsView: View {
.tag(CodeFileView.Theme.atelierSavannaDark)
Text("Atelier Savanna Light")
.tag(CodeFileView.Theme.atelierSavannaLight)
// TODO: Pojoaque does not seem to work (does not change from previous selection)
// Text("Pojoaque")
// .tag(CodeEditor.ThemeName.pojoaque)
Text("Agate")
.tag(CodeFileView.Theme.agate)
Text("Ocean")
.tag(CodeFileView.Theme.ocean)
}
.fixedSize()

Picker("Terminal Shell".localized(), selection: $shellType) {
Text("System Default".localized())
Expand All @@ -74,7 +75,11 @@ struct GeneralSettingsView: View {
Text("Bash")
.tag(TerminalShellType.bash)
}
.fixedSize()

Spacer()
}
.frame(width: 820, height: 450)
.padding()
}
}
Expand Down
15 changes: 15 additions & 0 deletions CodeEdit/Settings/Models/PreferencesIdentifier.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// PreferencesIdentifier.swift
// CodeEdit
//
// Created by 朱浩宇 on 2022/3/23.
//

import Preferences

extension Preferences.PaneIdentifier {
static let general = Self("general")
static let theme = Self("Theme")
static let execution = Self("execution")
static let `extension` = Self("extension")
}
Loading