1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-04 01:29:34 +00:00
6502bench/SourceGen/WpfGui/EditBitmapAnimation.xaml

149 lines
7.5 KiB
Plaintext
Raw Normal View History

<!--
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"
mc:Ignorable="d"
Title="Edit Bitmap Animation"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- top section: bitmap visualization selection -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3"
Text="Select bitmap visualizations to use as animation frames:"/>
<DataGrid Grid.Column="0" Grid.Row="1" Name="visSourceGrid"
IsReadOnly="True"
ItemsSource="{Binding VisSourceItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
SelectionMode="Single"
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}">
<Image Source="{Binding CachedImage}" Width="48" Height="48"
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Tag" Width="176" Binding="{Binding Tag}"/>
</DataGrid.Columns>
</DataGrid>
<DataGrid Grid.Column="2" Grid.Row="1" Name="visAnimGrid"
IsReadOnly="True"
ItemsSource="{Binding VisAnimItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
SelectionMode="Single"
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}">
<Image Source="{Binding CachedImage}" Width="48" Height="48"
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
</Border>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Tag" Width="176" Binding="{Binding Tag}"/>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Column="1" Grid.Row="1" Height="200">
<Button Content="Add &#x2192;" Width="70" Margin="4,24,4,4"/>
<Button Content="&#x2190; Remove" Width="70" Margin="4,0,4,4"/>
<Button Content="Clear" Width="70" Margin="4,4,4,4"/>
<Button Content="Up &#x2191;" Width="70" Margin="4,20,4,4"/>
<Button Content="Down &#x2193;" Width="70" Margin="4,0,4,4"/>
</StackPanel>
</Grid>
<!-- middle section: parameters -->
<Grid Grid.Row="1" Margin="0,8,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="Frame delay (msec):" Margin="0,1,0,0"/>
<TextBox Width="40" MaxLength="5" Margin="4,0,0,0"
Text="{Binding FrameDelayTimeMsec, FallbackValue=88888}" />
</StackPanel>
</Grid>
<!-- bottom section: preview -->
<Grid Grid.Row="2" Margin="0,8,0,0">
<TextBlock Text="Preview:"/>
</Grid>
<DockPanel Grid.Row="3" Margin="0,8,0,0" LastChildFill="False">
<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>