mirror of
https://github.com/fadden/6502bench.git
synced 2025-04-07 15:41:55 +00:00
Implement Extension Script Info debug feature
This commit is contained in:
parent
ef4fe35813
commit
2afdaf4ad3
SourceGenWPF
@ -2984,30 +2984,6 @@ namespace SourceGenWPF {
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Debug_Refresh() {
|
||||
Debug.WriteLine("Reanalyzing...");
|
||||
// Call through ApplyChanges so we update the timer task output.
|
||||
UndoableChange uc =
|
||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
|
||||
ApplyChanges(new ChangeSet(uc), false);
|
||||
#if false
|
||||
UpdateMenuItemsAndTitle(); // in case something changed
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Debug_ToggleCommentRulers() {
|
||||
MultiLineComment.DebugShowRuler = !MultiLineComment.DebugShowRuler;
|
||||
// Don't need to repeat the analysis, but we do want to save/restore the
|
||||
// selection and top position when the comment fields change size.
|
||||
UndoableChange uc =
|
||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.DataOnly);
|
||||
ApplyChanges(new ChangeSet(uc), false);
|
||||
}
|
||||
|
||||
public void Debug_ToggleKeepAliveHack() {
|
||||
ScriptManager.UseKeepAliveHack = !ScriptManager.UseKeepAliveHack;
|
||||
}
|
||||
|
||||
#endregion References panel
|
||||
|
||||
#region Notes panel
|
||||
@ -3277,11 +3253,43 @@ namespace SourceGenWPF {
|
||||
|
||||
#region Debug features
|
||||
|
||||
public void RunSourceGenerationTests() {
|
||||
public void Debug_ExtensionScriptInfo() {
|
||||
string info = mProject.DebugGetLoadedScriptInfo();
|
||||
|
||||
Tools.WpfGui.ShowText dlg = new Tools.WpfGui.ShowText(mMainWin, info);
|
||||
dlg.Title = "Loaded Extension Script Info";
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
public void Debug_RunSourceGenerationTests() {
|
||||
Tests.WpfGui.GenTestRunner dlg = new Tests.WpfGui.GenTestRunner(mMainWin);
|
||||
dlg.ShowDialog();
|
||||
}
|
||||
|
||||
public void Debug_Refresh() {
|
||||
Debug.WriteLine("Reanalyzing...");
|
||||
// Call through ApplyChanges so we update the timer task output.
|
||||
UndoableChange uc =
|
||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.CodeAndData);
|
||||
ApplyChanges(new ChangeSet(uc), false);
|
||||
#if false
|
||||
UpdateMenuItemsAndTitle(); // in case something changed
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Debug_ToggleCommentRulers() {
|
||||
MultiLineComment.DebugShowRuler = !MultiLineComment.DebugShowRuler;
|
||||
// Don't need to repeat the analysis, but we do want to save/restore the
|
||||
// selection and top position when the comment fields change size.
|
||||
UndoableChange uc =
|
||||
UndoableChange.CreateDummyChange(UndoableChange.ReanalysisScope.DataOnly);
|
||||
ApplyChanges(new ChangeSet(uc), false);
|
||||
}
|
||||
|
||||
public void Debug_ToggleKeepAliveHack() {
|
||||
ScriptManager.UseKeepAliveHack = !ScriptManager.UseKeepAliveHack;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,9 @@
|
||||
<Compile Include="Tools\WpfGui\AsciiChart.xaml.cs">
|
||||
<DependentUpon>AsciiChart.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Tools\WpfGui\ShowText.xaml.cs">
|
||||
<DependentUpon>ShowText.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WpfGui\AboutBox.xaml.cs">
|
||||
<DependentUpon>AboutBox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -226,6 +229,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Tools\WpfGui\ShowText.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WpfGui\AboutBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
34
SourceGenWPF/Tools/WpfGui/ShowText.xaml
Normal file
34
SourceGenWPF/Tools/WpfGui/ShowText.xaml
Normal file
@ -0,0 +1,34 @@
|
||||
<!--
|
||||
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.Tools.WpfGui.ShowText"
|
||||
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.Tools.WpfGui"
|
||||
mc:Ignorable="d"
|
||||
Title="(title)"
|
||||
Width="708" Height="500" MinWidth="100" MinHeight="100" ResizeMode="CanResizeWithGrip"
|
||||
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
|
||||
PreviewKeyDown="Window_KeyEventHandler">
|
||||
<Grid Margin="8">
|
||||
<TextBox Name="textBox" VerticalScrollBarVisibility="Visible"
|
||||
Text="{Binding DisplayText,
|
||||
FallbackValue=0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789}"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"/>
|
||||
</Grid>
|
||||
</Window>
|
70
SourceGenWPF/Tools/WpfGui/ShowText.xaml.cs
Normal file
70
SourceGenWPF/Tools/WpfGui/ShowText.xaml.cs
Normal file
@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SourceGenWPF.Tools.WpfGui {
|
||||
/// <summary>
|
||||
/// Simple text display dialog. Can be modal or modeless.
|
||||
/// </summary>
|
||||
public partial class ShowText : Window, INotifyPropertyChanged {
|
||||
/// <summary>
|
||||
/// Text to display in the window. May be updated at any time. Bound to dialog property.
|
||||
/// </summary>
|
||||
public string DisplayText {
|
||||
get { return mDisplayText; }
|
||||
set {
|
||||
mDisplayText = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
private string mDisplayText;
|
||||
|
||||
// INotifyPropertyChanged implementation
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = "") {
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor. Pass in an owner for modal dialogs, or null for modeless.
|
||||
/// </summary>
|
||||
public ShowText(Window owner, string initialText) {
|
||||
InitializeComponent();
|
||||
Owner = owner;
|
||||
DataContext = this;
|
||||
|
||||
if (owner == null) {
|
||||
// Modeless dialogs can get lost, so show them in the task bar.
|
||||
ShowInTaskbar = true;
|
||||
}
|
||||
|
||||
DisplayText = initialText;
|
||||
}
|
||||
|
||||
// Catch ESC key.
|
||||
private void Window_KeyEventHandler(object sender, KeyEventArgs e) {
|
||||
if (e.Key == Key.Escape) {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -56,7 +56,7 @@ limitations under the License.
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
<RoutedUICommand x:Key="CloseCmd" Text="Close"/>
|
||||
<RoutedUICommand x:Key="DebugSourceGenerationTestsCmd" Text="Source Generation Tests..."/>
|
||||
<RoutedUICommand x:Key="Debug_SourceGenerationTestsCmd" Text="Source Generation Tests..."/>
|
||||
<RoutedUICommand x:Key="DeleteMlcCmd" Text="Delete Note/Long Comment">
|
||||
<RoutedUICommand.InputGestures>
|
||||
<KeyGesture>Del</KeyGesture>
|
||||
@ -159,6 +159,7 @@ limitations under the License.
|
||||
</RoutedUICommand.InputGestures>
|
||||
</RoutedUICommand>
|
||||
|
||||
<RoutedUICommand x:Key="Debug_ExtensionScriptInfoCmd" Text="Extension Script Info..."/>
|
||||
<RoutedUICommand x:Key="Debug_ToggleCommentRulersCmd" Text="Show Comment Rulers"/>
|
||||
<RoutedUICommand x:Key="Debug_ToggleKeepAliveHackCmd" Text="Use Keep-Alive Hack"/>
|
||||
|
||||
@ -180,8 +181,8 @@ limitations under the License.
|
||||
CanExecute="IsProjectOpen" Executed="CopyCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource DeleteMlcCmd}"
|
||||
CanExecute="CanDeleteMlc" Executed="DeleteMlcCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource DebugSourceGenerationTestsCmd}"
|
||||
Executed="DebugSourceGenerationTestsCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource Debug_SourceGenerationTestsCmd}"
|
||||
Executed="Debug_SourceGenerationTestsCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource EditAddressCmd}"
|
||||
CanExecute="CanEditAddress" Executed="EditAddressCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource EditCommentCmd}"
|
||||
@ -258,6 +259,8 @@ limitations under the License.
|
||||
|
||||
<CommandBinding Command="Refresh"
|
||||
CanExecute="IsProjectOpen" Executed="Debug_RefreshCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource Debug_ExtensionScriptInfoCmd}"
|
||||
CanExecute="IsProjectOpen" Executed="Debug_ExtensionScriptInfoCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource Debug_ToggleCommentRulersCmd}"
|
||||
Executed="Debug_ToggleCommentRulersCmd_Executed"/>
|
||||
<CommandBinding Command="{StaticResource Debug_ToggleKeepAliveHackCmd}"
|
||||
@ -338,14 +341,14 @@ limitations under the License.
|
||||
<MenuItem Header="Show Undo/Redo History"/>
|
||||
<MenuItem Header="Show Analyzer Output"/>
|
||||
<MenuItem Header="Show Analysis Timers"/>
|
||||
<MenuItem Header="Extension Script Info..."/>
|
||||
<MenuItem Command="{StaticResource Debug_ExtensionScriptInfoCmd}"/>
|
||||
<Separator/>
|
||||
<MenuItem Name="debugCommentRulersMenuItem"
|
||||
Command="{StaticResource Debug_ToggleCommentRulersCmd}" IsCheckable="True"/>
|
||||
<MenuItem Name="debugKeepAliveHackMenuItem"
|
||||
Command="{StaticResource Debug_ToggleKeepAliveHackCmd}" IsCheckable="True"/>
|
||||
<Separator/>
|
||||
<MenuItem Command="{StaticResource DebugSourceGenerationTestsCmd}"/>
|
||||
<MenuItem Command="{StaticResource Debug_SourceGenerationTestsCmd}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
|
@ -925,11 +925,6 @@ namespace SourceGenWPF.WpfGui {
|
||||
mMainCtrl.CopyToClipboard();
|
||||
}
|
||||
|
||||
private void DebugSourceGenerationTestsCmd_Executed(object sender,
|
||||
ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.RunSourceGenerationTests();
|
||||
}
|
||||
|
||||
private void DeleteMlcCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.DeleteMlc();
|
||||
}
|
||||
@ -1113,10 +1108,19 @@ namespace SourceGenWPF.WpfGui {
|
||||
mMainCtrl.UndoChanges();
|
||||
}
|
||||
|
||||
private void Debug_ExtensionScriptInfoCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.Debug_ExtensionScriptInfo();
|
||||
}
|
||||
|
||||
private void Debug_RefreshCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.Debug_Refresh();
|
||||
}
|
||||
|
||||
private void Debug_SourceGenerationTestsCmd_Executed(object sender,
|
||||
ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.Debug_RunSourceGenerationTests();
|
||||
}
|
||||
|
||||
private void Debug_ToggleCommentRulersCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||
mMainCtrl.Debug_ToggleCommentRulers();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user