Skip to content

Commit

Permalink
Fix/clean do not take all document (#22)
Browse files Browse the repository at this point in the history
* Clean Now take all document

* Update deisng of regex management

Co-authored-by: arnaud7394 <marcille.arnaud@gmail.com>
  • Loading branch information
ArnaudMarcille and Rowtips authored Sep 6, 2022
1 parent a6f228d commit b48f667
Show file tree
Hide file tree
Showing 8 changed files with 348 additions and 134 deletions.
7 changes: 7 additions & 0 deletions EmptyLineExtension22/EmptyLineExtension22.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
<Compile Include="Options\OptionPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Options\RegexItem.xaml.cs">
<DependentUpon>RegexItem.xaml</DependentUpon>
</Compile>
<Compile Include="Options\Ressources\Command.cs" />
<Compile Include="Options\Ressources\MoveEnum.cs" />
<Compile Include="Options\Ressources\MoveEventArgs.cs" />
Expand Down Expand Up @@ -145,6 +148,10 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Page Include="Options\RegexItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Options\SettingsControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
65 changes: 59 additions & 6 deletions EmptyLineExtension22/Localization/Labels.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 21 additions & 4 deletions EmptyLineExtension22/Localization/Labels.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="SettingsControl_AddNewRegex" xml:space="preserve">
<value>Add new regex rule</value>
</data>
<data name="SettingsControl_AllowedLines" xml:space="preserve">
<value>Allowed lines (default is 1) :</value>
</data>
<data name="SettingsControl_AllowedLinesDesc" xml:space="preserve">
<value>Above, you can set the number of tolerated lines, if you want no line, just set it to 0. The default value is setted to 1, if you didn't set any value, the default value will be taken.
Below, you can set the regex requests for your specific cases, if there is multiple match, the last one in the list will be taken.</value>
<value>You can set the number of tolerated lines, if you want no line, just set it to 0. The default value is setted to 1, if you didn't set any value, the default value will be taken.</value>
</data>
<data name="SettingsControl_ApplyLabel" xml:space="preserve">
<value>Apply</value>
Expand All @@ -136,12 +138,27 @@ Below, you can set the regex requests for your specific cases, if there is multi
<data name="SettingsControl_IgnoreFirstLinesContent" xml:space="preserve">
<value>Delete all line at the start of the file</value>
</data>
<data name="SettingsControl_RegexLabel" xml:space="preserve">
<data name="SettingsControl_MoveDown" xml:space="preserve">
<value>Down</value>
</data>
<data name="SettingsControl_MoveUp" xml:space="preserve">
<value>Up</value>
</data>
<data name="SettingsControl_RegexDesc" xml:space="preserve">
<value>You can set the regex requests for your specific cases, if there is multiple match, the last one in the list will be taken.</value>
</data>
<data name="SettingsControl_RegexGridContent" xml:space="preserve">
<value>Regex</value>
</data>
<data name="SettingsControl_ValueLabel" xml:space="preserve">
<data name="SettingsControl_RegexGridRemove" xml:space="preserve">
<value>Remove</value>
</data>
<data name="SettingsControl_RegexGridValue" xml:space="preserve">
<value>Allowed lines</value>
</data>
<data name="SettingsControl_RegexLabel" xml:space="preserve">
<value>Regex</value>
</data>
<data name="Undo_Removed" xml:space="preserve">
<value>Remove empty lines</value>
</data>
Expand Down
99 changes: 99 additions & 0 deletions EmptyLineExtension22/Options/RegexItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<UserControl
x:Class="EmptyLineExtension22.Options.RegexItem"
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="clr-namespace:EmptyLineExtension22.Options"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="40"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*" />
<ColumnDefinition Width="4*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Separator Grid.ColumnSpan="5" IsTabStop="False" />
<TextBox
Grid.Row="1"
Grid.Column="0"
Margin="8,0,8,0"
VerticalAlignment="Center"
Text="{Binding Key}" />
<TextBox
x:Name="tbx_AllowedLines"
Grid.Row="1"
Grid.Column="1"
Margin="8,0,8,0"
VerticalAlignment="Center"
PreviewTextInput="tbx_AllowedLines_PreviewTextInput"
Text="{Binding Value}" />

<Button
Grid.Row="1"
Grid.Column="2"
Margin="8,0,8,0"
Command="{Binding UpCommand}"
Cursor="Hand"
IsTabStop="False"
Visibility="{Binding IsVisible, Converter={StaticResource BooleanToVisibility}}">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Path
Width="15"
Height="15"
Data="M263.169,3.051c-2.015-1.976-4.73-3.073-7.552-3.051l0,0c-2.834,0.001-5.551,1.129-7.552,3.136 L35.286,216.555c-4.112,4.218-4.026,10.972,0.192,15.084c1.971,1.921,4.608,3.006,7.36,3.028h117.333v266.667 c0,5.891,4.776,10.667,10.667,10.667h170.667c5.891,0,10.667-4.776,10.667-10.667V234.667h116.885 c5.891,0.011,10.675-4.757,10.686-10.648c0.005-2.84-1.123-5.565-3.134-7.571L263.169,3.051z"
Fill="Black"
Stretch="Fill" />
</ControlTemplate>
</Button.Template>
</Button>
<Button
Grid.Row="1"
Grid.Column="3"
Margin="8,0,8,0"
Command="{Binding DownCommand}"
Cursor="Hand"
IsTabStop="False"
Visibility="{Binding IsVisible, Converter={StaticResource BooleanToVisibility}}">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Path
Width="15"
Height="15"
Data="M469.205,277.333H352.341V10.667C352.341,4.776,347.566,0,341.675,0H171.008 c-5.891,0-10.667,4.776-10.667,10.667v266.667H43.008c-5.891,0.001-10.666,4.778-10.664,10.669c0.001,2.822,1.12,5.53,3.112,7.528 l212.8,213.504c2.001,2.007,4.718,3.135,7.552,3.136l0,0c2.831,0.005,5.548-1.115,7.552-3.115l213.333-213.504 c4.171-4.16,4.179-10.914,0.019-15.085C474.722,278.472,472.023,277.345,469.205,277.333z"
Fill="Black"
Stretch="Fill" />
</ControlTemplate>
</Button.Template>
</Button>
<Button
Grid.Row="1"
Grid.Column="4"
Margin="5"
Command="{Binding DeleteCommand}"
Cursor="Hand"
IsTabStop="False">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Path
Width="15"
Height="15"
Data="F1 M348.333,348.334z M0,0z M336.559,68.611L231.016,174.165 336.559,279.714C352.258,295.419 352.258,320.859 336.559,336.564 328.715,344.408 318.431,348.333 308.152,348.333 297.856,348.333 287.571,344.414 279.733,336.564L174.167,231.003 68.609,336.563C60.766,344.407 50.481,348.332 40.193,348.332 29.908,348.332 19.63,344.413 11.78,336.563 -3.919,320.865 -3.919,295.424 11.78,279.713L117.32,174.164 11.774,68.611C-3.925,52.912 -3.925,27.466 11.774,11.767 27.47,-3.92 52.901,-3.92 68.603,11.767L174.166,117.321 279.721,11.767C295.426,-3.92 320.86,-3.92 336.553,11.767 352.258,27.466 352.258,52.912 336.559,68.611z"
Fill="Red"
Stretch="Fill" />
</ControlTemplate>
</Button.Template>
</Button>
</Grid>
</UserControl>
36 changes: 36 additions & 0 deletions EmptyLineExtension22/Options/RegexItem.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EmptyLineExtension22.Options
{
/// <summary>
/// Interaction logic for RegexItem.xaml
/// </summary>
public partial class RegexItem : UserControl
{
public RegexItem()
{

InitializeComponent();
}

private void tbx_AllowedLines_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}
}
}
Loading

0 comments on commit b48f667

Please sign in to comment.