mirror of
https://github.com/fadden/6502bench.git
synced 2025-04-07 00:37:06 +00:00
Rough project properties layout
This commit is contained in:
parent
f4cb5cd8b8
commit
758d95e331
@ -1382,6 +1382,25 @@ namespace SourceGenWPF {
|
||||
}
|
||||
}
|
||||
|
||||
public void EditProjectProperties() {
|
||||
string projectDir = string.Empty;
|
||||
if (!string.IsNullOrEmpty(mProjectPathName)) {
|
||||
projectDir = Path.GetDirectoryName(mProjectPathName);
|
||||
}
|
||||
EditProjectProperties dlg = new EditProjectProperties(mMainWin, mProject.ProjectProps,
|
||||
projectDir, mOutputFormatter);
|
||||
dlg.ShowDialog();
|
||||
ProjectProperties newProps = dlg.NewProps;
|
||||
|
||||
// The dialog result doesn't matter, because the user might have hit "apply"
|
||||
// before hitting "cancel".
|
||||
if (newProps != null) {
|
||||
UndoableChange uc = UndoableChange.CreateProjectPropertiesChange(
|
||||
mProject.ProjectProps, newProps);
|
||||
ApplyUndoableChanges(new ChangeSet(uc));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the view and selection to the specified offset. We want to select stuff
|
||||
/// differently if we're jumping to a note vs. jumping to an instruction.
|
||||
|
@ -76,6 +76,9 @@
|
||||
<Compile Include="WpfGui\EditAppSettings.xaml.cs">
|
||||
<DependentUpon>EditAppSettings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WpfGui\EditProjectProperties.xaml.cs">
|
||||
<DependentUpon>EditProjectProperties.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WpfGui\FontPicker.xaml.cs">
|
||||
<DependentUpon>FontPicker.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -174,6 +177,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WpfGui\EditProjectProperties.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WpfGui\FontPicker.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -25,8 +25,8 @@ limitations under the License.
|
||||
Width="700" Height="440" ResizeMode="NoResize"
|
||||
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
||||
Loaded="Window_Loaded">
|
||||
<DockPanel Margin="8">
|
||||
|
||||
<DockPanel Margin="8">
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Name="applyButton" Content="Apply" Margin="0,0,20,0"
|
||||
Width="70" IsEnabled="{Binding IsDirty}" Click="ApplyButton_Click"/>
|
||||
@ -219,7 +219,7 @@ limitations under the License.
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
|
||||
|
||||
<TabItem Name="displayFormatTab" Header="Display Format">
|
||||
<DockPanel LastChildFill="False">
|
||||
<TextBlock DockPanel.Dock="Top" Margin="4,0,0,0"
|
||||
|
193
SourceGenWPF/WpfGui/EditProjectProperties.xaml
Normal file
193
SourceGenWPF/WpfGui/EditProjectProperties.xaml
Normal file
@ -0,0 +1,193 @@
|
||||
<!--
|
||||
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.WpfGui.EditProjectProperties"
|
||||
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.WpfGui"
|
||||
mc:Ignorable="d"
|
||||
Title="Edit Project Properties"
|
||||
Width="700" Height="440" ResizeMode="NoResize"
|
||||
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
||||
Loaded="Window_Loaded">
|
||||
|
||||
<DockPanel Margin="8">
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
||||
<Button DockPanel.Dock="Right" Name="cancelButton" Content="Cancel" IsCancel="True"
|
||||
Width="70" Margin="4,0,0,0"/>
|
||||
<Button DockPanel.Dock="Right" Name="okButton" Content="OK" IsDefault="True"
|
||||
Width="70" Click="OkButton_Click"/>
|
||||
<Button DockPanel.Dock="Right" Name="applyButton" Content="Apply" Margin="0,0,20,0"
|
||||
Width="70" IsEnabled="{Binding IsDirty}" Click="ApplyButton_Click"/>
|
||||
<TextBlock DockPanel.Dock="Left" Text="NOTE: changes are added to the undo/redo buffer"/>
|
||||
</DockPanel>
|
||||
|
||||
<TabControl Name="tabControl" DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||
<TabItem Name="generalTab" Header="General">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Header="CPU" Grid.Column="0" Grid.Row="0">
|
||||
<StackPanel>
|
||||
<ComboBox Name="cpuComboBox"/>
|
||||
<CheckBox Content="Enable undocumented instructions"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="Entry Flags" Grid.Column="0" Grid.Row="1">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Flags:"/>
|
||||
<TextBlock Text="N- V- M- X- D- I- Z- C- E-"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"/>
|
||||
</StackPanel>
|
||||
<Button Width="75" Content="Change"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Analysis Parameters" Grid.Column="1" Grid.Row="0" Grid.RowSpan="2">
|
||||
<StackPanel>
|
||||
<CheckBox Content="Analyze uncategorized data"/>
|
||||
<CheckBox Content="Seek nearby targets"/>
|
||||
<TextBlock Text="Minimum characters for string:"/>
|
||||
<ComboBox Name="minStringCharsComboBox"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Miscellaneous" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Left" Text="Auto-label style:"/>
|
||||
<ComboBox DockPanel.Dock="Left" Name="autoLabelStyleComboBox"/>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem Name="projectSymbolsTab" Header="Project Symbols">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"
|
||||
Text="Symbols defined in project:"/>
|
||||
|
||||
<ListView Grid.Column="0" Grid.Row="1"
|
||||
FontFamily="{StaticResource GeneralMonoFont}">
|
||||
<ListView.Resources>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
|
||||
</Style>
|
||||
</ListView.Resources>
|
||||
<ListView.View>
|
||||
<GridView AllowsColumnReorder="False">
|
||||
<GridViewColumn Header="Name"/>
|
||||
<GridViewColumn Header="Value"/>
|
||||
<GridViewColumn Header="Type"/>
|
||||
<GridViewColumn Header="Comment"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.Items>
|
||||
<ListViewItem>abcdefg</ListViewItem>
|
||||
</ListView.Items>
|
||||
</ListView>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="1">
|
||||
<Button Width="120" Content="_New Symbol..."/>
|
||||
<Button Width="120" Content="_Edit Symbol..."/>
|
||||
<Button Width="120" Content="_Remove"/>
|
||||
<Button Width="120" Content="_Import..."/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem Name="symbolFilesTab" Header="Symbol Files">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Currently configured symbol files:"/>
|
||||
|
||||
<ListBox Name="symbolFilesListBox" Grid.Column="0" Grid.Row="1">
|
||||
|
||||
</ListBox>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="3" Width="120" HorizontalAlignment="Left"
|
||||
Content="Add Symbol Files..."/>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="1">
|
||||
<Button Width="75" Content="Up"/>
|
||||
<Button Width="75" Content="Down"/>
|
||||
<Button Width="75" Content="Remove"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
|
||||
<TabItem Name="extensionScriptsTab" Header="Extension Scripts">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="300"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Currently configured symbol files:"/>
|
||||
|
||||
<ListBox Name="extensionScriptsListBox" Grid.Column="0" Grid.Row="1">
|
||||
|
||||
</ListBox>
|
||||
|
||||
<Button Grid.Column="0" Grid.Row="3" Width="120" HorizontalAlignment="Left"
|
||||
Content="Add Scripts..."/>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="1">
|
||||
<Button Width="75" Content="Remove"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</DockPanel>
|
||||
</Window>
|
159
SourceGenWPF/WpfGui/EditProjectProperties.xaml.cs
Normal file
159
SourceGenWPF/WpfGui/EditProjectProperties.xaml.cs
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
|
||||
using Asm65;
|
||||
|
||||
namespace SourceGenWPF.WpfGui {
|
||||
/// <summary>
|
||||
/// Project properties dialog.
|
||||
/// </summary>
|
||||
public partial class EditProjectProperties : Window, INotifyPropertyChanged {
|
||||
/// <summary>
|
||||
/// New set. Updated when Apply or OK is hit. This will be null if no changes have
|
||||
/// been applied.
|
||||
/// </summary>
|
||||
public ProjectProperties NewProps { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Format object to use when formatting addresses and constants.
|
||||
/// </summary>
|
||||
private Formatter mFormatter;
|
||||
|
||||
/// <summary>
|
||||
/// Working set. Used internally to hold state.
|
||||
/// </summary>
|
||||
private ProjectProperties mWorkProps;
|
||||
|
||||
/// <summary>
|
||||
/// Dirty flag. Determines whether or not the Apply button is enabled.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Ideally this would just be "WorkProps != OldProps", but it doesn't
|
||||
/// seem worthwhile to maintain an equality operator.
|
||||
/// </remarks>
|
||||
public bool IsDirty {
|
||||
get { return mIsDirty; }
|
||||
set {
|
||||
mIsDirty = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
private bool mIsDirty;
|
||||
|
||||
/// <summary>
|
||||
/// Project directory, if one has been established; otherwise empty.
|
||||
/// </summary>
|
||||
private string mProjectDir;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor. Initial state is configured from an existing ProjectProperties object.
|
||||
/// </summary>
|
||||
/// <param name="props">Property holder to clone.</param>
|
||||
/// <param name="projectDir">Project directory, if known.</param>
|
||||
/// <param name="formatter">Text formatter.</param>
|
||||
public EditProjectProperties(Window owner, ProjectProperties props, string projectDir,
|
||||
Formatter formatter) {
|
||||
InitializeComponent();
|
||||
Owner = owner;
|
||||
DataContext = this;
|
||||
|
||||
mWorkProps = new ProjectProperties(props);
|
||||
mProjectDir = projectDir;
|
||||
mFormatter = formatter;
|
||||
}
|
||||
|
||||
// INotifyPropertyChanged implementation
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e) {
|
||||
#if false
|
||||
// Configure CPU chooser. This must match the order of strings in the designer.
|
||||
switch (mWorkProps.CpuType) {
|
||||
case CpuDef.CpuType.Cpu6502:
|
||||
cpuComboBox.SelectedIndex = 0;
|
||||
break;
|
||||
case CpuDef.CpuType.Cpu65C02:
|
||||
cpuComboBox.SelectedIndex = 1;
|
||||
break;
|
||||
case CpuDef.CpuType.Cpu65816:
|
||||
cpuComboBox.SelectedIndex = 2;
|
||||
break;
|
||||
default:
|
||||
Debug.Assert(false);
|
||||
cpuComboBox.SelectedIndex = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
undocInstrCheckBox.Checked = mWorkProps.IncludeUndocumentedInstr;
|
||||
analyzeUncategorizedCheckBox.Checked =
|
||||
mWorkProps.AnalysisParams.AnalyzeUncategorizedData;
|
||||
seekAltTargetCheckBox.Checked =
|
||||
mWorkProps.AnalysisParams.SeekNearbyTargets;
|
||||
|
||||
int matchLen = mWorkProps.AnalysisParams.MinCharsForString;
|
||||
int selIndex;
|
||||
if (matchLen == DataAnalysis.MIN_CHARS_FOR_STRING_DISABLED) {
|
||||
selIndex = 0; // disabled
|
||||
} else {
|
||||
selIndex = matchLen - 2;
|
||||
}
|
||||
if (selIndex < 0 || selIndex >= minStringCharsComboBox.Items.Count) {
|
||||
Debug.Assert(false, "bad MinCharsForString " + matchLen);
|
||||
selIndex = 0;
|
||||
}
|
||||
minStringCharsComboBox.SelectedIndex = selIndex;
|
||||
|
||||
selIndex = (int)mWorkProps.AutoLabelStyle;
|
||||
if (selIndex < 0 || selIndex >= autoLabelStyleComboBox.Items.Count) {
|
||||
Debug.Assert(false, "bad AutoLabelStyle " + mWorkProps.AutoLabelStyle);
|
||||
selIndex = 0;
|
||||
}
|
||||
autoLabelStyleComboBox.SelectedIndex = selIndex;
|
||||
|
||||
LoadProjectSymbols();
|
||||
LoadPlatformSymbolFiles();
|
||||
LoadExtensionScriptNames();
|
||||
|
||||
// Various callbacks will have fired while configuring controls. Reset to "clean".
|
||||
mDirty = false;
|
||||
UpdateControls();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void ApplyButton_Click(object sender, RoutedEventArgs e) {
|
||||
NewProps = new ProjectProperties(mWorkProps);
|
||||
IsDirty = false;
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e) {
|
||||
// TODO(maybe): ideally we'd return false here if nothing has changed from the
|
||||
// state things were in when the dialog first opened. Checking IsDirty is
|
||||
// insufficient. Might be best to just let the UndoableChange stuff figure out
|
||||
// that nothing changed.
|
||||
NewProps = new ProjectProperties(mWorkProps);
|
||||
DialogResult = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -127,6 +127,8 @@ limitations under the License.
|
||||
Executed="NewProjectCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource OpenCmd}"
|
||||
Executed="OpenCmd_Executed"/>
|
||||
<CommandBinding Command="Properties"
|
||||
CanExecute="IsProjectOpen" Executed="EditProjectProperties_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RemoveHintsCmd}"
|
||||
CanExecute="CanRemoveHints" Executed="RemoveHintsCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource RecentProjectCmd}" x:Name="recentProjectCmd"
|
||||
|
@ -830,6 +830,10 @@ namespace SourceGenWPF.WpfGui {
|
||||
mMainCtrl.OpenProject();
|
||||
}
|
||||
|
||||
private void EditProjectProperties_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.EditProjectProperties();
|
||||
}
|
||||
|
||||
private void RemoveHintsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
Debug.WriteLine("remove hints");
|
||||
mMainCtrl.MarkAsType(CodeAnalysis.TypeHint.NoHint, false);
|
||||
@ -1177,5 +1181,6 @@ namespace SourceGenWPF.WpfGui {
|
||||
private string mInfoBoxContents;
|
||||
|
||||
#endregion Info panel
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user