Skip to content

Commit 02624f4

Browse files
committed
Some option in C#script text source editor
1 parent e4543e3 commit 02624f4

File tree

2 files changed

+64
-29
lines changed

2 files changed

+64
-29
lines changed

RegexDialog/RegExToolDialog.xaml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -610,24 +610,24 @@
610610
</GroupBox.Resources>
611611
<DockPanel>
612612
<WrapPanel Margin="5" DockPanel.Dock="Top">
613-
<RadioButton x:Name="CurrentTabTextSourceRadioButton"
613+
<RadioButton x:Name="CurrentTabTextSourceRadioButton"
614614
Margin="5,0"
615615
Content="Current _tab"
616616
IsChecked="{Binding TextSourceOn, Converter={converters:EnumBooleanConverter}, ConverterParameter='CurrentTab'}" />
617-
<RadioButton x:Name="CurrentSelectedTextSourceRadioButton"
617+
<RadioButton x:Name="CurrentSelectedTextSourceRadioButton"
618618
Margin="5,0"
619619
Content="Current se_lection"
620620
IsChecked="{Binding TextSourceOn, Converter={converters:EnumBooleanConverter}, ConverterParameter='CurrentSelection'}"/>
621-
<RadioButton x:Name="SpecifiedDirectoryTextSourceRadioButton"
621+
<RadioButton x:Name="SpecifiedDirectoryTextSourceRadioButton"
622622
Margin="5,0"
623623
Content="Specified _directory"
624624
IsChecked="{Binding TextSourceOn, Converter={converters:EnumBooleanConverter}, ConverterParameter='Directory'}"/>
625-
<RadioButton x:Name="CSharpScriptTextSourceRadioButton"
625+
<RadioButton x:Name="CSharpScriptTextSourceRadioButton"
626626
Margin="5,0"
627627
Content="C# _Script"
628628
IsChecked="{Binding TextSourceOn, Converter={converters:EnumBooleanConverter}, ConverterParameter='CSharpScript'}"/>
629629
</WrapPanel>
630-
630+
631631
<StackPanel Margin="5"
632632
DockPanel.Dock="Top"
633633
Visibility="{Binding IsChecked, ElementName=SpecifiedDirectoryTextSourceRadioButton, Converter={converters:CustomBoolToVisibilityConverter}}">
@@ -643,7 +643,7 @@
643643
ItemsSource="{Binding TextSourceDirectoryPathHistory}"
644644
IsEditable="True"/>
645645
</DockPanel>
646-
646+
647647
<Grid Margin="0,5">
648648
<Grid.ColumnDefinitions>
649649
<ColumnDefinition Width="Auto" />
@@ -674,19 +674,50 @@
674674
</StackPanel>
675675
</StackPanel>
676676

677-
<Border BorderBrush="Gray"
678-
BorderThickness="1"
679-
Visibility="{Binding IsChecked, ElementName=CSharpScriptTextSourceRadioButton, Converter={converters:CustomBoolToVisibilityConverter}}">
680-
<avalonEdit:TextEditor
681-
Name="TextSourceEditor"
682-
FontFamily="Consolas"
683-
FontSize="12"
684-
SyntaxHighlighting="C#"
685-
ShowLineNumbers="True"
686-
ScrollViewer.HorizontalScrollBarVisibility="Auto" />
687-
</Border>
677+
<DockPanel Visibility="{Binding IsChecked, ElementName=CSharpScriptTextSourceRadioButton, Converter={converters:CustomBoolToVisibilityConverter}}" >
678+
<WrapPanel DockPanel.Dock="Top">
679+
<WrapPanel.Resources>
680+
<Style BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" TargetType="Button" />
681+
<Style BasedOn="{StaticResource {x:Static ToolBar.ToggleButtonStyleKey}}" TargetType="ToggleButton" />
682+
</WrapPanel.Resources>
683+
<ToggleButton x:Name="ToggleShowLinesNumberInCSharpTextSourceButton"
684+
IsChecked="{Binding ShowLinesNumbersCSharpTextSourceEditorOption}">
685+
<StackPanel Orientation="Horizontal">
686+
<Image Source="{StaticResource ShowLinesNumbers}" Width="16" Height="16" ToolTip="Show/Hide lines numbers"/>
687+
</StackPanel>
688+
</ToggleButton>
689+
<ToggleButton x:Name="ToggleShowSpacesInCSharpTextSourceButton"
690+
IsChecked="{Binding ShowSpaceCharsCSharpTextSourceEditorOption}">
691+
<StackPanel Orientation="Horizontal">
692+
<Image Source="{StaticResource ShowSpaces}" Width="16" Height="16" ToolTip="Show/Hide Spaces and tabulations" />
693+
</StackPanel>
694+
</ToggleButton>
695+
<ToggleButton x:Name="ToggleShowReturnsInCSharpTextSourceButton"
696+
IsChecked="{Binding ShowEndOfLinesCSharpTextSourceEditorOption}">
697+
<StackPanel Orientation="Horizontal">
698+
<Image Source="{StaticResource ShowReturns}" Width="16" Height="16" ToolTip="Show/Hide end of lines" />
699+
</StackPanel>
700+
</ToggleButton>
701+
702+
</WrapPanel>
703+
<Border BorderBrush="Gray"
704+
BorderThickness="1">
705+
<avalonEdit:TextEditor
706+
Name="TextSourceEditor"
707+
FontFamily="Consolas"
708+
FontSize="12"
709+
SyntaxHighlighting="C#"
710+
ShowLineNumbers="{Binding ShowLinesNumbersCSharpTextSourceEditorOption}"
711+
ScrollViewer.HorizontalScrollBarVisibility="Auto" >
712+
<i:Interaction.Behaviors>
713+
<behaviors:SimplePropertyBindingBehavior PropertyName="Options.ShowSpaces" Value="{Binding ShowSpaceCharsCSharpTextSourceEditorOption}" />
714+
<behaviors:SimplePropertyBindingBehavior PropertyName="Options.ShowTabs" Value="{Binding ShowSpaceCharsCSharpTextSourceEditorOption}" />
715+
<behaviors:SimplePropertyBindingBehavior PropertyName="Options.ShowEndOfLine" Value="{Binding ShowEndOfLinesCSharpTextSourceEditorOption}" />
716+
</i:Interaction.Behaviors>
717+
</avalonEdit:TextEditor>
718+
</Border>
719+
</DockPanel>
688720
</DockPanel>
689-
690721
</GroupBox>
691722
</DockPanel>
692723
</TabItem>

