1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-09-10 13:54:52 +00:00
6502bench/SourceGen/WpfGui/Export.xaml
Andy McFadden 81157b6b47 Implement text export
This feature "exports" the source code in the same format it appears
in on screen.  The five columns on the left are optional, the four
on the right can be resized.  Exported text can span the entire file
or just the current selection.  Output can be plain text or CSV.
(I still haven't figured out a good use for CSV.)

The old copy-to-clipboard function is now implemented via the export
mechanism.

This adds a new clipboard mode that includes all columns.  Potentially
useful for filing bug reports against SourceGen.
2019-09-12 13:57:52 -07:00

125 lines
6.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.Export"
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="Export Source"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded">
<Grid Margin="8">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="General Options" Padding="2,4">
<StackPanel>
<CheckBox Content="Include notes" IsChecked="{Binding IncludeNotes}"/>
<CheckBox Content="Show Offset column" Margin="0,2,0,0" IsChecked="{Binding ShowOffset}"/>
<CheckBox Content="Show Address column" Margin="0,2,0,0" IsChecked="{Binding ShowAddress}"/>
<CheckBox Content="Show Bytes column" Margin="0,2,0,0" IsChecked="{Binding ShowBytes}"/>
<CheckBox Content="Show Flags column" Margin="0,2,0,0" IsChecked="{Binding ShowFlags}"/>
<CheckBox Content="Show Attributes column" Margin="0,2,0,0" IsChecked="{Binding ShowAttr}"/>
<TextBlock Text="Column widths (label, opcode, operand, comment):" Margin="0,4,0,0"/>
<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
<TextBox Name="asmLabelColWidthTextBox" Width="60" Margin="0,0,4,0"
TextChanged="AsmColWidthTextBox_TextChanged">
<TextBox.Text>
<Binding Path="AsmLabelColWidth" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Name="asmOpcodeColWidthTextBox" Width="60" Margin="0,0,4,0"
TextChanged="AsmColWidthTextBox_TextChanged">
<TextBox.Text>
<Binding Path="AsmOpcodeColWidth" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Name="asmOperandColWidthTextBox" Width="60" Margin="0,0,4,0"
TextChanged="AsmColWidthTextBox_TextChanged">
<TextBox.Text>
<Binding Path="AsmOperandColWidth" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Name="asmCommentColWidthTextBox" Width="60" Margin="0,0,8,0"
TextChanged="AsmColWidthTextBox_TextChanged">
<TextBox.Text>
<Binding Path="AsmCommentColWidth" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<local:AsmColWidthRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</StackPanel>
<CheckBox Content="Include only selected lines" Margin="0,4,0,0" IsChecked="{Binding SelectionOnly}"/>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="1" Header="Text Options" Padding="2,4">
<StackPanel>
<RadioButton Content="Plain text (UTF-8)" GroupName="TextMode" IsChecked="{Binding TextModePlain}"/>
<RadioButton Content="CSV" GroupName="TextMode" Margin="0,2,0,0" IsChecked="{Binding TextModeCsv}"/>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="2" Header="HTML Options" Padding="2,4">
<StackPanel>
<CheckBox Content="Include symbol table" IsChecked="{Binding IncludeSymbolTable}"/>
<CheckBox Content="Overwrite CSS file" Margin="0,2,0,0" IsChecked="{Binding OverwriteCss}"/>
</StackPanel>
</GroupBox>
<Grid Grid.Row="3" Margin="0,8,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="Generate HTML" Width="100"
IsEnabled="{Binding IsValid}" Click="GenerateHtmlButton_Click"/>
<Button Grid.Column="1" Content="Generate Text" Width="100" Margin="8,0,0,0"
IsEnabled="{Binding IsValid}" Click="GenerateTextButton_Click"/>
<Button Grid.Column="2" Content="Cancel" IsCancel="True" Width="70" Margin="8,0,0,0"
HorizontalAlignment="Right"/>
</Grid>
</Grid>
</Window>