Repository navigation
Expand file tree
/
Copy pathApp.xaml
More file actions
366 lines (353 loc) · 24.7 KB
/
Copy pathApp.xaml
File metadata and controls
366 lines (353 loc) · 24.7 KB
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<Application x:Class="KillerScan.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:kl="clr-namespace:KillerFamily.Layout"
xmlns:input="clr-namespace:KillerFamily.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:KillerScan.Controls"
xmlns:snap="clr-namespace:KillerFamily.Windowing"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- [0] Theme COLORS (replaced at startup and on every theme change by ThemeManager). -->
<ResourceDictionary Source="Themes/Dark.xaml"/>
<!-- The family control styles from the KillerUI template, identical in every app. -->
<ResourceDictionary Source="Controls/Controls.xaml"/>
<!-- Strings base; LocaleManager layers the chosen locale directly after it. -->
<ResourceDictionary Source="Strings/en-US.xaml"/>
</ResourceDictionary.MergedDictionaries>
<!-- ================================================================
KillerScan's own resources. Everything shared with the rest of the
family lives in Controls/Controls.xaml; only what KillerScan's views
alone use is here. All brush references use DynamicResource so a live
theme/accent change repaints them.
================================================================ -->
<!-- Device type: stored English value in, localized label out. Display only - nothing
that persists, colors, filters or exports goes through it (DeviceTypeConverter). -->
<controls:DeviceTypeConverter x:Key="DeviceTypeLoc"/>
<controls:VendorConverter x:Key="VendorLoc"/>
<controls:TrustMarkConverter x:Key="TrustMark"/>
<Style x:Key="ScanGridHeaderStrip" TargetType="Border"/>
<ControlTemplate x:Key="ScanDataGridTemplate" TargetType="DataGrid">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
<Grid>
<ScrollViewer x:Name="DG_ScrollViewer" Focusable="false">
<ScrollViewer.Template>
<ControlTemplate TargetType="ScrollViewer">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Spans the scrollbar column as well. Pinned to column 0 it
stopped short of the scrollbar, leaving a notch of pane
colour above it; the presenter still lays its headers out
on the real column widths, so only the strip gets wider. -->
<Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
Style="{DynamicResource ScanGridHeaderStrip}">
<DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"
Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Column}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
</Border>
<ScrollContentPresenter x:Name="PART_ScrollContentPresenter"
Grid.Row="1" Grid.Column="0"
CanContentScroll="{TemplateBinding CanContentScroll}"/>
<Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource ScrollTopCue}">
<Border.Visibility>
<MultiBinding Converter="{StaticResource ScrollEdgeVisibility}" ConverterParameter="Start">
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
<Binding Path="ScrollableHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
</MultiBinding>
</Border.Visibility>
</Border>
<Border Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" Style="{StaticResource ScrollBottomCue}">
<Border.Visibility>
<MultiBinding Converter="{StaticResource ScrollEdgeVisibility}" ConverterParameter="End">
<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
<Binding Path="ScrollableHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
</MultiBinding>
</Border.Visibility>
</Border>
<ScrollBar x:Name="PART_VerticalScrollBar" Panel.ZIndex="100"
Grid.Row="1" Grid.Column="1"
Orientation="Vertical"
Maximum="{TemplateBinding ScrollableHeight}"
ViewportSize="{TemplateBinding ViewportHeight}"
Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
<ScrollBar x:Name="PART_HorizontalScrollBar" Panel.ZIndex="100"
Grid.Row="2" Grid.Column="0" Orientation="Horizontal"
Maximum="{TemplateBinding ScrollableWidth}"
ViewportSize="{TemplateBinding ViewportWidth}"
Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}"
Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
</Grid>
</ControlTemplate>
</ScrollViewer.Template>
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Grid>
</Border>
</ControlTemplate>
<Style x:Key="ThemedDataGridColumnHeader" TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="{DynamicResource TableHeaderBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="Normal"/>
<Setter Property="Padding" Value="8,0"/>
<Setter Property="BorderBrush" Value="{DynamicResource HeaderLineBrush}"/>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Grid>
<Border IsHitTestVisible="False" Panel.ZIndex="2"
BorderBrush="{DynamicResource BevelLightBrush}"
BorderThickness="{DynamicResource BevelLightThickness}"/>
<Border IsHitTestVisible="False" Panel.ZIndex="2"
BorderBrush="{DynamicResource BevelDarkBrush}"
BorderThickness="{DynamicResource BevelDarkThickness}"/>
<Border x:Name="hdrBg"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ContentPresenter Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<TextBlock x:Name="sortGlyph" Grid.Column="1"
Text="▲" FontSize="8"
VerticalAlignment="Center" Margin="6,1,0,0"
Foreground="{DynamicResource PrimaryBrush}"
Visibility="Collapsed"/>
</Grid>
</Border>
<Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left"
Width="8" Margin="-4,0,0,0" Cursor="SizeWE">
<Thumb.Template>
<ControlTemplate TargetType="Thumb"><Border Background="Transparent"/></ControlTemplate>
</Thumb.Template>
</Thumb>
<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right"
Width="8" Margin="0,0,-4,0" Cursor="SizeWE">
<Thumb.Template>
<ControlTemplate TargetType="Thumb"><Border Background="Transparent"/></ControlTemplate>
</Thumb.Template>
</Thumb>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="SortDirection" Value="Ascending">
<Setter TargetName="sortGlyph" Property="Visibility" Value="Visible"/>
<Setter TargetName="sortGlyph" Property="Text" Value="▲"/>
</Trigger>
<Trigger Property="SortDirection" Value="Descending">
<Setter TargetName="sortGlyph" Property="Visibility" Value="Visible"/>
<Setter TargetName="sortGlyph" Property="Text" Value="▼"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="hdrBg" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="hdrBg" Property="Background" Value="{DynamicResource RowSelectedBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource SelectionFg}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Scan-session tab. Active tab adopts the pane color so it reads as attached to the grid. -->
<Style x:Key="TabButton" TargetType="Button">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontFamily" Value="{DynamicResource UiFont}"/>
<Setter Property="FontSize" Value="11.5"/>
<Setter Property="Margin" Value="0,4,3,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="b" Background="Transparent" CornerRadius="{DynamicResource TabCornerRadius}" Padding="11,5">
<ContentPresenter VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="b" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<DataTrigger Binding="{Binding IsActive}" Value="True">
<Setter TargetName="b" Property="Background" Value="{DynamicResource PaneBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TabNewBtn" TargetType="Button">
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Margin" Value="4,4,0,0"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="nb" Background="Transparent" CornerRadius="{DynamicResource ControlCornerRadius}" Width="24" Height="22">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="nb" Property="Background" Value="{DynamicResource RowHoverBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- The four-layer sunken edge as one control, for the file picker's wells. Every
thickness is zero on the flat themes, so it draws nothing there. KillerPDF's style. -->
<Style x:Key="PaneBevelOverlay" TargetType="{x:Type Control}">
<Setter Property="IsHitTestVisible" Value="False"/>
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Control}">
<Grid>
<Border BorderBrush="{DynamicResource PaneBevelDarkBrush}"
BorderThickness="{DynamicResource PaneBevelLightThickness}"/>
<Border BorderBrush="{DynamicResource PaneBevelLightBrush}"
BorderThickness="{DynamicResource PaneBevelDarkThickness}"/>
<Border Margin="{DynamicResource PaneBevelInnerMargin}"
BorderBrush="{DynamicResource PaneBevelDark2Brush}"
BorderThickness="{DynamicResource PaneBevel2LightThickness}"/>
<Border Margin="{DynamicResource PaneBevelInnerMargin}"
BorderBrush="{DynamicResource PaneBevelLight2Brush}"
BorderThickness="{DynamicResource PaneBevel2DarkThickness}"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Caption tab, KillerPDF's SidebarTabBtn: no fill, no underline, no pill. The
active one is shown by foreground alone, set by the caller. -->
<Style x:Key="ViewTabButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{DynamicResource MutedTextBrush}"/>
<Setter Property="FontFamily" Value="{DynamicResource UiFont}"/>
<Setter Property="FontSize" Value="10"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="2,2,8,2"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ContentPresenter/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.35"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- A text action rather than a control: for secondary, housekeeping commands that
sit on a caption row, where a pill would compete with the real buttons. Keeps
the outline color so it still reads as part of the family palette. -->
<Style x:Key="LinkButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource OutlineTextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="2,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="Transparent" Padding="{TemplateBinding Padding}">
<TextBlock x:Name="caption" Text="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}"
FontSize="{TemplateBinding FontSize}"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="caption" Property="TextDecorations" Value="Underline"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value="0.7"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.45"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- View toolbar button, KillerPDF's ToolbarButton key for key. The active view is
marked by the caller setting Background and Foreground to SelectionBg/SelectionFg,
not by a trigger here, so the highlight is the theme's selection pair rather than
the raw accent. -->
<Style x:Key="ViewToolbarButton" TargetType="Button">
<Setter Property="AutomationProperties.Name" Value="{Binding RelativeSource={RelativeSource Self}, Path=ToolTip}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="{DynamicResource ControlCornerRadius}"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center">
<ContentPresenter.Effect>
<DropShadowEffect Color="Black" BlurRadius="4" ShadowDepth="2"
Direction="270" Opacity="{DynamicResource IconShadowOpacity}"/>
</ContentPresenter.Effect>
</ContentPresenter>
</Border>
<ControlTemplate.Triggers>
<!-- The hover setter deliberately targets the button rather than the
template's Border: a local Background set for the active view
then outranks it, and the current view keeps its fill while the
pointer is over it. -->
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource RowHoverBrush}"/>
</Trigger>
<!-- No shadow on the active view, in any theme. The selected button
already carries a solid fill and its own foreground; a black
shadow on top of that reads as a smudge rather than as depth,
worst on the light accents but wrong everywhere. -->
<Trigger Property="Tag" Value="selected">
<Setter TargetName="content" Property="Effect" Value="{x:Null}"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>