2019-11-25 22:27:38 +00:00
|
|
|
<!--
|
|
|
|
Copyright 2019 faddenSoft
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<Window x:Class="SourceGen.WpfGui.EditVisualization"
|
|
|
|
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:system="clr-namespace:System;assembly=mscorlib"
|
|
|
|
xmlns:local="clr-namespace:SourceGen.WpfGui"
|
|
|
|
mc:Ignorable="d"
|
|
|
|
Title="Edit Visualization"
|
2019-12-06 00:08:30 +00:00
|
|
|
SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip"
|
2019-11-25 22:27:38 +00:00
|
|
|
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
2019-12-06 22:49:35 +00:00
|
|
|
ContentRendered="Window_ContentRendered"
|
2019-12-01 01:52:33 +00:00
|
|
|
Closed="Window_Closed">
|
2019-11-25 22:27:38 +00:00
|
|
|
|
|
|
|
<Window.Resources>
|
2019-12-07 01:19:27 +00:00
|
|
|
<system:String x:Key="str_VisGenFailed">Visualization generation failed</system:String>
|
|
|
|
|
2019-11-25 22:27:38 +00:00
|
|
|
<!-- big thanks: http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/ -->
|
|
|
|
<DataTemplate x:Key="BoolTemplate">
|
2019-11-27 02:54:42 +00:00
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="130"/>
|
|
|
|
<ColumnDefinition Width="100"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,4,0"
|
|
|
|
Text="{Binding UiString}" Foreground="{Binding ForegroundBrush}"/>
|
|
|
|
<CheckBox Grid.Column="1" Margin="0,0,0,4" IsChecked="{Binding Value}"
|
|
|
|
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
|
2019-12-03 00:38:32 +00:00
|
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="4,1,0,0"
|
2019-11-27 02:54:42 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
</Grid>
|
2019-11-25 22:27:38 +00:00
|
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="IntTemplate">
|
2019-11-27 02:54:42 +00:00
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="130"/>
|
|
|
|
<ColumnDefinition Width="100"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,4,0"
|
|
|
|
Text="{Binding UiString}" Foreground="{Binding ForegroundBrush}"/>
|
|
|
|
<TextBox Grid.Column="1" MaxLength="11" Margin="0,1,0,4"
|
|
|
|
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
|
2019-11-25 22:27:38 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
|
|
TextChanged="TextBox_TextChanged"/>
|
2019-12-03 00:38:32 +00:00
|
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="4,1,0,0"
|
2019-11-27 02:54:42 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
</Grid>
|
2019-11-25 22:27:38 +00:00
|
|
|
</DataTemplate>
|
|
|
|
<DataTemplate x:Key="FloatTemplate">
|
2019-11-27 02:54:42 +00:00
|
|
|
<Grid>
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="130"/>
|
|
|
|
<ColumnDefinition Width="100"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<TextBlock Grid.Column="0" HorizontalAlignment="Right" Margin="0,0,4,0"
|
|
|
|
Text="{Binding UiString}" Foreground="{Binding ForegroundBrush}"/>
|
|
|
|
<TextBox Grid.Column="1" MaxLength="11" Margin="0,1,0,4"
|
|
|
|
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}"
|
2019-11-25 22:27:38 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
|
|
TextChanged="TextBox_TextChanged"/>
|
2019-12-03 00:38:32 +00:00
|
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="4,1,0,0"
|
2019-11-27 02:54:42 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
</Grid>
|
2019-11-25 22:27:38 +00:00
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<!-- define and configure the template selector, which chooses one of the above
|
|
|
|
templates based on the parameter data type -->
|
|
|
|
<local:ParameterTemplateSelector x:Key="ParameterTemplateSelector"
|
|
|
|
BoolTemplate="{StaticResource BoolTemplate}"
|
|
|
|
IntTemplate="{StaticResource IntTemplate}"
|
|
|
|
FloatTemplate="{StaticResource FloatTemplate}"/>
|
|
|
|
</Window.Resources>
|
|
|
|
|
2019-12-03 00:38:32 +00:00
|
|
|
|
2019-11-25 22:27:38 +00:00
|
|
|
<Grid Margin="8">
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
2019-12-06 00:08:30 +00:00
|
|
|
<RowDefinition Height="*"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
2019-12-12 06:12:20 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
<Grid Grid.Row="0">
|
|
|
|
<Grid.ColumnDefinitions>
|
2019-11-27 02:54:42 +00:00
|
|
|
<ColumnDefinition Width="130"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
2019-11-27 02:54:42 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2019-12-03 00:38:32 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Margin="0,3,4,0"
|
2019-11-25 22:27:38 +00:00
|
|
|
Text="Visualizer:"/>
|
2019-12-06 00:08:30 +00:00
|
|
|
<ComboBox Name="visComboBox" Grid.Column="1" Grid.Row="0" Width="250" Margin="0,0,0,4"
|
|
|
|
HorizontalAlignment="Left"
|
2019-11-28 01:12:26 +00:00
|
|
|
ItemsSource="{Binding VisualizationList}" DisplayMemberPath="VisDescriptor.UiName"
|
2019-11-27 02:54:42 +00:00
|
|
|
SelectionChanged="VisComboBox_SelectionChanged"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Margin="0,0,4,0"
|
2019-12-20 23:05:16 +00:00
|
|
|
Text="Tag:"/>
|
2020-01-01 04:39:51 +00:00
|
|
|
<TextBox Grid.Column="1" Grid.Row="1" Name="tagTextBox" Width="250" Margin="0,1,0,0"
|
|
|
|
HorizontalAlignment="Left" Text="{Binding TagString, UpdateSourceTrigger=PropertyChanged}"
|
2019-11-27 02:54:42 +00:00
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<TextBlock Grid.Column="1" Grid.Row="2" Text="• Must be unique, 2+ chars"
|
|
|
|
Foreground="{Binding TagLabelBrush}"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
|
2019-12-06 00:08:30 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Margin="0,10,0,4" Text="Preview:"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</Grid>
|
|
|
|
|
2019-12-06 00:08:30 +00:00
|
|
|
<Border Grid.Row="1" BorderThickness="1" HorizontalAlignment="Stretch"
|
2019-12-01 01:52:33 +00:00
|
|
|
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
|
2020-03-09 00:05:08 +00:00
|
|
|
Background="{StaticResource CheckerBackground}"
|
|
|
|
SnapsToDevicePixels="True">
|
2020-03-03 01:12:59 +00:00
|
|
|
<!-- explicit width gets cleared after initial window layout -->
|
2020-03-08 00:52:36 +00:00
|
|
|
<Grid Name="previewGrid" Width="548" Height="400">
|
2020-03-03 01:12:59 +00:00
|
|
|
<!-- either the image or the path is shown, not both; background is set to
|
|
|
|
transparent for image, black for path -->
|
2020-03-02 02:18:31 +00:00
|
|
|
<Image Name="previewImage" Source="/Res/RedX.png"
|
2020-03-09 00:05:08 +00:00
|
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
2020-03-03 01:12:59 +00:00
|
|
|
<!-- ClipToBounds="True" -->
|
|
|
|
<!-- RenderOptions.EdgeMode="Aliased" -->
|
2020-03-02 02:18:31 +00:00
|
|
|
<Viewbox>
|
2020-03-09 00:05:08 +00:00
|
|
|
<Path Name="wireframePath" Stroke="White" StrokeThickness="2"/>
|
2020-03-02 02:18:31 +00:00
|
|
|
</Viewbox>
|
|
|
|
</Grid>
|
2019-11-28 01:12:26 +00:00
|
|
|
</Border>
|
2019-11-25 22:27:38 +00:00
|
|
|
|
2019-12-12 06:12:20 +00:00
|
|
|
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
|
|
|
|
<TextBlock FontSize="10" Text="Bitmap size: "/>
|
|
|
|
<TextBlock FontSize="10" Text="{Binding BitmapDimensions, FallbackValue=32x64}"/>
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<Grid Grid.Row="3" HorizontalAlignment="Left">
|
2019-11-25 22:27:38 +00:00
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
2019-12-03 00:38:32 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2019-12-03 00:38:32 +00:00
|
|
|
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,4">
|
|
|
|
<!--<TextBlock Text="Message:" Margin="0,0,8,0"/>-->
|
2019-12-12 06:12:20 +00:00
|
|
|
<TextBlock Text="{Binding PluginErrMessage, FallbackValue=ERROR}" Foreground="Red"/>
|
2019-12-03 00:38:32 +00:00
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<TextBlock Grid.Row="1" Text="Parameters:" Margin="0,0,0,4"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
|
|
|
|
<!-- generated controls are placed here -->
|
2019-12-06 00:08:30 +00:00
|
|
|
<ItemsControl Grid.Row="2" Width="400"
|
2019-11-25 22:27:38 +00:00
|
|
|
ItemsSource="{Binding ParameterList}"
|
|
|
|
ItemTemplateSelector="{StaticResource ParameterTemplateSelector}">
|
|
|
|
</ItemsControl>
|
|
|
|
</Grid>
|
2020-03-08 00:52:36 +00:00
|
|
|
|
|
|
|
<Grid Grid.Row="4" HorizontalAlignment="Left" Visibility="{Binding WireframeCtrlVisibility}">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<Rectangle Grid.Row="0" Grid.ColumnSpan="3" Margin="0,4,0,4" HorizontalAlignment="Stretch"
|
2020-03-08 00:52:36 +00:00
|
|
|
Fill="LightGray" Height="2"/>
|
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="1" Text="X axis rotation (deg):" Margin="0,5,0,0"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<TextBox Grid.Column="1" Grid.Row="1" Margin="4,4,0,0" Width="30" MaxLength="3"
|
|
|
|
Text="{Binding ElementName=initialXSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}"/>
|
|
|
|
<Slider Name="initialXSlider" Grid.Column="2" Grid.Row="1" Margin="4,4,0,0" Width="360"
|
|
|
|
Minimum="0" Maximum="359" TickFrequency="1" IsSnapToTickEnabled="True"
|
|
|
|
ValueChanged="InitialRotSlider_ValueChanged"/>
|
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="2" Text="Y axis rotation (deg):" Margin="0,5,0,0"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<TextBox Grid.Column="1" Grid.Row="2" Margin="4,4,0,0" Width="30" MaxLength="3"
|
|
|
|
Text="{Binding ElementName=initialYSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}"/>
|
|
|
|
<Slider Name="initialYSlider" Grid.Column="2" Grid.Row="2" Margin="4,4,0,0" Width="360"
|
|
|
|
Minimum="0" Maximum="359" TickFrequency="1" IsSnapToTickEnabled="True"
|
|
|
|
ValueChanged="InitialRotSlider_ValueChanged"/>
|
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="3" Text="Z axis rotation (deg):" Margin="0,5,0,0"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<TextBox Grid.Column="1" Grid.Row="3" Margin="4,4,0,0" Width="30" MaxLength="3"
|
|
|
|
Text="{Binding ElementName=initialZSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}"/>
|
|
|
|
<Slider Name="initialZSlider" Grid.Column="2" Grid.Row="3" Margin="4,4,0,0" Width="360"
|
|
|
|
Minimum="0" Maximum="359" TickFrequency="1" IsSnapToTickEnabled="True"
|
|
|
|
ValueChanged="InitialRotSlider_ValueChanged"/>
|
|
|
|
|
|
|
|
<CheckBox Name="isAnimated" Grid.Column="0" Grid.Row="4" Content="Animated" Margin="0,4,0,0"
|
|
|
|
IsChecked="{Binding IsWireframeAnimated}"/>
|
|
|
|
|
|
|
|
<!-- remaining items are enabled when "isAnimated" checkbox is checked -->
|
|
|
|
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" Margin="0,5,0,0"
|
2020-03-09 00:05:08 +00:00
|
|
|
Text="Rotation per frame:"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<StackPanel Grid.Column="1" Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" Margin="4,4,0,0"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}">
|
|
|
|
<TextBlock Text="X:" Margin="0,1,0,0"/>
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBox Width="40" MaxLength="4" Margin="4,0,0,0"
|
|
|
|
Text="{Binding RotDeltaX}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<TextBlock Text="Y:" Margin="8,1,0,0"/>
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBox Width="40" MaxLength="4" Margin="4,0,0,0"
|
|
|
|
Text="{Binding RotDeltaY}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<TextBlock Text="Z:" Margin="8,1,0,0"/>
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBox Width="40" MaxLength="4" Margin="4,0,0,0"
|
|
|
|
Text="{Binding RotDeltaZ}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
</StackPanel>
|
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="6" Text="Frame count:" Margin="0,5,0,0"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
|
|
|
<TextBox Grid.Column="1" Grid.Row="6" Width="50" Height="18" Margin="4,4,0,0"
|
|
|
|
Text="{Binding FrameCount}" MaxLength="4"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
<Button Grid.Column="2" Grid.Row="6" Width="70" Margin="4,4,0,0" HorizontalAlignment="Left"
|
2020-03-09 00:05:08 +00:00
|
|
|
Content="Auto" Click="AutoFrameCountButton_Click"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
|
2020-03-09 00:05:08 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="7" Text="Frame delay (msec):" Margin="0,5,0,0"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
|
|
|
<TextBox Grid.Column="1" Grid.Row="7" Width="50" Margin="4,4,0,0"
|
|
|
|
Text="{Binding FrameDelayMsec}" MaxLength="5"
|
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
2020-03-08 00:52:36 +00:00
|
|
|
</Grid>
|
2019-11-25 22:27:38 +00:00
|
|
|
|
2020-03-08 00:52:36 +00:00
|
|
|
<DockPanel Grid.Column="0" Grid.Row="5" Margin="0,8,0,0" LastChildFill="False">
|
2020-03-09 20:48:30 +00:00
|
|
|
<Button DockPanel.Dock="Left" Content="_Test Animation..." Width="110"
|
|
|
|
Click="TestAnim_Click" Visibility="{Binding WireframeCtrlVisibility}"
|
2020-03-08 00:52:36 +00:00
|
|
|
IsEnabled="{Binding ElementName=isAnimated, Path=IsChecked}"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
<Button DockPanel.Dock="Right" Content="Cancel" Width="70" Margin="8,0,0,0" IsCancel="True"/>
|
|
|
|
<Button DockPanel.Dock="Right" Grid.Column="1" Content="OK" Width="70"
|
2019-11-27 02:54:42 +00:00
|
|
|
IsDefault="True" IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
|
2019-11-25 22:27:38 +00:00
|
|
|
</DockPanel>
|
|
|
|
</Grid>
|
|
|
|
</Window>
|