Compare commits

...

138 Commits

Author SHA1 Message Date
Carlos Zamora
1ddc45e473 PRE-MERGE #19519 Implement search in Settings UI 2025-11-19 14:16:27 -08:00
Carlos Zamora
ceb291da48 PRE-MERGE #18917 Allow editing actions in the settings UI 2025-11-19 13:54:12 -08:00
Carlos Zamora
20bdc21c79 clean up more TODOs 2025-11-17 17:42:43 -08:00
Carlos Zamora
a4c69cfc6a clean up some TODOs 2025-11-17 17:35:45 -08:00
Carlos Zamora
e5ea64586d NavigateToXArgs --> NavigateToPageArgs 2025-11-17 16:49:57 -08:00
Carlos Zamora
81f881a579 Fix navigation for profile.appearance settings (global profile too) 2025-11-17 15:41:19 -08:00
Carlos Zamora
45d75e701f registerIndex macro -> lambda 2025-11-17 14:11:56 -08:00
Carlos Zamora
83aa9fd889 profiles: fix BringIntoView (partially) 2025-11-13 10:34:20 -08:00
Carlos Zamora
8c99200e96 color schemes: fix BringIntoView 2025-11-12 15:49:00 -08:00
Pankaj Bhojwani
f4eda1b505 & and move 2025-11-11 21:00:03 -08:00
Pankaj Bhojwani
7bb10f2c48 split size template 2025-11-11 20:45:31 -08:00
Pankaj Bhojwani
bbdf75de66 format 2025-11-11 20:08:41 -08:00
Pankaj Bhojwani
69186ed383 next pass 2025-11-11 20:07:53 -08:00
Pankaj Bhojwani
195c680db8 Merge branch 'main' of https://github.com/microsoft/terminal into dev/pabhoj/settings_actions_editor 2025-11-11 08:00:37 -08:00
Pankaj Bhojwani
1a332c4a43 mostly renames 2025-11-11 07:02:20 -08:00
Carlos Zamora
14bab6cc1a more polish; more bugs found; I guess it's a stalemate 2025-11-07 12:24:33 -08:00
Carlos Zamora
be2b1d30cb fix color schemes; convert APPEND_RUNTIME_OBJECT_RESULTS to lambda 2025-11-06 16:17:32 -08:00
Carlos Zamora
6fbf953fb2 clear search box 2025-11-06 15:32:35 -08:00
Carlos Zamora
cff62cc60e update selected item 2025-11-06 13:57:13 -08:00
Carlos Zamora
82536fd756 bugfix: duplicate profile 2025-11-05 15:26:54 -08:00
Carlos Zamora
bf2e4e19d7 code format and spell check 2025-11-05 15:26:34 -08:00
Carlos Zamora
2706d05491 icons 2025-11-05 14:54:07 -08:00
Pankaj Bhojwani
3a3ef4ec36 first round 2025-11-05 14:39:13 -08:00
Carlos Zamora
1dafcef36f FilteredSearchResult::CreateNoResultsItem and CreateRuntimeObjectItem 2025-11-05 13:02:30 -08:00
Carlos Zamora
53ddd92e7f remove SearchMetadata (old attempt) 2025-11-03 17:26:08 -08:00
Carlos Zamora
e84e8d408f add language neutral search 2025-11-03 17:02:03 -08:00
Carlos Zamora
532343f1ce runtime object indexing 2025-11-03 16:27:12 -08:00
Carlos Zamora
2a41f8a57c improve index 2025-11-03 11:48:36 -08:00
Carlos Zamora
e56eb74788 improve indexing perf and include help text 2025-10-29 15:01:31 -07:00
Carlos Zamora
cac844b1e9 minimum viable product 2025-10-28 12:59:31 -07:00
Carlos Zamora
915f085b60 load runtime index for search 2025-10-23 13:32:18 -07:00
Carlos Zamora
1b8c99dff8 Load build time index for search
- Adds referential XAML names to components of interest.
- Adds a script that generates the build time entries to be loaded
- Invokes the script in Editor.vcxproj
2025-10-15 15:44:17 -07:00
Carlos Zamora
e01ff4faf0 Introduce SearchMetadata and navigation by name
- SearchMetadata is unsused, but it is designed to hold information
   so that we can navigate to a setting
- Updated all pages to...
   - have an x:Name on relevant setting containers
   - have a NavigateToXArgs used in the OnNavigatedTo() function
   - update the NavigateToXArgs to include the name of an element
      to scroll down to
   - Add BringIntoViewWhenLoaded() to HasScrollViewer<T> which
      scrolls down to the element with a given name
These components aren't fully hooked up together yet and there's a
few TODO CARLOS's throughout. Main upcoming work:
- indexing
- runtime indexing
- search box UI
- search results UI
based on 079c69b8be/doc/specs/settings-search.md
2025-10-14 11:46:31 -07:00
Pankaj Bhojwani
294e2e38ad safer handling 2025-09-30 16:20:11 -07:00
Pankaj Bhojwani
8d1f280c93 expose int value on enum and flag entry 2025-09-30 14:23:39 -07:00
Pankaj Bhojwani
757bd154b3 function template instead 2025-09-26 11:55:21 -07:00
Pankaj Bhojwani
8b3c12ea30 edit action resource 2025-09-25 15:52:20 -07:00
Pankaj Bhojwani
e0352e41c7 Merge branch 'main' of https://github.com/microsoft/terminal into dev/pabhoj/settings_actions_editor 2025-09-25 15:32:43 -07:00
Pankaj Bhojwani
1693773039 formatt 2025-09-25 15:32:38 -07:00
Pankaj Bhojwani
6cffe9f36e first pass 2025-09-25 15:32:25 -07:00
Pankaj Bhojwani
2366b3fa0a format 2025-09-03 14:22:05 -07:00
Pankaj Bhojwani
8e0a44791e whitespace 2025-09-03 13:55:46 -07:00
Pankaj Bhojwani
e995a5f711 conflict 2025-09-03 13:54:29 -07:00
Pankaj Bhojwani
b2a624e644 updateid update 2025-08-25 15:32:31 -07:00
Pankaj Bhojwani
41ae7130cf Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-25 15:19:36 -07:00
Pankaj Bhojwani
d9a409afb8 updateid moved to cascadia settings 2025-08-25 15:19:01 -07:00
Pankaj Bhojwani
cde4c039e4 vector instead 2025-08-25 14:36:44 -07:00
Pankaj Bhojwani
bbdfb377fe use action map's update id 2025-08-22 14:39:24 -07:00
Pankaj Bhojwani
64dfb945b0 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-22 14:08:20 -07:00
Pankaj Bhojwani
ebee14b45f map handles id changes 2025-08-22 14:08:02 -07:00
Pankaj Bhojwani
84aaf055f3 lowercase i 2025-08-21 16:14:56 -07:00
Pankaj Bhojwani
890671ab34 callback instead 2025-08-21 16:13:55 -07:00
Pankaj Bhojwani
ea360191b5 unnecessary includes 2025-08-21 11:42:37 -07:00
Pankaj Bhojwani
e9291baeed init newterminalargs in getemptyargs 2025-08-21 11:13:18 -07:00
Pankaj Bhojwani
e2a758e4d4 first round 2025-08-20 15:10:34 -07:00
Pankaj Bhojwani
75d0a1b36a lightweight arg count 2025-08-18 16:37:46 -07:00
Pankaj Bhojwani
892ced6179 two cached vectors 2025-08-18 16:29:14 -07:00
Pankaj Bhojwani
ef197d2153 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-15 13:55:41 -07:00
Pankaj Bhojwani
981a01e74d don't need this anymore 2025-08-15 13:55:20 -07:00
Pankaj Bhojwani
6c08bcb84f cache the displayname 2025-08-15 13:27:40 -07:00
Pankaj Bhojwani
8a81db792f Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-15 11:36:59 -07:00
Pankaj Bhojwani
19fb26dc06 split pane args fix 2025-08-15 11:36:15 -07:00
Pankaj Bhojwani
06c051bfeb +1 2025-08-15 10:42:55 -07:00
Pankaj Bhojwani
9366666c88 get arg descriptors 2025-08-15 10:42:16 -07:00
Pankaj Bhojwani
b3f9c89595 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-14 13:39:03 -07:00
Pankaj Bhojwani
ccfb4bdf1d format 2025-08-14 13:38:42 -07:00
Pankaj Bhojwani
2b1ffd4d47 __COUNTER__, lazy init static arg descriptors 2025-08-14 13:37:15 -07:00
Pankaj Bhojwani
6cb9909758 typehint 2025-08-14 10:26:34 -07:00
Pankaj Bhojwani
fa36c5061f Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-08-13 16:41:46 -07:00
Pankaj Bhojwani
c5dd430bdf const vectors, rename to typeHint 2025-08-13 16:41:36 -07:00
Pankaj Bhojwani
9eb6c7746c conflict 2025-08-12 15:45:34 -07:00
Pankaj Bhojwani
da0a7a0fa0 conflict 2025-08-12 15:04:38 -07:00
Pankaj Bhojwani
24edaa97bf comma 2025-08-07 15:20:14 -07:00
Pankaj Bhojwani
9c50b62d81 prop names 2025-08-07 11:04:27 -07:00
Pankaj Bhojwani
b1550c867d show the first keybinding on the top level page 2025-06-27 13:56:41 -07:00
Pankaj Bhojwani
52abb0de72 Some keyboard nav stuff 2025-06-26 15:51:21 -07:00
Pankaj Bhojwani
d682ded898 update display name on argument change 2025-06-24 15:03:15 -07:00
Pankaj Bhojwani
2b086cbdf3 deduplicate enums that have different names but mean the same thing 2025-06-23 16:41:42 -07:00
Pankaj Bhojwani
816df339a8 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-06-23 14:24:00 -07:00
Pankaj Bhojwani
2f4a0c9b79 Arg_desc 2025-06-23 14:21:14 -07:00
Pankaj Bhojwani
bbdc6714d7 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-06-20 15:10:58 -07:00
Pankaj Bhojwani
10b8475012 rename 2025-06-20 15:10:19 -07:00
Pankaj Bhojwani
ac0eb51259 new info badge 2025-06-20 14:39:12 -07:00
Pankaj Bhojwani
4311a2b51c add todos, remove guid 2025-06-20 13:56:32 -07:00
Pankaj Bhojwani
757191b11f Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-06-20 12:50:21 -07:00
Pankaj Bhojwani
54681b4d13 localized arg names 2025-06-20 12:50:05 -07:00
Pankaj Bhojwani
ccc7292532 init to first item in the enum list 2025-06-19 15:19:54 -07:00
Pankaj Bhojwani
cd424f43dc assert 2025-06-19 15:05:13 -07:00
Pankaj Bhojwani
849eb1df4d access maps through page vm 2025-06-19 15:01:53 -07:00
Pankaj Bhojwani
ad0f79dbb8 name fixes 2025-06-18 15:53:48 -07:00
Pankaj Bhojwani
c24293cd89 getter only 2025-06-18 15:08:12 -07:00
Pankaj Bhojwani
43ad62c32d proposed shortcut action name 2025-06-18 14:47:09 -07:00
Pankaj Bhojwani
b23ce8735f remove these notifies 2025-06-18 14:38:07 -07:00
Pankaj Bhojwani
c4529aa935 uia text 2025-06-18 11:49:47 -07:00
Pankaj Bhojwani
c47a353ba4 switch to items control 2025-06-18 10:46:48 -07:00
Pankaj Bhojwani
caedc8fbc8 items control here 2025-06-17 14:30:15 -07:00
Pankaj Bhojwani
bafe0b1326 automation props, tab stop fixes 2025-06-17 12:39:53 -07:00
Pankaj Bhojwani
c24035f87c ...xaml side too 2025-06-16 16:37:57 -07:00
Pankaj Bhojwani
d862d67142 uia names 2025-06-16 16:33:39 -07:00
Pankaj Bhojwani
7db0cd6ad4 spell 2025-06-16 15:56:25 -07:00
Pankaj Bhojwani
f601fc73c5 keyboard nav, event handler cleanup 2025-06-16 11:33:51 -07:00
Pankaj Bhojwani
78395fbf25 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-06-13 13:19:59 -07:00
Pankaj Bhojwani
67a1b4e964 alphabetical 2025-06-13 13:18:38 -07:00
Pankaj Bhojwani
a6111892c5 move to action map 2025-06-13 13:17:08 -07:00
Pankaj Bhojwani
9fa1c94873 we're not listening to this 2025-06-11 16:40:55 -07:00
Pankaj Bhojwani
f853aa491c abstract 2025-06-11 16:20:56 -07:00
Pankaj Bhojwani
2e5c54c29d folder picker 2025-06-11 15:27:56 -07:00
Pankaj Bhojwani
7fac89c06b some wrapping 2025-06-11 11:04:33 -07:00
Pankaj Bhojwani
54b850ef95 no more no arg 2025-06-10 16:58:53 -07:00
Pankaj Bhojwani
3e426d77be remvoe more 2025-06-10 11:50:17 -07:00
Pankaj Bhojwani
5dde183dda add examples, remove some stuff 2025-06-10 11:41:17 -07:00
Pankaj Bhojwani
21e1e15b65 how about now 2025-06-03 15:51:59 -07:00
Pankaj Bhojwani
4e87177ac8 spelling 2025-06-03 15:46:41 -07:00
Pankaj Bhojwani
c55ba1b13c post merge updates 2025-06-03 15:07:55 -07:00
Pankaj Bhojwani
4a972cca71 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-06-03 14:21:13 -07:00
Pankaj Bhojwani
0cb802e8a1 format 2025-06-03 14:20:01 -07:00
Pankaj Bhojwani
0227969781 undef the correct thing 2025-06-03 14:00:40 -07:00
Pankaj Bhojwani
cdb9599c96 name fix 2025-06-02 16:45:54 -07:00
Pankaj Bhojwani
e2b2d46944 new tab menu updates with id changes 2025-06-02 16:04:46 -07:00
Pankaj Bhojwani
b0ba0df1d7 deduplicate resource strings 2025-06-02 15:18:12 -07:00
Pankaj Bhojwani
46b036b151 folder path, only capitalize first letter 2025-05-30 16:11:41 -07:00
Pankaj Bhojwani
80924f264d rename and separate interface 2025-05-30 13:27:04 -07:00
Pankaj Bhojwani
035b3414bc static actionargfactory class 2025-05-30 10:55:56 -07:00
Pankaj Bhojwani
18830be62d change this back 2025-05-29 16:11:07 -07:00
Pankaj Bhojwani
ed257207c5 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-05-29 16:10:08 -07:00
Pankaj Bhojwani
d62ede4bae init as nullptr 2025-05-29 13:51:33 -07:00
Pankaj Bhojwani
6557d17048 Merge branch 'main' of https://github.com/microsoft/terminal into dev/pabhoj/settings_model_reflection 2025-05-29 12:28:39 -07:00
Pankaj Bhojwani
5b617e00ea Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-05-16 12:53:40 -07:00
Pankaj Bhojwani
9618831ec7 first nits 2025-05-16 12:53:16 -07:00
Pankaj Bhojwani
eecb32d297 format 2025-05-15 12:02:50 -07:00
Pankaj Bhojwani
23a04324f8 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-05-15 12:01:38 -07:00
Pankaj Bhojwani
72e9b64e2d format 2025-05-15 12:01:20 -07:00
Pankaj Bhojwani
8d0f947e94 remove old stuff 2025-05-14 17:59:18 -07:00
Pankaj Bhojwani
63ec868455 remove old actions page 2025-05-14 17:32:31 -07:00
Pankaj Bhojwani
acad3880d0 Merge branch 'dev/pabhoj/settings_model_reflection' into dev/pabhoj/settings_actions_editor 2025-05-14 16:46:52 -07:00
Pankaj Bhojwani
ce8b31b825 use x-macro here instead 2025-05-14 16:44:07 -07:00
Pankaj Bhojwani
2f6108da6a settings actions editor 2025-05-14 13:35:08 -07:00
Pankaj Bhojwani
d9738363b7 settings model reflection 2025-05-14 13:33:12 -07:00
70 changed files with 4986 additions and 884 deletions

View File

@@ -71,7 +71,9 @@ sustainability
sxn
Tencent
toolset
Uids
UEFI
UIDs
uiatextrange
und
vsdevcmd

View File

@@ -4,6 +4,7 @@
#include "pch.h"
#include "Actions.h"
#include "Actions.g.cpp"
#include "NavigateToPageArgs.g.h"
#include "LibraryResources.h"
#include "../TerminalSettingsModel/AllShortcutActions.h"
@@ -19,52 +20,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Automation::AutomationProperties::SetName(AddNewButton(), RS_(L"Actions_AddNewTextBlock/Text"));
}
Automation::Peers::AutomationPeer Actions::OnCreateAutomationPeer()
{
_ViewModel.OnAutomationPeerAttached();
return nullptr;
}
void Actions::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::ActionsViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::ActionsViewModel>();
_ViewModel.CurrentPage(ActionsSubPage::Base);
auto vmImpl = get_self<ActionsViewModel>(_ViewModel);
vmImpl->MarkAsVisited();
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
// Only let this succeed once.
_layoutUpdatedRevoker.revoke();
// Subscribe to the view model's FocusContainer event.
// Use the KeyBindingViewModel or index provided in the event to focus the corresponding container
_ViewModel.FocusContainer([this](const auto& /*sender*/, const auto& args) {
if (auto kbdVM{ args.try_as<KeyBindingViewModel>() })
{
if (const auto& container = KeyBindingsListView().ContainerFromItem(*kbdVM))
{
container.as<Controls::ListViewItem>().Focus(FocusState::Programmatic);
}
}
else if (const auto& index = args.try_as<uint32_t>())
{
if (const auto& container = KeyBindingsListView().ContainerFromIndex(*index))
{
container.as<Controls::ListViewItem>().Focus(FocusState::Programmatic);
}
}
});
// Subscribe to the view model's UpdateBackground event.
// The view model does not have access to the page resources, so it asks us
// to update the key binding's container background
_ViewModel.UpdateBackground([this](const auto& /*sender*/, const auto& args) {
if (auto kbdVM{ args.try_as<KeyBindingViewModel>() })
{
if (kbdVM->IsInEditMode())
{
const auto& containerBackground{ Resources().Lookup(box_value(L"ActionContainerBackgroundEditing")).as<Windows::UI::Xaml::Media::Brush>() };
kbdVM->ContainerBackground(containerBackground);
}
else
{
const auto& containerBackground{ Resources().Lookup(box_value(L"ActionContainerBackground")).as<Windows::UI::Xaml::Media::Brush>() };
kbdVM->ContainerBackground(containerBackground);
}
}
AddNewButton().Focus(FocusState::Programmatic);
});
TraceLoggingWrite(
@@ -75,9 +42,4 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}
void Actions::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*eventArgs*/)
{
_ViewModel.AddNewKeybinding();
}
}

View File

@@ -16,12 +16,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Actions();
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
Windows::UI::Xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();
void AddNew_Click(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(Editor::ActionsViewModel, ViewModel, PropertyChanged.raise, nullptr);
private:
winrt::Windows::UI::Xaml::FrameworkElement::LayoutUpdated_revoker _layoutUpdatedRevoker;
};
}

View File

