1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 05:29:31 +00:00

Implement "about" dialog

This commit is contained in:
Andy McFadden 2019-07-06 15:51:57 -07:00
parent 83fe70535b
commit 33c4b86b44
8 changed files with 178 additions and 11 deletions

View File

@ -1887,6 +1887,14 @@ namespace SourceGenWPF {
HelpAccess.ShowHelp(HelpAccess.Topic.Contents);
}
/// <summary>
/// Handles Help - About
/// </summary>
public void ShowAboutBox() {
AboutBox dlg = new AboutBox(mMainWin);
dlg.ShowDialog();
}
#endregion Main window UI event handlers

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 KiB

View File

@ -78,6 +78,9 @@
<Compile Include="Tests\WpfGui\GenTestRunner.xaml.cs">
<DependentUpon>GenTestRunner.xaml</DependentUpon>
</Compile>
<Compile Include="WpfGui\AboutBox.xaml.cs">
<DependentUpon>AboutBox.xaml</DependentUpon>
</Compile>
<Compile Include="WpfGui\EditAppSettings.xaml.cs">
<DependentUpon>EditAppSettings.xaml</DependentUpon>
</Compile>
@ -185,6 +188,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WpfGui\AboutBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="WpfGui\EditAppSettings.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -271,5 +278,8 @@
<ItemGroup>
<Resource Include="Res\SourceGenIcon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Res\AboutImage.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -25,6 +25,7 @@ limitations under the License.
Title="Source Generation Test"
Icon="/SourceGenWPF;component/Res/SourceGenIcon.ico"
Width="640" Height="480" MinWidth="640" MinHeight="480"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Closing="Window_Closing">
<Window.Resources>

View File

@ -0,0 +1,65 @@
<!--
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.AboutBox"
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="About SourceGen"
Width="720" Height="600" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
Loaded="Window_Loaded">
<Grid Margin="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Image Grid.Column="0" Grid.Row="0"
Source="/SourceGenWPF;component/Res/Logo.png"/>
<StackPanel Grid.Column="1" Grid.Row="0" Margin="8,0,0,0">
<TextBlock Text="6502bench SourceGen" FontSize="30"/>
<TextBlock FontSize="24"
Text="{Binding ProgramVersionString, StringFormat={}Version {0},
FallbackValue=Version X.Y.Z-alpha1}"/>
<TextBlock Text="Copyright 2018 faddenSoft" Margin="0,30,0,0"/>
<TextBlock Text="Created by Andy McFadden"/>
</StackPanel>
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Margin="0,8,0,0">
<TextBlock Text="{Binding OsPlatform, FallbackValue=OS: blah blah blah}"/>
<TextBlock Text="Assertions and extended validation are enabled"
Visibility="{Binding DebugMessageVisibility}"/>
<TextBlock Text="Legal stuff:" Margin="0,8,0,0"/>
</StackPanel>
<TextBox Name="legalStuffTextBox" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2"
VerticalScrollBarVisibility="Auto"/>
<Button Grid.Column="1" Grid.Row="3" HorizontalAlignment="Right" Margin="0,8,0,0"
Content="OK" IsCancel="True" Width="70"/>
</Grid>
</Window>

View File

