mirror of
https://github.com/fadden/6502bench.git
synced 2024-12-03 05:49:48 +00:00
80ec6b6c78
The various items in the Actions menu are enabled or disabled based on the current selection. There's no SelectedIndices property in WPF ListViews, so we have to do things slightly differently. The SelectedItems list isn't kept sorted to match the list contents, so finding first/last item requires a bit of scanning. Also, rearranged some stuff. I'm trying to keep the old and new code somewhat parallel, to make it easier to walk through at the end and see if I've missed something.
326 lines
16 KiB
XML
326 lines
16 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="SourceGenWPF.ProjWin.MainWindow"
|
|
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:SourceGenWPF.ProjWin"
|
|
mc:Ignorable="d"
|
|
Title="6502bench SourceGen"
|
|
Icon="/SourceGenWPF;component/Res/SourceGenIcon.ico"
|
|
Width="1000" Height="600" MinWidth="800" MinHeight="500"
|
|
Loaded="Window_Loaded">
|
|
|
|
<Window.Resources>
|
|
<ResourceDictionary>
|
|
<!-- style and control templates for main code ListView items -->
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="CodeListItemStyle.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<!-- don't center the ListView(GridView) column headers
|
|
https://stackoverflow.com/q/44119146/294248
|
|
(style without ID applies to all instances of that type)
|
|
-->
|
|
<Style TargetType="{x:Type GridViewColumnHeader}">
|
|
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
|
</Style>
|
|
|
|
<RoutedUICommand x:Key="AssembleCmd" Text="Assemble...">
|
|
<RoutedUICommand.InputGestures>
|
|
<KeyGesture>Ctrl+Shift+A</KeyGesture>
|
|
</RoutedUICommand.InputGestures>
|
|
</RoutedUICommand>
|
|
<RoutedUICommand x:Key="CloseCmd" Text="Close"/>
|
|
<RoutedUICommand x:Key="HintAsCodeEntryPoint" Text="Hint As Code Entry Point"/>
|
|
<RoutedUICommand x:Key="HintAsDataStart" Text="Hint As Data Start"/>
|
|
<RoutedUICommand x:Key="HintAsInlineData" Text="Hint As Inline Data"/>
|
|
<RoutedUICommand x:Key="RemoveHints" Text="Remove Hints"/>
|
|
<RoutedUICommand x:Key="RecentProjectCmd"/>
|
|
<RoutedUICommand x:Key="SelectAllCmd" Text="Select All">
|
|
<RoutedUICommand.InputGestures>
|
|
<KeyGesture>Ctrl+A</KeyGesture>
|
|
</RoutedUICommand.InputGestures>
|
|
</RoutedUICommand>
|
|
</ResourceDictionary>
|
|
</Window.Resources>
|
|
|
|
<Window.CommandBindings>
|
|
<CommandBinding Command="{StaticResource AssembleCmd}"
|
|
CanExecute="IsProjectOpen" Executed="AssembleCmd_Executed"/>
|
|
<CommandBinding Command="{StaticResource CloseCmd}"
|
|
CanExecute="IsProjectOpen" Executed="CloseCmd_Executed"/>
|
|
<CommandBinding Command="{StaticResource HintAsCodeEntryPoint}"
|
|
CanExecute="CanHintAsCodeEntryPoint" Executed="HintAsCodeEntryPoint_Executed"/>
|
|
<CommandBinding Command="{StaticResource HintAsDataStart}"
|
|
CanExecute="CanHintAsDataStart" Executed="HintAsDataStart_Executed"/>
|
|
<CommandBinding Command="{StaticResource HintAsInlineData}"
|
|
CanExecute="CanHintAsInlineData" Executed="HintAsInlineData_Executed"/>
|
|
<CommandBinding Command="{StaticResource RemoveHints}"
|
|
CanExecute="CanRemoveHints" Executed="RemoveHints_Executed"/>
|
|
<CommandBinding Command="{StaticResource RecentProjectCmd}" Executed="RecentProjectCmd_Executed"/>
|
|
<!-- ListView has a built-in Ctrl+A handler; this only fires when codeListView not in focus -->
|
|
<CommandBinding Command="{StaticResource SelectAllCmd}"
|
|
CanExecute="IsProjectOpen" Executed="SelectAllCmd_Executed"/>
|
|
</Window.CommandBindings>
|
|
|
|
<DockPanel>
|
|
<Menu Name="appMenu" DockPanel.Dock="Top">
|
|
<MenuItem Header="_File">
|
|
<MenuItem Header="New"/>
|
|
<MenuItem Header="Open"/>
|
|
<MenuItem Command="Save"/>
|
|
<MenuItem Command="SaveAs"/>
|
|
<MenuItem Command="{StaticResource CloseCmd}"/>
|
|
<Separator/>
|
|
<MenuItem Command="{StaticResource AssembleCmd}"/>
|
|
<MenuItem Command="Print"/>
|
|
<Separator/>
|
|
<MenuItem Header="Recent Projects">
|
|
<MenuItem Header="(none)"/>
|
|
</MenuItem>
|
|
<Separator/>
|
|
<MenuItem Header="Exit"/>
|
|
</MenuItem>
|
|
<MenuItem Header="_Edit">
|
|
<MenuItem Command="Undo"/>
|
|
<MenuItem Command="Redo"/> <!-- want both Ctrl+Y and Ctrl+Shift+Z -->
|
|
<Separator/>
|
|
<MenuItem Command="Copy"/>
|
|
<Separator/>
|
|
<MenuItem Command="{StaticResource SelectAllCmd}"/>
|
|
<MenuItem Command="Find"/>
|
|
<MenuItem Header="Find Next"/>
|
|
<MenuItem Header="Go To..."/>
|
|
<Separator/>
|
|
<MenuItem Header="Edit Header Comment..."/>
|
|
<MenuItem Command="Properties" Header="Project Properties..."/>
|
|
<MenuItem Header="Toggle Data Scan"/>
|
|
<Separator/>
|
|
<MenuItem Header="Settings..."/>
|
|
</MenuItem>
|
|
<MenuItem Name="ActionsMenu" Header="_Actions">
|
|
<MenuItem Header="Set Address..."/>
|
|
<MenuItem Header="Override Status Flags..."/>
|
|
<MenuItem Header="Edit Label..."/>
|
|
<MenuItem Header="Edit Operand..."/>
|
|
<MenuItem Header="Edit Comment..."/>
|
|
<MenuItem Header="Edit Long Comment..."/>
|
|
<MenuItem Header="Edit Note..."/>
|
|
<MenuItem Header="Edit Project Symbol..."/>
|
|
<Separator/>
|
|
<MenuItem Command="{StaticResource HintAsCodeEntryPoint}" InputGestureText="Ctrl+H, Ctrl+C"/>
|
|
<MenuItem Command="{StaticResource HintAsDataStart}" InputGestureText="Ctrl+H, Ctrl+D"/>
|
|
<MenuItem Command="{StaticResource HintAsInlineData}" InputGestureText="Ctrl+H, Ctrl+I"/>
|
|
<MenuItem Command="{StaticResource RemoveHints}" InputGestureText="Ctrl+H, Ctrl+R"/>
|
|
<Separator/>
|
|
<MenuItem Header="Format Split-Address Table..."/>
|
|
<MenuItem Header="Toggle Single-Byte Format"/>
|
|
<MenuItem Header="Format As Word"/>
|
|
<MenuItem Header="Delete Note/Long Comment"/>
|
|
<Separator/>
|
|
<MenuItem Header="Show Hex Dump"/>
|
|
</MenuItem>
|
|
<MenuItem Header="_Tools">
|
|
<MenuItem Header="Hex Dump..."/>
|
|
<MenuItem Header="ASCII Chart"/>
|
|
</MenuItem>
|
|
<MenuItem Header="_Help">
|
|
<MenuItem Command="Help"/>
|
|
<MenuItem Header="About..."/>
|
|
</MenuItem>
|
|
<MenuItem Header="_DEBUG" Name="DebugMenu">
|
|
<MenuItem Command="Refresh" Header="Re-analyze"/>
|
|
<MenuItem Header="Show Undo/Redo History"/>
|
|
<MenuItem Header="Show Analyzer Output"/>
|
|
<MenuItem Header="Show Analysis Timers"/>
|
|
<MenuItem Header="Extension Script Info..."/>
|
|
<Separator/>
|
|
<MenuItem Header="Toggle Comment Rulers"/>
|
|
<MenuItem Header="Use Keep-Alive Hack"/>
|
|
<Separator/>
|
|
<MenuItem Header="Source Generation Tests..."/>
|
|
</MenuItem>
|
|
</Menu>
|
|
|
|
<ToolBar DockPanel.Dock="Top">
|
|
<Button Content="tbb" Width="75"/>
|
|
</ToolBar>
|
|
|
|
<StatusBar Name="mainStatusBar" DockPanel.Dock="Bottom">
|
|
<TextBlock Text="Ready"/>
|
|
</StatusBar>
|
|
|
|
<!-- Main part of the window. Three side-by-side panels, only the middle of which changes
|
|
size when the window is resized. -->
|
|
<Grid Name="triptychGrid" DockPanel.Dock="Top">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="168" MinWidth="100"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="*" MinWidth="150"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="187" MinWidth="100"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
<GridSplitter Width="4" Grid.Column="1" HorizontalAlignment="Left"/>
|
|
<GridSplitter Width="4" Grid.Column="3" HorizontalAlignment="Center"/>
|
|
|
|
<Grid Name="leftPanel" Grid.Column="0">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" MinHeight="100"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*" MinHeight="100"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<GroupBox Grid.Row="0" Header="References">
|
|
<DataGrid Name="referencesList" IsReadOnly="True"
|
|
FontFamily="{StaticResource GeneralMonoFont}">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="Offset" Binding="{Binding Offset}"/>
|
|
<DataGridTextColumn Header="Addr" Binding="{Binding Addr}"/>
|
|
<DataGridTextColumn Header="Type" Binding="{Binding Type}"/>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</GroupBox>
|
|
|
|
<GroupBox Grid.Row="2" Header="Notes">
|
|
<DataGrid Name="notesList" IsReadOnly="True"
|
|
FontFamily="{StaticResource GeneralMonoFont}">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="Offset" Binding="{Binding Offset}"/>
|
|
<DataGridTextColumn Header="Note" Binding="{Binding Note}"/>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</GroupBox>
|
|
|
|
<GridSplitter Height="4" Grid.Row="1"
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Center"/>
|
|
</Grid>
|
|
|
|
<Grid Name="launchPanel" Grid.Column="2"
|
|
Visibility="{Binding Path=LaunchPanelVisibility}" d:IsHidden="True">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
|
<Image Source="/SourceGenWPF;component/Res/Logo.png" Height="100"/>
|
|
<Grid Margin="8">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
<TextBlock Grid.Row="0" VerticalAlignment="Center"
|
|
Text="6502bench SourceGen" FontSize="36"/>
|
|
<TextBlock Grid.Row="1" VerticalAlignment="Center"
|
|
Text="{Binding ProgramVersionString, StringFormat={}Version {0},
|
|
RelativeSource={RelativeSource FindAncestor, AncestorType=Window},
|
|
FallbackValue=Version X.Y.Z-alpha1}"
|
|
FontSize="24"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Row="1" HorizontalAlignment="Left">
|
|
<Button Content="Start new project" Width="200" Height="50" Margin="10,30,10,10"/>
|
|
<Button Content="Open existing project" Width="200" Height="50" Margin="10"/>
|
|
<Button Content="Recent project #1" Width="200" Height="50" Margin="10"
|
|
CommandParameter="0"
|
|
Command="{DynamicResource RecentProjectCmd}"/>
|
|
<Button Content="Recent project #2" Width="200" Height="50" Margin="10"
|
|
CommandParameter="1"
|
|
Command="{DynamicResource RecentProjectCmd}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
|
|
<ListView Name="codeListView" Grid.Column="2"
|
|
FontFamily="{StaticResource GeneralMonoFont}"
|
|
Visibility="{Binding Path=CodeListVisibility}"
|
|
VirtualizingStackPanel.VirtualizationMode="Recycling"
|
|
ItemContainerStyle="{StaticResource codeListItemStyle}"
|
|
SelectionChanged="CodeListView_SelectionChanged">
|
|
<ListView.View>
|
|
<GridView AllowsColumnReorder="False">
|
|
<GridViewColumn Header="Offset" DisplayMemberBinding="{Binding Offset}"/>
|
|
<GridViewColumn Header="Addr" DisplayMemberBinding="{Binding Addr}"/>
|
|
<GridViewColumn Header="Bytes" DisplayMemberBinding="{Binding Bytes}"/>
|
|
<GridViewColumn Header="Flags" DisplayMemberBinding="{Binding Flags}"/>
|
|
<GridViewColumn Header="Attr" DisplayMemberBinding="{Binding Attr}"/>
|
|
<GridViewColumn Header="Label" DisplayMemberBinding="{Binding Label}"/>
|
|
<GridViewColumn Header="Opcode" DisplayMemberBinding="{Binding Opcode}"/>
|
|
<GridViewColumn Header="Operand" DisplayMemberBinding="{Binding Operand}"/>
|
|
<GridViewColumn Header="Comment" DisplayMemberBinding="{Binding Comment}"/>
|
|
</GridView>
|
|
</ListView.View>
|
|
|
|
<ListView.ContextMenu>
|
|
<!-- this is populated as a clone of the Actions menu during init -->
|
|
<ContextMenu/>
|
|
</ListView.ContextMenu>
|
|
|
|
</ListView>
|
|
|
|
<Grid Name="rightPanel" Grid.Column="4">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="*" MinHeight="100"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="143" MinHeight="100"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<GroupBox Grid.Row="0" Header="Symbols">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<WrapPanel Grid.Row="0">
|
|
<ToggleButton Content="User" Width="40" Margin="2,2"/>
|
|
<ToggleButton Content="Proj" Width="40" Margin="2,2"/>
|
|
<ToggleButton Content="Plat" Width="40" Margin="2,2"/>
|
|
<ToggleButton Content="Auto" Width="40" Margin="2,2"/>
|
|
<ToggleButton Content="Addr" Width="40" Margin="2,2"/>
|
|
<ToggleButton Content="Cnst" Width="40" Margin="2,2"/>
|
|
</WrapPanel>
|
|
|
|
<ScrollViewer Grid.Row="1"
|
|
VerticalScrollBarVisibility="Disabled"
|
|
HorizontalScrollBarVisibility="Auto" Margin="0,4,0,0">
|
|
<DataGrid Name="SymbolsList" IsReadOnly="True"
|
|
FontFamily="{StaticResource GeneralMonoFont}">
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="Type" Binding="{Binding Type}"/>
|
|
<DataGridTextColumn Header="Value" Binding="{Binding Value}"/>
|
|
<DataGridTextColumn Header="Name" Binding="{Binding Name}"/>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
</GroupBox>
|
|
|
|
<GroupBox Grid.Row="2" Header="Info">
|
|
<TextBox/>
|
|
</GroupBox>
|
|
|
|
<GridSplitter Height="4" Grid.Row="1"
|
|
HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
|
|
</Grid>
|
|
</Grid>
|
|
</DockPanel>
|
|
</Window>
|