@@ -123,7 +123,7 @@
<Style x:Key="KeyBindingContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="4" />
<Setter Property="Padding" Value="12,4,4,4" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
</Style>
@@ -138,24 +138,6 @@
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<x:Int32 x:Key="EditButtonSize">32</x:Int32>
<x:Double x:Key="EditButtonIconSize">14</x:Double>
<Style x:Key="EditButtonStyle"
BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="AccentEditButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
<Setter Property="Padding" Value="4" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<!-- Converters & Misc. -->
<SolidColorBrush x:Key="ActionContainerBackgroundEditing"
@@ -164,15 +146,9 @@
Color="Transparent" />
<!-- Templates -->
<DataTemplate x:Key="KeyBindingTemplate"
x:DataType="local:KeyBindingViewModel">
<ListViewItem AutomationProperties.AcceleratorKey="{x:Bind KeyChordText, Mode=OneWay}"
AutomationProperties.Name="{x:Bind Name, Mode=OneWay}"
Background="{x:Bind ContainerBackground, Mode=OneWay}"
GotFocus="{x:Bind ActionGotFocus}"
LostFocus="{x:Bind ActionLostFocus}"
PointerEntered="{x:Bind EnterHoverMode}"
PointerExited="{x:Bind ExitHoverMode}"
<DataTemplate x:Key="CommandTemplate"
x:DataType="local:CommandViewModel">
<ListViewItem AutomationProperties.Name="{x:Bind DisplayNameAndKeyChordAutomationPropName, Mode=OneWay}"
Style="{StaticResource KeyBindingContainerStyle}">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
@@ -180,146 +156,25 @@
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="auto" />
<!-- edit buttons -->
<!--
This needs to be 112 because that is the width of the row of buttons in edit mode + padding.
3 buttons: 32+32+32
Padding: 8+ 8
This allows the "edit" button to align with the "cancel" button seamlessly
-->
<ColumnDefinition Width="112" />
</Grid.ColumnDefinitions>
<!-- Command Name -->
<TextBlock Grid.Column="0"
FontWeight="Normal"
Style="{StaticResource KeyBindingNameTextBlockStyle}"
Text="{x:Bind Name, Mode=OneWay}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}" />
<!-- Edit Mode: Action Combo-box -->
<ComboBox x:Uid="Actions_ActionComboBox"
Grid.Column="0"
VerticalAlignment="Center"
ItemsSource="{x:Bind AvailableActions, Mode=OneWay}"
SelectedItem="{x:Bind ProposedAction, Mode=TwoWay}"
Visibility="{x:Bind IsInEditMode, Mode=OneWay}" />
Text="{x:Bind DisplayName, Mode=OneWay}" />
<!-- Key Chord Text -->
<Border Grid.Column="1"
Padding="2,0,2,0"
Padding="8,4,8,4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}">
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(FirstKeyChordText)}">
<TextBlock FontSize="14"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind KeyChordText, Mode=OneWay}"
Text="{x:Bind FirstKeyChordText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</Border>
<!-- Edit Mode: Key Chord Listener -->
<local:KeyChordListener Grid.Column="1"
Keys="{x:Bind ProposedKeys, Mode=TwoWay}"
Style="{StaticResource KeyChordEditorStyle}"
Visibility="{x:Bind IsInEditMode, Mode=OneWay}" />
<!-- Edit Button -->
<Button x:Uid="Actions_EditButton"
Grid.Column="2"
AutomationProperties.Name="{x:Bind EditButtonName}"
Background="Transparent"
Click="{x:Bind ToggleEditMode}"
GettingFocus="{x:Bind EditButtonGettingFocus}"
LosingFocus="{x:Bind EditButtonLosingFocus}"
Style="{StaticResource EditButtonStyle}"
Visibility="{x:Bind ShowEditButton, Mode=OneWay}">
<Button.Content>
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE70F;" />
</Button.Content>
<Button.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{StaticResource SystemAccentColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{StaticResource SystemAccentColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{StaticResource SystemAccentColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{StaticResource SystemAccentColor}" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<SolidColorBrush x:Key="ButtonBackground"
Color="{ThemeResource SystemColorButtonFaceColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPointerOver"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonBackgroundPressed"
Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="ButtonForeground"
Color="{ThemeResource SystemColorButtonTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPointerOver"
Color="{ThemeResource SystemColorHighlightTextColor}" />
<SolidColorBrush x:Key="ButtonForegroundPressed"
Color="{ThemeResource SystemColorHighlightTextColor}" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</Button.Resources>
</Button>
<!-- Edit Mode: Buttons -->
<StackPanel Grid.Column="2"
Orientation="Horizontal"
Visibility="{x:Bind IsInEditMode, Mode=OneWay}">
<!-- Cancel editing the action -->
<Button x:Uid="Actions_CancelButton"
AutomationProperties.Name="{x:Bind CancelButtonName}"
Click="{x:Bind CancelChanges}"
Style="{StaticResource EditButtonStyle}">
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE711;" />
</Button>
<!-- Accept changes -->
<Button x:Uid="Actions_AcceptButton"
Margin="8,0,0,0"
AutomationProperties.Name="{x:Bind AcceptButtonName}"
Click="{x:Bind AttemptAcceptChanges}"
Flyout="{x:Bind AcceptChangesFlyout, Mode=OneWay}"
Style="{StaticResource AccentEditButtonStyle}">
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE8FB;" />
</Button>
<!-- Delete the current key binding -->
<Button x:Uid="Actions_DeleteButton"
Margin="8,0,0,0"
AutomationProperties.Name="{x:Bind DeleteButtonName}"
Style="{StaticResource DeleteSmallButtonStyle}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsNewlyAdded), Mode=OneWay}">
<Button.Content>
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE74D;" />
</Button.Content>
<Button.Flyout>
<Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
<StackPanel>
<TextBlock x:Uid="Actions_DeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Actions_DeleteConfirmationButton"
Click="{x:Bind DeleteKeyBinding}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</Grid>
</ListViewItem>
</DataTemplate>
@@ -331,10 +186,14 @@
HorizontalAlignment="Left"
Spacing="8"
Style="{StaticResource SettingsStackStyle}">
<HyperlinkButton x:Uid="Actions_Disclaimer"
Margin="0"
Padding="0"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2341386" />
<!-- Add New Button -->
<Button x:Name="AddNewButton"
Margin="0,12,0,0"
Click="AddNew_Click">
Click="{x:Bind ViewModel.AddNewCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
@@ -345,11 +204,13 @@
</Button.Content>
</Button>
<!-- Keybindings -->
<ListView x:Name="KeyBindingsListView"
ItemTemplate="{StaticResource KeyBindingTemplate}"
ItemsSource="{x:Bind ViewModel.KeyBindingList, Mode=OneWay}"
SelectionMode="None" />
<!-- Commands -->
<ListView x:Name="CommandsListView"
Margin="-8,0,0,0"
IsItemClickEnabled="True"
ItemClick="{x:Bind ViewModel.CmdListItemClicked}"
ItemTemplate="{StaticResource CommandTemplate}"
ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}" />
</StackPanel>
</Border>
</Page>

File diff suppressed because it is too large Load Diff

View File

@@ -1,130 +1,318 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- ActionsViewModel.h
Abstract:
- This contains the view models for everything related to the Actions pages (Actions.xaml and EditAction.xaml)
- ActionsViewModel:
- Contains the "current page" enum, which dictates whether we're in the top-level Actions page or the EditAction page
- Contains the full command list, and keeps track of the "current command" that is being edited
- These are in the form of CommandViewModel(s)
- Handles modification to the list of commands, i.e. addition/deletion
- Listens to each CommandViewModel for key chord events for addition/modification/deletion of keychords
- CommandViewModel:
- Constructed with a Model::Command object
- View model for each specific command item
- Contains higher-level detail about the command itself such as name, whether it is a user command, and the shortcut action type
- Contains an ActionArgsViewModel, which it creates according to the shortcut action type
- Recreates the ActionArgsViewModel whenever the shortcut action type changes
- Contains the full keybinding list, in the form of KeyChordViewModel(s)
- ActionArgsViewModel:
- Constructed with a Model::ActionAndArgs object
- Contains a vector of ArgWrapper(s), one ArgWrapper for each arg
- Listens and propagates changes to the ArgWrappers
- ArgWrapper:
- Wrapper for each argument
- Handles binding and bind back logic for the presentation and modification of the argument via the UI
- Has separate binding and bind back logic depending on the type of the argument
- KeyChordViewModel:
- Constructed with a Control::KeyChord object
- Handles binding and bind back logic for the presentation and modification of a keybinding via the UI
--*/
#pragma once
#include "ActionsViewModel.g.h"
#include "KeyBindingViewModel.g.h"
#include "ModifyKeyBindingEventArgs.g.h"
#include "NavigateToCommandArgs.g.h"
#include "CommandViewModel.g.h"
#include "ArgWrapper.g.h"
#include "ActionArgsViewModel.g.h"
#include "KeyChordViewModel.g.h"
#include "ModifyKeyChordEventArgs.g.h"
#include "Utils.h"
#include "ViewModelHelpers.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct KeyBindingViewModelComparator
{
bool operator()(const Editor::KeyBindingViewModel& lhs, const Editor::KeyBindingViewModel& rhs) const
{
return lhs.Name() < rhs.Name();
}
};
struct ModifyKeyBindingEventArgs : ModifyKeyBindingEventArgsT<ModifyKeyBindingEventArgs>
struct NavigateToCommandArgs : NavigateToCommandArgsT<NavigateToCommandArgs>
{
public:
ModifyKeyBindingEventArgs(const Control::KeyChord& oldKeys, const Control::KeyChord& newKeys, const hstring oldActionName, const hstring newActionName) :
NavigateToCommandArgs(CommandViewModel command, Editor::IHostedInWindow windowRoot) :
_Command(command),
_WindowRoot(windowRoot) {}
Editor::IHostedInWindow WindowRoot() const noexcept { return _WindowRoot; }
Editor::CommandViewModel Command() const noexcept { return _Command; }
private:
Editor::IHostedInWindow _WindowRoot;
Editor::CommandViewModel _Command{ nullptr };
};
struct ModifyKeyChordEventArgs : ModifyKeyChordEventArgsT<ModifyKeyChordEventArgs>
{
public:
ModifyKeyChordEventArgs(const Control::KeyChord& oldKeys, const Control::KeyChord& newKeys) :
_OldKeys{ oldKeys },
_NewKeys{ newKeys },
_OldActionName{ std::move(oldActionName) },
_NewActionName{ std::move(newActionName) } {}
_NewKeys{ newKeys } {}
WINRT_PROPERTY(Control::KeyChord, OldKeys, nullptr);
WINRT_PROPERTY(Control::KeyChord, NewKeys, nullptr);
WINRT_PROPERTY(hstring, OldActionName);
WINRT_PROPERTY(hstring, NewActionName);
};
struct KeyBindingViewModel : KeyBindingViewModelT<KeyBindingViewModel>, ViewModelHelper<KeyBindingViewModel>
struct CommandViewModel : CommandViewModelT<CommandViewModel>, ViewModelHelper<CommandViewModel>
{
public:
KeyBindingViewModel(const Windows::Foundation::Collections::IObservableVector<hstring>& availableActions);
KeyBindingViewModel(const Control::KeyChord& keys, const hstring& name, const Windows::Foundation::Collections::IObservableVector<hstring>& availableActions);
CommandViewModel(const winrt::Microsoft::Terminal::Settings::Model::Command& cmd,
std::vector<Control::KeyChord> keyChordList,
const Editor::ActionsViewModel& actionsPageVM,
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> availableActionsAndNamesMap,
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> nameToActionMap);
void Initialize();
hstring Name() const { return _CurrentAction; }
hstring KeyChordText() const { return _KeyChordText; }
winrt::hstring DisplayName();
winrt::hstring Name();
void Name(const winrt::hstring& newName);
winrt::hstring DisplayNameAndKeyChordAutomationPropName();
winrt::hstring FirstKeyChordText();
winrt::hstring ID();
bool IsUserAction();
void Edit_Click();
til::typed_event<Editor::CommandViewModel, IInspectable> EditRequested;
void Delete_Click();
til::typed_event<Editor::CommandViewModel, IInspectable> DeleteRequested;
void AddKeybinding_Click();
// UIA text
winrt::hstring ActionNameTextBoxAutomationPropName();
winrt::hstring ShortcutActionComboBoxAutomationPropName();
winrt::hstring AdditionalArgumentsControlAutomationPropName();
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeNamesRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateWindowRootRequested;
til::typed_event<IInspectable, IInspectable> FocusContainer;
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedShortcutActionName);
VIEW_MODEL_OBSERVABLE_PROPERTY(Editor::ActionArgsViewModel, ActionArgsVM, nullptr);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<hstring>, AvailableShortcutActions, nullptr);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::KeyChordViewModel>, KeyChordList, nullptr);
WINRT_PROPERTY(bool, IsNewCommand, false);
private:
winrt::hstring _cachedDisplayName;
winrt::Microsoft::Terminal::Settings::Model::Command _command;
std::vector<Control::KeyChord> _keyChordList;
weak_ref<Editor::ActionsViewModel> _actionsPageVM{ nullptr };
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> _availableActionsAndNamesMap;
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> _nameToActionMap;
void _RegisterKeyChordVMEvents(Editor::KeyChordViewModel kcVM);
void _RegisterActionArgsVMEvents(Editor::ActionArgsViewModel actionArgsVM);
void _ReplaceCommandWithUserCopy(bool reinitialize);
void _CreateAndInitializeActionArgsVMHelper();
};
struct ArgWrapper : ArgWrapperT<ArgWrapper>, ViewModelHelper<ArgWrapper>
{
public:
ArgWrapper(const Model::ArgDescriptor& descriptor, const Windows::Foundation::IInspectable& value);
void Initialize();
winrt::hstring Name() const noexcept { return _descriptor.Name; };
winrt::hstring Type() const noexcept { return _descriptor.Type; };
Model::ArgTypeHint TypeHint() const noexcept { return _descriptor.TypeHint; };
bool Required() const noexcept { return _descriptor.Required; };
// We cannot use the macro here because we need to implement additional logic for the setter
Windows::Foundation::IInspectable EnumValue() const noexcept { return _EnumValue; };
void EnumValue(const Windows::Foundation::IInspectable& value);
Windows::Foundation::Collections::IObservableVector<Microsoft::Terminal::Settings::Editor::EnumEntry> EnumList() const noexcept { return _EnumList; };
Windows::Foundation::Collections::IObservableVector<Microsoft::Terminal::Settings::Editor::FlagEntry> FlagList() const noexcept { return _FlagList; };
// unboxing functions
winrt::hstring UnboxString(const Windows::Foundation::IInspectable& value);
int32_t UnboxInt32(const Windows::Foundation::IInspectable& value);
float UnboxInt32Optional(const Windows::Foundation::IInspectable& value);
uint32_t UnboxUInt32(const Windows::Foundation::IInspectable& value);
float UnboxUInt32Optional(const Windows::Foundation::IInspectable& value);
float UnboxFloat(const Windows::Foundation::IInspectable& value);
bool UnboxBool(const Windows::Foundation::IInspectable& value);
winrt::Windows::Foundation::IReference<bool> UnboxBoolOptional(const Windows::Foundation::IInspectable& value);
winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> UnboxTerminalCoreColorOptional(const Windows::Foundation::IInspectable& value);
winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> UnboxWindowsUIColorOptional(const Windows::Foundation::IInspectable& value);
// bind back functions
void StringBindBack(const winrt::hstring& newValue);
void Int32BindBack(const double newValue);
void Int32OptionalBindBack(const double newValue);
void UInt32BindBack(const double newValue);
void UInt32OptionalBindBack(const double newValue);
void FloatBindBack(const double newValue);
void BoolOptionalBindBack(const Windows::Foundation::IReference<bool> newValue);
void TerminalCoreColorBindBack(const winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> newValue);
void WindowsUIColorBindBack(const winrt::Windows::Foundation::IReference<Microsoft::Terminal::Core::Color> newValue);
safe_void_coroutine BrowseForFile_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
safe_void_coroutine BrowseForFolder_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& e);
// some argWrappers need to know additional information (like the default color scheme or the list of all color scheme names)
// to avoid populating all ArgWrappers with that information, instead we emit an event when we need that information
// (these events then get propagated up to the ActionsVM) and then the actionsVM will populate the value in us
// since there's an actionArgsVM above us and a commandVM above that, the event does get propagated through a few times but that's
// probably better than having every argWrapper contain the information by default
til::typed_event<IInspectable, Editor::ArgWrapper> ColorSchemeRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> ColorSchemeNamesRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> WindowRootRequested;
VIEW_MODEL_OBSERVABLE_PROPERTY(Editor::ColorSchemeViewModel, DefaultColorScheme, nullptr);
VIEW_MODEL_OBSERVABLE_PROPERTY(Windows::Foundation::IInspectable, Value, nullptr);
WINRT_PROPERTY(Windows::Foundation::Collections::IVector<winrt::hstring>, ColorSchemeNamesList, nullptr);
WINRT_PROPERTY(Editor::IHostedInWindow, WindowRoot, nullptr);
private:
Model::ArgDescriptor _descriptor;
Windows::Foundation::IInspectable _EnumValue{ nullptr };
Windows::Foundation::Collections::IObservableVector<Microsoft::Terminal::Settings::Editor::EnumEntry> _EnumList;
Windows::Foundation::Collections::IObservableVector<Microsoft::Terminal::Settings::Editor::FlagEntry> _FlagList;
// Regular enum list + value
template<typename EnumType>
void _InitializeEnumListAndValue(
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
const winrt::hstring& resourceSectionAndType,
const winrt::hstring& resourceProperty);
// Nullable enum list + value
template<typename EnumType>
void _InitializeNullableEnumListAndValue(
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
const winrt::hstring& resourceSectionAndType,
const winrt::hstring& resourceProperty);
// Flag list + value
template<typename EnumType>
void _InitializeFlagListAndValue(
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
const winrt::hstring& resourceSectionAndType,
const winrt::hstring& resourceProperty);
// Nullable flag list + value
template<typename EnumType>
void _InitializeNullableFlagListAndValue(
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
const winrt::hstring& resourceSectionAndType,
const winrt::hstring& resourceProperty);
};
struct ActionArgsViewModel : ActionArgsViewModelT<ActionArgsViewModel>, ViewModelHelper<ActionArgsViewModel>
{
public:
ActionArgsViewModel(const Microsoft::Terminal::Settings::Model::ActionAndArgs actionAndArgs);
void Initialize();
bool HasArgs() const noexcept;
void ReplaceActionAndArgs(Model::ActionAndArgs newActionAndArgs);
til::typed_event<IInspectable, IInspectable> WrapperValueChanged;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeNamesRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateWindowRootRequested;
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::ArgWrapper>, ArgValues, nullptr);
private:
Model::ActionAndArgs _actionAndArgs{ nullptr };
};
struct KeyChordViewModel : KeyChordViewModelT<KeyChordViewModel>, ViewModelHelper<KeyChordViewModel>
{
public:
KeyChordViewModel(Control::KeyChord CurrentKeys);
void CurrentKeys(const Control::KeyChord& newKeys);
Control::KeyChord CurrentKeys() const noexcept;
void ToggleEditMode();
void AcceptChanges();
void CancelChanges();
void DeleteKeyChord();
// UIA Text
hstring EditButtonName() const noexcept;
hstring CancelButtonName() const noexcept;
hstring AcceptButtonName() const noexcept;
hstring DeleteButtonName() const noexcept;
void EnterHoverMode() { IsHovered(true); };
void ExitHoverMode() { IsHovered(false); };
void ActionGotFocus() { IsContainerFocused(true); };
void ActionLostFocus() { IsContainerFocused(false); };
void EditButtonGettingFocus() { IsEditButtonFocused(true); };
void EditButtonLosingFocus() { IsEditButtonFocused(false); };
bool ShowEditButton() const noexcept;
void ToggleEditMode();
void DisableEditMode() { IsInEditMode(false); }
void AttemptAcceptChanges();
void AttemptAcceptChanges(const Control::KeyChord newKeys);
void CancelChanges();
void DeleteKeyBinding() { DeleteKeyBindingRequested.raise(*this, _CurrentKeys); }
// ProposedAction: the entry selected by the combo box; may disagree with the settings model.
// CurrentAction: the combo box item that maps to the settings model value.
// AvailableActions: the list of options in the combo box; both actions above must be in this list.
// NOTE: ProposedAction and CurrentAction may disagree mainly due to the "edit mode" system in place.
// Current Action serves as...
// 1 - a record of what to set ProposedAction to on a cancellation
// 2 - a form of translation between ProposedAction and the settings model
// We would also need an ActionMap reference to remove this, but this is a better separation
// of responsibilities.
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedAction);
VIEW_MODEL_OBSERVABLE_PROPERTY(hstring, CurrentAction);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<hstring>, AvailableActions, nullptr);
// ProposedKeys: the keys proposed by the control; may disagree with the settings model.
// CurrentKeys: the key chord bound in the settings model.
VIEW_MODEL_OBSERVABLE_PROPERTY(Control::KeyChord, ProposedKeys);
VIEW_MODEL_OBSERVABLE_PROPERTY(Control::KeyChord, CurrentKeys, nullptr);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsInEditMode, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsNewlyAdded, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(Control::KeyChord, ProposedKeys);
VIEW_MODEL_OBSERVABLE_PROPERTY(winrt::hstring, KeyChordText);
VIEW_MODEL_OBSERVABLE_PROPERTY(Windows::UI::Xaml::Controls::Flyout, AcceptChangesFlyout, nullptr);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsAutomationPeerAttached, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsHovered, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsContainerFocused, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsEditButtonFocused, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(Windows::UI::Xaml::Media::Brush, ContainerBackground, nullptr);
public:
til::typed_event<Editor::KeyBindingViewModel, Editor::ModifyKeyBindingEventArgs> ModifyKeyBindingRequested;
til::typed_event<Editor::KeyBindingViewModel, Terminal::Control::KeyChord> DeleteKeyBindingRequested;
til::typed_event<Editor::KeyBindingViewModel, IInspectable> DeleteNewlyAddedKeyBinding;
til::typed_event<Editor::KeyChordViewModel, Terminal::Control::KeyChord> AddKeyChordRequested;
til::typed_event<Editor::KeyChordViewModel, Editor::ModifyKeyChordEventArgs> ModifyKeyChordRequested;
til::typed_event<Editor::KeyChordViewModel, Terminal::Control::KeyChord> DeleteKeyChordRequested;
private:
hstring _KeyChordText{};
Control::KeyChord _currentKeys;
};
struct ActionsViewModel : ActionsViewModelT<ActionsViewModel>, ViewModelHelper<ActionsViewModel>
{
public:
ActionsViewModel(Model::CascadiaSettings settings);
void UpdateSettings(const Model::CascadiaSettings& settings);
void MarkAsVisited();
bool DisplayBadge() const noexcept;
void OnAutomationPeerAttached();
void AddNewKeybinding();
void AddNewCommand();
til::typed_event<IInspectable, IInspectable> FocusContainer;
til::typed_event<IInspectable, IInspectable> UpdateBackground;
void CurrentCommand(const Editor::CommandViewModel& newCommand);
Editor::CommandViewModel CurrentCommand();
void CmdListItemClicked(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::Controls::ItemClickEventArgs& e);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::KeyBindingViewModel>, KeyBindingList);
void DeleteKeyChord(const Control::KeyChord& keys);
void AttemptAddOrModifyKeyChord(const Editor::KeyChordViewModel& senderVM, winrt::hstring commandID, const Control::KeyChord& newKeys, const Control::KeyChord& oldKeys);
void AddCopiedCommand(const Model::Command& newCommand);
void RegenerateCommandID(const Model::Command& command);
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> AvailableShortcutActionsAndNames();
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> NameToActionMap();
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::CommandViewModel>, CommandList);
WINRT_OBSERVABLE_PROPERTY(ActionsSubPage, CurrentPage, _propertyChangedHandlers, ActionsSubPage::Base);
private:
bool _AutomationPeerAttached{ false };
Editor::CommandViewModel _CurrentCommand{ nullptr };
Model::CascadiaSettings _Settings;
Windows::Foundation::Collections::IObservableVector<hstring> _AvailableActionAndArgs;
Windows::Foundation::Collections::IMap<hstring, Model::ActionAndArgs> _AvailableActionMap;
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> _AvailableActionsAndNamesMap;
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> _NameToActionMap;
std::optional<uint32_t> _GetContainerIndexByKeyChord(const Control::KeyChord& keys);
void _RegisterEvents(com_ptr<implementation::KeyBindingViewModel>& kbdVM);
void _MakeCommandVMsHelper();
void _RegisterCmdVMEvents(com_ptr<implementation::CommandViewModel>& cmdVM);
void _KeyBindingViewModelPropertyChangedHandler(const Windows::Foundation::IInspectable& senderVM, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);
void _KeyBindingViewModelDeleteKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const Control::KeyChord& args);
void _KeyBindingViewModelModifyKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const Editor::ModifyKeyBindingEventArgs& args);
void _KeyBindingViewModelDeleteNewlyAddedKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const IInspectable& args);
void _CmdVMEditRequestedHandler(const Editor::CommandViewModel& senderVM, const IInspectable& args);
void _CmdVMDeleteRequestedHandler(const Editor::CommandViewModel& senderVM, const IInspectable& args);
void _CmdVMPropagateColorSchemeRequestedHandler(const IInspectable& sender, const Editor::ArgWrapper& wrapper);
void _CmdVMPropagateColorSchemeNamesRequestedHandler(const IInspectable& sender, const Editor::ArgWrapper& wrapper);
};
}

View File

