-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
791 lines (740 loc) · 46.5 KB
/
Copy pathMainWindow.xaml
File metadata and controls
791 lines (740 loc) · 46.5 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
<Window x:Class="DocScanner.MainWindow"
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:local="clr-namespace:DocScanner"
xmlns:vm="clr-namespace:DocScanner.ViewModels"
xmlns:controls="clr-namespace:DocScanner.Controls"
xmlns:models="clr-namespace:DocScanner.Models"
mc:Ignorable="d"
Title="DocScanner - Document Scanning & Contrast Enhancement"
Height="800" Width="1240"
MinHeight="650" MinWidth="980"
Background="{StaticResource BrushBgApp}"
Foreground="{StaticResource BrushTextPrimary}"
WindowStartupLocation="CenterScreen"
AllowDrop="True"
Drop="Window_Drop"
KeyDown="Window_KeyDown">
<Window.DataContext>
<vm:MainViewModel x:Name="ViewModel" />
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <!-- Top Toolbar -->
<RowDefinition Height="*" /> <!-- Main Workspace -->
<RowDefinition Height="Auto" /> <!-- Bottom Status Bar -->
</Grid.RowDefinitions>
<!-- TOP TOOLBAR -->
<Border Grid.Row="0"
Background="{StaticResource BrushBgHeader}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="0,0,0,1"
Padding="10,8">
<DockPanel LastChildFill="False">
<!-- Left: File Operations -->
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
<Button Style="{StaticResource ModernButton}"
Command="{Binding AddImagesCommand}"
ToolTip="Open document photos or scans from disk"
Margin="0,0,6,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="📁 Import Images" FontWeight="Medium" />
</StackPanel>
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding AddFromClipboardCommand}"
ToolTip="Paste image from clipboard (Ctrl+V)"
Margin="0,0,6,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="📋 Paste Clipboard" />
</StackPanel>
</Button>
<Separator Style="{x:Null}" Width="1" Background="{StaticResource BrushBorder}" Margin="6,2,12,2" />
<!-- Middle: Geometric / Crop Tools -->
<ToggleButton Style="{x:Null}"
IsChecked="{Binding IsCropMode}"
IsEnabled="{Binding HasPages}"
Cursor="Hand"
Padding="10,6"
Margin="0,0,6,0">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="bgBorder"
Background="{StaticResource BrushBgCard}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="3"
Padding="{TemplateBinding Padding}">
<TextBlock x:Name="txt" Text="📐 Crop / Perspective" Foreground="{StaticResource BrushTextPrimary}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bgBorder" Property="Background" Value="{StaticResource BrushBgCardSelected}" />
<Setter TargetName="bgBorder" Property="BorderBrush" Value="{StaticResource BrushAccent}" />
<Setter TargetName="txt" Property="FontWeight" Value="SemiBold" />
<Setter TargetName="txt" Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bgBorder" Property="BorderBrush" Value="{StaticResource BrushBorderLight}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bgBorder" Property="Opacity" Value="0.4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Button Style="{StaticResource ModernButton}"
Command="{Binding AutoDetectCornersCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Automatically detect 4 document corners"
Margin="0,0,6,0">
<TextBlock Text="✨ Auto-Detect" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding ResetCropCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Reset crop to full image bounds"
Margin="0,0,6,0">
<TextBlock Text="🔄 Reset Crop" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding RotateLeftCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Rotate 90° counter-clockwise"
Margin="0,0,4,0">
<TextBlock Text="⤹ Rotate L" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding RotateRightCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Rotate 90° clockwise"
Margin="0,0,6,0">
<TextBlock Text="⤸ Rotate R" />
</Button>
<ToggleButton Style="{x:Null}"
IsChecked="{Binding IsSplitView}"
IsEnabled="{Binding HasPages}"
Cursor="Hand"
Padding="10,6"
Margin="0,0,6,0"
ToolTip="Toggle side-by-side comparison with original warped document">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="bgBorder"
Background="{StaticResource BrushBgCard}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="3"
Padding="{TemplateBinding Padding}">
<TextBlock x:Name="txt" Text="◫ Split View" Foreground="{StaticResource BrushTextSecondary}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bgBorder" Property="Background" Value="{StaticResource BrushBgCardSelected}" />
<Setter TargetName="bgBorder" Property="BorderBrush" Value="{StaticResource BrushAccent}" />
<Setter TargetName="txt" Property="Foreground" Value="White" />
<Setter TargetName="txt" Property="FontWeight" Value="SemiBold" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bgBorder" Property="BorderBrush" Value="{StaticResource BrushBorderLight}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bgBorder" Property="Opacity" Value="0.4" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
</StackPanel>
<!-- Right: Export Operations -->
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
<Button Style="{StaticResource ModernButton}"
Command="{Binding ExportCurrentPageImageCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Save current enhanced page as PNG/JPEG image"
Margin="0,0,8,0">
<TextBlock Text="💾 Save Image..." />
</Button>
<Button Style="{StaticResource AccentButton}"
Command="{Binding ExportPdfCommand}"
IsEnabled="{Binding HasPages}"
ToolTip="Compile all pages into a multi-page PDF document"
Padding="14,6">
<TextBlock Text="📄 Export PDF" />
</Button>
</StackPanel>
</DockPanel>
</Border>
<!-- MAIN WORKSPACE -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220" MinWidth="160" MaxWidth="350" /> <!-- Left Thumbnail Sidebar -->
<ColumnDefinition Width="*" /> <!-- Center Canvas -->
<ColumnDefinition Width="290" MinWidth="240" MaxWidth="400" /> <!-- Right Filter Panel -->
</Grid.ColumnDefinitions>
<!-- 1. LEFT SIDEBAR: PAGES LIST -->
<Border Grid.Column="0"
Background="{StaticResource BrushBgSidebar}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="0,0,1,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Sidebar Header -->
<Border Grid.Row="0"
Background="{StaticResource BrushBgHeader}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="0,0,0,1"
Padding="12,8">
<DockPanel>
<TextBlock Text="PAGES"
FontWeight="SemiBold"
FontSize="11"
Foreground="{StaticResource BrushTextMuted}"
VerticalAlignment="Center" />
<TextBlock Text="{Binding Pages.Count, StringFormat='({0})'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
Margin="6,0,0,0"
VerticalAlignment="Center" />
</DockPanel>
</Border>
<!-- Thumbnails ListBox -->
<ListBox Grid.Row="1"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Pages}"
SelectedItem="{Binding SelectedPage}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Padding="8">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="4" />
<Setter Property="Margin" Value="0,0,0,8" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="itemBorder"
Background="{StaticResource BrushBgCard}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="4"
Padding="6">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="itemBorder" Property="Background" Value="{StaticResource BrushBgCardHover}" />
<Setter TargetName="itemBorder" Property="BorderBrush" Value="{StaticResource BrushBorderLight}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="itemBorder" Property="Background" Value="{StaticResource BrushBgCardSelected}" />
<Setter TargetName="itemBorder" Property="BorderBrush" Value="{StaticResource BrushAccent}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type models:ScannedPage}">
<StackPanel>
<Border Background="#111111"
CornerRadius="2"
Height="140"
HorizontalAlignment="Center">
<Image Source="{Binding ThumbnailBitmap}"
Stretch="Uniform"
RenderOptions.BitmapScalingMode="HighQuality" />
</Border>
<DockPanel Margin="0,6,0,0">
<TextBlock Text="{Binding PageNumber, StringFormat='Page {0}'}"
FontWeight="SemiBold"
FontSize="12"
Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="{Binding FilterType}"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
HorizontalAlignment="Right"
VerticalAlignment="Center" />
</DockPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!-- Sidebar Bottom Toolbar -->
<Border Grid.Row="2"
Background="{StaticResource BrushBgHeader}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="0,1,0,0"
Padding="8">
<UniformGrid Columns="3">
<Button Style="{StaticResource ModernButton}"
Command="{Binding MovePageUpCommand}"
IsEnabled="{Binding HasSelectedPage}"
ToolTip="Move page up"
Margin="0,0,4,0">
<TextBlock Text="▲ Up" FontSize="11" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding MovePageDownCommand}"
IsEnabled="{Binding HasSelectedPage}"
ToolTip="Move page down"
Margin="2,0,2,0">
<TextBlock Text="▼ Down" FontSize="11" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding DeletePageCommand}"
IsEnabled="{Binding HasSelectedPage}"
ToolTip="Delete selected page"
Margin="4,0,0,0">
<TextBlock Text="✕ Del" FontSize="11" Foreground="#ff6b6b" />
</Button>
</UniformGrid>
</Border>
</Grid>
</Border>
<!-- 2. CENTER CANVAS WORKSPACE -->
<Grid Grid.Column="1" Background="{StaticResource BrushBgApp}">
<!-- Empty State Placeholder -->
<Border Visibility="{Binding HasPages, Converter={StaticResource InverseBoolToVisConverter}}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Padding="30">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="📄"
FontSize="54"
HorizontalAlignment="Center"
Opacity="0.4"
Margin="0,0,0,16" />
<TextBlock Text="No Document Loaded"
FontSize="18"
FontWeight="SemiBold"
Foreground="{StaticResource BrushTextPrimary}"
HorizontalAlignment="Center"
Margin="0,0,0,8" />
<TextBlock Text="Drag and drop document photos here, or click Import Images"
FontSize="13"
Foreground="{StaticResource BrushTextMuted}"
HorizontalAlignment="Center"
Margin="0,0,0,20" />
<Button Style="{StaticResource AccentButton}"
Command="{Binding AddImagesCommand}"
HorizontalAlignment="Center"
Padding="16,8">
<TextBlock Text="Select Document Photos" />
</Button>
</StackPanel>
</Border>
<!-- Active Page View -->
<Grid Visibility="{Binding HasPages, Converter={StaticResource BoolToVisConverter}}">
<!-- A. CROP / PERSPECTIVE MODE -->
<Grid Visibility="{Binding IsCropMode, Converter={StaticResource BoolToVisConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Instruction Ribbon -->
<Border Grid.Row="0"
Background="#103b59"
BorderBrush="{StaticResource BrushAccent}"
BorderThickness="0,0,0,1"
Padding="12,6">
<DockPanel>
<TextBlock Text="📐 Interactive Perspective Crop: Drag the 4 corner handles to tightly frame your document."
Foreground="White"
FontSize="12"
VerticalAlignment="Center" />
<Button Style="{StaticResource ModernButton}"
Command="{Binding ToggleCropModeCommand}"
HorizontalAlignment="Right"
Padding="10,3">
<TextBlock Text="Done (Apply Crop)" FontWeight="SemiBold" />
</Button>
</DockPanel>
</Border>
<controls:InteractiveCropCanvas x:Name="CropCanvas"
Grid.Row="1"
Margin="16"
SourceImage="{Binding SelectedPage.SourceBitmap}"
Corners="{Binding SelectedPage.Corners, Mode=TwoWay}"
ImagePixelWidth="{Binding SelectedPage.ImageWidth, FallbackValue=100}"
ImagePixelHeight="{Binding SelectedPage.ImageHeight, FallbackValue=100}"
CornersManipulated="CropCanvas_CornersManipulated" />
</Grid>
<!-- B. ENHANCED PREVIEW MODE -->
<Grid Visibility="{Binding IsCropMode, Converter={StaticResource InverseBoolToVisConverter}}">
<!-- Single View -->
<Grid Visibility="{Binding IsSplitView, Converter={StaticResource InverseBoolToVisConverter}}"
Margin="16">
<Border Background="#111111"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="4">
<Image Source="{Binding SelectedPage.ProcessedBitmap}"
Stretch="Uniform"
RenderOptions.BitmapScalingMode="HighQuality" />
</Border>
</Grid>
<!-- Split / Side-by-Side View -->
<Grid Visibility="{Binding IsSplitView, Converter={StaticResource BoolToVisConverter}}"
Margin="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Left: Original Source -->
<Border Grid.Column="0"
Background="#111111"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="4">
<Grid>
<Image Source="{Binding SelectedPage.SourceBitmap}"
Stretch="Uniform"
RenderOptions.BitmapScalingMode="HighQuality" />
<Border Background="#cc000000"
HorizontalAlignment="Left"
VerticalAlignment="Top"
CornerRadius="0,0,4,0"
Padding="8,4">
<TextBlock Text="Original Photo" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
</Border>
</Grid>
</Border>
<GridSplitter Grid.Column="1"
Width="4"
HorizontalAlignment="Center"
Background="{StaticResource BrushBorder}" />
<!-- Right: Enhanced Output -->
<Border Grid.Column="2"
Background="#111111"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1"
CornerRadius="4">
<Grid>
<Image Source="{Binding SelectedPage.ProcessedBitmap}"
Stretch="Uniform"
RenderOptions.BitmapScalingMode="HighQuality" />
<Border Background="#cc000000"
HorizontalAlignment="Left"
VerticalAlignment="Top"
CornerRadius="0,0,4,0"
Padding="8,4">
<TextBlock Text="{Binding SelectedPage.FilterType, StringFormat='Enhanced ({0})'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
FontWeight="SemiBold" />
</Border>
</Grid>
</Border>
</Grid>
</Grid>
</Grid>
<!-- Loading Progress Overlay -->
<Border Background="#99000000"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisConverter}}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Border Background="{StaticResource BrushBgCard}"
BorderBrush="{StaticResource BrushAccent}"
BorderThickness="1"
CornerRadius="6"
Padding="24,16"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Center">
<ProgressBar IsIndeterminate="True"
Height="4"
Width="180"
Foreground="{StaticResource BrushAccent}"
Margin="0,0,0,12" />
<TextBlock Text="{Binding StatusText}"
Foreground="{StaticResource BrushTextPrimary}"
FontSize="12"
HorizontalAlignment="Center" />
</StackPanel>
</Border>
</Border>
</Grid>
<!-- 3. RIGHT CONTROL & FILTER PANEL -->
<Border Grid.Column="2"
Background="{StaticResource BrushBgSidebar}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="1,0,0,0"
IsEnabled="{Binding HasPages}">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled"
Padding="14">
<StackPanel>
<!-- Section: Presets -->
<TextBlock Text="DOCUMENT PRESETS"
FontWeight="SemiBold"
FontSize="11"
Foreground="{StaticResource BrushTextMuted}"
Margin="0,0,0,10" />
<RadioButton Style="{StaticResource PresetRadioButton}"
GroupName="FilterPreset"
IsChecked="{Binding ActiveFilterType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter=EnhancedColor}"
Command="{Binding SetFilterCommand}"
CommandParameter="EnhancedColor">
<StackPanel>
<TextBlock Text="Enhanced Color" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="Illumination normalization: Shadow removal + crisp text + vivid color"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
TextWrapping="Wrap" />
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource PresetRadioButton}"
GroupName="FilterPreset"
IsChecked="{Binding ActiveFilterType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter=BlackAndWhite}"
Command="{Binding SetFilterCommand}"
CommandParameter="BlackAndWhite">
<StackPanel>
<TextBlock Text="B&W Clean Document" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="Pure white paper (#FFFFFF) & deep black text binarization"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
TextWrapping="Wrap" />
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource PresetRadioButton}"
GroupName="FilterPreset"
IsChecked="{Binding ActiveFilterType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter=GrayscaleHighContrast}"
Command="{Binding SetFilterCommand}"
CommandParameter="GrayscaleHighContrast">
<StackPanel>
<TextBlock Text="Grayscale High-Contrast" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="Adaptive histogram equalization for monochrome scans"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
TextWrapping="Wrap" />
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource PresetRadioButton}"
GroupName="FilterPreset"
IsChecked="{Binding ActiveFilterType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter=SharpenOnly}"
Command="{Binding SetFilterCommand}"
CommandParameter="SharpenOnly">
<StackPanel>
<TextBlock Text="Detail Sharpening" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="High-pass text stroke edge enhancement"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
TextWrapping="Wrap" />
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource PresetRadioButton}"
GroupName="FilterPreset"
IsChecked="{Binding ActiveFilterType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter=Original}"
Command="{Binding SetFilterCommand}"
CommandParameter="Original">
<StackPanel>
<TextBlock Text="Original (Unenhanced)" FontWeight="SemiBold" Foreground="{StaticResource BrushTextPrimary}" />
<TextBlock Text="Raw perspective-warped document image"
FontSize="10"
Foreground="{StaticResource BrushTextMuted}"
TextWrapping="Wrap" />
</StackPanel>
</RadioButton>
<Separator Style="{x:Null}" Height="1" Background="{StaticResource BrushBorder}" Margin="0,12,0,14" />
<!-- Section: Fine-Tuning Sliders -->
<DockPanel Margin="0,0,0,10">
<TextBlock Text="FINE-TUNING ADJUSTMENTS"
FontWeight="SemiBold"
FontSize="11"
Foreground="{StaticResource BrushTextMuted}"
VerticalAlignment="Center" />
<Button Style="{StaticResource ModernButton}"
Command="{Binding ResetActivePresetCommand}"
ToolTip="Reset current preset settings to default"
HorizontalAlignment="Right"
Padding="6,2"
FontSize="10">
<TextBlock Text="↺ Reset" />
</Button>
</DockPanel>
<!-- Shadow Suppression Slider -->
<StackPanel Visibility="{Binding ShowShadowSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="Shadow Removal" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding ShadowSuppression, StringFormat='{}{0:P0}'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="0.0" Maximum="1.5"
Value="{Binding ShadowSuppression, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<!-- Sharpening Slider -->
<StackPanel Visibility="{Binding ShowSharpeningSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="Text Sharpening" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding Sharpening, StringFormat='{}{0:F1}'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="0.0" Maximum="4.0"
Value="{Binding Sharpening, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<!-- Contrast Slider -->
<StackPanel Visibility="{Binding ShowContrastSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="Contrast" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding Contrast, StringFormat='{}{0:F2}x'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="0.5" Maximum="3.5"
Value="{Binding Contrast, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<!-- Brightness Slider -->
<StackPanel Visibility="{Binding ShowBrightnessSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="Brightness" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding Brightness, StringFormat='{}{0:+0;-0;0}'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="-80" Maximum="80"
Value="{Binding Brightness, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<!-- B&W Threshold Offset Slider -->
<StackPanel Visibility="{Binding ShowThresholdSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="B&W Threshold Tuning" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding ThresholdOffset, StringFormat='{}{0:+0;-0;0}'}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="-30" Maximum="30"
Value="{Binding ThresholdOffset, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<!-- Denoise Cleanup Slider -->
<StackPanel Visibility="{Binding ShowDenoiseSlider, Converter={StaticResource BoolToVisConverter}}">
<DockPanel Margin="0,0,0,2">
<TextBlock Text="Noise Reduction" FontSize="11" Foreground="{StaticResource BrushTextSecondary}" />
<TextBlock Text="{Binding DenoiseStrength}"
FontSize="11"
Foreground="{StaticResource BrushAccent}"
HorizontalAlignment="Right" />
</DockPanel>
<Slider Style="{StaticResource ModernSlider}"
Minimum="0" Maximum="4"
IsSnapToTickEnabled="True"
TickFrequency="1"
Value="{Binding DenoiseStrength, Mode=TwoWay}"
ValueChanged="Slider_ValueChanged" />
</StackPanel>
<Separator Style="{x:Null}" Height="1" Background="{StaticResource BrushBorder}" Margin="0,14,0,14" />
<!-- Batch Actions -->
<TextBlock Text="BATCH OPERATIONS"
FontWeight="SemiBold"
FontSize="11"
Foreground="{StaticResource BrushTextMuted}"
Margin="0,0,0,10" />
<Button Style="{StaticResource ModernButton}"
Command="{Binding BatchExportAllImagesCommand}"
Margin="0,0,0,8">
<TextBlock Text="📁 Export All Pages to Folder..." />
</Button>
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
<!-- BOTTOM STATUS BAR -->
<Border Grid.Row="2"
Background="{StaticResource BrushBgHeader}"
BorderBrush="{StaticResource BrushBorder}"
BorderThickness="0,1,0,0"
Padding="12,4">
<DockPanel>
<TextBlock Text="{Binding StatusText}"
FontSize="11"
Foreground="{StaticResource BrushTextSecondary}"
VerticalAlignment="Center" />
<TextBlock Text="{Binding DetailsText}"
FontSize="11"
Foreground="{StaticResource BrushTextMuted}"
HorizontalAlignment="Right"
VerticalAlignment="Center" />
</DockPanel>
</Border>
<!-- GLOBAL IN-APP SUCCESS MODAL DIALOG (STAYS OPEN UNTIL DISMISSED BY USER) -->
<Border Grid.Row="0" Grid.RowSpan="3"
Background="#b3000000"
Visibility="{Binding IsSuccessDialogOpen, Converter={StaticResource BoolToVisConverter}}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Panel.ZIndex="1000">
<Border Background="{StaticResource BrushBgSidebar}"
BorderBrush="{StaticResource BrushAccent}"
BorderThickness="1"
CornerRadius="6"
Padding="24"
MaxWidth="520"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<StackPanel>
<DockPanel Margin="0,0,0,12">
<TextBlock Text="{Binding SuccessDialogTitle}"
FontWeight="Bold"
FontSize="15"
Foreground="{StaticResource BrushTextPrimary}"
VerticalAlignment="Center" />
</DockPanel>
<TextBlock Text="{Binding SuccessDialogMessage}"
Foreground="{StaticResource BrushTextSecondary}"
FontSize="12"
TextWrapping="Wrap"
Margin="0,0,0,24" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource ModernButton}"
Command="{Binding OpenExportedFolderCommand}"
Margin="0,0,8,0"
Padding="12,6">
<TextBlock Text="📁 Open Folder" />
</Button>
<Button Style="{StaticResource AccentButton}"
Command="{Binding OpenExportedFileCommand}"
Margin="0,0,8,0"
Padding="12,6">
<TextBlock Text="📄 Open File" />
</Button>
<Button Style="{StaticResource ModernButton}"
Command="{Binding CloseSuccessDialogCommand}"
Padding="16,6">
<TextBlock Text="OK" />
</Button>
</StackPanel>
</StackPanel>
</Border>
</Border>
</Grid>
</Window>