mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[PowerRename] Introduce advanced counter functionality (#27895)
This commit is contained in:
@@ -14,6 +14,7 @@ namespace PowerRenameUI
|
||||
ExplorerItemsSource ExplorerItems { get; };
|
||||
Windows.Foundation.Collections.IObservableVector<PatternSnippet> SearchRegExShortcuts { get; };
|
||||
Windows.Foundation.Collections.IObservableVector<PatternSnippet> DateTimeShortcuts { get; };
|
||||
Windows.Foundation.Collections.IObservableVector<PatternSnippet> CounterShortcuts { get; };
|
||||
|
||||
String OriginalCount;
|
||||
String RenamedCount;
|
||||
|
||||
@@ -323,6 +323,8 @@
|
||||
<Flyout x:Name="DateTimeFlyout" ShouldConstrainToRootBounds="False">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="28" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
@@ -364,7 +366,45 @@
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
|
||||
<TextBlock x:Uid="CounterCheatSheet_Title"
|
||||
Margin="0,10,0,0"
|
||||
FontWeight="SemiBold" Grid.Row="2" />
|
||||
<ListView Margin="-4,12,0,0"
|
||||
IsItemClickEnabled="True"
|
||||
ItemClick="DateTimeItemClick"
|
||||
ItemsSource="{x:Bind CounterShortcuts}"
|
||||
SelectionMode="None" Grid.Row="3">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate
|
||||
x:DataType="local:PatternSnippet">
|
||||
<Grid Margin="-10,0,0,0"
|
||||
ColumnSpacing="8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition
|
||||
Width="Auto" />
|
||||
<ColumnDefinition
|
||||
Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Padding="8"
|
||||
HorizontalAlignment="Left"
|
||||
Background="{ThemeResource ButtonBackground}"
|
||||
BorderBrush="{ThemeResource ButtonBorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<TextBlock
|
||||
FontFamily="Consolas"
|
||||
Foreground="{ThemeResource ButtonForeground}"
|
||||
Text="{x:Bind Code}" />
|
||||
</Border>
|
||||
<TextBlock Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
Text="{x:Bind Description}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Flyout>
|
||||
</Button.Flyout>
|
||||
|
||||
@@ -196,6 +196,13 @@ namespace winrt::PowerRenameUI::implementation
|
||||
m_dateTimeShortcuts.Append(winrt::make<PatternSnippet>(L"$ff", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MilliSeconds2D").ValueAsString()));
|
||||
m_dateTimeShortcuts.Append(winrt::make<PatternSnippet>(L"$f", manager.MainResourceMap().GetValue(L"Resources/DateTimeCheatSheet_MilliSeconds1D").ValueAsString()));
|
||||
|
||||
m_CounterShortcuts = winrt::single_threaded_observable_vector<PowerRenameUI::PatternSnippet>();
|
||||
m_CounterShortcuts.Append(winrt::make<PatternSnippet>(L"${}", manager.MainResourceMap().GetValue(L"Resources/CounterCheatSheet_Simple").ValueAsString()));
|
||||
m_CounterShortcuts.Append(winrt::make<PatternSnippet>(L"${start=10}", manager.MainResourceMap().GetValue(L"Resources/CounterCheatSheet_Start").ValueAsString()));
|
||||
m_CounterShortcuts.Append(winrt::make<PatternSnippet>(L"${increment=5}", manager.MainResourceMap().GetValue(L"Resources/CounterCheatSheet_Increment").ValueAsString()));
|
||||
m_CounterShortcuts.Append(winrt::make<PatternSnippet>(L"${padding=8}", manager.MainResourceMap().GetValue(L"Resources/CounterCheatSheet_Padding").ValueAsString()));
|
||||
m_CounterShortcuts.Append(winrt::make<PatternSnippet>(L"${increment=3,padding=4,start=900}", manager.MainResourceMap().GetValue(L"Resources/CounterCheatSheet_Complex").ValueAsString()));
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
listView_ExplorerItems().ApplyTemplate();
|
||||
|
||||
@@ -81,6 +81,8 @@ namespace winrt::PowerRenameUI::implementation
|
||||
PowerRenameUI::ExplorerItemsSource ExplorerItems() { return m_explorerItems; }
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> SearchRegExShortcuts() { return m_searchRegExShortcuts; }
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> DateTimeShortcuts() { return m_dateTimeShortcuts; }
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> CounterShortcuts() { return m_CounterShortcuts; }
|
||||
|
||||
hstring OriginalCount();
|
||||
void OriginalCount(hstring value);
|
||||
hstring RenamedCount();
|
||||
@@ -100,6 +102,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
PowerRenameUI::ExplorerItemsSource m_explorerItems;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> m_searchRegExShortcuts;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> m_dateTimeShortcuts;
|
||||
winrt::Windows::Foundation::Collections::IObservableVector<PowerRenameUI::PatternSnippet> m_CounterShortcuts;
|
||||
|
||||
// Used by PowerRenameManagerEvents
|
||||
HRESULT OnRename(_In_ IPowerRenameItem* renameItem);
|
||||
|
||||
@@ -150,6 +150,24 @@
|
||||
<data name="ReplaceBox.PlaceholderText" xml:space="preserve">
|
||||
<value>Replace with</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Title.Text" xml:space="preserve">
|
||||
<value>Replace using advanced counter syntax.</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Simple" xml:space="preserve">
|
||||
<value>A simple counter that you can use anywhere in a replace string.</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Start" xml:space="preserve">
|
||||
<value>A counter with a customized start value.</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Increment" xml:space="preserve">
|
||||
<value>A counter with a customized increment value.</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Padding" xml:space="preserve">
|
||||
<value>A counter with a customized number of leading padding zeroes.</value>
|
||||
</data>
|
||||
<data name="CounterCheatSheet_Complex" xml:space="preserve">
|
||||
<value>A counter showing multiple customized properties.</value>
|
||||
</data>
|
||||
<data name="DateTimeCheatSheet_Title.Text" xml:space="preserve">
|
||||
<value>Replace using file creation date and time</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user