@@ -1,60 +1,186 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "EnumEntry.idl";
import "ColorSchemeViewModel.idl";
import "MainPage.idl";
namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass ModifyKeyBindingEventArgs
[default_interface] runtimeclass ArgsTemplateSelectors : Windows.UI.Xaml.Controls.DataTemplateSelector
{
ArgsTemplateSelectors();
Windows.UI.Xaml.DataTemplate Int32Template;
Windows.UI.Xaml.DataTemplate Int32OptionalTemplate;
Windows.UI.Xaml.DataTemplate UInt32Template;
Windows.UI.Xaml.DataTemplate UInt32OptionalTemplate;
Windows.UI.Xaml.DataTemplate FloatTemplate;
Windows.UI.Xaml.DataTemplate SplitSizeTemplate;
Windows.UI.Xaml.DataTemplate StringTemplate;
Windows.UI.Xaml.DataTemplate ColorSchemeTemplate;
Windows.UI.Xaml.DataTemplate FilePickerTemplate;
Windows.UI.Xaml.DataTemplate FolderPickerTemplate;
Windows.UI.Xaml.DataTemplate BoolTemplate;
Windows.UI.Xaml.DataTemplate BoolOptionalTemplate;
Windows.UI.Xaml.DataTemplate EnumTemplate;
Windows.UI.Xaml.DataTemplate FlagTemplate;
Windows.UI.Xaml.DataTemplate TerminalCoreColorOptionalTemplate;
Windows.UI.Xaml.DataTemplate WindowsUIColorOptionalTemplate;
}
[default_interface] runtimeclass EditAction : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged
{
EditAction();
CommandViewModel ViewModel { get; };
}
runtimeclass NavigateToCommandArgs
{
CommandViewModel Command { get; };
IHostedInWindow WindowRoot { get; };
}
runtimeclass ModifyKeyChordEventArgs
{
Microsoft.Terminal.Control.KeyChord OldKeys { get; };
Microsoft.Terminal.Control.KeyChord NewKeys { get; };
String OldActionName { get; };
String NewActionName { get; };
}
runtimeclass KeyBindingViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
runtimeclass CommandViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
// Settings Model side
String Name;
String ID { get; };
Boolean IsUserAction { get; };
// keybindings
IObservableVector<KeyChordViewModel> KeyChordList { get; };
// action args
ActionArgsViewModel ActionArgsVM { get; };
// View-model specific
String DisplayName { get; };
String FirstKeyChordText { get; };
String DisplayNameAndKeyChordAutomationPropName { get; };
// UI side (command list page)
void Edit_Click();
// UI side (edit command page)
IObservableVector<String> AvailableShortcutActions { get; };
Object ProposedShortcutActionName;
void Delete_Click();
void AddKeybinding_Click();
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateColorSchemeRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateColorSchemeNamesRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateWindowRootRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> FocusContainer;
// UI side (edit command page, automation property names)
String ActionNameTextBoxAutomationPropName { get; };
String ShortcutActionComboBoxAutomationPropName { get; };
String AdditionalArgumentsControlAutomationPropName { get; };
}
runtimeclass ArgWrapper : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
String Name { get; };
String Type { get; };
Microsoft.Terminal.Settings.Model.ArgTypeHint TypeHint { get; };
Boolean Required { get; };
IInspectable Value;
IInspectable EnumValue;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> EnumList { get; };
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.FlagEntry> FlagList { get; };
ColorSchemeViewModel DefaultColorScheme;
Windows.Foundation.Collections.IVector<String> ColorSchemeNamesList;
IHostedInWindow WindowRoot;
// unboxing functions
String UnboxString(Object value);
UInt32 UnboxInt32(Object value);
Single UnboxInt32Optional(Object value);
UInt32 UnboxUInt32(Object value);
Single UnboxUInt32Optional(Object value);
Single UnboxFloat(Object value);
Boolean UnboxBool(Object value);
Windows.Foundation.IReference<Boolean> UnboxBoolOptional(Object value);
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> UnboxTerminalCoreColorOptional(Object value);
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> UnboxWindowsUIColorOptional(Object value);
// bind back functions
void StringBindBack(String newValue);
void Int32BindBack(Double newValue);
void Int32OptionalBindBack(Double newValue);
void UInt32BindBack(Double newValue);
void UInt32OptionalBindBack(Double newValue);
void FloatBindBack(Double newValue);
void BoolOptionalBindBack(Windows.Foundation.IReference<Boolean> newValue);
void TerminalCoreColorBindBack(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> newValue);
void WindowsUIColorBindBack(Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> newValue);
void BrowseForFile_Click(IInspectable sender, Windows.UI.Xaml.RoutedEventArgs args);
void BrowseForFolder_Click(IInspectable sender, Windows.UI.Xaml.RoutedEventArgs args);
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> ColorSchemeRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> ColorSchemeNamesRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> WindowRootRequested;
}
runtimeclass ActionArgsViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
Boolean HasArgs { get; };
IObservableVector<ArgWrapper> ArgValues;
event Windows.Foundation.TypedEventHandler<Object, Object> WrapperValueChanged;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateColorSchemeRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateColorSchemeNamesRequested;
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateWindowRootRequested;
}
runtimeclass KeyChordViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
String KeyChordText { get; };
// UI side
Boolean ShowEditButton { get; };
Boolean IsInEditMode { get; };
Boolean IsNewlyAdded { get; };
Microsoft.Terminal.Control.KeyChord ProposedKeys;
Object ProposedAction;
Windows.UI.Xaml.Controls.Flyout AcceptChangesFlyout;
String EditButtonName { get; };
Boolean IsInEditMode { get; };
void ToggleEditMode();
void AcceptChanges();
void CancelChanges();
void DeleteKeyChord();
String CancelButtonName { get; };
String AcceptButtonName { get; };
String DeleteButtonName { get; };
Windows.UI.Xaml.Media.Brush ContainerBackground { get; };
void EnterHoverMode();
void ExitHoverMode();
void ActionGotFocus();
void ActionLostFocus();
void EditButtonGettingFocus();
void EditButtonLosingFocus();
IObservableVector<String> AvailableActions { get; };
void ToggleEditMode();
void AttemptAcceptChanges();
void CancelChanges();
void DeleteKeyBinding();
event Windows.Foundation.TypedEventHandler<KeyBindingViewModel, ModifyKeyBindingEventArgs> ModifyKeyBindingRequested;
event Windows.Foundation.TypedEventHandler<KeyBindingViewModel, Microsoft.Terminal.Control.KeyChord> DeleteKeyBindingRequested;
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, Microsoft.Terminal.Control.KeyChord> AddKeyChordRequested;
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, ModifyKeyChordEventArgs> ModifyKeyChordRequested;
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, Microsoft.Terminal.Control.KeyChord> DeleteKeyChordRequested;
}
enum ActionsSubPage
{
Base = 0,
Edit = 1
};
runtimeclass ActionsViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
{
ActionsViewModel(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
void UpdateSettings(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
void OnAutomationPeerAttached();
void AddNewKeybinding();
void AddNewCommand();
IObservableVector<KeyBindingViewModel> KeyBindingList { get; };
event Windows.Foundation.TypedEventHandler<Object, Object> FocusContainer;
event Windows.Foundation.TypedEventHandler<Object, Object> UpdateBackground;
ActionsSubPage CurrentPage;
Boolean DisplayBadge { get; };
void AttemptAddOrModifyKeyChord(KeyChordViewModel senderVM, String commandID, Microsoft.Terminal.Control.KeyChord newKeys, Microsoft.Terminal.Control.KeyChord oldKeys);
void DeleteKeyChord(Microsoft.Terminal.Control.KeyChord keys);
void AddCopiedCommand(Microsoft.Terminal.Settings.Model.Command newCommand);
void RegenerateCommandID(Microsoft.Terminal.Settings.Model.Command command);
CommandViewModel CurrentCommand;
IObservableVector<CommandViewModel> CommandList { get; };
void CmdListItemClicked(IInspectable sender, Windows.UI.Xaml.Controls.ItemClickEventArgs args);
}
}

View File

@@ -29,6 +29,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void AddProfile::OnNavigatedTo(const NavigationEventArgs& e)
{
_State = e.Parameter().as<Editor::AddProfilePageNavigationState>();
BringIntoViewWhenLoaded(_State.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -26,8 +26,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
struct AddProfilePageNavigationState : AddProfilePageNavigationStateT<AddProfilePageNavigationState>
{
public:
AddProfilePageNavigationState(const Model::CascadiaSettings& settings) :
_Settings{ settings } {}
AddProfilePageNavigationState(const Model::CascadiaSettings& settings, const hstring& elementToFocus = {}) :
_Settings{ settings },
_ElementToFocus{ elementToFocus } {}
void RequestAddNew()
{
@@ -42,6 +43,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
til::event<AddNewArgs> AddNew;
WINRT_PROPERTY(Model::CascadiaSettings, Settings, nullptr);
WINRT_PROPERTY(hstring, ElementToFocus);
};
struct AddProfile : public HasScrollViewer<AddProfile>, AddProfileT<AddProfile>

View File

@@ -8,6 +8,8 @@ namespace Microsoft.Terminal.Settings.Editor
runtimeclass AddProfilePageNavigationState
{
Microsoft.Terminal.Settings.Model.CascadiaSettings Settings;
String ElementToFocus { get; };
void RequestAddNew();
void RequestDuplicate(Guid profile);
event AddNewArgs AddNew;

View File

@@ -37,7 +37,8 @@
</Button>
</Border>
<StackPanel Margin="{StaticResource StandardControlMargin}">
<local:SettingContainer x:Uid="AddProfile_Duplicate">
<local:SettingContainer x:Name="DuplicateProfile"
x:Uid="AddProfile_Duplicate">
<ComboBox x:Name="Profiles"
AutomationProperties.AccessibilityView="Content"
ItemsSource="{x:Bind State.Settings.AllProfiles, Mode=OneWay}"

View File

@@ -1134,6 +1134,24 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
INITIALIZE_BINDABLE_ENUM_SETTING(IntenseTextStyle, IntenseTextStyle, winrt::Microsoft::Terminal::Settings::Model::IntenseStyle, L"Appearance_IntenseTextStyle", L"Content");
}
void Appearances::BringIntoViewWhenLoaded(hstring elementToFocus)
{
if (elementToFocus.empty())
{
return;
}
_loadedRevoker = this->Loaded(winrt::auto_revoke, [weakThis{ get_weak() }, elementToFocus](auto&&, auto&&) {
if (const auto strongThis = weakThis.get())
{
if (const auto element = strongThis->FindName(elementToFocus))
{
element.as<FrameworkElement>().StartBringIntoView();
}
}
});
}
IObservableVector<Editor::Font> Appearances::FilteredFontList()
{
if (!_filteredFonts)

View File

@@ -188,6 +188,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
struct Appearances : AppearancesT<Appearances>
{
Appearances();
void BringIntoViewWhenLoaded(hstring elementToFocus);
// CursorShape visibility logic
bool IsVintageCursor() const;
@@ -210,6 +211,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
bool IsCustomFontWeight();
til::property_changed_event PropertyChanged;
winrt::Windows::UI::Xaml::FrameworkElement::Loaded_revoker _loadedRevoker;
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Microsoft::Terminal::Settings::Editor::EnumEntry>, FontWeightList);

View File

@@ -72,7 +72,8 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Color Scheme -->
<!-- This currently only display the Dark color scheme, even if the user has a pair of schemes set. -->
<local:SettingContainer x:Uid="Profile_ColorScheme"
<local:SettingContainer x:Name="ColorScheme"
x:Uid="Profile_ColorScheme"
ClearSettingValue="{x:Bind Appearance.ClearColorScheme}"
CurrentValueAccessibleName="{x:Bind Appearance.CurrentColorScheme.Name, Mode=OneWay}"
HasSettingValue="{x:Bind Appearance.HasDarkColorSchemeName, Mode=OneWay}"
@@ -280,17 +281,20 @@
IsChecked="{x:Bind ShowAllFonts, Mode=TwoWay}" />
</StackPanel>
</local:SettingContainer>
<local:SettingContainer x:Uid="Profile_MissingFontFaces"
<local:SettingContainer x:Name="MissingFontFaces"
x:Uid="Profile_MissingFontFaces"
HelpText="{x:Bind Appearance.MissingFontFaces, Mode=OneWay}"
Style="{StaticResource SettingContainerErrorStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Appearance.MissingFontFaces), Mode=OneWay}" />
<local:SettingContainer x:Uid="Profile_ProportionalFontFaces"
<local:SettingContainer x:Name="ProportionalFontFaces"
x:Uid="Profile_ProportionalFontFaces"
HelpText="{x:Bind Appearance.ProportionalFontFaces, Mode=OneWay}"
Style="{StaticResource SettingContainerWarningStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(Appearance.ProportionalFontFaces), Mode=OneWay}" />
<!-- Font Size -->
<local:SettingContainer x:Uid="Profile_FontSize"
<local:SettingContainer x:Name="FontSize"
x:Uid="Profile_FontSize"
ClearSettingValue="{x:Bind Appearance.ClearFontSize}"
HasSettingValue="{x:Bind Appearance.HasFontSize, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontSizeOverrideSource, Mode=OneWay}"
@@ -306,7 +310,8 @@
</local:SettingContainer>
<!-- Line Height -->
<local:SettingContainer x:Uid="Profile_LineHeight"
<local:SettingContainer x:Name="LineHeight"
x:Uid="Profile_LineHeight"
ClearSettingValue="{x:Bind Appearance.ClearLineHeight}"
HasSettingValue="{x:Bind Appearance.HasLineHeight, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.LineHeightOverrideSource, Mode=OneWay}"
@@ -322,7 +327,8 @@
</local:SettingContainer>
<!-- Cell Width -->
<local:SettingContainer x:Uid="Profile_CellWidth"
<local:SettingContainer x:Name="CellWidth"
x:Uid="Profile_CellWidth"
ClearSettingValue="{x:Bind Appearance.ClearCellWidth}"
HasSettingValue="{x:Bind Appearance.HasCellWidth, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.CellWidthOverrideSource, Mode=OneWay}"
@@ -338,7 +344,8 @@
</local:SettingContainer>
<!-- Font Weight -->
<local:SettingContainer x:Uid="Profile_FontWeight"
<local:SettingContainer x:Name="FontWeight"
x:Uid="Profile_FontWeight"
ClearSettingValue="{x:Bind Appearance.ClearFontWeight}"
HasSettingValue="{x:Bind Appearance.HasFontWeight, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontWeightOverrideSource, Mode=OneWay}"
@@ -374,7 +381,8 @@
</Grid>
</StackPanel>
</local:SettingContainer>
<local:SettingContainer x:Uid="Profile_FontAxes"
<local:SettingContainer x:Name="FontAxes"
x:Uid="Profile_FontAxes"
ClearSettingValue="{x:Bind Appearance.ClearFontAxes}"
HasSettingValue="{x:Bind Appearance.HasFontAxes, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontAxesOverrideSource, Mode=OneWay}"
@@ -401,7 +409,8 @@
</muxc:DropDownButton>
</StackPanel>
</local:SettingContainer>
<local:SettingContainer x:Uid="Profile_FontFeatures"
<local:SettingContainer x:Name="FontFeatures"
x:Uid="Profile_FontFeatures"
ClearSettingValue="{x:Bind Appearance.ClearFontFeatures}"
HasSettingValue="{x:Bind Appearance.HasFontFeatures, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.FontFeaturesOverrideSource, Mode=OneWay}"
@@ -430,7 +439,8 @@
</local:SettingContainer>
<!-- Builtin Glyphs -->
<local:SettingContainer x:Uid="Profile_EnableBuiltinGlyphs"
<local:SettingContainer x:Name="EnableBuiltinGlyphs"
x:Uid="Profile_EnableBuiltinGlyphs"
ClearSettingValue="{x:Bind Appearance.ClearEnableBuiltinGlyphs}"
HasSettingValue="{x:Bind Appearance.HasEnableBuiltinGlyphs, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.EnableBuiltinGlyphsOverrideSource, Mode=OneWay}">
@@ -439,7 +449,8 @@
</local:SettingContainer>
<!-- Color Glyphs -->
<local:SettingContainer x:Uid="Profile_EnableColorGlyphs"
<local:SettingContainer x:Name="EnableColorGlyphs"
x:Uid="Profile_EnableColorGlyphs"
ClearSettingValue="{x:Bind Appearance.ClearEnableColorGlyphs}"
HasSettingValue="{x:Bind Appearance.HasEnableColorGlyphs, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.EnableColorGlyphsOverrideSource, Mode=OneWay}">
@@ -448,7 +459,8 @@
</local:SettingContainer>
<!-- Retro Terminal Effect -->
<local:SettingContainer x:Uid="Profile_RetroTerminalEffect"
<local:SettingContainer x:Name="RetroTerminalEffect"
x:Uid="Profile_RetroTerminalEffect"
ClearSettingValue="{x:Bind Appearance.ClearRetroTerminalEffect}"
HasSettingValue="{x:Bind Appearance.HasRetroTerminalEffect, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.RetroTerminalEffectOverrideSource, Mode=OneWay}">
@@ -457,7 +469,8 @@
</local:SettingContainer>
<!-- Adjust Indistinguishable Colors -->
<local:SettingContainer x:Uid="Profile_AdjustIndistinguishableColors"
<local:SettingContainer x:Name="AdjustIndistinguishableColors"
x:Uid="Profile_AdjustIndistinguishableColors"
ClearSettingValue="{x:Bind Appearance.ClearAdjustIndistinguishableColors}"
HasSettingValue="{x:Bind Appearance.HasAdjustIndistinguishableColors, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.AdjustIndistinguishableColorsOverrideSource, Mode=OneWay}">
@@ -475,7 +488,8 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Cursor Shape -->
<local:SettingContainer x:Uid="Profile_CursorShape"
<local:SettingContainer x:Name="CursorShape"
x:Uid="Profile_CursorShape"
ClearSettingValue="{x:Bind Appearance.ClearCursorShape}"
HasSettingValue="{x:Bind Appearance.HasCursorShape, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.CursorShapeOverrideSource, Mode=OneWay}">
@@ -487,7 +501,8 @@
</local:SettingContainer>
<!-- Cursor Height -->
<local:SettingContainer x:Uid="Profile_CursorHeight"
<local:SettingContainer x:Name="CursorHeight"
x:Uid="Profile_CursorHeight"
ClearSettingValue="{x:Bind Appearance.ClearCursorHeight}"
HasSettingValue="{x:Bind Appearance.HasCursorHeight, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.CursorHeightOverrideSource, Mode=OneWay}"
@@ -559,7 +574,8 @@
</local:SettingContainer>
<!-- Background Image Stretch Mode -->
<local:SettingContainer x:Uid="Profile_BackgroundImageStretchMode"
<local:SettingContainer x:Name="BackgroundImageStretchMode"
x:Uid="Profile_BackgroundImageStretchMode"
ClearSettingValue="{x:Bind Appearance.ClearBackgroundImageStretchMode}"
HasSettingValue="{x:Bind Appearance.HasBackgroundImageStretchMode, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.BackgroundImageStretchModeOverrideSource, Mode=OneWay}"
@@ -572,7 +588,8 @@
</local:SettingContainer>
<!-- Background Image Alignment -->
<local:SettingContainer x:Uid="Profile_BackgroundImageAlignment"
<local:SettingContainer x:Name="BackgroundImageAlignment"
x:Uid="Profile_BackgroundImageAlignment"
ClearSettingValue="{x:Bind Appearance.ClearBackgroundImageAlignment}"
CurrentValue="{x:Bind Appearance.BackgroundImageAlignmentCurrentValue, Mode=OneWay}"
HasSettingValue="{x:Bind Appearance.HasBackgroundImageAlignment, Mode=OneWay}"
@@ -760,7 +777,8 @@
</local:SettingContainer>
<!-- Background Image Opacity -->
<local:SettingContainer x:Uid="Profile_BackgroundImageOpacity"
<local:SettingContainer x:Name="BackgroundImageOpacity"
x:Uid="Profile_BackgroundImageOpacity"
ClearSettingValue="{x:Bind Appearance.ClearBackgroundImageOpacity}"
HasSettingValue="{x:Bind Appearance.HasBackgroundImageOpacity, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.BackgroundImageOpacityOverrideSource, Mode=OneWay}"
@@ -786,7 +804,8 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Intense is bold, bright -->
<local:SettingContainer x:Uid="Appearance_IntenseTextStyle"
<local:SettingContainer x:Name="IntenseTextStyle"
x:Uid="Appearance_IntenseTextStyle"
ClearSettingValue="{x:Bind Appearance.ClearIntenseTextStyle}"
HasSettingValue="{x:Bind Appearance.HasIntenseTextStyle, Mode=OneWay}"
SettingOverrideSource="{x:Bind Appearance.IntenseTextStyleOverrideSource, Mode=OneWay}">

View File

@@ -0,0 +1,93 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "ArgsTemplateSelectors.h"
#include "ArgsTemplateSelectors.g.cpp"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
// Method Description:
// - This method is called once command palette decides how to render a filtered command.
// Currently we support two ways to render command, that depend on its palette item type:
// - For TabPalette item we render an icon, a title, and some tab-related indicators like progress bar (as defined by TabItemTemplate)
// - All other items are currently rendered with icon, title and optional key-chord (as defined by GeneralItemTemplate)
// Arguments:
// - item - an instance of filtered command to render
// Return Value:
// - data template to use for rendering
Windows::UI::Xaml::DataTemplate ArgsTemplateSelectors::SelectTemplateCore(const winrt::Windows::Foundation::IInspectable& item, const winrt::Windows::UI::Xaml::DependencyObject& /*container*/)
{
static constexpr std::pair<
std::wstring_view,
til::property<Windows::UI::Xaml::DataTemplate> ArgsTemplateSelectors::*>
lut[] = {
{ L"int32_t", &ArgsTemplateSelectors::Int32Template },
{ L"uint32_t", &ArgsTemplateSelectors::UInt32Template },
{ L"bool", &ArgsTemplateSelectors::BoolTemplate },
{ L"Windows::Foundation::IReference<bool>", &ArgsTemplateSelectors::BoolOptionalTemplate },
{ L"Windows::Foundation::IReference<int32_t>", &ArgsTemplateSelectors::Int32OptionalTemplate },
{ L"Windows::Foundation::IReference<uint32_t>", &ArgsTemplateSelectors::UInt32OptionalTemplate },
{ L"SuggestionsSource", &ArgsTemplateSelectors::FlagTemplate },
{ L"Windows::Foundation::IReference<Control::CopyFormat>", &ArgsTemplateSelectors::FlagTemplate },
{ L"Windows::Foundation::IReference<Microsoft::Terminal::Core::Color>", &ArgsTemplateSelectors::TerminalCoreColorOptionalTemplate },
{ L"Windows::Foundation::IReference<Windows::UI::Color>", &ArgsTemplateSelectors::WindowsUIColorOptionalTemplate },
{ L"Model::ResizeDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"Model::FocusDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"SettingsTarget", &ArgsTemplateSelectors::EnumTemplate },
{ L"MoveTabDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"Microsoft::Terminal::Control::ScrollToMarkDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"CommandPaletteLaunchMode", &ArgsTemplateSelectors::EnumTemplate },
{ L"FindMatchDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"Model::DesktopBehavior", &ArgsTemplateSelectors::EnumTemplate },
{ L"Model::MonitorBehavior", &ArgsTemplateSelectors::EnumTemplate },
{ L"winrt::Microsoft::Terminal::Control::ClearBufferType", &ArgsTemplateSelectors::EnumTemplate },
{ L"SelectOutputDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"Windows::Foundation::IReference<TabSwitcherMode>", &ArgsTemplateSelectors::EnumTemplate },
{ L"Model::SplitDirection", &ArgsTemplateSelectors::EnumTemplate },
{ L"SplitType", &ArgsTemplateSelectors::EnumTemplate },
};
if (const auto argWrapper{ item.try_as<Microsoft::Terminal::Settings::Editor::ArgWrapper>() })
{
const auto argType = argWrapper.Type();
if (argType == L"winrt::hstring")
{
// string has some special cases - check the tag
const auto argTag = argWrapper.TypeHint();
switch (argTag)
{
case Model::ArgTypeHint::ColorScheme:
return ColorSchemeTemplate();
case Model::ArgTypeHint::FilePath:
return FilePickerTemplate();
case Model::ArgTypeHint::FolderPath:
return FolderPickerTemplate();
default:
// no special handling required, just return the normal string template
return StringTemplate();
}
}
else if (argType == L"float")
{
const auto argTag = argWrapper.TypeHint();
switch (argTag)
{
case Model::ArgTypeHint::SplitSize:
return SplitSizeTemplate();
default:
return FloatTemplate();
}
}
for (const auto& [type, member] : lut)
{
if (type == argType)
{
return (this->*member)();
}
}
}
return nullptr;
}
}

View File

@@ -0,0 +1,38 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "ArgsTemplateSelectors.g.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct ArgsTemplateSelectors : ArgsTemplateSelectorsT<ArgsTemplateSelectors>
{
ArgsTemplateSelectors() = default;
Windows::UI::Xaml::DataTemplate SelectTemplateCore(const winrt::Windows::Foundation::IInspectable&, const winrt::Windows::UI::Xaml::DependencyObject& = nullptr);
til::property<winrt::Windows::UI::Xaml::DataTemplate> Int32Template;
til::property<winrt::Windows::UI::Xaml::DataTemplate> Int32OptionalTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> UInt32Template;
til::property<winrt::Windows::UI::Xaml::DataTemplate> UInt32OptionalTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> FloatTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> SplitSizeTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> StringTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> ColorSchemeTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> FilePickerTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> FolderPickerTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> BoolTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> BoolOptionalTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> EnumTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> FlagTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> TerminalCoreColorOptionalTemplate;
til::property<winrt::Windows::UI::Xaml::DataTemplate> WindowsUIColorOptionalTemplate;
};
}
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(ArgsTemplateSelectors);
}

View File

@@ -4,6 +4,7 @@
#include "pch.h"
#include "ColorSchemes.h"
#include "ColorTableEntry.g.cpp"
#include "NavigateToPageArgs.g.h"
#include "ColorSchemes.g.cpp"
#include <LibraryResources.h>
@@ -35,9 +36,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void ColorSchemes::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::ColorSchemesPageViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::ColorSchemesPageViewModel>();
_ViewModel.CurrentPage(ColorSchemesSubPage::Base);
BringIntoViewWhenLoaded(args.ElementToFocus());
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
// Only let this succeed once.
_layoutUpdatedRevoker.revoke();

View File

@@ -37,6 +37,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
WINRT_OBSERVABLE_PROPERTY(ColorSchemesSubPage, CurrentPage, _propertyChangedHandlers, ColorSchemesSubPage::Base);
WINRT_OBSERVABLE_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel>, AllColorSchemes, _propertyChangedHandlers, nullptr);
WINRT_PROPERTY(hstring, ElementToFocus);
private:
Editor::ColorSchemeViewModel _CurrentScheme{ nullptr };

View File

@@ -6,6 +6,7 @@
#include "EnumEntry.h"
#include "Compatibility.g.cpp"
#include "CompatibilityViewModel.g.cpp"
#include "NavigateToPageArgs.g.h"
using namespace winrt::Windows::UI::Xaml::Navigation;
using namespace winrt::Microsoft::Terminal::Settings::Model;
@@ -54,7 +55,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Compatibility::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::CompatibilityViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::CompatibilityViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -26,13 +26,15 @@
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Allow Headless -->
<local:SettingContainer x:Uid="Globals_AllowHeadless">
<local:SettingContainer x:Name="AllowHeadless"
x:Uid="Globals_AllowHeadless">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Text Measurement -->
<local:SettingContainer x:Uid="Globals_TextMeasurement">
<local:SettingContainer x:Name="TextMeasurement"
x:Uid="Globals_TextMeasurement">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
@@ -41,14 +43,16 @@
</local:SettingContainer>
<!-- Debug Features -->
<local:SettingContainer x:Uid="Globals_DebugFeaturesEnabled"
<local:SettingContainer x:Name="DebugFeaturesEnabled"
x:Uid="Globals_DebugFeaturesEnabled"
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Reset Application State -->
<local:SettingContainer x:Uid="Settings_ResetApplicationState">
<local:SettingContainer x:Name="ResetApplicationState"
x:Uid="Settings_ResetApplicationState">
<Button x:Uid="Settings_ResetApplicationStateButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
@@ -69,7 +73,8 @@
</local:SettingContainer>
<!-- Reset to Default Settings -->
<local:SettingContainer x:Uid="Settings_ResetToDefaultSettings">
<local:SettingContainer x:Name="ResetToDefaultSettings"
x:Uid="Settings_ResetToDefaultSettings">
<Button x:Uid="Settings_ResetToDefaultSettingsButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>

View File

@@ -0,0 +1,53 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "EditAction.h"
#include "EditAction.g.cpp"
#include "LibraryResources.h"
#include "../TerminalSettingsModel/AllShortcutActions.h"
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Navigation;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
EditAction::EditAction()
{
}
void EditAction::OnNavigatedTo(const NavigationEventArgs& e)
{
const auto args = e.Parameter().as<Editor::NavigateToCommandArgs>();
_ViewModel = args.Command();
_propagateWindowRootRevoker = _ViewModel.PropagateWindowRootRequested(
winrt::auto_revoke,
[windowRoot = args.WindowRoot()](const IInspectable&, const Editor::ArgWrapper& wrapper) {
if (wrapper)
{
wrapper.WindowRoot(windowRoot);
}
});
auto weakThis = get_weak();
_focusContainerRevoker = _ViewModel.FocusContainer(
winrt::auto_revoke,
[weakThis](const auto&, const auto& args) {
if (auto page{ weakThis.get() })
{
if (auto kcVM{ args.try_as<KeyChordViewModel>() })
{
if (const auto& container = page->KeyChordListView().ContainerFromItem(*kcVM))
{
container.as<Controls::ListViewItem>().Focus(FocusState::Programmatic);
}
}
}
});
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
// Only let this succeed once.
_layoutUpdatedRevoker.revoke();
CommandNameTextBox().Focus(FocusState::Programmatic);
});
}
}

