mirror of
https://github.com/fadden/6502bench.git
synced 2024-09-11 04:57:02 +00:00
Added some rudimentary bitmap creation code. Got a test pattern generated by the plugin to display in the app. (Most of the time required for this was spent figuring out how bitmaps are handled in WPF.)
155 lines
7.4 KiB
XML
155 lines
7.4 KiB
XML
<!--
|
|
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"
|
|
Width="460" SizeToContent="Height" ResizeMode="NoResize"
|
|
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
|
Loaded="Window_Loaded">
|
|
|
|
<Window.Resources>
|
|
<!-- big thanks: http://drwpf.com/blog/2008/01/03/itemscontrol-d-is-for-datatemplate/ -->
|
|
<DataTemplate x:Key="BoolTemplate">
|
|
<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"/>
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="0,1,0,0"
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
<DataTemplate x:Key="IntTemplate">
|
|
<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}"
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
TextChanged="TextBox_TextChanged"/>
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="0,1,0,0"
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
</Grid>
|
|
</DataTemplate>
|
|
<DataTemplate x:Key="FloatTemplate">
|
|
<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}"
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
TextChanged="TextBox_TextChanged"/>
|
|
<TextBlock Grid.Column="2" Text="{Binding RangeText}" Margin="0,1,0,0"
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
</Grid>
|
|
</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>
|
|
|
|
<Grid Margin="8">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid Grid.Row="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="130"/>
|
|
<ColumnDefinition Width="*"/>
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right" Margin="0,0,4,0"
|
|
Text="Visualizer:"/>
|
|
<ComboBox Name="visComboBox" Grid.Column="1" Grid.Row="0" Margin="0,0,0,4"
|
|
ItemsSource="{Binding VisualizationList}" DisplayMemberPath="VisDescriptor.UiName"
|
|
SelectionChanged="VisComboBox_SelectionChanged"/>
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" Margin="0,0,4,0"
|
|
Text="Tag:" Foreground="{Binding TagLabelBrush}"/>
|
|
<TextBox Grid.Column="1" Grid.Row="1"
|
|
Text="{Binding TagString, UpdateSourceTrigger=PropertyChanged}"
|
|
FontFamily="{StaticResource GeneralMonoFont}"/>
|
|
|
|
<TextBlock Grid.Column="1" Grid.Row="2" Text="• Must be unique, 2+ chars"/>
|
|
|
|
<TextBlock Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" Margin="0,20,0,4" Text="Preview:"/>
|
|
</Grid>
|
|
|
|
<Border Grid.Row="1" BorderThickness="1"
|
|
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}">
|
|
<Image Name="previewImage" Width="400" Height="400" Source="/Res/AboutImage.png"
|
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
|
</Border>
|
|
|
|
<Grid Grid.Row="2">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Grid.Row="0" Text="Parameters:" Margin="0,0,0,4"/>
|
|
|
|
<!-- generated controls are placed here -->
|
|
<ItemsControl Grid.Row="1"
|
|
ItemsSource="{Binding ParameterList}"
|
|
ItemTemplateSelector="{StaticResource ParameterTemplateSelector}">
|
|
</ItemsControl>
|
|
</Grid>
|
|
|
|
<DockPanel Grid.Column="0" 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>
|