diff --git a/CodeEdit.xcodeproj/project.pbxproj b/CodeEdit.xcodeproj/project.pbxproj index 1d8e4c58b4..32cbef3c79 100644 --- a/CodeEdit.xcodeproj/project.pbxproj +++ b/CodeEdit.xcodeproj/project.pbxproj @@ -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 */; }; @@ -26,7 +25,6 @@ 2813F93927ECC4C300E305E4 /* NavigatorSidebar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287776E627E3413200D46668 /* NavigatorSidebar.swift */; }; 2813F93A27ECC4CC00E305E4 /* ProjectNavigatorItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 287776EC27E350D800D46668 /* ProjectNavigatorItem.swift */; }; 2859B93F27EB50050069BE88 /* FontPicker in Frameworks */ = {isa = PBXBuildFile; productRef = 2859B93E27EB50050069BE88 /* FontPicker */; }; - 2859B94127EB5BC00069BE88 /* TerminalSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2859B94027EB5BC00069BE88 /* TerminalSettingsView.swift */; }; 286471AB27ED51FD0039369D /* ProjectNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 286471AA27ED51FD0039369D /* ProjectNavigator.swift */; }; 286620A527E4AB6900E18C2B /* BreadcrumbsComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 286620A427E4AB6900E18C2B /* BreadcrumbsComponent.swift */; }; 2875A46D27E3BE5B007805F8 /* BreadcrumbsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2875A46C27E3BE5B007805F8 /* BreadcrumbsView.swift */; }; @@ -41,6 +39,17 @@ 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 */; }; + 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 */; }; + 90626FC527EB5EDD008926FE /* ExecutionSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90626FC427EB5EDD008926FE /* ExecutionSettingsView.swift */; }; + 90626FC727EB5F31008926FE /* ExtensionsSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90626FC627EB5F31008926FE /* ExtensionsSettingsView.swift */; }; + 907A4FAB27F32C0C00EC87A1 /* Color+Focused.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907A4FA927F32C0C00EC87A1 /* Color+Focused.swift */; }; + 907A4FAC27F32C0C00EC87A1 /* NSImage+TintColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907A4FAA27F32C0C00EC87A1 /* NSImage+TintColor.swift */; }; + 907A4FAE27F32E3B00EC87A1 /* View+Form.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907A4FAD27F32E3B00EC87A1 /* View+Form.swift */; }; + 907A4FB027F32FFD00EC87A1 /* TerminalSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907A4FAF27F32FFD00EC87A1 /* TerminalSettingsView.swift */; }; + 908165E227EC8F000079F5D9 /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = 908165E127EC8F000079F5D9 /* Preferences */; }; + 90BBEF2727EDCF1B004BF43C /* Preferences in Frameworks */ = {isa = PBXBuildFile; productRef = 90BBEF2627EDCF1B004BF43C /* Preferences */; }; 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 */; }; @@ -91,10 +100,8 @@ 0485EB1C27E7338100138301 /* QuickOpenItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickOpenItem.swift; sourceTree = ""; }; 0485EB1E27E7458B00138301 /* WorkspaceCodeFileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WorkspaceCodeFileView.swift; sourceTree = ""; }; 0485EB2227E7791400138301 /* QuickOpenPreviewView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = QuickOpenPreviewView.swift; sourceTree = ""; tabWidth = 4; }; - 04F2BF0E27DBB28E0024EAB1 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 04F2BF1127DBB3C10024EAB1 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = ""; tabWidth = 4; }; 2806CBD327EE9FC0003E5523 /* ProjectNavigatorContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectNavigatorContextMenu.swift; sourceTree = ""; }; - 2859B94027EB5BC00069BE88 /* TerminalSettingsView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = TerminalSettingsView.swift; sourceTree = ""; tabWidth = 4; }; 286471AA27ED51FD0039369D /* ProjectNavigator.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = ProjectNavigator.swift; sourceTree = ""; tabWidth = 4; }; 286620A427E4AB6900E18C2B /* BreadcrumbsComponent.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = BreadcrumbsComponent.swift; sourceTree = ""; tabWidth = 4; }; 2875A46C27E3BE5B007805F8 /* BreadcrumbsView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = BreadcrumbsView.swift; sourceTree = ""; tabWidth = 4; }; @@ -106,6 +113,19 @@ 28B0A19727E385C300B73177 /* NavigatorSidebarToolbarTop.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = NavigatorSidebarToolbarTop.swift; sourceTree = ""; tabWidth = 4; }; 28FFE1BE27E3A441001939DB /* NavigatorSidebarToolbarBottom.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = NavigatorSidebarToolbarBottom.swift; sourceTree = ""; tabWidth = 4; }; 34EE19BD27E0469C00F152CE /* BlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurView.swift; sourceTree = ""; }; + 90626FA827EB3017008926FE /* PreferencesIdentifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesIdentifier.swift; sourceTree = ""; }; + 90626FAA27EB3254008926FE /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = ""; }; + 90626FAF27EB3789008926FE /* ThemeSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeSettingsView.swift; sourceTree = ""; }; + 90626FC427EB5EDD008926FE /* ExecutionSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExecutionSettingsView.swift; sourceTree = ""; }; + 90626FC627EB5F31008926FE /* ExtensionsSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionsSettingsView.swift; sourceTree = ""; }; + 907A4F9327EEDAF200EC87A1 /* CEColorPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CEColorPicker.swift; sourceTree = ""; }; + 907A4F9B27EEED1600EC87A1 /* NSImage+TintColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSImage+TintColor.swift"; sourceTree = ""; }; + 907A4FA927F32C0C00EC87A1 /* Color+Focused.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Color+Focused.swift"; sourceTree = ""; }; + 907A4FAA27F32C0C00EC87A1 /* NSImage+TintColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSImage+TintColor.swift"; sourceTree = ""; }; + 907A4FAD27F32E3B00EC87A1 /* View+Form.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Form.swift"; sourceTree = ""; }; + 907A4FAF27F32FFD00EC87A1 /* TerminalSettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TerminalSettingsView.swift; sourceTree = ""; }; + 90BBEF2927EDD9AC004BF43C /* Color+Focused.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Focused.swift"; sourceTree = ""; }; + 90BBEF2C27EED686004BF43C /* ColorChoose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorChoose.swift; sourceTree = ""; }; B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeEdit.app; sourceTree = BUILT_PRODUCTS_DIR; }; B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceView.swift; sourceTree = ""; tabWidth = 4; }; B658FB3327DA9E1000EA4DBD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -135,11 +155,13 @@ buildActionMask = 2147483647; files = ( 5C403B8F27E20F8000788241 /* WorkspaceClient in Frameworks */, + 908165E227EC8F000079F5D9 /* Preferences in Frameworks */, 0485EB2527E7B9C800138301 /* Overlays in Frameworks */, B65E614627E6765D00255275 /* Introspect in Frameworks */, D70F5E2C27E4E8CF004EE4B9 /* WelcomeModule in Frameworks */, 2859B93F27EB50050069BE88 /* FontPicker in Frameworks */, D7F72DEB27EA3574000C3064 /* Search in Frameworks */, + 90BBEF2727EDCF1B004BF43C /* Preferences in Frameworks */, 5CFA753B27E896B60002F01B /* GitClient in Frameworks */, 28CE5EA027E6493D0065D29C /* StatusBar in Frameworks */, 5CF38A5E27E48E6C0096A0F7 /* CodeFile in Frameworks */, @@ -181,6 +203,8 @@ 04660F6327E3ACAF00477777 /* Appearances.swift */, 04660F6527E3ACEF00477777 /* ReopenBehavior.swift */, 289978EC27E4E97E00BB0357 /* FileIconStyle.swift */, + 90626FA827EB3017008926FE /* PreferencesIdentifier.swift */, + 90626FAA27EB3254008926FE /* Theme.swift */, ); path = Models; sourceTree = ""; @@ -199,9 +223,11 @@ isa = PBXGroup; children = ( 04660F6227E3ACA300477777 /* Models */, - 04F2BF0E27DBB28E0024EAB1 /* SettingsView.swift */, 04F2BF1127DBB3C10024EAB1 /* GeneralSettingsView.swift */, - 2859B94027EB5BC00069BE88 /* TerminalSettingsView.swift */, + 907A4FAF27F32FFD00EC87A1 /* TerminalSettingsView.swift */, + 90626FAF27EB3789008926FE /* ThemeSettingsView.swift */, + 90626FC427EB5EDD008926FE /* ExecutionSettingsView.swift */, + 90626FC627EB5F31008926FE /* ExtensionsSettingsView.swift */, ); path = Settings; sourceTree = ""; @@ -261,12 +287,34 @@ name = Frameworks; sourceTree = ""; }; + 907A4F9F27F32AE700EC87A1 /* Recovered References */ = { + isa = PBXGroup; + children = ( + 90BBEF2927EDD9AC004BF43C /* Color+Focused.swift */, + 907A4F9B27EEED1600EC87A1 /* NSImage+TintColor.swift */, + 90BBEF2C27EED686004BF43C /* ColorChoose.swift */, + 907A4F9327EEDAF200EC87A1 /* CEColorPicker.swift */, + ); + name = "Recovered References"; + sourceTree = ""; + }; + 907A4FA827F32C0C00EC87A1 /* Extensions */ = { + isa = PBXGroup; + children = ( + 907A4FA927F32C0C00EC87A1 /* Color+Focused.swift */, + 907A4FAA27F32C0C00EC87A1 /* NSImage+TintColor.swift */, + 907A4FAD27F32E3B00EC87A1 /* View+Form.swift */, + ); + path = Extensions; + sourceTree = ""; + }; B658FB2327DA9E0F00EA4DBD = { isa = PBXGroup; children = ( B658FB2E27DA9E0F00EA4DBD /* CodeEdit */, B658FB2D27DA9E0F00EA4DBD /* Products */, 5C403B8D27E20F8000788241 /* Frameworks */, + 907A4F9F27F32AE700EC87A1 /* Recovered References */, ); indentWidth = 4; sourceTree = ""; @@ -285,6 +333,7 @@ B658FB2E27DA9E0F00EA4DBD /* CodeEdit */ = { isa = PBXGroup; children = ( + 907A4FA827F32C0C00EC87A1 /* Extensions */, 2875A46E27E3BE63007805F8 /* Breadcrumbs */, 34EE19BC27E0467F00F152CE /* CustomViews */, 043C321227E31FE8006AE443 /* Documents */, @@ -383,6 +432,8 @@ 5CFA753A27E896B60002F01B /* GitClient */, D7F72DEA27EA3574000C3064 /* Search */, 2859B93E27EB50050069BE88 /* FontPicker */, + 908165E127EC8F000079F5D9 /* Preferences */, + 90BBEF2627EDCF1B004BF43C /* Preferences */, ); productName = CodeEdit; productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */; @@ -458,6 +509,7 @@ mainGroup = B658FB2327DA9E0F00EA4DBD; packageReferences = ( B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */, + 90BBEF2527EDCF1B004BF43C /* XCRemoteSwiftPackageReference "Preferences" */, ); productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */; projectDirPath = ""; @@ -549,9 +601,14 @@ 2B7A583527E4BA0100D25D4E /* AppDelegate.swift in Sources */, 2875A46D27E3BE5B007805F8 /* BreadcrumbsView.swift in Sources */, 0485EB1D27E7338100138301 /* QuickOpenItem.swift in Sources */, + 90626FC727EB5F31008926FE /* ExtensionsSettingsView.swift in Sources */, + 90626FB027EB3789008926FE /* ThemeSettingsView.swift in Sources */, + D7012EE827E757850001E1EF /* FindNavigator.swift in Sources */, + D7E201AE27E8B3C000CB86D0 /* String+Ranges.swift in Sources */, + D7E201B027E8C07300CB86D0 /* FindNavigatorSearchBar.swift in Sources */, D7012EE827E757850001E1EF /* FindNavigator.swift in Sources */, + 907A4FB027F32FFD00EC87A1 /* TerminalSettingsView.swift in Sources */, D7E201AE27E8B3C000CB86D0 /* String+Ranges.swift in Sources */, - 04540D5B27DD08C300E91B77 /* SettingsView.swift in Sources */, D7E201B027E8C07300CB86D0 /* FindNavigatorSearchBar.swift in Sources */, D72E1A8927E44D7C00EB11B9 /* WelcomeWindowView.swift in Sources */, 04540D5C27DD08C300E91B77 /* GeneralSettingsView.swift in Sources */, @@ -559,24 +616,30 @@ B673FDAD27E8296A00795864 /* PressActionsModifier.swift in Sources */, 043C321427E31FF6006AE443 /* CodeEditDocumentController.swift in Sources */, 04660F6427E3ACAF00477777 /* Appearances.swift in Sources */, - 2859B94127EB5BC00069BE88 /* TerminalSettingsView.swift in Sources */, 04540D5E27DD08C300E91B77 /* WorkspaceView.swift in Sources */, 34EE19BE27E0469C00F152CE /* BlurView.swift in Sources */, D7211D4327E066CE008F2ED7 /* Localized+Ex.swift in Sources */, D7E201B227E8D50000CB86D0 /* FindNavigatorModeSelector.swift in Sources */, 287776E927E34BC700D46668 /* TabBar.swift in Sources */, + 90626FAB27EB3254008926FE /* Theme.swift in Sources */, 0485EB1F27E7458B00138301 /* WorkspaceCodeFileView.swift in Sources */, 0485EB1927E70F4900138301 /* QuickOpenView.swift in Sources */, + D7E201BD27EA00E200CB86D0 /* FindNavigatorResultFileItem.swift in Sources */, + 90626FC527EB5EDD008926FE /* ExecutionSettingsView.swift in Sources */, + 907A4FAC27F32C0C00EC87A1 /* NSImage+TintColor.swift in Sources */, 286471AB27ED51FD0039369D /* ProjectNavigator.swift in Sources */, D7E201BD27EA00E200CB86D0 /* FindNavigatorResultFileItem.swift in Sources */, 286620A527E4AB6900E18C2B /* BreadcrumbsComponent.swift in Sources */, 287776EF27E3515300D46668 /* TabBarItem.swift in Sources */, D72E1A8727E4242900EB11B9 /* RecentProjectsView.swift in Sources */, + 907A4FAB27F32C0C00EC87A1 /* Color+Focused.swift in Sources */, 04660F6A27E51E5C00477777 /* CodeEditWindowController.swift in Sources */, B6EE989027E8879A00CDD8AB /* InspectorSidebar.swift in Sources */, 289978ED27E4E97E00BB0357 /* FileIconStyle.swift in Sources */, 04660F6627E3ACEF00477777 /* ReopenBehavior.swift in Sources */, D72E1A8327E3B0D400EB11B9 /* WelcomeView.swift in Sources */, + 90626FA927EB3017008926FE /* PreferencesIdentifier.swift in Sources */, + 907A4FAE27F32E3B00EC87A1 /* View+Form.swift in Sources */, 043C321627E3201F006AE443 /* WorkspaceDocument.swift in Sources */, 28B0A19827E385C300B73177 /* NavigatorSidebarToolbarTop.swift in Sources */, 28FFE1BF27E3A441001939DB /* NavigatorSidebarToolbarBottom.swift in Sources */, @@ -942,6 +1005,14 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ + 90BBEF2527EDCF1B004BF43C /* XCRemoteSwiftPackageReference "Preferences" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/underthestars-zhy/Preferences"; + requirement = { + branch = main; + kind = branch; + }; + }; B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/siteline/SwiftUI-Introspect"; @@ -977,6 +1048,15 @@ isa = XCSwiftPackageProductDependency; productName = GitClient; }; + 908165E127EC8F000079F5D9 /* Preferences */ = { + isa = XCSwiftPackageProductDependency; + productName = Preferences; + }; + 90BBEF2627EDCF1B004BF43C /* Preferences */ = { + isa = XCSwiftPackageProductDependency; + package = 90BBEF2527EDCF1B004BF43C /* XCRemoteSwiftPackageReference "Preferences" */; + productName = Preferences; + }; B65E614527E6765D00255275 /* Introspect */ = { isa = XCSwiftPackageProductDependency; package = B65E614427E6765D00255275 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */; diff --git a/CodeEdit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CodeEdit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000000..ba59d6f7f7 --- /dev/null +++ b/CodeEdit.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "swiftui-introspect", + "kind" : "remoteSourceControl", + "location" : "https://github.com/siteline/SwiftUI-Introspect", + "state" : { + "revision" : "f2616860a41f9d9932da412a8978fec79c06fe24", + "version" : "0.1.4" + } + } + ], + "version" : 2 +} diff --git a/CodeEdit.xcworkspace/xcshareddata/swiftpm/Package.resolved b/CodeEdit.xcworkspace/xcshareddata/swiftpm/Package.resolved index 408cdae738..d88b72b286 100644 --- a/CodeEdit.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/CodeEdit.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -3,13 +3,22 @@ "pins": [ { "package": "Highlightr", - "repositoryURL": "https://github.com/raspu/Highlightr.git", + "repositoryURL": "https://github.com/raspu/Highlightr", "state": { "branch": null, "revision": "93199b9e434f04bda956a613af8f571933f9f037", "version": "2.1.2" } }, + { + "package": "Preferences", + "repositoryURL": "https://github.com/underthestars-zhy/Preferences", + "state": { + "branch": "main", + "revision": "3bdbafbad722aa6fc43211fcb01e634b31978f47", + "version": null + } + }, { "package": "SnapshotTesting", "repositoryURL": "https://github.com/pointfreeco/swift-snapshot-testing.git", diff --git a/CodeEdit/AppDelegate.swift b/CodeEdit/AppDelegate.swift index 452bc3dad1..04b8137604 100644 --- a/CodeEdit/AppDelegate.swift +++ b/CodeEdit/AppDelegate.swift @@ -6,6 +6,7 @@ // import SwiftUI +import Preferences class CodeEditApplication: NSApplication { let strongDelegate = AppDelegate() @@ -105,27 +106,49 @@ 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.terminal, + title: "Terminal", + toolbarIcon: NSImage(systemSymbolName: "terminal", accessibilityDescription: nil)! + ) { + TerminalSettingsView() + }, + Preferences.Pane( + identifier: Preferences.PaneIdentifier.execution, + title: "Execution", + toolbarIcon: NSImage(systemSymbolName: "arrowtriangle.forward", accessibilityDescription: nil)! + ) { + ExecutionSettingsView() + }, + Preferences.Pane( + identifier: Preferences.PaneIdentifier.extension, + title: "Extensions", + toolbarIcon: NSImage(systemSymbolName: "shippingbox", accessibilityDescription: nil)! + ) { + ExtensionsSettingsView() + }, + ] + ) @IBAction func openPreferences(_ sender: Any) { - if let window = NSApp.windows.filter({ window in - return (window.contentView as? NSHostingView) != 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) { diff --git a/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-1.png b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-1.png new file mode 100644 index 0000000000..4ae190b42e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-1.png differ diff --git a/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-2.png b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-2.png new file mode 100644 index 0000000000..4ae190b42e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x-2.png differ diff --git a/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x.png b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x.png new file mode 100644 index 0000000000..4ae190b42e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Agate.imageset/CleanShot 2022-03-23 at 18.58.14@2x.png differ diff --git a/CodeEdit/Assets.xcassets/Agate.imageset/Contents.json b/CodeEdit/Assets.xcassets/Agate.imageset/Contents.json new file mode 100644 index 0000000000..d8daef4ccc --- /dev/null +++ b/CodeEdit/Assets.xcassets/Agate.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "CleanShot 2022-03-23 at 18.58.14@2x-1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.58.14@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.58.14@2x-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-1.png b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-1.png new file mode 100644 index 0000000000..c5b787fd1a Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-1.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-2.png b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-2.png new file mode 100644 index 0000000000..c5b787fd1a Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x-2.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x.png b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x.png new file mode 100644 index 0000000000..c5b787fd1a Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/CleanShot 2022-03-23 at 18.55.38@2x.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/Contents.json b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/Contents.json new file mode 100644 index 0000000000..8e6127fda8 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Atelier Savanna Dark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "CleanShot 2022-03-23 at 18.55.38@2x-1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.55.38@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.55.38@2x-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-1.png b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-1.png new file mode 100644 index 0000000000..047fe034cd Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-1.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-2.png b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-2.png new file mode 100644 index 0000000000..047fe034cd Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x-2.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x.png b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x.png new file mode 100644 index 0000000000..047fe034cd Binary files /dev/null and b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/CleanShot 2022-03-23 at 18.56.54@2x.png differ diff --git a/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/Contents.json b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/Contents.json new file mode 100644 index 0000000000..30acc25968 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Atelier Savanna Light.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "CleanShot 2022-03-23 at 18.56.54@2x-1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.56.54@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.56.54@2x-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-1.svg b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-1.svg new file mode 100644 index 0000000000..f22564ce5c --- /dev/null +++ b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-2.svg b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-2.svg new file mode 100644 index 0000000000..f22564ce5c --- /dev/null +++ b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault-2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault.svg b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault.svg new file mode 100644 index 0000000000..f22564ce5c --- /dev/null +++ b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/ColorPickerDefault.svg @@ -0,0 +1,4 @@ + + + + diff --git a/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/Contents.json b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/Contents.json new file mode 100644 index 0000000000..fccb944591 --- /dev/null +++ b/CodeEdit/Assets.xcassets/ColorPickerDefault.imageset/Contents.json @@ -0,0 +1,27 @@ +{ + "images" : [ + { + "filename" : "ColorPickerDefault.svg", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ColorPickerDefault-1.svg", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ColorPickerDefault-2.svg", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + }, + "properties" : { + "preserves-vector-representation" : true, + "template-rendering-intent" : "template" + } +} diff --git a/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-1.png b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-1.png new file mode 100644 index 0000000000..3c8f975f6e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-1.png differ diff --git a/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-2.png b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-2.png new file mode 100644 index 0000000000..3c8f975f6e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x-2.png differ diff --git a/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x.png b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x.png new file mode 100644 index 0000000000..3c8f975f6e Binary files /dev/null and b/CodeEdit/Assets.xcassets/Ocean.imageset/CleanShot 2022-03-23 at 18.57.32@2x.png differ diff --git a/CodeEdit/Assets.xcassets/Ocean.imageset/Contents.json b/CodeEdit/Assets.xcassets/Ocean.imageset/Contents.json new file mode 100644 index 0000000000..3aab78fba9 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Ocean.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "CleanShot 2022-03-23 at 18.57.32@2x-1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.57.32@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "CleanShot 2022-03-23 at 18.57.32@2x-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Contents.json b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Contents.json new file mode 100644 index 0000000000..6e0ba9b288 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Settings Image - Auto.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Settings Image - Auto-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Settings Image - Auto-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-1.png b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-1.png new file mode 100644 index 0000000000..3d49523b54 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-1.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-2.png b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-2.png new file mode 100644 index 0000000000..3d49523b54 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto-2.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto.png b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto.png new file mode 100644 index 0000000000..3d49523b54 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Auto.imageset/Settings Image - Auto.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Contents.json b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Contents.json new file mode 100644 index 0000000000..8b06ba8041 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Settings Image - Dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Settings Image - Dark-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Settings Image - Dark-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-1.png b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-1.png new file mode 100644 index 0000000000..f98ec6f2c8 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-1.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-2.png b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-2.png new file mode 100644 index 0000000000..f98ec6f2c8 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark-2.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark.png b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark.png new file mode 100644 index 0000000000..f98ec6f2c8 Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Dark.imageset/Settings Image - Dark.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Contents.json b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Contents.json new file mode 100644 index 0000000000..95e7d2d693 --- /dev/null +++ b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Settings Image - Light.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Settings Image - Light-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Settings Image - Light-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-1.png b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-1.png new file mode 100644 index 0000000000..a67ba49eda Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-1.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-2.png b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-2.png new file mode 100644 index 0000000000..a67ba49eda Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light-2.png differ diff --git a/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light.png b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light.png new file mode 100644 index 0000000000..a67ba49eda Binary files /dev/null and b/CodeEdit/Assets.xcassets/Settings Image - Light.imageset/Settings Image - Light.png differ diff --git a/CodeEdit/Assets.xcassets/new dark.imageset/Contents.json b/CodeEdit/Assets.xcassets/new dark.imageset/Contents.json new file mode 100644 index 0000000000..6e6c256ba4 --- /dev/null +++ b/CodeEdit/Assets.xcassets/new dark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "new dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "new dark-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "new dark-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/new dark.imageset/new dark-1.png b/CodeEdit/Assets.xcassets/new dark.imageset/new dark-1.png new file mode 100644 index 0000000000..a7e47e8d16 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new dark.imageset/new dark-1.png differ diff --git a/CodeEdit/Assets.xcassets/new dark.imageset/new dark-2.png b/CodeEdit/Assets.xcassets/new dark.imageset/new dark-2.png new file mode 100644 index 0000000000..a7e47e8d16 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new dark.imageset/new dark-2.png differ diff --git a/CodeEdit/Assets.xcassets/new dark.imageset/new dark.png b/CodeEdit/Assets.xcassets/new dark.imageset/new dark.png new file mode 100644 index 0000000000..a7e47e8d16 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new dark.imageset/new dark.png differ diff --git a/CodeEdit/Assets.xcassets/new light.imageset/Contents.json b/CodeEdit/Assets.xcassets/new light.imageset/Contents.json new file mode 100644 index 0000000000..d8f43fd554 --- /dev/null +++ b/CodeEdit/Assets.xcassets/new light.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "new light.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "new light-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "new light-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/new light.imageset/new light-1.png b/CodeEdit/Assets.xcassets/new light.imageset/new light-1.png new file mode 100644 index 0000000000..4f512669e3 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new light.imageset/new light-1.png differ diff --git a/CodeEdit/Assets.xcassets/new light.imageset/new light-2.png b/CodeEdit/Assets.xcassets/new light.imageset/new light-2.png new file mode 100644 index 0000000000..4f512669e3 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new light.imageset/new light-2.png differ diff --git a/CodeEdit/Assets.xcassets/new light.imageset/new light.png b/CodeEdit/Assets.xcassets/new light.imageset/new light.png new file mode 100644 index 0000000000..4f512669e3 Binary files /dev/null and b/CodeEdit/Assets.xcassets/new light.imageset/new light.png differ diff --git a/CodeEdit/Assets.xcassets/open dark.imageset/Contents.json b/CodeEdit/Assets.xcassets/open dark.imageset/Contents.json new file mode 100644 index 0000000000..f674d69c18 --- /dev/null +++ b/CodeEdit/Assets.xcassets/open dark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "open dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "open dark-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "open dark-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/open dark.imageset/open dark-1.png b/CodeEdit/Assets.xcassets/open dark.imageset/open dark-1.png new file mode 100644 index 0000000000..551b1cca21 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open dark.imageset/open dark-1.png differ diff --git a/CodeEdit/Assets.xcassets/open dark.imageset/open dark-2.png b/CodeEdit/Assets.xcassets/open dark.imageset/open dark-2.png new file mode 100644 index 0000000000..551b1cca21 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open dark.imageset/open dark-2.png differ diff --git a/CodeEdit/Assets.xcassets/open dark.imageset/open dark.png b/CodeEdit/Assets.xcassets/open dark.imageset/open dark.png new file mode 100644 index 0000000000..551b1cca21 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open dark.imageset/open dark.png differ diff --git a/CodeEdit/Assets.xcassets/open light.imageset/Contents.json b/CodeEdit/Assets.xcassets/open light.imageset/Contents.json new file mode 100644 index 0000000000..efc9faaea4 --- /dev/null +++ b/CodeEdit/Assets.xcassets/open light.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "open light.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "open light-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "open light-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/open light.imageset/open light-1.png b/CodeEdit/Assets.xcassets/open light.imageset/open light-1.png new file mode 100644 index 0000000000..8ba51c9425 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open light.imageset/open light-1.png differ diff --git a/CodeEdit/Assets.xcassets/open light.imageset/open light-2.png b/CodeEdit/Assets.xcassets/open light.imageset/open light-2.png new file mode 100644 index 0000000000..8ba51c9425 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open light.imageset/open light-2.png differ diff --git a/CodeEdit/Assets.xcassets/open light.imageset/open light.png b/CodeEdit/Assets.xcassets/open light.imageset/open light.png new file mode 100644 index 0000000000..8ba51c9425 Binary files /dev/null and b/CodeEdit/Assets.xcassets/open light.imageset/open light.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window dark.imageset/Contents.json b/CodeEdit/Assets.xcassets/welcome window dark.imageset/Contents.json new file mode 100644 index 0000000000..77ab926845 --- /dev/null +++ b/CodeEdit/Assets.xcassets/welcome window dark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "welcome window dark.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "welcome window dark-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "welcome window dark-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-1.png b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-1.png new file mode 100644 index 0000000000..336ad8159e Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-1.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-2.png b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-2.png new file mode 100644 index 0000000000..336ad8159e Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark-2.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark.png b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark.png new file mode 100644 index 0000000000..336ad8159e Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window dark.imageset/welcome window dark.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window light.imageset/Contents.json b/CodeEdit/Assets.xcassets/welcome window light.imageset/Contents.json new file mode 100644 index 0000000000..65032e1ee3 --- /dev/null +++ b/CodeEdit/Assets.xcassets/welcome window light.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "welcome window light.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "welcome window light-1.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "welcome window light-2.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-1.png b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-1.png new file mode 100644 index 0000000000..6018a04273 Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-1.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-2.png b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-2.png new file mode 100644 index 0000000000..6018a04273 Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light-2.png differ diff --git a/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light.png b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light.png new file mode 100644 index 0000000000..6018a04273 Binary files /dev/null and b/CodeEdit/Assets.xcassets/welcome window light.imageset/welcome window light.png differ diff --git a/CodeEdit/Elements/CEColorPicker.swift b/CodeEdit/Elements/CEColorPicker.swift new file mode 100644 index 0000000000..022887ca98 --- /dev/null +++ b/CodeEdit/Elements/CEColorPicker.swift @@ -0,0 +1,27 @@ +// +// CEColorPicker.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/26. +// + +import SwiftUI + +struct CEColorPicker: View { + @Binding var selection: T + + let colors: [Color] + let name: String + + var body: some View { + Picker("", selection: $selection) { + HStack { + Image(nsImage: .init(named: .init("ColorPickerDefault"))?.tint(color: .green) ?? NSImage()) + + Text(name) + } + .padding(.trailing) + } + .fixedSize() + } +} diff --git a/CodeEdit/Elements/ColorChoose.swift b/CodeEdit/Elements/ColorChoose.swift new file mode 100644 index 0000000000..2bb8477409 --- /dev/null +++ b/CodeEdit/Elements/ColorChoose.swift @@ -0,0 +1,44 @@ +// +// ColorChoose.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/26. +// + +import SwiftUI + +struct ColorChoose: View { + @Binding var selected: T + let selection: T + let colors: [Color] + let onTap: (() -> Void) + + var body: some View { + Circle() + .fill(AngularGradient(colors: colors, center: .center)) + .frame(width: 15, height: 15) + .overlay { + Circle() + .stroke(lineWidth: 2) + .fill(.gray) + .opacity(0.3) + } + .overlay { + Circle() + .frame(width: 5, height: 5) + .foregroundColor(.white) + .opacity(selected == selection ? 1 : 0) + } + .onTapGesture { + selected = selection + onTap() + } + } + + init(selected: Binding, selection: T, colors: [Color], onTap: (() -> Void)? = nil) { + self._selected = selected + self.selection = selection + self.colors = colors + self.onTap = onTap ?? {} + } +} diff --git a/CodeEdit/Extensions/Color+Focused.swift b/CodeEdit/Extensions/Color+Focused.swift new file mode 100644 index 0000000000..e48fbfe129 --- /dev/null +++ b/CodeEdit/Extensions/Color+Focused.swift @@ -0,0 +1,26 @@ +// +// Color+Focused.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/25. +// + +import SwiftUI + +extension Color { + static var focusedColor: some View { + ZStack { + Color.accentColor.opacity(isDarkMode() ? 0.55 : 0.75) + Color.accentColor.blendMode(.softLight) + } + .compositingGroup() + } + + static var unfocusedColor: Color { + !isDarkMode() ? .black.opacity(0.11) : .white.opacity(0.12) + } + + static func isDarkMode() -> Bool { + NSApp.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua + } +} diff --git a/CodeEdit/Extensions/NSImage+TintColor.swift b/CodeEdit/Extensions/NSImage+TintColor.swift new file mode 100644 index 0000000000..6ce81dec5b --- /dev/null +++ b/CodeEdit/Extensions/NSImage+TintColor.swift @@ -0,0 +1,20 @@ +// +// NSImage+TintColor.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/26. +// +// swiftlint:disable all + +import AppKit + +extension NSImage { + func tint(color: NSColor) -> NSImage { + return NSImage(size: size, flipped: false) { (rect) -> Bool in + color.set() + rect.fill() + self.draw(in: rect, from: NSRect(origin: .zero, size: self.size), operation: .destinationIn, fraction: 1.0) + return true + } + } +} diff --git a/CodeEdit/Extensions/View+Form.swift b/CodeEdit/Extensions/View+Form.swift new file mode 100644 index 0000000000..9928fd432a --- /dev/null +++ b/CodeEdit/Extensions/View+Form.swift @@ -0,0 +1,33 @@ +// +// View+Form.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/29. +// + +import SwiftUI + +extension HorizontalAlignment { + private enum ControlAlignment: AlignmentID { + static func defaultValue(in context: ViewDimensions) -> CGFloat { + return context[HorizontalAlignment.center] + } + } + + static let controlAlignment = HorizontalAlignment(ControlAlignment.self) +} + +public extension View { + /// Attaches a label to this view for laying out in a `Form` + /// - Parameter view: the label view to use + /// - Returns: an `HStack` with an alignment guide for placing in a form + func formLabel(_ view: V) -> some View { + HStack { + view + self + .alignmentGuide(.controlAlignment) { $0[.leading] } + } + .alignmentGuide(.leading) { $0[.controlAlignment] } + + } +} diff --git a/CodeEdit/Settings/ExecutionSettingsView.swift b/CodeEdit/Settings/ExecutionSettingsView.swift new file mode 100644 index 0000000000..4a71cacac2 --- /dev/null +++ b/CodeEdit/Settings/ExecutionSettingsView.swift @@ -0,0 +1,88 @@ +// +// ExecutionSettingsView.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/23. +// + +import SwiftUI +import TerminalEmulator +import FontPicker +import Preferences + +struct ExecutionSettingsView: View { + @AppStorage(TerminalShellType.storageKey) var shellType: TerminalShellType = .default + @AppStorage(TerminalFont.storageKey) var terminalFontSelection: TerminalFont = .default + @AppStorage(TerminalFontName.storageKey) var terminalFontName: String = TerminalFontName.default + @AppStorage(TerminalFontSize.storageKey) var terminalFontSize: Int = TerminalFontSize.default + + @State var customFont = false + + @StateObject private var colors = AnsiColors.shared + @State var terminalColor: Color = .gray + + @Environment(\.colorScheme) var colorScheme + + var body: some View { + VStack(alignment: .center) { + Preferences.Container(contentWidth: 500) { + Preferences.Section(title: "Terminal Shell:") { + Picker("", selection: $shellType) { + Text("System Default".localized()) + .tag(TerminalShellType.auto) + Text("ZSH") + .tag(TerminalShellType.zsh) + Text("Bash") + .tag(TerminalShellType.bash) + } + .fixedSize() + } + + Preferences.Section(title: "Terminal Font:") { + Toggle(isOn: $customFont) { + FontPicker("\(terminalFontName) \(terminalFontSize)", + name: $terminalFontName, size: $terminalFontSize) + } + } + + Preferences.Section(title: "Terminal Color:") { + if colorScheme == .dark { + HStack(spacing: 0) { + ansiColorPicker($colors.colors[0]) + ansiColorPicker($colors.colors[1]) + ansiColorPicker($colors.colors[2]) + ansiColorPicker($colors.colors[3]) + ansiColorPicker($colors.colors[4]) + ansiColorPicker($colors.colors[5]) + ansiColorPicker($colors.colors[6]) + ansiColorPicker($colors.colors[7]) + } + } else { + HStack(spacing: 0) { + ansiColorPicker($colors.colors[8]) + ansiColorPicker($colors.colors[9]) + ansiColorPicker($colors.colors[10]) + ansiColorPicker($colors.colors[11]) + ansiColorPicker($colors.colors[12]) + ansiColorPicker($colors.colors[13]) + ansiColorPicker($colors.colors[14]) + ansiColorPicker($colors.colors[15]) + } + } + } + } + + Spacer() + } + .onAppear { + customFont = terminalFontSelection == .custom + } + .padding() + .frame(width: 820, height: 450) + } + + private func ansiColorPicker(_ color: Binding) -> some View { + ColorPicker(selection: color, supportsOpacity: false) { } + .labelsHidden() + } +} diff --git a/CodeEdit/Settings/ExtensionsSettingsView.swift b/CodeEdit/Settings/ExtensionsSettingsView.swift new file mode 100644 index 0000000000..9ca90e9a60 --- /dev/null +++ b/CodeEdit/Settings/ExtensionsSettingsView.swift @@ -0,0 +1,24 @@ +// +// ExtensionsSettingsView.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/23. +// + +import SwiftUI + +struct ExtensionsSettingsView: View { + var body: some View { + VStack { + Spacer() + } + .padding() + .frame(width: 820, height: 450) + } +} + +struct ExtensionsSettingsView_Previews: PreviewProvider { + static var previews: some View { + ExtensionsSettingsView() + } +} diff --git a/CodeEdit/Settings/GeneralSettingsView.swift b/CodeEdit/Settings/GeneralSettingsView.swift index 540d922d99..de7d782fb6 100644 --- a/CodeEdit/Settings/GeneralSettingsView.swift +++ b/CodeEdit/Settings/GeneralSettingsView.swift @@ -7,6 +7,7 @@ import SwiftUI import CodeFile +import Preferences // MARK: - View @@ -26,29 +27,22 @@ struct GeneralSettingsView: View { @AppStorage(EditorTabWidth.storageKey) var defaultTabWidth: Int = EditorTabWidth.default + @State var refresh = UUID() + var body: some View { Form { - Picker("Appearance".localized(), selection: $appearance) { - Text("System".localized()) - .tag(Appearances.system) - Divider() - Text("Light".localized()) - .tag(Appearances.light) - Text("Dark".localized()) - .tag(Appearances.dark) - } - .onChange(of: appearance) { tag in - tag.applyAppearance() - } + AppearenceChangeView(refresh: refresh) + .formLabel(Text("Appearence:".localized())) - Picker("File Icon Style".localized(), selection: $fileIconStyle) { + 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) { + Picker("Reopen Behavior:".localized(), selection: $reopenBehavior) { Text("Welcome Screen".localized()) .tag(ReopenBehavior.welcome) Divider() @@ -57,29 +51,110 @@ struct GeneralSettingsView: View { Text("New Document".localized()) .tag(ReopenBehavior.newDocument) } - - Picker("Editor Theme".localized(), selection: $editorTheme) { - Text("Atelier Savanna (Auto)") - .tag(CodeFileView.Theme.atelierSavannaAuto) - Text("Atelier Savanna Dark") - .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() HStack { - Stepper("Default Tab Width".localized(), value: $defaultTabWidth, in: 2...8) + Stepper("Default Tab Width:".localized(), value: $defaultTabWidth, in: 2...8) Text(String(defaultTabWidth)) } + + Spacer() + } + .onChange(of: appearance) { tag in + tag.applyAppearance() + refresh = UUID() } .padding() + .frame(width: 820, height: 450) + } + + struct AppearenceChangeView: View { + let refresh: UUID + @StateObject var model = KeyModel.shared + @AppStorage(Appearances.storageKey) var appearance: Appearances = .default + + var body: some View { + HStack { + VStack { + ZStack(alignment: .center) { + if model.key { + Color.focusedColor.opacity(appearance == .system || appearance == .default ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } else { + Color.unfocusedColor.opacity(appearance == .system || appearance == .default ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } + + Image("Settings Image - Auto") + .resizable() + .frame(width: 67, height: 46) + .scaledToFit() + .cornerRadius(5) + .onTapGesture { + appearance = .system + } + } + + Text("Auto".localized()) + } + .padding(.trailing) + + VStack { + ZStack(alignment: .center) { + if model.key { + Color.focusedColor.opacity(appearance == .light ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } else { + Color.unfocusedColor.opacity(appearance == .light ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } + + Image("Settings Image - Light") + .resizable() + .frame(width: 67, height: 46) + .scaledToFit() + .cornerRadius(5) + .onTapGesture { + appearance = .light + } + } + + Text("Light".localized()) + } + .padding(.trailing) + + VStack { + ZStack(alignment: .center) { + if model.key { + Color.focusedColor.opacity(appearance == .dark ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } else { + Color.unfocusedColor.opacity(appearance == .dark ? 1 : 0) + .frame(width: 67 + 3, height: 46 + 3) + .cornerRadius(5) + } + + Image("Settings Image - Dark") + .resizable() + .frame(width: 67, height: 46) + .scaledToFit() + .cornerRadius(5) + .onTapGesture { + appearance = .dark + } + } + + Text("Dark".localized()) + } + .padding(.trailing) + } + .id(refresh) + } } } diff --git a/CodeEdit/Settings/Models/PreferencesIdentifier.swift b/CodeEdit/Settings/Models/PreferencesIdentifier.swift new file mode 100644 index 0000000000..1c9a1f6d8a --- /dev/null +++ b/CodeEdit/Settings/Models/PreferencesIdentifier.swift @@ -0,0 +1,16 @@ +// +// 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 terminal = Self("terminal") + static let execution = Self("execution") + static let `extension` = Self("extension") +} diff --git a/CodeEdit/Settings/Models/Theme.swift b/CodeEdit/Settings/Models/Theme.swift new file mode 100644 index 0000000000..db8ef8534a --- /dev/null +++ b/CodeEdit/Settings/Models/Theme.swift @@ -0,0 +1,77 @@ +// +// Theme.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/23. +// + +import SwiftUI +import CodeFile + +/// This is sturct for ThemeSettingsView +struct Themes: Identifiable { + static let all: [Themes] = [ + .init(name: "Atelier Savanna Auto", theme: .atelierSavannaAuto, + image: isDarkMode() ? "Atelier Savanna Dark" : "Atelier Savanna Light"), + .init(name: "Atelier Savanna Dark", theme: .atelierSavannaDark, image: "Atelier Savanna Dark"), + .init(name: "Atelier Savanna Light", theme: .atelierSavannaLight, image: "Atelier Savanna Light"), + .init(name: "Agate", theme: .agate, image: "Agate"), + .init(name: "Ocean", theme: .ocean, image: "Ocean") + ] + + let id = UUID() + let name: String + let theme: CodeFileView.Theme + + /// 580 * 310 + let image: Image + + init(name: String, theme: CodeFileView.Theme, image: String) { + self.name = name + self.theme = theme + self.image = Image(image) + } + + /// Tell the appearence + static func isDarkMode() -> Bool { + NSApp.effectiveAppearance.bestMatch(from: [.darkAqua, .aqua]) == .darkAqua + } + + func selected(_ editorTheme: CodeFileView.Theme) -> Bool { + return editorTheme == self.theme + } + + static func next() { + @AppStorage(CodeFileView.Theme.storageKey) var editorTheme: CodeFileView.Theme = .atelierSavannaAuto + if let firstIndex = Self.all.firstIndex(where: { theme in + theme.theme == editorTheme + }) { + let index: Int + + if firstIndex + 1 >= Self.all.count { + index = 0 + } else { + index = firstIndex + 1 + } + + editorTheme = Self.all[index].theme + } + } + + static func back() { + @AppStorage(CodeFileView.Theme.storageKey) var editorTheme: CodeFileView.Theme = .atelierSavannaAuto + if let firstIndex = Self.all.firstIndex(where: { theme in + theme.theme == editorTheme + }) { + let index: Int + + if firstIndex - 1 < 0 { + index = Self.all.endIndex - 1 + } else { + index = firstIndex - 1 + } + + editorTheme = Self.all[index].theme + } + } +} diff --git a/CodeEdit/Settings/TerminalSettingsView.swift b/CodeEdit/Settings/TerminalSettingsView.swift index c1c02c5478..09cedf1d25 100644 --- a/CodeEdit/Settings/TerminalSettingsView.swift +++ b/CodeEdit/Settings/TerminalSettingsView.swift @@ -39,6 +39,7 @@ struct TerminalSettingsView: View { Text("Bash") .tag(TerminalShellType.bash) } + .fixedSize() Picker("Terminal Appearance", selection: $terminalColorSchmeme) { Text("App Default") @@ -49,6 +50,7 @@ struct TerminalSettingsView: View { Text("Dark") .tag(TerminalColorScheme.dark) } + .fixedSize() Picker("Terminal Font".localized(), selection: $terminalFontSelection) { Text("System Font".localized()) @@ -57,6 +59,8 @@ struct TerminalSettingsView: View { Text("Custom".localized()) .tag(TerminalFont.custom) } + .fixedSize() + if terminalFontSelection == .custom { HStack { FontPicker( @@ -66,7 +70,10 @@ struct TerminalSettingsView: View { ) } } + Divider() + .frame(width: 300) + Section { VStack(alignment: .leading, spacing: 0) { HStack(spacing: 0) { @@ -93,11 +100,15 @@ struct TerminalSettingsView: View { } } } + Button("Restore Defaults") { AnsiColors.shared.resetDefault() } + + Spacer() } .padding() + .frame(width: 820, height: 450) } private func ansiColorPicker(_ color: Binding) -> some View { diff --git a/CodeEdit/Settings/ThemeSettingsView.swift b/CodeEdit/Settings/ThemeSettingsView.swift new file mode 100644 index 0000000000..980262f853 --- /dev/null +++ b/CodeEdit/Settings/ThemeSettingsView.swift @@ -0,0 +1,97 @@ +// +// ThemeSettingsView.swift +// CodeEdit +// +// Created by 朱浩宇 on 2022/3/23. +// + +import SwiftUI +import CodeFile +import Preferences + +struct ThemeSettingsView: View { + @AppStorage(CodeFileView.Theme.storageKey) var editorTheme: CodeFileView.Theme = .atelierSavannaAuto + + let gridRule = [GridItem](repeating: GridItem(.flexible(), alignment: .top), count: 5) + + @State var keyWindow = true + @State var refresh = UUID() + + @StateObject var model = KeyModel.shared + + var body: some View { + ScrollView { + LazyVGrid(columns: gridRule) { + ForEach(Themes.all) { themeItem in + VStack { + VStack { + if themeItem.selected(editorTheme) { + themeItem.image + .resizable() + .frame(width: 116, height: 62) + .scaledToFit() + .cornerRadius(3) + } else { + themeItem.image + .resizable() + .frame(width: 116, height: 62) + .scaledToFit() + .overlay { + RoundedRectangle(cornerRadius: 3) + .stroke(lineWidth: 1.5) + .foregroundColor(Color.gray.opacity(0.5)) + } + .clipShape(RoundedRectangle(cornerRadius: 3)) + } + + Text(themeItem.name) + .lineLimit(1) + .multilineTextAlignment(.center) + .font(.system(size: 11)) + } + .padding(5) + .background(BackGroundView(selected: themeItem.selected(editorTheme))) + .onTapGesture { + editorTheme = themeItem.theme + } + } + .padding() + } + } + } + .padding() + .frame(width: 820, height: 450) + .onChange(of: model.event) { newValue in + if let event = newValue { + if event.keyCode == 124 { + Themes.next() + } else if event.keyCode == 123 { + Themes.back() + } + } + } + } + + struct BackGroundView: View { + @StateObject var model = KeyModel.shared + let selected: Bool + + var body: some View { + if selected { + if model.key { + Color.focusedColor.cornerRadius(5) + } else { + Color.unfocusedColor.cornerRadius(5) + } + } else { + Color.clear + } + } + } +} + +struct ThemeSettingsView_Previews: PreviewProvider { + static var previews: some View { + ThemeSettingsView() + } +}