mirror of
https://github.com/fadden/6502bench.git
synced 2025-08-13 00:25:20 +00:00
Implement simple DEBUG menu items
Refresh, comment ruler toggle, keep-alive toggle.
This commit is contained in:
@@ -63,6 +63,10 @@ namespace SourceGenWPF.AsmGen {
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queries the versions from all known assemblers, replacing any previously held data.
|
/// Queries the versions from all known assemblers, replacing any previously held data.
|
||||||
|
///
|
||||||
|
/// WARNING: this will execute all configured assemblers, and may cause a noticeable
|
||||||
|
/// pause while running. Should only be a fraction of a second on a modern system,
|
||||||
|
/// but it's something to bear in mind.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void QueryVersions() {
|
public static void QueryVersions() {
|
||||||
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
|
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
|
||||||
|
@@ -471,14 +471,9 @@ namespace SourceGenWPF {
|
|||||||
// Unpack the recent-project list.
|
// Unpack the recent-project list.
|
||||||
UnpackRecentProjectList();
|
UnpackRecentProjectList();
|
||||||
|
|
||||||
#if false
|
|
||||||
// Enable the DEBUG menu if configured.
|
// Enable the DEBUG menu if configured.
|
||||||
bool showDebugMenu = AppSettings.Global.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
|
mMainWin.ShowDebugMenu =
|
||||||
if (dEBUGToolStripMenuItem.Visible != showDebugMenu) {
|
AppSettings.Global.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
|
||||||
dEBUGToolStripMenuItem.Visible = showDebugMenu;
|
|
||||||
mainMenuStrip.Refresh();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Finally, update the display list generator with all the fancy settings.
|
// Finally, update the display list generator with all the fancy settings.
|
||||||
if (CodeLineList != null) {
|
if (CodeLineList != null) {
|
||||||
@@ -2989,6 +2984,30 @@ namespace SourceGenWPF {
|
|||||||
#endif
|
#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
|
#endregion References panel
|
||||||
|
|
||||||
#region Notes panel
|
#region Notes panel
|
||||||
|
@@ -39,6 +39,8 @@ limitations under the License.
|
|||||||
<ResourceDictionary Source="../Res/CommandIcons.xaml"/>
|
<ResourceDictionary Source="../Res/CommandIcons.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<BooleanToVisibilityConverter x:Key="BoolToVis"/>
|
||||||
|
|
||||||
<!-- don't center the ListView(GridView) column headers
|
<!-- don't center the ListView(GridView) column headers
|
||||||
https://stackoverflow.com/q/44119146/294248
|
https://stackoverflow.com/q/44119146/294248
|
||||||
(style without ID applies to all instances of that type)
|
(style without ID applies to all instances of that type)
|
||||||
@@ -157,6 +159,9 @@ limitations under the License.
|
|||||||
</RoutedUICommand.InputGestures>
|
</RoutedUICommand.InputGestures>
|
||||||
</RoutedUICommand>
|
</RoutedUICommand>
|
||||||
|
|
||||||
|
<RoutedUICommand x:Key="Debug_ToggleCommentRulersCmd" Text="Show Comment Rulers"/>
|
||||||
|
<RoutedUICommand x:Key="Debug_ToggleKeepAliveHackCmd" Text="Use Keep-Alive Hack"/>
|
||||||
|
|
||||||
<CollectionViewSource x:Key="SymbolTableSource" Source="{Binding SymbolsList}"
|
<CollectionViewSource x:Key="SymbolTableSource" Source="{Binding SymbolsList}"
|
||||||
Filter="SymbolsList_Filter"/>
|
Filter="SymbolsList_Filter"/>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -250,6 +255,13 @@ limitations under the License.
|
|||||||
CanExecute="CanToggleSingleByteFormat" Executed="ToggleSingleByteFormatCmd_Executed"/>
|
CanExecute="CanToggleSingleByteFormat" Executed="ToggleSingleByteFormatCmd_Executed"/>
|
||||||
<CommandBinding Command="{StaticResource UndoCmd}"
|
<CommandBinding Command="{StaticResource UndoCmd}"
|
||||||
CanExecute="CanUndo" Executed="UndoCmd_Executed"/>
|
CanExecute="CanUndo" Executed="UndoCmd_Executed"/>
|
||||||
|
|
||||||
|
<CommandBinding Command="Refresh"
|
||||||
|
CanExecute="IsProjectOpen" Executed="Debug_RefreshCmd_Executed"/>
|
||||||
|
<CommandBinding Command="{StaticResource Debug_ToggleCommentRulersCmd}"
|
||||||
|
Executed="Debug_ToggleCommentRulersCmd_Executed"/>
|
||||||
|
<CommandBinding Command="{StaticResource Debug_ToggleKeepAliveHackCmd}"
|
||||||
|
Executed="Debug_ToggleKeepAliveHackCmd_Executed"/>
|
||||||
</Window.CommandBindings>
|
</Window.CommandBindings>
|
||||||
|
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
@@ -320,15 +332,18 @@ limitations under the License.
|
|||||||
<MenuItem Command="Help"/>
|
<MenuItem Command="Help"/>
|
||||||
<MenuItem Command="{StaticResource AboutCmd}"/>
|
<MenuItem Command="{StaticResource AboutCmd}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="_DEBUG" Name="DebugMenu">
|
<MenuItem Header="_DEBUG" Name="DebugMenu" SubmenuOpened="DebugMenu_SubmenuOpened"
|
||||||
|
Visibility="{Binding ShowDebugMenu, Converter={StaticResource BoolToVis}}">
|
||||||
<MenuItem Command="Refresh" Header="Re-analyze"/>
|
<MenuItem Command="Refresh" Header="Re-analyze"/>
|
||||||
<MenuItem Header="Show Undo/Redo History"/>
|
<MenuItem Header="Show Undo/Redo History"/>
|
||||||
<MenuItem Header="Show Analyzer Output"/>
|
<MenuItem Header="Show Analyzer Output"/>
|
||||||
<MenuItem Header="Show Analysis Timers"/>
|
<MenuItem Header="Show Analysis Timers"/>
|
||||||
<MenuItem Header="Extension Script Info..."/>
|
<MenuItem Header="Extension Script Info..."/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="Toggle Comment Rulers"/>
|
<MenuItem Name="debugCommentRulersMenuItem"
|
||||||
<MenuItem Header="Use Keep-Alive Hack"/>
|
Command="{StaticResource Debug_ToggleCommentRulersCmd}" IsCheckable="True"/>
|
||||||
|
<MenuItem Name="debugKeepAliveHackMenuItem"
|
||||||
|
Command="{StaticResource Debug_ToggleKeepAliveHackCmd}" IsCheckable="True"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Command="{StaticResource DebugSourceGenerationTestsCmd}"/>
|
<MenuItem Command="{StaticResource DebugSourceGenerationTestsCmd}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@@ -69,6 +69,18 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
}
|
}
|
||||||
private double mLongCommentWidth;
|
private double mLongCommentWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the DEBUG menu should be visible on the main menu strip.
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowDebugMenu {
|
||||||
|
get { return mShowDebugMenu; }
|
||||||
|
set {
|
||||||
|
mShowDebugMenu = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool mShowDebugMenu;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to controller object.
|
/// Reference to controller object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -669,17 +681,19 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
/// when the ItemContainerGenerator's StatusChanged event fires.
|
/// when the ItemContainerGenerator's StatusChanged event fires.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Steps to cause problem:
|
/// Sample steps to reproduce problem:
|
||||||
/// 1. select note
|
/// 1. select note
|
||||||
/// 2. delete note
|
/// 2. delete note
|
||||||
/// 3. select nearby line
|
/// 3. select nearby line
|
||||||
/// 4. edit > undo
|
/// 4. edit > undo
|
||||||
/// 5. hit the down-arrow key
|
/// 5. hit the down-arrow key
|
||||||
///
|
///
|
||||||
/// Without this event handler, the list jumps to line zero. The original article
|
/// Without this event handler, the list jumps to line zero. Apparently the keyboard
|
||||||
/// was dealing with a different problem, where you'd have to hit the down-arrow twice
|
/// navigation is not based on which element(s) are selected.
|
||||||
/// to make it move, because the focus was on the control rather than the item. The
|
///
|
||||||
/// same fix seems to apply for this issue as well.
|
/// The original article was dealing with a different problem, where you'd have to hit
|
||||||
|
/// the down-arrow twice to make it move the first time, because the focus was on the
|
||||||
|
/// control rather than an item. The same fix seems to apply for this issue as well.
|
||||||
///
|
///
|
||||||
/// From http://cytivrat.blogspot.com/2011/05/selecting-first-item-in-wpf-listview.html
|
/// From http://cytivrat.blogspot.com/2011/05/selecting-first-item-in-wpf-listview.html
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
@@ -698,7 +712,7 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CodeListView_GetTopIndex() {
|
public int CodeListView_GetTopIndex() {
|
||||||
return codeListView.GetTopItemIndex();
|
return codeListView.GetTopItemIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1099,6 +1113,18 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
mMainCtrl.UndoChanges();
|
mMainCtrl.UndoChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Debug_RefreshCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
|
mMainCtrl.Debug_Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Debug_ToggleCommentRulersCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
|
mMainCtrl.Debug_ToggleCommentRulers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Debug_ToggleKeepAliveHackCmd_Executed(object sender, ExecutedRoutedEventArgs e) {
|
||||||
|
mMainCtrl.Debug_ToggleKeepAliveHack();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Command handlers
|
#endregion Command handlers
|
||||||
|
|
||||||
#region Misc
|
#region Misc
|
||||||
@@ -1182,6 +1208,10 @@ namespace SourceGenWPF.WpfGui {
|
|||||||
private void ToolsMenu_SubmenuOpened(object sender, RoutedEventArgs e) {
|
private void ToolsMenu_SubmenuOpened(object sender, RoutedEventArgs e) {
|
||||||
toggleAsciiChartMenuItem.IsChecked = mMainCtrl.IsAsciiChartOpen;
|
toggleAsciiChartMenuItem.IsChecked = mMainCtrl.IsAsciiChartOpen;
|
||||||
}
|
}
|
||||||
|
private void DebugMenu_SubmenuOpened(object sender, RoutedEventArgs e) {
|
||||||
|
debugCommentRulersMenuItem.IsChecked = MultiLineComment.DebugShowRuler;
|
||||||
|
debugKeepAliveHackMenuItem.IsChecked = Sandbox.ScriptManager.UseKeepAliveHack;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Misc
|
#endregion Misc
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user