mirror of https://github.com/fadden/6502bench.git
Compare commits
2 Commits
1c79cddb47
...
110a9ae818
Author | SHA1 | Date |
---|---|---|
Andy McFadden | 110a9ae818 | |
Andy McFadden | c637d6549c |
|
@ -256,7 +256,7 @@ namespace SourceGen {
|
||||||
// Load the settings from the file. If this fails we have no way to tell the user,
|
// Load the settings from the file. If this fails we have no way to tell the user,
|
||||||
// so just keep going.
|
// so just keep going.
|
||||||
LoadAppSettings();
|
LoadAppSettings();
|
||||||
SetAppWindowLocation();
|
SetAppWindowLocation(); // <-- this causes WindowLoaded to fire
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -453,20 +453,6 @@ namespace SourceGen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Replaces the contents of the global settings object with the new settings,
|
|
||||||
/// then applies them to the project.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="settings">New settings.</param>
|
|
||||||
public void SetAppSettings(AppSettings settings) {
|
|
||||||
AppSettings.Global.ReplaceSettings(settings);
|
|
||||||
ApplyAppSettings();
|
|
||||||
|
|
||||||
// We get called whenever Apply or OK is hit in the settings editor, so it's
|
|
||||||
// a pretty good time to save the settings out.
|
|
||||||
SaveAppSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the app window's location and size. This should be called before the window has
|
/// Sets the app window's location and size. This should be called before the window has
|
||||||
/// finished initialization.
|
/// finished initialization.
|
||||||
|
@ -1519,21 +1505,30 @@ namespace SourceGen {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the application settings dialog. All changes to settings are made directly
|
/// Handles Edit > App Settings.
|
||||||
/// to the AppSettings.Global object.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void EditAppSettings() {
|
public void EditAppSettings() {
|
||||||
ShowAppSettings(mMainWin, WpfGui.EditAppSettings.Tab.Unknown,
|
ShowAppSettings(mMainWin, WpfGui.EditAppSettings.Tab.Unknown,
|
||||||
AsmGen.AssemblerInfo.Id.Unknown);
|
AsmGen.AssemblerInfo.Id.Unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Opens the application settings dialog. All changes to settings are made directly
|
||||||
|
/// to the AppSettings.Global object.
|
||||||
|
/// </summary>
|
||||||
public void ShowAppSettings(Window owner, EditAppSettings.Tab initialTab,
|
public void ShowAppSettings(Window owner, EditAppSettings.Tab initialTab,
|
||||||
AsmGen.AssemblerInfo.Id initialAsmId) {
|
AsmGen.AssemblerInfo.Id initialAsmId) {
|
||||||
EditAppSettings dlg = new EditAppSettings(owner, mMainWin, this,
|
EditAppSettings dlg = new EditAppSettings(owner, mMainWin, initialTab, initialAsmId);
|
||||||
initialTab, initialAsmId);
|
dlg.SettingsApplied += SetAppSettings; // called when "Apply" is clicked
|
||||||
dlg.ShowDialog();
|
dlg.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
// The settings code calls SetAppSettings() directly whenever "Apply" is hit.
|
/// <summary>
|
||||||
|
/// Applies settings to the project, and saves them to the settings files.
|
||||||
|
/// </summary>
|
||||||
|
private void SetAppSettings() {
|
||||||
|
ApplyAppSettings();
|
||||||
|
SaveAppSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleCodeListDoubleClick(int row, int col) {
|
public void HandleCodeListDoubleClick(int row, int col) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace SourceGen.Tools.Omf {
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
Debug.Assert(seg.FileLength > 0);
|
Debug.Assert(seg != null && seg.FileLength > 0);
|
||||||
|
|
||||||
SegmentList.Add(seg);
|
SegmentList.Add(seg);
|
||||||
offset += seg.FileLength;
|
offset += seg.FileLength;
|
||||||
|
|
|
@ -22,6 +22,7 @@ using System.Reflection;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using Asm65;
|
using Asm65;
|
||||||
|
@ -30,25 +31,25 @@ using CommonUtil;
|
||||||
using AssemblerInfo = SourceGen.AsmGen.AssemblerInfo;
|
using AssemblerInfo = SourceGen.AsmGen.AssemblerInfo;
|
||||||
using AssemblerConfig = SourceGen.AsmGen.AssemblerConfig;
|
using AssemblerConfig = SourceGen.AsmGen.AssemblerConfig;
|
||||||
using ExpressionMode = Asm65.Formatter.FormatConfig.ExpressionMode;
|
using ExpressionMode = Asm65.Formatter.FormatConfig.ExpressionMode;
|
||||||
using System.Windows.Input;
|
|
||||||
|
|
||||||
namespace SourceGen.WpfGui {
|
namespace SourceGen.WpfGui {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Application settings dialog.
|
/// Application settings dialog.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class EditAppSettings : Window, INotifyPropertyChanged {
|
public partial class EditAppSettings : Window, INotifyPropertyChanged {
|
||||||
|
/// <summary>
|
||||||
|
/// Event that the controller can subscribe to if it wants to be notified when the
|
||||||
|
/// "Apply" or "OK" button is hit.
|
||||||
|
/// </summary>
|
||||||
|
public event SettingsAppliedHandler SettingsApplied;
|
||||||
|
public delegate void SettingsAppliedHandler();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to main window. Needed for examination of the code list font and
|
/// Reference to main window. Needed for examination of the code list font and
|
||||||
/// column widths.
|
/// column widths.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private MainWindow mMainWin;
|
private MainWindow mMainWin;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reference to main controller. Needed to push settings out when Apply/OK is clicked.
|
|
||||||
/// TODO: use an Event instead?
|
|
||||||
/// </summary>
|
|
||||||
private MainController mMainCtrl;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Copy of settings that we make changes to. On "Apply" or "OK", this is pushed
|
/// Copy of settings that we make changes to. On "Apply" or "OK", this is pushed
|
||||||
/// into the global settings object, and applied to the ProjectView.
|
/// into the global settings object, and applied to the ProjectView.
|
||||||
|
@ -103,14 +104,13 @@ namespace SourceGen.WpfGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public EditAppSettings(Window owner, MainWindow mainWin, MainController mainCtrl,
|
public EditAppSettings(Window owner, MainWindow mainWin, Tab initialTab,
|
||||||
Tab initialTab, AssemblerInfo.Id initialAsmId) {
|
AssemblerInfo.Id initialAsmId) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
DataContext = this;
|
DataContext = this;
|
||||||
|
|
||||||
mMainWin = mainWin;
|
mMainWin = mainWin;
|
||||||
mMainCtrl = mainCtrl;
|
|
||||||
mInitialTab = initialTab;
|
mInitialTab = initialTab;
|
||||||
mInitialAsmId = initialAsmId;
|
mInitialAsmId = initialAsmId;
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ namespace SourceGen.WpfGui {
|
||||||
// QueryVersions() can sometimes be slow under Win10 (mid 2019), possibly
|
// QueryVersions() can sometimes be slow under Win10 (mid 2019), possibly
|
||||||
// because of the built-in malware detection, so pop up a wait cursor.
|
// because of the built-in malware detection, so pop up a wait cursor.
|
||||||
Mouse.OverrideCursor = Cursors.Wait;
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
mMainCtrl.SetAppSettings(mSettings);
|
AppSettings.Global.ReplaceSettings(mSettings);
|
||||||
|
OnSettingsApplied();
|
||||||
AsmGen.AssemblerVersionCache.QueryVersions();
|
AsmGen.AssemblerVersionCache.QueryVersions();
|
||||||
} finally {
|
} finally {
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
|
@ -213,6 +214,16 @@ namespace SourceGen.WpfGui {
|
||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raises the "settings applied" event.
|
||||||
|
/// </summary>
|
||||||
|
private void OnSettingsApplied() {
|
||||||
|
SettingsAppliedHandler handler = SettingsApplied;
|
||||||
|
if (handler != null) {
|
||||||
|
handler();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Code View
|
#region Code View
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ CopyData lda #<addrs ;get pointer into
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- grid-container -->
|
</div> <!-- main -->
|
||||||
|
|
||||||
<div id="prevnext">
|
<div id="prevnext">
|
||||||
<a href="using-sourcegen.html" class="btn-next">Next »</a>
|
<a href="using-sourcegen.html" class="btn-next">Next »</a>
|
||||||
|
|
Loading…
Reference in New Issue