From 9493ca0ea33840e509cd572278c082de6ed6ad08 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 17 Sep 2020 11:33:51 -0700 Subject: [PATCH 01/87] Add a Settings UI Prototype (#7370) This commit introduces a rough prototype of the Settings UI as the `TerminalSettingsEditor`. This project was added to OpenConsole.sln and deploys as a standalone app. Some databinding is configured to a fake TerminalSettingsModel (located in the ObjectModel folder). This commit will start the settings UI feature branch, which will receive a full review on merge-back into main. References #6720 - Settings UI Spec and Design References #1564 - Settings UI Feature/Epic --- .../actions/spell-check/dictionary/apis.txt | 5 + .../spell-check/dictionary/microsoft.txt | 1 + OpenConsole.sln | 41 + .../TerminalSettingsEditor/AddProfile.cpp | 17 + .../TerminalSettingsEditor/AddProfile.h | 20 + .../TerminalSettingsEditor/AddProfile.idl | 7 + .../TerminalSettingsEditor/AddProfile.xaml | 267 ++++++ src/cascadia/TerminalSettingsEditor/App.cpp | 129 +++ src/cascadia/TerminalSettingsEditor/App.h | 17 + src/cascadia/TerminalSettingsEditor/App.idl | 6 + src/cascadia/TerminalSettingsEditor/App.xaml | 33 + .../Assets/Square150x150Logo.png | Bin 0 -> 2355 bytes .../Assets/Square44x44Logo.png | Bin 0 -> 1525 bytes .../Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../TerminalSettingsEditor/ColorSchemes.cpp | 100 +++ .../TerminalSettingsEditor/ColorSchemes.h | 44 + .../TerminalSettingsEditor/ColorSchemes.idl | 13 + .../TerminalSettingsEditor/ColorSchemes.xaml | 502 +++++++++++ .../GlobalAppearance.cpp | 24 + .../TerminalSettingsEditor/GlobalAppearance.h | 26 + .../GlobalAppearance.idl | 13 + .../GlobalAppearance.xaml | 44 + .../TerminalSettingsEditor/GlobalSettings.idl | 35 + .../TerminalSettingsEditor/Globals.cpp | 17 + src/cascadia/TerminalSettingsEditor/Globals.h | 20 + .../TerminalSettingsEditor/Globals.idl | 11 + .../TerminalSettingsEditor/Globals.xaml | 82 ++ src/cascadia/TerminalSettingsEditor/Home.cpp | 41 + src/cascadia/TerminalSettingsEditor/Home.h | 28 + src/cascadia/TerminalSettingsEditor/Home.idl | 13 + src/cascadia/TerminalSettingsEditor/Home.xaml | 70 ++ .../TerminalSettingsEditor/HomeGridItem.cpp | 15 + .../TerminalSettingsEditor/HomeGridItem.h | 19 + .../TerminalSettingsEditor/HomeGridItem.idl | 11 + .../TerminalSettingsEditor/Interaction.cpp | 24 + .../TerminalSettingsEditor/Interaction.h | 25 + .../TerminalSettingsEditor/Interaction.idl | 14 + .../TerminalSettingsEditor/Interaction.xaml | 33 + .../KeyBindingsPage.xaml | 17 + .../TerminalSettingsEditor/Keybindings.cpp | 239 +++++ .../TerminalSettingsEditor/Keybindings.h | 49 ++ .../TerminalSettingsEditor/Keybindings.idl | 11 + .../TerminalSettingsEditor/Keybindings.xaml | 153 ++++ .../TerminalSettingsEditor/Launch.cpp | 25 + src/cascadia/TerminalSettingsEditor/Launch.h | 25 + .../TerminalSettingsEditor/Launch.idl | 14 + .../TerminalSettingsEditor/Launch.xaml | 60 ++ .../TerminalSettingsEditor/MainPage.cpp | 232 +++++ .../TerminalSettingsEditor/MainPage.h | 39 + .../TerminalSettingsEditor/MainPage.idl | 11 + .../TerminalSettingsEditor/MainPage.xaml | 178 ++++ .../NewTabOptionPanelControl.cpp | 43 + .../NewTabOptionPanelControl.h | 30 + .../NewTabOptionPanelControl.idl | 13 + .../NewTabOptionPanelControl.xaml | 31 + .../ObjectModel/AppSettings.cpp | 95 ++ .../ObjectModel/AppSettings.h | 67 ++ .../ObjectModel/ColorScheme.cpp | 823 ++++++++++++++++++ .../ObjectModel/ColorScheme.h | 186 ++++ .../ObjectModel/ColorScheme.idl | 95 ++ .../ObjectModel/ColorSchemeModel.cpp | 16 + .../ObjectModel/ColorSchemeModel.h | 16 + .../ObjectModel/ColorSchemeModel.idl | 9 + .../ObjectModel/EnumBooleanConverter.cpp | 0 .../ObjectModel/GlobalSettings.cpp | 3 + .../ObjectModel/GlobalSettings.h | 40 + .../ObjectModel/GlobalSettings.idl | 51 ++ .../ObjectModel/GlobalSettingsModel.cpp | 17 + .../ObjectModel/GlobalSettingsModel.h | 16 + .../ObjectModel/GlobalSettingsModel.idl | 9 + .../ObjectModel/Profile.cpp | 26 + .../ObjectModel/Profile.h | 71 ++ .../ObjectModel/Profile.idl | 117 +++ .../ObjectModel/ProfileModel.cpp | 17 + .../ObjectModel/ProfileModel.h | 16 + .../ObjectModel/ProfileModel.idl | 9 + .../ObjectModel/SettingsTypes.idl | 85 ++ .../Package.appxmanifest | 40 + .../TerminalSettingsEditor/Profiles.cpp | 84 ++ .../TerminalSettingsEditor/Profiles.h | 33 + .../TerminalSettingsEditor/Profiles.idl | 13 + .../TerminalSettingsEditor/Profiles.xaml | 253 ++++++ .../PropertySheet.props | 16 + .../TerminalSettingsEditor/Rendering.cpp | 24 + .../TerminalSettingsEditor/Rendering.h | 25 + .../TerminalSettingsEditor/Rendering.idl | 13 + .../TerminalSettingsEditor/Rendering.xaml | 31 + .../SettingsEditorViewModel.cpp | 24 + .../SettingsEditorViewModel.h | 22 + .../SettingsEditorViewModel.idl | 13 + .../SplitPaneOptionPanelControl.cpp | 58 ++ .../SplitPaneOptionPanelControl.h | 34 + .../SplitPaneOptionPanelControl.idl | 13 + .../SplitPaneOptionPanelControl.xaml | 36 + .../TerminalSettingsEditor.vcxproj | 291 +++++++ .../TerminalSettingsEditor.vcxproj.filters | 104 +++ src/cascadia/TerminalSettingsEditor/Utils.cpp | 101 +++ src/cascadia/TerminalSettingsEditor/Utils.h | 12 + .../TerminalSettingsEditor/packages.config | 5 + src/cascadia/TerminalSettingsEditor/pch.cpp | 1 + src/cascadia/TerminalSettingsEditor/pch.h | 51 ++ 101 files changed, 6018 insertions(+) create mode 100644 src/cascadia/TerminalSettingsEditor/AddProfile.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/AddProfile.h create mode 100644 src/cascadia/TerminalSettingsEditor/AddProfile.idl create mode 100644 src/cascadia/TerminalSettingsEditor/AddProfile.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/App.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/App.h create mode 100644 src/cascadia/TerminalSettingsEditor/App.idl create mode 100644 src/cascadia/TerminalSettingsEditor/App.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/Assets/Square150x150Logo.png create mode 100644 src/cascadia/TerminalSettingsEditor/Assets/Square44x44Logo.png create mode 100644 src/cascadia/TerminalSettingsEditor/Assets/StoreLogo.png create mode 100644 src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ColorSchemes.h create mode 100644 src/cascadia/TerminalSettingsEditor/ColorSchemes.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/GlobalAppearance.h create mode 100644 src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl create mode 100644 src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/GlobalSettings.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Globals.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Globals.h create mode 100644 src/cascadia/TerminalSettingsEditor/Globals.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Globals.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/Home.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Home.h create mode 100644 src/cascadia/TerminalSettingsEditor/Home.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Home.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.h create mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Interaction.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Interaction.h create mode 100644 src/cascadia/TerminalSettingsEditor/Interaction.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Interaction.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/Keybindings.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Keybindings.h create mode 100644 src/cascadia/TerminalSettingsEditor/Keybindings.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Keybindings.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/Launch.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Launch.h create mode 100644 src/cascadia/TerminalSettingsEditor/Launch.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Launch.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/MainPage.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/MainPage.h create mode 100644 src/cascadia/TerminalSettingsEditor/MainPage.idl create mode 100644 src/cascadia/TerminalSettingsEditor/MainPage.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/NewTabOptionPanelControl.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/NewTabOptionPanelControl.h create mode 100644 src/cascadia/TerminalSettingsEditor/NewTabOptionPanelControl.idl create mode 100644 src/cascadia/TerminalSettingsEditor/NewTabOptionPanelControl.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/EnumBooleanConverter.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.h create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.idl create mode 100644 src/cascadia/TerminalSettingsEditor/ObjectModel/SettingsTypes.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Package.appxmanifest create mode 100644 src/cascadia/TerminalSettingsEditor/Profiles.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Profiles.h create mode 100644 src/cascadia/TerminalSettingsEditor/Profiles.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Profiles.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/PropertySheet.props create mode 100644 src/cascadia/TerminalSettingsEditor/Rendering.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Rendering.h create mode 100644 src/cascadia/TerminalSettingsEditor/Rendering.idl create mode 100644 src/cascadia/TerminalSettingsEditor/Rendering.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.h create mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.idl create mode 100644 src/cascadia/TerminalSettingsEditor/SplitPaneOptionPanelControl.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/SplitPaneOptionPanelControl.h create mode 100644 src/cascadia/TerminalSettingsEditor/SplitPaneOptionPanelControl.idl create mode 100644 src/cascadia/TerminalSettingsEditor/SplitPaneOptionPanelControl.xaml create mode 100644 src/cascadia/TerminalSettingsEditor/TerminalSettingsEditor.vcxproj create mode 100644 src/cascadia/TerminalSettingsEditor/TerminalSettingsEditor.vcxproj.filters create mode 100644 src/cascadia/TerminalSettingsEditor/Utils.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/Utils.h create mode 100644 src/cascadia/TerminalSettingsEditor/packages.config create mode 100644 src/cascadia/TerminalSettingsEditor/pch.cpp create mode 100644 src/cascadia/TerminalSettingsEditor/pch.h diff --git a/.github/actions/spell-check/dictionary/apis.txt b/.github/actions/spell-check/dictionary/apis.txt index 2ce6c20c31f..969b90c3460 100644 --- a/.github/actions/spell-check/dictionary/apis.txt +++ b/.github/actions/spell-check/dictionary/apis.txt @@ -45,12 +45,17 @@ RSHIFT rx serializer SIZENS +snprintf spsc STDCPP +Subheader +Subpage syscall tmp +tolower tx userenv +wcsstr wcstoui XDocument XElement diff --git a/.github/actions/spell-check/dictionary/microsoft.txt b/.github/actions/spell-check/dictionary/microsoft.txt index a5d56bf5bc8..df286478679 100644 --- a/.github/actions/spell-check/dictionary/microsoft.txt +++ b/.github/actions/spell-check/dictionary/microsoft.txt @@ -12,6 +12,7 @@ LKG mfcribbon microsoft microsoftonline +muxc netcore osgvsowi pgc diff --git a/OpenConsole.sln b/OpenConsole.sln index 82ab30fdc5a..f6f92f66537 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -307,6 +307,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTerminalTestNetCore", "s EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wt", "src\cascadia\wt\wt.vcxproj", "{506FD703-BAA7-4F6E-9361-64F550EC8FCA}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TerminalSettingsEditor", "src\cascadia\TerminalSettingsEditor\TerminalSettingsEditor.vcxproj", "{CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AuditMode|Any CPU = AuditMode|Any CPU @@ -1986,6 +1988,44 @@ Global {506FD703-BAA7-4F6E-9361-64F550EC8FCA}.Release|x64.Build.0 = Release|x64 {506FD703-BAA7-4F6E-9361-64F550EC8FCA}.Release|x86.ActiveCfg = Release|Win32 {506FD703-BAA7-4F6E-9361-64F550EC8FCA}.Release|x86.Build.0 = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|Any CPU.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|Any CPU.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|Any CPU.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|ARM64.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|ARM64.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|ARM64.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x64Test.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x64Test.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x64Test.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x86Test.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x86Test.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|DotNet_x86Test.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x64.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x64.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x64.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x86.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x86.Build.0 = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.AuditMode|x86.Deploy.0 = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|ARM64.ActiveCfg = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|DotNet_x64Test.ActiveCfg = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|DotNet_x86Test.ActiveCfg = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x64.ActiveCfg = Debug|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x64.Build.0 = Debug|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x64.Deploy.0 = Debug|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x86.ActiveCfg = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x86.Build.0 = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Debug|x86.Deploy.0 = Debug|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|Any CPU.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|ARM64.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|DotNet_x64Test.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|DotNet_x86Test.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x64.ActiveCfg = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x64.Build.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x64.Deploy.0 = Release|x64 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x86.ActiveCfg = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x86.Build.0 = Release|Win32 + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32}.Release|x86.Deploy.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2066,6 +2106,7 @@ Global {6BAE5851-50D5-4934-8D5E-30361A8A40F3} = {81C352DB-1818-45B7-A284-18E259F1CC87} {1588FD7C-241E-4E7D-9113-43735F3E6BAD} = {59840756-302F-44DF-AA47-441A9D673202} {506FD703-BAA7-4F6E-9361-64F550EC8FCA} = {59840756-302F-44DF-AA47-441A9D673202} + {CA5CAD1A-0B5E-45C3-96A8-BB496BFE4E32} = {59840756-302F-44DF-AA47-441A9D673202} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271} diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.cpp b/src/cascadia/TerminalSettingsEditor/AddProfile.cpp new file mode 100644 index 00000000000..9139a8d9623 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.cpp @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "AddProfile.h" +#include "AddProfile.g.cpp" + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + AddProfile::AddProfile() + { + InitializeComponent(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.h b/src/cascadia/TerminalSettingsEditor/AddProfile.h new file mode 100644 index 00000000000..d27f3e6f553 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.h @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "AddProfile.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct AddProfile : AddProfileT + { + AddProfile(); + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(AddProfile); +} diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.idl b/src/cascadia/TerminalSettingsEditor/AddProfile.idl new file mode 100644 index 00000000000..de959cdaf93 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.idl @@ -0,0 +1,7 @@ +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] runtimeclass AddProfile : Windows.UI.Xaml.Controls.Page + { + AddProfile(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/AddProfile.xaml b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml new file mode 100644 index 00000000000..d535ef218b5 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/AddProfile.xaml @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp new file mode 100644 index 00000000000..ce45faf73b0 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "GlobalAppearance.h" +#include "GlobalAppearance.g.cpp" +#include + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + GlobalAppearance::GlobalAppearance() + { + m_globalSettingsModel = winrt::make(); + InitializeComponent(); + } + + Model::GlobalSettingsModel GlobalAppearance::GlobalSettingsModel() + { + return m_globalSettingsModel; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h new file mode 100644 index 00000000000..cd1419c327b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "GlobalAppearance.g.h" +#include "ObjectModel/GlobalSettingsModel.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct GlobalAppearance : GlobalAppearanceT + { + GlobalAppearance(); + + Model::GlobalSettingsModel GlobalSettingsModel(); + + private: + Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(GlobalAppearance); +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl new file mode 100644 index 00000000000..8b346a09368 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "ObjectModel/GlobalSettingsModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] runtimeclass GlobalAppearance : Windows.UI.Xaml.Controls.Page + { + GlobalAppearance(); + Microsoft.Terminal.Settings.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml new file mode 100644 index 00000000000..ef56a8f45a1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl b/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl new file mode 100644 index 00000000000..fffe555a6c1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "SettingsTypes.idl"; + +namespace SettingsControl +{ + [default_interface] runtimeclass GlobalSettings { + GlobalSettings(); + + String UnparsedDefaultProfile(); + + Guid DefaultProfile; + Int32 InitialRows; + Int32 InitialCols; + Boolean AlwaysShowTabs; + Boolean ShowTitleInTitlebar; + Boolean ConfirmCloseAllTabs; + Windows.UI.Xaml.ElementTheme Theme; + TabWidthMode TabWidth; + Boolean ShowTabsInTitlebar; + String WordDelimiters; + Boolean CopyOnSelect; + Boolean CopyFormatting; + Boolean WarnAboutLargePaste; + Boolean WarnAboutMultiLinePaste; + Boolean SnapToGridOnResize; + Boolean ForceFullRepaintRendering; + Boolean SoftwareRendering; + Boolean ForceVTInput; + Boolean DebugFeaturesEnabled; + Boolean StartOnUserLogin; + Boolean AlwaysOnTop; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.cpp b/src/cascadia/TerminalSettingsEditor/Globals.cpp new file mode 100644 index 00000000000..38257dd5a5a --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.cpp @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Globals.h" +#include "Globals.g.cpp" + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Globals::Globals() + { + InitializeComponent(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.h b/src/cascadia/TerminalSettingsEditor/Globals.h new file mode 100644 index 00000000000..e1a6683a25d --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.h @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Globals.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Globals : GlobalsT + { + Globals(); + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Globals); +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.idl b/src/cascadia/TerminalSettingsEditor/Globals.idl new file mode 100644 index 00000000000..3c3abbc93d4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] + runtimeclass Globals : Windows.UI.Xaml.Controls.Page + { + Globals(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.xaml b/src/cascadia/TerminalSettingsEditor/Globals.xaml new file mode 100644 index 00000000000..756d0b713f1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Home.cpp b/src/cascadia/TerminalSettingsEditor/Home.cpp new file mode 100644 index 00000000000..2728f0ce98e --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.cpp @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Home.h" +#include "Home.g.cpp" +#include "MainPage.h" + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Home::Home() + { + m_homeViewModel = winrt::make(); + InitializeComponent(); + + HomeViewModel().HomeGridItems().Append(winrt::make(L"Startup", L"Launch_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Interaction", L"Interaction_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Rendering", L"Rendering_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Global appearance", L"GlobalAppearance_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Color schemes", L"ColorSchemes_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Global profile settings", L"GlobalProfile_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Keyboard", L"Keyboard_Nav")); + } + + void Home::HomeGridItemClickHandler(IInspectable const&, Controls::ItemClickEventArgs const& args) + { + auto clickedItemContainer = args.ClickedItem().as(); + hstring tag = clickedItemContainer->PageTag(); + MainPage mainPage; + mainPage.Navigate(frame(), tag); + } + + Editor::SettingsEditorViewModel Home::HomeViewModel() + { + return m_homeViewModel; + } + +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.h b/src/cascadia/TerminalSettingsEditor/Home.h new file mode 100644 index 00000000000..bb67143dca6 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.h @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Home.g.h" +#include "SettingsEditorViewModel.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Home : HomeT + { + Home(); + + Editor::SettingsEditorViewModel HomeViewModel(); + + void HomeGridItemClickHandler(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::Controls::ItemClickEventArgs const& args); + + private: + Editor::SettingsEditorViewModel m_homeViewModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Home); +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.idl b/src/cascadia/TerminalSettingsEditor/Home.idl new file mode 100644 index 00000000000..e275d44c1c4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.idl @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "SettingsEditorViewModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass Home : Windows.UI.Xaml.Controls.Page + { + Home(); + SettingsEditorViewModel HomeViewModel{ get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.xaml b/src/cascadia/TerminalSettingsEditor/Home.xaml new file mode 100644 index 00000000000..f6e428f0996 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp b/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp new file mode 100644 index 00000000000..248cb5d6c86 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "HomeGridItem.h" +#include "HomeGridItem.g.cpp" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + HomeGridItem::HomeGridItem(hstring const& title, hstring const& pageTag) : + _Title{ title }, + _PageTag{ pageTag } + { + } +} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.h b/src/cascadia/TerminalSettingsEditor/HomeGridItem.h new file mode 100644 index 00000000000..9b7a0e10f42 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.h @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once +#include "HomeGridItem.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct HomeGridItem : HomeGridItemT + { + HomeGridItem() = delete; + HomeGridItem(hstring const& title, hstring const& pageTag); + + WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); + OBSERVABLE_GETSET_PROPERTY(hstring, Title, _PropertyChangedHandlers); + OBSERVABLE_GETSET_PROPERTY(hstring, PageTag, _PropertyChangedHandlers); + }; +} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl b/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl new file mode 100644 index 00000000000..935be521f2f --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass HomeGridItem : Windows.UI.Xaml.Data.INotifyPropertyChanged + { + String Title; + String PageTag; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.cpp b/src/cascadia/TerminalSettingsEditor/Interaction.cpp new file mode 100644 index 00000000000..69c75b2dc56 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.cpp @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Interaction.h" +#include "Interaction.g.cpp" +#include + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Interaction::Interaction() + { + m_globalSettingsModel = winrt::make(); + InitializeComponent(); + } + + Model::GlobalSettingsModel Interaction::GlobalSettingsModel() + { + return m_globalSettingsModel; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.h b/src/cascadia/TerminalSettingsEditor/Interaction.h new file mode 100644 index 00000000000..73d90c24f8b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.h @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Interaction.g.h" +#include "ObjectModel/GlobalSettingsModel.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Interaction : InteractionT + { + Interaction(); + + Model::GlobalSettingsModel GlobalSettingsModel(); + + private: + Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Interaction); +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.idl b/src/cascadia/TerminalSettingsEditor/Interaction.idl new file mode 100644 index 00000000000..342730d7ae0 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.idl @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "ObjectModel/GlobalSettingsModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] runtimeclass Interaction : Windows.UI.Xaml.Controls.Page + { + Interaction(); + + Microsoft.Terminal.Settings.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml new file mode 100644 index 00000000000..f30d8303e3b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml b/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml new file mode 100644 index 00000000000..0e3b8b639a1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.cpp b/src/cascadia/TerminalSettingsEditor/Keybindings.cpp new file mode 100644 index 00000000000..6c2c5183ef8 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.cpp @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Keybindings.h" +#include "Keybindings.g.cpp" + +#include "Utils.h" + +using namespace winrt; +using namespace winrt::Windows::Foundation; +using namespace winrt::Windows::UI::Xaml; +using namespace winrt::Windows::UI::Xaml::Input; +using namespace winrt::Windows::UI::Xaml::Controls::Primitives; +using namespace winrt::Windows::System; +using namespace winrt::Microsoft::Terminal::Settings; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Keybindings::Keybindings() + { + InitializeComponent(); + + m_optionalSettingsPanel = FindName(L"OptionalSettingsPanel").as(); + m_addNewButton = FindName(L"AddNewLink").as(); + + Controls::TextBox tb = FindName(L"KeyBindTextBox").as(); + tb.KeyDown({ this, &Keybindings::KeyDown }); + } + + void Keybindings::Button_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/) + { + Popup popup = FindName(L"StandardPopup").as(); + + if (!popup.IsOpen()) + { + popup.IsOpen(true); + } + } + + void Keybindings::AddNewButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) + { + hstring setting = GetSelectedItemTag(FindName(L"CommandComboBox")); + + Controls::StackPanel panel{}; + + if (setting == c_moveFocusTag || setting == c_resizePaneTag) + { + panel = FindName(L"moveResizeFocusOptionPanel").as(); + panel.Visibility(Visibility::Visible); + } + else + { + panel = FindName(setting + L"OptionPanel").as(); + bool panelWasVisible = (panel.Visibility() == Visibility::Visible); + panel.Visibility(Visibility::Visible); + m_lastOpenedArgsPanel = panel; + + Controls::HyperlinkButton button = sender.as(); + if (setting == c_splitPaneTag) + { + if (panelWasVisible) + { + panel.Children().Append(SplitPaneOptionPanelControl()); + } + button.Visibility(Visibility::Visible); + } + else if (setting == c_newTabTag) + { + panel.Children().Append(NewTabOptionPanelControl()); + button.Visibility(Visibility::Visible); + } + else + { + button.Visibility(Visibility::Collapsed); + } + } + + m_lastOpenedArgsPanel = panel; + } + + hstring Keybindings::GetKeyListString() + { + hstring generatedString = L""; + boolean lastKeyWasModifier{}; + + if (m_keysInBind.find(VirtualKey::Control) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Control); + lastKeyWasModifier = true; + } + + if (m_keysInBind.find(VirtualKey::Shift) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Shift); + lastKeyWasModifier = true; + } + + if (m_keysInBind.find(VirtualKey::Menu) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Menu); + lastKeyWasModifier = true; + } + + for (const auto& key : m_keysInBind) + { + if (key != VirtualKey::Control && key != VirtualKey::Shift && key != VirtualKey::Menu) + { + hstring keyString = KeyToString(key); + + if (!keyString.empty()) + { + if (!generatedString.empty() && !lastKeyWasModifier) + { + generatedString = generatedString + L"+"; + } + generatedString = generatedString + KeyToString(key); + lastKeyWasModifier = false; + } + } + } + + return generatedString; + } + + void Keybindings::KeyDown(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) + { + Controls::TextBox textBox = sender.as(); + + if (e.Key() == VirtualKey::Back) + { + m_keysInBind.clear(); + } + else + { + m_keysInBind.insert(e.Key()); + if (textBox != nullptr) + { + textBox.Text(GetKeyListString()); + } + } + + e.Handled(true); + } + + void Keybindings::KeyBindTextBox_TextChanging(winrt::Windows::UI::Xaml::Controls::TextBox const& sender, winrt::Windows::UI::Xaml::Controls::TextBoxTextChangingEventArgs const& /*args*/) + { + hstring currText = sender.Text(); + hstring newText = hstring(currText.data(), currText.size()); + + sender.Text(newText); + } + + void Keybindings::ShowOptionsButtonIfRequired(hstring tag) + { + std::set settingsWithOptions; + settingsWithOptions.insert(c_openSettingsTag); + settingsWithOptions.insert(c_newTabTag); + settingsWithOptions.insert(c_switchToTabTag); + settingsWithOptions.insert(c_renameTabTag); + settingsWithOptions.insert(c_setTabColorTag); + settingsWithOptions.insert(c_moveFocusTag); + settingsWithOptions.insert(c_resizePaneTag); + settingsWithOptions.insert(c_splitPaneTag); + settingsWithOptions.insert(c_copyTag); + + Windows::UI::Xaml::Visibility expectedVisibility = Visibility::Collapsed; + if (settingsWithOptions.find(tag) != settingsWithOptions.end()) + { + expectedVisibility = Visibility::Visible; + } + m_optionalSettingsPanel.Visibility(expectedVisibility); + m_addNewButton.Visibility(expectedVisibility); + if (m_lastOpenedArgsPanel != nullptr) + { + m_lastOpenedArgsPanel.Visibility(Visibility::Collapsed); + } + } + + void Keybindings::CommandComboBox_SelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& /*e*/) + { + hstring selectedItemTag = GetSelectedItemTag(sender); + ShowOptionsButtonIfRequired(selectedItemTag); + } + + void Keybindings::SaveButton_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) + { + // Collect the information here + winrt::Windows::UI::Popups::MessageDialog msg{ CollectInputData() }; + msg.ShowAsync(); + } + + hstring Keybindings::TraversePanel(const Controls::Panel& panel) + { + hstring fullInfo; + + for (const auto panelChild : panel.Children()) + { + if (Controls::ComboBox childComboBox = panelChild.try_as()) + { + fullInfo = fullInfo + childComboBox.Name() + L":" + GetSelectedItemTag(childComboBox); + } + else if (Controls::TextBox childTextBox = panelChild.try_as()) + { + fullInfo = fullInfo + childTextBox.Name() + L":" + childTextBox.Text(); + } + else if (Editor::NewTabOptionPanelControl ntOptionPanel = panelChild.try_as()) + { + fullInfo = fullInfo + ntOptionPanel.Argument() + L":" + ntOptionPanel.InputValue(); + } + else if (Editor::SplitPaneOptionPanelControl spOptionPanel = panelChild.try_as()) + { + fullInfo = fullInfo + spOptionPanel.Argument() + L":" + spOptionPanel.InputValue(); + } + else if (Controls::Grid grid = panelChild.try_as()) + { + fullInfo = fullInfo + TraversePanel(grid); + } + fullInfo = fullInfo + L"\n"; + } + + return fullInfo; + } + + hstring Keybindings::CollectInputData() + { + hstring fullInfo; + + Controls::ComboBox comboBox = FindName(L"CommandComboBox").as(); + fullInfo = fullInfo + comboBox.Name() + L":" + GetSelectedItemTag(comboBox) + L"\n"; + + Controls::TextBox textBox = FindName(L"KeyBindTextBox").as(); + fullInfo = fullInfo + textBox.Name() + L":" + textBox.Text() + L"\n"; + + fullInfo = fullInfo + TraversePanel(m_lastOpenedArgsPanel); + + return fullInfo; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.h b/src/cascadia/TerminalSettingsEditor/Keybindings.h new file mode 100644 index 00000000000..548fbb8a8a4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.h @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Keybindings.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Keybindings : KeybindingsT + { + Keybindings(); + + void Button_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + void AddNewButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + void KeyDown(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e); + void KeyBindTextBox_TextChanging(winrt::Windows::UI::Xaml::Controls::TextBox const& sender, winrt::Windows::UI::Xaml::Controls::TextBoxTextChangingEventArgs const& args); + void CommandComboBox_SelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& e); + void SaveButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + + private: + hstring GetKeyListString(); + void ShowOptionsButtonIfRequired(hstring tag); + hstring CollectInputData(); + hstring TraversePanel(const winrt::Windows::UI::Xaml::Controls::Panel& panel); + + const hstring c_openSettingsTag = L"openSettings"; + const hstring c_newTabTag = L"newTab"; + const hstring c_switchToTabTag = L"switchToTab"; + const hstring c_renameTabTag = L"renameTab"; + const hstring c_setTabColorTag = L"setTabColor"; + const hstring c_moveFocusTag = L"moveFocus"; + const hstring c_resizePaneTag = L"resizePane"; + const hstring c_splitPaneTag = L"splitPane"; + const hstring c_copyTag = L"copy"; + + winrt::Windows::UI::Xaml::Controls::StackPanel m_lastOpenedArgsPanel{}; + winrt::Windows::UI::Xaml::Controls::StackPanel m_optionalSettingsPanel{}; + winrt::Windows::UI::Xaml::Controls::HyperlinkButton m_addNewButton{}; + + std::set m_keysInBind; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Keybindings); +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.idl b/src/cascadia/TerminalSettingsEditor/Keybindings.idl new file mode 100644 index 00000000000..4627c3d329e --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] + runtimeclass Keybindings : Windows.UI.Xaml.Controls.Page + { + Keybindings(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.xaml b/src/cascadia/TerminalSettingsEditor/Keybindings.xaml new file mode 100644 index 00000000000..fc1a4b7f642 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.xaml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp new file mode 100644 index 00000000000..ce45faf73b0 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "GlobalAppearance.h" +#include "GlobalAppearance.g.cpp" +#include + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + GlobalAppearance::GlobalAppearance() + { + m_globalSettingsModel = winrt::make(); + InitializeComponent(); + } + + Model::GlobalSettingsModel GlobalAppearance::GlobalSettingsModel() + { + return m_globalSettingsModel; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h new file mode 100644 index 00000000000..cd1419c327b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "GlobalAppearance.g.h" +#include "ObjectModel/GlobalSettingsModel.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct GlobalAppearance : GlobalAppearanceT + { + GlobalAppearance(); + + Model::GlobalSettingsModel GlobalSettingsModel(); + + private: + Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(GlobalAppearance); +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl new file mode 100644 index 00000000000..8b346a09368 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "ObjectModel/GlobalSettingsModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] runtimeclass GlobalAppearance : Windows.UI.Xaml.Controls.Page + { + GlobalAppearance(); + Microsoft.Terminal.Settings.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml new file mode 100644 index 00000000000..ef56a8f45a1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl b/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl new file mode 100644 index 00000000000..fffe555a6c1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "SettingsTypes.idl"; + +namespace SettingsControl +{ + [default_interface] runtimeclass GlobalSettings { + GlobalSettings(); + + String UnparsedDefaultProfile(); + + Guid DefaultProfile; + Int32 InitialRows; + Int32 InitialCols; + Boolean AlwaysShowTabs; + Boolean ShowTitleInTitlebar; + Boolean ConfirmCloseAllTabs; + Windows.UI.Xaml.ElementTheme Theme; + TabWidthMode TabWidth; + Boolean ShowTabsInTitlebar; + String WordDelimiters; + Boolean CopyOnSelect; + Boolean CopyFormatting; + Boolean WarnAboutLargePaste; + Boolean WarnAboutMultiLinePaste; + Boolean SnapToGridOnResize; + Boolean ForceFullRepaintRendering; + Boolean SoftwareRendering; + Boolean ForceVTInput; + Boolean DebugFeaturesEnabled; + Boolean StartOnUserLogin; + Boolean AlwaysOnTop; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.cpp b/src/cascadia/TerminalSettingsEditor/Globals.cpp new file mode 100644 index 00000000000..38257dd5a5a --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.cpp @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Globals.h" +#include "Globals.g.cpp" + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Globals::Globals() + { + InitializeComponent(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.h b/src/cascadia/TerminalSettingsEditor/Globals.h new file mode 100644 index 00000000000..e1a6683a25d --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.h @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Globals.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Globals : GlobalsT + { + Globals(); + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Globals); +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.idl b/src/cascadia/TerminalSettingsEditor/Globals.idl new file mode 100644 index 00000000000..3c3abbc93d4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] + runtimeclass Globals : Windows.UI.Xaml.Controls.Page + { + Globals(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Globals.xaml b/src/cascadia/TerminalSettingsEditor/Globals.xaml new file mode 100644 index 00000000000..756d0b713f1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Globals.xaml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Home.cpp b/src/cascadia/TerminalSettingsEditor/Home.cpp new file mode 100644 index 00000000000..2728f0ce98e --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.cpp @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Home.h" +#include "Home.g.cpp" +#include "MainPage.h" + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Home::Home() + { + m_homeViewModel = winrt::make(); + InitializeComponent(); + + HomeViewModel().HomeGridItems().Append(winrt::make(L"Startup", L"Launch_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Interaction", L"Interaction_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Rendering", L"Rendering_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Global appearance", L"GlobalAppearance_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Color schemes", L"ColorSchemes_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Global profile settings", L"GlobalProfile_Nav")); + HomeViewModel().HomeGridItems().Append(winrt::make(L"Keyboard", L"Keyboard_Nav")); + } + + void Home::HomeGridItemClickHandler(IInspectable const&, Controls::ItemClickEventArgs const& args) + { + auto clickedItemContainer = args.ClickedItem().as(); + hstring tag = clickedItemContainer->PageTag(); + MainPage mainPage; + mainPage.Navigate(frame(), tag); + } + + Editor::SettingsEditorViewModel Home::HomeViewModel() + { + return m_homeViewModel; + } + +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.h b/src/cascadia/TerminalSettingsEditor/Home.h new file mode 100644 index 00000000000..bb67143dca6 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.h @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Home.g.h" +#include "SettingsEditorViewModel.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Home : HomeT + { + Home(); + + Editor::SettingsEditorViewModel HomeViewModel(); + + void HomeGridItemClickHandler(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::Controls::ItemClickEventArgs const& args); + + private: + Editor::SettingsEditorViewModel m_homeViewModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Home); +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.idl b/src/cascadia/TerminalSettingsEditor/Home.idl new file mode 100644 index 00000000000..e275d44c1c4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.idl @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "SettingsEditorViewModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass Home : Windows.UI.Xaml.Controls.Page + { + Home(); + SettingsEditorViewModel HomeViewModel{ get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Home.xaml b/src/cascadia/TerminalSettingsEditor/Home.xaml new file mode 100644 index 00000000000..f6e428f0996 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Home.xaml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp b/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp new file mode 100644 index 00000000000..248cb5d6c86 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "HomeGridItem.h" +#include "HomeGridItem.g.cpp" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + HomeGridItem::HomeGridItem(hstring const& title, hstring const& pageTag) : + _Title{ title }, + _PageTag{ pageTag } + { + } +} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.h b/src/cascadia/TerminalSettingsEditor/HomeGridItem.h new file mode 100644 index 00000000000..9b7a0e10f42 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.h @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once +#include "HomeGridItem.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct HomeGridItem : HomeGridItemT + { + HomeGridItem() = delete; + HomeGridItem(hstring const& title, hstring const& pageTag); + + WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); + OBSERVABLE_GETSET_PROPERTY(hstring, Title, _PropertyChangedHandlers); + OBSERVABLE_GETSET_PROPERTY(hstring, PageTag, _PropertyChangedHandlers); + }; +} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl b/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl new file mode 100644 index 00000000000..935be521f2f --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass HomeGridItem : Windows.UI.Xaml.Data.INotifyPropertyChanged + { + String Title; + String PageTag; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.cpp b/src/cascadia/TerminalSettingsEditor/Interaction.cpp new file mode 100644 index 00000000000..69c75b2dc56 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.cpp @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Interaction.h" +#include "Interaction.g.cpp" +#include + +using namespace winrt; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Interaction::Interaction() + { + m_globalSettingsModel = winrt::make(); + InitializeComponent(); + } + + Model::GlobalSettingsModel Interaction::GlobalSettingsModel() + { + return m_globalSettingsModel; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.h b/src/cascadia/TerminalSettingsEditor/Interaction.h new file mode 100644 index 00000000000..73d90c24f8b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.h @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Interaction.g.h" +#include "ObjectModel/GlobalSettingsModel.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Interaction : InteractionT + { + Interaction(); + + Model::GlobalSettingsModel GlobalSettingsModel(); + + private: + Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Interaction); +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.idl b/src/cascadia/TerminalSettingsEditor/Interaction.idl new file mode 100644 index 00000000000..342730d7ae0 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.idl @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import "ObjectModel/GlobalSettingsModel.idl"; + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] runtimeclass Interaction : Windows.UI.Xaml.Controls.Page + { + Interaction(); + + Microsoft.Terminal.Settings.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml new file mode 100644 index 00000000000..f30d8303e3b --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml b/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml new file mode 100644 index 00000000000..0e3b8b639a1 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/KeyBindingsPage.xaml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.cpp b/src/cascadia/TerminalSettingsEditor/Keybindings.cpp new file mode 100644 index 00000000000..6c2c5183ef8 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.cpp @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "Keybindings.h" +#include "Keybindings.g.cpp" + +#include "Utils.h" + +using namespace winrt; +using namespace winrt::Windows::Foundation; +using namespace winrt::Windows::UI::Xaml; +using namespace winrt::Windows::UI::Xaml::Input; +using namespace winrt::Windows::UI::Xaml::Controls::Primitives; +using namespace winrt::Windows::System; +using namespace winrt::Microsoft::Terminal::Settings; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Keybindings::Keybindings() + { + InitializeComponent(); + + m_optionalSettingsPanel = FindName(L"OptionalSettingsPanel").as(); + m_addNewButton = FindName(L"AddNewLink").as(); + + Controls::TextBox tb = FindName(L"KeyBindTextBox").as(); + tb.KeyDown({ this, &Keybindings::KeyDown }); + } + + void Keybindings::Button_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/) + { + Popup popup = FindName(L"StandardPopup").as(); + + if (!popup.IsOpen()) + { + popup.IsOpen(true); + } + } + + void Keybindings::AddNewButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) + { + hstring setting = GetSelectedItemTag(FindName(L"CommandComboBox")); + + Controls::StackPanel panel{}; + + if (setting == c_moveFocusTag || setting == c_resizePaneTag) + { + panel = FindName(L"moveResizeFocusOptionPanel").as(); + panel.Visibility(Visibility::Visible); + } + else + { + panel = FindName(setting + L"OptionPanel").as(); + bool panelWasVisible = (panel.Visibility() == Visibility::Visible); + panel.Visibility(Visibility::Visible); + m_lastOpenedArgsPanel = panel; + + Controls::HyperlinkButton button = sender.as(); + if (setting == c_splitPaneTag) + { + if (panelWasVisible) + { + panel.Children().Append(SplitPaneOptionPanelControl()); + } + button.Visibility(Visibility::Visible); + } + else if (setting == c_newTabTag) + { + panel.Children().Append(NewTabOptionPanelControl()); + button.Visibility(Visibility::Visible); + } + else + { + button.Visibility(Visibility::Collapsed); + } + } + + m_lastOpenedArgsPanel = panel; + } + + hstring Keybindings::GetKeyListString() + { + hstring generatedString = L""; + boolean lastKeyWasModifier{}; + + if (m_keysInBind.find(VirtualKey::Control) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Control); + lastKeyWasModifier = true; + } + + if (m_keysInBind.find(VirtualKey::Shift) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Shift); + lastKeyWasModifier = true; + } + + if (m_keysInBind.find(VirtualKey::Menu) != m_keysInBind.end()) + { + generatedString = generatedString + KeyToString(VirtualKey::Menu); + lastKeyWasModifier = true; + } + + for (const auto& key : m_keysInBind) + { + if (key != VirtualKey::Control && key != VirtualKey::Shift && key != VirtualKey::Menu) + { + hstring keyString = KeyToString(key); + + if (!keyString.empty()) + { + if (!generatedString.empty() && !lastKeyWasModifier) + { + generatedString = generatedString + L"+"; + } + generatedString = generatedString + KeyToString(key); + lastKeyWasModifier = false; + } + } + } + + return generatedString; + } + + void Keybindings::KeyDown(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) + { + Controls::TextBox textBox = sender.as(); + + if (e.Key() == VirtualKey::Back) + { + m_keysInBind.clear(); + } + else + { + m_keysInBind.insert(e.Key()); + if (textBox != nullptr) + { + textBox.Text(GetKeyListString()); + } + } + + e.Handled(true); + } + + void Keybindings::KeyBindTextBox_TextChanging(winrt::Windows::UI::Xaml::Controls::TextBox const& sender, winrt::Windows::UI::Xaml::Controls::TextBoxTextChangingEventArgs const& /*args*/) + { + hstring currText = sender.Text(); + hstring newText = hstring(currText.data(), currText.size()); + + sender.Text(newText); + } + + void Keybindings::ShowOptionsButtonIfRequired(hstring tag) + { + std::set settingsWithOptions; + settingsWithOptions.insert(c_openSettingsTag); + settingsWithOptions.insert(c_newTabTag); + settingsWithOptions.insert(c_switchToTabTag); + settingsWithOptions.insert(c_renameTabTag); + settingsWithOptions.insert(c_setTabColorTag); + settingsWithOptions.insert(c_moveFocusTag); + settingsWithOptions.insert(c_resizePaneTag); + settingsWithOptions.insert(c_splitPaneTag); + settingsWithOptions.insert(c_copyTag); + + Windows::UI::Xaml::Visibility expectedVisibility = Visibility::Collapsed; + if (settingsWithOptions.find(tag) != settingsWithOptions.end()) + { + expectedVisibility = Visibility::Visible; + } + m_optionalSettingsPanel.Visibility(expectedVisibility); + m_addNewButton.Visibility(expectedVisibility); + if (m_lastOpenedArgsPanel != nullptr) + { + m_lastOpenedArgsPanel.Visibility(Visibility::Collapsed); + } + } + + void Keybindings::CommandComboBox_SelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& /*e*/) + { + hstring selectedItemTag = GetSelectedItemTag(sender); + ShowOptionsButtonIfRequired(selectedItemTag); + } + + void Keybindings::SaveButton_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) + { + // Collect the information here + winrt::Windows::UI::Popups::MessageDialog msg{ CollectInputData() }; + msg.ShowAsync(); + } + + hstring Keybindings::TraversePanel(const Controls::Panel& panel) + { + hstring fullInfo; + + for (const auto panelChild : panel.Children()) + { + if (Controls::ComboBox childComboBox = panelChild.try_as()) + { + fullInfo = fullInfo + childComboBox.Name() + L":" + GetSelectedItemTag(childComboBox); + } + else if (Controls::TextBox childTextBox = panelChild.try_as()) + { + fullInfo = fullInfo + childTextBox.Name() + L":" + childTextBox.Text(); + } + else if (Editor::NewTabOptionPanelControl ntOptionPanel = panelChild.try_as()) + { + fullInfo = fullInfo + ntOptionPanel.Argument() + L":" + ntOptionPanel.InputValue(); + } + else if (Editor::SplitPaneOptionPanelControl spOptionPanel = panelChild.try_as()) + { + fullInfo = fullInfo + spOptionPanel.Argument() + L":" + spOptionPanel.InputValue(); + } + else if (Controls::Grid grid = panelChild.try_as()) + { + fullInfo = fullInfo + TraversePanel(grid); + } + fullInfo = fullInfo + L"\n"; + } + + return fullInfo; + } + + hstring Keybindings::CollectInputData() + { + hstring fullInfo; + + Controls::ComboBox comboBox = FindName(L"CommandComboBox").as(); + fullInfo = fullInfo + comboBox.Name() + L":" + GetSelectedItemTag(comboBox) + L"\n"; + + Controls::TextBox textBox = FindName(L"KeyBindTextBox").as(); + fullInfo = fullInfo + textBox.Name() + L":" + textBox.Text() + L"\n"; + + fullInfo = fullInfo + TraversePanel(m_lastOpenedArgsPanel); + + return fullInfo; + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.h b/src/cascadia/TerminalSettingsEditor/Keybindings.h new file mode 100644 index 00000000000..548fbb8a8a4 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.h @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "Keybindings.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct Keybindings : KeybindingsT + { + Keybindings(); + + void Button_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + void AddNewButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + void KeyDown(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e); + void KeyBindTextBox_TextChanging(winrt::Windows::UI::Xaml::Controls::TextBox const& sender, winrt::Windows::UI::Xaml::Controls::TextBoxTextChangingEventArgs const& args); + void CommandComboBox_SelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& e); + void SaveButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + + private: + hstring GetKeyListString(); + void ShowOptionsButtonIfRequired(hstring tag); + hstring CollectInputData(); + hstring TraversePanel(const winrt::Windows::UI::Xaml::Controls::Panel& panel); + + const hstring c_openSettingsTag = L"openSettings"; + const hstring c_newTabTag = L"newTab"; + const hstring c_switchToTabTag = L"switchToTab"; + const hstring c_renameTabTag = L"renameTab"; + const hstring c_setTabColorTag = L"setTabColor"; + const hstring c_moveFocusTag = L"moveFocus"; + const hstring c_resizePaneTag = L"resizePane"; + const hstring c_splitPaneTag = L"splitPane"; + const hstring c_copyTag = L"copy"; + + winrt::Windows::UI::Xaml::Controls::StackPanel m_lastOpenedArgsPanel{}; + winrt::Windows::UI::Xaml::Controls::StackPanel m_optionalSettingsPanel{}; + winrt::Windows::UI::Xaml::Controls::HyperlinkButton m_addNewButton{}; + + std::set m_keysInBind; + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(Keybindings); +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.idl b/src/cascadia/TerminalSettingsEditor/Keybindings.idl new file mode 100644 index 00000000000..4627c3d329e --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.idl @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + [default_interface] + runtimeclass Keybindings : Windows.UI.Xaml.Controls.Page + { + Keybindings(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.xaml b/src/cascadia/TerminalSettingsEditor/Keybindings.xaml new file mode 100644 index 00000000000..fc1a4b7f642 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Keybindings.xaml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -109,11 +109,11 @@ the MIT License. See LICENSE in the project root for license information. --> - - - - - - - - + + + + + @@ -24,479 +72,24 @@ the MIT License. See LICENSE in the project root for license information. --> Style="{StaticResource SubheaderTextBlockStyle}" Margin="0,0,0,20" Grid.Row="0" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp new file mode 100644 index 00000000000..4086908da83 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "ColorToHexConverter.h" +#include "ColorToHexConverter.g.cpp" + +using namespace winrt::Windows; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Foundation::IInspectable ColorToHexConverter::Convert(Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& /* targetType */, + Foundation::IInspectable const& /* parameter */, + hstring const& /* language */) + { + til::color color{ winrt::unbox_value(value) }; + auto hex = winrt::to_hstring(color.ToHexString().data()); + return winrt::box_value(hex); + } + + Foundation::IInspectable ColorToHexConverter::ConvertBack(Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& /* targetType */, + Foundation::IInspectable const& /* parameter */, + hstring const& /* language */) + { + auto str = winrt::unbox_value(value); + std::wstring hex{ str.data() }; + Windows::UI::Color newColor; + newColor.A = base::checked_cast(std::stoi(hex.substr(1, 2), nullptr, 16)); + newColor.R = base::checked_cast(std::stoi(hex.substr(3, 2), nullptr, 16)); + newColor.G = base::checked_cast(std::stoi(hex.substr(5, 2), nullptr, 16)); + newColor.B = base::checked_cast(std::stoi(hex.substr(7, 2), nullptr, 16)); + return winrt::box_value(newColor); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.h b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.h new file mode 100644 index 00000000000..53e2963dfd9 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.h @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "ColorToHexConverter.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct ColorToHexConverter : ColorToHexConverterT + { + ColorToHexConverter() = default; + + Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& targetType, + Windows::Foundation::IInspectable const& parameter, + hstring const& language); + + Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& targetType, + Windows::Foundation::IInspectable const& parameter, + hstring const& language); + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(ColorToHexConverter); +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.idl b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.idl new file mode 100644 index 00000000000..e16d4656ff0 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.idl @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass ColorToHexConverter : [default] Windows.UI.Xaml.Data.IValueConverter + { + ColorToHexConverter(); + }; +} diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp index ce45faf73b0..bb570307392 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp @@ -4,21 +4,21 @@ #include "pch.h" #include "GlobalAppearance.h" #include "GlobalAppearance.g.cpp" -#include +#include "MainPage.h" using namespace winrt; using namespace winrt::Windows::UI::Xaml; +using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { GlobalAppearance::GlobalAppearance() { - m_globalSettingsModel = winrt::make(); InitializeComponent(); } - Model::GlobalSettingsModel GlobalAppearance::GlobalSettingsModel() + GlobalAppSettings GlobalAppearance::GlobalSettings() { - return m_globalSettingsModel; + return MainPage::Settings().GlobalSettings(); } } diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h index cd1419c327b..0d9ad74ca2f 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.h @@ -4,7 +4,6 @@ #pragma once #include "GlobalAppearance.g.h" -#include "ObjectModel/GlobalSettingsModel.h" #include "Utils.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation @@ -12,11 +11,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation struct GlobalAppearance : GlobalAppearanceT { GlobalAppearance(); - - Model::GlobalSettingsModel GlobalSettingsModel(); - - private: - Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + winrt::Microsoft::Terminal::Settings::Model::GlobalAppSettings GlobalSettings(); }; } diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl index 1e032d50ddc..f8bc6af9b63 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl @@ -1,13 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import "ObjectModel/GlobalSettingsModel.idl"; - namespace Microsoft.Terminal.Settings.Editor { [default_interface] runtimeclass GlobalAppearance : Windows.UI.Xaml.Controls.Page { GlobalAppearance(); - Microsoft.Terminal.Settings.Editor.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + Microsoft.Terminal.Settings.Model.GlobalAppSettings GlobalSettings { get; }; } } diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml index 851d3c8ff17..c2947554d1b 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml @@ -30,15 +30,15 @@ the MIT License. See LICENSE in the project root for license information. --> - - - + + + - + diff --git a/src/cascadia/TerminalSettingsEditor/Home.cpp b/src/cascadia/TerminalSettingsEditor/Home.cpp index 2728f0ce98e..91afb85dc2c 100644 --- a/src/cascadia/TerminalSettingsEditor/Home.cpp +++ b/src/cascadia/TerminalSettingsEditor/Home.cpp @@ -29,8 +29,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { auto clickedItemContainer = args.ClickedItem().as(); hstring tag = clickedItemContainer->PageTag(); - MainPage mainPage; - mainPage.Navigate(frame(), tag); + MainPage::Navigate(frame(), tag); } Editor::SettingsEditorViewModel Home::HomeViewModel() diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.cpp b/src/cascadia/TerminalSettingsEditor/Interaction.cpp index 69c75b2dc56..3a0e57445d1 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.cpp +++ b/src/cascadia/TerminalSettingsEditor/Interaction.cpp @@ -4,21 +4,21 @@ #include "pch.h" #include "Interaction.h" #include "Interaction.g.cpp" -#include +#include "MainPage.h" using namespace winrt; using namespace winrt::Windows::UI::Xaml; +using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { Interaction::Interaction() { - m_globalSettingsModel = winrt::make(); InitializeComponent(); } - Model::GlobalSettingsModel Interaction::GlobalSettingsModel() + GlobalAppSettings Interaction::GlobalSettings() { - return m_globalSettingsModel; + return MainPage::Settings().GlobalSettings(); } } diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.h b/src/cascadia/TerminalSettingsEditor/Interaction.h index 73d90c24f8b..66c23b810e8 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.h +++ b/src/cascadia/TerminalSettingsEditor/Interaction.h @@ -4,18 +4,14 @@ #pragma once #include "Interaction.g.h" -#include "ObjectModel/GlobalSettingsModel.h" +#include "Utils.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { struct Interaction : InteractionT { Interaction(); - - Model::GlobalSettingsModel GlobalSettingsModel(); - - private: - Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + winrt::Microsoft::Terminal::Settings::Model::GlobalAppSettings GlobalSettings(); }; } diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.idl b/src/cascadia/TerminalSettingsEditor/Interaction.idl index bd6cf58085b..3167c660cfe 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.idl +++ b/src/cascadia/TerminalSettingsEditor/Interaction.idl @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import "ObjectModel/GlobalSettingsModel.idl"; - namespace Microsoft.Terminal.Settings.Editor { [default_interface] runtimeclass Interaction : Windows.UI.Xaml.Controls.Page { Interaction(); - - Microsoft.Terminal.Settings.Editor.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + Microsoft.Terminal.Settings.Model.GlobalAppSettings GlobalSettings { get; }; } } diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml index ee41589f4aa..59bc7f054f6 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.xaml +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -24,10 +24,11 @@ the MIT License. See LICENSE in the project root for license information. --> Style="{StaticResource SubheaderTextBlockStyle}" Margin="0,0,0,20" /> - - - - + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Launch.cpp b/src/cascadia/TerminalSettingsEditor/Launch.cpp index f1130545bd0..cfc220eb867 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.cpp +++ b/src/cascadia/TerminalSettingsEditor/Launch.cpp @@ -4,22 +4,21 @@ #include "pch.h" #include "Launch.h" #include "Launch.g.cpp" -#include +#include "MainPage.h" using namespace winrt; using namespace winrt::Windows::UI::Xaml; +using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { Launch::Launch() { - m_globalSettingsModel = winrt::make(); InitializeComponent(); } - Model::GlobalSettingsModel Launch::GlobalSettingsModel() + GlobalAppSettings Launch::GlobalSettings() { - return m_globalSettingsModel; + return MainPage::Settings().GlobalSettings(); } - } diff --git a/src/cascadia/TerminalSettingsEditor/Launch.h b/src/cascadia/TerminalSettingsEditor/Launch.h index 59582455dbf..053f380d9cb 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.h +++ b/src/cascadia/TerminalSettingsEditor/Launch.h @@ -4,7 +4,6 @@ #pragma once #include "Launch.g.h" -#include "ObjectModel/GlobalSettingsModel.h" #include "Utils.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation @@ -12,10 +11,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation struct Launch : LaunchT { Launch(); - Model::GlobalSettingsModel GlobalSettingsModel(); - - private: - Model::GlobalSettingsModel m_globalSettingsModel{ nullptr }; + winrt::Microsoft::Terminal::Settings::Model::GlobalAppSettings GlobalSettings(); }; } diff --git a/src/cascadia/TerminalSettingsEditor/Launch.idl b/src/cascadia/TerminalSettingsEditor/Launch.idl index 29c75995143..2afcb447b1d 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.idl +++ b/src/cascadia/TerminalSettingsEditor/Launch.idl @@ -1,14 +1,12 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import "ObjectModel/GlobalSettingsModel.idl"; - namespace Microsoft.Terminal.Settings.Editor { [default_interface] runtimeclass Launch : Windows.UI.Xaml.Controls.Page { Launch(); - Microsoft.Terminal.Settings.Editor.Model.GlobalSettingsModel GlobalSettingsModel { get; }; + Microsoft.Terminal.Settings.Model.GlobalAppSettings GlobalSettings { get; }; } } diff --git a/src/cascadia/TerminalSettingsEditor/Launch.xaml b/src/cascadia/TerminalSettingsEditor/Launch.xaml index 105c6aabbe1..4005ff5a918 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.xaml +++ b/src/cascadia/TerminalSettingsEditor/Launch.xaml @@ -24,17 +24,18 @@ the MIT License. See LICENSE in the project root for license information. --> Style="{StaticResource SubheaderTextBlockStyle}" Margin="0,0,0,20" /> - - + + - + + ToolTipService.Placement="Mouse"/> - - - + ToolTipService.Placement="Mouse"/>--> + + diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index a82539fe43b..fbfa5583b4e 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -22,18 +22,20 @@ namespace winrt using namespace winrt::Windows::Foundation; using namespace winrt::Windows::UI::Xaml; -using namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation; +using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { - MainPage::MainPage() + winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings MainPage::_settingsSource{ nullptr }; + + MainPage::MainPage(CascadiaSettings settings) { InitializeComponent(); // TODO GH#1564: When we actually connect this to Windows Terminal, // this section will clone the active AppSettings - _settingsSource = AppSettings(); - _settingsClone = _settingsSource.Clone(); + MainPage::_settingsSource = settings; + _settingsClone = nullptr; SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Add new profile"), L"AddNew_Nav")); SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Always show tabs"), L"GlobalAppearance_Nav")); @@ -64,6 +66,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Word delimiters"), L"Interaction_Nav")); } + CascadiaSettings MainPage::Settings() + { + return _settingsSource; + } + void MainPage::SettingsNav_Loaded(IInspectable const&, RoutedEventArgs const&) { //// set the initial selectedItem diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.h b/src/cascadia/TerminalSettingsEditor/MainPage.h index c8848d64595..ed0ce2d82af 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.h +++ b/src/cascadia/TerminalSettingsEditor/MainPage.h @@ -3,20 +3,21 @@ #pragma once +#include "Utils.h" #include "MainPage.g.h" -#include "ObjectModel/AppSettings.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { struct MainPage : MainPageT { - MainPage(); + MainPage() = delete; + MainPage(winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings settings); void SettingsNav_Loaded(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); void SettingsNav_ItemInvoked(Microsoft::UI::Xaml::Controls::NavigationView const& sender, Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs const& args); void SettingsNav_BackRequested(Microsoft::UI::Xaml::Controls::NavigationView const&, Microsoft::UI::Xaml::Controls::NavigationViewBackRequestedEventArgs const& args); bool On_BackRequested(); - void Navigate(Windows::UI::Xaml::Controls::Frame contentFrame, hstring clickedItemTag); + static void Navigate(Windows::UI::Xaml::Controls::Frame contentFrame, hstring clickedItemTag); std::map SearchList; @@ -25,11 +26,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void AutoSuggestBox_SuggestionChosen(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs args); void SearchSettings(hstring query, winrt::Windows::UI::Xaml::Controls::AutoSuggestBox& autoBox); + static winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings Settings(); + private: // XAML should data-bind to the _settingsClone // When "save" is pressed, _settingsSource = _settingsClone - Model::implementation::AppSettings _settingsSource; - Model::implementation::AppSettings _settingsClone; + static winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings _settingsSource; + winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings _settingsClone{ nullptr }; }; } diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.idl b/src/cascadia/TerminalSettingsEditor/MainPage.idl index f20e4335365..9a08c853bec 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.idl +++ b/src/cascadia/TerminalSettingsEditor/MainPage.idl @@ -6,6 +6,6 @@ namespace Microsoft.Terminal.Settings.Editor [default_interface] runtimeclass MainPage : Windows.UI.Xaml.Controls.Page { - MainPage(); + MainPage(Microsoft.Terminal.Settings.Model.CascadiaSettings settings); } } diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj index d8796874255..174334f6420 100644 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj @@ -1,297 +1,292 @@ - - - - - - false - - - - {CA5CAD1A-0b5e-45c3-96a8-bb496bfe4e32} - Microsoft.Terminal.Settings.Editor - Microsoft.Terminal.Settings.Editor - - - DynamicLibrary - Console - - true - - 4 - - true - nested - - - - - - - AddProfile.xaml - - - GlobalAppearance.xaml - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - Home.xaml - - - HomeGridItem.idl - - - Interaction.xaml - - - Keybindings.xaml - Code - - - Launch.xaml - - - SplitPaneOptionPanelControl.xaml - - - NewTabOptionPanelControl.xaml - - - - - - - - - - MainPage.xaml - - - ObjectModel/ProfileModel.idl - - - Profiles.xaml - Code - - - Rendering.xaml - - - - SettingsEditorViewModel.idl - - - - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - - - - AddProfile.xaml - - - GlobalAppearance.xaml - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - Home.xaml - - - HomeGridItem.idl - - - Interaction.xaml - - - Keybindings.xaml - Code - - - Launch.xaml - - - SplitPaneOptionPanelControl.xaml - - - NewTabOptionPanelControl.xaml - - - - - - - - - Create - - - MainPage.xaml - - - - ObjectModel/ProfileModel.idl - - - Profiles.xaml - Code - - - Rendering.xaml - - - - SettingsEditorViewModel.idl - - - - - - - Home.xaml - Code - - - GlobalAppearance.xaml - Code - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - - Launch.xaml - Code - - - Interaction.xaml - Code - - - - - - - - Rendering.xaml - Code - - - Keybindings.xaml - Code - - - MainPage.xaml - - - Profiles.xaml - Code - - - AddProfile.xaml - Code - - - SplitPaneOptionPanelControl.xaml - Code - - - NewTabOptionPanelControl.xaml - Code - - - - - - - - - - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - + + + + + + false + + + + {CA5CAD1A-0b5e-45c3-96a8-bb496bfe4e32} + Microsoft.Terminal.Settings.Editor + Microsoft.Terminal.Settings.Editor + + + DynamicLibrary + Console + + true + + 4 + + true + nested + + + + + + + AddProfile.xaml + + + ColorToHexConverter.idl + + + GlobalAppearance.xaml + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + Home.xaml + + + HomeGridItem.idl + + + Interaction.xaml + + + Keybindings.xaml + Code + + + Launch.xaml + + + SplitPaneOptionPanelControl.xaml + + + NewTabOptionPanelControl.xaml + + + + MainPage.xaml + + + Profiles.xaml + Code + + + Rendering.xaml + + + + SettingsEditorViewModel.idl + + + + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + + + + AddProfile.xaml + + + ColorToHexConverter.idl + + + GlobalAppearance.xaml + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + Home.xaml + + + HomeGridItem.idl + + + Interaction.xaml + + + Keybindings.xaml + Code + + + Launch.xaml + + + SplitPaneOptionPanelControl.xaml + + + NewTabOptionPanelControl.xaml + + + Create + + + MainPage.xaml + + + + Profiles.xaml + Code + + + Rendering.xaml + + + + SettingsEditorViewModel.idl + + + + + + + Home.xaml + Code + + + GlobalAppearance.xaml + Code + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + + Launch.xaml + Code + + + Interaction.xaml + Code + + + Rendering.xaml + Code + + + Keybindings.xaml + Code + + + MainPage.xaml + + + Profiles.xaml + Code + + + AddProfile.xaml + Code + + + SplitPaneOptionPanelControl.xaml + Code + + + NewTabOptionPanelControl.xaml + Code + + + + + + + + + + + + + + + false + + + false + + + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.cpp deleted file mode 100644 index 34e4b93d45b..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "pch.h" -#include "AppSettings.h" - -using namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation; - -// uncomment and edit these to test data binding - -//AppSettings::AppSettings() -//{ -//// Global Settings -//Globals = GlobalSettings(); -//Globals.DefaultProfile = L"{61c54bbd-c2c6-5271-96e7-009a87ff44bf}"; -//Globals.InitialCols = 120; -//Globals.InitialRows = 30; -//Globals.LaunchMode = AppLaunchMode::default; -//Globals.AlwaysOnTop = false; -//Globals.CopyOnSelect = false; -//Globals.CopyFormatting = true; -//Globals.WordDelimiters = L" /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502"; -//Globals.AlwaysShowTabs = true; -//Globals.ShowTabsInTitlebar = true; -//Globals.ShowTitleInTitlebar = true; -//Globals.TabWidthMode = TabViewWidthMode::equal; -//Globals.ConfirmCloseAllTabs = true; -//Globals.StartOnUserLogin = false; -//Globals.Theme = ElementTheme::system; -//Globals.SnapToGridOnResize = true; - -//// Profiles -//{ -// // Profile 1 -// auto x = Profile(); -// x.Guid = L"{61c54bbd-c2c6-5271-96e7-009a87ff44bf}"; -// x.Name = L"Windows PowerShell"; -// x.Commandline = L"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"; -// x.Icon = L"ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png"; -// x.ColorScheme = L"Campbell"; -// x.AntialiasingMode = TextAntialiasingMode::grayscale; -// x.CloseOnExit = CloseOnExitMode::graceful; -// x.CursorShape = CursorStyle::bar; -// x.FontFace = L"Cascadia Mono"; -// x.FontSize = 12; -// x.Hidden = false; -// x.HistorySize = 9001; -// x.Padding = L"8, 8, 8, 8"; -// x.SnapOnInput = true; -// x.AltGrAliasing = true; -// x.StartingDirectory = L"%USERPROFILE%"; -// x.UseAcrylic = false; - -// Profiles.push_back(x); - -// // Profile 2 -// auto y = Profile(); -// y.Guid = L"{0caa0dad-35be-5f56-a8ff-afceeeaa6101}"; -// y.Name = L"Command Prompt"; -// y.Commandline = L"%SystemRoot%\\System32\\cmd.exe"; -// y.Icon = L"ms-appx:///ProfileIcons/{0caa0dad-35be-5f56-a8ff-afceeeaa6101}.png"; -// y.ColorScheme = L"Campbell"; -// y.AntialiasingMode = TextAntialiasingMode::grayscale; -// y.CloseOnExit = CloseOnExitMode::graceful; -// y.CursorShape = CursorStyle::bar; -// y.FontFace = L"Cascadia Mono"; -// y.FontSize = 12; -// y.Hidden = false; -// y.HistorySize = 9001; -// y.Padding = L"8, 8, 8, 8"; -// y.SnapOnInput = true; -// y.AltGrAliasing = true; -// y.StartingDirectory = L"%USERPROFILE%"; -// y.UseAcrylic = false; - -// Profiles.push_back(y); -//} - -//// Color Schemes -//{ -// // too much work rn to handle adding color schemes -// // need to convert string to unsigned int -//} - -//// Bindings -//{ -// // too much work rn to handle adding key bindings -// // we don't have a quick-n-easy way to record keys -// // also, no representation for keybinding args yet -//} -//} - -//AppSettings AppSettings::Clone() -//{ -// // TODO: This is fake. But again, we get this out of the _real_ impl of this -// auto clone = AppSettings(); -// return clone; -//} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.h deleted file mode 100644 index ce33d224f51..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/AppSettings.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "GlobalSettings.h" -#include "Profile.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - enum class Modifiers - { - Shift = 0x1, - Alt = 0x2, - Ctrl = 0x4 - }; - - enum class Key - { - TODO_FIX - }; - - class KeyChord - { - Modifiers Mods; - Key Button; - }; - - enum class Action - { - adjustFontSize, - closePane, - closeTab, - closeWindow, - copy, - duplicateTab, - find, - moveFocus, - newTab, - nextTab, - openNewTabDropdown, - openSetting, - paste, - prevTab, - resetFontSize, - resizePane, - scrollDown, - scrollUp, - scrollUpPage, - scrollDownPage, - splitPane, - switchToTab, - toggleFullscreen - }; - - class AppSettings - { - public: - AppSettings() = default; - ~AppSettings() = default; - - AppSettings Clone() { return AppSettings(); } - - // Uncomment these to test some data binding - // GlobalSettings Globals; - // std::vector Profiles; - // std::map Schemes; - std::map Keybindings; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.cpp deleted file mode 100644 index 2361948f66b..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.cpp +++ /dev/null @@ -1,823 +0,0 @@ -#include "pch.h" -#include "ColorScheme.h" -#include "Model.ColorScheme.g.cpp" - -using namespace winrt; -using namespace winrt::Windows::UI; -using namespace winrt::Windows::UI::Core; -using namespace winrt::Windows::UI::Xaml::Data; -using namespace winrt::Windows::UI::Xaml::Media; - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - ColorScheme::ColorScheme() - { - _Background = Colors::Black(); - _Foreground = Colors::White(); - _Black = Colors::Black(); - _BrightBlack = Colors::DimGray(); - _Blue = Colors::Blue(); - _BrightBlue = Colors::LightBlue(); - _Cyan = Colors::Cyan(); - _BrightCyan = Colors::LightCyan(); - _Green = Colors::Green(); - _BrightGreen = Colors::LightGreen(); - _Purple = Colors::Purple(); - _BrightPurple = Colors::MediumPurple(); - _Red = Colors::Red(); - _BrightRed = Colors::IndianRed(); - _White = Colors::WhiteSmoke(); - _BrightWhite = Colors::White(); - _Yellow = Colors::Yellow(); - _BrightYellow = Colors::LightYellow(); - } - - // Background Handlers - Color ColorScheme::Background() - { - return _Background; - } - - void ColorScheme::Background(Brush const& brush) - { - ColorScheme::Background(brushToColor(brush)); - } - - void ColorScheme::Background(Color const& color) - { - if (cmpColor(color, _Background)) - { - _Background = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BackgroundBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BackgroundHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Background" }); - } - } - - Brush ColorScheme::BackgroundBrush() - { - return ColorScheme::colorToBrush(_Background); - } - - winrt::hstring ColorScheme::BackgroundHexValue() - { - return colorToHex(_Background); - } - - void ColorScheme::BackgroundHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Background(ColorScheme::hexToColor(hex)); - } - } - - // Foreground Handlers - Color ColorScheme::Foreground() - { - return _Foreground; - } - - void ColorScheme::Foreground(Brush const& brush) - { - ColorScheme::Foreground(brushToColor(brush)); - } - - void ColorScheme::Foreground(Color const& color) - { - if (cmpColor(color, _Foreground)) - { - _Foreground = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"ForegroundBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"ForegroundHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Foreground" }); - } - } - - Brush ColorScheme::ForegroundBrush() - { - return ColorScheme::colorToBrush(_Foreground); - } - - winrt::hstring ColorScheme::ForegroundHexValue() - { - return colorToHex(_Foreground); - } - - void ColorScheme::ForegroundHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Foreground(ColorScheme::hexToColor(hex)); - } - } - - // Black Handlers - Color ColorScheme::Black() - { - return _Black; - } - - void ColorScheme::Black(Brush const& brush) - { - ColorScheme::Black(brushToColor(brush)); - } - - void ColorScheme::Black(Color const& color) - { - if (cmpColor(color, _Black)) - { - _Black = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BlackBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BlackHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Black" }); - } - } - - Brush ColorScheme::BlackBrush() - { - return ColorScheme::colorToBrush(_Black); - } - - winrt::hstring ColorScheme::BlackHexValue() - { - return colorToHex(_Black); - } - - void ColorScheme::BlackHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Black(ColorScheme::hexToColor(hex)); - } - } - - // BrightBlack Handlers - Color ColorScheme::BrightBlack() - { - return _BrightBlack; - } - - void ColorScheme::BrightBlack(Brush const& brush) - { - ColorScheme::BrightBlack(brushToColor(brush)); - } - - void ColorScheme::BrightBlack(Color const& color) - { - if (cmpColor(color, _BrightBlack)) - { - _BrightBlack = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlackBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlackHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlack" }); - } - } - - Brush ColorScheme::BrightBlackBrush() - { - return ColorScheme::colorToBrush(_BrightBlack); - } - - winrt::hstring ColorScheme::BrightBlackHexValue() - { - return colorToHex(_BrightBlack); - } - - void ColorScheme::BrightBlackHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightBlack(ColorScheme::hexToColor(hex)); - } - } - - // Blue Handlers - Color ColorScheme::Blue() - { - return _Blue; - } - - void ColorScheme::Blue(Brush const& brush) - { - ColorScheme::Blue(brushToColor(brush)); - } - - void ColorScheme::Blue(Color const& color) - { - if (cmpColor(color, _Blue)) - { - _Blue = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BlueBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BlueHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Blue" }); - } - } - - Brush ColorScheme::BlueBrush() - { - return ColorScheme::colorToBrush(_Blue); - } - - winrt::hstring ColorScheme::BlueHexValue() - { - return colorToHex(_Blue); - } - - void ColorScheme::BlueHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Blue(ColorScheme::hexToColor(hex)); - } - } - - // BrightBlue Handlers - Color ColorScheme::BrightBlue() - { - return _BrightBlue; - } - - void ColorScheme::BrightBlue(Brush const& brush) - { - ColorScheme::BrightBlue(brushToColor(brush)); - } - - void ColorScheme::BrightBlue(Color const& color) - { - if (cmpColor(color, _BrightBlue)) - { - _BrightBlue = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlueBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlueHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightBlue" }); - } - } - - Brush ColorScheme::BrightBlueBrush() - { - return ColorScheme::colorToBrush(_BrightBlue); - } - - winrt::hstring ColorScheme::BrightBlueHexValue() - { - return colorToHex(_BrightBlue); - } - - void ColorScheme::BrightBlueHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightBlue(ColorScheme::hexToColor(hex)); - } - } - - // Cyan Handlers - Color ColorScheme::Cyan() - { - return _Cyan; - } - - void ColorScheme::Cyan(Brush const& brush) - { - ColorScheme::Cyan(brushToColor(brush)); - } - - void ColorScheme::Cyan(Color const& color) - { - if (cmpColor(color, _Cyan)) - { - _Cyan = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"CyanBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"CyanHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Cyan" }); - } - } - - Brush ColorScheme::CyanBrush() - { - return ColorScheme::colorToBrush(_Cyan); - } - - winrt::hstring ColorScheme::CyanHexValue() - { - return colorToHex(_Cyan); - } - - void ColorScheme::CyanHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Cyan(ColorScheme::hexToColor(hex)); - } - } - - // BrightCyan Handlers - Color ColorScheme::BrightCyan() - { - return _BrightCyan; - } - - void ColorScheme::BrightCyan(Brush const& brush) - { - ColorScheme::BrightCyan(brushToColor(brush)); - } - - void ColorScheme::BrightCyan(Color const& color) - { - if (cmpColor(color, _BrightCyan)) - { - _BrightCyan = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightCyanBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightCyanHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightCyan" }); - } - } - - Brush ColorScheme::BrightCyanBrush() - { - return ColorScheme::colorToBrush(_BrightCyan); - } - - winrt::hstring ColorScheme::BrightCyanHexValue() - { - return colorToHex(_BrightCyan); - } - - void ColorScheme::BrightCyanHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightCyan(ColorScheme::hexToColor(hex)); - } - } - - // Green Handlers - Color ColorScheme::Green() - { - return _Green; - } - - void ColorScheme::Green(Brush const& brush) - { - ColorScheme::Green(brushToColor(brush)); - } - - void ColorScheme::Green(Color const& color) - { - if (cmpColor(color, _Green)) - { - _Green = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"GreenBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"GreenHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Green" }); - } - } - - Brush ColorScheme::GreenBrush() - { - return ColorScheme::colorToBrush(_Green); - } - - winrt::hstring ColorScheme::GreenHexValue() - { - return colorToHex(_Green); - } - - void ColorScheme::GreenHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Green(ColorScheme::hexToColor(hex)); - } - } - - // BrightGreen Handlers - Color ColorScheme::BrightGreen() - { - return _BrightGreen; - } - - void ColorScheme::BrightGreen(Brush const& brush) - { - ColorScheme::BrightGreen(brushToColor(brush)); - } - - void ColorScheme::BrightGreen(Color const& color) - { - if (cmpColor(color, _BrightGreen)) - { - _BrightGreen = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightGreenBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightGreenHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightGreen" }); - } - } - - Brush ColorScheme::BrightGreenBrush() - { - return ColorScheme::colorToBrush(_BrightGreen); - } - - winrt::hstring ColorScheme::BrightGreenHexValue() - { - return colorToHex(_BrightGreen); - } - - void ColorScheme::BrightGreenHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightGreen(ColorScheme::hexToColor(hex)); - } - } - - // Purple Handlers - Color ColorScheme::Purple() - { - return _Purple; - } - - void ColorScheme::Purple(Brush const& brush) - { - ColorScheme::Purple(brushToColor(brush)); - } - - void ColorScheme::Purple(Color const& color) - { - if (cmpColor(color, _Purple)) - { - _Purple = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"PurpleBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"PurpleHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Purple" }); - } - } - - Brush ColorScheme::PurpleBrush() - { - return ColorScheme::colorToBrush(_Purple); - } - - winrt::hstring ColorScheme::PurpleHexValue() - { - return colorToHex(_Purple); - } - - void ColorScheme::PurpleHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Purple(ColorScheme::hexToColor(hex)); - } - } - - // BrightPurple Handlers - Color ColorScheme::BrightPurple() - { - return _BrightPurple; - } - - void ColorScheme::BrightPurple(Brush const& brush) - { - ColorScheme::BrightPurple(brushToColor(brush)); - } - - void ColorScheme::BrightPurple(Color const& color) - { - if (cmpColor(color, _BrightPurple)) - { - _BrightPurple = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightPurpleBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightPurpleHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightPurple" }); - } - } - - Brush ColorScheme::BrightPurpleBrush() - { - return ColorScheme::colorToBrush(_BrightPurple); - } - - winrt::hstring ColorScheme::BrightPurpleHexValue() - { - return colorToHex(_BrightPurple); - } - - void ColorScheme::BrightPurpleHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightPurple(ColorScheme::hexToColor(hex)); - } - } - - // Red Handlers - Color ColorScheme::Red() - { - return _Red; - } - - void ColorScheme::Red(Brush const& brush) - { - ColorScheme::Red(brushToColor(brush)); - } - - void ColorScheme::Red(Color const& color) - { - if (cmpColor(color, _Red)) - { - _Red = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"RedBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"RedHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Red" }); - } - } - - Brush ColorScheme::RedBrush() - { - return ColorScheme::colorToBrush(_Red); - } - - winrt::hstring ColorScheme::RedHexValue() - { - return colorToHex(_Red); - } - - void ColorScheme::RedHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Red(ColorScheme::hexToColor(hex)); - } - } - - // BrightRed Handlers - Color ColorScheme::BrightRed() - { - return _BrightRed; - } - - void ColorScheme::BrightRed(Brush const& brush) - { - ColorScheme::BrightRed(brushToColor(brush)); - } - - void ColorScheme::BrightRed(Color const& color) - { - if (cmpColor(color, _BrightRed)) - { - _BrightRed = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightRedBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightRedHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightRed" }); - } - } - - Brush ColorScheme::BrightRedBrush() - { - return ColorScheme::colorToBrush(_BrightRed); - } - - winrt::hstring ColorScheme::BrightRedHexValue() - { - return colorToHex(_BrightRed); - } - - void ColorScheme::BrightRedHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightRed(ColorScheme::hexToColor(hex)); - } - } - - // White Handlers - Color ColorScheme::White() - { - return _White; - } - - void ColorScheme::White(Brush const& brush) - { - ColorScheme::White(brushToColor(brush)); - } - - void ColorScheme::White(Color const& color) - { - if (cmpColor(color, _White)) - { - _White = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"WhiteBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"WhiteHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"White" }); - } - } - - Brush ColorScheme::WhiteBrush() - { - return ColorScheme::colorToBrush(_White); - } - - winrt::hstring ColorScheme::WhiteHexValue() - { - return colorToHex(_White); - } - - void ColorScheme::WhiteHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::White(ColorScheme::hexToColor(hex)); - } - } - - // BrightWhite Handlers - Color ColorScheme::BrightWhite() - { - return _BrightWhite; - } - - void ColorScheme::BrightWhite(Brush const& brush) - { - ColorScheme::BrightWhite(brushToColor(brush)); - } - - void ColorScheme::BrightWhite(Color const& color) - { - if (cmpColor(color, _BrightWhite)) - { - _BrightWhite = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightWhiteBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightWhiteHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightWhite" }); - } - } - - Brush ColorScheme::BrightWhiteBrush() - { - return ColorScheme::colorToBrush(_BrightWhite); - } - - winrt::hstring ColorScheme::BrightWhiteHexValue() - { - return colorToHex(_BrightWhite); - } - - void ColorScheme::BrightWhiteHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightWhite(ColorScheme::hexToColor(hex)); - } - } - - // Yellow Handlers - Color ColorScheme::Yellow() - { - return _Yellow; - } - - void ColorScheme::Yellow(Brush const& brush) - { - ColorScheme::Yellow(brushToColor(brush)); - } - - void ColorScheme::Yellow(Color const& color) - { - if (cmpColor(color, _Yellow)) - { - _Yellow = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"YellowBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"YellowHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"Yellow" }); - } - } - - Brush ColorScheme::YellowBrush() - { - return ColorScheme::colorToBrush(_Yellow); - } - - winrt::hstring ColorScheme::YellowHexValue() - { - return colorToHex(_Yellow); - } - - void ColorScheme::YellowHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::Yellow(ColorScheme::hexToColor(hex)); - } - } - - // BrightYellow Handlers - Color ColorScheme::BrightYellow() - { - return _BrightYellow; - } - - void ColorScheme::BrightYellow(Brush const& brush) - { - ColorScheme::BrightYellow(brushToColor(brush)); - } - - void ColorScheme::BrightYellow(Color const& color) - { - if (cmpColor(color, _BrightYellow)) - { - _BrightYellow = color; - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightYellowBrush" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightYellowHexValue" }); - _PropertyChanged(*this, PropertyChangedEventArgs{ L"BrightYellow" }); - } - } - - Brush ColorScheme::BrightYellowBrush() - { - return ColorScheme::colorToBrush(_BrightYellow); - } - - winrt::hstring ColorScheme::BrightYellowHexValue() - { - return colorToHex(_BrightYellow); - } - - void ColorScheme::BrightYellowHexValue(winrt::hstring hex) - { - // TODO: Dirty dirty hack - We should try to parse this string a little harder than checking that its 9 long - if (hex.size() == 9) - { - ColorScheme::BrightYellow(ColorScheme::hexToColor(hex)); - } - } - - // event handlers - event_token ColorScheme::PropertyChanged(PropertyChangedEventHandler const& handler) - { - return _PropertyChanged.add(handler); - } - - void ColorScheme::PropertyChanged(event_token const& token) - { - _PropertyChanged.remove(token); - } - - // helpers - - Color ColorScheme::hexToColor(winrt::hstring hex) - { - std::string string = winrt::to_string(hex); - Color newColor = Color(); - newColor.A = base::checked_cast(std::stoi(string.substr(1, 2), nullptr, 16)); - newColor.R = base::checked_cast(std::stoi(string.substr(3, 2), nullptr, 16)); - newColor.G = base::checked_cast(std::stoi(string.substr(5, 2), nullptr, 16)); - newColor.B = base::checked_cast(std::stoi(string.substr(7, 2), nullptr, 16)); - return newColor; - } - - winrt::hstring ColorScheme::colorToHex(Windows::UI::Color color) - { - char hex[10]; - snprintf(hex, sizeof hex, "#%02x%02x%02x%02x", color.A, color.R, color.G, color.B); - - return winrt::to_hstring(hex); - } - - bool ColorScheme::cmpColor(Color a, Color b) - { - if (a.A == b.A && a.R == b.R && a.G == b.G && a.B == b.B) - { - return false; - } - return true; - } - - Brush ColorScheme::colorToBrush(Color color) - { - return SolidColorBrush(color); - } - - Color ColorScheme::brushToColor(Brush brush) - { - return brush.as().Color(); - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.h deleted file mode 100644 index 1a3a59f753c..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.h +++ /dev/null @@ -1,186 +0,0 @@ -#pragma once - -#include "Model.ColorScheme.g.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct ColorScheme : ColorSchemeT - { - ColorScheme(); - - // Background - Windows::UI::Color Background(); - Windows::UI::Xaml::Media::Brush BackgroundBrush(); - winrt::hstring BackgroundHexValue(); - void BackgroundHexValue(winrt::hstring); - void Background(Windows::UI::Xaml::Media::Brush const& brush); - void Background(Windows::UI::Color const& color); - - //Foreground - Windows::UI::Color Foreground(); - Windows::UI::Xaml::Media::Brush ForegroundBrush(); - winrt::hstring ForegroundHexValue(); - void ForegroundHexValue(winrt::hstring); - void Foreground(Windows::UI::Xaml::Media::Brush const& brush); - void Foreground(Windows::UI::Color const& color); - - // Black - Windows::UI::Color Black(); - Windows::UI::Xaml::Media::Brush BlackBrush(); - winrt::hstring BlackHexValue(); - void BlackHexValue(winrt::hstring); - void Black(Windows::UI::Xaml::Media::Brush const& brush); - void Black(Windows::UI::Color const& color); - - // BrightBlack - Windows::UI::Color BrightBlack(); - Windows::UI::Xaml::Media::Brush BrightBlackBrush(); - winrt::hstring BrightBlackHexValue(); - void BrightBlackHexValue(winrt::hstring); - void BrightBlack(Windows::UI::Xaml::Media::Brush const& brush); - void BrightBlack(Windows::UI::Color const& color); - - // Blue - Windows::UI::Color Blue(); - Windows::UI::Xaml::Media::Brush BlueBrush(); - winrt::hstring BlueHexValue(); - void BlueHexValue(winrt::hstring); - void Blue(Windows::UI::Xaml::Media::Brush const& brush); - void Blue(Windows::UI::Color const& color); - - // BrightBlue - Windows::UI::Color BrightBlue(); - Windows::UI::Xaml::Media::Brush BrightBlueBrush(); - winrt::hstring BrightBlueHexValue(); - void BrightBlueHexValue(winrt::hstring); - void BrightBlue(Windows::UI::Xaml::Media::Brush const& brush); - void BrightBlue(Windows::UI::Color const& color); - - // Cyan - Windows::UI::Color Cyan(); - Windows::UI::Xaml::Media::Brush CyanBrush(); - winrt::hstring CyanHexValue(); - void CyanHexValue(winrt::hstring); - void Cyan(Windows::UI::Xaml::Media::Brush const& brush); - void Cyan(Windows::UI::Color const& color); - - // BrightCyan - Windows::UI::Color BrightCyan(); - Windows::UI::Xaml::Media::Brush BrightCyanBrush(); - winrt::hstring BrightCyanHexValue(); - void BrightCyanHexValue(winrt::hstring); - void BrightCyan(Windows::UI::Xaml::Media::Brush const& brush); - void BrightCyan(Windows::UI::Color const& color); - - // Green - Windows::UI::Color Green(); - Windows::UI::Xaml::Media::Brush GreenBrush(); - winrt::hstring GreenHexValue(); - void GreenHexValue(winrt::hstring); - void Green(Windows::UI::Xaml::Media::Brush const& brush); - void Green(Windows::UI::Color const& color); - - // BrightGreen - Windows::UI::Color BrightGreen(); - Windows::UI::Xaml::Media::Brush BrightGreenBrush(); - winrt::hstring BrightGreenHexValue(); - void BrightGreenHexValue(winrt::hstring); - void BrightGreen(Windows::UI::Xaml::Media::Brush const& brush); - void BrightGreen(Windows::UI::Color const& color); - - // Purple - Windows::UI::Color Purple(); - Windows::UI::Xaml::Media::Brush PurpleBrush(); - winrt::hstring PurpleHexValue(); - void PurpleHexValue(winrt::hstring); - void Purple(Windows::UI::Xaml::Media::Brush const& brush); - void Purple(Windows::UI::Color const& color); - - // BrightPurple - Windows::UI::Color BrightPurple(); - Windows::UI::Xaml::Media::Brush BrightPurpleBrush(); - winrt::hstring BrightPurpleHexValue(); - void BrightPurpleHexValue(winrt::hstring); - void BrightPurple(Windows::UI::Xaml::Media::Brush const& brush); - void BrightPurple(Windows::UI::Color const& color); - - // Red - Windows::UI::Color Red(); - Windows::UI::Xaml::Media::Brush RedBrush(); - winrt::hstring RedHexValue(); - void RedHexValue(winrt::hstring); - void Red(Windows::UI::Xaml::Media::Brush const& brush); - void Red(Windows::UI::Color const& color); - - // BrightRed - Windows::UI::Color BrightRed(); - Windows::UI::Xaml::Media::Brush BrightRedBrush(); - winrt::hstring BrightRedHexValue(); - void BrightRedHexValue(winrt::hstring); - void BrightRed(Windows::UI::Xaml::Media::Brush const& brush); - void BrightRed(Windows::UI::Color const& color); - - // White - Windows::UI::Color White(); - Windows::UI::Xaml::Media::Brush WhiteBrush(); - winrt::hstring WhiteHexValue(); - void WhiteHexValue(winrt::hstring); - void White(Windows::UI::Xaml::Media::Brush const& brush); - void White(Windows::UI::Color const& color); - - // BrightWhite - Windows::UI::Color BrightWhite(); - Windows::UI::Xaml::Media::Brush BrightWhiteBrush(); - winrt::hstring BrightWhiteHexValue(); - void BrightWhiteHexValue(winrt::hstring); - void BrightWhite(Windows::UI::Xaml::Media::Brush const& brush); - void BrightWhite(Windows::UI::Color const& color); - - // Yellow - Windows::UI::Color Yellow(); - Windows::UI::Xaml::Media::Brush YellowBrush(); - winrt::hstring YellowHexValue(); - void YellowHexValue(winrt::hstring); - void Yellow(Windows::UI::Xaml::Media::Brush const& brush); - void Yellow(Windows::UI::Color const& color); - - // BrightYellow - Windows::UI::Color BrightYellow(); - Windows::UI::Xaml::Media::Brush BrightYellowBrush(); - winrt::hstring BrightYellowHexValue(); - void BrightYellowHexValue(winrt::hstring); - void BrightYellow(Windows::UI::Xaml::Media::Brush const& brush); - void BrightYellow(Windows::UI::Color const& color); - - winrt::event_token PropertyChanged(Windows::UI::Xaml::Data::PropertyChangedEventHandler const& value); - void PropertyChanged(winrt::event_token const& token); - - private: - static bool cmpColor(Windows::UI::Color a, Windows::UI::Color b); - static winrt::hstring colorToHex(Windows::UI::Color); - static Windows::UI::Color hexToColor(winrt::hstring); - static Windows::UI::Xaml::Media::Brush colorToBrush(Windows::UI::Color); - static Windows::UI::Color brushToColor(Windows::UI::Xaml::Media::Brush); - - Windows::UI::Color _Background; - Windows::UI::Color _Foreground; - Windows::UI::Color _Black; - Windows::UI::Color _BrightBlack; - Windows::UI::Color _Blue; - Windows::UI::Color _BrightBlue; - Windows::UI::Color _Cyan; - Windows::UI::Color _BrightCyan; - Windows::UI::Color _Green; - Windows::UI::Color _BrightGreen; - Windows::UI::Color _Purple; - Windows::UI::Color _BrightPurple; - Windows::UI::Color _Red; - Windows::UI::Color _BrightRed; - Windows::UI::Color _White; - Windows::UI::Color _BrightWhite; - Windows::UI::Color _Yellow; - Windows::UI::Color _BrightYellow; - - winrt::event _PropertyChanged; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.idl deleted file mode 100644 index 6227a93d7f6..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorScheme.idl +++ /dev/null @@ -1,95 +0,0 @@ -namespace Microsoft.Terminal.Settings.Editor.Model -{ - runtimeclass ColorScheme : Windows.UI.Xaml.Data.INotifyPropertyChanged - { - // Background - Windows.UI.Color Background; - String BackgroundHexValue; - Windows.UI.Xaml.Media.Brush BackgroundBrush { get; }; - - //Foreground - Windows.UI.Color Foreground; - String ForegroundHexValue; - Windows.UI.Xaml.Media.Brush ForegroundBrush { get; }; - - // Black - Windows.UI.Color Black; - String BlackHexValue; - Windows.UI.Xaml.Media.Brush BlackBrush { get; }; - - // BrightBlack - Windows.UI.Color BrightBlack; - String BrightBlackHexValue; - Windows.UI.Xaml.Media.Brush BrightBlackBrush { get; }; - - // Blue - Windows.UI.Color Blue; - String BlueHexValue; - Windows.UI.Xaml.Media.Brush BlueBrush { get; }; - - // BrightBlue - Windows.UI.Color BrightBlue; - String BrightBlueHexValue; - Windows.UI.Xaml.Media.Brush BrightBlueBrush { get; }; - - // Cyan - Windows.UI.Color Cyan; - String CyanHexValue; - Windows.UI.Xaml.Media.Brush CyanBrush { get; }; - - // BrightCyan - Windows.UI.Color BrightCyan; - String BrightCyanHexValue; - Windows.UI.Xaml.Media.Brush BrightCyanBrush { get; }; - - // Green - Windows.UI.Color Green; - String GreenHexValue; - Windows.UI.Xaml.Media.Brush GreenBrush { get; }; - - // BrightGreen - Windows.UI.Color BrightGreen; - String BrightGreenHexValue; - Windows.UI.Xaml.Media.Brush BrightGreenBrush { get; }; - - // Purple - Windows.UI.Color Purple; - String PurpleHexValue; - Windows.UI.Xaml.Media.Brush PurpleBrush { get; }; - - // BrightPurple - Windows.UI.Color BrightPurple; - String BrightPurpleHexValue; - Windows.UI.Xaml.Media.Brush BrightPurpleBrush { get; }; - - // Red - Windows.UI.Color Red; - String RedHexValue; - Windows.UI.Xaml.Media.Brush RedBrush { get; }; - - // BrightRed - Windows.UI.Color BrightRed; - String BrightRedHexValue; - Windows.UI.Xaml.Media.Brush BrightRedBrush { get; }; - - // White - Windows.UI.Color White; - String WhiteHexValue; - Windows.UI.Xaml.Media.Brush WhiteBrush { get; }; - - // BrightWhite - Windows.UI.Color BrightWhite; - String BrightWhiteHexValue; - Windows.UI.Xaml.Media.Brush BrightWhiteBrush { get; }; - - // Yellow - Windows.UI.Color Yellow; - String YellowHexValue; - Windows.UI.Xaml.Media.Brush YellowBrush { get; }; - - // BrightYellow - Windows.UI.Color BrightYellow; - String BrightYellowHexValue; - Windows.UI.Xaml.Media.Brush BrightYellowBrush { get; }; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.cpp deleted file mode 100644 index 1b369957945..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "pch.h" -#include "ColorScheme.h" -#include "Model.ColorSchemeModel.g.cpp" -#include "ColorSchemeModel.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - ColorSchemeModel::ColorSchemeModel() - { - m_colorScheme = winrt::make(); - } - Model::ColorScheme ColorSchemeModel::ColorScheme() - { - return m_colorScheme; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.h deleted file mode 100644 index 1a73c1e07ea..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "Model.ColorSchemeModel.g.h" -#include "ColorScheme.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct ColorSchemeModel : ColorSchemeModelT - { - ColorSchemeModel(); - - Model::ColorScheme ColorScheme(); - - private: - Model::ColorScheme m_colorScheme{ nullptr }; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.idl deleted file mode 100644 index d549c58b22c..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ColorSchemeModel.idl +++ /dev/null @@ -1,9 +0,0 @@ -import "ObjectModel/ColorScheme.idl"; - -namespace Microsoft.Terminal.Settings.Editor.Model -{ - runtimeclass ColorSchemeModel - { - ColorScheme ColorScheme { get; }; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/EnumBooleanConverter.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/EnumBooleanConverter.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.cpp deleted file mode 100644 index 76927de6c8a..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "pch.h" -#include "GlobalSettings.h" -#include "Model.GlobalSettings.g.cpp" diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.h deleted file mode 100644 index 3af3de67b3d..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include "Model.GlobalSettings.g.h" -#include -#include "../Utils.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct GlobalSettings : GlobalSettingsT - { - public: - GlobalSettings() = default; - - WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); - OBSERVABLE_GETSET_PROPERTY(hstring, DefaultProfile, _PropertyChangedHandlers, L"{61c54bbd-c2c6-5271-96e7-009a87ff44bf}"); - OBSERVABLE_GETSET_PROPERTY(int, InitialRows, _PropertyChangedHandlers, 120); - OBSERVABLE_GETSET_PROPERTY(int, InitialCols, _PropertyChangedHandlers, 30); - OBSERVABLE_GETSET_PROPERTY(bool, AlwaysShowTabs, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, ShowTitlebar, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, ShowTitleInTitlebar, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, ConfirmCloseAllTabs, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(Windows::UI::Xaml::ElementTheme, Theme, _PropertyChangedHandlers, Windows::UI::Xaml::ElementTheme::Default); - OBSERVABLE_GETSET_PROPERTY(TabViewWidthMode, TabWidthMode, _PropertyChangedHandlers, TabViewWidthMode::equal); - OBSERVABLE_GETSET_PROPERTY(bool, ShowTabsInTitlebar, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(hstring, WordDelimiters, _PropertyChangedHandlers, L" /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502"); - OBSERVABLE_GETSET_PROPERTY(bool, CopyOnSelect, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, CopyFormatting, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, WarnAboutLargePaste, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, WarnAboutMultiLinePaste, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(hstring, LaunchPosition, _PropertyChangedHandlers, L"(0,0)"); - OBSERVABLE_GETSET_PROPERTY(AppLaunchMode, LaunchMode, _PropertyChangedHandlers, AppLaunchMode::Default); - OBSERVABLE_GETSET_PROPERTY(bool, SnapToGridOnResize, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, ForceFullRepaintRendering, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, SoftwareRendering, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, ForceVTInput, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, DebugFeaturesEnabled, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, StartOnUserLogin, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, AlwaysOnTop, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, DisableDynamicProfiles, _PropertyChangedHandlers, false); - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.idl deleted file mode 100644 index a98d59d61b8..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettings.idl +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -namespace Microsoft.Terminal.Settings.Editor.Model -{ - enum TabViewWidthMode - { - equal, - titleLength, - compact - }; - enum AppLaunchMode - { - Default, - maximized - }; - - runtimeclass GlobalSettings : Windows.UI.Xaml.Data.INotifyPropertyChanged - { - //String UnparsedDefaultProfile(); - - String DefaultProfile; - Int32 InitialRows; - Int32 InitialCols; - Boolean AlwaysShowTabs; - Boolean ShowTitleInTitlebar; - Boolean ShowTitlebar; - Boolean ConfirmCloseAllTabs; - Windows.UI.Xaml.ElementTheme Theme; - TabViewWidthMode TabWidthMode; - AppLaunchMode LaunchMode; - Boolean ShowTabsInTitlebar; - String WordDelimiters; - Boolean CopyOnSelect; - Boolean CopyFormatting; - Boolean WarnAboutLargePaste; - Boolean WarnAboutMultiLinePaste; - String LaunchPosition; - // fix JsonConverters for these unique types - //LaunchPosition InitialPosition; - //AppLaunchMode LaunchMode; - Boolean SnapToGridOnResize; - Boolean ForceFullRepaintRendering; - Boolean SoftwareRendering; - Boolean ForceVTInput; - Boolean DebugFeaturesEnabled; - Boolean StartOnUserLogin; - Boolean AlwaysOnTop; - Boolean DisableDynamicProfiles; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.cpp deleted file mode 100644 index 1c2777aecd7..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "pch.h" -#include "GlobalSettings.h" -#include "Model.GlobalSettingsModel.g.cpp" -#include "GlobalSettingsModel.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - GlobalSettingsModel::GlobalSettingsModel() - { - m_globalSettings = nullptr; - m_globalSettings = winrt::make(); - } - Model::GlobalSettings GlobalSettingsModel::GlobalSettings() - { - return m_globalSettings; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.h deleted file mode 100644 index 194c191bd84..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "Model.GlobalSettingsModel.g.h" -#include "GlobalSettings.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct GlobalSettingsModel : GlobalSettingsModelT - { - GlobalSettingsModel(); - - Model::GlobalSettings GlobalSettings(); - - private: - Model::GlobalSettings m_globalSettings{ nullptr }; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.idl deleted file mode 100644 index 0afa5d0a32d..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/GlobalSettingsModel.idl +++ /dev/null @@ -1,9 +0,0 @@ -import "ObjectModel/GlobalSettings.idl"; - -namespace Microsoft.Terminal.Settings.Editor.Model -{ - runtimeclass GlobalSettingsModel - { - GlobalSettings GlobalSettings { get; }; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.cpp deleted file mode 100644 index 3276ed8b86c..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "pch.h" -#include "Profile.h" -#include "Model.Profile.g.cpp" - -using namespace winrt::Windows::UI::Xaml; -using namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation; - -HorizontalAlignment Profile::BackgroundImageHorizontalAlignment() const noexcept -{ - return std::get<0>(_BackgroundImageAlignment); -} - -void Profile::BackgroundImageHorizontalAlignment(const HorizontalAlignment& value) noexcept -{ - std::get<0>(_BackgroundImageAlignment) = value; -} - -VerticalAlignment Profile::BackgroundImageVerticalAlignment() const noexcept -{ - return std::get<1>(_BackgroundImageAlignment); -} - -void Profile::BackgroundImageVerticalAlignment(const VerticalAlignment& value) noexcept -{ - std::get<1>(_BackgroundImageAlignment) = value; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.h deleted file mode 100644 index c58b5876de1..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include "Model.Profile.g.h" -#include "Utils.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct Profile : ProfileT - { - public: - Profile() = default; - - WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); - OBSERVABLE_GETSET_PROPERTY(guid, Guid, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, Name, _PropertyChangedHandlers, L"Default"); - OBSERVABLE_GETSET_PROPERTY(hstring, Source, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(guid, ConnectionType, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, Icon, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(bool, Hidden, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(CloseOnExitMode, CloseOnExit, _PropertyChangedHandlers, CloseOnExitMode::graceful); - OBSERVABLE_GETSET_PROPERTY(hstring, TabTitle, _PropertyChangedHandlers); - - // Terminal Control Settings - OBSERVABLE_GETSET_PROPERTY(bool, UseAcrylic, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(double, AcrylicOpacity, _PropertyChangedHandlers, 0.5); - OBSERVABLE_GETSET_PROPERTY(ScrollbarState, ScrollState, _PropertyChangedHandlers, ScrollbarState::visible); - OBSERVABLE_GETSET_PROPERTY(hstring, FontFace, _PropertyChangedHandlers, L"Cascadia Mono"); - OBSERVABLE_GETSET_PROPERTY(int32_t, FontSize, _PropertyChangedHandlers, 12); - OBSERVABLE_GETSET_PROPERTY(Windows::UI::Text::FontWeight, FontWeight, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, Padding, _PropertyChangedHandlers, L"8, 8, 8, 8"); - OBSERVABLE_GETSET_PROPERTY(bool, CopyOnSelect, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(hstring, Commandline, _PropertyChangedHandlers, L"cmd.exe"); - OBSERVABLE_GETSET_PROPERTY(hstring, StartingDirectory, _PropertyChangedHandlers, L"%USERPROFILE%"); - OBSERVABLE_GETSET_PROPERTY(hstring, EnvironmentVariables, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, BackgroundImage, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(double, BackgroundImageOpacity, _PropertyChangedHandlers, 0.5); - OBSERVABLE_GETSET_PROPERTY(Windows::UI::Xaml::Media::Stretch, BackgroundImageStretchMode, _PropertyChangedHandlers, Windows::UI::Xaml::Media::Stretch::UniformToFill); - - public: - // BackgroundImageAlignment is 1 setting saved as 2 separate values - Windows::UI::Xaml::HorizontalAlignment BackgroundImageHorizontalAlignment() const noexcept; - void BackgroundImageHorizontalAlignment(const Windows::UI::Xaml::HorizontalAlignment& value) noexcept; - Windows::UI::Xaml::VerticalAlignment BackgroundImageVerticalAlignment() const noexcept; - void BackgroundImageVerticalAlignment(const Windows::UI::Xaml::VerticalAlignment& value) noexcept; - - OBSERVABLE_GETSET_PROPERTY(uint32_t, SelectionBackground, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(TextAntialiasingMode, AntialiasingMode, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(bool, RetroTerminalEffect, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, ForceFullRepaintRendering, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, SoftwareRendering, _PropertyChangedHandlers, false); - - // Terminal Core Settings - OBSERVABLE_GETSET_PROPERTY(uint32_t, DefaultForeground, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(uint32_t, DefaultBackground, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, ColorScheme, _PropertyChangedHandlers, L"Campbell"); - OBSERVABLE_GETSET_PROPERTY(int32_t, HistorySize, _PropertyChangedHandlers, 9001); - OBSERVABLE_GETSET_PROPERTY(int32_t, InitialRows, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(int32_t, InitialCols, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(bool, SnapOnInput, _PropertyChangedHandlers, true); - OBSERVABLE_GETSET_PROPERTY(bool, AltGrAliasing, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(uint32_t, CursorColor, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(CursorStyle, CursorShape, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(uint32_t, CursorHeight, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, StartingTitle, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(bool, SuppressApplicationTitle, _PropertyChangedHandlers, false); - OBSERVABLE_GETSET_PROPERTY(bool, ForceVTInput, _PropertyChangedHandlers, false); - - private: - std::tuple _BackgroundImageAlignment; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.idl deleted file mode 100644 index 20a2e4d1353..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/Profile.idl +++ /dev/null @@ -1,117 +0,0 @@ -namespace Microsoft.Terminal.Settings.Editor.Model -{ - enum CloseOnExitMode - { - graceful, - always, - never - }; - - enum ScrollbarState - { - visible, - Hidden - }; - - enum FontWeight - { - thin, - extra_light, - light, - semi_light, - normal, - medium, - semi_bold, - bold, - extra_bold, - black, - extra_black - }; - - enum Stretch - { - none, - fill, - uniform, - uniformToFill - }; - - enum TextAntialiasingMode - { - grayscale, - cleartype, - aliased - }; - - enum CursorStyle - { - vintage, - bar, - underscore, - filledBox, - emptyBox - }; - - runtimeclass Profile : Windows.UI.Xaml.Data.INotifyPropertyChanged - { - Guid Guid; - String Name; - String Source; - Guid ConnectionType; - String Icon; - Boolean Hidden; - CloseOnExitMode CloseOnExit; - String TabTitle; - - // Terminal Control Settings - Boolean UseAcrylic; - Double AcrylicOpacity; - ScrollbarState ScrollState; - - String FontFace; - Int32 FontSize; - Windows.UI.Text.FontWeight FontWeight; - String Padding; - - Boolean CopyOnSelect; - - String Commandline; - String StartingDirectory; - String EnvironmentVariables; - - String BackgroundImage; - Double BackgroundImageOpacity; - Windows.UI.Xaml.Media.Stretch BackgroundImageStretchMode; - Windows.UI.Xaml.HorizontalAlignment BackgroundImageHorizontalAlignment; - Windows.UI.Xaml.VerticalAlignment BackgroundImageVerticalAlignment; - - UInt32 SelectionBackground; - - TextAntialiasingMode AntialiasingMode; - - Boolean RetroTerminalEffect; - Boolean ForceFullRepaintRendering; - Boolean SoftwareRendering; - - // Terminal Core Settings - UInt32 DefaultForeground; - UInt32 DefaultBackground; - String ColorScheme; - - // TODO:MSFT:20642297 - define a sentinel for Infinite Scrollback - Int32 HistorySize; - Int32 InitialRows; - Int32 InitialCols; - - Boolean SnapOnInput; - Boolean AltGrAliasing; - - UInt32 CursorColor; - CursorStyle CursorShape; - UInt32 CursorHeight; - String StartingTitle; - Boolean SuppressApplicationTitle; - - Boolean ForceVTInput; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.cpp b/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.cpp deleted file mode 100644 index 6e7dec70ad6..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "pch.h" -#include "ObjectModel/Profile.h" -#include "Model.ProfileModel.g.cpp" -#include "ProfileModel.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - ProfileModel::ProfileModel() - { - m_Profile = winrt::make(); - } - - Model::Profile ProfileModel::Profile() - { - return m_Profile; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.h b/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.h deleted file mode 100644 index 3200eef2549..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "Model.ProfileModel.g.h" -#include "ObjectModel/Profile.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::Model::implementation -{ - struct ProfileModel : ProfileModelT - { - ProfileModel(); - - Model::Profile Profile(); - - private: - Model::Profile m_Profile{ nullptr }; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.idl deleted file mode 100644 index 73c7088790a..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/ProfileModel.idl +++ /dev/null @@ -1,9 +0,0 @@ -import "ObjectModel/Profile.idl"; - -namespace Microsoft.Terminal.Settings.Editor.Model -{ - runtimeclass ProfileModel - { - Profile Profile { get; }; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/ObjectModel/SettingsTypes.idl b/src/cascadia/TerminalSettingsEditor/ObjectModel/SettingsTypes.idl deleted file mode 100644 index d48ea58bd5a..00000000000 --- a/src/cascadia/TerminalSettingsEditor/ObjectModel/SettingsTypes.idl +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -namespace SettingsControl -{ - enum CloseOnExitMode - { - Never, - Graceful, - Always - }; - - struct LaunchPosition - { - Windows.Foundation.IReference X; - Windows.Foundation.IReference Y; - }; - - enum AppLaunchMode - { - DefaultMode, - MaximizedMode, - FullscreenMode - }; - - enum CursorStyle - { - Vintage, - Bar, - Underscore, - FilledBox, - EmptyBox - }; - - enum Direction - { - None = 0, - Left, - Right, - Up, - Down - }; - - enum SplitState - { - Automatic = -1, - None = 0, - Vertical = 1, - Horizontal = 2 - }; - - enum SplitType - { - Manual = 0, - Duplicate = 1 - }; - - enum SettingsTarget - { - SettingsFile = 0, - DefaultsFile, - AllFiles - }; - - enum ScrollbarState - { - Visible = 0, - Hidden - }; - - enum TextAntialiasingMode - { - Grayscale = 0, - Cleartype, - Aliased - }; - - // This is a 1-to-1 translation of MUX::TabViewWidthMode - enum TabWidthMode - { - Equal = 0, - TitleLength, - Compact - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.cpp b/src/cascadia/TerminalSettingsEditor/Profiles.cpp index 08380f29254..695f85dcfb5 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.cpp +++ b/src/cascadia/TerminalSettingsEditor/Profiles.cpp @@ -8,24 +8,19 @@ using namespace winrt::Windows::Foundation; using namespace winrt::Windows::Storage; using namespace winrt::Windows::Storage::AccessCache; using namespace winrt::Windows::Storage::Pickers; +using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { Profiles::Profiles() { - m_profileModel = winrt::make(); InitializeComponent(); } - Profiles::Profiles(Model::ProfileModel profile) : - m_profileModel{ profile } + Profiles::Profiles(Settings::Model::Profile profile) { InitializeComponent(); - } - - Model::ProfileModel Profiles::ProfileModel() - { - return m_profileModel; + Profile(profile); } fire_and_forget Profiles::BackgroundImage_Click(IInspectable const&, RoutedEventArgs const&) @@ -69,10 +64,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation fire_and_forget Profiles::StartingDirectory_Click(IInspectable const&, RoutedEventArgs const&) { auto lifetime = get_strong(); - FolderPicker picker; picker.SuggestedStartLocation(PickerLocationId::DocumentsLibrary); - StorageFolder folder = co_await picker.PickSingleFolderAsync(); if (folder != nullptr) { diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.h b/src/cascadia/TerminalSettingsEditor/Profiles.h index 39f470ef5ea..08974594ff5 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.h +++ b/src/cascadia/TerminalSettingsEditor/Profiles.h @@ -1,29 +1,27 @@ -// Copyright (c) Microsoft Corporation. + +// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. #pragma once +#include "Utils.h" #include "Profiles.g.h" -#include "ObjectModel/ProfileModel.h" namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { struct Profiles : ProfilesT { + public: Profiles(); - Profiles(Model::ProfileModel profile); - - Model::ProfileModel ProfileModel(); - - private: - Model::ProfileModel m_profileModel{ nullptr }; + Profiles(winrt::Microsoft::Terminal::Settings::Model::Profile profile); - public: fire_and_forget BackgroundImage_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); fire_and_forget Commandline_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); // TODO GH#1564: Settings UI // This crashes on click, for some reason //fire_and_forget StartingDirectory_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + + GETSET_PROPERTY(winrt::Microsoft::Terminal::Settings::Model::Profile, Profile); }; } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.idl b/src/cascadia/TerminalSettingsEditor/Profiles.idl index 49757eb2e48..da68e3975a9 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.idl +++ b/src/cascadia/TerminalSettingsEditor/Profiles.idl @@ -1,13 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -import "ObjectModel/ProfileModel.idl"; - namespace Microsoft.Terminal.Settings.Editor { [default_interface] runtimeclass Profiles : Windows.UI.Xaml.Controls.Page { Profiles(); - Microsoft.Terminal.Settings.Editor.Model.ProfileModel ProfileModel { get; }; + Microsoft.Terminal.Settings.Model.Profile Profile { get; }; } } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index e3f8f063a33..8382bf4c568 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -10,6 +10,20 @@ the MIT License. See LICENSE in the project root for license information. --> xmlns:Controls="using:Microsoft.UI.Xaml.Controls" xmlns:Windows10version1809="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 7)" mc:Ignorable="d"> + + + + + + - + @@ -125,11 +139,11 @@ the MIT License. See LICENSE in the project root for license information. --> + IsColorChannelTextInputVisible="False" + IsHexInputVisible="False" + IsAlphaEnabled="False" + IsAlphaSliderVisible="True" + IsAlphaTextInputVisible="True" /> @@ -150,11 +164,11 @@ the MIT License. See LICENSE in the project root for license information. --> + IsColorChannelTextInputVisible="False" + IsHexInputVisible="False" + IsAlphaEnabled="False" + IsAlphaSliderVisible="True" + IsAlphaTextInputVisible="True" /> @@ -175,17 +189,17 @@ the MIT License. See LICENSE in the project root for license information. --> + IsColorChannelTextInputVisible="False" + IsHexInputVisible="False" + IsAlphaEnabled="False" + IsAlphaSliderVisible="True" + IsAlphaTextInputVisible="True" /> - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - + + + + - - - - - + + @@ -68,29 +54,98 @@ the MIT License. See LICENSE in the project root for license information. --> + + Style="{StaticResource SubheaderTextBlockStyle}" + Margin="10,0,0,20" + Grid.Row="0" /> + Grid.Column="0"> + Margin="10,0,0,0" + SelectedIndex="0" + ItemsSource="{x:Bind ColorSchemeList, Mode=OneWay}" + SelectionChanged="ColorSchemeSelectionChanged" Width="160"> - - - - + Grid.Row="2" + Grid.Column="0"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.cpp b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.cpp new file mode 100644 index 00000000000..2cdefb6eb09 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.cpp @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "pch.h" +#include "ColorToBrushConverter.h" +#include "ColorToBrushConverter.g.cpp" + +using namespace winrt::Windows; +using namespace winrt::Windows::UI::Xaml; + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + Foundation::IInspectable ColorToBrushConverter::Convert(Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& /* targetType */, + Foundation::IInspectable const& /* parameter */, + hstring const& /* language */) + { + return winrt::box_value(Windows::UI::Xaml::Media::SolidColorBrush(winrt::unbox_value(value))); + } + + Foundation::IInspectable ColorToBrushConverter::ConvertBack(Foundation::IInspectable const& /*value*/, + Windows::UI::Xaml::Interop::TypeName const& /* targetType */, + Foundation::IInspectable const& /*parameter*/, + hstring const& /* language */) + { + throw hresult_not_implemented(); + } +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.h b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.h new file mode 100644 index 00000000000..94c20db6d7d --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.h @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#pragma once + +#include "ColorToBrushConverter.g.h" +#include "Utils.h" + +namespace winrt::Microsoft::Terminal::Settings::Editor::implementation +{ + struct ColorToBrushConverter : ColorToBrushConverterT + { + ColorToBrushConverter() = default; + + Windows::Foundation::IInspectable Convert(Windows::Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& targetType, + Windows::Foundation::IInspectable const& parameter, + hstring const& language); + + Windows::Foundation::IInspectable ConvertBack(Windows::Foundation::IInspectable const& value, + Windows::UI::Xaml::Interop::TypeName const& targetType, + Windows::Foundation::IInspectable const& parameter, + hstring const& language); + }; +} + +namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation +{ + BASIC_FACTORY(ColorToBrushConverter); +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.idl b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.idl new file mode 100644 index 00000000000..fb4346e42ef --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/ColorToBrushConverter.idl @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +namespace Microsoft.Terminal.Settings.Editor +{ + runtimeclass ColorToBrushConverter : [default] Windows.UI.Xaml.Data.IValueConverter + { + ColorToBrushConverter(); + }; +} diff --git a/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp index 4086908da83..1d9379ab3cb 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp +++ b/src/cascadia/TerminalSettingsEditor/ColorToHexConverter.cpp @@ -20,18 +20,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation return winrt::box_value(hex); } - Foundation::IInspectable ColorToHexConverter::ConvertBack(Foundation::IInspectable const& value, + Foundation::IInspectable ColorToHexConverter::ConvertBack(Foundation::IInspectable const& /*value*/, Windows::UI::Xaml::Interop::TypeName const& /* targetType */, - Foundation::IInspectable const& /* parameter */, + Foundation::IInspectable const& /*parameter*/, hstring const& /* language */) { - auto str = winrt::unbox_value(value); - std::wstring hex{ str.data() }; - Windows::UI::Color newColor; - newColor.A = base::checked_cast(std::stoi(hex.substr(1, 2), nullptr, 16)); - newColor.R = base::checked_cast(std::stoi(hex.substr(3, 2), nullptr, 16)); - newColor.G = base::checked_cast(std::stoi(hex.substr(5, 2), nullptr, 16)); - newColor.B = base::checked_cast(std::stoi(hex.substr(7, 2), nullptr, 16)); - return winrt::box_value(newColor); + throw hresult_not_implemented(); } } diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj index 174334f6420..ac62f377dd3 100644 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj @@ -1,292 +1,311 @@ - - - - - - false - - - - {CA5CAD1A-0b5e-45c3-96a8-bb496bfe4e32} - Microsoft.Terminal.Settings.Editor - Microsoft.Terminal.Settings.Editor - - - DynamicLibrary - Console - - true - - 4 - - true - nested - - - - - - - AddProfile.xaml - - - ColorToHexConverter.idl - - - GlobalAppearance.xaml - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - Home.xaml - - - HomeGridItem.idl - - - Interaction.xaml - - - Keybindings.xaml - Code - - - Launch.xaml - - - SplitPaneOptionPanelControl.xaml - - - NewTabOptionPanelControl.xaml - - - - MainPage.xaml - - - Profiles.xaml - Code - - - Rendering.xaml - - - - SettingsEditorViewModel.idl - - - - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - Designer - - - - - - AddProfile.xaml - - - ColorToHexConverter.idl - - - GlobalAppearance.xaml - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - Home.xaml - - - HomeGridItem.idl - - - Interaction.xaml - - - Keybindings.xaml - Code - - - Launch.xaml - - - SplitPaneOptionPanelControl.xaml - - - NewTabOptionPanelControl.xaml - - - Create - - - MainPage.xaml - - - - Profiles.xaml - Code - - - Rendering.xaml - - - - SettingsEditorViewModel.idl - - - - - - - Home.xaml - Code - - - GlobalAppearance.xaml - Code - - - ColorSchemes.xaml - Code - - - Globals.xaml - Code - - - - Launch.xaml - Code - - - Interaction.xaml - Code - - - Rendering.xaml - Code - - - Keybindings.xaml - Code - - - MainPage.xaml - - - Profiles.xaml - Code - - - AddProfile.xaml - Code - - - SplitPaneOptionPanelControl.xaml - Code - - - NewTabOptionPanelControl.xaml - Code - - - - - - - - - - - - - - - false - - - false - - - false - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + + + + + + false + + + + {CA5CAD1A-0b5e-45c3-96a8-bb496bfe4e32} + Microsoft.Terminal.Settings.Editor + Microsoft.Terminal.Settings.Editor + + + DynamicLibrary + Console + + true + + 4 + + true + nested + + + + + + + AddProfile.xaml + + + ColorToBrushConverter.idl + + + ColorToHexConverter.idl + + + GlobalAppearance.xaml + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + Home.xaml + + + HomeGridItem.idl + + + Interaction.xaml + + + Keybindings.xaml + Code + + + Launch.xaml + + + SplitPaneOptionPanelControl.xaml + + + NewTabOptionPanelControl.xaml + + + + MainPage.xaml + + + Profiles.xaml + Code + + + Rendering.xaml + + + + SettingsEditorViewModel.idl + + + + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + + + + AddProfile.xaml + + + ColorToBrushConverter.idl + + + ColorToHexConverter.idl + + + GlobalAppearance.xaml + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + Home.xaml + + + HomeGridItem.idl + + + Interaction.xaml + + + Keybindings.xaml + Code + + + Launch.xaml + + + SplitPaneOptionPanelControl.xaml + + + NewTabOptionPanelControl.xaml + + + Create + + + MainPage.xaml + + + + Profiles.xaml + Code + + + Rendering.xaml + + + + SettingsEditorViewModel.idl + + + + + + + + Home.xaml + Code + + + GlobalAppearance.xaml + Code + + + ColorSchemes.xaml + Code + + + Globals.xaml + Code + + + + Launch.xaml + Code + + + Interaction.xaml + Code + + + Rendering.xaml + Code + + + Keybindings.xaml + Code + + + MainPage.xaml + + + Profiles.xaml + Code + + + AddProfile.xaml + Code + + + SplitPaneOptionPanelControl.xaml + Code + + + NewTabOptionPanelControl.xaml + Code + + + + + + + Designer + + + + + + + + + + + {18D09A24-8240-42D6-8CB6-236EEE820263} + + + {CA5CAD1A-039A-4929-BA2A-8BEB2E4106FE} + false + + + false + + + false + + + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters new file mode 100644 index 00000000000..29457622184 --- /dev/null +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + Converters + + + Converters + + + + + + + + + + + + + + + + + + + + + + + + + + {00f725c8-41b4-40a8-995e-8ee2e49a4a4c} + + + \ No newline at end of file diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index 70b25c880a3..1e11525dc64 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Background @@ -153,10 +153,13 @@ Color schemes + + Cursor color + Cyan - + Foreground @@ -165,6 +168,9 @@ Purple + + Selection background + Red diff --git a/src/cascadia/TerminalSettingsEditor/Utils.cpp b/src/cascadia/TerminalSettingsEditor/Utils.cpp index dce1357187e..da1dfcc54dc 100644 --- a/src/cascadia/TerminalSettingsEditor/Utils.cpp +++ b/src/cascadia/TerminalSettingsEditor/Utils.cpp @@ -6,11 +6,15 @@ #include "pch.h" #include "Utils.h" +#include + using namespace winrt; using namespace winrt::Windows::System; using namespace winrt::Windows::Foundation; using namespace winrt::Windows::UI::Xaml; +UTILS_DEFINE_LIBRARY_RESOURCE_SCOPE(L"Microsoft.Terminal.Settings.Editor/Resources"); + namespace winrt::Microsoft::Terminal::Settings { hstring GetSelectedItemTag(winrt::Windows::Foundation::IInspectable const& comboBoxAsInspectable) From b757e822f3eb652a827b70a3fa6b4dc4a5fd85f2 Mon Sep 17 00:00:00 2001 From: Dustin Howett Date: Tue, 27 Oct 2020 15:16:52 -0700 Subject: [PATCH 14/87] Fix build for broken merge in 15b4565c7 --- src/cascadia/TerminalApp/TerminalPage.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 5b1d302fc1c..4f248617545 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2269,10 +2269,9 @@ namespace winrt::TerminalApp::implementation for (const auto& tab : _tabs) { - auto tabImpl{ _GetStrongTabImpl(tab) }; - if (tabImpl->GetTabViewItem().ContextFlyout()) + if (tab.TabViewItem().ContextFlyout()) { - tabImpl->GetTabViewItem().ContextFlyout().Hide(); + tab.TabViewItem().ContextFlyout().Hide(); } } } From 22805bdaff36307b77c9d145d8162f1f3f8278fa Mon Sep 17 00:00:00 2001 From: Kayla Cinnamon Date: Tue, 27 Oct 2020 15:35:03 -0700 Subject: [PATCH 15/87] Fix spacing on profile advanced page (#8065) When I did the polishing I forgot to do the Advanced page under profiles. I fixed that here. --- src/cascadia/TerminalSettingsEditor/Profiles.xaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index 8ccd6700642..cbc037b6d6d 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -243,17 +243,17 @@ the MIT License. See LICENSE in the project root for license information. --> - - - + + + - - - - + + + + From e2dcd1615e1fa96eb610f0570fa262932ae62f4d Mon Sep 17 00:00:00 2001 From: Kayla Cinnamon Date: Wed, 28 Oct 2020 13:57:37 -0700 Subject: [PATCH 16/87] Hide incomplete settings UI features (#8078) ## Summary of the Pull Request Removed the following from the navigation menu: - Search bar - Home page - Keyboard page Changed landing page to Launch page ![image](https://user-images.githubusercontent.com/48369326/97476068-3afe2180-190b-11eb-9c9b-9b0c07a6974c.png) ## References #1564 ## PR Checklist * [ ] Closes #xxx * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- src/cascadia/TerminalSettingsEditor/Home.cpp | 40 ------- src/cascadia/TerminalSettingsEditor/Home.h | 28 ----- src/cascadia/TerminalSettingsEditor/Home.idl | 13 --- src/cascadia/TerminalSettingsEditor/Home.xaml | 79 ------------- .../TerminalSettingsEditor/HomeGridItem.cpp | 15 --- .../TerminalSettingsEditor/HomeGridItem.h | 19 ---- .../TerminalSettingsEditor/HomeGridItem.idl | 11 -- .../TerminalSettingsEditor/MainPage.cpp | 104 +----------------- .../TerminalSettingsEditor/MainPage.h | 7 -- .../TerminalSettingsEditor/MainPage.xaml | 44 -------- ...Microsoft.Terminal.Settings.Editor.vcxproj | 27 ----- ...t.Terminal.Settings.Editor.vcxproj.filters | 3 - .../SettingsEditorViewModel.cpp | 24 ---- .../SettingsEditorViewModel.h | 22 ---- .../SettingsEditorViewModel.idl | 13 --- 15 files changed, 3 insertions(+), 446 deletions(-) delete mode 100644 src/cascadia/TerminalSettingsEditor/Home.cpp delete mode 100644 src/cascadia/TerminalSettingsEditor/Home.h delete mode 100644 src/cascadia/TerminalSettingsEditor/Home.idl delete mode 100644 src/cascadia/TerminalSettingsEditor/Home.xaml delete mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp delete mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.h delete mode 100644 src/cascadia/TerminalSettingsEditor/HomeGridItem.idl delete mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.cpp delete mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.h delete mode 100644 src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.idl diff --git a/src/cascadia/TerminalSettingsEditor/Home.cpp b/src/cascadia/TerminalSettingsEditor/Home.cpp deleted file mode 100644 index 91afb85dc2c..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Home.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "pch.h" -#include "Home.h" -#include "Home.g.cpp" -#include "MainPage.h" - -using namespace winrt; -using namespace winrt::Windows::UI::Xaml; - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - Home::Home() - { - m_homeViewModel = winrt::make(); - InitializeComponent(); - - HomeViewModel().HomeGridItems().Append(winrt::make(L"Startup", L"Launch_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Interaction", L"Interaction_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Rendering", L"Rendering_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Global appearance", L"GlobalAppearance_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Color schemes", L"ColorSchemes_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Global profile settings", L"GlobalProfile_Nav")); - HomeViewModel().HomeGridItems().Append(winrt::make(L"Keyboard", L"Keyboard_Nav")); - } - - void Home::HomeGridItemClickHandler(IInspectable const&, Controls::ItemClickEventArgs const& args) - { - auto clickedItemContainer = args.ClickedItem().as(); - hstring tag = clickedItemContainer->PageTag(); - MainPage::Navigate(frame(), tag); - } - - Editor::SettingsEditorViewModel Home::HomeViewModel() - { - return m_homeViewModel; - } - -} diff --git a/src/cascadia/TerminalSettingsEditor/Home.h b/src/cascadia/TerminalSettingsEditor/Home.h deleted file mode 100644 index bb67143dca6..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Home.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#pragma once - -#include "Home.g.h" -#include "SettingsEditorViewModel.h" -#include "Utils.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - struct Home : HomeT - { - Home(); - - Editor::SettingsEditorViewModel HomeViewModel(); - - void HomeGridItemClickHandler(Windows::Foundation::IInspectable const&, Windows::UI::Xaml::Controls::ItemClickEventArgs const& args); - - private: - Editor::SettingsEditorViewModel m_homeViewModel{ nullptr }; - }; -} - -namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation -{ - BASIC_FACTORY(Home); -} diff --git a/src/cascadia/TerminalSettingsEditor/Home.idl b/src/cascadia/TerminalSettingsEditor/Home.idl deleted file mode 100644 index e275d44c1c4..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Home.idl +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import "SettingsEditorViewModel.idl"; - -namespace Microsoft.Terminal.Settings.Editor -{ - runtimeclass Home : Windows.UI.Xaml.Controls.Page - { - Home(); - SettingsEditorViewModel HomeViewModel{ get; }; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/Home.xaml b/src/cascadia/TerminalSettingsEditor/Home.xaml deleted file mode 100644 index 48f2bcdcaad..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Home.xaml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp b/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp deleted file mode 100644 index 248cb5d6c86..00000000000 --- a/src/cascadia/TerminalSettingsEditor/HomeGridItem.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "pch.h" -#include "HomeGridItem.h" -#include "HomeGridItem.g.cpp" - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - HomeGridItem::HomeGridItem(hstring const& title, hstring const& pageTag) : - _Title{ title }, - _PageTag{ pageTag } - { - } -} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.h b/src/cascadia/TerminalSettingsEditor/HomeGridItem.h deleted file mode 100644 index 9b7a0e10f42..00000000000 --- a/src/cascadia/TerminalSettingsEditor/HomeGridItem.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#pragma once -#include "HomeGridItem.g.h" -#include "Utils.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - struct HomeGridItem : HomeGridItemT - { - HomeGridItem() = delete; - HomeGridItem(hstring const& title, hstring const& pageTag); - - WINRT_CALLBACK(PropertyChanged, Windows::UI::Xaml::Data::PropertyChangedEventHandler); - OBSERVABLE_GETSET_PROPERTY(hstring, Title, _PropertyChangedHandlers); - OBSERVABLE_GETSET_PROPERTY(hstring, PageTag, _PropertyChangedHandlers); - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl b/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl deleted file mode 100644 index 935be521f2f..00000000000 --- a/src/cascadia/TerminalSettingsEditor/HomeGridItem.idl +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -namespace Microsoft.Terminal.Settings.Editor -{ - runtimeclass HomeGridItem : Windows.UI.Xaml.Data.INotifyPropertyChanged - { - String Title; - String PageTag; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index fbfa5583b4e..5f48897ce13 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -4,7 +4,6 @@ #include "pch.h" #include "MainPage.h" #include "MainPage.g.cpp" -#include "Home.h" #include "Globals.h" #include "Launch.h" #include "Interaction.h" @@ -36,34 +35,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation // this section will clone the active AppSettings MainPage::_settingsSource = settings; _settingsClone = nullptr; - - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Add new profile"), L"AddNew_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Always show tabs"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Color scheme"), L"ColorSchemes_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Columns on first launch"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Copy after selection is made"), L"Interaction_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Copy formatting"), L"Interaction_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Default profile"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Disable dynamic profiles"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Global appearance"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Global profile settings"), L"GlobalProfile_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Hide close all tabs popup"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Interaction"), L"Interaction_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Keyboard"), L"Keyboard_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Launch"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Launch on startup"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Launch position"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Launch size"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Rendering"), L"Rendering_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Rows on first launch"), L"Launch_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Screen redrawing"), L"Rendering_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Show terminal title in title bar"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Show the title bar"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Software rendering"), L"Rendering_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Tab width mode"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Theme"), L"GlobalAppearance_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Window resize behavior"), L"Rendering_Nav")); - SearchList.insert(std::pair(Windows::Foundation::PropertyValue::CreateString(L"Word delimiters"), L"Interaction_Nav")); } CascadiaSettings MainPage::Settings() @@ -77,7 +48,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation for (uint32_t i = 0; i < SettingsNav().MenuItems().Size(); i++) { const auto item = SettingsNav().MenuItems().GetAt(i).as(); - const hstring homeNav = L"Home_Nav"; + const hstring homeNav = L"General_Nav"; const hstring itemTag = unbox_value(item.Tag()); if (itemTag == homeNav) @@ -87,7 +58,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } } - contentFrame().Navigate(xaml_typename()); + contentFrame().Navigate(xaml_typename()); } void MainPage::SettingsNav_ItemInvoked(MUX::Controls::NavigationView const&, MUX::Controls::NavigationViewItemInvokedEventArgs const& args) @@ -123,67 +94,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation return true; } - void MainPage::AutoSuggestBox_TextChanged(IInspectable const& sender, const Controls::AutoSuggestBoxTextChangedEventArgs args) - { - Controls::AutoSuggestBox autoBox = sender.as(); - auto query = autoBox.Text(); - SearchSettings(query, autoBox); - } - - void MainPage::AutoSuggestBox_QuerySubmitted(const Controls::AutoSuggestBox sender, const Controls::AutoSuggestBoxQuerySubmittedEventArgs args) - { - auto value = args.QueryText(); - } - - void MainPage::AutoSuggestBox_SuggestionChosen(const Controls::AutoSuggestBox sender, const Controls::AutoSuggestBoxSuggestionChosenEventArgs args) - { - auto selectItem = args.SelectedItem().as().GetString(); - Controls::AutoSuggestBox autoBox = sender.as(); - - Navigate(contentFrame(), SearchList.at(args.SelectedItem())); - } - - void MainPage::SearchSettings(hstring query, Controls::AutoSuggestBox& autoBox) - { - Windows::Foundation::Collections::IVector suggestions = single_threaded_vector(); - std::vector rawSuggestions; - - for (auto it = SearchList.begin(); it != SearchList.end(); ++it) - { - auto value = it->first; - hstring item = value.as().GetString(); - - std::string tmp = winrt::to_string(item); - std::transform(tmp.begin(), tmp.end(), tmp.begin(), [](auto c) { return static_cast(std::tolower(c)); }); - item = winrt::to_hstring(tmp); - - std::string tmp2 = winrt::to_string(query); - std::transform(tmp2.begin(), tmp2.end(), tmp2.begin(), [](auto c) { return static_cast(std::tolower(c)); }); - query = winrt::to_hstring(tmp2); - - if (std::wcsstr(item.c_str(), query.c_str())) - { - rawSuggestions.emplace_back(value); - } - } - - // perform sort comparing strings inside of IPropertyValues - std::sort(rawSuggestions.begin(), rawSuggestions.end(), [](const IInspectable& a, const IInspectable& b) -> bool { - return a.as().GetString() < b.as().GetString(); - }); - - // Pass all elements from rawSuggestions to suggestions - for (const auto& suggestion : rawSuggestions) - { - suggestions.Append(suggestion); - } - - autoBox.ItemsSource(suggestions); - } - void MainPage::Navigate(Controls::Frame contentFrame, hstring clickedItemTag) { - const hstring homePage = L"Home_Nav"; const hstring generalPage = L"General_Nav"; const hstring launchSubpage = L"Launch_Nav"; const hstring interactionSubpage = L"Interaction_Nav"; @@ -197,13 +109,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation const hstring colorSchemesPage = L"ColorSchemes_Nav"; const hstring globalAppearancePage = L"GlobalAppearance_Nav"; - const hstring keybindingsPage = L"Keyboard_Nav"; - - if (clickedItemTag == homePage) - { - contentFrame.Navigate(xaml_typename()); - } - else if (clickedItemTag == launchSubpage) + if (clickedItemTag == launchSubpage) { contentFrame.Navigate(xaml_typename()); } @@ -231,9 +137,5 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { contentFrame.Navigate(xaml_typename()); } - else if (clickedItemTag == keybindingsPage) - { - contentFrame.Navigate(xaml_typename()); - } } } diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.h b/src/cascadia/TerminalSettingsEditor/MainPage.h index ed0ce2d82af..59fb8951860 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.h +++ b/src/cascadia/TerminalSettingsEditor/MainPage.h @@ -19,13 +19,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation bool On_BackRequested(); static void Navigate(Windows::UI::Xaml::Controls::Frame contentFrame, hstring clickedItemTag); - std::map SearchList; - - void AutoSuggestBox_TextChanged(Windows::Foundation::IInspectable const& sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs args); - void AutoSuggestBox_QuerySubmitted(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxQuerySubmittedEventArgs args); - void AutoSuggestBox_SuggestionChosen(const winrt::Windows::UI::Xaml::Controls::AutoSuggestBox sender, const winrt::Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs args); - void SearchSettings(hstring query, winrt::Windows::UI::Xaml::Controls::AutoSuggestBox& autoBox); - static winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings Settings(); private: diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.xaml b/src/cascadia/TerminalSettingsEditor/MainPage.xaml index 14e6a5deb65..cc14bf65bc1 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.xaml +++ b/src/cascadia/TerminalSettingsEditor/MainPage.xaml @@ -26,18 +26,8 @@ the MIT License. See LICENSE in the project root for license information. --> IsBackButtonVisible="Auto" IsBackEnabled="True" BackRequested="SettingsNav_BackRequested"> - - - - @@ -104,34 +94,6 @@ the MIT License. See LICENSE in the project root for license information. --> - - - - - Command Prompt - - - - - - - Windows Powershell - - - - - - - Ubuntu - - - - - - - PowerShell 7 - - @@ -142,12 +104,6 @@ the MIT License. See LICENSE in the project root for license information. --> - - - Keyboard - - diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj index dbcb1a66798..ef2a76a8848 100644 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj @@ -55,12 +55,6 @@ Globals.xaml Code - - Home.xaml - - - HomeGridItem.idl - Interaction.xaml @@ -89,9 +83,6 @@ Rendering.xaml - - SettingsEditorViewModel.idl - @@ -110,9 +101,6 @@ Designer - - Designer - Designer @@ -160,12 +148,6 @@ Globals.xaml Code - - Home.xaml - - - HomeGridItem.idl - Interaction.xaml @@ -197,18 +179,11 @@ Rendering.xaml - - SettingsEditorViewModel.idl - - - Home.xaml - Code - GlobalAppearance.xaml Code @@ -221,7 +196,6 @@ Globals.xaml Code - Launch.xaml Code @@ -257,7 +231,6 @@ NewTabOptionPanelControl.xaml Code - diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters index 29457622184..d315eed3bf3 100644 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters +++ b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters @@ -16,8 +16,6 @@ - - Converters @@ -36,7 +34,6 @@ - diff --git a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.cpp b/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.cpp deleted file mode 100644 index b468e818dcb..00000000000 --- a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "pch.h" -#include "SettingsEditorViewModel.h" -#include "SettingsEditorViewModel.g.cpp" - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - SettingsEditorViewModel::SettingsEditorViewModel() - { - _HomeGridItems = winrt::single_threaded_observable_vector(); - } - - Editor::HomeGridItem SettingsEditorViewModel::HomeGridItem() - { - return _HomeGridItem; - } - - Windows::Foundation::Collections::IObservableVector SettingsEditorViewModel::HomeGridItems() - { - return _HomeGridItems; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.h b/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.h deleted file mode 100644 index 670fe0b782b..00000000000 --- a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#pragma once -#include "SettingsEditorViewModel.g.h" -#include "HomeGridItem.h" - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - struct SettingsEditorViewModel : SettingsEditorViewModelT - { - SettingsEditorViewModel(); - - Editor::HomeGridItem HomeGridItem(); - - Windows::Foundation::Collections::IObservableVector HomeGridItems(); - - private: - Editor::HomeGridItem _HomeGridItem{ nullptr }; - Windows::Foundation::Collections::IObservableVector _HomeGridItems; - }; -} diff --git a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.idl b/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.idl deleted file mode 100644 index 325a30a05ef..00000000000 --- a/src/cascadia/TerminalSettingsEditor/SettingsEditorViewModel.idl +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import "HomeGridItem.idl"; - -namespace Microsoft.Terminal.Settings.Editor -{ - runtimeclass SettingsEditorViewModel - { - HomeGridItem HomeGridItem { get; }; - Windows.Foundation.Collections.IObservableVector HomeGridItems { get; }; - } -} From 9fc79d5559bfdbfb4848f5ead01d97c6755aec35 Mon Sep 17 00:00:00 2001 From: Leon Liang Date: Wed, 28 Oct 2020 14:05:30 -0700 Subject: [PATCH 17/87] Hook up the Settings UI JSON button (#8059) This PR will make the "Open JSON file" navigation view item in the Settings UI will open the user's settings file. Normally, `NavigationViewItems` raise their parent's `ItemInvoked` handler, but when a `NavViewItem` is in the `NavigationView.PaneFooter`, it doesn't do that. So, we have to hook up `OpenJson`'s `Tapped` and `KeyDown` handler to detect both a tap event and the enter keydown events. References #1564 --- src/cascadia/TerminalApp/SettingsTab.cpp | 4 ++-- src/cascadia/TerminalApp/SettingsTab.h | 2 +- src/cascadia/TerminalApp/TerminalPage.cpp | 10 +++++++- .../TerminalSettingsEditor/MainPage.cpp | 23 +++++++++++++++++++ .../TerminalSettingsEditor/MainPage.h | 4 ++++ .../TerminalSettingsEditor/MainPage.idl | 1 + .../TerminalSettingsEditor/MainPage.xaml | 2 +- src/cascadia/TerminalSettingsEditor/pch.h | 1 + 8 files changed, 42 insertions(+), 5 deletions(-) diff --git a/src/cascadia/TerminalApp/SettingsTab.cpp b/src/cascadia/TerminalApp/SettingsTab.cpp index 565ceaf341e..58c09267622 100644 --- a/src/cascadia/TerminalApp/SettingsTab.cpp +++ b/src/cascadia/TerminalApp/SettingsTab.cpp @@ -22,9 +22,9 @@ namespace winrt namespace winrt::TerminalApp::implementation { - SettingsTab::SettingsTab(winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings settings) + SettingsTab::SettingsTab(winrt::Microsoft::Terminal::Settings::Editor::MainPage settingsUI) { - Content(winrt::Microsoft::Terminal::Settings::Editor::MainPage(settings)); + Content(settingsUI); _MakeTabViewItem(); _CreateContextMenu(); diff --git a/src/cascadia/TerminalApp/SettingsTab.h b/src/cascadia/TerminalApp/SettingsTab.h index 71ebca70fbc..ea2f6dc8af3 100644 --- a/src/cascadia/TerminalApp/SettingsTab.h +++ b/src/cascadia/TerminalApp/SettingsTab.h @@ -26,7 +26,7 @@ namespace winrt::TerminalApp::implementation struct SettingsTab : SettingsTabT { public: - SettingsTab(winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings settings); + SettingsTab(winrt::Microsoft::Terminal::Settings::Editor::MainPage settingsUI); void Focus(winrt::Windows::UI::Xaml::FocusState focusState); winrt::Windows::UI::Xaml::FocusState FocusState() const noexcept; diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 5eeba2296e9..5a65086d4d0 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2587,7 +2587,15 @@ namespace winrt::TerminalApp::implementation // If we're holding the settings tab's switch command, don't create a new one, switch to the existing one. if (!_switchToSettingsCommand) { - auto newTabImpl = winrt::make_self(_settings); + winrt::Microsoft::Terminal::Settings::Editor::MainPage sui{ _settings }; + sui.OpenJson([weakThis{ get_weak() }](auto&& /*s*/, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget e) { + if (auto page{ weakThis.get() }) + { + page->_LaunchSettings(e); + } + }); + + auto newTabImpl = winrt::make_self(sui); _MakeSwitchToTabCommand(*newTabImpl, _tabs.Size()); // Add the new tab to the list of our tabs. diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index 5f48897ce13..8a0d5a59e84 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -22,6 +22,8 @@ namespace winrt using namespace winrt::Windows::Foundation; using namespace winrt::Windows::UI::Xaml; using namespace winrt::Microsoft::Terminal::Settings::Model; +using namespace winrt::Windows::UI::Core; +using namespace winrt::Windows::System; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { @@ -138,4 +140,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation contentFrame.Navigate(xaml_typename()); } } + + void MainPage::OpenJsonTapped(IInspectable const& /*sender*/, Windows::UI::Xaml::Input::TappedRoutedEventArgs const& /*args*/) + { + const CoreWindow window = CoreWindow::GetForCurrentThread(); + const auto rAltState = window.GetKeyState(VirtualKey::RightMenu); + const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu); + const bool altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) || + WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down); + + const auto target = altPressed ? SettingsTarget::DefaultsFile : SettingsTarget::SettingsFile; + _OpenJsonHandlers(nullptr, target); + } + + void MainPage::OpenJsonKeyDown(IInspectable const& /*sender*/, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& args) + { + if (args.Key() == VirtualKey::Enter || args.Key() == VirtualKey::Space) + { + const auto target = args.KeyStatus().IsMenuKeyDown ? SettingsTarget::DefaultsFile : SettingsTarget::SettingsFile; + _OpenJsonHandlers(nullptr, target); + } + } } diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.h b/src/cascadia/TerminalSettingsEditor/MainPage.h index 59fb8951860..ad6f874dc20 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.h +++ b/src/cascadia/TerminalSettingsEditor/MainPage.h @@ -13,6 +13,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation MainPage() = delete; MainPage(winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings settings); + void OpenJsonKeyDown(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs const& args); + void OpenJsonTapped(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs const& args); void SettingsNav_Loaded(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); void SettingsNav_ItemInvoked(Microsoft::UI::Xaml::Controls::NavigationView const& sender, Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs const& args); void SettingsNav_BackRequested(Microsoft::UI::Xaml::Controls::NavigationView const&, Microsoft::UI::Xaml::Controls::NavigationViewBackRequestedEventArgs const& args); @@ -21,6 +23,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation static winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings Settings(); + TYPED_EVENT(OpenJson, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget); + private: // XAML should data-bind to the _settingsClone // When "save" is pressed, _settingsSource = _settingsClone diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.idl b/src/cascadia/TerminalSettingsEditor/MainPage.idl index 9a08c853bec..a526380d009 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.idl +++ b/src/cascadia/TerminalSettingsEditor/MainPage.idl @@ -7,5 +7,6 @@ namespace Microsoft.Terminal.Settings.Editor runtimeclass MainPage : Windows.UI.Xaml.Controls.Page { MainPage(Microsoft.Terminal.Settings.Model.CascadiaSettings settings); + event Windows.Foundation.TypedEventHandler OpenJson; } } diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.xaml b/src/cascadia/TerminalSettingsEditor/MainPage.xaml index cc14bf65bc1..565ec68f821 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.xaml +++ b/src/cascadia/TerminalSettingsEditor/MainPage.xaml @@ -106,7 +106,7 @@ the MIT License. See LICENSE in the project root for license information. --> - + diff --git a/src/cascadia/TerminalSettingsEditor/pch.h b/src/cascadia/TerminalSettingsEditor/pch.h index 8e1fea0d454..8eea091e7d7 100644 --- a/src/cascadia/TerminalSettingsEditor/pch.h +++ b/src/cascadia/TerminalSettingsEditor/pch.h @@ -32,6 +32,7 @@ #include #include +#include #include #include #include From 60b154b519afe550832784d239f33389689971a6 Mon Sep 17 00:00:00 2001 From: Kayla Cinnamon Date: Wed, 28 Oct 2020 14:13:59 -0700 Subject: [PATCH 18/87] Change save to apply in SUI (#8082) ## Summary of the Pull Request Fixed the resizing bug where long text buttons get cut off, hid the unsaved changes warning, and changed "save" to "apply" ![MicrosoftTeams-image (1)](https://user-images.githubusercontent.com/48369326/97494176-2f1e5980-1923-11eb-8980-604bd5a067e5.png) ![image](https://user-images.githubusercontent.com/48369326/97494207-3a718500-1923-11eb-9409-7a95ecb50536.png) ## References #1564 ## PR Checklist * [ ] Closes #xxx * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed --- .../TerminalSettingsEditor/MainPage.xaml | 5 +- .../Resources/en-US/Resources.resw | 58 +++++++++---------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.xaml b/src/cascadia/TerminalSettingsEditor/MainPage.xaml index 565ec68f821..7940b526d58 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.xaml +++ b/src/cascadia/TerminalSettingsEditor/MainPage.xaml @@ -123,10 +123,9 @@ the MIT License. See LICENSE in the project root for license information. --> - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index fc5dac50b9e..07e2a121a32 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -675,10 +675,10 @@ Visual (Flash Taskbar) - + Add new - + Delete color scheme @@ -687,7 +687,7 @@ The name of the color scheme. - + Delete profile diff --git a/src/cascadia/TerminalSettingsModel/ColorScheme.cpp b/src/cascadia/TerminalSettingsModel/ColorScheme.cpp index 93c9cc9d716..82fb3877bb1 100644 --- a/src/cascadia/TerminalSettingsModel/ColorScheme.cpp +++ b/src/cascadia/TerminalSettingsModel/ColorScheme.cpp @@ -5,6 +5,7 @@ #include "ColorScheme.h" #include "DefaultSettings.h" #include "../../types/inc/Utils.hpp" +#include "../../types/inc/colorTable.hpp" #include "Utils.h" #include "JsonUtils.h" @@ -46,7 +47,7 @@ ColorScheme::ColorScheme() : _SelectionBackground{ DEFAULT_FOREGROUND }, _CursorColor{ DEFAULT_CURSOR_COLOR } { - _InitializeColorTable(); + Utils::InitializeCampbellColorTable(_table); } ColorScheme::ColorScheme(winrt::hstring name) : @@ -64,28 +65,6 @@ ColorScheme::ColorScheme(winrt::hstring name, Color defaultFg, Color defaultBg, _CursorColor = cursorColor; } -// Method Description: -// - Sets the color table to Cambell's values -void ColorScheme::_InitializeColorTable() -{ - _table.at(0) = Utils::ColorFromHexString("#0C0C0C"); - _table.at(1) = Utils::ColorFromHexString("#C50F1F"); - _table.at(2) = Utils::ColorFromHexString("#13A10E"); - _table.at(3) = Utils::ColorFromHexString("#C19C00"); - _table.at(4) = Utils::ColorFromHexString("#0037DA"); - _table.at(5) = Utils::ColorFromHexString("#881798"); - _table.at(6) = Utils::ColorFromHexString("#3A96DD"); - _table.at(7) = Utils::ColorFromHexString("#CCCCCC"); - _table.at(8) = Utils::ColorFromHexString("#767676"); - _table.at(9) = Utils::ColorFromHexString("#E74856"); - _table.at(10) = Utils::ColorFromHexString("#16C60C"); - _table.at(11) = Utils::ColorFromHexString("#F9F1A5"); - _table.at(12) = Utils::ColorFromHexString("#3B78FF"); - _table.at(13) = Utils::ColorFromHexString("#B4009E"); - _table.at(14) = Utils::ColorFromHexString("#61D6D6"); - _table.at(15) = Utils::ColorFromHexString("#F2F2F2"); -} - winrt::com_ptr ColorScheme::Copy() const { auto scheme{ winrt::make_self() }; diff --git a/src/cascadia/TerminalSettingsModel/ColorScheme.h b/src/cascadia/TerminalSettingsModel/ColorScheme.h index c29169da4cf..6ab07822a37 100644 --- a/src/cascadia/TerminalSettingsModel/ColorScheme.h +++ b/src/cascadia/TerminalSettingsModel/ColorScheme.h @@ -57,8 +57,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation private: std::array _table; - void _InitializeColorTable(); - friend class SettingsModelLocalTests::SettingsTests; friend class SettingsModelLocalTests::ColorSchemeTests; }; diff --git a/src/cascadia/TerminalSettingsModel/ColorScheme.idl b/src/cascadia/TerminalSettingsModel/ColorScheme.idl index 6555de9ff34..694c62ae8e7 100644 --- a/src/cascadia/TerminalSettingsModel/ColorScheme.idl +++ b/src/cascadia/TerminalSettingsModel/ColorScheme.idl @@ -13,6 +13,9 @@ namespace Microsoft.Terminal.Settings.Model Windows.UI.Color SelectionBackground; Windows.UI.Color CursorColor; + // winrt::com_arrays prevent data binding. + // Instead of representing Table as a property, + // we expose the getter as a function. Windows.UI.Color[] Table(); void SetColorTableEntry(UInt8 index, Windows.UI.Color value); } diff --git a/src/types/colorTable.cpp b/src/types/colorTable.cpp index 5a29ca7529b..033f53598e6 100644 --- a/src/types/colorTable.cpp +++ b/src/types/colorTable.cpp @@ -468,6 +468,13 @@ void Utils::InitializeCampbellColorTable(const gsl::span table) std::copy(campbellColorTable.begin(), campbellColorTable.end(), table.begin()); } +void Utils::InitializeCampbellColorTable(const gsl::span table) +{ + THROW_HR_IF(E_INVALIDARG, table.size() < 16); + + std::copy(campbellColorTable.begin(), campbellColorTable.end(), table.begin()); +} + // Function Description: // - Fill the first 16 entries of a given color table with the Campbell color // scheme, in the Windows BGR order. diff --git a/src/types/inc/colorTable.hpp b/src/types/inc/colorTable.hpp index d09653da83c..b9afde82131 100644 --- a/src/types/inc/colorTable.hpp +++ b/src/types/inc/colorTable.hpp @@ -13,6 +13,7 @@ Module Name: namespace Microsoft::Console::Utils { void InitializeCampbellColorTable(const gsl::span table); + void InitializeCampbellColorTable(const gsl::span table); void InitializeCampbellColorTableForConhost(const gsl::span table); void SwapANSIColorOrderForConhost(const gsl::span table); void Initialize256ColorTable(const gsl::span table); From f9fc9861a111925347f0362ba0fd9a14fb0765c9 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Mon, 30 Nov 2020 11:51:42 -0800 Subject: [PATCH 42/87] Propagate IslandWindow's HWND into any component that needs it (#8391) This fixes the issue with the settings UI where clicking the browse buttons would cause an exception to be thrown when we tried to display a picker without an originating HWND. It turns out that pickers need a hosting/parent window, and Xaml Islands doesn't furnish us with a CoreWindow that's set up for that use case. Alas! Raymond Chen's [blog post on the matter] suggests that we should hand the HWND off through some classic COM interface. To do that properly, Terminal's various components need to implement that interface and propagate the HWND down where it's needed. Thanks to a [Xaml compiler issue], we can't actually do that. To work around that, we've begged and borrowed different methods for pushing HWNDs around: 1. Using IInitializeWithWindow in secret 2. A member that takes a uint64 3. An interface that offers a function that will "wire up" the HWND. I chose (1) because AppHost can implement IInitializeWithWindow, but TerminalPage cannot. We're just pretending that TerminalPage _can_. I chose (2) because none of the Xaml types in TerminalSettingsEditor can implement the interface thanks to the aforementioned compiler issue, but we don't have an escape hatch like AppHost that lives in the same module and can help us do the propagation. I chose (3) because I didn't want to commit the same sin as (2) _seven times_ for every different type of settings page that exists. (3) is backed by "IHostedInWindow", and anybody who knows they have to use IInitializeWithWindow to tie an HWND to an object can call IHostedInWindow.TryPropagateHostingWindow() on that object. House of cards. [Xaml compiler issue]: https://github.com/microsoft/microsoft-ui-xaml/issues/3331 [blog post on the matter]: https://devblogs.microsoft.com/oldnewthing/20190412-00/?p=102413 --- .../actions/spell-check/dictionary/apis.txt | 1 + .github/actions/spell-check/expect/expect.txt | 2 ++ src/cascadia/TerminalApp/AppLogic.cpp | 7 ++++++ src/cascadia/TerminalApp/AppLogic.h | 4 +++- src/cascadia/TerminalApp/TerminalPage.cpp | 16 ++++++++++++- src/cascadia/TerminalApp/TerminalPage.h | 5 ++++ src/cascadia/TerminalApp/pch.h | 1 + .../TerminalSettingsEditor/MainPage.cpp | 23 ++++++++++++++++--- .../TerminalSettingsEditor/MainPage.h | 5 ++++ .../TerminalSettingsEditor/MainPage.idl | 15 +++++++++++- .../TerminalSettingsEditor/Profiles.cpp | 8 +++---- .../TerminalSettingsEditor/Profiles.h | 12 ++++++---- .../TerminalSettingsEditor/Profiles.idl | 2 ++ .../TerminalSettingsEditor/Profiles.xaml | 1 + src/cascadia/TerminalSettingsEditor/pch.h | 2 ++ src/cascadia/WindowsTerminal/AppHost.cpp | 5 ++++ 16 files changed, 94 insertions(+), 15 deletions(-) diff --git a/.github/actions/spell-check/dictionary/apis.txt b/.github/actions/spell-check/dictionary/apis.txt index 3e3abc6518c..a82d06ec3dc 100644 --- a/.github/actions/spell-check/dictionary/apis.txt +++ b/.github/actions/spell-check/dictionary/apis.txt @@ -61,6 +61,7 @@ rx schandle semver serializer +shobjidl SIZENS GETDESKWALLPAPER snprintf diff --git a/.github/actions/spell-check/expect/expect.txt b/.github/actions/spell-check/expect/expect.txt index 63f88247b12..0e122515936 100644 --- a/.github/actions/spell-check/expect/expect.txt +++ b/.github/actions/spell-check/expect/expect.txt @@ -1062,7 +1062,9 @@ IFont ifstream IGNOREEND IHigh +IHosted iid +IInitialize IInput IInspectable IInteract diff --git a/src/cascadia/TerminalApp/AppLogic.cpp b/src/cascadia/TerminalApp/AppLogic.cpp index a6f15bea939..74432904678 100644 --- a/src/cascadia/TerminalApp/AppLogic.cpp +++ b/src/cascadia/TerminalApp/AppLogic.cpp @@ -196,6 +196,13 @@ namespace winrt::TerminalApp::implementation _root = winrt::make_self(); } + // Method Description: + // - Implements the IInitializeWithWindow interface from shobjidl_core. + HRESULT AppLogic::Initialize(HWND hwnd) + { + return _root->Initialize(hwnd); + } + // Method Description: // - Called around the codebase to discover if this is a UWP where we need to turn off specific settings. // Arguments: diff --git a/src/cascadia/TerminalApp/AppLogic.h b/src/cascadia/TerminalApp/AppLogic.h index c11c1a5fc24..3d2051a1200 100644 --- a/src/cascadia/TerminalApp/AppLogic.h +++ b/src/cascadia/TerminalApp/AppLogic.h @@ -10,7 +10,7 @@ namespace winrt::TerminalApp::implementation { - struct AppLogic : AppLogicT + struct AppLogic : AppLogicT { public: static AppLogic* Current() noexcept; @@ -19,6 +19,8 @@ namespace winrt::TerminalApp::implementation AppLogic(); ~AppLogic() = default; + STDMETHODIMP Initialize(HWND hwnd); + void Create(); bool IsUwp() const noexcept; void RunAsUwp(); diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index f5ef2a9da13..8308983bc4a 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -45,11 +45,20 @@ namespace winrt::TerminalApp::implementation TerminalPage::TerminalPage() : _tabs{ winrt::single_threaded_observable_vector() }, _mruTabActions{ winrt::single_threaded_vector() }, - _startupActions{ winrt::single_threaded_vector() } + _startupActions{ winrt::single_threaded_vector() }, + _hostingHwnd{} { InitializeComponent(); } + // Method Description: + // - implements the IInitializeWithWindow interface from shobjidl_core. + HRESULT TerminalPage::Initialize(HWND hwnd) + { + _hostingHwnd = hwnd; + return S_OK; + } + // Function Description: // - Recursively check our commands to see if there's a keybinding for // exactly their action. If there is, label that command with the text @@ -2738,6 +2747,11 @@ namespace winrt::TerminalApp::implementation if (!_switchToSettingsCommand) { winrt::Microsoft::Terminal::Settings::Editor::MainPage sui{ _settings }; + if (_hostingHwnd) + { + sui.SetHostingWindow(reinterpret_cast(*_hostingHwnd)); + } + sui.OpenJson([weakThis{ get_weak() }](auto&& /*s*/, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget e) { if (auto page{ weakThis.get() }) { diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index fb10e71ecb0..0fd970b5492 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -41,6 +41,10 @@ namespace winrt::TerminalApp::implementation public: TerminalPage(); + // This implements shobjidl's IInitializeWithWindow, but due to a XAML Compiler bug we cannot + // put it in our inheritance graph. https://github.com/microsoft/microsoft-ui-xaml/issues/3331 + STDMETHODIMP Initialize(HWND hwnd); + winrt::fire_and_forget SetSettings(Microsoft::Terminal::Settings::Model::CascadiaSettings settings, bool needRefreshUI); void Create(); @@ -90,6 +94,7 @@ namespace winrt::TerminalApp::implementation private: friend struct TerminalPageT; // for Xaml to bind events + std::optional _hostingHwnd; // If you add controls here, but forget to null them either here or in // the ctor, you're going to have a bad time. It'll mysteriously fail to diff --git a/src/cascadia/TerminalApp/pch.h b/src/cascadia/TerminalApp/pch.h index f152929cda9..62a82813282 100644 --- a/src/cascadia/TerminalApp/pch.h +++ b/src/cascadia/TerminalApp/pch.h @@ -64,6 +64,7 @@ TRACELOGGING_DECLARE_PROVIDER(g_hTerminalAppProvider); #include #include +#include #include #include diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index 0bd5fdd7632..b7b3ac8731d 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -46,6 +46,23 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _InitializeProfilesList(); } + void MainPage::SetHostingWindow(uint64_t hostingWindow) noexcept + { + _hostingHwnd.emplace(reinterpret_cast(hostingWindow)); + } + + bool MainPage::TryPropagateHostingWindow(IInspectable object) noexcept + { + if (_hostingHwnd) + { + if (auto initializeWithWindow{ object.try_as() }) + { + return SUCCEEDED(initializeWithWindow->Initialize(*_hostingHwnd)); + } + } + return false; + } + // Function Description: // - Called when the NavigationView is loaded. Navigates to the first item in the NavigationView, if no item is selected // Arguments: @@ -95,7 +112,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation else if (const auto profile = clickedItemContainer.Tag().try_as()) { // Navigate to a page with the given profile - contentFrame().Navigate(xaml_typename(), winrt::make(profile, _settingsClone.GlobalSettings().ColorSchemes())); + contentFrame().Navigate(xaml_typename(), winrt::make(profile, _settingsClone.GlobalSettings().ColorSchemes(), *this)); } } } @@ -116,7 +133,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } else if (clickedItemTag == globalProfileTag) { - contentFrame().Navigate(xaml_typename(), winrt::make(_settingsClone.ProfileDefaults(), _settingsClone.GlobalSettings().ColorSchemes())); + contentFrame().Navigate(xaml_typename(), winrt::make(_settingsClone.ProfileDefaults(), _settingsClone.GlobalSettings().ColorSchemes(), *this)); } else if (clickedItemTag == colorSchemesTag) { @@ -184,7 +201,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation // Select and navigate to the new profile // TODO: Setting SelectedItem here doesn't update the NavigationView's selected visual indicator SettingsNav().SelectedItem(navItem); - contentFrame().Navigate(xaml_typename(), winrt::make(newProfile, _settingsClone.GlobalSettings().ColorSchemes())); + contentFrame().Navigate(xaml_typename(), winrt::make(newProfile, _settingsClone.GlobalSettings().ColorSchemes(), *this)); } MUX::Controls::NavigationViewItem MainPage::_CreateProfileNavViewItem(const Profile& profile) diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.h b/src/cascadia/TerminalSettingsEditor/MainPage.h index a40ee15e583..ffb8e4894e7 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.h +++ b/src/cascadia/TerminalSettingsEditor/MainPage.h @@ -18,6 +18,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation void SettingsNav_Loaded(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); void SettingsNav_ItemInvoked(Microsoft::UI::Xaml::Controls::NavigationView const& sender, Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs const& args); + void SetHostingWindow(uint64_t hostingWindow) noexcept; + bool TryPropagateHostingWindow(IInspectable object) noexcept; + TYPED_EVENT(OpenJson, winrt::Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Settings::Model::SettingsTarget); private: @@ -27,6 +30,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings _settingsClone; winrt::Windows::Foundation::Collections::IMap _profileToNavItemMap; + std::optional _hostingHwnd; + void _InitializeProfilesList(); void _CreateAndNavigateToNewProfile(const uint32_t index); winrt::Microsoft::UI::Xaml::Controls::NavigationViewItem _CreateProfileNavViewItem(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile); diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.idl b/src/cascadia/TerminalSettingsEditor/MainPage.idl index 28ac5f565bb..d603cbc9647 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.idl +++ b/src/cascadia/TerminalSettingsEditor/MainPage.idl @@ -3,10 +3,23 @@ namespace Microsoft.Terminal.Settings.Editor { - [default_interface] runtimeclass MainPage : Windows.UI.Xaml.Controls.Page + // Due to a XAML Compiler bug, it is hard for us to propagate an HWND into a XAML-using runtimeclass. + // To work around that, we'll only propagate the HWND (when we need to) into the settings' toplevel page + // and use IHostedInWindow to hide the implementation detail where we use IInitializeWithWindow (shobjidl_core) + // https://github.com/microsoft/microsoft-ui-xaml/issues/3331 + interface IHostedInWindow + { + Boolean TryPropagateHostingWindow(IInspectable i); + } + + [default_interface] runtimeclass MainPage : Windows.UI.Xaml.Controls.Page, IHostedInWindow { MainPage(Microsoft.Terminal.Settings.Model.CascadiaSettings settings); event Windows.Foundation.TypedEventHandler OpenJson; + + // Due to the aforementioned bug, we can't use IInitializeWithWindow _here_ either. + // Let's just smuggle the HWND in as a UInt64 :| + void SetHostingWindow(UInt64 window); } } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.cpp b/src/cascadia/TerminalSettingsEditor/Profiles.cpp index 3062c05daaf..82942372806 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.cpp +++ b/src/cascadia/TerminalSettingsEditor/Profiles.cpp @@ -39,6 +39,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation FileOpenPicker picker; + _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to picker.ViewMode(PickerViewMode::Thumbnail); picker.SuggestedStartLocation(PickerLocationId::PicturesLibrary); picker.FileTypeFilter().ReplaceAll({ L".jpg", L".jpeg", L".png", L".gif" }); @@ -57,6 +58,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation FileOpenPicker picker; //TODO: SETTINGS UI Commandline handling should be robust and intelligent + _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to picker.ViewMode(PickerViewMode::Thumbnail); picker.SuggestedStartLocation(PickerLocationId::ComputerFolder); picker.FileTypeFilter().ReplaceAll({ L".bat", L".exe" }); @@ -68,14 +70,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } } - // TODO GH#1564: Settings UI - // This crashes on click, for some reason - /* fire_and_forget Profiles::StartingDirectory_Click(IInspectable const&, RoutedEventArgs const&) { auto lifetime = get_strong(); FolderPicker picker; + _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to picker.SuggestedStartLocation(PickerLocationId::DocumentsLibrary); + picker.FileTypeFilter().ReplaceAll({ L"*" }); StorageFolder folder = co_await picker.PickSingleFolderAsync(); if (folder != nullptr) { @@ -83,5 +84,4 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation StartingDirectory().Text(folder.Path()); } } - */ } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.h b/src/cascadia/TerminalSettingsEditor/Profiles.h index c3db965d886..d464a4c0891 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.h +++ b/src/cascadia/TerminalSettingsEditor/Profiles.h @@ -12,14 +12,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation struct ProfilePageNavigationState : ProfilePageNavigationStateT { public: - ProfilePageNavigationState(const Model::Profile& profile, const Windows::Foundation::Collections::IMapView& schemes) : + ProfilePageNavigationState(const Model::Profile& profile, const Windows::Foundation::Collections::IMapView& schemes, const IHostedInWindow& windowRoot) : _Profile{ profile }, - _Schemes{ schemes } {} + _Schemes{ schemes }, + _WindowRoot{ windowRoot } + { + } Windows::Foundation::Collections::IMapView Schemes() { return _Schemes; } void Schemes(const Windows::Foundation::Collections::IMapView& val) { _Schemes = val; } GETSET_PROPERTY(Model::Profile, Profile, nullptr); + GETSET_PROPERTY(IHostedInWindow, WindowRoot, nullptr); private: Windows::Foundation::Collections::IMapView _Schemes; @@ -34,9 +38,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation fire_and_forget BackgroundImage_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); fire_and_forget Commandline_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); - // TODO GH#1564: Settings UI - // This crashes on click, for some reason - //fire_and_forget StartingDirectory_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + fire_and_forget StartingDirectory_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); GETSET_PROPERTY(Editor::ProfilePageNavigationState, State, nullptr); GETSET_BINDABLE_ENUM_SETTING(CursorShape, winrt::Microsoft::Terminal::TerminalControl::CursorStyle, State().Profile, CursorShape); diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.idl b/src/cascadia/TerminalSettingsEditor/Profiles.idl index 2319c35633e..79ee05a55e8 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.idl +++ b/src/cascadia/TerminalSettingsEditor/Profiles.idl @@ -2,6 +2,7 @@ // Licensed under the MIT license. import "EnumEntry.idl"; +import "MainPage.idl"; namespace Microsoft.Terminal.Settings.Editor { @@ -9,6 +10,7 @@ namespace Microsoft.Terminal.Settings.Editor { Windows.Foundation.Collections.IMapView Schemes; Microsoft.Terminal.Settings.Model.Profile Profile; + IHostedInWindow WindowRoot; // necessary to send the right HWND into the file picker dialogs. }; [default_interface] runtimeclass Profiles : Windows.UI.Xaml.Controls.Page diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index 291bad7074a..6192037a96d 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -47,6 +47,7 @@ the MIT License. See LICENSE in the project root for license information. --> x:Name="StartingDirectory" Text="{x:Bind State.Profile.StartingDirectory, Mode=TwoWay}"/> + + diff --git a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml index fac2cf11b8b..9bc2b2f89f2 100644 --- a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml +++ b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml @@ -57,5 +57,4 @@ - diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index 465aca15a2a..538b7f9dd94 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -38,7 +38,6 @@ the MIT License. See LICENSE in the project root for license information. --> diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index d500b81e53f..301c58aa8df 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -1,17 +1,17 @@  - @@ -740,4 +740,7 @@ Name - + + Rename + + \ No newline at end of file From 1a11ae085e5f37c3c7104c9a2f801d2b7b25c422 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Fri, 4 Dec 2020 14:52:51 -0800 Subject: [PATCH 47/87] Add font fallback to profile.icon --- src/cascadia/TerminalSettingsEditor/Profiles.xaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index 15d37c9111c..5458c0ed579 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -74,7 +74,8 @@ the MIT License. See LICENSE in the project root for license information. --> + Text="{x:Bind State.Profile.Icon, Mode=TwoWay}" + FontFamily="Segoe UI, Segoe MDL2 Assets"/> - + - + - + - - - diff --git a/src/cascadia/TerminalSettingsEditor/Keybindings.cpp b/src/cascadia/TerminalSettingsEditor/Keybindings.cpp deleted file mode 100644 index 6c2c5183ef8..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Keybindings.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "pch.h" -#include "Keybindings.h" -#include "Keybindings.g.cpp" - -#include "Utils.h" - -using namespace winrt; -using namespace winrt::Windows::Foundation; -using namespace winrt::Windows::UI::Xaml; -using namespace winrt::Windows::UI::Xaml::Input; -using namespace winrt::Windows::UI::Xaml::Controls::Primitives; -using namespace winrt::Windows::System; -using namespace winrt::Microsoft::Terminal::Settings; - -namespace winrt::Microsoft::Terminal::Settings::Editor::implementation -{ - Keybindings::Keybindings() - { - InitializeComponent(); - - m_optionalSettingsPanel = FindName(L"OptionalSettingsPanel").as(); - m_addNewButton = FindName(L"AddNewLink").as(); - - Controls::TextBox tb = FindName(L"KeyBindTextBox").as(); - tb.KeyDown({ this, &Keybindings::KeyDown }); - } - - void Keybindings::Button_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/) - { - Popup popup = FindName(L"StandardPopup").as(); - - if (!popup.IsOpen()) - { - popup.IsOpen(true); - } - } - - void Keybindings::AddNewButton_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) - { - hstring setting = GetSelectedItemTag(FindName(L"CommandComboBox")); - - Controls::StackPanel panel{}; - - if (setting == c_moveFocusTag || setting == c_resizePaneTag) - { - panel = FindName(L"moveResizeFocusOptionPanel").as(); - panel.Visibility(Visibility::Visible); - } - else - { - panel = FindName(setting + L"OptionPanel").as(); - bool panelWasVisible = (panel.Visibility() == Visibility::Visible); - panel.Visibility(Visibility::Visible); - m_lastOpenedArgsPanel = panel; - - Controls::HyperlinkButton button = sender.as(); - if (setting == c_splitPaneTag) - { - if (panelWasVisible) - { - panel.Children().Append(SplitPaneOptionPanelControl()); - } - button.Visibility(Visibility::Visible); - } - else if (setting == c_newTabTag) - { - panel.Children().Append(NewTabOptionPanelControl()); - button.Visibility(Visibility::Visible); - } - else - { - button.Visibility(Visibility::Collapsed); - } - } - - m_lastOpenedArgsPanel = panel; - } - - hstring Keybindings::GetKeyListString() - { - hstring generatedString = L""; - boolean lastKeyWasModifier{}; - - if (m_keysInBind.find(VirtualKey::Control) != m_keysInBind.end()) - { - generatedString = generatedString + KeyToString(VirtualKey::Control); - lastKeyWasModifier = true; - } - - if (m_keysInBind.find(VirtualKey::Shift) != m_keysInBind.end()) - { - generatedString = generatedString + KeyToString(VirtualKey::Shift); - lastKeyWasModifier = true; - } - - if (m_keysInBind.find(VirtualKey::Menu) != m_keysInBind.end()) - { - generatedString = generatedString + KeyToString(VirtualKey::Menu); - lastKeyWasModifier = true; - } - - for (const auto& key : m_keysInBind) - { - if (key != VirtualKey::Control && key != VirtualKey::Shift && key != VirtualKey::Menu) - { - hstring keyString = KeyToString(key); - - if (!keyString.empty()) - { - if (!generatedString.empty() && !lastKeyWasModifier) - { - generatedString = generatedString + L"+"; - } - generatedString = generatedString + KeyToString(key); - lastKeyWasModifier = false; - } - } - } - - return generatedString; - } - - void Keybindings::KeyDown(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Input::KeyRoutedEventArgs const& e) - { - Controls::TextBox textBox = sender.as(); - - if (e.Key() == VirtualKey::Back) - { - m_keysInBind.clear(); - } - else - { - m_keysInBind.insert(e.Key()); - if (textBox != nullptr) - { - textBox.Text(GetKeyListString()); - } - } - - e.Handled(true); - } - - void Keybindings::KeyBindTextBox_TextChanging(winrt::Windows::UI::Xaml::Controls::TextBox const& sender, winrt::Windows::UI::Xaml::Controls::TextBoxTextChangingEventArgs const& /*args*/) - { - hstring currText = sender.Text(); - hstring newText = hstring(currText.data(), currText.size()); - - sender.Text(newText); - } - - void Keybindings::ShowOptionsButtonIfRequired(hstring tag) - { - std::set settingsWithOptions; - settingsWithOptions.insert(c_openSettingsTag); - settingsWithOptions.insert(c_newTabTag); - settingsWithOptions.insert(c_switchToTabTag); - settingsWithOptions.insert(c_renameTabTag); - settingsWithOptions.insert(c_setTabColorTag); - settingsWithOptions.insert(c_moveFocusTag); - settingsWithOptions.insert(c_resizePaneTag); - settingsWithOptions.insert(c_splitPaneTag); - settingsWithOptions.insert(c_copyTag); - - Windows::UI::Xaml::Visibility expectedVisibility = Visibility::Collapsed; - if (settingsWithOptions.find(tag) != settingsWithOptions.end()) - { - expectedVisibility = Visibility::Visible; - } - m_optionalSettingsPanel.Visibility(expectedVisibility); - m_addNewButton.Visibility(expectedVisibility); - if (m_lastOpenedArgsPanel != nullptr) - { - m_lastOpenedArgsPanel.Visibility(Visibility::Collapsed); - } - } - - void Keybindings::CommandComboBox_SelectionChanged(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::Controls::SelectionChangedEventArgs const& /*e*/) - { - hstring selectedItemTag = GetSelectedItemTag(sender); - ShowOptionsButtonIfRequired(selectedItemTag); - } - - void Keybindings::SaveButton_Click(winrt::Windows::Foundation::IInspectable const& /*sender*/, winrt::Windows::UI::Xaml::RoutedEventArgs const& /*e*/) - { - // Collect the information here - winrt::Windows::UI::Popups::MessageDialog msg{ CollectInputData() }; - msg.ShowAsync(); - } - - hstring Keybindings::TraversePanel(const Controls::Panel& panel) - { - hstring fullInfo; - - for (const auto panelChild : panel.Children()) - { - if (Controls::ComboBox childComboBox = panelChild.try_as()) - { - fullInfo = fullInfo + childComboBox.Name() + L":" + GetSelectedItemTag(childComboBox); - } - else if (Controls::TextBox childTextBox = panelChild.try_as()) - { - fullInfo = fullInfo + childTextBox.Name() + L":" + childTextBox.Text(); - } - else if (Editor::NewTabOptionPanelControl ntOptionPanel = panelChild.try_as()) - { - fullInfo = fullInfo + ntOptionPanel.Argument() + L":" + ntOptionPanel.InputValue(); - } - else if (Editor::SplitPaneOptionPanelControl spOptionPanel = panelChild.try_as()) - { - fullInfo = fullInfo + spOptionPanel.Argument() + L":" + spOptionPanel.InputValue(); - } - else if (Controls::Grid grid = panelChild.try_as()) - { - fullInfo = fullInfo + TraversePanel(grid); - } - fullInfo = fullInfo + L"\n"; - } - - return fullInfo; - } - - hstring Keybindings::CollectInputData() - { - hstring fullInfo; - - Controls::ComboBox comboBox = FindName(L"CommandComboBox").as(); - fullInfo = fullInfo + comboBox.Name() + L":" + GetSelectedItemTag(comboBox) + L"\n"; - - Controls::TextBox textBox = FindName(L"KeyBindTextBox").as(); - fullInfo = fullInfo + textBox.Name() + L":" + textBox.Text() + L"\n"; - - fullInfo = fullInfo + TraversePanel(m_lastOpenedArgsPanel); - - return fullInfo; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index cab77cd894e..382aa7395cb 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -283,7 +283,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation SettingsNav().MenuItems().InsertAt(index, navItem); // Select and navigate to the new profile - // TODO: Setting SelectedItem here doesn't update the NavigationView's selected visual indicator SettingsNav().SelectedItem(navItem); contentFrame().Navigate(xaml_typename(), winrt::make(newProfile, _settingsClone.GlobalSettings().ColorSchemes(), *this)); } diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.cpp b/src/cascadia/TerminalSettingsEditor/Profiles.cpp index 68f1669af67..139b6752ac9 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.cpp +++ b/src/cascadia/TerminalSettingsEditor/Profiles.cpp @@ -93,11 +93,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation FileOpenPicker picker; - //TODO: SETTINGS UI Commandline handling should be robust and intelligent _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to picker.ViewMode(PickerViewMode::Thumbnail); picker.SuggestedStartLocation(PickerLocationId::ComputerFolder); - picker.FileTypeFilter().ReplaceAll({ L".bat", L".exe" }); + picker.FileTypeFilter().ReplaceAll({ L".bat", L".exe", L".cmd" }); StorageFile file = co_await picker.PickSingleFileAsync(); if (file != nullptr) diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index 8be16cdc06e..b87bc0e36c8 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -208,9 +208,6 @@ Profile that opens when clicking the '+' icon or by typing the key binding assigned to 'newTab'. - - Automatically create new profiles when new shells are installed - Redraw entire screen when display updates @@ -660,9 +657,6 @@ When checked, visual animations will be disabled across the application. - - Enables all of the dynamic profile generators, adding their profiles to the list of profiles on startup. - Black This is the formal name for a font weight. From 93158e7453658eda9243367e8293ca11863823d5 Mon Sep 17 00:00:00 2001 From: Kayla Cinnamon Date: Tue, 8 Dec 2020 16:48:43 -0800 Subject: [PATCH 60/87] Add groupings to profile page (#8516) To help with organization, I've added headers to group like items together on the profile page. ![image](https://user-images.githubusercontent.com/48369326/101402056-11c89d80-3888-11eb-8ebd-1cbdca6ad0d0.png) --- .../CommonResources.xaml | 7 +- .../TerminalSettingsEditor/Profiles.xaml | 60 ++++++++++------ .../Resources/en-US/Resources.resw | 71 +++++++++++-------- 3 files changed, 87 insertions(+), 51 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml index 028f3433244..e3146eb376a 100644 --- a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml +++ b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml @@ -58,6 +58,11 @@ + + + - + + + + + + + + 17 + + + + + + + + + + + + + 16 + + + + + + + + + + + + + 18 + + + + + + + + + + + + + + + 1 + + + + + + + + + 0 + + + + + + + + + 2 + + + + + + + + + + + 33 + + + + + + + + + 32 + + + + + + + + + 34 + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index 2204f51e922..dd143aaeb5a 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -379,38 +379,47 @@ Sets the file location of the image to draw over the window background. - + Background image alignment Sets how the background image aligns to the boundaries of the window. - + Bottom + This is the formal name for a visual alignment. - + Bottom left + This is the formal name for a visual alignment. - + Bottom right + This is the formal name for a visual alignment. - + Center + This is the formal name for a visual alignment. - + Left + This is the formal name for a visual alignment. - + Right + This is the formal name for a visual alignment. - + Top + This is the formal name for a visual alignment. - + Top left + This is the formal name for a visual alignment. - + Top right + This is the formal name for a visual alignment. Browse... diff --git a/src/cascadia/TerminalSettingsModel/Profile.idl b/src/cascadia/TerminalSettingsModel/Profile.idl index 16a2492ab95..ad3f171e866 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.idl +++ b/src/cascadia/TerminalSettingsModel/Profile.idl @@ -18,8 +18,7 @@ namespace Microsoft.Terminal.Settings.Model All = 0xffffffff }; - [flags] - enum ConvergedAlignment { + [flags] enum ConvergedAlignment { // low 4 bits are the horizontal Horizontal_Center = 0x00, Horizontal_Left = 0x01, diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h index 53ec395c494..2157f10ea83 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h @@ -78,7 +78,6 @@ JSON_FLAG_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::BellStyle) JSON_ENUM_MAPPER(::winrt::Microsoft::Terminal::Settings::Model::ConvergedAlignment) { - // reduce repetition static constexpr std::array mappings = { pair_type{ "center", ValueType::Horizontal_Center | ValueType::Vertical_Center }, pair_type{ "topLeft", ValueType::Horizontal_Left | ValueType::Vertical_Top }, From 3a383338e98dec0dbc87e00521d50912bcb77ceb Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Tue, 8 Dec 2020 17:21:14 -0800 Subject: [PATCH 62/87] add 'locked' to settings.json & defaults.json --- .../Resources/en-US/Resources.resw | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw index dd143aaeb5a..072b2f2286a 100644 --- a/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw +++ b/src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw @@ -1,17 +1,17 @@  - @@ -739,5 +739,6 @@ Open your settings.json file. Alt+Click to open your defaults.json file. + {Locked="settings.json"}, {Locked="defaults.json"} - + \ No newline at end of file From 106c1e329f09973356d885c3fcda05907b1398e2 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 9 Dec 2020 11:35:45 -0800 Subject: [PATCH 63/87] address Griese PR comments --- .../TerminalSettingsEditor/ColorSchemes.cpp | 2 + .../TerminalSettingsEditor/GlobalSettings.idl | 35 ------ .../TerminalSettingsEditor/MainPage.xaml | 1 + ...Microsoft.Terminal.Settings.Editor.filters | 100 ------------------ .../TerminalSettingsEditor/Profiles.cpp | 26 ++++- .../TerminalSettingsEditor/Profiles.h | 1 + .../TerminalSettingsEditor/Profiles.xaml | 2 + src/cascadia/TerminalSettingsEditor/Utils.cpp | 78 -------------- src/cascadia/TerminalSettingsEditor/Utils.h | 1 - .../CascadiaSettings.cpp | 4 +- .../TerminalSettingsModel/EnumMappings.cpp | 2 + 11 files changed, 35 insertions(+), 217 deletions(-) delete mode 100644 src/cascadia/TerminalSettingsEditor/GlobalSettings.idl delete mode 100644 src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp index 71370781af9..ed229ef2060 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp @@ -87,6 +87,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation // - void ColorSchemes::_UpdateColorSchemeList() { + // Surprisingly, though this is called every time we navigate to the page, + // the list does not keep growing on each navigation. const auto& colorSchemeMap{ _State.Globals().ColorSchemes() }; for (const auto& pair : colorSchemeMap) { diff --git a/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl b/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl deleted file mode 100644 index fffe555a6c1..00000000000 --- a/src/cascadia/TerminalSettingsEditor/GlobalSettings.idl +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -import "SettingsTypes.idl"; - -namespace SettingsControl -{ - [default_interface] runtimeclass GlobalSettings { - GlobalSettings(); - - String UnparsedDefaultProfile(); - - Guid DefaultProfile; - Int32 InitialRows; - Int32 InitialCols; - Boolean AlwaysShowTabs; - Boolean ShowTitleInTitlebar; - Boolean ConfirmCloseAllTabs; - Windows.UI.Xaml.ElementTheme Theme; - TabWidthMode TabWidth; - Boolean ShowTabsInTitlebar; - String WordDelimiters; - Boolean CopyOnSelect; - Boolean CopyFormatting; - Boolean WarnAboutLargePaste; - Boolean WarnAboutMultiLinePaste; - Boolean SnapToGridOnResize; - Boolean ForceFullRepaintRendering; - Boolean SoftwareRendering; - Boolean ForceVTInput; - Boolean DebugFeaturesEnabled; - Boolean StartOnUserLogin; - Boolean AlwaysOnTop; - } -} diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.xaml b/src/cascadia/TerminalSettingsEditor/MainPage.xaml index 013edaf830b..85c269eaed0 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.xaml +++ b/src/cascadia/TerminalSettingsEditor/MainPage.xaml @@ -94,6 +94,7 @@ the MIT License. See LICENSE in the project root for license information. --> + diff --git a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters b/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters deleted file mode 100644 index f7295db337e..00000000000 --- a/src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.filters +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - - - - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - ObjectModel - - - - - - - - - - - - - - - - - - - - - - - - - - {46598618-8219-4016-ae77-cb53d953645a} - - - - - - \ No newline at end of file diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.cpp b/src/cascadia/TerminalSettingsEditor/Profiles.cpp index 2d140d69e9b..08a106d3db9 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.cpp +++ b/src/cascadia/TerminalSettingsEditor/Profiles.cpp @@ -95,7 +95,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to picker.ViewMode(PickerViewMode::Thumbnail); picker.SuggestedStartLocation(PickerLocationId::PicturesLibrary); - picker.FileTypeFilter().ReplaceAll({ L".jpg", L".jpeg", L".png", L".gif" }); + + // Converted into a BitmapImage. This list of supported image file formats is from BitmapImage documentation + // https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Imaging.BitmapImage?view=winrt-19041#remarks + picker.FileTypeFilter().ReplaceAll({ L".jpg", L".jpeg", L".png", L".bmp", L".gif", L".tiff", L".ico" }); StorageFile file = co_await picker.PickSingleFileAsync(); if (file != nullptr) @@ -104,6 +107,27 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } } + fire_and_forget Profiles::Icon_Click(IInspectable const&, RoutedEventArgs const&) + { + auto lifetime = get_strong(); + + FileOpenPicker picker; + + _State.WindowRoot().TryPropagateHostingWindow(picker); // if we don't do this, there's no HWND for it to attach to + picker.ViewMode(PickerViewMode::Thumbnail); + picker.SuggestedStartLocation(PickerLocationId::PicturesLibrary); + + // Converted into a BitmapIconSource. This list of supported image file formats is from BitmapImage documentation + // https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Imaging.BitmapImage?view=winrt-19041#remarks + picker.FileTypeFilter().ReplaceAll({ L".jpg", L".jpeg", L".png", L".bmp", L".gif", L".tiff", L".ico" }); + + StorageFile file = co_await picker.PickSingleFileAsync(); + if (file != nullptr) + { + Icon().Text(file.Path()); + } + } + fire_and_forget Profiles::Commandline_Click(IInspectable const&, RoutedEventArgs const&) { auto lifetime = get_strong(); diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.h b/src/cascadia/TerminalSettingsEditor/Profiles.h index ef0b2803cde..394c3a8bf47 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.h +++ b/src/cascadia/TerminalSettingsEditor/Profiles.h @@ -42,6 +42,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation fire_and_forget BackgroundImage_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); fire_and_forget Commandline_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); fire_and_forget StartingDirectory_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); + fire_and_forget Icon_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); void BIAlignment_Click(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Xaml::RoutedEventArgs const& e); // CursorShape visibility logic diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index a5b358fd3b5..f414cea72c6 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -67,10 +67,12 @@ the MIT License. See LICENSE in the project root for license information. --> @@ -227,6 +228,16 @@ the MIT License. See LICENSE in the project root for license information. --> + + + + diff --git a/src/cascadia/TerminalSettingsEditor/Profiles.xaml b/src/cascadia/TerminalSettingsEditor/Profiles.xaml index 9369c8b10e7..93921f1ac42 100644 --- a/src/cascadia/TerminalSettingsEditor/Profiles.xaml +++ b/src/cascadia/TerminalSettingsEditor/Profiles.xaml @@ -85,7 +85,9 @@ the MIT License. See LICENSE in the project root for license information. --> - @@ -233,8 +235,7 @@ the MIT License. See LICENSE in the project root for license information. --> + DefaultButton="Primary"> diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index c605f679dfd..2df5ce75895 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -223,7 +223,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation } else if (clickedItemTag == colorSchemesTag) { - contentFrame().Navigate(xaml_typename(), winrt::make(_settingsClone.GlobalSettings())); + contentFrame().Navigate(xaml_typename(), winrt::make(_settingsClone.GlobalSettings(), _settingsSource.GlobalSettings().Theme())); } else if (clickedItemTag == globalAppearanceTag) { From c240d76c1e6b883916aac8ba7c1abbfeec71b129 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Wed, 16 Dec 2020 13:16:25 -0600 Subject: [PATCH 74/87] add delete button disclaimer --- .../TerminalSettingsEditor/ColorSchemes.cpp | 10 ++ .../TerminalSettingsEditor/ColorSchemes.idl | 1 + .../TerminalSettingsEditor/ColorSchemes.xaml | 99 +++++++++-------- .../CommonResources.xaml | 7 ++ .../TerminalSettingsEditor/Profiles.cpp | 38 +++++++ .../TerminalSettingsEditor/Profiles.xaml | 100 ++++++++++-------- .../TerminalSettingsEditor/Rendering.xaml | 5 +- .../Resources/en-US/Resources.resw | 18 +++- .../TerminalSettingsSerializationHelpers.h | 3 +- 9 files changed, 181 insertions(+), 100 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp index 1ff4cabc14e..98b69f9cbfc 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp @@ -89,6 +89,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation const auto colorScheme{ args.AddedItems().GetAt(0).try_as() }; CurrentColorScheme(colorScheme); _UpdateColorTable(colorScheme); + + // Set the text disclaimer for the text box + hstring disclaimer{}; + const std::wstring schemeName{ colorScheme.Name() }; + if (InBoxSchemes.find(schemeName) != InBoxSchemes.end()) + { + // load disclaimer for in-box profiles + disclaimer = RS_(L"ColorScheme_DeleteButtonDisclaimerInBox"); + } + DeleteButtonDisclaimer().Text(disclaimer); _PropertyChangedHandlers(*this, Windows::UI::Xaml::Data::PropertyChangedEventArgs{ L"CanDeleteCurrentScheme" }); } diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.idl b/src/cascadia/TerminalSettingsEditor/ColorSchemes.idl index 1dd114106e2..67ce6620a2b 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.idl +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.idl @@ -19,6 +19,7 @@ namespace Microsoft.Terminal.Settings.Editor ColorSchemesPageNavigationState State { get; }; Boolean CanDeleteCurrentScheme { get; }; + Microsoft.Terminal.Settings.Model.ColorScheme CurrentColorScheme { get; }; Windows.Foundation.Collections.IObservableVector CurrentColorTable; Windows.Foundation.Collections.IObservableVector ColorSchemeList { get; }; diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml b/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml index 6c631de6fe8..893971767b2 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml @@ -185,52 +185,59 @@ the MIT License. See LICENSE in the project root for license information. --> - + + + + + + + - - - - - - - 17 - - - - - - - - - - - - - 16 - - - - - - - - - - - - - 18 - - - - - - - - - - - - - - - 1 - - - - - - - - - 0 - - - - - - - - - 2 - - - - - - - - - - - 33 - - - - - - - - - 32 - - - - - - - - - 34 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 541f46cbf331d010a4d80e085fe762dd5d86e6ae Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 17 Dec 2020 16:15:38 -0600 Subject: [PATCH 84/87] manually hide CS delete flyout --- src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp | 1 + src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp index 85a3ed6d8f4..5409244b5fd 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.cpp @@ -174,6 +174,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation ColorSchemeComboBox().SelectedIndex(removedSchemeIndex - 1); } _ColorSchemeList.RemoveAt(removedSchemeIndex); + DeleteButton().Flyout().Hide(); } void ColorSchemes::AddNew_Click(IInspectable const& /*sender*/, RoutedEventArgs const& /*e*/) diff --git a/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml b/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml index 803ca95e47e..1c1951af6b7 100644 --- a/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml +++ b/src/cascadia/TerminalSettingsEditor/ColorSchemes.xaml @@ -209,7 +209,8 @@ the MIT License. See LICENSE in the project root for license information. --> Grid.Column="0" Grid.ColumnSpan="2" Margin="{StaticResource StandardControlSpacing}"> -