View File

@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "EditAction.g.h"
#include "ActionsViewModel.h"
#include "Utils.h"
#include "ViewModelHelpers.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct EditAction : public HasScrollViewer<EditAction>, EditActionT<EditAction>
{
public:
EditAction();
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(Editor::CommandViewModel, ViewModel, PropertyChanged.raise, nullptr);
private:
friend struct EditActionT<EditAction>; // for Xaml to bind events
winrt::Windows::UI::Xaml::FrameworkElement::LayoutUpdated_revoker _layoutUpdatedRevoker;
Editor::CommandViewModel::PropagateWindowRootRequested_revoker _propagateWindowRootRevoker;
Editor::CommandViewModel::FocusContainer_revoker _focusContainerRevoker;
};
}
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(EditAction);
}

View File

@@ -0,0 +1,740 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<Page x:Class="Microsoft.Terminal.Settings.Editor.EditAction"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mtu="using:Microsoft.Terminal.UI"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
mc:Ignorable="d">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Theme Dictionary -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<!-- Override visual states -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- Define the appearance of the button -->
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightAccentRevealBackgroundBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<!-- Override visual states -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- Define the appearance of the button -->
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightAccentRevealBackgroundBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<GridLength x:Key="ArgumentNameWidth">148</GridLength>
<!-- Styles -->
<Style x:Key="KeyBindingContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="4" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
</Style>
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<x:Int32 x:Key="EditButtonSize">32</x:Int32>
<x:Double x:Key="EditButtonIconSize">14</x:Double>
<Style x:Key="EditButtonStyle"
BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="AccentEditButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
<Setter Property="Padding" Value="4" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<!-- Templates -->
<DataTemplate x:Key="KeyChordTemplate"
x:DataType="local:KeyChordViewModel">
<ListViewItem IsTabStop="False"
Style="{StaticResource KeyBindingContainerStyle}">
<Grid Padding="2,0,2,0"
VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Click="{x:Bind ToggleEditMode}"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}">
<TextBlock FontSize="14"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind KeyChordText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</Button>
<Grid Grid.Column="0"
ColumnSpacing="8"
Visibility="{x:Bind IsInEditMode, Mode=OneWay}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Edit Mode: Key Chord Listener -->
<local:KeyChordListener Grid.Column="0"
Keys="{x:Bind ProposedKeys, Mode=TwoWay}"
Style="{StaticResource KeyChordEditorStyle}" />
<!-- Cancel editing the action -->
<Button x:Uid="Actions_CancelButton"
Grid.Column="1"
AutomationProperties.Name="{x:Bind CancelButtonName}"
Click="{x:Bind CancelChanges}"
Style="{StaticResource EditButtonStyle}">
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE711;" />
</Button>
<!-- Accept changes -->
<Button x:Uid="Actions_AcceptButton"
Grid.Column="2"
AutomationProperties.Name="{x:Bind AcceptButtonName}"
Click="{x:Bind AcceptChanges}"
Flyout="{x:Bind AcceptChangesFlyout, Mode=OneWay}"
Style="{StaticResource AccentEditButtonStyle}">
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE8FB;" />
</Button>
</Grid>
<Button Grid.Column="1"
Margin="8,0,0,0"
AutomationProperties.Name="{x:Bind DeleteButtonName}"
Style="{StaticResource DeleteSmallButtonStyle}">
<Button.Content>
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE74D;" />
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Actions_DeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Actions_DeleteConfirmationButton"
Click="{x:Bind DeleteKeyChord}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</ListViewItem>
</DataTemplate>
<!-- Example shortcut action to test this template: Adjust Opacity -->
<!-- Currently that is the only Int32 arg, so just clamp the min/max values according to that -->
<DataTemplate x:Key="Int32Template"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="100"
Minimum="0"
SmallChange="10"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32(Value), Mode=TwoWay, BindBack=Int32BindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Switch To Tab -->
<DataTemplate x:Key="UInt32Template"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
Minimum="0"
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32(Value), Mode=TwoWay, BindBack=UInt32BindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Close Other Tabs -->
<DataTemplate x:Key="UInt32OptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
Minimum="0"
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32Optional(Value), Mode=TwoWay, BindBack=UInt32OptionalBindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="Int32OptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
Minimum="0"
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32Optional(Value), Mode=TwoWay, BindBack=Int32OptionalBindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Adjust Font Size -->
<DataTemplate x:Key="FloatTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
Minimum="-999"
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="SplitSizeTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="0.2"
Maximum="1"
Minimum="0"
SmallChange="0.1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Send Input -->
<DataTemplate x:Key="StringTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto"
MinWidth="196" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Color Scheme -->
<DataTemplate x:Key="ColorSchemeTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ComboBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Export Buffer -->
<DataTemplate x:Key="FilePickerTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="2"
Click="{x:Bind BrowseForFile_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: New Tab -->
<DataTemplate x:Key="FolderPickerTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="2"
Click="{x:Bind BrowseForFolder_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Focus Mode -->
<DataTemplate x:Key="BoolTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ToggleSwitch Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
IsOn="{x:Bind UnboxBool(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="BoolOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<CheckBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
IsChecked="{x:Bind UnboxBoolOptional(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}"
IsThreeState="True" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Resize Pane -->
<DataTemplate x:Key="EnumComboBoxTemplate"
x:DataType="local:EnumEntry">
<TextBlock Text="{x:Bind EnumName, Mode=OneWay}" />
</DataTemplate>
<DataTemplate x:Key="EnumTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ComboBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Copy Text -->
<DataTemplate x:Key="FlagItemTemplate"
x:DataType="local:FlagEntry">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Grid.Column="0"
AutomationProperties.Name="{x:Bind FlagName}"
IsChecked="{x:Bind IsSet, Mode=TwoWay}" />
<TextBlock Grid.Column="1"
Padding="0,0,0,4"
VerticalAlignment="Center"
Text="{x:Bind FlagName, Mode=OneWay}" />
</Grid>
</DataTemplate>
<DataTemplate x:Key="FlagTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ItemsControl Grid.Column="1"
Margin="0"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource FlagItemTemplate}"
ItemsSource="{x:Bind FlagList, Mode=OneWay}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Add Mark -->
<DataTemplate x:Key="TerminalCoreColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<local:NullableColorPicker x:Uid="Actions_NullableColorPicker"
Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ColorSchemeVM="{x:Bind DefaultColorScheme, Mode=OneWay}"
CurrentColor="{x:Bind UnboxTerminalCoreColorOptional(Value), Mode=TwoWay, BindBack=TerminalCoreColorBindBack}"
NullColorPreview="{x:Bind DefaultColorScheme.ForegroundColor.Color, Mode=OneWay}" />
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Tab Color -->
<DataTemplate x:Key="WindowsUIColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<local:NullableColorPicker x:Uid="Actions_NullableColorPicker"
Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ColorSchemeVM="{x:Bind DefaultColorScheme, Mode=OneWay}"
CurrentColor="{x:Bind UnboxWindowsUIColorOptional(Value), Mode=TwoWay, BindBack=WindowsUIColorBindBack}"
NullColorPreview="{x:Bind DefaultColorScheme.ForegroundColor.Color, Mode=OneWay}" />
</Grid>
</DataTemplate>
<local:ArgsTemplateSelectors x:Key="ArgsTemplateSelector"
BoolOptionalTemplate="{StaticResource BoolOptionalTemplate}"
BoolTemplate="{StaticResource BoolTemplate}"
ColorSchemeTemplate="{StaticResource ColorSchemeTemplate}"
EnumTemplate="{StaticResource EnumTemplate}"
FilePickerTemplate="{StaticResource FilePickerTemplate}"
FlagTemplate="{StaticResource FlagTemplate}"
FloatTemplate="{StaticResource FloatTemplate}"
FolderPickerTemplate="{StaticResource FolderPickerTemplate}"
Int32OptionalTemplate="{StaticResource Int32OptionalTemplate}"
Int32Template="{StaticResource Int32Template}"
SplitSizeTemplate="{StaticResource SplitSizeTemplate}"
StringTemplate="{StaticResource StringTemplate}"
TerminalCoreColorOptionalTemplate="{StaticResource TerminalCoreColorOptionalTemplate}"
UInt32OptionalTemplate="{StaticResource UInt32OptionalTemplate}"
UInt32Template="{StaticResource UInt32Template}"
WindowsUIColorOptionalTemplate="{StaticResource WindowsUIColorOptionalTemplate}" />
</ResourceDictionary>
</Page.Resources>
<Border MaxWidth="{StaticResource StandardControlMaxWidth}"
Margin="{StaticResource SettingStackMargin}">
<Grid MaxWidth="600"
Margin="{StaticResource SettingStackMargin}"
HorizontalAlignment="Left"
ColumnSpacing="16"
RowSpacing="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock x:Uid="Actions_Name"
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center" />
<TextBox x:Name="CommandNameTextBox"
Grid.Row="0"
Grid.Column="1"
Width="300"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind ViewModel.ActionNameTextBoxAutomationPropName}"
PlaceholderText="{x:Bind ViewModel.DisplayName, Mode=OneWay}"
Text="{x:Bind ViewModel.Name, Mode=TwoWay}" />
<TextBlock x:Uid="Actions_ShortcutAction"
Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center" />
<ComboBox Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
AutomationProperties.Name="{x:Bind ViewModel.ShortcutActionComboBoxAutomationPropName}"
ItemsSource="{x:Bind ViewModel.AvailableShortcutActions, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.ProposedShortcutActionName, Mode=TwoWay}" />
<TextBlock x:Uid="Actions_Arguments"
Grid.Row="2"
Grid.Column="0"
VerticalAlignment="Center"
Visibility="{x:Bind ViewModel.ActionArgsVM.HasArgs, Mode=OneWay}" />
<ItemsControl Grid.Row="2"
Grid.Column="1"
AutomationProperties.Name="{x:Bind ViewModel.AdditionalArgumentsControlAutomationPropName}"
IsTabStop="False"
ItemTemplateSelector="{StaticResource ArgsTemplateSelector}"
ItemsSource="{x:Bind ViewModel.ActionArgsVM.ArgValues, Mode=OneWay}" />
<TextBlock x:Uid="Actions_Keybindings"
Grid.Row="3"
Grid.Column="0"
VerticalAlignment="Center" />
<ListView x:Name="KeyChordListView"
x:Uid="Actions_KeyBindingsListView"
Grid.Row="3"
Grid.Column="1"
ItemTemplate="{StaticResource KeyChordTemplate}"
ItemsSource="{x:Bind ViewModel.KeyChordList, Mode=OneWay}"
SelectionMode="None">
<ListView.Header>
<Button Click="{x:Bind ViewModel.AddKeybinding_Click}">
<TextBlock x:Uid="Actions_AddKeyChord" />
</Button>
</ListView.Header>
</ListView>
<Button Grid.Row="4"
Grid.Column="0"
IsEnabled="{x:Bind ViewModel.IsUserAction, Mode=OneWay}"
Style="{StaticResource DeleteButtonStyle}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
<TextBlock x:Uid="Actions_DeleteButton2"
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Actions_CommandDeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Actions_CommandDeleteConfirmationButton"
Click="{x:Bind ViewModel.Delete_Click}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</Border>
</Page>

View File

@@ -4,6 +4,7 @@
#include "pch.h"
#include "EditColorScheme.h"
#include "EditColorScheme.g.cpp"
#include "NavigateToPageArgs.g.h"
#include <LibraryResources.h>
@@ -40,7 +41,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void EditColorScheme::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::ColorSchemeViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::ColorSchemeViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
const auto schemeName = _ViewModel.Name();
NameBox().Text(schemeName);

View File

@@ -5,6 +5,12 @@ import "ColorSchemeViewModel.idl";
namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass NavigateToEditColorSchemeArgs
{
ColorSchemeViewModel ViewModel { get; };
String ElementToFocus { get; };
}
[default_interface] runtimeclass EditColorScheme : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged
{
EditColorScheme();

View File

@@ -200,7 +200,8 @@
</Grid>
</Border>
<local:SettingContainer x:Uid="ColorScheme_InboxSchemeDuplicate"
<local:SettingContainer x:Name="InboxSchemeDuplicate"
x:Uid="ColorScheme_InboxSchemeDuplicate"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(ViewModel.IsEditable), Mode=OneWay}">
<Button x:Name="DuplicateSchemeButton"
x:Uid="ColorScheme_DuplicateButton"
@@ -208,7 +209,8 @@
Style="{StaticResource BrowseButtonStyle}" />
</local:SettingContainer>
<local:SettingContainer x:Uid="ColorScheme_ColorsHeader"
<local:SettingContainer x:Name="ColorsHeader"
x:Uid="ColorScheme_ColorsHeader"
StartExpanded="True"
Style="{StaticResource ExpanderSettingContainerStyle}"
Visibility="{x:Bind ViewModel.IsEditable, Mode=OneWay}">

View File

@@ -17,6 +17,7 @@ Author(s):
#pragma once
#include "EnumEntry.g.h"
#include "FlagEntry.g.h"
#include "Utils.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
@@ -26,7 +27,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
bool operator()(const Editor::EnumEntry& lhs, const Editor::EnumEntry& rhs) const
{
return lhs.EnumValue().as<T>() < rhs.EnumValue().as<T>();
return lhs.IntValue() < rhs.IntValue();
}
};
@@ -35,7 +36,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
bool operator()(const Editor::EnumEntry& lhs, const Editor::EnumEntry& rhs) const
{
return lhs.EnumValue().as<T>() > rhs.EnumValue().as<T>();
return lhs.IntValue() > rhs.IntValue();
}
};
@@ -46,6 +47,11 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_EnumName{ enumName },
_EnumValue{ enumValue } {}
EnumEntry(const winrt::hstring enumName, const winrt::Windows::Foundation::IInspectable& enumValue, const int32_t intValue) :
_EnumName{ enumName },
_EnumValue{ enumValue },
_IntValue{ intValue } {}
hstring ToString()
{
return EnumName();
@@ -54,5 +60,50 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, EnumName, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::Foundation::IInspectable, EnumValue, PropertyChanged.raise);
WINRT_PROPERTY(int32_t, IntValue, 0);
};
template<typename T>
struct FlagEntryComparator
{
bool operator()(const Editor::FlagEntry& lhs, const Editor::FlagEntry& rhs) const
{
return lhs.FlagValue().as<T>() < rhs.FlagValue().as<T>();
}
};
template<typename T>
struct FlagEntryReverseComparator
{
bool operator()(const Editor::FlagEntry& lhs, const Editor::FlagEntry& rhs) const
{
return lhs.FlagValue().as<T>() > rhs.FlagValue().as<T>();
}
};
struct FlagEntry : FlagEntryT<FlagEntry>
{
public:
FlagEntry(const winrt::hstring flagName, const winrt::Windows::Foundation::IInspectable& flagValue, const bool isSet) :
_FlagName{ flagName },
_FlagValue{ flagValue },
_IsSet{ isSet } {}
FlagEntry(const winrt::hstring flagName, const winrt::Windows::Foundation::IInspectable& flagValue, const bool isSet, const int32_t intValue) :
_FlagName{ flagName },
_FlagValue{ flagValue },
_IsSet{ isSet },
_IntValue{ intValue } {}
hstring ToString()
{
return FlagName();
}
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, FlagName, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::Foundation::IInspectable, FlagValue, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsSet, PropertyChanged.raise);
WINRT_PROPERTY(int32_t, IntValue, 0);
};
}

View File

@@ -7,5 +7,14 @@ namespace Microsoft.Terminal.Settings.Editor
{
String EnumName { get; };
IInspectable EnumValue { get; };
Int32 IntValue { get; };
}
[default_interface] runtimeclass FlagEntry : Windows.UI.Xaml.Data.INotifyPropertyChanged, Windows.Foundation.IStringable
{
String FlagName { get; };
IInspectable FlagValue { get; };
Int32 IntValue { get; };
Boolean IsSet;
}
}

View File

