2019-12-18 00:40:27 +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.EditBitmapAnimation"
|
|
|
|
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:SourceGen.WpfGui"
|
2019-12-20 23:05:16 +00:00
|
|
|
xmlns:common="clr-namespace:CommonWPF;assembly=CommonWPF"
|
2019-12-18 00:40:27 +00:00
|
|
|
mc:Ignorable="d"
|
|
|
|
Title="Edit Bitmap Animation"
|
|
|
|
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
|
2019-12-20 23:05:16 +00:00
|
|
|
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
|
|
|
Closing="Window_Closing">
|
2019-12-18 00:40:27 +00:00
|
|
|
|
|
|
|
<Grid Margin="8">
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
2019-12-20 23:05:16 +00:00
|
|
|
<RowDefinition Height="Auto"/>
|
2019-12-18 00:40:27 +00:00
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<!-- top section: tag entry -->
|
|
|
|
<StackPanel Grid.Row="0">
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
<TextBlock Margin="0,0,4,0" Text="Tag:"/>
|
|
|
|
<TextBox Width="250" Margin="4,1,0,0"
|
|
|
|
Text="{Binding TagString, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<TextBlock Text="• Must be unique, 2+ chars" Margin="30,0,0,0" Foreground="{Binding TagLabelBrush}"/>
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<!-- upper-middle section: bitmap visualization selection -->
|
|
|
|
<Grid Grid.Row="1" Margin="0,8,0,0">
|
2019-12-18 00:40:27 +00:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Margin="0,0,0,4"
|
|
|
|
Text="Select visualizations to use as animation frames:"/>
|
2019-12-18 00:40:27 +00:00
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<DataGrid Grid.Column="0" Grid.Row="1" Name="visSourceGrid" Width="251" Height="300"
|
2019-12-18 00:40:27 +00:00
|
|
|
IsReadOnly="True"
|
|
|
|
ItemsSource="{Binding VisSourceItems}"
|
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
GridLinesVisibility="Vertical"
|
|
|
|
VerticalGridLinesBrush="#FF7F7F7F"
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
HeadersVisibility="Column"
|
|
|
|
CanUserReorderColumns="False"
|
2019-12-22 22:21:18 +00:00
|
|
|
SelectionMode="Extended"
|
2019-12-20 23:05:16 +00:00
|
|
|
SelectionChanged="VisSourceGrid_SelectionChanged"
|
2019-12-18 00:40:27 +00:00
|
|
|
MouseDoubleClick="VisSourceGrid_MouseDoubleClick">
|
|
|
|
<DataGrid.Resources>
|
|
|
|
<!-- make the no-focus color the same as the in-focus color -->
|
|
|
|
<!-- thanks: https://stackoverflow.com/a/13053511/294248 -->
|
|
|
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
|
|
|
|
Color="{x:Static SystemColors.HighlightColor}"/>
|
|
|
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
|
|
|
|
Color="{x:Static SystemColors.HighlightTextColor}"/>
|
|
|
|
</DataGrid.Resources>
|
|
|
|
<DataGrid.Columns>
|
|
|
|
<DataGridTemplateColumn Header="Img" Width="56">
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate>
|
|
|
|
<Border BorderThickness="0" Background="{StaticResource BitmapBackground}">
|
2019-12-25 18:07:42 +00:00
|
|
|
<Grid>
|
|
|
|
<Image Source="{Binding CachedImage}" Width="48" Height="48"
|
|
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
|
|
|
<Image Source="{Binding OverlayImage}" Width="48" Height="48"/>
|
|
|
|
</Grid>
|
2019-12-18 00:40:27 +00:00
|
|
|
</Border>
|
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTextColumn Header="Tag" Width="176" Binding="{Binding Tag}"/>
|
|
|
|
</DataGrid.Columns>
|
|
|
|
</DataGrid>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<DataGrid Grid.Column="2" Grid.Row="1" Name="visAnimGrid" Width="251" Height="300"
|
2019-12-18 00:40:27 +00:00
|
|
|
IsReadOnly="True"
|
|
|
|
ItemsSource="{Binding VisAnimItems}"
|
|
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
|
|
SnapsToDevicePixels="True"
|
|
|
|
GridLinesVisibility="Vertical"
|
|
|
|
VerticalGridLinesBrush="#FF7F7F7F"
|
|
|
|
AutoGenerateColumns="False"
|
|
|
|
HeadersVisibility="Column"
|
|
|
|
CanUserReorderColumns="False"
|
|
|
|
SelectionMode="Single"
|
2019-12-20 23:05:16 +00:00
|
|
|
SelectionChanged="VisAnimGrid_SelectionChanged"
|
2019-12-18 00:40:27 +00:00
|
|
|
MouseDoubleClick="VisAnimGrid_MouseDoubleClick">
|
|
|
|
<DataGrid.Resources>
|
|
|
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
|
|
|
|
Color="{x:Static SystemColors.HighlightColor}"/>
|
|
|
|
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
|
|
|
|
Color="{x:Static SystemColors.HighlightTextColor}"/>
|
|
|
|
</DataGrid.Resources>
|
|
|
|
<DataGrid.Columns>
|
|
|
|
<DataGridTemplateColumn Header="Img" Width="56">
|
|
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
|
|
<DataTemplate>
|
|
|
|
<Border BorderThickness="0" Background="{StaticResource BitmapBackground}">
|
2019-12-25 18:07:42 +00:00
|
|
|
<Grid>
|
|
|
|
<Image Source="{Binding CachedImage}" Width="48" Height="48"
|
|
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
|
|
|
<Image Source="{Binding OverlayImage}" Width="48" Height="48"/>
|
|
|
|
</Grid>
|
2019-12-18 00:40:27 +00:00
|
|
|
</Border>
|
|
|
|
</DataTemplate>
|
|
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
|
|
</DataGridTemplateColumn>
|
|
|
|
<DataGridTextColumn Header="Tag" Width="176" Binding="{Binding Tag}"/>
|
|
|
|
</DataGrid.Columns>
|
|
|
|
</DataGrid>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<StackPanel Grid.Column="1" Grid.Row="1">
|
|
|
|
<Button Content="Add →" Width="70" Margin="4,24,4,4"
|
|
|
|
IsEnabled="{Binding IsAddEnabled}" Click="AddButton_Click"/>
|
|
|
|
<Button Content="← Remove" Width="70" Margin="4,0,4,4"
|
|
|
|
IsEnabled="{Binding IsRemoveEnabled}" Click="RemoveButton_Click"/>
|
|
|
|
<Button Content="Clear" Width="70" Margin="4,4,4,4"
|
|
|
|
IsEnabled="{Binding IsRemoveEnabled}" Click="ClearButton_Click"/>
|
|
|
|
<Button Content="Up ↑" Width="70" Margin="4,20,4,4"
|
|
|
|
IsEnabled="{Binding IsUpEnabled}" Click="UpButton_Click"/>
|
|
|
|
<Button Content="Down ↓" Width="70" Margin="4,0,4,4"
|
|
|
|
IsEnabled="{Binding IsDownEnabled}" Click="DownButton_Click"/>
|
2019-12-18 00:40:27 +00:00
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<!-- lower-middle section: parameters -->
|
|
|
|
<Grid Grid.Row="2" Margin="0,8,0,0">
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
2019-12-18 00:40:27 +00:00
|
|
|
</StackPanel>
|
2019-12-20 23:05:16 +00:00
|
|
|
|
|
|
|
<Grid Grid.Row="0">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" Margin="0,1,4,0"
|
|
|
|
Text="Frame delay (msec):" Foreground="{Binding FrameDelayLabelBrush}"/>
|
|
|
|
<TextBox Grid.Column="1" Grid.Row="2" Width="40" HorizontalAlignment="Left" Margin="0,0,0,0"
|
|
|
|
Text="{Binding FrameDelayTimeMsec, UpdateSourceTrigger=PropertyChanged, FallbackValue=88888}"
|
|
|
|
MaxLength="5"/>
|
|
|
|
</Grid>
|
2019-12-18 00:40:27 +00:00
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<!-- bottom section: preview -->
|
2019-12-20 23:05:16 +00:00
|
|
|
<Grid Grid.Row="3" Margin="0,8,0,0">
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
|
|
|
<Border Grid.Row="0" BorderBrush="Black" BorderThickness="1"
|
|
|
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
|
|
Background="{StaticResource CheckerBackground}">
|
|
|
|
<common:FrameAnimationControl Name="previewAnim" Width="256" Height="256"
|
|
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
|
|
|
</Border>
|
|
|
|
<Button Grid.Row="1" Width="120" Content="Start / Stop" Margin="0,4,0,0"
|
|
|
|
Click="showPreviewClick" IsEnabled="{Binding IsPreviewEnabled}"/>
|
2019-12-18 00:40:27 +00:00
|
|
|
</Grid>
|
|
|
|
|
2019-12-20 23:05:16 +00:00
|
|
|
<DockPanel Grid.Row="4" Margin="0,8,0,0" LastChildFill="False">
|
2019-12-18 00:40:27 +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"
|
|
|
|
IsDefault="True" IsEnabled="{Binding IsValid}" Click="OkButton_Click"/>
|
|
|
|
</DockPanel>
|
|
|
|
</Grid>
|
|
|
|
</Window>
|