mirror of
https://github.com/microsoft/terminal.git
synced 2025-12-10 00:48:23 -06:00
Merge remote-tracking branch 'origin/main' into feature/llm
This commit is contained in:
commit
cfd4adee72
@ -152,12 +152,27 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
|
|
||||||
_renderer->SetBackgroundColorChangedCallback([this]() { _rendererBackgroundColorChanged(); });
|
_renderer->SetBackgroundColorChangedCallback([this]() { _rendererBackgroundColorChanged(); });
|
||||||
_renderer->SetFrameColorChangedCallback([this]() { _rendererTabColorChanged(); });
|
_renderer->SetFrameColorChangedCallback([this]() { _rendererTabColorChanged(); });
|
||||||
_renderer->SetRendererEnteredErrorStateCallback([this]() { RendererEnteredErrorState.raise(nullptr, nullptr); });
|
_renderer->SetRendererEnteredErrorStateCallback([this]() { _rendererEnteredErrorState(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateSettings(settings, unfocusedAppearance);
|
UpdateSettings(settings, unfocusedAppearance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ControlCore::_rendererEnteredErrorState()
|
||||||
|
{
|
||||||
|
// The first time the renderer fails out (after all of its own retries), switch it to D2D and WARP
|
||||||
|
// and force it to try again. If it _still_ fails, we can let it halt.
|
||||||
|
if (_renderFailures++ == 0)
|
||||||
|
{
|
||||||
|
const auto lock = _terminal->LockForWriting();
|
||||||
|
_renderEngine->SetGraphicsAPI(parseGraphicsAPI(GraphicsAPI::Direct2D));
|
||||||
|
_renderEngine->SetSoftwareRendering(true);
|
||||||
|
_renderer->EnablePainting();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
RendererEnteredErrorState.raise(nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void ControlCore::_setupDispatcherAndCallbacks()
|
void ControlCore::_setupDispatcherAndCallbacks()
|
||||||
{
|
{
|
||||||
// Get our dispatcher. If we're hosted in-proc with XAML, this will get
|
// Get our dispatcher. If we're hosted in-proc with XAML, this will get
|
||||||
@ -917,6 +932,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
_renderEngine->SetSoftwareRendering(_settings.SoftwareRendering());
|
_renderEngine->SetSoftwareRendering(_settings.SoftwareRendering());
|
||||||
// Inform the renderer of our opacity
|
// Inform the renderer of our opacity
|
||||||
_renderEngine->EnableTransparentBackground(_isBackgroundTransparent());
|
_renderEngine->EnableTransparentBackground(_isBackgroundTransparent());
|
||||||
|
_renderFailures = 0; // We may have changed the engine; reset the failure counter.
|
||||||
|
|
||||||
// Trigger a redraw to repaint the window background and tab colors.
|
// Trigger a redraw to repaint the window background and tab colors.
|
||||||
_renderer->TriggerRedrawAll(true, true);
|
_renderer->TriggerRedrawAll(true, true);
|
||||||
@ -1983,6 +1999,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
{
|
{
|
||||||
// The lock must be held, because it calls into IRenderData which is shared state.
|
// The lock must be held, because it calls into IRenderData which is shared state.
|
||||||
const auto lock = _terminal->LockForWriting();
|
const auto lock = _terminal->LockForWriting();
|
||||||
|
_renderFailures = 0;
|
||||||
_renderer->EnablePainting();
|
_renderer->EnablePainting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -344,6 +344,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
safe_void_coroutine _renderEngineSwapChainChanged(const HANDLE handle);
|
safe_void_coroutine _renderEngineSwapChainChanged(const HANDLE handle);
|
||||||
void _rendererBackgroundColorChanged();
|
void _rendererBackgroundColorChanged();
|
||||||
void _rendererTabColorChanged();
|
void _rendererTabColorChanged();
|
||||||
|
void _rendererEnteredErrorState();
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
void _raiseReadOnlyWarning();
|
void _raiseReadOnlyWarning();
|
||||||
@ -398,6 +399,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
|
|||||||
float _panelWidth{ 0 };
|
float _panelWidth{ 0 };
|
||||||
float _panelHeight{ 0 };
|
float _panelHeight{ 0 };
|
||||||
float _compositionScale{ 0 };
|
float _compositionScale{ 0 };
|
||||||
|
uint8_t _renderFailures{ 0 };
|
||||||
bool _forceCursorVisible = false;
|
bool _forceCursorVisible = false;
|
||||||
|
|
||||||
// Audio stuff.
|
// Audio stuff.
|
||||||
|
|||||||
@ -18,52 +18,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
Automation::AutomationProperties::SetName(AddNewButton(), RS_(L"Actions_AddNewTextBlock/Text"));
|
Automation::AutomationProperties::SetName(AddNewButton(), RS_(L"Actions_AddNewTextBlock/Text"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Automation::Peers::AutomationPeer Actions::OnCreateAutomationPeer()
|
|
||||||
{
|
|
||||||
_ViewModel.OnAutomationPeerAttached();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Actions::OnNavigatedTo(const NavigationEventArgs& e)
|
void Actions::OnNavigatedTo(const NavigationEventArgs& e)
|
||||||
{
|
{
|
||||||
_ViewModel = e.Parameter().as<Editor::ActionsViewModel>();
|
_ViewModel = e.Parameter().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.
|
AddNewButton().Focus(FocusState::Programmatic);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
TraceLoggingWrite(
|
TraceLoggingWrite(
|
||||||
@ -74,9 +39,4 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
|
||||||
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actions::AddNew_Click(const IInspectable& /*sender*/, const RoutedEventArgs& /*eventArgs*/)
|
|
||||||
{
|
|
||||||
_ViewModel.AddNewKeybinding();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,12 +16,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
Actions();
|
Actions();
|
||||||
|
|
||||||
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
|
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;
|
til::property_changed_event PropertyChanged;
|
||||||
WINRT_OBSERVABLE_PROPERTY(Editor::ActionsViewModel, ViewModel, PropertyChanged.raise, nullptr);
|
WINRT_OBSERVABLE_PROPERTY(Editor::ActionsViewModel, ViewModel, PropertyChanged.raise, nullptr);
|
||||||
|
|
||||||
|
private:
|
||||||
|
winrt::Windows::UI::Xaml::FrameworkElement::LayoutUpdated_revoker _layoutUpdatedRevoker;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -123,7 +123,7 @@
|
|||||||
<Style x:Key="KeyBindingContainerStyle"
|
<Style x:Key="KeyBindingContainerStyle"
|
||||||
BasedOn="{StaticResource DefaultListViewItemStyle}"
|
BasedOn="{StaticResource DefaultListViewItemStyle}"
|
||||||
TargetType="ListViewItem">
|
TargetType="ListViewItem">
|
||||||
<Setter Property="Padding" Value="4" />
|
<Setter Property="Padding" Value="12,4,4,4" />
|
||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||||
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
|
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
|
||||||
</Style>
|
</Style>
|
||||||
@ -138,24 +138,6 @@
|
|||||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
</Style>
|
</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. -->
|
<!-- Converters & Misc. -->
|
||||||
<SolidColorBrush x:Key="ActionContainerBackgroundEditing"
|
<SolidColorBrush x:Key="ActionContainerBackgroundEditing"
|
||||||
@ -164,15 +146,9 @@
|
|||||||
Color="Transparent" />
|
Color="Transparent" />
|
||||||
|
|
||||||
<!-- Templates -->
|
<!-- Templates -->
|
||||||
<DataTemplate x:Key="KeyBindingTemplate"
|
<DataTemplate x:Key="CommandTemplate"
|
||||||
x:DataType="local:KeyBindingViewModel">
|
x:DataType="local:CommandViewModel">
|
||||||
<ListViewItem AutomationProperties.AcceleratorKey="{x:Bind KeyChordText, Mode=OneWay}"
|
<ListViewItem AutomationProperties.Name="{x:Bind DisplayNameAndKeyChordAutomationPropName, 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}"
|
|
||||||
Style="{StaticResource KeyBindingContainerStyle}">
|
Style="{StaticResource KeyBindingContainerStyle}">
|
||||||
<Grid ColumnSpacing="8">
|
<Grid ColumnSpacing="8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -180,146 +156,25 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<!-- key chord -->
|
<!-- key chord -->
|
||||||
<ColumnDefinition Width="auto" />
|
<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>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- Command Name -->
|
<!-- Command Name -->
|
||||||
<TextBlock Grid.Column="0"
|
<TextBlock Grid.Column="0"
|
||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
Style="{StaticResource KeyBindingNameTextBlockStyle}"
|
Style="{StaticResource KeyBindingNameTextBlockStyle}"
|
||||||
Text="{x:Bind Name, Mode=OneWay}"
|
Text="{x:Bind DisplayName, 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}" />
|
|
||||||
|
|
||||||
<!-- Key Chord Text -->
|
<!-- Key Chord Text -->
|
||||||
<Border Grid.Column="1"
|
<Border Grid.Column="1"
|
||||||
Padding="2,0,2,0"
|
Padding="8,4,8,4"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{ThemeResource KeyChordBorderStyle}"
|
Style="{ThemeResource KeyChordBorderStyle}"
|
||||||
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}">
|
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(FirstKeyChordText)}">
|
||||||
|
|
||||||
<TextBlock FontSize="14"
|
<TextBlock FontSize="14"
|
||||||
Style="{ThemeResource KeyChordTextBlockStyle}"
|
Style="{ThemeResource KeyChordTextBlockStyle}"
|
||||||
Text="{x:Bind KeyChordText, Mode=OneWay}"
|
Text="{x:Bind FirstKeyChordText, Mode=OneWay}"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
</Border>
|
</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="" />
|
|
||||||
</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="" />
|
|
||||||
</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="" />
|
|
||||||
</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="" />
|
|
||||||
</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>
|
</Grid>
|
||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@ -331,10 +186,14 @@
|
|||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Spacing="8"
|
Spacing="8"
|
||||||
Style="{StaticResource SettingsStackStyle}">
|
Style="{StaticResource SettingsStackStyle}">
|
||||||
|
<HyperlinkButton x:Uid="Actions_Disclaimer"
|
||||||
|
Margin="0"
|
||||||
|
Padding="0"
|
||||||
|
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2341386" />
|
||||||
<!-- Add New Button -->
|
<!-- Add New Button -->
|
||||||
<Button x:Name="AddNewButton"
|
<Button x:Name="AddNewButton"
|
||||||
Margin="0,12,0,0"
|
Margin="0,12,0,0"
|
||||||
Click="AddNew_Click">
|
Click="{x:Bind ViewModel.AddNewCommand}">
|
||||||
<Button.Content>
|
<Button.Content>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<FontIcon FontSize="{StaticResource StandardIconSize}"
|
<FontIcon FontSize="{StaticResource StandardIconSize}"
|
||||||
@ -345,11 +204,13 @@
|
|||||||
</Button.Content>
|
</Button.Content>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Keybindings -->
|
<!-- Commands -->
|
||||||
<ListView x:Name="KeyBindingsListView"
|
<ListView x:Name="CommandsListView"
|
||||||
ItemTemplate="{StaticResource KeyBindingTemplate}"
|
Margin="-8,0,0,0"
|
||||||
ItemsSource="{x:Bind ViewModel.KeyBindingList, Mode=OneWay}"
|
IsItemClickEnabled="True"
|
||||||
SelectionMode="None" />
|
ItemClick="{x:Bind ViewModel.CmdListItemClicked}"
|
||||||
|
ItemTemplate="{StaticResource CommandTemplate}"
|
||||||
|
ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,130 +1,304 @@
|
|||||||
// 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
|
#pragma once
|
||||||
|
|
||||||
#include "ActionsViewModel.g.h"
|
#include "ActionsViewModel.g.h"
|
||||||
#include "KeyBindingViewModel.g.h"
|
#include "NavigateToCommandArgs.g.h"
|
||||||
#include "ModifyKeyBindingEventArgs.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 "Utils.h"
|
||||||
#include "ViewModelHelpers.h"
|
#include "ViewModelHelpers.h"
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
||||||
{
|
{
|
||||||
struct KeyBindingViewModelComparator
|
struct NavigateToCommandArgs : NavigateToCommandArgsT<NavigateToCommandArgs>
|
||||||
{
|
|
||||||
bool operator()(const Editor::KeyBindingViewModel& lhs, const Editor::KeyBindingViewModel& rhs) const
|
|
||||||
{
|
|
||||||
return lhs.Name() < rhs.Name();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ModifyKeyBindingEventArgs : ModifyKeyBindingEventArgsT<ModifyKeyBindingEventArgs>
|
|
||||||
{
|
{
|
||||||
public:
|
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 },
|
_OldKeys{ oldKeys },
|
||||||
_NewKeys{ newKeys },
|
_NewKeys{ newKeys } {}
|
||||||
_OldActionName{ std::move(oldActionName) },
|
|
||||||
_NewActionName{ std::move(newActionName) } {}
|
|
||||||
|
|
||||||
WINRT_PROPERTY(Control::KeyChord, OldKeys, nullptr);
|
WINRT_PROPERTY(Control::KeyChord, OldKeys, nullptr);
|
||||||
WINRT_PROPERTY(Control::KeyChord, NewKeys, 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:
|
public:
|
||||||
KeyBindingViewModel(const Windows::Foundation::Collections::IObservableVector<hstring>& availableActions);
|
CommandViewModel(const winrt::Microsoft::Terminal::Settings::Model::Command& cmd,
|
||||||
KeyBindingViewModel(const Control::KeyChord& keys, const hstring& name, const Windows::Foundation::Collections::IObservableVector<hstring>& availableActions);
|
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; }
|
winrt::hstring DisplayName();
|
||||||
hstring KeyChordText() const { return _KeyChordText; }
|
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;
|
||||||
|
|
||||||
|
template<typename EnumType>
|
||||||
|
void _InitializeEnumListAndValue(
|
||||||
|
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
|
||||||
|
const winrt::hstring& resourceSectionAndType,
|
||||||
|
const winrt::hstring& resourceProperty,
|
||||||
|
const bool nullable);
|
||||||
|
|
||||||
|
template<typename EnumType>
|
||||||
|
void _InitializeFlagListAndValue(
|
||||||
|
const winrt::Windows::Foundation::Collections::IMapView<winrt::hstring, EnumType>& mappings,
|
||||||
|
const winrt::hstring& resourceSectionAndType,
|
||||||
|
const winrt::hstring& resourceProperty,
|
||||||
|
const bool nullable);
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
// UIA Text
|
||||||
hstring EditButtonName() const noexcept;
|
|
||||||
hstring CancelButtonName() const noexcept;
|
hstring CancelButtonName() const noexcept;
|
||||||
hstring AcceptButtonName() const noexcept;
|
hstring AcceptButtonName() const noexcept;
|
||||||
hstring DeleteButtonName() 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, 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(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:
|
public:
|
||||||
til::typed_event<Editor::KeyBindingViewModel, Editor::ModifyKeyBindingEventArgs> ModifyKeyBindingRequested;
|
til::typed_event<Editor::KeyChordViewModel, Terminal::Control::KeyChord> AddKeyChordRequested;
|
||||||
til::typed_event<Editor::KeyBindingViewModel, Terminal::Control::KeyChord> DeleteKeyBindingRequested;
|
til::typed_event<Editor::KeyChordViewModel, Editor::ModifyKeyChordEventArgs> ModifyKeyChordRequested;
|
||||||
til::typed_event<Editor::KeyBindingViewModel, IInspectable> DeleteNewlyAddedKeyBinding;
|
til::typed_event<Editor::KeyChordViewModel, Terminal::Control::KeyChord> DeleteKeyChordRequested;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
hstring _KeyChordText{};
|
Control::KeyChord _currentKeys;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ActionsViewModel : ActionsViewModelT<ActionsViewModel>, ViewModelHelper<ActionsViewModel>
|
struct ActionsViewModel : ActionsViewModelT<ActionsViewModel>, ViewModelHelper<ActionsViewModel>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActionsViewModel(Model::CascadiaSettings settings);
|
ActionsViewModel(Model::CascadiaSettings settings);
|
||||||
|
void UpdateSettings(const Model::CascadiaSettings& settings);
|
||||||
|
void MarkAsVisited();
|
||||||
|
bool DisplayBadge() const noexcept;
|
||||||
|
|
||||||
void OnAutomationPeerAttached();
|
void AddNewCommand();
|
||||||
void AddNewKeybinding();
|
|
||||||
|
|
||||||
til::typed_event<IInspectable, IInspectable> FocusContainer;
|
void CurrentCommand(const Editor::CommandViewModel& newCommand);
|
||||||
til::typed_event<IInspectable, IInspectable> UpdateBackground;
|
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:
|
private:
|
||||||
bool _AutomationPeerAttached{ false };
|
Editor::CommandViewModel _CurrentCommand{ nullptr };
|
||||||
Model::CascadiaSettings _Settings;
|
Model::CascadiaSettings _Settings;
|
||||||
Windows::Foundation::Collections::IObservableVector<hstring> _AvailableActionAndArgs;
|
Windows::Foundation::Collections::IMap<Model::ShortcutAction, winrt::hstring> _AvailableActionsAndNamesMap;
|
||||||
Windows::Foundation::Collections::IMap<hstring, Model::ActionAndArgs> _AvailableActionMap;
|
Windows::Foundation::Collections::IMap<winrt::hstring, Model::ShortcutAction> _NameToActionMap;
|
||||||
|
|
||||||
std::optional<uint32_t> _GetContainerIndexByKeyChord(const Control::KeyChord& keys);
|
void _MakeCommandVMsHelper();
|
||||||
void _RegisterEvents(com_ptr<implementation::KeyBindingViewModel>& kbdVM);
|
void _RegisterCmdVMEvents(com_ptr<implementation::CommandViewModel>& cmdVM);
|
||||||
|
|
||||||
void _KeyBindingViewModelPropertyChangedHandler(const Windows::Foundation::IInspectable& senderVM, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args);
|
void _CmdVMEditRequestedHandler(const Editor::CommandViewModel& senderVM, const IInspectable& args);
|
||||||
void _KeyBindingViewModelDeleteKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const Control::KeyChord& args);
|
void _CmdVMDeleteRequestedHandler(const Editor::CommandViewModel& senderVM, const IInspectable& args);
|
||||||
void _KeyBindingViewModelModifyKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const Editor::ModifyKeyBindingEventArgs& args);
|
void _CmdVMPropagateColorSchemeRequestedHandler(const IInspectable& sender, const Editor::ArgWrapper& wrapper);
|
||||||
void _KeyBindingViewModelDeleteNewlyAddedKeyBindingHandler(const Editor::KeyBindingViewModel& senderVM, const IInspectable& args);
|
void _CmdVMPropagateColorSchemeNamesRequestedHandler(const IInspectable& sender, const Editor::ArgWrapper& wrapper);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,60 +1,186 @@
|
|||||||
// Copyright (c) Microsoft Corporation.
|
// Copyright (c) Microsoft Corporation.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
import "EnumEntry.idl";
|
||||||
|
import "ColorSchemeViewModel.idl";
|
||||||
|
import "MainPage.idl";
|
||||||
|
|
||||||
namespace Microsoft.Terminal.Settings.Editor
|
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 OldKeys { get; };
|
||||||
Microsoft.Terminal.Control.KeyChord NewKeys { 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
|
// 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 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; };
|
String KeyChordText { get; };
|
||||||
|
|
||||||
// UI side
|
// UI side
|
||||||
Boolean ShowEditButton { get; };
|
|
||||||
Boolean IsInEditMode { get; };
|
|
||||||
Boolean IsNewlyAdded { get; };
|
|
||||||
Microsoft.Terminal.Control.KeyChord ProposedKeys;
|
Microsoft.Terminal.Control.KeyChord ProposedKeys;
|
||||||
Object ProposedAction;
|
|
||||||
Windows.UI.Xaml.Controls.Flyout AcceptChangesFlyout;
|
Windows.UI.Xaml.Controls.Flyout AcceptChangesFlyout;
|
||||||
String EditButtonName { get; };
|
Boolean IsInEditMode { get; };
|
||||||
|
void ToggleEditMode();
|
||||||
|
void AcceptChanges();
|
||||||
|
void CancelChanges();
|
||||||
|
void DeleteKeyChord();
|
||||||
String CancelButtonName { get; };
|
String CancelButtonName { get; };
|
||||||
String AcceptButtonName { get; };
|
String AcceptButtonName { get; };
|
||||||
String DeleteButtonName { get; };
|
String DeleteButtonName { get; };
|
||||||
Windows.UI.Xaml.Media.Brush ContainerBackground { get; };
|
|
||||||
|
|
||||||
void EnterHoverMode();
|
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, Microsoft.Terminal.Control.KeyChord> AddKeyChordRequested;
|
||||||
void ExitHoverMode();
|
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, ModifyKeyChordEventArgs> ModifyKeyChordRequested;
|
||||||
void ActionGotFocus();
|
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, Microsoft.Terminal.Control.KeyChord> DeleteKeyChordRequested;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum ActionsSubPage
|
||||||
|
{
|
||||||
|
Base = 0,
|
||||||
|
Edit = 1
|
||||||
|
};
|
||||||
|
|
||||||
runtimeclass ActionsViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
runtimeclass ActionsViewModel : Windows.UI.Xaml.Data.INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
ActionsViewModel(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
|
ActionsViewModel(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
|
||||||
|
void UpdateSettings(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);
|
||||||
|
|
||||||
void OnAutomationPeerAttached();
|
void AddNewCommand();
|
||||||
void AddNewKeybinding();
|
|
||||||
|
|
||||||
IObservableVector<KeyBindingViewModel> KeyBindingList { get; };
|
ActionsSubPage CurrentPage;
|
||||||
event Windows.Foundation.TypedEventHandler<Object, Object> FocusContainer;
|
Boolean DisplayBadge { get; };
|
||||||
event Windows.Foundation.TypedEventHandler<Object, Object> UpdateBackground;
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/cascadia/TerminalSettingsEditor/ArgsTemplateSelectors.h
Normal file
38
src/cascadia/TerminalSettingsEditor/ArgsTemplateSelectors.h
Normal 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);
|
||||||
|
}
|
||||||
53
src/cascadia/TerminalSettingsEditor/EditAction.cpp
Normal file
53
src/cascadia/TerminalSettingsEditor/EditAction.cpp
Normal 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);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/cascadia/TerminalSettingsEditor/EditAction.h
Normal file
34
src/cascadia/TerminalSettingsEditor/EditAction.h
Normal 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);
|
||||||
|
}
|
||||||
740
src/cascadia/TerminalSettingsEditor/EditAction.xaml
Normal file
740
src/cascadia/TerminalSettingsEditor/EditAction.xaml
Normal 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="" />
|
||||||
|
</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="" />
|
||||||
|
</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="" />
|
||||||
|
</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="" />
|
||||||
|
<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>
|
||||||
@ -17,6 +17,7 @@ Author(s):
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "EnumEntry.g.h"
|
#include "EnumEntry.g.h"
|
||||||
|
#include "FlagEntry.g.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
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
|
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
|
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 },
|
_EnumName{ enumName },
|
||||||
_EnumValue{ enumValue } {}
|
_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()
|
hstring ToString()
|
||||||
{
|
{
|
||||||
return EnumName();
|
return EnumName();
|
||||||
@ -54,5 +60,50 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
til::property_changed_event PropertyChanged;
|
til::property_changed_event PropertyChanged;
|
||||||
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, EnumName, PropertyChanged.raise);
|
WINRT_OBSERVABLE_PROPERTY(winrt::hstring, EnumName, PropertyChanged.raise);
|
||||||
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::Foundation::IInspectable, EnumValue, 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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,5 +7,14 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
{
|
{
|
||||||
String EnumName { get; };
|
String EnumName { get; };
|
||||||
IInspectable EnumValue { 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,6 +116,24 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_actionsVM = winrt::make<ActionsViewModel>(_settingsClone);
|
||||||
|
_actionsViewModelChangedRevoker = _actionsVM.PropertyChanged(winrt::auto_revoke, [=](auto&&, const PropertyChangedEventArgs& args) {
|
||||||
|
const auto settingName{ args.PropertyName() };
|
||||||
|
if (settingName == L"CurrentPage")
|
||||||
|
{
|
||||||
|
if (_actionsVM.CurrentPage() == ActionsSubPage::Edit)
|
||||||
|
{
|
||||||
|
contentFrame().Navigate(xaml_typename<Editor::EditAction>(), winrt::make<implementation::NavigateToCommandArgs>(_actionsVM.CurrentCommand(), *this));
|
||||||
|
const auto crumb = winrt::make<Breadcrumb>(box_value(actionsTag), RS_(L"Nav_EditAction/Content"), BreadcrumbSubPage::Actions_Edit);
|
||||||
|
_breadcrumbs.Append(crumb);
|
||||||
|
}
|
||||||
|
else if (_actionsVM.CurrentPage() == ActionsSubPage::Base)
|
||||||
|
{
|
||||||
|
_Navigate(winrt::hstring{ actionsTag }, BreadcrumbSubPage::None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
auto extensionsVMImpl = winrt::make_self<ExtensionsViewModel>(_settingsClone, _colorSchemesPageVM);
|
auto extensionsVMImpl = winrt::make_self<ExtensionsViewModel>(_settingsClone, _colorSchemesPageVM);
|
||||||
extensionsVMImpl->NavigateToProfileRequested({ this, &MainPage::_NavigateToProfileHandler });
|
extensionsVMImpl->NavigateToProfileRequested({ this, &MainPage::_NavigateToProfileHandler });
|
||||||
extensionsVMImpl->NavigateToColorSchemeRequested({ this, &MainPage::_NavigateToColorSchemeHandler });
|
extensionsVMImpl->NavigateToColorSchemeRequested({ this, &MainPage::_NavigateToColorSchemeHandler });
|
||||||
@ -192,6 +210,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
_InitializeProfilesList();
|
_InitializeProfilesList();
|
||||||
// Update the Nav State with the new version of the settings
|
// Update the Nav State with the new version of the settings
|
||||||
_colorSchemesPageVM.UpdateSettings(_settingsClone);
|
_colorSchemesPageVM.UpdateSettings(_settingsClone);
|
||||||
|
_actionsVM.UpdateSettings(_settingsClone);
|
||||||
_newTabMenuPageVM.UpdateSettings(_settingsClone);
|
_newTabMenuPageVM.UpdateSettings(_settingsClone);
|
||||||
_extensionsVM.UpdateSettings(_settingsClone, _colorSchemesPageVM);
|
_extensionsVM.UpdateSettings(_settingsClone, _colorSchemesPageVM);
|
||||||
|
|
||||||
@ -512,9 +531,14 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
}
|
}
|
||||||
else if (clickedItemTag == actionsTag)
|
else if (clickedItemTag == actionsTag)
|
||||||
{
|
{
|
||||||
contentFrame().Navigate(xaml_typename<Editor::Actions>(), winrt::make<ActionsViewModel>(_settingsClone));
|
|
||||||
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Actions/Content"), BreadcrumbSubPage::None);
|
const auto crumb = winrt::make<Breadcrumb>(box_value(clickedItemTag), RS_(L"Nav_Actions/Content"), BreadcrumbSubPage::None);
|
||||||
_breadcrumbs.Append(crumb);
|
_breadcrumbs.Append(crumb);
|
||||||
|
contentFrame().Navigate(xaml_typename<Editor::Actions>(), _actionsVM);
|
||||||
|
|
||||||
|
if (subPage == BreadcrumbSubPage::Actions_Edit && _actionsVM.CurrentCommand() != nullptr)
|
||||||
|
{
|
||||||
|
_actionsVM.CurrentPage(ActionsSubPage::Edit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (clickedItemTag == newTabMenuTag)
|
else if (clickedItemTag == newTabMenuTag)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -44,6 +44,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
|
|
||||||
Windows::Foundation::Collections::IObservableVector<IInspectable> Breadcrumbs() noexcept;
|
Windows::Foundation::Collections::IObservableVector<IInspectable> Breadcrumbs() noexcept;
|
||||||
Editor::ExtensionsViewModel ExtensionsVM() const noexcept { return _extensionsVM; }
|
Editor::ExtensionsViewModel ExtensionsVM() const noexcept { return _extensionsVM; }
|
||||||
|
Editor::ActionsViewModel ActionsVM() const noexcept { return _actionsVM; }
|
||||||
|
|
||||||
static void RefreshGithubAuthStatus(const winrt::hstring& message);
|
static void RefreshGithubAuthStatus(const winrt::hstring& message);
|
||||||
static winrt::event_token GithubAuthCompleted(const GithubAuthCompletedHandler& handler);
|
static winrt::event_token GithubAuthCompleted(const GithubAuthCompletedHandler& handler);
|
||||||
@ -86,11 +87,13 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
|
|||||||
void _MoveXamlParsedNavItemsIntoItemSource();
|
void _MoveXamlParsedNavItemsIntoItemSource();
|
||||||
|
|
||||||
winrt::Microsoft::Terminal::Settings::Editor::ColorSchemesPageViewModel _colorSchemesPageVM{ 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::NewTabMenuViewModel _newTabMenuPageVM{ nullptr };
|
||||||
winrt::Microsoft::Terminal::Settings::Editor::ExtensionsViewModel _extensionsVM{ nullptr };
|
winrt::Microsoft::Terminal::Settings::Editor::ExtensionsViewModel _extensionsVM{ nullptr };
|
||||||
|
|
||||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _profileViewModelChangedRevoker;
|
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _profileViewModelChangedRevoker;
|
||||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _colorSchemesPageViewModelChangedRevoker;
|
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 _ntmViewModelChangedRevoker;
|
||||||
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _extensionsViewModelChangedRevoker;
|
Windows::UI::Xaml::Data::INotifyPropertyChanged::PropertyChanged_revoker _extensionsViewModelChangedRevoker;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
import "Extensions.idl";
|
import "Extensions.idl";
|
||||||
|
import "ActionsViewModel.idl";
|
||||||
|
|
||||||
namespace Microsoft.Terminal.Settings.Editor
|
namespace Microsoft.Terminal.Settings.Editor
|
||||||
{
|
{
|
||||||
@ -24,6 +25,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
Profile_Terminal,
|
Profile_Terminal,
|
||||||
Profile_Advanced,
|
Profile_Advanced,
|
||||||
ColorSchemes_Edit,
|
ColorSchemes_Edit,
|
||||||
|
Actions_Edit,
|
||||||
NewTabMenu_Folder,
|
NewTabMenu_Folder,
|
||||||
Extensions_Extension
|
Extensions_Extension
|
||||||
};
|
};
|
||||||
@ -50,6 +52,7 @@ namespace Microsoft.Terminal.Settings.Editor
|
|||||||
|
|
||||||
Windows.Foundation.Collections.IObservableVector<IInspectable> Breadcrumbs { get; };
|
Windows.Foundation.Collections.IObservableVector<IInspectable> Breadcrumbs { get; };
|
||||||
ExtensionsViewModel ExtensionsVM { get; };
|
ExtensionsViewModel ExtensionsVM { get; };
|
||||||
|
ActionsViewModel ActionsVM { get; };
|
||||||
|
|
||||||
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };
|
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };
|
||||||
|
|
||||||
|
|||||||
@ -149,6 +149,10 @@
|
|||||||
<muxc:NavigationViewItem.Icon>
|
<muxc:NavigationViewItem.Icon>
|
||||||
<FontIcon Glyph="" />
|
<FontIcon Glyph="" />
|
||||||
</muxc:NavigationViewItem.Icon>
|
</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>
|
||||||
|
|
||||||
<muxc:NavigationViewItem x:Uid="Nav_NewTabMenu"
|
<muxc:NavigationViewItem x:Uid="Nav_NewTabMenu"
|
||||||
|
|||||||
@ -45,6 +45,13 @@
|
|||||||
<ClInclude Include="Actions.h">
|
<ClInclude Include="Actions.h">
|
||||||
<DependentUpon>Actions.xaml</DependentUpon>
|
<DependentUpon>Actions.xaml</DependentUpon>
|
||||||
</ClInclude>
|
</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">
|
<ClInclude Include="AddProfile.h">
|
||||||
<DependentUpon>AddProfile.xaml</DependentUpon>
|
<DependentUpon>AddProfile.xaml</DependentUpon>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -175,6 +182,9 @@
|
|||||||
<Page Include="Actions.xaml">
|
<Page Include="Actions.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="EditAction.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="AddProfile.xaml">
|
<Page Include="AddProfile.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
@ -248,6 +258,13 @@
|
|||||||
<ClCompile Include="Actions.cpp">
|
<ClCompile Include="Actions.cpp">
|
||||||
<DependentUpon>Actions.xaml</DependentUpon>
|
<DependentUpon>Actions.xaml</DependentUpon>
|
||||||
</ClCompile>
|
</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">
|
<ClCompile Include="AddProfile.cpp">
|
||||||
<DependentUpon>AddProfile.xaml</DependentUpon>
|
<DependentUpon>AddProfile.xaml</DependentUpon>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@ -52,6 +52,7 @@
|
|||||||
<Page Include="Appearances.xaml" />
|
<Page Include="Appearances.xaml" />
|
||||||
<Page Include="Rendering.xaml" />
|
<Page Include="Rendering.xaml" />
|
||||||
<Page Include="Actions.xaml" />
|
<Page Include="Actions.xaml" />
|
||||||
|
<Page Include="EditAction.xaml" />
|
||||||
<Page Include="SettingContainerStyle.xaml" />
|
<Page Include="SettingContainerStyle.xaml" />
|
||||||
<Page Include="AddProfile.xaml" />
|
<Page Include="AddProfile.xaml" />
|
||||||
<Page Include="KeyChordListener.xaml" />
|
<Page Include="KeyChordListener.xaml" />
|
||||||
|
|||||||
@ -854,7 +854,11 @@
|
|||||||
</data>
|
</data>
|
||||||
<data name="Nav_Actions.Content" xml:space="preserve">
|
<data name="Nav_Actions.Content" xml:space="preserve">
|
||||||
<value>Actions</value>
|
<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>
|
||||||
<data name="Nav_Extensions.Content" xml:space="preserve">
|
<data name="Nav_Extensions.Content" xml:space="preserve">
|
||||||
<value>Extensions</value>
|
<value>Extensions</value>
|
||||||
@ -1972,6 +1976,42 @@
|
|||||||
<value>Delete the unfocused appearance for this profile.</value>
|
<value>Delete the unfocused appearance for this profile.</value>
|
||||||
<comment>A description for what the delete unfocused appearance button does.</comment>
|
<comment>A description for what the delete unfocused appearance button does.</comment>
|
||||||
</data>
|
</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">
|
<data name="Actions_DeleteConfirmationButton.Content" xml:space="preserve">
|
||||||
<value>Yes, delete key binding</value>
|
<value>Yes, delete key binding</value>
|
||||||
<comment>Button label that confirms deletion of a key binding entry.</comment>
|
<comment>Button label that confirms deletion of a key binding entry.</comment>
|
||||||
@ -1980,6 +2020,14 @@
|
|||||||
<value>Are you sure you want to delete this key binding?</value>
|
<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>
|
<comment>Confirmation message displayed when the user attempts to delete a key binding entry.</comment>
|
||||||
</data>
|
</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">
|
<data name="Actions_InvalidKeyChordMessage" xml:space="preserve">
|
||||||
<value>Invalid key chord. Please enter a valid key chord.</value>
|
<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>
|
<comment>Error message displayed when an invalid key chord is input by the user.</comment>
|
||||||
@ -2024,6 +2072,278 @@
|
|||||||
<value>Action</value>
|
<value>Action</value>
|
||||||
<comment>Label for a control that sets the action of a key binding.</comment>
|
<comment>Label for a control that sets the action of a key binding.</comment>
|
||||||
</data>
|
</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">
|
<data name="KeyChordListener.[using:Windows.UI.Xaml.Automation]AutomationProperties.HelpText" xml:space="preserve">
|
||||||
<value>Input your desired keyboard shortcut.</value>
|
<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>
|
<comment>Help text directing users how to use the "KeyChordListener" control. Pressing a keyboard shortcut will be recorded by this control.</comment>
|
||||||
|
|||||||
@ -9,38 +9,38 @@
|
|||||||
// being its localized name, and also initializes the enum to EnumEntry
|
// being its localized name, and also initializes the enum to EnumEntry
|
||||||
// map that's required to tell XAML what enum value the currently active
|
// map that's required to tell XAML what enum value the currently active
|
||||||
// setting has.
|
// setting has.
|
||||||
#define INITIALIZE_BINDABLE_ENUM_SETTING(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
|
#define INITIALIZE_BINDABLE_ENUM_SETTING(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
|
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
|
||||||
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
|
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
|
||||||
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
|
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
|
||||||
for (auto [key, value] : enumMapping##name) \
|
for (auto [key, value] : enumMapping##name) \
|
||||||
{ \
|
{ \
|
||||||
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
|
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
|
||||||
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value)); \
|
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##List.emplace_back(entry); \
|
||||||
_##name##Map.Insert(value, entry); \
|
_##name##Map.Insert(value, entry); \
|
||||||
} \
|
} \
|
||||||
std::sort(name##List.begin(), name##List.end(), EnumEntryComparator<enumType>()); \
|
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)); \
|
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
|
#define INITIALIZE_BINDABLE_ENUM_SETTING_REVERSE_ORDER(name, enumMappingsName, enumType, resourceSectionAndType, resourceProperty) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
|
std::vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry> name##List; \
|
||||||
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
|
_##name##Map = winrt::single_threaded_map<enumType, winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(); \
|
||||||
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
|
auto enumMapping##name = winrt::Microsoft::Terminal::Settings::Model::EnumMappings::enumMappingsName(); \
|
||||||
for (auto [key, value] : enumMapping##name) \
|
for (auto [key, value] : enumMapping##name) \
|
||||||
{ \
|
{ \
|
||||||
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
|
auto enumName = LocalizedNameForEnumName(resourceSectionAndType, key, resourceProperty); \
|
||||||
auto entry = winrt::make<winrt::Microsoft::Terminal::Settings::Editor::implementation::EnumEntry>(enumName, winrt::box_value<enumType>(value)); \
|
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##List.emplace_back(entry); \
|
||||||
_##name##Map.Insert(value, entry); \
|
_##name##Map.Insert(value, entry); \
|
||||||
} \
|
} \
|
||||||
std::sort(name##List.begin(), name##List.end(), EnumEntryReverseComparator<enumType>()); \
|
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)); \
|
_##name##List = winrt::single_threaded_observable_vector<winrt::Microsoft::Terminal::Settings::Editor::EnumEntry>(std::move(name##List)); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
// This macro must be used alongside INITIALIZE_BINDABLE_ENUM_SETTING.
|
// This macro must be used alongside INITIALIZE_BINDABLE_ENUM_SETTING.
|
||||||
|
|||||||
@ -307,7 +307,7 @@ protected: \
|
|||||||
#define SPLIT_PANE_ARGS(X) \
|
#define SPLIT_PANE_ARGS(X) \
|
||||||
X(Model::SplitDirection, SplitDirection, "split", false, ArgTypeHint::None, SplitDirection::Automatic) \
|
X(Model::SplitDirection, SplitDirection, "split", false, ArgTypeHint::None, SplitDirection::Automatic) \
|
||||||
X(SplitType, SplitMode, "splitMode", false, ArgTypeHint::None, SplitType::Manual) \
|
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)
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
#define HANDLE_URI_ARGS(X) \
|
#define HANDLE_URI_ARGS(X) \
|
||||||
|
|||||||
@ -10,7 +10,8 @@ namespace Microsoft.Terminal.Settings.Model
|
|||||||
None = 0,
|
None = 0,
|
||||||
FilePath,
|
FilePath,
|
||||||
FolderPath,
|
FolderPath,
|
||||||
ColorScheme
|
ColorScheme,
|
||||||
|
SplitSize
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ArgDescriptor
|
struct ArgDescriptor
|
||||||
|
|||||||
@ -238,7 +238,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
|||||||
{
|
{
|
||||||
if (!_name.has_value() || _name->name != value)
|
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 } };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,13 @@
|
|||||||
</alwaysEnabledBrandingTokens>
|
</alwaysEnabledBrandingTokens>
|
||||||
</feature>
|
</feature>
|
||||||
|
|
||||||
|
<feature>
|
||||||
|
<name>Feature_AtlasEngineLoudErrors</name>
|
||||||
|
<description>Atlas Engine can optionally support signaling every presentation failure to its consumer. For now, we only want that to happen in non-Release builds.</description>
|
||||||
|
<stage>AlwaysEnabled</stage>
|
||||||
|
<alwaysDisabledReleaseTokens/>
|
||||||
|
</feature>
|
||||||
|
|
||||||
<feature>
|
<feature>
|
||||||
<name>Feature_NearbyFontLoading</name>
|
<name>Feature_NearbyFontLoading</name>
|
||||||
<description>Controls whether fonts in the same directory as the binary are used during rendering. Disabled for conhost so that it doesn't iterate the entire system32 directory.</description>
|
<description>Controls whether fonts in the same directory as the binary are used during rendering. Disabled for conhost so that it doesn't iterate the entire system32 directory.</description>
|
||||||
|
|||||||
@ -61,13 +61,18 @@ catch (const wil::ResultException& exception)
|
|||||||
return E_PENDING;
|
return E_PENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_p.warningCallback)
|
if constexpr (Feature_AtlasEngineLoudErrors::IsEnabled())
|
||||||
{
|
{
|
||||||
try
|
// We may fail to present repeatedly, e.g. if there's a short-term device failure.
|
||||||
|
// We should not bombard the consumer with repeated warning callbacks (where they may present a dialog to the user).
|
||||||
|
if (_p.warningCallback)
|
||||||
{
|
{
|
||||||
_p.warningCallback(hr, {});
|
try
|
||||||
|
{
|
||||||
|
_p.warningCallback(hr, {});
|
||||||
|
}
|
||||||
|
CATCH_LOG()
|
||||||
}
|
}
|
||||||
CATCH_LOG()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_b.reset();
|
_b.reset();
|
||||||
|
|||||||
@ -12,9 +12,10 @@ using namespace Microsoft::Console::Types;
|
|||||||
using PointTree = interval_tree::IntervalTree<til::point, size_t>;
|
using PointTree = interval_tree::IntervalTree<til::point, size_t>;
|
||||||
|
|
||||||
static constexpr TimerRepr TimerReprMax = std::numeric_limits<TimerRepr>::max();
|
static constexpr TimerRepr TimerReprMax = std::numeric_limits<TimerRepr>::max();
|
||||||
static constexpr DWORD maxRetriesForRenderEngine = 3;
|
// We want there to be five retry periods; after the last one, we will mark the render as failed.
|
||||||
// The renderer will wait this number of milliseconds * how many tries have elapsed before trying again.
|
static constexpr unsigned int maxRetriesForRenderEngine = 5;
|
||||||
static constexpr DWORD renderBackoffBaseTimeMilliseconds = 150;
|
// The renderer will wait this number of milliseconds * 2^tries before trying again.
|
||||||
|
static constexpr DWORD renderBackoffBaseTimeMilliseconds = 100;
|
||||||
|
|
||||||
// Routine Description:
|
// Routine Description:
|
||||||
// - Creates a new renderer controller for a console.
|
// - Creates a new renderer controller for a console.
|
||||||
@ -326,40 +327,44 @@ DWORD Renderer::_timerToMillis(TimerRepr t) noexcept
|
|||||||
// - HRESULT S_OK, GDI error, Safe Math error, or state/argument errors.
|
// - HRESULT S_OK, GDI error, Safe Math error, or state/argument errors.
|
||||||
[[nodiscard]] HRESULT Renderer::PaintFrame()
|
[[nodiscard]] HRESULT Renderer::PaintFrame()
|
||||||
{
|
{
|
||||||
auto tries = maxRetriesForRenderEngine;
|
HRESULT hr{ S_FALSE };
|
||||||
while (tries > 0)
|
// Attempt zero doesn't count as a retry. We should try maxRetries + 1 times.
|
||||||
|
for (unsigned int attempt = 0u; attempt <= maxRetriesForRenderEngine; ++attempt)
|
||||||
{
|
{
|
||||||
|
if (attempt > 0) [[unlikely]]
|
||||||
|
{
|
||||||
|
// Add a bit of backoff.
|
||||||
|
// Sleep 100, 200, 400, 600, 800ms, 1600ms before failing out and disabling the renderer.
|
||||||
|
Sleep(renderBackoffBaseTimeMilliseconds * (1 << (attempt - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
// BODGY: Optimally we would want to retry per engine, but that causes different
|
// BODGY: Optimally we would want to retry per engine, but that causes different
|
||||||
// problems (intermittent inconsistent states between text renderer and UIA output,
|
// problems (intermittent inconsistent states between text renderer and UIA output,
|
||||||
// not being able to lock the cursor location, etc.).
|
// not being able to lock the cursor location, etc.).
|
||||||
const auto hr = _PaintFrame();
|
hr = _PaintFrame();
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_HR_IF(hr, hr != E_PENDING);
|
LOG_HR_IF(hr, hr != E_PENDING);
|
||||||
|
|
||||||
if (--tries == 0)
|
|
||||||
{
|
|
||||||
// Stop trying.
|
|
||||||
_disablePainting();
|
|
||||||
if (_pfnRendererEnteredErrorState)
|
|
||||||
{
|
|
||||||
_pfnRendererEnteredErrorState();
|
|
||||||
}
|
|
||||||
// If there's no callback, we still don't want to FAIL_FAST: the renderer going black
|
|
||||||
// isn't near as bad as the entire application aborting. We're a component. We shouldn't
|
|
||||||
// abort applications that host us.
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add a bit of backoff.
|
|
||||||
// Sleep 150ms, 300ms, 450ms before failing out and disabling the renderer.
|
|
||||||
Sleep(renderBackoffBaseTimeMilliseconds * (maxRetriesForRenderEngine - tries));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
// Stop trying.
|
||||||
|
_disablePainting();
|
||||||
|
if (_pfnRendererEnteredErrorState)
|
||||||
|
{
|
||||||
|
_pfnRendererEnteredErrorState();
|
||||||
|
}
|
||||||
|
// If there's no callback, we still don't want to FAIL_FAST: the renderer going black
|
||||||
|
// isn't near as bad as the entire application aborting. We're a component. We shouldn't
|
||||||
|
// abort applications that host us.
|
||||||
|
hr = S_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] HRESULT Renderer::_PaintFrame() noexcept
|
[[nodiscard]] HRESULT Renderer::_PaintFrame() noexcept
|
||||||
|
|||||||
@ -12,7 +12,11 @@ Handle Handle::Create()
|
|||||||
{
|
{
|
||||||
Handle handle;
|
Handle handle;
|
||||||
handle._impl = new Implementation();
|
handle._impl = new Implementation();
|
||||||
handle._impl->Initialize();
|
if (!handle._impl->Initialize())
|
||||||
|
{
|
||||||
|
delete handle._impl;
|
||||||
|
handle._impl = nullptr;
|
||||||
|
}
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,9 +68,14 @@ void Implementation::SetDefaultScopeAlphanumericHalfWidth(bool enable) noexcept
|
|||||||
s_wantsAnsiInputScope.store(enable, std::memory_order_relaxed);
|
s_wantsAnsiInputScope.store(enable, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::Initialize()
|
bool Implementation::Initialize()
|
||||||
{
|
{
|
||||||
_categoryMgr = wil::CoCreateInstance<ITfCategoryMgr>(CLSID_TF_CategoryMgr, CLSCTX_INPROC_SERVER);
|
_categoryMgr = wil::CoCreateInstanceNoThrow<ITfCategoryMgr>(CLSID_TF_CategoryMgr);
|
||||||
|
if (!_categoryMgr)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_displayAttributeMgr = wil::CoCreateInstance<ITfDisplayAttributeMgr>(CLSID_TF_DisplayAttributeMgr);
|
_displayAttributeMgr = wil::CoCreateInstance<ITfDisplayAttributeMgr>(CLSID_TF_DisplayAttributeMgr);
|
||||||
|
|
||||||
// There's no point in calling TF_GetThreadMgr. ITfThreadMgr is a per-thread singleton.
|
// There's no point in calling TF_GetThreadMgr. ITfThreadMgr is a per-thread singleton.
|
||||||
@ -89,6 +94,7 @@ void Implementation::Initialize()
|
|||||||
THROW_IF_FAILED(_contextSource->AdviseSink(IID_ITfTextEditSink, static_cast<ITfTextEditSink*>(this), &_cookieTextEditSink));
|
THROW_IF_FAILED(_contextSource->AdviseSink(IID_ITfTextEditSink, static_cast<ITfTextEditSink*>(this), &_cookieTextEditSink));
|
||||||
|
|
||||||
THROW_IF_FAILED(_documentMgr->Push(_context.get()));
|
THROW_IF_FAILED(_documentMgr->Push(_context.get()));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::Uninitialize() noexcept
|
void Implementation::Uninitialize() noexcept
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace Microsoft::Console::TSF
|
|||||||
|
|
||||||
virtual ~Implementation() = default;
|
virtual ~Implementation() = default;
|
||||||
|
|
||||||
void Initialize();
|
bool Initialize();
|
||||||
void Uninitialize() noexcept;
|
void Uninitialize() noexcept;
|
||||||
HWND FindWindowOfActiveTSF() noexcept;
|
HWND FindWindowOfActiveTSF() noexcept;
|
||||||
void AssociateFocus(IDataProvider* provider);
|
void AssociateFocus(IDataProvider* provider);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user