RegexDialog/Utils/Config.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public virtual void OnPropertyChanged([CallerMemberName] string propertyName = "
7575

7676
#endregion
7777

78-
private void Init()
78+
private void Init()
7979
{
8080
}
8181

@@ -108,33 +108,37 @@ private void Init()
108108

109109
public ObservableDictionary<string, bool> RegexOptionsSelection { get; set; } = new ObservableDictionary<string, bool>();
110110

111-
public RegexTextSource TextSourceOn { get; set; } = RegexTextSource.CurrentTab;
111+
public RegexTextSource TextSourceOn { get; set; }
112112

113113
public string TextSourceDirectoryPath { get; set; } = string.Empty;
114114
public ObservableCollection<string> TextSourceDirectoryPathHistory { get; set; } = new ObservableCollection<string>();
115115

116116
public string TextSourceDirectorySearchFilter { get; set; } = string.Empty;
117117
public ObservableCollection<string> TextSourceDirectorySearchFilterHistory { get; set; } = new ObservableCollection<string>();
118118

119-
public bool TextSourceDirectorySearchSubDirectories { get; set; } = false;
119+
public bool TextSourceDirectorySearchSubDirectories { get; set; }
120120

121121
public bool TextSourceDirectoryShowNotMatchedFiles { get; set; } = true;
122122

123-
public bool PrintFileNameWhenExtract { get; set; } = false;
123+
public bool PrintFileNameWhenExtract { get; set; }
124124

125125
public bool OpenFilesForReplace { get; set; } = true;
126126

127-
public bool ShowEmptyMatches { get; set; } = false;
127+
public bool ShowEmptyMatches { get; set; }
128128

129129
public bool AutoIndentCharClassesOnOneLine { get; set; } = true;
130130
public bool AutoIndentKeepQuantifiersOnSameLine { get; set; } = true;
131131

132-
public bool ShowLinesNumbersRegexEditorOption { get; set; } = false;
133-
public bool ShowSpaceCharsRegexEditorOption { get; set; } = false;
134-
public bool ShowEndOfLinesRegexEditorOption { get; set; } = false;
132+
public bool ShowLinesNumbersRegexEditorOption { get; set; }
133+
public bool ShowSpaceCharsRegexEditorOption { get; set; }
134+
public bool ShowEndOfLinesRegexEditorOption { get; set; }
135135

136-
public bool ShowLinesNumbersReplaceEditorOption { get; set; } = false;
137-
public bool ShowSpaceCharsReplaceEditorOption { get; set; } = false;
138-
public bool ShowEndOfLinesReplaceEditorOption { get; set; } = false;
136+
public bool ShowLinesNumbersReplaceEditorOption { get; set; }
137+
public bool ShowSpaceCharsReplaceEditorOption { get; set; }
138+
public bool ShowEndOfLinesReplaceEditorOption { get; set; }
139+
140+
public bool ShowLinesNumbersCSharpTextSourceEditorOption { get; set; }
141+
public bool ShowSpaceCharsCSharpTextSourceEditorOption { get; set; }
142+
public bool ShowEndOfLinesCSharpTextSourceEditorOption { get; set; }
139143
}
140144
}

0 commit comments

Comments
 (0)