@@ -3,6 +3,7 @@
#include "pch.h"
#include "Extensions.h"
#include "NavigateToPageArgs.g.h"
#include "Extensions.g.cpp"
#include "ExtensionPackageViewModel.g.cpp"
#include "ExtensionsViewModel.g.cpp"
@@ -34,12 +35,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Extensions::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::ExtensionsViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::ExtensionsViewModel>();
auto vmImpl = get_self<ExtensionsViewModel>(_ViewModel);
vmImpl->ExtensionPackageIdentifierTemplateSelector(_extensionPackageIdentifierTemplateSelector);
vmImpl->LazyLoadExtensions();
vmImpl->MarkAsVisited();
BringIntoViewWhenLoaded(args.ElementToFocus());
if (vmImpl->IsExtensionView())
{
const auto currentPkgVM = vmImpl->CurrentExtensionPackage();

View File

@@ -500,7 +500,8 @@
<muxc:Expander.Content>
<StackPanel>
<!-- Scope -->
<local:SettingContainer x:Uid="Extensions_Scope"
<local:SettingContainer x:Name="Scope"
x:Uid="Extensions_Scope"
Content="{x:Bind ViewModel.CurrentExtensionPackage.Scope, Mode=OneWay}"
IsTabStop="False"
Style="{StaticResource SettingContainerWithTextContent}" />

View File

@@ -3,6 +3,7 @@
#include "pch.h"
#include "GlobalAppearance.h"
#include "NavigateToPageArgs.g.h"
#include "GlobalAppearance.g.cpp"
#include <LibraryResources.h>
@@ -24,7 +25,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void GlobalAppearance::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::GlobalAppearanceViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::GlobalAppearanceViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -5,7 +5,7 @@ import "GlobalAppearanceViewModel.idl";
namespace Microsoft.Terminal.Settings.Editor
{
[default_interface] runtimeclass GlobalAppearance : Windows.UI.Xaml.Controls.Page
runtimeclass GlobalAppearance : Windows.UI.Xaml.Controls.Page
{
GlobalAppearance();
GlobalAppearanceViewModel ViewModel { get; };

View File

@@ -28,7 +28,8 @@
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Theme -->
<local:SettingContainer x:Uid="Globals_Theme">
<local:SettingContainer x:Name="Theme"
x:Uid="Globals_Theme">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemsSource="{x:Bind ViewModel.ThemeList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentTheme, Mode=TwoWay}"
@@ -42,7 +43,8 @@
</local:SettingContainer>
<!-- Position of new tab -->
<local:SettingContainer x:Uid="Globals_NewTabPosition">
<local:SettingContainer x:Name="NewTabPosition"
x:Uid="Globals_NewTabPosition">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.NewTabPositionList, Mode=OneWay}"
@@ -51,45 +53,52 @@
</local:SettingContainer>
<!-- Show Titlebar -->
<local:SettingContainer x:Uid="Globals_ShowTitlebar">
<local:SettingContainer x:Name="ShowTitlebar"
x:Uid="Globals_ShowTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}"
Toggled="{x:Bind ViewModel.ShowTitlebarToggled}" />
</local:SettingContainer>
<!-- Always show tabs -->
<local:SettingContainer x:Uid="Globals_AlwaysShowTabs">
<local:SettingContainer x:Name="AlwaysShowTabs"
x:Uid="Globals_AlwaysShowTabs">
<ToggleSwitch IsEnabled="{x:Bind mtu:Converters.InvertBoolean(ViewModel.ShowTabsInTitlebar), Mode=OneWay}"
IsOn="{x:Bind ViewModel.AlwaysShowTabs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show tabs in full screen -->
<local:SettingContainer x:Uid="Globals_ShowTabsFullscreen">
<local:SettingContainer x:Name="ShowTabsFullscreen"
x:Uid="Globals_ShowTabsFullscreen">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsFullscreen, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Acrylic in Tab Row -->
<local:SettingContainer x:Uid="Globals_AcrylicTabRow">
<local:SettingContainer x:Name="AcrylicTabRow"
x:Uid="Globals_AcrylicTabRow">
<ToggleSwitch IsOn="{x:Bind ViewModel.UseAcrylicInTabRow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Title in Titlebar -->
<local:SettingContainer x:Uid="Globals_ShowTitleInTitlebar">
<local:SettingContainer x:Name="ShowTitleInTitlebar"
x:Uid="Globals_ShowTitleInTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTitleInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Always on Top -->
<local:SettingContainer x:Uid="Globals_AlwaysOnTop">
<local:SettingContainer x:Name="AlwaysOnTop"
x:Uid="Globals_AlwaysOnTop">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysOnTop, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Tab Width Mode -->
<local:SettingContainer x:Uid="Globals_TabWidthMode">
<local:SettingContainer x:Name="TabWidthMode"
x:Uid="Globals_TabWidthMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabWidthModeList, Mode=OneWay}"
@@ -99,37 +108,43 @@
<!-- Disable Animations -->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<local:SettingContainer x:Uid="Globals_DisableAnimationsReversed">
<local:SettingContainer x:Name="DisableAnimations"
x:Uid="Globals_DisableAnimationsReversed">
<ToggleSwitch IsOn="{x:Bind ViewModel.InvertedDisableAnimations, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Always Show Notification Icon -->
<local:SettingContainer x:Uid="Globals_AlwaysShowNotificationIcon">
<local:SettingContainer x:Name="AlwaysShowNotificationIcon"
x:Uid="Globals_AlwaysShowNotificationIcon">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysShowNotificationIcon, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Minimize To Notification Area -->
<local:SettingContainer x:Uid="Globals_MinimizeToNotificationArea">
<local:SettingContainer x:Name="MinimizeToNotificationArea"
x:Uid="Globals_MinimizeToNotificationArea">
<ToggleSwitch IsOn="{x:Bind ViewModel.MinimizeToNotificationArea, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Automatically hide window -->
<local:SettingContainer x:Uid="Globals_AutoHideWindow">
<local:SettingContainer x:Name="AutoHideWindow"
x:Uid="Globals_AutoHideWindow">
<ToggleSwitch IsOn="{x:Bind ViewModel.AutoHideWindow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Admin Shield -->
<local:SettingContainer x:Uid="Globals_ShowAdminShield">
<local:SettingContainer x:Name="ShowAdminShield"
x:Uid="Globals_ShowAdminShield">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAdminShield, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Unfocused Acrylic -->
<local:SettingContainer x:Uid="Globals_EnableUnfocusedAcrylic">
<local:SettingContainer x:Name="EnableUnfocusedAcrylic"
x:Uid="Globals_EnableUnfocusedAcrylic">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableUnfocusedAcrylic, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

View File

@@ -4,6 +4,7 @@
#include "pch.h"
#include "Interaction.h"
#include "Interaction.g.cpp"
#include "NavigateToPageArgs.g.h"
#include "EnumEntry.h"
@@ -21,7 +22,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Interaction::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::InteractionViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::InteractionViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -27,13 +27,15 @@
<StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Copy On Select -->
<local:SettingContainer x:Uid="Globals_CopyOnSelect">
<local:SettingContainer x:Name="CopyOnSelect"
x:Uid="Globals_CopyOnSelect">
<ToggleSwitch IsOn="{x:Bind ViewModel.CopyOnSelect, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Copy Format -->
<local:SettingContainer x:Uid="Globals_CopyFormat">
<local:SettingContainer x:Name="CopyFormat"
x:Uid="Globals_CopyFormat">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.CopyFormatList, Mode=OneWay}"
@@ -42,19 +44,22 @@
</local:SettingContainer>
<!-- Trim Block Selection -->
<local:SettingContainer x:Uid="Globals_TrimBlockSelection">
<local:SettingContainer x:Name="TrimBlockSelection"
x:Uid="Globals_TrimBlockSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimBlockSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Trim Paste -->
<local:SettingContainer x:Uid="Globals_TrimPaste">
<local:SettingContainer x:Name="TrimPaste"
x:Uid="Globals_TrimPaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimPaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Word Delimiters -->
<local:SettingContainer x:Uid="Globals_WordDelimiters"
<local:SettingContainer x:Name="WordDelimiters"
x:Uid="Globals_WordDelimiters"
CurrentValue="{x:Bind ViewModel.WordDelimiters, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
@@ -63,13 +68,15 @@
</local:SettingContainer>
<!-- Snap On Resize -->
<local:SettingContainer x:Uid="Globals_SnapToGridOnResize">
<local:SettingContainer x:Name="SnapToGridOnResize"
x:Uid="Globals_SnapToGridOnResize">
<ToggleSwitch IsOn="{x:Bind ViewModel.SnapToGridOnResize, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Tab Switcher Mode -->
<local:SettingContainer x:Uid="Globals_TabSwitcherMode">
<local:SettingContainer x:Name="TabSwitcherMode"
x:Uid="Globals_TabSwitcherMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabSwitcherModeList}"
@@ -78,31 +85,36 @@
</local:SettingContainer>
<!-- Focus Follow Mouse Mode -->
<local:SettingContainer x:Uid="Globals_FocusFollowMouse">
<local:SettingContainer x:Name="FocusFollowMouse"
x:Uid="Globals_FocusFollowMouse">
<ToggleSwitch IsOn="{x:Bind ViewModel.FocusFollowMouse, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Font Size Changes with Scrolling -->
<local:SettingContainer x:Uid="Globals_ScrollToZoom">
<local:SettingContainer x:Name="ScrollToZoom"
x:Uid="Globals_ScrollToZoom">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToZoom, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Window Opacity Changes with Scrolling -->
<local:SettingContainer x:Uid="Globals_ScrollToChangeOpacity">
<local:SettingContainer x:Name="ScrollToChangeOpacity"
x:Uid="Globals_ScrollToChangeOpacity">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToChangeOpacity, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Detect URLs -->
<local:SettingContainer x:Uid="Globals_DetectURLs">
<local:SettingContainer x:Name="DetectURLs"
x:Uid="Globals_DetectURLs">
<ToggleSwitch IsOn="{x:Bind ViewModel.DetectURLs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Search Web Default Query URL -->
<local:SettingContainer x:Uid="Globals_SearchWebDefaultQueryUrl"
<local:SettingContainer x:Name="SearchWebDefaultQueryUrl"
x:Uid="Globals_SearchWebDefaultQueryUrl"
CurrentValue="{x:Bind ViewModel.SearchWebDefaultQueryUrl, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
@@ -111,7 +123,8 @@
</local:SettingContainer>
<!-- Enable Color Selection -->
<local:SettingContainer x:Uid="Globals_EnableColorSelection">
<local:SettingContainer x:Name="EnableColorSelection"
x:Uid="Globals_EnableColorSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableColorSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
@@ -123,25 +136,29 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Close All Tabs Warning -->
<local:SettingContainer x:Uid="Globals_ConfirmCloseAllTabs">
<local:SettingContainer x:Name="ConfirmCloseAllTabs"
x:Uid="Globals_ConfirmCloseAllTabs">
<ToggleSwitch IsOn="{x:Bind ViewModel.ConfirmCloseAllTabs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Input Service Warning -->
<local:SettingContainer x:Uid="Globals_InputServiceWarning">
<local:SettingContainer x:Name="InputServiceWarning"
x:Uid="Globals_InputServiceWarning">
<ToggleSwitch IsOn="{x:Bind ViewModel.InputServiceWarning, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Large Paste Warning -->
<local:SettingContainer x:Uid="Globals_WarnAboutLargePaste">
<local:SettingContainer x:Name="WarnAboutLargePaste"
x:Uid="Globals_WarnAboutLargePaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.WarnAboutLargePaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Multi Line Paste Warning -->
<local:SettingContainer x:Uid="Globals_WarnAboutMultiLinePaste">
<local:SettingContainer x:Name="WarnAboutMultiLinePaste"
x:Uid="Globals_WarnAboutMultiLinePaste">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind WarnAboutMultiLinePasteList}"

View File

@@ -40,7 +40,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Launch::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::LaunchViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::LaunchViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
auto innerViewModel{ winrt::get_self<Editor::implementation::LaunchViewModel>(_ViewModel) };
/* coroutine dispatch */ innerViewModel->PrepareStartOnUserLoginSettings();

View File

@@ -44,9 +44,9 @@
<StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Default Profile -->
<local:SettingContainer x:Uid="Globals_DefaultProfile">
<ComboBox x:Name="DefaultProfile"
ItemsSource="{x:Bind ViewModel.DefaultProfiles}"
<local:SettingContainer x:Name="DefaultProfile"
x:Uid="Globals_DefaultProfile">
<ComboBox ItemsSource="{x:Bind ViewModel.DefaultProfiles}"
SelectedItem="{x:Bind ViewModel.CurrentDefaultProfile, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
@@ -141,7 +141,8 @@
</local:SettingContainer>
<!-- Language -->
<local:SettingContainer x:Uid="Globals_Language">
<local:SettingContainer x:Name="Language"
x:Uid="Globals_Language">
<ComboBox ItemsSource="{x:Bind ViewModel.LanguageList}"
SelectedItem="{x:Bind ViewModel.CurrentLanguage, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
@@ -154,7 +155,8 @@
</local:SettingContainer>
<!-- Language -->
<local:SettingContainer x:Uid="Globals_DefaultInputScope">
<local:SettingContainer x:Name="DefaultInputScope"
x:Uid="Globals_DefaultInputScope">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.DefaultInputScopeList}"
@@ -163,7 +165,8 @@
</local:SettingContainer>
<!-- Start on User Login -->
<local:SettingContainer x:Uid="Globals_StartOnUserLogin"
<local:SettingContainer x:Name="StartOnUserLogin"
x:Uid="Globals_StartOnUserLogin"
HelpText="{x:Bind ViewModel.StartOnUserLoginStatefulHelpText, Mode=OneWay}"
Visibility="{x:Bind ViewModel.StartOnUserLoginAvailable, Mode=OneTime}">
<ToggleSwitch IsEnabled="{x:Bind ViewModel.StartOnUserLoginConfigurable, Mode=OneWay}"
@@ -172,7 +175,8 @@
</local:SettingContainer>
<!-- First Window Behavior -->
<local:SettingContainer x:Uid="Globals_FirstWindowPreference">
<local:SettingContainer x:Name="FirstWindowPreference"
x:Uid="Globals_FirstWindowPreference">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.FirstWindowPreferenceList}"
@@ -181,7 +185,8 @@
</local:SettingContainer>
<!-- Windowing Behavior -->
<local:SettingContainer x:Uid="Globals_WindowingBehavior">
<local:SettingContainer x:Name="WindowingBehavior"
x:Uid="Globals_WindowingBehavior">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.WindowingBehaviorList}"
@@ -190,7 +195,8 @@
</local:SettingContainer>
<!-- Launch Size -->
<local:SettingContainer x:Uid="Globals_LaunchSize"
<local:SettingContainer x:Name="LaunchSize"
x:Uid="Globals_LaunchSize"
CurrentValue="{x:Bind ViewModel.LaunchSizeCurrentValue, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<Grid ColumnSpacing="12"
@@ -233,7 +239,8 @@
</local:SettingContainer>
<!-- Launch Parameters -->
<local:SettingContainer x:Uid="Globals_LaunchParameters"
<local:SettingContainer x:Name="LaunchParameters"
x:Uid="Globals_LaunchParameters"
CurrentValue="{x:Bind ViewModel.LaunchParametersCurrentValue, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<Grid RowSpacing="8">

File diff suppressed because it is too large Load Diff

View File

@@ -5,10 +5,18 @@
#include "MainPage.g.h"
#include "Breadcrumb.g.h"
#include "NavigateToPageArgs.g.h"
#include "FilteredSearchResult.g.h"
#include "Utils.h"
#include "GeneratedSettingsIndex.g.h"
#include <til/generational.h>
class ScopedResourceLoader;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
const ScopedResourceLoader& EnglishOnlyResourceLoader() noexcept;
struct Breadcrumb : BreadcrumbT<Breadcrumb>
{
Breadcrumb(IInspectable tag, winrt::hstring label, BreadcrumbSubPage subPage) :
@@ -23,6 +31,54 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
WINRT_PROPERTY(BreadcrumbSubPage, SubPage);
};
struct NavigateToPageArgs : NavigateToPageArgsT<NavigateToPageArgs>
{
public:
NavigateToPageArgs(Windows::Foundation::IInspectable viewModel, Editor::IHostedInWindow windowRoot, const hstring& elementToFocus = {}) :
_ViewModel(viewModel),
_WindowRoot(windowRoot),
_ElementToFocus(elementToFocus) {}
Editor::IHostedInWindow WindowRoot() const noexcept { return _WindowRoot; }
Windows::Foundation::IInspectable ViewModel() const noexcept { return _ViewModel; }
hstring ElementToFocus() const noexcept { return _ElementToFocus; }
private:
Editor::IHostedInWindow _WindowRoot;
Windows::Foundation::IInspectable _ViewModel{ nullptr };
hstring _ElementToFocus{};
};
struct LocalizedIndexEntry
{
std::optional<winrt::hstring> DisplayTextNeutral = std::nullopt;
std::optional<winrt::hstring> HelpTextNeutral = std::nullopt;
const IndexEntry* Entry = nullptr;
};
struct FilteredSearchResult : FilteredSearchResultT<FilteredSearchResult>
{
FilteredSearchResult(const LocalizedIndexEntry* entry, const Windows::Foundation::IInspectable& navigationArgOverride = nullptr, const std::optional<hstring>& label = std::nullopt) :
_SearchIndexEntry{ entry },
_NavigationArgOverride{ navigationArgOverride },
_overrideLabel{ label } {}
static Editor::FilteredSearchResult CreateNoResultsItem(const winrt::hstring& query);
static Editor::FilteredSearchResult CreateRuntimeObjectItem(const LocalizedIndexEntry* searchIndexEntry, const Windows::Foundation::IInspectable& runtimeObj);
hstring ToString() { return Label(); }
winrt::hstring Label() const;
bool IsNoResultsPlaceholder() const;
const LocalizedIndexEntry& SearchIndexEntry() const noexcept { return *_SearchIndexEntry; }
Windows::Foundation::IInspectable NavigationArg() const;
Windows::UI::Xaml::Controls::IconElement Icon() const;
private:
const std::optional<winrt::hstring> _overrideLabel{ std::nullopt };
const Windows::Foundation::IInspectable _NavigationArgOverride{ nullptr };
const LocalizedIndexEntry* _SearchIndexEntry{ nullptr };
};
struct MainPage : MainPageT<MainPage>
{
MainPage() = delete;
@@ -30,6 +86,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void UpdateSettings(const Model::CascadiaSettings& settings);
safe_void_coroutine SettingsSearchBox_TextChanged(const Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const Windows::UI::Xaml::Controls::AutoSuggestBoxTextChangedEventArgs& args);
void SettingsSearchBox_QuerySubmitted(const Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const Windows::UI::Xaml::Controls::AutoSuggestBoxQuerySubmittedEventArgs& args);
void SettingsSearchBox_SuggestionChosen(const Windows::UI::Xaml::Controls::AutoSuggestBox& sender, const Windows::UI::Xaml::Controls::AutoSuggestBoxSuggestionChosenEventArgs& args);
void SettingsNav_Loaded(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
void SettingsNav_ItemInvoked(const Microsoft::UI::Xaml::Controls::NavigationView& sender, const Microsoft::UI::Xaml::Controls::NavigationViewItemInvokedEventArgs& args);
void SaveButton_Click(const Windows::Foundation::IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& args);
@@ -44,6 +104,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Windows::Foundation::Collections::IObservableVector<IInspectable> Breadcrumbs() noexcept;
Editor::ExtensionsViewModel ExtensionsVM() const noexcept { return _extensionsVM; }
Editor::ActionsViewModel ActionsVM() const noexcept { return _actionsVM; }
til::typed_event<Windows::Foundation::IInspectable, Model::SettingsTarget> OpenJson;
til::typed_event<Windows::Foundation::IInspectable, Windows::Foundation::Collections::IVectorView<Model::SettingsLoadWarnings>> ShowLoadWarningsDialog;
@@ -67,22 +128,57 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void _SetupProfileEventHandling(const winrt::Microsoft::Terminal::Settings::Editor::ProfileViewModel profile);
void _PreNavigateHelper();
void _Navigate(hstring clickedItemTag, BreadcrumbSubPage subPage);
void _Navigate(const Editor::ProfileViewModel& profile, BreadcrumbSubPage subPage);
void _Navigate(const Editor::NewTabMenuEntryViewModel& ntmEntryVM, BreadcrumbSubPage subPage);
void _Navigate(const Editor::ExtensionPackageViewModel& extPkgVM, BreadcrumbSubPage subPage);
void _Navigate(hstring clickedItemTag, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ProfileViewModel& profile, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ColorSchemeViewModel& colorSchemeVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::NewTabMenuEntryViewModel& ntmEntryVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _Navigate(const Editor::ExtensionPackageViewModel& extPkgVM, BreadcrumbSubPage subPage, hstring elementToFocus = {});
void _NavigateToProfileHandler(const IInspectable& sender, winrt::guid profileGuid);
void _NavigateToColorSchemeHandler(const IInspectable& sender, const IInspectable& args);
Microsoft::UI::Xaml::Controls::NavigationViewItem _FindProfileNavItem(winrt::guid profileGuid) const;
void _UpdateBackgroundForMica();
void _MoveXamlParsedNavItemsIntoItemSource();
til::generation_t _QuerySearchIndex(const hstring& queryText);
safe_void_coroutine _UpdateSearchIndex();
winrt::Microsoft::Terminal::Settings::Editor::ProfileViewModel _profileDefaultsVM{ nullptr };
Windows::Foundation::Collections::IVector<winrt::Microsoft::Terminal::Settings::Editor::ProfileViewModel> _profileVMs{ nullptr };
winrt::Microsoft::Terminal::Settings::Editor::ColorSchemesPageViewModel _colorSchemesPageVM{ nullptr };
winrt::Microsoft::Terminal::Settings::Editor::ActionsViewModel _actionsVM{ nullptr };
winrt::Microsoft::Terminal::Settings::Editor::NewTabMenuViewModel _newTabMenuPageVM{ nullptr };
winrt::Microsoft::Terminal::Settings::Editor::ExtensionsViewModel _extensionsVM{ nullptr };
struct SearchIndex
{
SearchIndex& operator=(const SearchIndex& other) = default;
std::vector<LocalizedIndexEntry> mainIndex;
std::vector<LocalizedIndexEntry> profileIndex;
std::vector<LocalizedIndexEntry> ntmFolderIndex;
std::vector<LocalizedIndexEntry> colorSchemeIndex;
// Links to main page; used when searching runtime objects (i.e. profile/extension name --> Profile_Base/Extension View)
LocalizedIndexEntry profileIndexEntry;
LocalizedIndexEntry ntmFolderIndexEntry;
LocalizedIndexEntry colorSchemeIndexEntry;
LocalizedIndexEntry extensionIndexEntry;
};
til::generational<SearchIndex> _searchIndex;
struct FilteredSearchIndex
{
std::vector<const LocalizedIndexEntry*> mainIndex;
std::vector<const LocalizedIndexEntry*> profileIndex;
std::vector<const LocalizedIndexEntry*> ntmFolderIndex;
std::vector<const LocalizedIndexEntry*> colorSchemeIndex;
};
til::generational<FilteredSearchIndex> _filteredSearchIndex;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _profileViewModelChangedRevoker;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _colorSchemesPageViewModelChangedRevoker;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _actionsViewModelChangedRevoker;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _ntmViewModelChangedRevoker;
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _extensionsViewModelChangedRevoker;
};

View File

@@ -2,6 +2,7 @@
// Licensed under the MIT license.
import "Extensions.idl";
import "ActionsViewModel.idl";
namespace Microsoft.Terminal.Settings.Editor
{
@@ -15,6 +16,13 @@ namespace Microsoft.Terminal.Settings.Editor
UInt64 GetHostingWindow();
}
runtimeclass NavigateToPageArgs
{
IHostedInWindow WindowRoot { get; };
IInspectable ViewModel { get; };
String ElementToFocus { get; };
}
enum BreadcrumbSubPage
{
None = 0,
@@ -22,10 +30,17 @@ namespace Microsoft.Terminal.Settings.Editor
Profile_Terminal,
Profile_Advanced,
ColorSchemes_Edit,
Actions_Edit,
NewTabMenu_Folder,
Extensions_Extension
};
runtimeclass FilteredSearchResult : Windows.Foundation.IStringable
{
String Label { get; };
Windows.UI.Xaml.Controls.IconElement Icon { get; };
}
runtimeclass Breadcrumb : Windows.Foundation.IStringable
{
IInspectable Tag;
@@ -47,6 +62,7 @@ namespace Microsoft.Terminal.Settings.Editor
Windows.Foundation.Collections.IObservableVector<IInspectable> Breadcrumbs { get; };
ExtensionsViewModel ExtensionsVM { get; };
ActionsViewModel ActionsVM { get; };
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };
}

View File

@@ -99,23 +99,54 @@
</Grid>
</muxc:NavigationView.Header>
<muxc:NavigationView.AutoSuggestBox>
<AutoSuggestBox x:Name="SettingsSearchBox"
x:Uid="Nav_SearchBox"
QueryIcon="Find"
QuerySubmitted="SettingsSearchBox_QuerySubmitted"
SuggestionChosen="SettingsSearchBox_SuggestionChosen"
TextChanged="SettingsSearchBox_TextChanged">
<AutoSuggestBox.ItemTemplate>
<DataTemplate x:DataType="local:FilteredSearchResult">
<Grid HorizontalAlignment="Stretch"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{x:Bind Icon}" />
<TextBlock Grid.Column="1"
Text="{x:Bind Label}" />
</Grid>
</DataTemplate>
</AutoSuggestBox.ItemTemplate>
</AutoSuggestBox>
</muxc:NavigationView.AutoSuggestBox>
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem x:Uid="Nav_Launch"
<muxc:NavigationViewItem x:Name="LaunchNavItem"
x:Uid="Nav_Launch"
Tag="Launch_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7B5;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Interaction"
<muxc:NavigationViewItem x:Name="InteractionNavItem"
x:Uid="Nav_Interaction"
Tag="Interaction_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7C9;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Appearance"
<muxc:NavigationViewItem x:Name="GlobalAppearanceNavItem"
x:Uid="Nav_Appearance"
Tag="GlobalAppearance_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE771;" />
@@ -130,35 +161,44 @@
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Rendering"
<muxc:NavigationViewItem x:Name="RenderingNavItem"
x:Uid="Nav_Rendering"
Tag="Rendering_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE7F8;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Compatibility"
<muxc:NavigationViewItem x:Name="CompatibilityNavItem"
x:Uid="Nav_Compatibility"
Tag="Compatibility_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEC7A;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Actions"
<muxc:NavigationViewItem x:Name="ActionsNavItem"
x:Uid="Nav_Actions"
Tag="Actions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE765;" />
</muxc:NavigationViewItem.Icon>
<muxc:NavigationViewItem.InfoBadge>
<muxc:InfoBadge Style="{StaticResource NewInfoBadge}"
Visibility="{x:Bind ActionsVM.DisplayBadge, Mode=OneWay}" />
</muxc:NavigationViewItem.InfoBadge>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_NewTabMenu"
<muxc:NavigationViewItem x:Name="NewTabMenuNavItem"
x:Uid="Nav_NewTabMenu"
Tag="NewTabMenu_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xE71d;" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Nav_Extensions"
<muxc:NavigationViewItem x:Name="ExtensionsNavItem"
x:Uid="Nav_Extensions"
Tag="Extensions_Nav">
<muxc:NavigationViewItem.Icon>
<FontIcon Glyph="&#xEA86;" />

View File

@@ -45,6 +45,13 @@
<ClInclude Include="Actions.h">
<DependentUpon>Actions.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="ArgsTemplateSelectors.h">
<DependentUpon>ActionsViewModel.idl</DependentUpon>
<SubType>Code</SubType>
</ClInclude>
<ClInclude Include="EditAction.h">
<DependentUpon>EditAction.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="AddProfile.h">
<DependentUpon>AddProfile.xaml</DependentUpon>
</ClInclude>
@@ -162,12 +169,16 @@
</ClInclude>
<ClInclude Include="Utils.h" />
<ClInclude Include="PreviewConnection.h" />
<ClInclude Include="$(GeneratedFilesDir)GeneratedSettingsIndex.g.h" />
</ItemGroup>
<!-- ========================= XAML files ======================== -->
<ItemGroup>
<Page Include="Actions.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="EditAction.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="AddProfile.xaml">
<SubType>Designer</SubType>
</Page>
@@ -238,6 +249,13 @@
<ClCompile Include="Actions.cpp">
<DependentUpon>Actions.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="ArgsTemplateSelectors.cpp">
<DependentUpon>ActionsViewModel.idl</DependentUpon>
<SubType>Code</SubType>
</ClCompile>
<ClCompile Include="EditAction.cpp">
<DependentUpon>EditAction.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="AddProfile.cpp">
<DependentUpon>AddProfile.xaml</DependentUpon>
</ClCompile>
@@ -356,6 +374,7 @@
<ClCompile Include="PreviewConnection.cpp">
<DependentUpon>PreviewConnection.h</DependentUpon>
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)GeneratedSettingsIndex.g.cpp" />
</ItemGroup>
<!-- ========================= idl Files ======================== -->
<ItemGroup>
@@ -524,4 +543,10 @@
<!-- This -must- go after cppwinrt.build.post.props because that includes many VS-provided props including appcontainer.common.props, which stomps on what cppwinrt.targets did. -->
<Import Project="$(OpenConsoleDir)src\common.nugetversions.targets" />
<Import Project="$(SolutionDir)build\rules\CollectWildcardResources.targets" />
<Target Name="GenerateSettingsIndex"
Inputs="@(Page);$(OpenConsoleDir)tools\GenerateSettingsIndex.ps1"
Outputs="$(GeneratedFilesDir)GeneratedSettingsIndex.g.h;$(GeneratedFilesDir)GeneratedSettingsIndex.g.cpp"
BeforeTargets="ClCompile">
<Exec Command="pwsh.exe -NoProfile -ExecutionPolicy Unrestricted &quot;$(OpenConsoleDir)tools\GenerateSettingsIndex.ps1&quot; -SourceDir &quot;$(MSBuildThisFileDirectory).&quot; -OutputDir &quot;$(MSBuildThisFileDirectory)$(GeneratedFilesDir).&quot;" />
</Target>
</Project>

