-
Notifications
You must be signed in to change notification settings - Fork 0
/
StructFiltersWindow.xaml
268 lines (268 loc) · 13 KB
/
StructFiltersWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<Window
x:Class="NGDartStructFilters.Views.StructFiltersWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:NGDartStructFilters;assembly=NG-DART.StructFilters"
Title="NG-DART Message Type Structure Filters"
d:DataContext="{x:Static vm:StructFilters.designVm}"
d:DesignHeight="450"
d:DesignWidth="700"
SizeToContent="Width"
MinWidth="800"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Background="#F0F0F0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Left">
<TextBlock
Margin="10,5,10,0"
FontSize="14">
<TextBlock.Text>
<MultiBinding StringFormat="Message Type: 0x{0:X4}, {1}">
<Binding Path="MsgType.ID" />
<Binding Path="MsgType.Name" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
<StackPanel
FocusManager.FocusedElement="{Binding ElementName=txtSearch}"
Margin="10,5,10,0"
Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock
Text="Search: " HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox
Name="txtSearch"
Width="200"
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
AcceptsReturn="False"
VerticalAlignment="Center">
<TextBox.InputBindings>
<KeyBinding Command="{Binding SearchEnter}" Key="Enter" />
</TextBox.InputBindings>
</TextBox>
</StackPanel>
</Grid>
<TreeView
x:Name="StructsTreeView"
Grid.Row="1"
Margin="10,10,10,10"
ItemsSource="{Binding Fields}"
>
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Style.Resources>
<!--Highlight the selected item found in search in yellow.-->
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Yellow" />
</Style.Resources>
<Setter Property="Focusable" Value="False" />
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
<EventSetter Event="Selected" Handler="StructsTreeView_SelectedItemChanged" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildFields}">
<StackPanel Orientation="Horizontal">
<StackPanel.ContextMenu>
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}" IsOpen="{Binding IsContextMenuOpen}">
<MenuItem Command="{Binding ContextSelectAll}" Header="{Binding ContextSelectAllHeader}" />
<MenuItem Command="{Binding ContextClearAll}" Header="{Binding ContextClearAllHeader}" />
<MenuItem Command="{Binding ContextCancel}" Header="Cancel" />
</ContextMenu>
</StackPanel.ContextMenu>
<CheckBox
Content="GML "
IsChecked="{Binding IsGml}"
IsEnabled="{Binding GmlImplementedForParent}">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding GmlImplementedForParent}" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
<DataTrigger Binding="{Binding ParentStruct}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
<CheckBox
Content="CML "
IsChecked="{Binding IsCml}"
IsEnabled="{Binding CmlImplementedForParent}" />
<CheckBox
Content="CML Change Field "
IsChecked="{Binding IsCmlChangeField}"
IsEnabled="{Binding CmlChangeFieldImplementedForParent}">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding ParentStruct}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
<CheckBox
Content="CML Entity "
IsChecked="{Binding IsCmlEntity}"
IsEnabled="{Binding CmlEntityImplementedForParent}">
<CheckBox.Style>
<Style TargetType="CheckBox">
<Style.Triggers>
<DataTrigger Binding="{Binding ParentStruct}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</CheckBox.Style>
</CheckBox>
<TextBlock Text="| " />
<TextBlock Text="{Binding Name}" />
<TextBlock Foreground="Blue" Text=" (" />
<TextBlock Foreground="Blue" Text="{Binding Union}" />
<TextBlock Foreground="Blue" Text=": " />
<TextBlock Foreground="Blue" Text="{Binding Type}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding GmlImplementedForStruct}" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Foreground="Blue" Text=") " />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="209*" />
<ColumnDefinition Width="141*" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Margin="0,0,0,10"
HorizontalAlignment="Left"
Orientation="Horizontal" Grid.ColumnSpan="2" Width="553">
<Grid x:Name="SpinnerNumericUpDownControl" Margin="10,0">
<!-- From https://stackoverflow.com/a/21907688/5652483 -->
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="Expand Level: " />
<TextBlock
Grid.Column="1"
MinWidth="14"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="{Binding ExpandLevel}" />
<Grid
x:Name="GridRoot"
Grid.Column="2"
Width="25">
<Grid.RowDefinitions>
<RowDefinition MaxHeight="18" />
<RowDefinition Height="0.00001*" />
<RowDefinition MaxHeight="18" />
</Grid.RowDefinitions>
<RepeatButton Command="{Binding IncreaseExpandLevel}" Focusable="False">
<Grid>
<Path
x:Name="IncreaseArrow"
Data="M 0 4 L 8 4 L 4 0 Z"
Stroke="Blue"
StrokeThickness="1" />
</Grid>
</RepeatButton>
<RepeatButton
Grid.Row="2"
Command="{Binding DecreaseExpandLevel}"
Focusable="False">
<Grid>
<Path
x:Name="DecreaseArrow"
Data="M 0 0 L 4 4 L 8 0 Z"
Stroke="Blue"
StrokeThickness="1" />
</Grid>
</RepeatButton>
</Grid>
</Grid>
<Button
Margin="5,0"
Padding="5,2"
Command="{Binding ExpandAll}"
Content="Expand All" />
<Button
Margin="5,0"
Padding="5,2"
Command="{Binding CollapseAll}"
Content="Collapse All" />
<Button
Margin="5,0"
Padding="5,2"
Command="{Binding GmlSelectAll}"
Content="Select All for GML" />
<Button
Margin="5,0"
Padding="5,2"
Command="{Binding GmlClearAll}"
Content="Clear All for GML" />
</StackPanel>
<StackPanel
Grid.Column="1"
Margin="0,0,10,10"
HorizontalAlignment="Right"
Orientation="Horizontal" Width="190">
<CheckBox
Content="Enable"
ToolTip="Uncheck and save to temporarily disable all structure filters"
Margin="5,0"
Padding="5,2"
IsChecked="{Binding IsFilteringEnabled}"
VerticalContentAlignment="Center"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Button
Width="50"
Margin="5,0"
Padding="5,2"
Command="{Binding Save}"
Content="Save"
IsEnabled="{Binding IsEnabled}" />
<Button
Width="50"
Margin="5,0"
Padding="5,2"
Command="{Binding Cancel}"
Content="Cancel"
IsCancel="true" />
</StackPanel>
</Grid>
</Grid>
</Window>