Files
HawkeyeVision/Plugins/LindtLeerformPlugin/Views/CalibrationWindow.axaml
2026-04-08 13:10:34 +02:00

137 lines
7.0 KiB
XML

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:LindtLeerformPlugin.ViewModels"
x:Class="LindtLeerformPlugin.Views.CalibrationWindow"
x:DataType="vm:CalibrationWindowViewModel"
Title="Leerform Calibration"
Width="1024" Height="800">
<Window.Styles>
<Style Selector="Button">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Red" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="#FFEBEE" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="TextBlock.Foreground" Value="Red" />
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="Background" Value="#FFCDD2" />
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="TextBlock.Foreground" Value="Red" />
</Style>
</Window.Styles>
<DockPanel>
<!-- Toolbar -->
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Spacing="8" Margin="8">
<Button Content="START PREVIEW" Command="{Binding StartPreviewCommand}" IsEnabled="{Binding !IsPreviewRunning}" />
<Button Content="STOP PREVIEW" Command="{Binding StopPreviewCommand}" IsEnabled="{Binding IsPreviewRunning}" />
<Button Content="CAPTURE IMAGE" Command="{Binding CaptureImageCommand}" />
</StackPanel>
<!-- Status Bar -->
<Border DockPanel.Dock="Bottom" Background="#1E1E1E" Padding="8,4">
<StackPanel Orientation="Horizontal" Spacing="16">
<TextBlock Text="{Binding StatusText}" Foreground="LightGray" />
<TextBlock Foreground="LightGray">
<TextBlock.Text>
<MultiBinding StringFormat="Captured: {0}">
<Binding Path="CapturedImageCount" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</Border>
<!-- Settings Panel -->
<Border DockPanel.Dock="Right" Width="290" Padding="12" Background="White">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<StackPanel Spacing="8" Margin="0,0,20,0">
<TextBlock Text="Calibration Settings" FontWeight="Bold" FontSize="14" Foreground="Black" />
<Button Content="CALIBRATE" Command="{Binding RunCalibrationCommand}" Margin="0,4" />
<Button Content="CLEAR IMAGES" Command="{Binding ClearCalibrationImagesCommand}" Margin="0,4" />
<Separator Margin="0,8" />
<TextBlock Text="Calibrated" Foreground="LimeGreen" IsVisible="{Binding IsCalibrated}" />
<TextBlock Foreground="Gray" IsVisible="{Binding IsCalibrated}">
<TextBlock.Text>
<MultiBinding StringFormat="RMS Error: {0:F4}">
<Binding Path="RmsError" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<CheckBox Content="Apply Calibration" IsChecked="{Binding ApplyCalibration}"
IsEnabled="{Binding IsCalibrated}" Foreground="Black" Margin="0,4" />
<Separator Margin="0,8" />
<TextBlock Text="Pattern" FontWeight="Bold" FontSize="14" Foreground="Black" />
<TextBlock Text="Rows" Foreground="Black" />
<NumericUpDown Value="{Binding Rows}" Minimum="1" Maximum="200" Increment="1" FormatString="0" />
<TextBlock Text="Cols" Foreground="Black" />
<NumericUpDown Value="{Binding Cols}" Minimum="1" Maximum="200" Increment="1" FormatString="0" />
<TextBlock Text="Shape" Foreground="Black" />
<ComboBox ItemsSource="{Binding AvailableCellShapes}" SelectedItem="{Binding SelectedCellShape}" HorizontalAlignment="Stretch" />
<TextBlock Text="Padding (px)" Foreground="Black" />
<NumericUpDown Value="{Binding Padding}" Minimum="0" Maximum="500" Increment="1" FormatString="0" />
<Separator Margin="0,8" />
<TextBlock Text="ROI (px)" FontWeight="Bold" FontSize="14" Foreground="Black" />
<TextBlock Text="X" Foreground="Black" />
<NumericUpDown Value="{Binding RoiX}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" />
<TextBlock Text="Y" Foreground="Black" />
<NumericUpDown Value="{Binding RoiY}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" />
<TextBlock Text="Width" Foreground="Black" />
<NumericUpDown Value="{Binding RoiWidth}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" />
<TextBlock Text="Height" Foreground="Black" />
<NumericUpDown Value="{Binding RoiHeight}" Minimum="0" Maximum="100000" Increment="1" FormatString="0" />
<Separator Margin="0,8" />
<Button Content="SET REFERENCE (RESETS SPLINES)" Command="{Binding SetReferenceHistogramCommand}" Margin="0,4"
HorizontalAlignment="Stretch" />
<TextBlock Text="✓ Average spline set" Foreground="LimeGreen" IsVisible="{Binding HasAverageSpline}" />
<Button Content="TEST PATTERN" Command="{Binding TestPatternCommand}" Margin="0,4"
HorizontalAlignment="Stretch" />
<Separator Margin="0,8" />
<TextBlock Text="Recipe" FontWeight="Bold" FontSize="14" Foreground="Black" />
<TextBlock Foreground="Black">
<TextBlock.Text>
<MultiBinding StringFormat="Current: {0}">
<Binding Path="CurrentRecipeName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<Button Content="SAVE RECIPE" Command="{Binding SaveRecipeCommand}" Margin="0,4"
HorizontalAlignment="Stretch" />
</StackPanel>
</ScrollViewer>
</Border>
<!-- Live Preview -->
<Border Background="#1A1A1A" Margin="4">
<Image x:Name="PreviewImageControl"
Source="{Binding PreviewImage}"
Stretch="Uniform" />
</Border>
</DockPanel>
</Window>