View File

@@ -50,6 +50,7 @@
<Page Include="Appearances.xaml" />
<Page Include="Rendering.xaml" />
<Page Include="Actions.xaml" />
<Page Include="EditAction.xaml" />
<Page Include="SettingContainerStyle.xaml" />
<Page Include="AddProfile.xaml" />
<Page Include="KeyChordListener.xaml" />

View File

@@ -3,6 +3,7 @@
#include "pch.h"
#include "NewTabMenu.h"
#include "NavigateToPageArgs.g.h"
#include "NewTabMenu.g.cpp"
#include "NewTabMenuEntryTemplateSelector.g.cpp"
#include "EnumEntry.h"
@@ -43,7 +44,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void NewTabMenu::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::NewTabMenuViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::NewTabMenuViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -324,7 +324,8 @@
<!-- Once PR #17965 merges, we can add that kind of control to set an icon -->
<!-- Name -->
<local:SettingContainer x:Uid="NewTabMenu_CurrentFolderName"
<local:SettingContainer x:Name="CurrentFolderName"
x:Uid="NewTabMenu_CurrentFolderName"
Grid.Row="0"
CurrentValue="{x:Bind ViewModel.CurrentFolderName, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
@@ -333,14 +334,16 @@
</local:SettingContainer>
<!-- Inlining -->
<local:SettingContainer x:Uid="NewTabMenu_CurrentFolderInlining"
<local:SettingContainer x:Name="CurrentFolderInlining"
x:Uid="NewTabMenu_CurrentFolderInlining"
Grid.Row="1">
<ToggleSwitch IsOn="{x:Bind ViewModel.CurrentFolderInlining, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Allow Empty -->
<local:SettingContainer x:Uid="NewTabMenu_CurrentFolderAllowEmpty"
<local:SettingContainer x:Name="CurrentFolderAllowEmpty"
x:Uid="NewTabMenu_CurrentFolderAllowEmpty"
Grid.Row="2">
<ToggleSwitch IsOn="{x:Bind ViewModel.CurrentFolderAllowEmpty, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
@@ -353,7 +356,8 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Add Profile -->
<local:SettingContainer x:Uid="NewTabMenu_AddProfile"
<local:SettingContainer x:Name="AddProfile"
x:Uid="NewTabMenu_AddProfile"
FontIconGlyph="&#xE756;"
Style="{StaticResource SettingContainerWithIcon}">
@@ -402,7 +406,8 @@
</local:SettingContainer>
<!-- Add Separator -->
<local:SettingContainer x:Uid="NewTabMenu_AddSeparator"
<local:SettingContainer x:Name="AddSeparator"
x:Uid="NewTabMenu_AddSeparator"
FontIconGlyph="&#xE76f;"
Style="{StaticResource SettingContainerWithIcon}">
<Button x:Name="AddSeparatorButton"
@@ -418,7 +423,8 @@
</local:SettingContainer>
<!-- Add Folder -->
<local:SettingContainer x:Uid="NewTabMenu_AddFolder"
<local:SettingContainer x:Name="AddFolder"
x:Uid="NewTabMenu_AddFolder"
FontIconGlyph="&#xF12B;"
Style="{StaticResource SettingContainerWithIcon}">
<StackPanel Orientation="Horizontal"
@@ -444,7 +450,8 @@
</local:SettingContainer>
<!-- Add Match Profiles -->
<local:SettingContainer x:Uid="NewTabMenu_AddMatchProfiles"
<local:SettingContainer x:Name="AddMatchProfiles"
x:Uid="NewTabMenu_AddMatchProfiles"
FontIconGlyph="&#xE748;"
Style="{StaticResource ExpanderSettingContainerStyleWithIcon}">
<StackPanel Spacing="8">

View File

@@ -452,6 +452,25 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return _folderTreeCache;
}
Collections::IObservableVector<Editor::FolderEntryViewModel> NewTabMenuViewModel::FolderTreeFlatList() const
{
std::vector<Editor::FolderEntryViewModel> flatList;
_FolderTreeFlatListImpl(_rootEntries, flatList);
return single_threaded_observable_vector<Editor::FolderEntryViewModel>(std::move(flatList));
}
void NewTabMenuViewModel::_FolderTreeFlatListImpl(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entriesToAdd, std::vector<Editor::FolderEntryViewModel>& flatList)
{
for (const auto& entry : entriesToAdd)
{
if (const auto& folderVM = entry.try_as<Editor::FolderEntryViewModel>())
{
flatList.push_back(folderVM);
_FolderTreeFlatListImpl(folderVM.Entries(), flatList);
}
}
}
// This recursively constructs the FolderTree
FolderTreeViewEntry::FolderTreeViewEntry(Editor::FolderEntryViewModel folderEntry) :
_folderEntry{ folderEntry },

View File

@@ -49,6 +49,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Windows::Foundation::Collections::IObservableVector<Model::Profile> AvailableProfiles() const { return _Settings.AllProfiles(); }
Windows::Foundation::Collections::IObservableVector<Editor::FolderTreeViewEntry> FolderTree() const;
Windows::Foundation::Collections::IObservableVector<Editor::FolderEntryViewModel> FolderTreeFlatList() const;
Windows::Foundation::Collections::IObservableVector<Editor::NewTabMenuEntryViewModel> CurrentView() const;
VIEW_MODEL_OBSERVABLE_PROPERTY(Editor::FolderEntryViewModel, CurrentFolder, nullptr);
VIEW_MODEL_OBSERVABLE_PROPERTY(Editor::FolderTreeViewEntry, CurrentFolderTreeViewSelectedItem, nullptr);
@@ -67,6 +68,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
Windows::Foundation::Collections::IObservableVector<Editor::NewTabMenuEntryViewModel>::VectorChanged_revoker _rootEntriesChangedRevoker;
static bool _IsRemainingProfilesEntryMissing(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entries);
static void _FolderTreeFlatListImpl(const Windows::Foundation::Collections::IVector<Editor::NewTabMenuEntryViewModel>& entriesToAdd, std::vector<Editor::FolderEntryViewModel>& flatList);
void _FolderPropertyChanged(const IInspectable& sender, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);
};

View File

