Skip to content

Commit 7bb10f2

Browse files
split size template
1 parent bbdf75d commit 7bb10f2

File tree

6 files changed

+41
-3
lines changed

6 files changed

+41
-3
lines changed

src/cascadia/TerminalSettingsEditor/ActionsViewModel.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Microsoft.Terminal.Settings.Editor
1616
Windows.UI.Xaml.DataTemplate UInt32Template;
1717
Windows.UI.Xaml.DataTemplate UInt32OptionalTemplate;
1818
Windows.UI.Xaml.DataTemplate FloatTemplate;
19+
Windows.UI.Xaml.DataTemplate SplitSizeTemplate;
1920
Windows.UI.Xaml.DataTemplate StringTemplate;
2021
Windows.UI.Xaml.DataTemplate ColorSchemeTemplate;
2122
Windows.UI.Xaml.DataTemplate FilePickerTemplate;

src/cascadia/TerminalSettingsEditor/ArgsTemplateSelectors.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
2424
lut[] = {
2525
{ L"int32_t", &ArgsTemplateSelectors::Int32Template },
2626
{ L"uint32_t", &ArgsTemplateSelectors::UInt32Template },
27-
{ L"float", &ArgsTemplateSelectors::FloatTemplate },
2827
{ L"bool", &ArgsTemplateSelectors::BoolTemplate },
2928
{ L"Windows::Foundation::IReference<bool>", &ArgsTemplateSelectors::BoolOptionalTemplate },
3029
{ L"Windows::Foundation::IReference<int32_t>", &ArgsTemplateSelectors::Int32OptionalTemplate },
@@ -69,6 +68,17 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
6968
return StringTemplate();
7069
}
7170
}
71+
else if (argType == L"float")
72+
{
73+
const auto argTag = argWrapper.TypeHint();
74+
switch (argTag)
75+
{
76+
case Model::ArgTypeHint::SplitSize:
77+
return SplitSizeTemplate();
78+
default:
79+
return FloatTemplate();
80+
}
81+
}
7282

7383
for (const auto& [type, member] : lut)
7484
{

src/cascadia/TerminalSettingsEditor/ArgsTemplateSelectors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
1818
til::property<winrt::Windows::UI::Xaml::DataTemplate> UInt32Template;
1919
til::property<winrt::Windows::UI::Xaml::DataTemplate> UInt32OptionalTemplate;
2020
til::property<winrt::Windows::UI::Xaml::DataTemplate> FloatTemplate;
21+
til::property<winrt::Windows::UI::Xaml::DataTemplate> SplitSizeTemplate;
2122
til::property<winrt::Windows::UI::Xaml::DataTemplate> StringTemplate;
2223
til::property<winrt::Windows::UI::Xaml::DataTemplate> ColorSchemeTemplate;
2324
til::property<winrt::Windows::UI::Xaml::DataTemplate> FilePickerTemplate;

src/cascadia/TerminalSettingsEditor/EditAction.xaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,30 @@
356356
</Grid>
357357
</DataTemplate>
358358

359+
<!-- Example shortcut action to test this template: Split Pane -->
360+
<DataTemplate x:Key="SplitSizeTemplate"
361+
x:DataType="local:ArgWrapper">
362+
<Grid Margin="0,4,0,4"
363+
ColumnSpacing="8">
364+
<Grid.ColumnDefinitions>
365+
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
366+
<ColumnDefinition Width="Auto" />
367+
</Grid.ColumnDefinitions>
368+
<TextBlock Grid.Column="0"
369+
VerticalAlignment="Center"
370+
Text="{x:Bind Name}"
371+
TextWrapping="WrapWholeWords" />
372+
<muxc:NumberBox Grid.Column="1"
373+
AutomationProperties.Name="{x:Bind Name}"
374+
LargeChange="0.2"
375+
Maximum="1"
376+
Minimum="0"
377+
SmallChange="0.1"
378+
Style="{StaticResource NumberBoxSettingStyle}"
379+
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
380+
</Grid>
381+
</DataTemplate>
382+
359383
<!-- Example shortcut action to test this template: Send Input -->
360384
<DataTemplate x:Key="StringTemplate"
361385
x:DataType="local:ArgWrapper">
@@ -610,6 +634,7 @@
610634
FolderPickerTemplate="{StaticResource FolderPickerTemplate}"
611635
Int32OptionalTemplate="{StaticResource Int32OptionalTemplate}"
612636
Int32Template="{StaticResource Int32Template}"
637+
SplitSizeTemplate="{StaticResource SplitSizeTemplate}"
613638
StringTemplate="{StaticResource StringTemplate}"
614639
TerminalCoreColorOptionalTemplate="{StaticResource TerminalCoreColorOptionalTemplate}"
615640
UInt32OptionalTemplate="{StaticResource UInt32OptionalTemplate}"

src/cascadia/TerminalSettingsModel/ActionArgs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ protected: \
307307
#define SPLIT_PANE_ARGS(X) \
308308
X(Model::SplitDirection, SplitDirection, "split", false, ArgTypeHint::None, SplitDirection::Automatic) \
309309
X(SplitType, SplitMode, "splitMode", false, ArgTypeHint::None, SplitType::Manual) \
310-
X(float, SplitSize, "size", false, ArgTypeHint::None, 0.5f)
310+
X(float, SplitSize, "size", false, ArgTypeHint::SplitSize, 0.5f)
311311

312312
////////////////////////////////////////////////////////////////////////////////
313313

src/cascadia/TerminalSettingsModel/ActionArgs.idl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ namespace Microsoft.Terminal.Settings.Model
1010
None = 0,
1111
FilePath,
1212
FolderPath,
13-
ColorScheme
13+
ColorScheme,
14+
SplitSize
1415
};
1516

1617
struct ArgDescriptor

0 commit comments

Comments
 (0)