terminal/src/cascadia/TerminalSettingsModel/GlobalAppSettings.idl

170 lines
4.7 KiB
Plaintext
Raw Normal View History

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "ColorScheme.idl";
import "KeyMapping.idl";
import "Command.idl";
Introduce TerminalSettingsModel project (#7667) Introduces a new TerminalSettingsModel (TSM) project. This project is responsible for (de)serializing and exposing Windows Terminal's settings as WinRT objects. ## References #885: TSM epic #1564: Settings UI is dependent on this for data binding and settings access #6904: TSM Spec In the process of ripping out TSM from TerminalApp, a few other changes were made to make this possible: 1. AppLogic's `ApplicationDisplayName` and `ApplicationVersion` was moved to `CascadiaSettings` - These are defined as static functions. They also no longer check if `AppLogic::Current()` is nullptr. 2. `enum LaunchMode` was moved from TerminalApp to TSM 3. `AzureConnectionType` and `TelnetConnectionType` were moved from the profile generators to their respective TerminalConnections 4. CascadiaSettings' `SettingsPath` and `DefaultSettingsPath` are exposed as `hstring` instead of `std::filesystem::path` 5. `Command::ExpandCommands()` was exposed via the IDL - This required some of the warnings to be saved to an `IVector` instead of `std::vector`, among some other small changes. 6. The localization resources had to be split into two halves. - Resource file linked in init.cpp. Verified at runtime thanks to the StaticResourceLoader. 7. Added constructors to some `ActionArgs` 8. Utils.h/cpp were moved to `cascadia/inc`. `JsonKey()` was moved to `JsonUtils`. Both TermApp and TSM need access to Utils.h/cpp. A large amount of work includes moving to the new namespace (`TerminalApp` --> `Microsoft::Terminal::Settings::Model`). Fixing the tests had its own complications. Testing required us to split up TSM into a DLL and LIB, similar to TermApp. Discussion on creating a non-local test variant can be found in #7743. Closes #885
2020-10-06 18:56:59 +02:00
namespace Microsoft.Terminal.Settings.Model
{
// MIDL 3 allows for structs to hold nullable types
// Though IReference is a WinRT object, MIDL 3
// handles all of the ownership logic for us.
// Docs: https://docs.microsoft.com/en-us/uwp/midl-3/intro#types
struct LaunchPosition
{
Windows.Foundation.IReference<Int64> X;
Windows.Foundation.IReference<Int64> Y;
};
Introduce TerminalSettingsModel project (#7667) Introduces a new TerminalSettingsModel (TSM) project. This project is responsible for (de)serializing and exposing Windows Terminal's settings as WinRT objects. ## References #885: TSM epic #1564: Settings UI is dependent on this for data binding and settings access #6904: TSM Spec In the process of ripping out TSM from TerminalApp, a few other changes were made to make this possible: 1. AppLogic's `ApplicationDisplayName` and `ApplicationVersion` was moved to `CascadiaSettings` - These are defined as static functions. They also no longer check if `AppLogic::Current()` is nullptr. 2. `enum LaunchMode` was moved from TerminalApp to TSM 3. `AzureConnectionType` and `TelnetConnectionType` were moved from the profile generators to their respective TerminalConnections 4. CascadiaSettings' `SettingsPath` and `DefaultSettingsPath` are exposed as `hstring` instead of `std::filesystem::path` 5. `Command::ExpandCommands()` was exposed via the IDL - This required some of the warnings to be saved to an `IVector` instead of `std::vector`, among some other small changes. 6. The localization resources had to be split into two halves. - Resource file linked in init.cpp. Verified at runtime thanks to the StaticResourceLoader. 7. Added constructors to some `ActionArgs` 8. Utils.h/cpp were moved to `cascadia/inc`. `JsonKey()` was moved to `JsonUtils`. Both TermApp and TSM need access to Utils.h/cpp. A large amount of work includes moving to the new namespace (`TerminalApp` --> `Microsoft::Terminal::Settings::Model`). Fixing the tests had its own complications. Testing required us to split up TSM into a DLL and LIB, similar to TermApp. Discussion on creating a non-local test variant can be found in #7743. Closes #885
2020-10-06 18:56:59 +02:00
enum LaunchMode
{
DefaultMode,
MaximizedMode,
FullscreenMode,
FocusMode,
MaximizedFocusMode,
Introduce TerminalSettingsModel project (#7667) Introduces a new TerminalSettingsModel (TSM) project. This project is responsible for (de)serializing and exposing Windows Terminal's settings as WinRT objects. ## References #885: TSM epic #1564: Settings UI is dependent on this for data binding and settings access #6904: TSM Spec In the process of ripping out TSM from TerminalApp, a few other changes were made to make this possible: 1. AppLogic's `ApplicationDisplayName` and `ApplicationVersion` was moved to `CascadiaSettings` - These are defined as static functions. They also no longer check if `AppLogic::Current()` is nullptr. 2. `enum LaunchMode` was moved from TerminalApp to TSM 3. `AzureConnectionType` and `TelnetConnectionType` were moved from the profile generators to their respective TerminalConnections 4. CascadiaSettings' `SettingsPath` and `DefaultSettingsPath` are exposed as `hstring` instead of `std::filesystem::path` 5. `Command::ExpandCommands()` was exposed via the IDL - This required some of the warnings to be saved to an `IVector` instead of `std::vector`, among some other small changes. 6. The localization resources had to be split into two halves. - Resource file linked in init.cpp. Verified at runtime thanks to the StaticResourceLoader. 7. Added constructors to some `ActionArgs` 8. Utils.h/cpp were moved to `cascadia/inc`. `JsonKey()` was moved to `JsonUtils`. Both TermApp and TSM need access to Utils.h/cpp. A large amount of work includes moving to the new namespace (`TerminalApp` --> `Microsoft::Terminal::Settings::Model`). Fixing the tests had its own complications. Testing required us to split up TSM into a DLL and LIB, similar to TermApp. Discussion on creating a non-local test variant can be found in #7743. Closes #885
2020-10-06 18:56:59 +02:00
};
enum TabSwitcherMode
{
MostRecentlyUsed,
InOrder,
Disabled,
};
enum WindowingMode
{
UseNew,
UseAnyExisting,
UseExisting,
};
[default_interface] runtimeclass GlobalAppSettings {
Guid DefaultProfile;
Boolean HasUnparsedDefaultProfile();
void ClearUnparsedDefaultProfile();
String UnparsedDefaultProfile;
Boolean HasInitialRows();
void ClearInitialRows();
Int32 InitialRows;
Boolean HasInitialCols();
void ClearInitialCols();
Int32 InitialCols;
Boolean HasAlwaysShowTabs();
void ClearAlwaysShowTabs();
Boolean AlwaysShowTabs;
Boolean HasShowTitleInTitlebar();
void ClearShowTitleInTitlebar();
Boolean ShowTitleInTitlebar;
Boolean HasConfirmCloseAllTabs();
void ClearConfirmCloseAllTabs();
Boolean ConfirmCloseAllTabs;
Boolean HasTheme();
void ClearTheme();
Windows.UI.Xaml.ElementTheme Theme;
Boolean HasTabWidthMode();
void ClearTabWidthMode();
Microsoft.UI.Xaml.Controls.TabViewWidthMode TabWidthMode;
Boolean HasShowTabsInTitlebar();
void ClearShowTabsInTitlebar();
Boolean ShowTabsInTitlebar;
Boolean HasWordDelimiters();
void ClearWordDelimiters();
String WordDelimiters;
Boolean HasCopyOnSelect();
void ClearCopyOnSelect();
Boolean CopyOnSelect;
Boolean HasCopyFormatting();
void ClearCopyFormatting();
Microsoft.Terminal.TerminalControl.CopyFormat CopyFormatting;
Boolean HasWarnAboutLargePaste();
void ClearWarnAboutLargePaste();
Boolean WarnAboutLargePaste;
Boolean HasWarnAboutMultiLinePaste();
void ClearWarnAboutMultiLinePaste();
Boolean WarnAboutMultiLinePaste;
Boolean HasInitialPosition();
void ClearInitialPosition();
LaunchPosition InitialPosition;
Boolean HasCenterOnLaunch();
void ClearCenterOnLaunch();
Boolean CenterOnLaunch;
Boolean HasLaunchMode();
void ClearLaunchMode();
LaunchMode LaunchMode;
Boolean HasSnapToGridOnResize();
void ClearSnapToGridOnResize();
Boolean SnapToGridOnResize;
Boolean HasForceFullRepaintRendering();
void ClearForceFullRepaintRendering();
Boolean ForceFullRepaintRendering;
Boolean HasSoftwareRendering();
void ClearSoftwareRendering();
Boolean SoftwareRendering;
Boolean HasForceVTInput();
void ClearForceVTInput();
Boolean ForceVTInput;
Boolean HasDebugFeaturesEnabled();
void ClearDebugFeaturesEnabled();
Boolean DebugFeaturesEnabled;
Boolean HasStartOnUserLogin();
void ClearStartOnUserLogin();
Boolean StartOnUserLogin;
Boolean HasAlwaysOnTop();
void ClearAlwaysOnTop();
Boolean AlwaysOnTop;
Boolean HasTabSwitcherMode();
void ClearTabSwitcherMode();
TabSwitcherMode TabSwitcherMode;
Boolean HasDisableAnimations();
void ClearDisableAnimations();
Boolean DisableAnimations;
Windows.Foundation.Collections.IMapView<String, ColorScheme> ColorSchemes();
void AddColorScheme(ColorScheme scheme);
Add UI for adding, renaming, and deleting a color scheme (#8403) Introduces the following UI controls to the ColorSchemes page: - "Add new" button - next to dropdown selector - adds a new color scheme named ("Color Scheme #" where # is the number of color schemes you have) - "Rename" Button - next to the selector - replaces the ComboBox with a TextBox and the accept/cancel buttons appear - "Delete" button - bottom of the page - opens flyout, when confirmed, deletes the current color scheme and selects another one This also adds a Delete button to the Profiles page. The Hide checkbox was moved above the Delete button. ## References #1564 - Settings UI #6800 - Settings UI Completion Epic ## Detailed Description of the Pull Request / Additional comments **Color Schemes:** - Deleting a color scheme selects another one from the list available - Rename replaces the combobox with a textbox to allow editing - The Add New button creates a new color scheme named "Color Scheme X" where X is the number of schemes defined - In-box color schemes cannot be deleted **Profile:** - Deleting a profile selects another one from the list available - the rename button does not exist (yet), because it needs a modification to the NavigationView's Header Template - The delete button is disabled for in-box profiles (CMD and Windows Powershell) and dynamic profiles ## Validation Steps Performed **Color Schemes - Add New** ✅ Creates a new color scheme named "Color Scheme X" (X being the number of color schemes) ✅ The new color scheme can be renamed/deleted/modified **Color Schemes - Rename** ✅ You cannot rename an in-box color scheme ✅ The rename button has a tooltip ✅ Clicking the rename button replaces the combobox with a textbox ✅ Accept --> changes name ✅ Cancel --> does not change the name ✅ accepting/cancelling the rename operation updates the combo box appropriately **Color Schemes - Delete** ✅ Clicking delete produces a flyout to confirm deletion ✅ Deleting a color scheme removes it from the list and select the one under it ✅ Deleting the last color scheme selects the last available color scheme after it's deleted ✅ In-box color schemes have the delete button disabled, and a disclaimer appears next to it **Profile- Delete** ✅ Base layer presents a disclaimer at the top, and hides the delete button ✅ Dynamic and in-box profiles disable the delete button and show the appropriate disclaimer next to the disabled button ✅ Clicking delete produces a flyout to confirm deletion ✅ Regular profiles have a delete button that is styled appropriately ✅ Clicking the delete profile button opens a content dialog. Confirmation deletes the profile and navigates to the profile indexed under it (deleting the last one redirects to the last one) ## Demo Refer to this post [here](https://github.com/microsoft/terminal/pull/8403#issuecomment-747545651. Confirmation flyout demo: https://github.com/microsoft/terminal/pull/8403#issuecomment-747657842
2020-12-18 00:14:07 +01:00
void RemoveColorScheme(String schemeName);
KeyMapping KeyMap();
Windows.Foundation.Collections.IMapView<String, Command> Commands();
Boolean HasStartupActions();
void ClearStartupActions();
String StartupActions();
Boolean HasFocusFollowMouse();
void ClearFocusFollowMouse();
Boolean FocusFollowMouse;
Boolean HasWindowingBehavior();
void ClearWindowingBehavior();
WindowingMode WindowingBehavior;
}
}