@@ -4,7 +4,6 @@
#pragma once
#include "DeleteProfileEventArgs.g.h"
#include "NavigateToProfileArgs.g.h"
#include "BellSoundViewModel.g.h"
#include "ProfileViewModel.g.h"
#include "Utils.h"
@@ -12,21 +11,6 @@
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct NavigateToProfileArgs : NavigateToProfileArgsT<NavigateToProfileArgs>
{
public:
NavigateToProfileArgs(ProfileViewModel profile, Editor::IHostedInWindow windowRoot) :
_Profile(profile),
_WindowRoot(windowRoot) {}
Editor::IHostedInWindow WindowRoot() const noexcept { return _WindowRoot; }
Editor::ProfileViewModel Profile() const noexcept { return _Profile; }
private:
Editor::IHostedInWindow _WindowRoot;
Editor::ProfileViewModel _Profile{ nullptr };
};
struct BellSoundViewModel : BellSoundViewModelT<BellSoundViewModel>, ViewModelHelper<BellSoundViewModel>
{
public:
@@ -56,6 +40,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void DeleteProfile();
void SetupAppearances(Windows::Foundation::Collections::IObservableVector<Editor::ColorSchemeViewModel> schemesList);
void ForceRefreshCurrentPage()
{
// Used to trigger the PropertyChanged handler in MainPage.cpp
// This forces the page to refresh
_NotifyChanges(L"CurrentPage");
}
// bell style bits
hstring BellStylePreview() const;
@@ -174,6 +164,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
WINRT_PROPERTY(bool, IsBaseLayer, false);
WINRT_PROPERTY(bool, FocusDeleteButton, false);
WINRT_PROPERTY(hstring, ElementToFocus);
WINRT_PROPERTY(Windows::Foundation::Collections::IVector<Windows::Foundation::IInspectable>, IconTypes);
GETSET_BINDABLE_ENUM_SETTING(AntiAliasingMode, Microsoft::Terminal::Control::TextAntialiasingMode, AntialiasingMode);
GETSET_BINDABLE_ENUM_SETTING(CloseOnExitMode, Microsoft::Terminal::Settings::Model::CloseOnExitMode, CloseOnExit);

View File

@@ -14,12 +14,6 @@ import "ColorSchemesPageViewModel.idl";
namespace Microsoft.Terminal.Settings.Editor
{
runtimeclass NavigateToProfileArgs
{
ProfileViewModel Profile { get; };
IHostedInWindow WindowRoot { get; };
}
runtimeclass DeleteProfileEventArgs
{
Guid ProfileGuid { get; };

View File

@@ -26,9 +26,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Advanced::OnNavigatedTo(const NavigationEventArgs& e)
{
const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>();
_Profile = args.Profile();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_Profile = args.ViewModel().as<Editor::ProfileViewModel>();
_windowRoot = args.WindowRoot();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -37,7 +37,8 @@
<StackPanel Grid.Row="1"
Style="{StaticResource SettingsStackStyle}">
<!-- Antialiasing Mode -->
<local:SettingContainer x:Uid="Profile_AntialiasingMode"
<local:SettingContainer x:Name="AntialiasingMode"
x:Uid="Profile_AntialiasingMode"
ClearSettingValue="{x:Bind Profile.ClearAntialiasingMode}"
HasSettingValue="{x:Bind Profile.HasAntialiasingMode, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AntialiasingModeOverrideSource, Mode=OneWay}">
@@ -49,7 +50,8 @@
</local:SettingContainer>
<!-- AltGr Aliasing -->
<local:SettingContainer x:Uid="Profile_AltGrAliasing"
<local:SettingContainer x:Name="AltGrAliasing"
x:Uid="Profile_AltGrAliasing"
ClearSettingValue="{x:Bind Profile.ClearAltGrAliasing}"
HasSettingValue="{x:Bind Profile.HasAltGrAliasing, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AltGrAliasingOverrideSource, Mode=OneWay}">
@@ -58,7 +60,8 @@
</local:SettingContainer>
<!-- Snap On Input -->
<local:SettingContainer x:Uid="Profile_SnapOnInput"
<local:SettingContainer x:Name="SnapOnInput"
x:Uid="Profile_SnapOnInput"
ClearSettingValue="{x:Bind Profile.ClearSnapOnInput}"
HasSettingValue="{x:Bind Profile.HasSnapOnInput, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.SnapOnInputOverrideSource, Mode=OneWay}">
@@ -67,7 +70,8 @@
</local:SettingContainer>
<!-- History Size -->
<local:SettingContainer x:Uid="Profile_HistorySize"
<local:SettingContainer x:Name="HistorySize"
x:Uid="Profile_HistorySize"
ClearSettingValue="{x:Bind Profile.ClearHistorySize}"
HasSettingValue="{x:Bind Profile.HasHistorySize, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.HistorySizeOverrideSource, Mode=OneWay}">
@@ -80,7 +84,8 @@
</local:SettingContainer>
<!-- Close On Exit -->
<local:SettingContainer x:Uid="Profile_CloseOnExit"
<local:SettingContainer x:Name="CloseOnExit"
x:Uid="Profile_CloseOnExit"
ClearSettingValue="{x:Bind Profile.ClearCloseOnExit}"
HasSettingValue="{x:Bind Profile.HasCloseOnExit, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.CloseOnExitOverrideSource, Mode=OneWay}">
@@ -92,7 +97,8 @@
</local:SettingContainer>
<!-- Bell Style -->
<local:SettingContainer x:Uid="Profile_BellStyle"
<local:SettingContainer x:Name="BellStyle"
x:Uid="Profile_BellStyle"
ClearSettingValue="{x:Bind Profile.ClearBellStyle}"
CurrentValue="{x:Bind Profile.BellStylePreview, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasBellStyle, Mode=OneWay}"
@@ -109,7 +115,8 @@
</local:SettingContainer>
<!-- Bell Sound -->
<local:SettingContainer x:Uid="Profile_BellSound"
<local:SettingContainer x:Name="BellSound"
x:Uid="Profile_BellSound"
ClearSettingValue="{x:Bind Profile.ClearBellSound}"
CurrentValue="{x:Bind Profile.BellSoundPreview, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasBellSound, Mode=OneWay}"
@@ -190,7 +197,8 @@
</local:SettingContainer>
<!-- RightClickContextMenu -->
<local:SettingContainer x:Uid="Profile_RightClickContextMenu"
<local:SettingContainer x:Name="RightClickContextMenu"
x:Uid="Profile_RightClickContextMenu"
ClearSettingValue="{x:Bind Profile.ClearRightClickContextMenu}"
HasSettingValue="{x:Bind Profile.HasRightClickContextMenu, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.RightClickContextMenuOverrideSource, Mode=OneWay}">
@@ -199,7 +207,8 @@
</local:SettingContainer>
<!-- ShowMarks -->
<local:SettingContainer x:Uid="Profile_ShowMarks"
<local:SettingContainer x:Name="ShowMarks"
x:Uid="Profile_ShowMarks"
ClearSettingValue="{x:Bind Profile.ClearShowMarks}"
HasSettingValue="{x:Bind Profile.HasShowMarks, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ShowMarksOverrideSource, Mode=OneWay}"
@@ -209,7 +218,8 @@
</local:SettingContainer>
<!-- AutoMarkPrompts -->
<local:SettingContainer x:Uid="Profile_AutoMarkPrompts"
<local:SettingContainer x:Name="AutoMarkPrompts"
x:Uid="Profile_AutoMarkPrompts"
ClearSettingValue="{x:Bind Profile.ClearAutoMarkPrompts}"
HasSettingValue="{x:Bind Profile.HasAutoMarkPrompts, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AutoMarkPromptsOverrideSource, Mode=OneWay}"
@@ -219,7 +229,8 @@
</local:SettingContainer>
<!-- ReloadEnvVars -->
<local:SettingContainer x:Uid="Profile_ReloadEnvVars"
<local:SettingContainer x:Name="ReloadEnvVars"
x:Uid="Profile_ReloadEnvVars"
ClearSettingValue="{x:Bind Profile.ClearReloadEnvironmentVariables}"
HasSettingValue="{x:Bind Profile.HasReloadEnvironmentVariables, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ReloadEnvironmentVariablesOverrideSource, Mode=OneWay}">
@@ -228,7 +239,8 @@
</local:SettingContainer>
<!-- RepositionCursorWithMouse -->
<local:SettingContainer x:Uid="Profile_RepositionCursorWithMouse"
<local:SettingContainer x:Name="RepositionCursorWithMouse"
x:Uid="Profile_RepositionCursorWithMouse"
ClearSettingValue="{x:Bind Profile.ClearRepositionCursorWithMouse}"
HasSettingValue="{x:Bind Profile.HasRepositionCursorWithMouse, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.RepositionCursorWithMouseOverrideSource, Mode=OneWay}"
@@ -238,7 +250,8 @@
</local:SettingContainer>
<!-- RainbowSuggestions -->
<local:SettingContainer x:Uid="Profile_RainbowSuggestions"
<local:SettingContainer x:Name="RainbowSuggestions"
x:Uid="Profile_RainbowSuggestions"
ClearSettingValue="{x:Bind Profile.ClearRainbowSuggestions}"
HasSettingValue="{x:Bind Profile.HasRainbowSuggestions, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.RainbowSuggestionsOverrideSource, Mode=OneWay}">
@@ -247,7 +260,8 @@
</local:SettingContainer>
<!-- Path Translation -->
<local:SettingContainer x:Uid="Profile_PathTranslationStyle"
<local:SettingContainer x:Name="PathTranslationStyle"
x:Uid="Profile_PathTranslationStyle"
ClearSettingValue="{x:Bind Profile.ClearPathTranslationStyle}"
HasSettingValue="{x:Bind Profile.HasPathTranslationStyle, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.PathTranslationStyleOverrideSource, Mode=OneWay}">

View File

@@ -3,6 +3,7 @@
#include "pch.h"
#include "Profiles_Appearance.h"
#include "Appearances.h"
#include "ProfileViewModel.h"
#include "PreviewConnection.h"
@@ -22,10 +23,22 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Appearance::OnNavigatedTo(const NavigationEventArgs& e)
{
const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>();
_Profile = args.Profile();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_Profile = args.ViewModel().as<Editor::ProfileViewModel>();
_windowRoot = args.WindowRoot();
const auto elementToFocus = args.ElementToFocus();
if (elementToFocus.starts_with(L"App."))
{
// remove "App." prefix
std::wstring correctedName{ elementToFocus.c_str() };
get_self<implementation::Appearances>(DefaultAppearanceView())->BringIntoViewWhenLoaded(hstring{ correctedName.substr(4) });
}
else
{
BringIntoViewWhenLoaded(elementToFocus);
}
if (!_previewControl)
{
const auto settings = winrt::get_self<implementation::ProfileViewModel>(_Profile)->TermSettings();

View File

@@ -5,11 +5,10 @@
#include <ThrottledFunc.h>
#include "Profiles_Appearance.g.h"
#include "PreviewConnection.h"
#include "Utils.h"
#include "Profiles_Appearance.g.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct Profiles_Appearance : public HasScrollViewer<Profiles_Appearance>, Profiles_AppearanceT<Profiles_Appearance>

View File

@@ -75,7 +75,8 @@
CornerRadius="{StaticResource ControlCornerRadius}" />
</Border>
<local:Appearances Appearance="{x:Bind Profile.DefaultAppearance, Mode=OneWay}"
<local:Appearances x:Name="DefaultAppearanceView"
Appearance="{x:Bind Profile.DefaultAppearance, Mode=OneWay}"
SourceProfile="{x:Bind Profile, Mode=OneWay}"
WindowRoot="{x:Bind WindowRoot, Mode=OneTime}" />
@@ -85,12 +86,12 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Opacity -->
<local:SettingContainer x:Name="OpacityContainer"
<local:SettingContainer x:Name="Opacity"
x:Uid="Profile_Opacity"
ClearSettingValue="{x:Bind Profile.ClearOpacity}"
HasSettingValue="{x:Bind Profile.HasOpacity, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.OpacityOverrideSource, Mode=OneWay}">
<StackPanel x:Name="OpacityControl">
<StackPanel>
<Grid Style="{StaticResource CustomSliderControlGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -107,12 +108,12 @@
</local:SettingContainer>
<!-- Use Acrylic -->
<local:SettingContainer x:Uid="Profile_UseAcrylic"
<local:SettingContainer x:Name="UseAcrylic"
x:Uid="Profile_UseAcrylic"
ClearSettingValue="{x:Bind Profile.ClearUseAcrylic}"
HasSettingValue="{x:Bind Profile.HasUseAcrylic, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.UseAcrylicOverrideSource, Mode=OneWay}">
<ToggleSwitch x:Name="UseAcrylicToggleSwitch"
IsOn="{x:Bind Profile.UseAcrylic, Mode=TwoWay}"
<ToggleSwitch IsOn="{x:Bind Profile.UseAcrylic, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
@@ -124,7 +125,8 @@
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Padding -->
<local:SettingContainer x:Uid="Profile_Padding"
<local:SettingContainer x:Name="Padding"
x:Uid="Profile_Padding"
ClearSettingValue="{x:Bind Profile.ClearPadding}"
CurrentValue="{x:Bind Profile.Padding, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasPadding, Mode=OneWay}"
@@ -191,7 +193,8 @@
</local:SettingContainer>
<!-- Scrollbar Visibility -->
<local:SettingContainer x:Uid="Profile_ScrollbarVisibility"
<local:SettingContainer x:Name="ScrollbarVisibility"
x:Uid="Profile_ScrollbarVisibility"
ClearSettingValue="{x:Bind Profile.ClearScrollState}"
HasSettingValue="{x:Bind Profile.HasScrollState, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ScrollStateOverrideSource, Mode=OneWay}">
@@ -207,7 +210,10 @@
Visibility="{x:Bind Profile.EditableUnfocusedAppearance, Mode=OneWay}">
<TextBlock x:Uid="Profile_UnfocusedAppearanceTextBlock"
Style="{StaticResource TextBlockSubtitleStyle}" />
<Button x:Uid="Profile_CreateUnfocusedAppearanceButton"
<!-- Create Unfocused Appearance -->
<Button x:Name="CreateUnfocusedAppearance"
x:Uid="Profile_CreateUnfocusedAppearanceButton"
Margin="8,0,0,0"
VerticalAlignment="Bottom"
Click="CreateUnfocusedAppearance_Click"
@@ -224,7 +230,10 @@
</StackPanel>
</Button.Content>
</Button>
<Button x:Uid="Profile_DeleteUnfocusedAppearanceButton"
<!-- Delete Unfocused Appearance -->
<Button x:Name="DeleteUnfocusedAppearance"
x:Uid="Profile_DeleteUnfocusedAppearanceButton"
Margin="8,0,0,0"
VerticalAlignment="Bottom"
Click="DeleteUnfocusedAppearance_Click"
@@ -241,7 +250,10 @@
</Button.Content>
</Button>
</StackPanel>
<local:Appearances Appearance="{x:Bind Profile.UnfocusedAppearance, Mode=OneWay}"
<!-- Unfocused Appearance -->
<local:Appearances x:Name="UnfocusedAppearanceView"
Appearance="{x:Bind Profile.UnfocusedAppearance, Mode=OneWay}"
SourceProfile="{x:Bind Profile, Mode=OneWay}"
Visibility="{x:Bind Profile.ShowUnfocusedAppearance, Mode=OneWay}"
WindowRoot="{x:Bind WindowRoot, Mode=OneTime}" />

View File

@@ -30,9 +30,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Base::OnNavigatedTo(const NavigationEventArgs& e)
{
const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>();
_Profile = args.Profile();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_Profile = args.ViewModel().as<Editor::ProfileViewModel>();
_windowRoot = args.WindowRoot();
BringIntoViewWhenLoaded(args.ElementToFocus());
// Check the use parent directory box if the starting directory is empty
if (_Profile.StartingDirectory().empty())

View File

@@ -40,7 +40,8 @@
Additionally, the JSON stubs generated by auto-generated profiles come with a name,
so the name will always be overridden.
-->
<local:SettingContainer x:Uid="Profile_Name"
<local:SettingContainer x:Name="Name"
x:Uid="Profile_Name"
CurrentValue="{x:Bind Profile.Name, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(Profile.IsBaseLayer), Mode=OneWay}">
@@ -49,7 +50,7 @@
</local:SettingContainer>
<!-- Commandline -->
<local:SettingContainer x:Name="CommandlineContainer"
<local:SettingContainer x:Name="Commandline"
x:Uid="Profile_Commandline"
ClearSettingValue="{x:Bind Profile.ClearCommandline}"
CurrentValue="{x:Bind Profile.Commandline, Mode=OneWay}"
@@ -70,7 +71,7 @@
</local:SettingContainer>
<!-- Starting Directory -->
<local:SettingContainer x:Name="StartingDirectoryContainer"
<local:SettingContainer x:Name="StartingDirectory"
x:Uid="Profile_StartingDirectory"
ClearSettingValue="{x:Bind Profile.ClearStartingDirectory}"
CurrentValue="{x:Bind Profile.CurrentStartingDirectoryPreview, Mode=OneWay}"
@@ -99,7 +100,8 @@
</local:SettingContainer>
<!-- Icon -->
<local:SettingContainer x:Uid="Profile_Icon"
<local:SettingContainer x:Name="Icon"
x:Uid="Profile_Icon"
ClearSettingValue="{x:Bind Profile.ClearIcon}"
CurrentValueAccessibleName="{x:Bind Profile.LocalizedIcon, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasIcon, Mode=OneWay}"
@@ -198,7 +200,8 @@
</local:SettingContainer>
<!-- Tab Title -->
<local:SettingContainer x:Uid="Profile_TabTitle"
<local:SettingContainer x:Name="TabTitle"
x:Uid="Profile_TabTitle"
ClearSettingValue="{x:Bind Profile.ClearTabTitle}"
CurrentValue="{x:Bind Profile.TabTitlePreview, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasTabTitle, Mode=OneWay}"
@@ -225,7 +228,8 @@
</local:SettingContainer>
<!-- Elevate -->
<local:SettingContainer x:Uid="Profile_Elevate"
<local:SettingContainer x:Name="Elevate"
x:Uid="Profile_Elevate"
ClearSettingValue="{x:Bind Profile.ClearElevate}"
HasSettingValue="{x:Bind Profile.HasElevate, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ElevateOverrideSource, Mode=OneWay}">
@@ -234,7 +238,8 @@
</local:SettingContainer>
<!-- Hidden -->
<local:SettingContainer x:Uid="Profile_Hidden"
<local:SettingContainer x:Name="Hidden"
x:Uid="Profile_Hidden"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(Profile.IsBaseLayer), Mode=OneWay}">
<ToggleSwitch IsOn="{x:Bind Profile.Hidden, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />

View File

@@ -23,8 +23,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Base_Orphaned::OnNavigatedTo(const NavigationEventArgs& e)
{
const auto args = e.Parameter().as<Editor::NavigateToProfileArgs>();
_Profile = args.Profile();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_Profile = args.ViewModel().as<Editor::ProfileViewModel>();
_layoutUpdatedRevoker = LayoutUpdated(winrt::auto_revoke, [this](auto /*s*/, auto /*e*/) {
// This event fires every time the layout changes, but it is always the last one to fire

View File

@@ -23,7 +23,8 @@
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Delete Button -->
<local:SettingContainer x:Uid="Profile_Delete_Orphaned">
<local:SettingContainer x:Name="DeleteOrphaned"
x:Uid="Profile_Delete_Orphaned">
<local:SettingContainer.Content>
<Button x:Name="DeleteButton"
Click="DeleteConfirmation_Click"
@@ -40,7 +41,8 @@
</local:SettingContainer.Content>
</local:SettingContainer>
<local:SettingContainer x:Uid="Profile_Name">
<local:SettingContainer x:Name="Name"
x:Uid="Profile_Name">
<local:SettingContainer.Content>
<TextBlock FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
Style="{StaticResource SettingsPageItemDescriptionStyle}"
@@ -48,7 +50,8 @@
</local:SettingContainer.Content>
</local:SettingContainer>
<local:SettingContainer x:Uid="Profile_Source_Orphaned">
<local:SettingContainer x:Name="Source"
x:Uid="Profile_Source_Orphaned">
<local:SettingContainer.Content>
<TextBlock FontFamily="Segoe UI, Segoe Fluent Icons, Segoe MDL2 Assets"
Style="{StaticResource SettingsPageItemDescriptionStyle}"

View File

@@ -21,7 +21,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Profiles_Terminal::OnNavigatedTo(const NavigationEventArgs& e)
{
_Profile = e.Parameter().as<Editor::ProfileViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_Profile = args.ViewModel().as<Editor::ProfileViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -32,7 +32,8 @@
Style="{StaticResource SettingsStackStyle}">
<!-- Suppress Application Title -->
<local:SettingContainer x:Uid="Profile_SuppressApplicationTitle"
<local:SettingContainer x:Name="SuppressApplicationTitle"
x:Uid="Profile_SuppressApplicationTitle"
ClearSettingValue="{x:Bind Profile.ClearSuppressApplicationTitle}"
HasSettingValue="{x:Bind Profile.HasSuppressApplicationTitle, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.SuppressApplicationTitleOverrideSource, Mode=OneWay}">
@@ -41,7 +42,8 @@
</local:SettingContainer>
<!-- Force VT Input -->
<local:SettingContainer x:Uid="Profile_ForceVTInput"
<local:SettingContainer x:Name="ForceVTInput"
x:Uid="Profile_ForceVTInput"
ClearSettingValue="{x:Bind Profile.ClearForceVTInput}"
HasSettingValue="{x:Bind Profile.HasForceVTInput, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.ForceVTInputOverrideSource, Mode=OneWay}">
@@ -50,7 +52,8 @@
</local:SettingContainer>
<!-- Allow VT Checksum Report -->
<local:SettingContainer x:Uid="Profile_AllowVtChecksumReport"
<local:SettingContainer x:Name="AllowVtChecksumReport"
x:Uid="Profile_AllowVtChecksumReport"
ClearSettingValue="{x:Bind Profile.ClearAllowVtChecksumReport}"
HasSettingValue="{x:Bind Profile.HasAllowVtChecksumReport, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AllowVtChecksumReportOverrideSource, Mode=OneWay}">
@@ -59,7 +62,8 @@
</local:SettingContainer>
<!-- Allow VT Clipboard Writing -->
<local:SettingContainer x:Uid="Profile_AllowVtClipboardWrite"
<local:SettingContainer x:Name="AllowVtClipboardWrite"
x:Uid="Profile_AllowVtClipboardWrite"
ClearSettingValue="{x:Bind Profile.ClearAllowVtClipboardWrite}"
HasSettingValue="{x:Bind Profile.HasAllowVtClipboardWrite, Mode=OneWay}"
SettingOverrideSource="{x:Bind Profile.AllowVtClipboardWriteOverrideSource, Mode=OneWay}">
@@ -68,7 +72,8 @@
</local:SettingContainer>
<!-- Answerback Message -->
<local:SettingContainer x:Uid="Profile_AnswerbackMessage"
<local:SettingContainer x:Name="AnswerbackMessage"
x:Uid="Profile_AnswerbackMessage"
ClearSettingValue="{x:Bind Profile.ClearAnswerbackMessage}"
CurrentValue="{x:Bind Profile.AnswerbackMessagePreview, Mode=OneWay}"
HasSettingValue="{x:Bind Profile.HasAnswerbackMessage, Mode=OneWay}"

View File

@@ -3,6 +3,7 @@
#include "pch.h"
#include "Rendering.h"
#include "NavigateToPageArgs.g.h"
#include "Rendering.g.cpp"
using namespace winrt::Windows::UI::Xaml::Navigation;
@@ -16,7 +17,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Rendering::OnNavigatedTo(const NavigationEventArgs& e)
{
_ViewModel = e.Parameter().as<Editor::RenderingViewModel>();
const auto args = e.Parameter().as<Editor::NavigateToPageArgs>();
_ViewModel = args.ViewModel().as<Editor::RenderingViewModel>();
BringIntoViewWhenLoaded(args.ElementToFocus());
TraceLoggingWrite(
g_hTerminalSettingsEditorProvider,

View File

@@ -24,7 +24,8 @@
</Page.Resources>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<local:SettingContainer x:Uid="Globals_GraphicsAPI">
<local:SettingContainer x:Name="GraphicsAPI"
x:Uid="Globals_GraphicsAPI">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.GraphicsAPIList}"
@@ -32,12 +33,14 @@
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<local:SettingContainer x:Uid="Globals_DisablePartialInvalidation">
<local:SettingContainer x:Name="DisablePartialInvalidation"
x:Uid="Globals_DisablePartialInvalidation">
<ToggleSwitch IsOn="{x:Bind ViewModel.DisablePartialInvalidation, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<local:SettingContainer x:Uid="Globals_SoftwareRendering">
<local:SettingContainer x:Name="SoftwareRendering"
x:Uid="Globals_SoftwareRendering">
<ToggleSwitch IsOn="{x:Bind ViewModel.SoftwareRendering, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>

View File

@@ -690,7 +690,11 @@
</data>
<data name="Nav_Actions.Content" xml:space="preserve">
<value>Actions</value>
<comment>Header for the "actions" menu item. This navigates to a page that lets you see and modify commands, key bindings, and actions that can be done in the app.</comment>
<comment>Header for the "actions" menu item. This navigates to a page that lets you see the available commands in the app.</comment>
</data>
<data name="Nav_EditAction.Content" xml:space="preserve">
<value>Edit Action...</value>
<comment>Header for the "edit action" page. This is the page that lets you modify a specific command and its key bindings.</comment>
</data>
<data name="Nav_Extensions.Content" xml:space="preserve">
<value>Extensions</value>
@@ -1808,6 +1812,42 @@
<value>Delete the unfocused appearance for this profile.</value>
<comment>A description for what the delete unfocused appearance button does.</comment>
</data>
<data name="Actions_Disclaimer.Content" xml:space="preserve">
<value>Learn more about actions</value>
<comment>Disclaimer presented at the top of the actions page to redirect the user to documentation regarding actions.</comment>
</data>
<data name="Actions_DeleteButton2.Text" xml:space="preserve">
<value>Delete action</value>
<comment>Button label that deletes the selected action.</comment>
</data>
<data name="Actions_Name.Text" xml:space="preserve">
<value>Action name</value>
<comment>Label for the text box that edits the action name.</comment>
</data>
<data name="Actions_NameEntryBox.PlaceholderText" xml:space="preserve">
<value>Action name</value>
<comment>Placeholder text for the text box where the user can edit the action name.</comment>
</data>
<data name="Actions_ShortcutAction.Text" xml:space="preserve">
<value>Action type</value>
<comment>Label for the combo box that edits the action type.</comment>
</data>
<data name="Actions_KeyBindingsListView.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Keybindings</value>
<comment>Name for a control which contains the list of keybindings for the current command.</comment>
</data>
<data name="Actions_Arguments.Text" xml:space="preserve">
<value>Additional arguments</value>
<comment>Label for the list of editable arguments for the currently selected action.</comment>
</data>
<data name="Actions_Keybindings.Text" xml:space="preserve">
<value>Keybindings</value>
<comment>Label for the list of editable keybindings for the current command.</comment>
</data>
<data name="Actions_AddKeyChord.Text" xml:space="preserve">
<value>Add keybinding</value>
<comment>Button label that adds a keybinding to the current action.</comment>
</data>
<data name="Actions_DeleteConfirmationButton.Content" xml:space="preserve">
<value>Yes, delete key binding</value>
<comment>Button label that confirms deletion of a key binding entry.</comment>
@@ -1816,6 +1856,14 @@
<value>Are you sure you want to delete this key binding?</value>
<comment>Confirmation message displayed when the user attempts to delete a key binding entry.</comment>
</data>
<data name="Actions_CommandDeleteConfirmationButton.Content" xml:space="preserve">
<value>Yes, delete action</value>
<comment>Button label that confirms deletion of an action.</comment>
</data>
<data name="Actions_CommandDeleteConfirmationMessage.Text" xml:space="preserve">
<value>Are you sure you want to delete this action?</value>
<comment>Confirmation message displayed when the user attempts to delete an action.</comment>
</data>
<data name="Actions_InvalidKeyChordMessage" xml:space="preserve">
<value>Invalid key chord. Please enter a valid key chord.</value>
<comment>Error message displayed when an invalid key chord is input by the user.</comment>
@@ -1860,6 +1908,278 @@
<value>Action</value>
<comment>Label for a control that sets the action of a key binding.</comment>
</data>
<data name="Actions_NullEnumValue" xml:space="preserve">
<value>Use global setting</value>
<comment>An option to choose from for nullable enums. Clears the enum value.</comment>
</data>
<data name="Actions_CopyFormatHtml.Content" xml:space="preserve">
<value>HTML</value>
<comment>An option to choose from for the "copy format". Copies content in HTML format.</comment>
</data>
<data name="Actions_CopyFormatRtf.Content" xml:space="preserve">
<value>RTF</value>
<comment>An option to choose from for the "copy format". Copies content in Rich Text Format (RTF).</comment>
</data>
<data name="Actions_SplitDirectionAuto.Content" xml:space="preserve">
<value>Automatic</value>
<comment>An option to choose from for the "split direction". Automatically determines the split direction.</comment>
</data>
<data name="Actions_SplitDirectionUp.Content" xml:space="preserve">
<value>Up</value>
<comment>An option to choose from for the "split direction". Splits upward.</comment>
</data>
<data name="Actions_SplitDirectionRight.Content" xml:space="preserve">
<value>Right</value>
<comment>An option to choose from for the "split direction". Splits to the right.</comment>
</data>
<data name="Actions_SplitDirectionDown.Content" xml:space="preserve">
<value>Down</value>
<comment>An option to choose from for the "split direction". Splits downward.</comment>
</data>
<data name="Actions_SplitDirectionLeft.Content" xml:space="preserve">
<value>Left</value>
<comment>An option to choose from for the "split direction". Splits to the left.</comment>
</data>
<data name="Actions_SplitDirectionVertical.Content" xml:space="preserve">
<value>Vertical</value>
<comment>An option to choose from for the "split direction". Splits vertically.</comment>
</data>
<data name="Actions_SplitDirectionHorizontal.Content" xml:space="preserve">
<value>Horizontal</value>
<comment>An option to choose from for the "split direction". Splits horizontally.</comment>
</data>
<data name="Actions_SplitTypeManual.Content" xml:space="preserve">
<value>Manual</value>
<comment>An option to choose from for the "split type". Creates a manual split.</comment>
</data>
<data name="Actions_SplitTypeDuplicate.Content" xml:space="preserve">
<value>Duplicate</value>
<comment>An option to choose from for the "split type". Creates a split by duplicating the current session.</comment>
</data>
<data name="Actions_ResizeDirectionNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "resize direction". None option.</comment>
</data>
<data name="Actions_ResizeDirectionLeft.Content" xml:space="preserve">
<value>Left</value>
<comment>An option to choose from for the "resize direction". Left option.</comment>
</data>
<data name="Actions_ResizeDirectionRight.Content" xml:space="preserve">
<value>Right</value>
<comment>An option to choose from for the "resize direction". Right option.</comment>
</data>
<data name="Actions_ResizeDirectionUp.Content" xml:space="preserve">
<value>Up</value>
<comment>An option to choose from for the "resize direction". Up option.</comment>
</data>
<data name="Actions_ResizeDirectionDown.Content" xml:space="preserve">
<value>Down</value>
<comment>An option to choose from for the "resize direction". Down option.</comment>
</data>
<data name="Actions_FocusDirectionNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "focus direction". None option.</comment>
</data>
<data name="Actions_FocusDirectionLeft.Content" xml:space="preserve">
<value>Left</value>
<comment>An option to choose from for the "focus direction". Left option.</comment>
</data>
<data name="Actions_FocusDirectionRight.Content" xml:space="preserve">
<value>Right</value>
<comment>An option to choose from for the "focus direction". Right option.</comment>
</data>
<data name="Actions_FocusDirectionUp.Content" xml:space="preserve">
<value>Up</value>
<comment>An option to choose from for the "focus direction". Up option.</comment>
</data>
<data name="Actions_FocusDirectionDown.Content" xml:space="preserve">
<value>Down</value>
<comment>An option to choose from for the "focus direction". Down option.</comment>
</data>
<data name="Actions_FocusDirectionPrevious.Content" xml:space="preserve">
<value>Previous</value>
<comment>An option to choose from for the "focus direction". Previous option.</comment>
</data>
<data name="Actions_FocusDirectionPreviousInOrder.Content" xml:space="preserve">
<value>Previous In Order</value>
<comment>An option to choose from for the "focus direction". Previous in order option.</comment>
</data>
<data name="Actions_FocusDirectionNextInOrder.Content" xml:space="preserve">
<value>Next In Order</value>
<comment>An option to choose from for the "focus direction". Next in order option.</comment>
</data>
<data name="Actions_FocusDirectionFirst.Content" xml:space="preserve">
<value>First</value>
<comment>An option to choose from for the "focus direction". First option.</comment>
</data>
<data name="Actions_FocusDirectionParent.Content" xml:space="preserve">
<value>Parent</value>
<comment>An option to choose from for the "focus direction". Parent option.</comment>
</data>
<data name="Actions_FocusDirectionChild.Content" xml:space="preserve">
<value>Child</value>
<comment>An option to choose from for the "focus direction". Child option.</comment>
</data>
<data name="Actions_SettingsTargetSettingsFile.Content" xml:space="preserve">
<value>Settings File</value>
<comment>An option to choose from for the "settings target". Targets the settings file.</comment>
</data>
<data name="Actions_SettingsTargetDefaultsFile.Content" xml:space="preserve">
<value>Defaults File</value>
<comment>An option to choose from for the "settings target". Targets the defaults file.</comment>
</data>
<data name="Actions_SettingsTargetAllFiles.Content" xml:space="preserve">
<value>All Files</value>
<comment>An option to choose from for the "settings target". Targets all files.</comment>
</data>
<data name="Actions_SettingsTargetSettingsUI.Content" xml:space="preserve">
<value>Settings UI</value>
<comment>An option to choose from for the "settings target". Targets the settings UI.</comment>
</data>
<data name="Actions_SettingsTargetDirectory.Content" xml:space="preserve">
<value>Directory</value>
<comment>An option to choose from for the "settings target". Targets the directory.</comment>
</data>
<data name="Actions_MoveTabDirectionNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "move tab direction". No movement.</comment>
</data>
<data name="Actions_MoveTabDirectionForward.Content" xml:space="preserve">
<value>Forward</value>
<comment>An option to choose from for the "move tab direction". Moves the tab forward.</comment>
</data>
<data name="Actions_MoveTabDirectionBackward.Content" xml:space="preserve">
<value>Backward</value>
<comment>An option to choose from for the "move tab direction". Moves the tab backward.</comment>
</data>
<data name="Actions_ScrollToMarkDirectionPrevious.Content" xml:space="preserve">
<value>Previous</value>
<comment>An option to choose from for the "scroll to mark direction". Scrolls to the previous mark.</comment>
</data>
<data name="Actions_ScrollToMarkDirectionNext.Content" xml:space="preserve">
<value>Next</value>
<comment>An option to choose from for the "scroll to mark direction". Scrolls to the next mark.</comment>
</data>
<data name="Actions_ScrollToMarkDirectionFirst.Content" xml:space="preserve">
<value>First</value>
<comment>An option to choose from for the "scroll to mark direction". Scrolls to the first mark.</comment>
</data>
<data name="Actions_ScrollToMarkDirectionLast.Content" xml:space="preserve">
<value>Last</value>
<comment>An option to choose from for the "scroll to mark direction". Scrolls to the last mark.</comment>
</data>
<data name="Actions_CommandPaletteLaunchModeAction.Content" xml:space="preserve">
<value>Action</value>
<comment>An option to choose from for the "command palette launch mode". Launches in action mode.</comment>
</data>
<data name="Actions_CommandPaletteLaunchModeCommandLine.Content" xml:space="preserve">
<value>Command Line</value>
<comment>An option to choose from for the "command palette launch mode". Launches in command line mode.</comment>
</data>
<data name="Actions_SuggestionsSourceNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "suggestions source". No suggestions source.</comment>
</data>
<data name="Actions_SuggestionsSourceTasks.Content" xml:space="preserve">
<value>Tasks</value>
<comment>An option to choose from for the "suggestions source". Suggestions come from tasks.</comment>
</data>
<data name="Actions_SuggestionsSourceSnippets.Content" xml:space="preserve">
<value>Snippets</value>
<comment>An option to choose from for the "suggestions source". Suggestions come from snippets.</comment>
</data>
<data name="Actions_SuggestionsSourceCommandHistory.Content" xml:space="preserve">
<value>Command History</value>
<comment>An option to choose from for the "suggestions source". Suggestions come from command history.</comment>
</data>
<data name="Actions_SuggestionsSourceDirectoryHistory.Content" xml:space="preserve">
<value>Directory History</value>
<comment>An option to choose from for the "suggestions source". Suggestions come from directory history.</comment>
</data>
<data name="Actions_SuggestionsSourceQuickFix.Content" xml:space="preserve">
<value>Quick Fixes</value>
<comment>An option to choose from for the "suggestions source". Suggestions come from quick fixes.</comment>
</data>
<data name="Actions_SuggestionsSourceAll.Content" xml:space="preserve">
<value>All</value>
<comment>An option to choose from for the "suggestions source". Includes all suggestion sources.</comment>
</data>
<data name="Actions_FindMatchDirectionNone.Content" xml:space="preserve">
<value>None</value>
<comment>An option to choose from for the "find match direction". No direction selected.</comment>
</data>
<data name="Actions_FindMatchDirectionNext.Content" xml:space="preserve">
<value>Next</value>
<comment>An option to choose from for the "find match direction". Finds the next match.</comment>
</data>
<data name="Actions_FindMatchDirectionPrev.Content" xml:space="preserve">
<value>Previous</value>
<comment>An option to choose from for the "find match direction". Finds the previous match.</comment>
</data>
<data name="Actions_DesktopBehaviorAny.Content" xml:space="preserve">
<value>Any</value>
<comment>An option to choose from for the "desktop behavior". Applies to any desktop.</comment>
</data>
<data name="Actions_DesktopBehaviorToCurrent.Content" xml:space="preserve">
<value>To Current</value>
<comment>An option to choose from for the "desktop behavior". Moves to the current desktop.</comment>
</data>
<data name="Actions_DesktopBehaviorOnCurrent.Content" xml:space="preserve">
<value>On Current</value>
<comment>An option to choose from for the "desktop behavior". Stays on the current desktop.</comment>
</data>
<data name="Actions_MonitorBehaviorAny.Content" xml:space="preserve">
<value>Any</value>
<comment>An option to choose from for the "monitor behavior". Applies to any monitor.</comment>
</data>
<data name="Actions_MonitorBehaviorToCurrent.Content" xml:space="preserve">
<value>To Current</value>
<comment>An option to choose from for the "monitor behavior". Moves to the current monitor.</comment>
</data>
<data name="Actions_MonitorBehaviorToMouse.Content" xml:space="preserve">
<value>To Mouse</value>
<comment>An option to choose from for the "monitor behavior". Moves to the monitor where the mouse is located.</comment>
</data>
<data name="Actions_ClearBufferTypeScreen.Content" xml:space="preserve">
<value>Screen</value>
<comment>An option to choose from for the "clear buffer type". Clears only the screen.</comment>
</data>
<data name="Actions_ClearBufferTypeScrollback.Content" xml:space="preserve">
<value>Scrollback</value>
<comment>An option to choose from for the "clear buffer type". Clears only the scrollback buffer.</comment>
</data>
<data name="Actions_ClearBufferTypeAll.Content" xml:space="preserve">
<value>All</value>
<comment>An option to choose from for the "clear buffer type". Clears both the screen and the scrollback buffer.</comment>
</data>
<data name="Actions_SelectOutputDirectionPrev.Content" xml:space="preserve">
<value>Previous</value>
<comment>An option to choose from for the "select output direction". Selects the previous output.</comment>
</data>
<data name="Actions_SelectOutputDirectionNext.Content" xml:space="preserve">
<value>Next</value>
<comment>An option to choose from for the "select output direction". Selects the next output.</comment>
</data>
<data name="Actions_TabSwitcherModeMru.Content" xml:space="preserve">
<value>Most Recently Used</value>
<comment>An option to choose from for the "tab switcher mode". Switches tabs based on most recently used order.</comment>
</data>
<data name="Actions_TabSwitcherModeInOrder.Content" xml:space="preserve">
<value>In Order</value>
<comment>An option to choose from for the "tab switcher mode". Switches tabs in sequential order.</comment>
</data>
<data name="Actions_TabSwitcherModeDisabled.Content" xml:space="preserve">
<value>Disabled</value>
<comment>An option to choose from for the "tab switcher mode". Disables tab switching.</comment>
</data>
<data name="Actions_NullableColorPicker.NullColorButtonLabel" xml:space="preserve">
<value>No color</value>
<comment>Label for a button directing the user to opt out of choosing a color.</comment>
</data>
<data name="Actions_Browse.Content" xml:space="preserve">
<value>Browse...</value>
<comment>Button label that opens a file picker in a new window. The "..." is standard to mean it will open a new window.</comment>
</data>
<data name="KeyChordListener.[using:Windows.UI.Xaml.Automation]AutomationProperties.HelpText" xml:space="preserve">
<value>Input your desired keyboard shortcut.</value>
<comment>Help text directing users how to use the "KeyChordListener" control. Pressing a keyboard shortcut will be recorded by this control.</comment>
@@ -2475,4 +2795,12 @@
<data name="Settings_ResetApplicationStateConfirmationButton.Content" xml:space="preserve">
<value>Yes, clear the cache</value>
</data>
</root>
<data name="Nav_SearchBox.PlaceholderText" xml:space="preserve">
<value>Search for settings</value>
<comment>Placeholder text for the main search box in the settings editor.</comment>
</data>
<data name="Search_NoResults" xml:space="preserve">
<value>No results for "{}"</value>
<comment>{Locked="{}"} Displayed when no results were found for a given query. "{}" will be replaced with the query.</comment>
</data>
</root>

View File

@@ -3,44 +3,46 @@
#pragma once
#include "SettingContainer.h"
// This macro must be used alongside GETSET_BINDABLE_ENUM_SETTING.
// Use this in your class's constructor after Initialize_Component().
// It sorts and initializes the observable list of enum entries with the enum name
// being its localized name, and also initializes the enum to EnumEntry
// map that's required to tell XAML what enum value the currently active
// setting has.
#define INITIALIZE_BINDABLE_ENUM_SETTING(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
do \
{ \
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
for (auto [key, value] : enumMapping##name) \
{ \
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value)); \
name##List.emplace_back(entry); \
_##name##Map.Insert(value, entry); \
} \
std::sort(name##List.begin(), name##List.end(), EnumEntryComparator<enumType>()); \
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
#define INITIALIZE_BINDABLE_ENUM_SETTING(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
do \
{ \
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
for (auto [key, value] : enumMapping##name) \
{ \
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value), static_cast<int32_t>(value)); \
name##List.emplace_back(entry); \
_##name##Map.Insert(value, entry); \
} \
std::sort(name##List.begin(), name##List.end(), EnumEntryComparator<enumType>()); \
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
} while (0);
#define INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
do \
{ \
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
for (auto [key, value] : enumMapping##name) \
{ \
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value)); \
name##List.emplace_back(entry); \
_##name##Map.Insert(value, entry); \
} \
std::sort(name##List.begin(), name##List.end(), EnumEntryReverseComparator<enumType>()); \
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
#define INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
do \
{ \
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
for (auto [key, value] : enumMapping##name) \
{ \
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value), static_cast<int32_t>(value)); \
name##List.emplace_back(entry); \
_##name##Map.Insert(value, entry); \
} \
std::sort(name##List.begin(), name##List.end(), EnumEntryReverseComparator<enumType>()); \
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
} while (0);
// This macro must be used alongside INITIALIZE_BINDABLE_ENUM_SETTING.
@@ -116,4 +118,32 @@ struct HasScrollViewer
DismissAllPopups(uielem.XamlRoot());
}
}
// Finds the element with the given name and brings it into view
void BringIntoViewWhenLoaded(const winrt::hstring elementName)
{
if (elementName.empty())
{
return;
}
auto* pThis = static_cast<T*>(this);
_loadedRevoker = pThis->Loaded(winrt::auto_revoke, [weakThis{ pThis->get_weak() }, elementName](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
if (const auto& controlToFocus{ page->FindName(elementName).try_as<winrt::Windows::UI::Xaml::Controls::Control>() })
{
// We need to wait for the page to be loaded
// or else the call to StartBringIntoView()
// will end up doing nothing
controlToFocus.StartBringIntoView();
controlToFocus.Focus(winrt::Windows::UI::Xaml::FocusState::Programmatic);
}
page->_loadedRevoker.revoke();
}
});
}
protected:
winrt::Windows::UI::Xaml::FrameworkElement::Loaded_revoker _loadedRevoker;
};

View File

@@ -60,9 +60,8 @@ namespace winrt
namespace WARC = ::winrt::Windows::ApplicationModel::Resources::Core;
}
// Like RS_ and RS_fmt, but they use an ambient boolean named "localized" to
// determine whether to load the English version of a resource or the localized
// one.
// Like RS_ and RS_fmt, but they use an ambient context to determine
// whether to load the English version of a resource or the localized one.
#define RS_switchable_(x) RS_switchable_impl(context, USES_RESOURCE(x))
#define RS_switchable_fmt(x, ...) RS_switchable_fmt_impl(context, USES_RESOURCE(x), __VA_ARGS__)

View File

@@ -307,7 +307,7 @@ protected: \
#define SPLIT_PANE_ARGS(X) \
X(Model::SplitDirection, SplitDirection, "split", false, ArgTypeHint::None, SplitDirection::Automatic) \
X(SplitType, SplitMode, "splitMode", false, ArgTypeHint::None, SplitType::Manual) \
X(float, SplitSize, "size", false, ArgTypeHint::None, 0.5f)
X(float, SplitSize, "size", false, ArgTypeHint::SplitSize, 0.5f)
////////////////////////////////////////////////////////////////////////////////

View File

@@ -10,7 +10,8 @@ namespace Microsoft.Terminal.Settings.Model
None = 0,
FilePath,
FolderPath,
ColorScheme
ColorScheme,
SplitSize
};
struct ArgDescriptor

View File

@@ -239,7 +239,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
if (!_name.has_value() || _name->name != value)
{
_name = CommandNameOrResource{ .name = std::wstring{ value } };
if (value.empty())
{
_name.reset();
}
else
{
_name = CommandNameOrResource{ .name = std::wstring{ value } };
}
}
}

View File

@@ -253,6 +253,39 @@ private:
static winrt::Windows::UI::Xaml::DependencyProperty _##name##Property;
#endif
#ifndef ATTACHED_DEPENDENCY_PROPERTY
#define ATTACHED_DEPENDENCY_PROPERTY(type, name) \
public: \
static winrt::Windows::UI::Xaml::DependencyProperty name##Property() \
{ \
return _##name##Property; \
} \
static type Get##name(winrt::Windows::UI::Xaml::DependencyObject const& target) \
{ \
auto&& temp{ target.GetValue(_##name##Property) }; \
if (temp) \
{ \
return winrt::unbox_value<type>(temp); \
} \
\
if constexpr (std::is_base_of_v<winrt::Windows::Foundation::IInspectable, type>) \
{ \
return { nullptr }; \
} \
else \
{ \
return {}; \
} \
} \
static void Set##name(winrt::Windows::UI::Xaml::DependencyObject const& target, const type& value) \
{ \
target.SetValue(_##name##Property, winrt::box_value(value)); \
} \
\
private: \
static winrt::Windows::UI::Xaml::DependencyProperty _##name##Property;
#endif
// Use this macro for quickly defining the factory_implementation part of a
// class. CppWinrt requires these for the compiler, but more often than not,
// they require no customization. See

View File

@@ -0,0 +1,583 @@
<#
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
.SYNOPSIS
Scans XAML files for local:SettingContainer entries and generates GeneratedSettingsIndex.g.h / .g.cpp.
.PARAMETER SourceDir
Directory to scan recursively for .xaml files.
.PARAMETER OutputDir
Directory to place generated C++ files.
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)][string]$SourceDir,
[Parameter(Mandatory=$false)][string]$OutputDir
)
# Prohibited UIDs (exact match, case-insensitive by default)
$ProhibitedUids = @(
'Extensions_Scope',
'Profile_MissingFontFaces',
'Profile_ProportionalFontFaces',
'ColorScheme_InboxSchemeDuplicate',
'ColorScheme_ColorsHeader',
'ColorScheme_Rename'
)
# Prohibited XAML files
$ProhibitedXamlFiles = @(
'CommonResources.xaml',
'KeyChordListener.xaml',
'NullableColorPicker.xaml',
'SettingContainerStyle.xaml',
'AISettings.xaml'
)
if (-not (Test-Path $SourceDir)) { throw "SourceDir not found: $SourceDir" }
if (-not (Test-Path $OutputDir)) { New-Item -ItemType Directory -Path $OutputDir | Out-Null }
$resourceKeys = ([xml](Get-Content "$($SourceDir)\Resources\en-US\Resources.resw")).root.data.name
$entries = @()
Get-ChildItem -Path $SourceDir -Recurse -Filter *.xaml | ForEach-Object {
# Skip whole file if prohibited
$filename = $_.Name
if ($ProhibitedXamlFiles -contains $filename)
{
return
}
$text = Get-Content -Raw -LiteralPath $_.FullName
# Extract Page x:Class
$pageClass = $null
if ($text -match '<Page\b[^>]*\bx:Class="([^"]+)"')
{
$pageClass = $matches[1]
}
elseif ($filename -eq 'Appearances.xaml')
{
# Appearances.xaml is a UserControl that is hosted in Profiles_Appearance.xaml
$pageClass = 'Microsoft::Terminal::Settings::Editor::Profiles_Appearance'
}
else
{
return
}
# Convert XAML namespace dots to C++ scope operators
$pageClass = ($pageClass -replace '\.', '::')
# Deduce BreadcrumbSubPage
# Special cases:
# - NewTabMenu: defer to UID, see NavigationParam section below
# - Extensions: defer to UID, see NavigationParam section below
$subPage = 'BreadcrumbSubPage::'
if ($pageClass -match 'Editor::Profiles_Appearance')
{
$subPage += 'Profile_Appearance'
}
elseif ($pageClass -match 'Editor::Profiles_Terminal')
{
$subPage += 'Profile_Terminal'
}
elseif ($pageClass -match 'Editor::Profiles_Advanced')
{
$subPage += 'Profile_Advanced'
}
elseif ($pageClass -match 'Editor::EditColorScheme')
{
$subPage += 'ColorSchemes_Edit'
}
else
{
$subPage += 'None'
}
# Register top-level pages
if ($filename -eq 'Launch.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Launch/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Launch/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Launch_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'Interaction.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Interaction/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Interaction/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Interaction_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'GlobalAppearance.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Appearance/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Appearance/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"GlobalAppearance_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'ColorSchemes.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_ColorSchemes/Content`""
DisplayTextLocalized = "RS_(L`"Nav_ColorSchemes/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
# Manually register the "add new" button
$entries += [pscustomobject]@{
DisplayTextUid = "L`"ColorScheme_AddNewButton/Text`""
DisplayTextLocalized = 'RS_(L"ColorScheme_AddNewButton/Text")'
HelpTextUid = 'std::nullopt'
HelpTextLocalized = 'std::nullopt'
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"ColorSchemes_Nav`"})"
SubPage = 'BreadcrumbSubPage::None'
ElementName = 'L"AddNewButton"'
File = $filename
}
}
elseif ($filename -eq 'Rendering.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Rendering/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Rendering/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Rendering_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'Compatibility.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Compatibility/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Compatibility/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Compatibility_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'Actions.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Actions/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Actions/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Actions_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'NewTabMenu.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_NewTabMenu/Content`""
DisplayTextLocalized = "RS_(L`"Nav_NewTabMenu/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"NewTabMenu_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'Extensions.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_Extensions/Content`""
DisplayTextLocalized = "RS_(L`"Nav_Extensions/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"Extensions_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'Profiles_Base.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_ProfileDefaults/Content`""
DisplayTextLocalized = "RS_(L`"Nav_ProfileDefaults/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"GlobalProfile_Nav`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
}
elseif ($filename -eq 'AddProfile.xaml')
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"Nav_AddNewProfile/Content`""
DisplayTextLocalized = "RS_(L`"Nav_AddNewProfile/Content`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"AddProfile`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L""'
File = $filename
}
$entries += [pscustomobject]@{
DisplayTextUid = "L`"AddProfile_AddNewTextBlock/Text`""
DisplayTextLocalized = "RS_(L`"AddProfile_AddNewTextBlock/Text`")"
HelpTextUid = "std::nullopt"
HelpTextLocalized = "std::nullopt"
ParentPage = $pageClass
NavigationParam = "winrt::box_value(hstring{L`"AddProfile`"})"
SubPage = "BreadcrumbSubPage::None"
ElementName = 'L"AddNewButton"'
File = $filename
}
}
# Find all local:SettingContainer start tags
$pattern = '<local:SettingContainer\b([^>/]*)(/?>)'
$matchesAll = [System.Text.RegularExpressions.Regex]::Matches($text, $pattern, 'IgnoreCase')
foreach ($m in $matchesAll)
{
$attrBlock = $m.Groups[1].Value
# Extract Uid
if ($attrBlock -match '\bx:Uid="([^"]+)"')
{
$uid = $matches[1]
# Skip entry if UID prohibited
if ($ProhibitedUids -contains $uid)
{
continue
}
}
else
{
continue
}
# Extract Name
if ($attrBlock -match '\bx:Name="([^"]+)"')
{
$name = $matches[1]
}
elseif ($attrBlock -match '\bName="([^"]+)"')
{
$name = $matches[1]
}
else
{
$name = ""
}
# Profile.Appearance settings need a special prefix for the ElementName.
# This allows us to bring the element into view at runtime.
if ($filename -eq 'Appearances.xaml')
{
$name = 'App.' + $name
}
# Deduce NavigationParam
# duplicateForVM is used to duplicate the entry if we need a VM param at runtime (i.e. profile vs global profile)
$duplicateForVM = $false
$navigationParam = 'nullptr'
if ($pageClass -match 'Editor::Launch')
{
$navigationParam = 'Launch_Nav'
}
elseif ($pageClass -match 'Editor::Interaction')
{
$navigationParam = 'Interaction_Nav'
}
elseif ($pageClass -match 'Editor::Rendering')
{
$navigationParam = 'Rendering_Nav'
}
elseif ($pageClass -match 'Editor::Compatibility')
{
$navigationParam = 'Compatibility_Nav'
}
elseif ($pageClass -match 'Editor::Actions')
{
$navigationParam = 'Actions_Nav'
}
elseif ($pageClass -match 'Editor::NewTabMenu')
{
if ($uid -match 'NewTabMenu_CurrentFolder')
{
$navigationParam = 'nullptr'
$subPage = 'BreadcrumbSubPage::NewTabMenu_Folder'
}
else
{
$navigationParam = 'NewTabMenu_Nav'
$subPage = 'BreadcrumbSubPage::None'
$duplicateForVM = $true
}
}
elseif ($pageClass -match 'Editor::Extensions')
{
$navigationParam = 'Extensions_Nav'
$subPage = 'BreadcrumbSubPage::None'
}
elseif ($pageClass -match 'Editor::Profiles_Base' -or
$pageClass -match 'Editor::Profiles_Appearance' -or
$pageClass -match 'Editor::Profiles_Terminal' -or
$pageClass -match 'Editor::Profiles_Advanced')
{
$navigationParam = 'GlobalProfile_Nav'
$duplicateForVM = $true
}
elseif ($pageClass -match 'Editor::EditColorScheme')
{
# populate with color scheme name at runtime
$navigationParam = 'nullptr'
}
elseif ($pageClass -match 'Editor::GlobalAppearance')
{
$navigationParam = 'GlobalAppearance_Nav'
}
elseif ($pageClass -match 'Editor::AddProfile')
{
$navigationParam = 'AddProfile'
}
$entries += [pscustomobject]@{
DisplayTextUid = "L`"$($uid)/Header`""
DisplayTextLocalized = "RS_(L`"$($uid)/Header`")"
HelpTextUid = $resourceKeys -contains "$($uid).HelpText" ? "std::optional<hstring>{ L`"$($uid)/HelpText`" }" : "std::nullopt"
HelpTextLocalized = $resourceKeys -contains "$($uid).HelpText" ? "std::optional<hstring>{ RS_(L`"$($uid)/HelpText`") }" : "std::nullopt"
ParentPage = $pageClass
NavigationParam = $navigationParam -eq "nullptr" ? $navigationParam : "winrt::box_value(hstring{L`"$($navigationParam)`"})"
SubPage = $subPage
ElementName = "L`"$($name)`""
File = $filename
}
# Duplicate entry for VM param if needed
if ($duplicateForVM)
{
$entries += [pscustomobject]@{
DisplayTextUid = "L`"$($uid)/Header`""
DisplayTextLocalized = "RS_(L`"$($uid)/Header`")"
HelpTextUid = $resourceKeys -contains "$($uid).HelpText" ? "std::optional<hstring>{ L`"$($uid)/HelpText`" }" : "std::nullopt"
HelpTextLocalized = $resourceKeys -contains "$($uid).HelpText" ? "std::optional<hstring>{ RS_(L`"$($uid)/HelpText`") }" : "std::nullopt"
ParentPage = $pageClass
NavigationParam = 'nullptr' # VM param at runtime
SubPage = $navigationParam -eq 'NewTabMenu_Nav' ? 'BreadcrumbSubPage::NewTabMenu_Folder' : $subPage
ElementName = "L`"$($name)`""
File = $filename
}
}
}
}
# Ensure there aren't any duplicate entries
$entries = $entries | Sort-Object DisplayTextLocalized, HelpTextLocalized, ParentPage, NavigationParam, SubPage, ElementName, File -Unique
$buildTimeEntries = @()
$profileEntries = @()
$schemeEntries = @()
$ntmEntries = @()
foreach ($e in $entries)
{
$formattedEntry = " IndexEntry{ $($e.DisplayTextUid), $($e.DisplayTextLocalized), $($e.HelpTextUid), $($e.HelpTextLocalized), $($e.NavigationParam), $($e.SubPage), $($e.ElementName) }, // $($e.File)"
if ($e.NavigationParam -eq 'nullptr' -and
($e.ParentPage -match 'Profiles_Base' -or
$e.ParentPage -match 'Profiles_Appearance' -or
$e.ParentPage -match 'Profiles_Terminal' -or
$e.ParentPage -match 'Profiles_Advanced'))
{
$profileEntries += $formattedEntry
}
elseif ($e.SubPage -eq 'BreadcrumbSubPage::ColorSchemes_Edit')
{
$schemeEntries += $formattedEntry
}
elseif ($e.SubPage -eq 'BreadcrumbSubPage::NewTabMenu_Folder')
{
$ntmEntries += $formattedEntry
}
else
{
$buildTimeEntries += $formattedEntry
}
}
$headerPath = Join-Path $OutputDir 'GeneratedSettingsIndex.g.h'
$cppPath = Join-Path $OutputDir 'GeneratedSettingsIndex.g.cpp'
$header = @"
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
--*/
#pragma once
#include <winrt/Windows.UI.Xaml.Interop.h>
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct IndexEntry
{
// x:Uid of the SettingContainer's Header (i.e. "Globals_DefaultProfile/Header")
hstring DisplayTextUid;
// Localized display text shown in the SettingContainer (i.e. RS_(L"Globals_DefaultProfile/Header"))
hstring DisplayTextLocalized;
// x:Uid of the SettingContainer's HelpText (i.e. "Globals_DefaultProfile/HelpText")
// May not exist for all entries
std::optional<hstring> HelpTextUid;
// Localized help text shown in the SettingContainer (i.e. RS_(L"Globals_DefaultProfile/HelpText"))
// May not exist for all entries
std::optional<hstring> HelpTextLocalized;
// Navigation argument (i.e. winrt::box_value(hstring) or nullptr)
// Use nullptr as placeholder for runtime navigation with a view model object
winrt::Windows::Foundation::IInspectable NavigationArg;
BreadcrumbSubPage SubPage;
// x:Name of the SettingContainer to navigate to on the page (i.e. "DefaultProfile")
hstring ElementName;
};
const std::array<IndexEntry, $($buildTimeEntries.Count)>& LoadBuildTimeIndex();
const std::array<IndexEntry, $($profileEntries.Count)>& LoadProfileIndex();
const std::array<IndexEntry, $($ntmEntries.Count)>& LoadNTMFolderIndex();
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex();
const IndexEntry& PartialProfileIndexEntry();
const IndexEntry& PartialNTMFolderIndexEntry();
const IndexEntry& PartialColorSchemeIndexEntry();
const IndexEntry& PartialExtensionIndexEntry();
}
"@
$cpp = @"
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include <winrt/Microsoft.Terminal.Settings.Editor.h>
#include "GeneratedSettingsIndex.g.h"
#include <LibraryResources.h>
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
const std::array<IndexEntry, $($buildTimeEntries.Count)>& LoadBuildTimeIndex()
{
static std::array<IndexEntry, $($buildTimeEntries.Count)> entries =
{
$( ($buildTimeEntries -join "`r`n") )
};
return entries;
}
const std::array<IndexEntry, $($profileEntries.Count)>& LoadProfileIndex()
{
static std::array<IndexEntry, $($profileEntries.Count)> entries =
{
$( ($profileEntries -join "`r`n") )
};
return entries;
}
const std::array<IndexEntry, $($ntmEntries.Count)>& LoadNTMFolderIndex()
{
static std::array<IndexEntry, $($ntmEntries.Count)> entries =
{
$( ($ntmEntries -join "`r`n") )
};
return entries;
}
const std::array<IndexEntry, $($schemeEntries.Count)>& LoadColorSchemeIndex()
{
static std::array<IndexEntry, $($schemeEntries.Count)> entries =
{
$( ($schemeEntries -join "`r`n") )
};
return entries;
}
const IndexEntry& PartialProfileIndexEntry()
{
static IndexEntry entry{ L"", L"", std::nullopt, std::nullopt, nullptr, BreadcrumbSubPage::None, L"" };
return entry;
}
const IndexEntry& PartialNTMFolderIndexEntry()
{
static IndexEntry entry{ L"", L"", std::nullopt, std::nullopt, nullptr, BreadcrumbSubPage::NewTabMenu_Folder, L"" };
return entry;
}
const IndexEntry& PartialColorSchemeIndexEntry()
{
static IndexEntry entry{ L"", L"", std::nullopt, std::nullopt, nullptr, BreadcrumbSubPage::ColorSchemes_Edit, L"" };
return entry;
}
const IndexEntry& PartialExtensionIndexEntry()
{
static IndexEntry entry{ L"", L"", std::nullopt, std::nullopt, nullptr, BreadcrumbSubPage::Extensions_Extension, L"" };
return entry;
}
}
"@
Set-Content -LiteralPath $headerPath -Value $header -NoNewline
Set-Content -LiteralPath $cppPath -Value $cpp -NoNewline
Write-Host "Generated:"
Write-Host " $headerPath"
Write-Host " $cppPath"