1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-02 13:51:36 +00:00
6502bench/SourceGen/Tools/Omf/WpfGui/OmfSegmentViewer.xaml
Andy McFadden 327ad4fbbc Store reduced OMF relocation data in project file
A "cooked" form of the relocation data is added to the project, for
use during data analysis.

Also, changed the data grids in the segment viewer to allow multi-
select, so users can copy & paste the contents.
2020-07-02 17:10:05 -07:00

143 lines
7.5 KiB
XML

<!--
Copyright 2020 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.Tools.Omf.WpfGui.OmfSegmentViewer"
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.Tools.Omf.WpfGui"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="OMF Segment Viewer"
SizeToContent="Height" Width="600" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
<system:String x:Key="str_FileOffsetLenFmt">File offset {0}, length {1} ({2})</system:String>
<system:String x:Key="str_RecordHeaderFmt">Records ({0}):</system:String>
<system:String x:Key="str_RelocHeaderFmt">Relocation dictionary ({0}):</system:String>
</Window.Resources>
<Grid Margin="8">
<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>
<TextBlock Grid.Row="0" Text="{Binding FileOffsetLenStr, FallbackValue=File Offset / Length}" Margin="0,8,0,0"/>
<TextBlock Grid.Row="1" Text="Header fields:" Margin="0,8,0,0"/>
<DataGrid Name="headerList" Grid.Row="2" Height="145" Margin="0,8,0,0"
IsReadOnly="True"
ItemsSource="{Binding HeaderItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Extended">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<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>
<DataGridTextColumn Header="Name" Width="100" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Value" Width="120" Binding="{Binding Value}"/>
<DataGridTextColumn Header="Notes" Width="280" Binding="{Binding Note}"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="3" Text="{Binding RecordHeaderStr, FallbackValue=Records (123):}" Margin="0,8,0,0"/>
<DataGrid Name="recordList" Grid.Row="4" Height="145" Margin="0,8,0,0"
IsReadOnly="True"
ItemsSource="{Binding RecordItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Extended">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<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>
<DataGridTextColumn Header="OpName" Width="80" Binding="{Binding OpName}"/>
<DataGridTextColumn Header="Length" Width="80" Binding="{Binding Length}"/>
<DataGridTextColumn Header="Value" Width="380" Binding="{Binding Value}"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock Grid.Row="5" Text="{Binding RelocHeaderStr, FallbackValue=Relocation dictionary:}" Margin="0,8,0,0"
Visibility="{Binding HasRelocs, Converter={StaticResource BoolToVis}}"/>
<DataGrid Name="relocList" Grid.Row="6" Height="145" Margin="0,8,0,0"
Visibility="{Binding HasRelocs, Converter={StaticResource BoolToVis}}"
IsReadOnly="True"
ItemsSource="{Binding RelocItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="Vertical"
VerticalGridLinesBrush="#FF7F7F7F"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Extended">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<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>
<DataGridTextColumn Header="Bytes" Width="50" Binding="{Binding Width}"/>
<DataGridTextColumn Header="Offset" Width="70" Binding="{Binding Offset}"/>
<DataGridTextColumn Header="Rel Off" Width="70" Binding="{Binding RelOffset}"/>
<DataGridTextColumn Header="Shift" Width="50" Binding="{Binding Shift}"/>
<DataGridTextColumn Header="File Num" Width="70" Binding="{Binding FileNum}"/>
<DataGridTextColumn Header="Seg Num" Width="70" Binding="{Binding SegNum}"/>
<DataGridTextColumn Header="Super Type" Width="80" Binding="{Binding SuperType}"/>
</DataGrid.Columns>
</DataGrid>
<DockPanel Grid.Row="7" LastChildFill="False" Margin="0,16,0,0">
<Button DockPanel.Dock="Right" Content="Done" Width="70" IsCancel="True"/>
</DockPanel>
</Grid>
</Window>