@ -0,0 +1,74 @@
/*
* 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.IO;
using System.Windows;
namespace SourceGenWPF.WpfGui {
/// <summary>
/// "About" dialog.
/// </summary>
public partial class AboutBox : Window {
private const string LEGAL_STUFF_FILE_NAME = "LegalStuff.txt";
/// <summary>
/// Version string, for display.
/// </summary>
public string ProgramVersionString {
get { return App.ProgramVersion.ToString(); }
}
/// <summary>
/// Operating system version, for display.
/// </summary>
public string OsPlatform {
get {
return "OS: " + System.Runtime.InteropServices.RuntimeInformation.OSDescription;
}
}
/// <summary>
/// Determines whether a message about assertions is visible.
/// </summary>
public Visibility DebugMessageVisibility {
get {
#if DEBUG
return Visibility.Visible;
#else
return Visibility.Collapsed;
#endif
}
}
public AboutBox(Window owner) {
InitializeComponent();
Owner = owner;
DataContext = this;
}
private void Window_Loaded(object sender, RoutedEventArgs e) {
string text;
string pathName = RuntimeDataAccess.GetPathName(LEGAL_STUFF_FILE_NAME);
try {
text = File.ReadAllText(pathName);
} catch (Exception ex) {
text = ex.ToString();
}
legalStuffTextBox.Text = text;
}
}
}

View File

@ -47,7 +47,7 @@ limitations under the License.
<Setter Property="HorizontalContentAlignment" Value="Left" />
</Style>
<RoutedUICommand x:Key="AppSettingsCmd" Text="Settings..."/>
<RoutedUICommand x:Key="AboutCmd" Text="About..."/>
<RoutedUICommand x:Key="AssembleCmd" Text="Assemble...">
<RoutedUICommand.InputGestures>
<KeyGesture>Ctrl+Shift+A</KeyGesture>
@ -56,6 +56,7 @@ limitations under the License.
<RoutedUICommand x:Key="CloseCmd" Text="Close"/>
<RoutedUICommand x:Key="DebugSourceGenerationTestsCmd" Text="Source Generation Tests..."/>
<RoutedUICommand x:Key="EditAddressCmd" Text="Set Address..."/>
<RoutedUICommand x:Key="EditAppSettingsCmd" Text="Settings..."/>
<RoutedUICommand x:Key="EditStatusFlagsCmd" Text="Override Status Flags..."/>
<RoutedUICommand x:Key="ExitCmd" Text="Exit"/>
<RoutedUICommand x:Key="HintAsCodeEntryPointCmd" Text="Hint As Code Entry Point"/>
@ -100,14 +101,16 @@ limitations under the License.
</Window.Resources>
<Window.CommandBindings>
<CommandBinding Command="{StaticResource AppSettingsCmd}"
Executed="AppSettingsCmd_Executed"/>
<CommandBinding Command="{StaticResource AboutCmd}"
Executed="AboutCmd_Executed"/>
<CommandBinding Command="{StaticResource EditAppSettingsCmd}"
Executed="EditAppSettingsCmd_Executed"/>
<CommandBinding Command="{StaticResource AssembleCmd}"
CanExecute="IsProjectOpen" Executed="AssembleCmd_Executed"/>
<CommandBinding Command="{StaticResource CloseCmd}"
CanExecute="IsProjectOpen" Executed="CloseCmd_Executed"/>
<CommandBinding Command="{StaticResource DebugSourceGenerationTestsCmd}"
Executed="DebugSourceGenerationTests_Executed"/>
Executed="DebugSourceGenerationTestsCmd_Executed"/>
<CommandBinding Command="{StaticResource EditAddressCmd}"
CanExecute="CanEditAddress" Executed="EditAddressCmd_Executed"/>
<CommandBinding Command="{StaticResource EditStatusFlagsCmd}"
@ -131,7 +134,7 @@ limitations under the License.
<CommandBinding Command="{StaticResource OpenCmd}"
Executed="OpenCmd_Executed"/>
<CommandBinding Command="Properties"
CanExecute="IsProjectOpen" Executed="EditProjectProperties_Executed"/>
CanExecute="IsProjectOpen" Executed="EditProjectPropertiesCmd_Executed"/>
<CommandBinding Command="{StaticResource RemoveHintsCmd}"
CanExecute="CanRemoveHints" Executed="RemoveHintsCmd_Executed"/>
<CommandBinding Command="{StaticResource RecentProjectCmd}" x:Name="recentProjectCmd"
@ -182,7 +185,7 @@ limitations under the License.
<MenuItem Command="Properties" Header="Project Properties..."/>
<MenuItem Header="Toggle Data Scan"/>
<Separator/>
<MenuItem Command="{StaticResource AppSettingsCmd}"/>
<MenuItem Command="{StaticResource EditAppSettingsCmd}"/>
</MenuItem>
<MenuItem Name="actionsMenu" Header="_Actions">
<MenuItem Command="{StaticResource EditAddressCmd}"/>
@ -212,7 +215,7 @@ limitations under the License.
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Command="Help"/>
<MenuItem Header="About..."/>
<MenuItem Command="{StaticResource AboutCmd}"/>
</MenuItem>
<MenuItem Header="_DEBUG" Name="DebugMenu">
<MenuItem Command="Refresh" Header="Re-analyze"/>

View File

@ -41,6 +41,7 @@ namespace SourceGenWPF.WpfGui {
/// </summary>
public DisplayList CodeDisplayList { get; private set; }
/// <summary>
/// Version string, for display.
/// </summary>
public string ProgramVersionString {
@ -769,8 +770,8 @@ namespace SourceGenWPF.WpfGui {
#region Command handlers
private void AppSettingsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditSettings();
private void AboutCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.ShowAboutBox();
}
private void AssembleCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
@ -783,7 +784,8 @@ namespace SourceGenWPF.WpfGui {
}
}
private void DebugSourceGenerationTests_Executed(object sender, ExecutedRoutedEventArgs e) {
private void DebugSourceGenerationTestsCmd_Executed(object sender,
ExecutedRoutedEventArgs e) {
mMainCtrl.RunSourceGenerationTests();
}
@ -791,6 +793,10 @@ namespace SourceGenWPF.WpfGui {
mMainCtrl.EditAddress();
}
private void EditAppSettingsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditSettings();
}
private void EditStatusFlagsCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditStatusFlags();
}
@ -834,7 +840,7 @@ namespace SourceGenWPF.WpfGui {
mMainCtrl.OpenProject();
}
private void EditProjectProperties_Executed(object sender, ExecutedRoutedEventArgs e) {
private void EditProjectPropertiesCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
mMainCtrl.EditProjectProperties();
}