mirror of
https://github.com/fadden/6502bench.git
synced 2025-04-22 23:37:34 +00:00
Code cleanup
Should be no change in behavior. (issue #32) (issue #35) (issue #36)
This commit is contained in:
parent
f307ffe8c0
commit
e995747cb0
@ -21,20 +21,24 @@ namespace SourceGen.AppForms {
|
||||
/// <summary>
|
||||
/// Path name of problematic file.
|
||||
/// </summary>
|
||||
public string PathName { get; set; }
|
||||
private string mPathName;
|
||||
|
||||
/// <summary>
|
||||
/// Message to show in the dialog.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
private string mMessage;
|
||||
|
||||
public DataFileLoadIssue() {
|
||||
|
||||
public DataFileLoadIssue(string pathName, string message) {
|
||||
InitializeComponent();
|
||||
|
||||
mPathName = pathName;
|
||||
mMessage = message;
|
||||
}
|
||||
|
||||
private void DataFileLoadIssue_Load(object sender, EventArgs e) {
|
||||
pathNameTextBox.Text = PathName;
|
||||
problemLabel.Text = Message;
|
||||
pathNameTextBox.Text = mPathName;
|
||||
problemLabel.Text = mMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
SourceGen/AppForms/EditAddress.Designer.cs
generated
18
SourceGen/AppForms/EditAddress.Designer.cs
generated
@ -41,7 +41,7 @@ namespace SourceGen.AppForms {
|
||||
System.Windows.Forms.Label addressLabel;
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.addressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.instructionLabel1 = new System.Windows.Forms.Label();
|
||||
this.instructionLabel2 = new System.Windows.Forms.Label();
|
||||
addressLabel = new System.Windows.Forms.Label();
|
||||
@ -79,12 +79,13 @@ namespace SourceGen.AppForms {
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBox1
|
||||
// addressTextBox
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(68, 13);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(275, 20);
|
||||
this.textBox1.TabIndex = 0;
|
||||
this.addressTextBox.Location = new System.Drawing.Point(68, 13);
|
||||
this.addressTextBox.Name = "addressTextBox";
|
||||
this.addressTextBox.Size = new System.Drawing.Size(275, 20);
|
||||
this.addressTextBox.TabIndex = 0;
|
||||
this.addressTextBox.TextChanged += new System.EventHandler(this.addressTextBox_TextChanged);
|
||||
//
|
||||
// instructionLabel1
|
||||
//
|
||||
@ -113,7 +114,7 @@ namespace SourceGen.AppForms {
|
||||
this.ClientSize = new System.Drawing.Size(358, 126);
|
||||
this.Controls.Add(this.instructionLabel2);
|
||||
this.Controls.Add(this.instructionLabel1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.addressTextBox);
|
||||
this.Controls.Add(addressLabel);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
@ -124,6 +125,7 @@ namespace SourceGen.AppForms {
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Edit Address";
|
||||
this.Load += new System.EventHandler(this.EditAddress_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@ -133,7 +135,7 @@ namespace SourceGen.AppForms {
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox addressTextBox;
|
||||
private System.Windows.Forms.Label instructionLabel1;
|
||||
private System.Windows.Forms.Label instructionLabel2;
|
||||
}
|
||||
|
@ -19,14 +19,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace SourceGen.AppForms {
|
||||
public partial class EditAddress : Form {
|
||||
#if false
|
||||
private bool mAllowLastChar;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Maximum allowed address value.
|
||||
/// </summary>
|
||||
public int MaxAddressValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address typed by user. Only valid after the dialog returns OK. Will be set to -1
|
||||
@ -34,91 +26,53 @@ namespace SourceGen.AppForms {
|
||||
/// </summary>
|
||||
public int Address { get; private set; }
|
||||
|
||||
public EditAddress() {
|
||||
/// <summary>
|
||||
/// Maximum allowed address value.
|
||||
/// </summary>
|
||||
private int mMaxAddressValue;
|
||||
|
||||
|
||||
public EditAddress(int initialAddr, int maxAddressValue) {
|
||||
InitializeComponent();
|
||||
|
||||
Address = -2;
|
||||
MaxAddressValue = (1 << 24) - 1;
|
||||
|
||||
#if false
|
||||
// This is probably not all that useful. We're not preventing
|
||||
// invalid inputs, e.g. excessively large values or "$/$/$/", by restricting
|
||||
// the keys that can be typed.
|
||||
textBox1.KeyDown += textBox1_KeyDown;
|
||||
textBox1.KeyPress += textBox1_KeyPress;
|
||||
#endif
|
||||
|
||||
// Update the OK button based on current contents.
|
||||
textBox1.TextChanged += textBox1_TextChanged;
|
||||
mMaxAddressValue = maxAddressValue;
|
||||
addressTextBox.Text = Asm65.Address.AddressToString(initialAddr, false);
|
||||
}
|
||||
|
||||
public void SetInitialAddress(int addr) {
|
||||
textBox1.Text = Asm65.Address.AddressToString(addr, false);
|
||||
textBox1.SelectAll();
|
||||
private void EditAddress_Load(object sender, EventArgs e) {
|
||||
addressTextBox.SelectAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles a click on the OK button by setting the Address property to the
|
||||
/// decoded value from the text field.
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void okButton_Click(object sender, EventArgs e) {
|
||||
if (textBox1.Text.Length == 0) {
|
||||
if (addressTextBox.Text.Length == 0) {
|
||||
Address = -1;
|
||||
} else {
|
||||
Asm65.Address.ParseAddress(textBox1.Text, MaxAddressValue, out int addr);
|
||||
Asm65.Address.ParseAddress(addressTextBox.Text, mMaxAddressValue, out int addr);
|
||||
Address = addr;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the OK button whenever the text changes. This works for all change sources,
|
||||
/// including programmatic.
|
||||
/// </summary>
|
||||
private void addressTextBox_TextChanged(object sender, EventArgs e) {
|
||||
UpdateOkEnabled();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enables or disables the OK button depending on whether the current input is
|
||||
/// valid. We allow valid addresses and an empty box.
|
||||
/// </summary>
|
||||
private void UpdateOkEnabled() {
|
||||
string text = textBox1.Text;
|
||||
string text = addressTextBox.Text;
|
||||
okButton.Enabled = (text.Length == 0) ||
|
||||
Asm65.Address.ParseAddress(text, MaxAddressValue, out int unused);
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Limits characters to [A-F][a-f][0-9][/].
|
||||
/// </summary>
|
||||
private void textBox1_KeyDown(object sender, KeyEventArgs e) {
|
||||
bool allow = false;
|
||||
if (e.KeyCode == Keys.D4 && e.Modifiers == Keys.Shift) {
|
||||
allow = true; // allow '$'; not sure this works on non-US keyboards?
|
||||
} else if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.F) {
|
||||
allow = !(e.Alt || e.Control); // allow shift
|
||||
} else if ((e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9) ||
|
||||
e.KeyCode == Keys.OemQuestion) {
|
||||
allow = (e.Modifiers == 0);
|
||||
} else if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete) {
|
||||
allow = true;
|
||||
}
|
||||
|
||||
mAllowLastChar = allow;
|
||||
//Debug.WriteLine("DOWN " + e.KeyCode + " allow=" + allow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rejects invalid characters.
|
||||
/// </summary>
|
||||
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {
|
||||
//Debug.WriteLine("PRESS " + e.KeyChar + " : " + mAllowLastChar);
|
||||
if (!mAllowLastChar) {
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Updates the OK button whenever the text changes. This works for all change sources,
|
||||
/// including programmatic.
|
||||
/// </summary>
|
||||
private void textBox1_TextChanged(object sender, EventArgs e) {
|
||||
UpdateOkEnabled();
|
||||
Asm65.Address.ParseAddress(text, mMaxAddressValue, out int unused);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,10 +540,11 @@ namespace SourceGen.AppForms {
|
||||
name += ".exe";
|
||||
}
|
||||
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
dlg.FileName = name;
|
||||
dlg.Filter = prefix + "|" + name;
|
||||
dlg.RestoreDirectory = true;
|
||||
OpenFileDialog dlg = new OpenFileDialog() {
|
||||
FileName = name,
|
||||
Filter = prefix + "|" + name,
|
||||
RestoreDirectory = true
|
||||
};
|
||||
if (dlg.ShowDialog() != DialogResult.Cancel) {
|
||||
pathName = dlg.FileName;
|
||||
}
|
||||
|
16
SourceGen/AppForms/EditComment.Designer.cs
generated
16
SourceGen/AppForms/EditComment.Designer.cs
generated
@ -41,7 +41,7 @@ namespace SourceGen.AppForms {
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.instructionLabel = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.commentTextBox = new System.Windows.Forms.TextBox();
|
||||
this.asciiOnlyLabel = new System.Windows.Forms.Label();
|
||||
this.maxLengthLabel = new System.Windows.Forms.Label();
|
||||
this.numCharsLabel = new System.Windows.Forms.Label();
|
||||
@ -81,11 +81,11 @@ namespace SourceGen.AppForms {
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(13, 30);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(488, 20);
|
||||
this.textBox1.TabIndex = 1;
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
this.commentTextBox.Location = new System.Drawing.Point(13, 30);
|
||||
this.commentTextBox.Name = "textBox1";
|
||||
this.commentTextBox.Size = new System.Drawing.Size(488, 20);
|
||||
this.commentTextBox.TabIndex = 1;
|
||||
this.commentTextBox.TextChanged += new System.EventHandler(this.commentTextBox_TextChanged);
|
||||
//
|
||||
// asciiOnlyLabel
|
||||
//
|
||||
@ -124,7 +124,7 @@ namespace SourceGen.AppForms {
|
||||
this.Controls.Add(this.numCharsLabel);
|
||||
this.Controls.Add(this.maxLengthLabel);
|
||||
this.Controls.Add(this.asciiOnlyLabel);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.commentTextBox);
|
||||
this.Controls.Add(this.instructionLabel);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
@ -145,7 +145,7 @@ namespace SourceGen.AppForms {
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.Label instructionLabel;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.TextBox commentTextBox;
|
||||
private System.Windows.Forms.Label asciiOnlyLabel;
|
||||
private System.Windows.Forms.Label maxLengthLabel;
|
||||
private System.Windows.Forms.Label numCharsLabel;
|
||||
|
@ -21,9 +21,9 @@ using System.Windows.Forms;
|
||||
namespace SourceGen.AppForms {
|
||||
public partial class EditComment : Form {
|
||||
/// <summary>
|
||||
/// Comment string being edited.
|
||||
/// Edited comment string. Will be empty if the comment is to be deleted.
|
||||
/// </summary>
|
||||
public string Comment { get; set; }
|
||||
public string Comment { get; private set; }
|
||||
|
||||
private string mNumCharsFormat;
|
||||
|
||||
@ -32,33 +32,36 @@ namespace SourceGen.AppForms {
|
||||
private const int RECOMMENDED_MAX_LENGTH = 52;
|
||||
|
||||
|
||||
public EditComment() {
|
||||
public EditComment(string comment) {
|
||||
InitializeComponent();
|
||||
|
||||
// The initial label string is used as the format arg.
|
||||
mNumCharsFormat = numCharsLabel.Text;
|
||||
|
||||
// Remember the default color.
|
||||
mDefaultLabelColor = asciiOnlyLabel.ForeColor;
|
||||
|
||||
Debug.Assert(comment != null);
|
||||
commentTextBox.Text = comment;
|
||||
}
|
||||
|
||||
private void EditComment_Load(object sender, EventArgs e) {
|
||||
mDefaultLabelColor = asciiOnlyLabel.ForeColor;
|
||||
|
||||
// Extract the format string from the label.
|
||||
mNumCharsFormat = numCharsLabel.Text;
|
||||
|
||||
textBox1.Text = Comment;
|
||||
UpdateLengthLabel();
|
||||
}
|
||||
|
||||
private void UpdateLengthLabel() {
|
||||
numCharsLabel.Text = string.Format(mNumCharsFormat, textBox1.Text.Length);
|
||||
numCharsLabel.Text = string.Format(mNumCharsFormat, commentTextBox.Text.Length);
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e) {
|
||||
private void commentTextBox_TextChanged(object sender, EventArgs e) {
|
||||
UpdateLengthLabel();
|
||||
|
||||
if (!CommonUtil.TextUtil.IsPrintableAscii(textBox1.Text)) {
|
||||
if (!CommonUtil.TextUtil.IsPrintableAscii(commentTextBox.Text)) {
|
||||
asciiOnlyLabel.ForeColor = Color.Red;
|
||||
} else {
|
||||
asciiOnlyLabel.ForeColor = mDefaultLabelColor;
|
||||
}
|
||||
if (textBox1.Text.Length > RECOMMENDED_MAX_LENGTH) {
|
||||
if (commentTextBox.Text.Length > RECOMMENDED_MAX_LENGTH) {
|
||||
maxLengthLabel.ForeColor = Color.Red;
|
||||
} else {
|
||||
maxLengthLabel.ForeColor = mDefaultLabelColor;
|
||||
@ -66,7 +69,7 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e) {
|
||||
Comment = textBox1.Text;
|
||||
Comment = commentTextBox.Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ namespace SourceGen.AppForms {
|
||||
/// <summary>
|
||||
/// Format object to use when formatting addresses and constants.
|
||||
/// </summary>
|
||||
private Formatter NumFormatter { get; set; }
|
||||
private Formatter mNumFormatter;
|
||||
|
||||
/// <summary>
|
||||
/// List of existing symbols, for uniqueness check. The list will not be modified.
|
||||
/// </summary>
|
||||
private SortedList<String, DefSymbol> DefSymbolList { get; set; }
|
||||
private SortedList<String, DefSymbol> mDefSymbolList;
|
||||
|
||||
// Saved off at dialog load time.
|
||||
private Color mDefaultLabelColor;
|
||||
@ -46,8 +46,8 @@ namespace SourceGen.AppForms {
|
||||
public EditDefSymbol(Formatter formatter, SortedList<String, DefSymbol> defList) {
|
||||
InitializeComponent();
|
||||
|
||||
NumFormatter = formatter;
|
||||
DefSymbolList = defList;
|
||||
mNumFormatter = formatter;
|
||||
mDefSymbolList = defList;
|
||||
}
|
||||
|
||||
private void EditDefSymbol_Load(object sender, EventArgs e) {
|
||||
@ -55,7 +55,7 @@ namespace SourceGen.AppForms {
|
||||
|
||||
if (DefSym != null) {
|
||||
labelTextBox.Text = DefSym.Label;
|
||||
valueTextBox.Text = NumFormatter.FormatValueInBase(DefSym.Value,
|
||||
valueTextBox.Text = mNumFormatter.FormatValueInBase(DefSym.Value,
|
||||
DefSym.DataDescriptor.NumBase);
|
||||
commentTextBox.Text = DefSym.Comment;
|
||||
|
||||
@ -78,7 +78,7 @@ namespace SourceGen.AppForms {
|
||||
// if it exists elsewhere.)
|
||||
labelValid = Asm65.Label.ValidateLabel(labelTextBox.Text);
|
||||
|
||||
if (DefSymbolList.TryGetValue(labelTextBox.Text, out DefSymbol existing)) {
|
||||
if (mDefSymbolList.TryGetValue(labelTextBox.Text, out DefSymbol existing)) {
|
||||
// It's okay if it's the same object.
|
||||
labelUnique = (existing == DefSym);
|
||||
} else {
|
||||
|
@ -21,25 +21,30 @@ using System.Windows.Forms;
|
||||
namespace SourceGen.AppForms {
|
||||
public partial class EditLabel : Form {
|
||||
/// <summary>
|
||||
/// Symbol object. May initially be null. When the dialog completes successfully,
|
||||
/// Symbol object. When the dialog completes successfully,
|
||||
/// this will have the new symbol, or null if the user deleted the label.
|
||||
/// </summary>
|
||||
public Symbol LabelSym { get; set; }
|
||||
public Symbol LabelSym { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address we are editing the label for.
|
||||
/// </summary>
|
||||
public int Address { private get; set; }
|
||||
private int mAddress;
|
||||
|
||||
// Saved off at dialog load time.
|
||||
private Color mDefaultLabelColor;
|
||||
|
||||
// Reference to DisasmProject's SymbolTable.
|
||||
/// <summary>
|
||||
/// Reference to DisasmProject's SymbolTable.
|
||||
/// </summary>
|
||||
private SymbolTable mSymbolTable;
|
||||
|
||||
// Dialog label text color, saved off at dialog load time.
|
||||
private Color mDefaultLabelColor;
|
||||
|
||||
public EditLabel(SymbolTable symbolTable) {
|
||||
|
||||
public EditLabel(Symbol origSym, int address, SymbolTable symbolTable) {
|
||||
InitializeComponent();
|
||||
|
||||
LabelSym = origSym;
|
||||
mAddress = address;
|
||||
mSymbolTable = symbolTable;
|
||||
}
|
||||
|
||||
@ -140,7 +145,7 @@ namespace SourceGen.AppForms {
|
||||
Debug.Assert(false); // WTF
|
||||
symbolType = Symbol.Type.LocalOrGlobalAddr;
|
||||
}
|
||||
LabelSym = new Symbol(labelTextBox.Text, Address, Symbol.Source.User, symbolType);
|
||||
LabelSym = new Symbol(labelTextBox.Text, mAddress, Symbol.Source.User, symbolType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,6 @@ namespace SourceGen.AppForms {
|
||||
/// regardless of the dialog's return value.
|
||||
/// </summary>
|
||||
public partial class EditProjectProperties : Form {
|
||||
/// <summary>
|
||||
/// Working set. Used internally to hold state.
|
||||
/// </summary>
|
||||
private ProjectProperties WorkProps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// New set. Updated when Apply or OK is hit. This will be null if no changes have
|
||||
/// been applied.
|
||||
@ -46,7 +41,12 @@ namespace SourceGen.AppForms {
|
||||
/// <summary>
|
||||
/// Format object to use when formatting addresses and constants.
|
||||
/// </summary>
|
||||
public Formatter NumFormatter { get; set; }
|
||||
private Formatter mFormatter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Working set. Used internally to hold state.
|
||||
/// </summary>
|
||||
private ProjectProperties mWorkProps;
|
||||
|
||||
/// <summary>
|
||||
/// Dirty flag. Ideally this would just be "WorkProps != OldProps", but it doesn't
|
||||
@ -60,24 +60,24 @@ namespace SourceGen.AppForms {
|
||||
private string mProjectDir;
|
||||
|
||||
|
||||
public EditProjectProperties(string projectDir) {
|
||||
/// <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(ProjectProperties props, string projectDir,
|
||||
Formatter formatter) {
|
||||
InitializeComponent();
|
||||
|
||||
mWorkProps = new ProjectProperties(props);
|
||||
mProjectDir = projectDir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the initial state from an existing ProjectProperties object. This must be
|
||||
/// called, and must be called before the dialog is shown.
|
||||
/// </summary>
|
||||
/// <param name="props">Object to clone.</param>
|
||||
public void SetInitialProps(ProjectProperties props) {
|
||||
WorkProps = new ProjectProperties(props);
|
||||
mFormatter = formatter;
|
||||
}
|
||||
|
||||
private void EditProperties_Load(object sender, EventArgs e) {
|
||||
// Configure CPU chooser. This must match the order of strings in the designer.
|
||||
switch (WorkProps.CpuType) {
|
||||
switch (mWorkProps.CpuType) {
|
||||
case CpuDef.CpuType.Cpu6502:
|
||||
cpuComboBox.SelectedIndex = 0;
|
||||
break;
|
||||
@ -93,13 +93,13 @@ namespace SourceGen.AppForms {
|
||||
break;
|
||||
}
|
||||
|
||||
undocInstrCheckBox.Checked = WorkProps.IncludeUndocumentedInstr;
|
||||
undocInstrCheckBox.Checked = mWorkProps.IncludeUndocumentedInstr;
|
||||
analyzeUncategorizedCheckBox.Checked =
|
||||
WorkProps.AnalysisParams.AnalyzeUncategorizedData;
|
||||
mWorkProps.AnalysisParams.AnalyzeUncategorizedData;
|
||||
seekAltTargetCheckBox.Checked =
|
||||
WorkProps.AnalysisParams.SeekNearbyTargets;
|
||||
mWorkProps.AnalysisParams.SeekNearbyTargets;
|
||||
|
||||
int matchLen = WorkProps.AnalysisParams.MinCharsForString;
|
||||
int matchLen = mWorkProps.AnalysisParams.MinCharsForString;
|
||||
int selIndex;
|
||||
if (matchLen == DataAnalysis.MIN_CHARS_FOR_STRING_DISABLED) {
|
||||
selIndex = 0; // disabled
|
||||
@ -122,11 +122,11 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e) {
|
||||
NewProps = new ProjectProperties(WorkProps);
|
||||
NewProps = new ProjectProperties(mWorkProps);
|
||||
}
|
||||
|
||||
private void applyButton_Click(object sender, EventArgs e) {
|
||||
NewProps = new ProjectProperties(WorkProps);
|
||||
NewProps = new ProjectProperties(mWorkProps);
|
||||
mDirty = false;
|
||||
UpdateControls();
|
||||
}
|
||||
@ -140,7 +140,7 @@ namespace SourceGen.AppForms {
|
||||
const string FLAGS = "CZIDXMVNE"; // flags, in order low to high, plus emu bit
|
||||
const string VALUES = "-?01";
|
||||
StringBuilder sb = new StringBuilder(27);
|
||||
StatusFlags flags = WorkProps.EntryFlags;
|
||||
StatusFlags flags = mWorkProps.EntryFlags;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
// Want to show P reg flags (first 8) in conventional high-to-low order.
|
||||
int idx = (7 - i) + (i == 8 ? 9 : 0);
|
||||
@ -197,34 +197,31 @@ namespace SourceGen.AppForms {
|
||||
|
||||
private void cpuComboBox_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
CpuDef.CpuType cpuType = CpuSelectionToCpuType(cpuComboBox.SelectedIndex);
|
||||
if (WorkProps.CpuType != cpuType) {
|
||||
WorkProps.CpuType = cpuType;
|
||||
if (mWorkProps.CpuType != cpuType) {
|
||||
mWorkProps.CpuType = cpuType;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
}
|
||||
}
|
||||
|
||||
private void undocInstrCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
if (WorkProps.IncludeUndocumentedInstr != undocInstrCheckBox.Checked) {
|
||||
WorkProps.IncludeUndocumentedInstr = undocInstrCheckBox.Checked;
|
||||
if (mWorkProps.IncludeUndocumentedInstr != undocInstrCheckBox.Checked) {
|
||||
mWorkProps.IncludeUndocumentedInstr = undocInstrCheckBox.Checked;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
}
|
||||
}
|
||||
|
||||
private void changeFlagButton_Click(object sender, EventArgs e) {
|
||||
EditStatusFlags dlg = new EditStatusFlags();
|
||||
dlg.FlagValue = WorkProps.EntryFlags;
|
||||
|
||||
CpuDef cpuDef = CpuDef.GetBestMatch(WorkProps.CpuType,
|
||||
WorkProps.IncludeUndocumentedInstr);
|
||||
dlg.HasEmuFlag = cpuDef.HasEmuFlag;
|
||||
CpuDef cpuDef = CpuDef.GetBestMatch(mWorkProps.CpuType,
|
||||
mWorkProps.IncludeUndocumentedInstr);
|
||||
EditStatusFlags dlg = new EditStatusFlags(mWorkProps.EntryFlags, cpuDef.HasEmuFlag);
|
||||
|
||||
dlg.ShowDialog();
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
if (WorkProps.EntryFlags != dlg.FlagValue) {
|
||||
if (mWorkProps.EntryFlags != dlg.FlagValue) {
|
||||
// Flags changed.
|
||||
WorkProps.EntryFlags = dlg.FlagValue;
|
||||
mWorkProps.EntryFlags = dlg.FlagValue;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
}
|
||||
@ -234,14 +231,14 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void analyzeUncategorizedCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
WorkProps.AnalysisParams.AnalyzeUncategorizedData =
|
||||
mWorkProps.AnalysisParams.AnalyzeUncategorizedData =
|
||||
analyzeUncategorizedCheckBox.Checked;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
}
|
||||
|
||||
private void seekAltTargetCheckBox_CheckedChanged(object sender, EventArgs e) {
|
||||
WorkProps.AnalysisParams.SeekNearbyTargets =
|
||||
mWorkProps.AnalysisParams.SeekNearbyTargets =
|
||||
seekAltTargetCheckBox.Checked;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
@ -256,8 +253,8 @@ namespace SourceGen.AppForms {
|
||||
newVal = index + 2;
|
||||
}
|
||||
|
||||
if (newVal != WorkProps.AnalysisParams.MinCharsForString) {
|
||||
WorkProps.AnalysisParams.MinCharsForString = newVal;
|
||||
if (newVal != mWorkProps.AnalysisParams.MinCharsForString) {
|
||||
mWorkProps.AnalysisParams.MinCharsForString = newVal;
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
}
|
||||
@ -280,7 +277,7 @@ namespace SourceGen.AppForms {
|
||||
//Debug.WriteLine("LPS loading " + WorkProps.ProjectSyms.Count + " project symbols");
|
||||
projectSymbolsListView.BeginUpdate();
|
||||
projectSymbolsListView.Items.Clear();
|
||||
foreach (KeyValuePair<string, DefSymbol> kvp in WorkProps.ProjectSyms) {
|
||||
foreach (KeyValuePair<string, DefSymbol> kvp in mWorkProps.ProjectSyms) {
|
||||
DefSymbol defSym = kvp.Value;
|
||||
string typeStr;
|
||||
if (defSym.SymbolType == Symbol.Type.Constant) {
|
||||
@ -292,7 +289,7 @@ namespace SourceGen.AppForms {
|
||||
ListViewItem lvi = new ListViewItem();
|
||||
lvi.Text = defSym.Label;
|
||||
mSymbolSubArray[0] = new ListViewItem.ListViewSubItem(lvi,
|
||||
NumFormatter.FormatValueInBase(defSym.Value, defSym.DataDescriptor.NumBase));
|
||||
mFormatter.FormatValueInBase(defSym.Value, defSym.DataDescriptor.NumBase));
|
||||
mSymbolSubArray[1] = new ListViewItem.ListViewSubItem(lvi, typeStr);
|
||||
mSymbolSubArray[2] = new ListViewItem.ListViewSubItem(lvi, defSym.Comment);
|
||||
lvi.SubItems.AddRange(mSymbolSubArray);
|
||||
@ -310,11 +307,11 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void newSymbolButton_Click(object sender, EventArgs e) {
|
||||
EditDefSymbol dlg = new EditDefSymbol(NumFormatter, WorkProps.ProjectSyms);
|
||||
EditDefSymbol dlg = new EditDefSymbol(mFormatter, mWorkProps.ProjectSyms);
|
||||
dlg.ShowDialog();
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
Debug.WriteLine("ADD: " + dlg.DefSym);
|
||||
WorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
|
||||
mWorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
|
||||
mDirty = true;
|
||||
LoadProjectSymbols();
|
||||
UpdateControls();
|
||||
@ -326,24 +323,24 @@ namespace SourceGen.AppForms {
|
||||
// Single-select list view, button dimmed when no selection.
|
||||
Debug.Assert(projectSymbolsListView.SelectedItems.Count == 1);
|
||||
ListViewItem item = projectSymbolsListView.SelectedItems[0];
|
||||
DefSymbol defSym = WorkProps.ProjectSyms[item.Text];
|
||||
DefSymbol defSym = mWorkProps.ProjectSyms[item.Text];
|
||||
DoEditSymbol(defSym);
|
||||
}
|
||||
|
||||
private void projectSymbolsListView_MouseDoubleClick(object sender, MouseEventArgs e) {
|
||||
ListViewHitTestInfo info = projectSymbolsListView.HitTest(e.X, e.Y);
|
||||
DefSymbol defSym = WorkProps.ProjectSyms[info.Item.Text];
|
||||
DefSymbol defSym = mWorkProps.ProjectSyms[info.Item.Text];
|
||||
DoEditSymbol(defSym);
|
||||
}
|
||||
|
||||
private void DoEditSymbol(DefSymbol defSym) {
|
||||
EditDefSymbol dlg = new EditDefSymbol(NumFormatter, WorkProps.ProjectSyms);
|
||||
EditDefSymbol dlg = new EditDefSymbol(mFormatter, mWorkProps.ProjectSyms);
|
||||
dlg.DefSym = defSym;
|
||||
dlg.ShowDialog();
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
// Label might have changed, so remove old before adding new.
|
||||
WorkProps.ProjectSyms.Remove(defSym.Label);
|
||||
WorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
|
||||
mWorkProps.ProjectSyms.Remove(defSym.Label);
|
||||
mWorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
|
||||
mDirty = true;
|
||||
LoadProjectSymbols();
|
||||
UpdateControls();
|
||||
@ -357,8 +354,8 @@ namespace SourceGen.AppForms {
|
||||
|
||||
int selectionIndex = projectSymbolsListView.SelectedIndices[0];
|
||||
ListViewItem item = projectSymbolsListView.SelectedItems[0];
|
||||
DefSymbol defSym = WorkProps.ProjectSyms[item.Text];
|
||||
WorkProps.ProjectSyms.Remove(defSym.Label);
|
||||
DefSymbol defSym = mWorkProps.ProjectSyms[item.Text];
|
||||
mWorkProps.ProjectSyms.Remove(defSym.Label);
|
||||
mDirty = true;
|
||||
LoadProjectSymbols();
|
||||
UpdateControls();
|
||||
@ -387,7 +384,7 @@ namespace SourceGen.AppForms {
|
||||
symbolFilesListBox.BeginUpdate();
|
||||
symbolFilesListBox.Items.Clear();
|
||||
|
||||
foreach (string fileName in WorkProps.PlatformSymbolFileIdentifiers) {
|
||||
foreach (string fileName in mWorkProps.PlatformSymbolFileIdentifiers) {
|
||||
symbolFilesListBox.Items.Add(fileName);
|
||||
}
|
||||
|
||||
@ -400,11 +397,12 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void addSymbolFilesButton_Click(object sender, EventArgs e) {
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
fileDlg.Filter = PlatformSymbols.FILENAME_FILTER;
|
||||
fileDlg.Multiselect = true;
|
||||
fileDlg.InitialDirectory = RuntimeDataAccess.GetDirectory();
|
||||
fileDlg.RestoreDirectory = true; // doesn't seem to work?
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = PlatformSymbols.FILENAME_FILTER,
|
||||
Multiselect = true,
|
||||
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
||||
RestoreDirectory = true // doesn't seem to work?
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return;
|
||||
}
|
||||
@ -429,13 +427,13 @@ namespace SourceGen.AppForms {
|
||||
|
||||
string ident = ef.Identifier;
|
||||
|
||||
if (WorkProps.PlatformSymbolFileIdentifiers.Contains(ident)) {
|
||||
if (mWorkProps.PlatformSymbolFileIdentifiers.Contains(ident)) {
|
||||
Debug.WriteLine("Already present: " + ident);
|
||||
continue;
|
||||
}
|
||||
|
||||
Debug.WriteLine("Adding symbol file: " + ident);
|
||||
WorkProps.PlatformSymbolFileIdentifiers.Add(ident);
|
||||
mWorkProps.PlatformSymbolFileIdentifiers.Add(ident);
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
@ -468,9 +466,9 @@ namespace SourceGen.AppForms {
|
||||
symbolFilesListBox.SetSelected(selIndex + adj, true);
|
||||
|
||||
// do the same operation in the file name list
|
||||
string str = WorkProps.PlatformSymbolFileIdentifiers[selIndex];
|
||||
WorkProps.PlatformSymbolFileIdentifiers.RemoveAt(selIndex);
|
||||
WorkProps.PlatformSymbolFileIdentifiers.Insert(selIndex + adj, str);
|
||||
string str = mWorkProps.PlatformSymbolFileIdentifiers[selIndex];
|
||||
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(selIndex);
|
||||
mWorkProps.PlatformSymbolFileIdentifiers.Insert(selIndex + adj, str);
|
||||
|
||||
mDirty = true;
|
||||
UpdateControls();
|
||||
@ -481,7 +479,7 @@ namespace SourceGen.AppForms {
|
||||
for (int i = symbolFilesListBox.SelectedIndices.Count - 1; i >= 0; i--) {
|
||||
int index = symbolFilesListBox.SelectedIndices[i];
|
||||
symbolFilesListBox.Items.RemoveAt(index);
|
||||
WorkProps.PlatformSymbolFileIdentifiers.RemoveAt(index);
|
||||
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(index);
|
||||
}
|
||||
|
||||
mDirty = true;
|
||||
@ -489,11 +487,10 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void importSymbolsButton_Click(object sender, EventArgs e) {
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
|
||||
fileDlg.Filter = ProjectFile.FILENAME_FILTER + "|" +
|
||||
Properties.Resources.FILE_FILTER_ALL;
|
||||
fileDlg.FilterIndex = 1;
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = ProjectFile.FILENAME_FILTER + "|" + Properties.Resources.FILE_FILTER_ALL,
|
||||
FilterIndex = 1
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return;
|
||||
}
|
||||
@ -502,9 +499,9 @@ namespace SourceGen.AppForms {
|
||||
DisasmProject newProject = new DisasmProject();
|
||||
if (!ProjectFile.DeserializeFromFile(projPathName, newProject,
|
||||
out FileLoadReport report)) {
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues();
|
||||
dlg.Messages = report.Format();
|
||||
dlg.CanContinue = false;
|
||||
// Unable to open project file. Report error and bail.
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues(report.Format(),
|
||||
ProjectLoadIssues.Buttons.Cancel);
|
||||
dlg.ShowDialog();
|
||||
// ignore dlg.DialogResult
|
||||
dlg.Dispose();
|
||||
@ -520,7 +517,7 @@ namespace SourceGen.AppForms {
|
||||
DefSymbol defSym = new DefSymbol(sym.Label, sym.Value, Symbol.Source.Project,
|
||||
Symbol.Type.ExternalAddr, FormatDescriptor.SubType.None,
|
||||
string.Empty, string.Empty);
|
||||
WorkProps.ProjectSyms[defSym.Label] = defSym;
|
||||
mWorkProps.ProjectSyms[defSym.Label] = defSym;
|
||||
foundCount++;
|
||||
}
|
||||
}
|
||||
@ -556,7 +553,7 @@ namespace SourceGen.AppForms {
|
||||
extensionScriptsListBox.BeginUpdate();
|
||||
extensionScriptsListBox.Items.Clear();
|
||||
|
||||
foreach (string fileName in WorkProps.ExtensionScriptFileIdentifiers) {
|
||||
foreach (string fileName in mWorkProps.ExtensionScriptFileIdentifiers) {
|
||||
extensionScriptsListBox.Items.Add(fileName);
|
||||
}
|
||||
|
||||
@ -569,11 +566,12 @@ namespace SourceGen.AppForms {
|
||||
}
|
||||
|
||||
private void addExtensionScriptsButton_Click(object sender, EventArgs e) {
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
fileDlg.Filter = Sandbox.ScriptManager.FILENAME_FILTER;
|
||||
fileDlg.Multiselect = true;
|
||||
fileDlg.InitialDirectory = RuntimeDataAccess.GetDirectory();
|
||||
fileDlg.RestoreDirectory = true; // doesn't seem to work?
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = Sandbox.ScriptManager.FILENAME_FILTER,
|
||||
Multiselect = true,
|
||||
InitialDirectory = RuntimeDataAccess.GetDirectory(),
|
||||
RestoreDirectory = true // doesn't seem to work?
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return;
|
||||
}
|
||||
@ -598,13 +596,13 @@ namespace SourceGen.AppForms {
|
||||
|
||||
string ident = ef.Identifier;
|
||||
|
||||
if (WorkProps.ExtensionScriptFileIdentifiers.Contains(ident)) {
|
||||
if (mWorkProps.ExtensionScriptFileIdentifiers.Contains(ident)) {
|
||||
Debug.WriteLine("Already present: " + ident);
|
||||
continue;
|
||||
}
|
||||
|
||||
Debug.WriteLine("Adding extension script: " + ident);
|
||||
WorkProps.ExtensionScriptFileIdentifiers.Add(ident);
|
||||
mWorkProps.ExtensionScriptFileIdentifiers.Add(ident);
|
||||
mDirty = true;
|
||||
}
|
||||
|
||||
@ -619,7 +617,7 @@ namespace SourceGen.AppForms {
|
||||
for (int i = extensionScriptsListBox.SelectedIndices.Count - 1; i >= 0; i--) {
|
||||
int index = extensionScriptsListBox.SelectedIndices[i];
|
||||
extensionScriptsListBox.Items.RemoveAt(index);
|
||||
WorkProps.ExtensionScriptFileIdentifiers.RemoveAt(index);
|
||||
mWorkProps.ExtensionScriptFileIdentifiers.RemoveAt(index);
|
||||
}
|
||||
|
||||
mDirty = true;
|
||||
|
@ -24,21 +24,24 @@ namespace SourceGen.AppForms {
|
||||
/// <summary>
|
||||
/// In/out status flag value.
|
||||
/// </summary>
|
||||
public StatusFlags FlagValue { get; set; }
|
||||
public StatusFlags FlagValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set this if the CPU has an emulation flag (65802/65816). If this isn't
|
||||
/// set, the M, X, and E flag buttons will be disabled.
|
||||
/// </summary>
|
||||
public bool HasEmuFlag { get; set; }
|
||||
private bool mHasEmuFlag;
|
||||
|
||||
|
||||
public EditStatusFlags() {
|
||||
public EditStatusFlags(StatusFlags flagValue, bool hasEmuFlag) {
|
||||
InitializeComponent();
|
||||
|
||||
FlagValue = flagValue;
|
||||
mHasEmuFlag = hasEmuFlag;
|
||||
}
|
||||
|
||||
private void EditStatusFlags_Load(object sender, EventArgs e) {
|
||||
if (!HasEmuFlag) {
|
||||
if (!mHasEmuFlag) {
|
||||
panelM.Enabled = false;
|
||||
panelX.Enabled = false;
|
||||
panelE.Enabled = false;
|
||||
|
@ -19,12 +19,15 @@ using System.Windows.Forms;
|
||||
namespace SourceGen.AppForms {
|
||||
public partial class FindBox : Form {
|
||||
/// <summary>
|
||||
/// Text to find.
|
||||
/// Text to find. On success, holds the string searched for.
|
||||
/// </summary>
|
||||
public string TextToFind { get; set; }
|
||||
public string TextToFind { get; private set; }
|
||||
|
||||
public FindBox() {
|
||||
|
||||
public FindBox(string findStr) {
|
||||
InitializeComponent();
|
||||
|
||||
TextToFind = findStr;
|
||||
}
|
||||
|
||||
private void FindBox_Load(object sender, EventArgs e) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SourceGen.AppForms {
|
||||
@ -25,34 +24,36 @@ namespace SourceGen.AppForms {
|
||||
/// <summary>
|
||||
/// Multi-line message for text box.
|
||||
/// </summary>
|
||||
public string Messages { get; set; }
|
||||
private string mMessages;
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable the Continue button. Defaults to true.
|
||||
/// Which buttons are enabled.
|
||||
/// </summary>
|
||||
public bool CanContinue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable or disable the Cancel button. Defaults to true.
|
||||
/// </summary>
|
||||
public bool CanCancel { get; set; }
|
||||
private Buttons mAllowedButtons;
|
||||
public enum Buttons {
|
||||
Unknown = 0, Continue, Cancel, ContinueOrCancel
|
||||
}
|
||||
|
||||
|
||||
public ProjectLoadIssues() {
|
||||
public ProjectLoadIssues(string msgs, Buttons allowedButtons) {
|
||||
InitializeComponent();
|
||||
CanContinue = CanCancel = true;
|
||||
|
||||
mMessages = msgs;
|
||||
mAllowedButtons = allowedButtons;
|
||||
}
|
||||
|
||||
private void ProjectLoadIssues_Load(object sender, EventArgs e) {
|
||||
messageTextBox.Text = Messages;
|
||||
messageTextBox.Text = mMessages;
|
||||
|
||||
if (!CanContinue) {
|
||||
if (mAllowedButtons == Buttons.Cancel) {
|
||||
// Continue not allowed
|
||||
okButton.Enabled = false;
|
||||
|
||||
// No point warning them about invalid data if they can't continue.
|
||||
invalidDiscardLabel.Visible = false;
|
||||
}
|
||||
if (!CanCancel) {
|
||||
if (mAllowedButtons == Buttons.Continue) {
|
||||
// Cancel not allowed.
|
||||
cancelButton.Enabled = false;
|
||||
|
||||
// They're stuck with the problem.
|
||||
|
@ -803,9 +803,8 @@ namespace SourceGen.AppForms {
|
||||
string messages = mProject.LoadExternalFiles();
|
||||
if (messages.Length != 0) {
|
||||
// ProjectLoadIssues isn't quite the right dialog, but it'll do.
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues();
|
||||
dlg.CanCancel = false;
|
||||
dlg.Messages = messages;
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues(messages,
|
||||
ProjectLoadIssues.Buttons.Continue);
|
||||
dlg.ShowDialog();
|
||||
dlg.Dispose();
|
||||
}
|
||||
@ -1326,11 +1325,10 @@ namespace SourceGen.AppForms {
|
||||
return;
|
||||
}
|
||||
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
|
||||
fileDlg.Filter = ProjectFile.FILENAME_FILTER + "|" +
|
||||
Properties.Resources.FILE_FILTER_ALL;
|
||||
fileDlg.FilterIndex = 1;
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = ProjectFile.FILENAME_FILTER + "|" + Properties.Resources.FILE_FILTER_ALL,
|
||||
FilterIndex = 1
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return;
|
||||
}
|
||||
@ -1365,9 +1363,8 @@ namespace SourceGen.AppForms {
|
||||
// Should probably use a less-busy dialog for something simple like
|
||||
// "permission denied", but the open file dialog handles most simple
|
||||
// stuff directly.
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues();
|
||||
dlg.Messages = report.Format();
|
||||
dlg.CanContinue = false;
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues(report.Format(),
|
||||
ProjectLoadIssues.Buttons.Cancel);
|
||||
dlg.ShowDialog();
|
||||
// ignore dlg.DialogResult
|
||||
dlg.Dispose();
|
||||
@ -1397,8 +1394,8 @@ namespace SourceGen.AppForms {
|
||||
|
||||
// If there were warnings, notify the user and give the a chance to cancel.
|
||||
if (report.Count != 0) {
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues();
|
||||
dlg.Messages = report.Format();
|
||||
ProjectLoadIssues dlg = new ProjectLoadIssues(report.Format(),
|
||||
ProjectLoadIssues.Buttons.ContinueOrCancel);
|
||||
dlg.ShowDialog();
|
||||
DialogResult result = dlg.DialogResult;
|
||||
dlg.Dispose();
|
||||
@ -1476,9 +1473,7 @@ namespace SourceGen.AppForms {
|
||||
/// <param name="errorMsg">Message to display in the message box.</param>
|
||||
/// <returns>Full path of file to open.</returns>
|
||||
private string ChooseDataFile(string origPath, string errorMsg) {
|
||||
DataFileLoadIssue dlg = new DataFileLoadIssue();
|
||||
dlg.PathName = origPath;
|
||||
dlg.Message = errorMsg;
|
||||
DataFileLoadIssue dlg = new DataFileLoadIssue(origPath, errorMsg);
|
||||
dlg.ShowDialog();
|
||||
DialogResult result = dlg.DialogResult;
|
||||
dlg.Dispose();
|
||||
@ -1486,9 +1481,10 @@ namespace SourceGen.AppForms {
|
||||
return null;
|
||||
}
|
||||
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
fileDlg.FileName = Path.GetFileName(origPath);
|
||||
fileDlg.Filter = Properties.Resources.FILE_FILTER_ALL;
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
FileName = Path.GetFileName(origPath),
|
||||
Filter = Properties.Resources.FILE_FILTER_ALL
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return null;
|
||||
}
|
||||
@ -1513,14 +1509,13 @@ namespace SourceGen.AppForms {
|
||||
|
||||
// File > Save As...
|
||||
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
SaveFileDialog fileDlg = new SaveFileDialog();
|
||||
|
||||
fileDlg.Filter = ProjectFile.FILENAME_FILTER + "|" +
|
||||
Properties.Resources.FILE_FILTER_ALL;
|
||||
fileDlg.FilterIndex = 1;
|
||||
fileDlg.ValidateNames = true;
|
||||
fileDlg.AddExtension = true;
|
||||
fileDlg.FileName = Path.GetFileName(mDataPathName) + ProjectFile.FILENAME_EXT;
|
||||
SaveFileDialog fileDlg = new SaveFileDialog() {
|
||||
Filter = ProjectFile.FILENAME_FILTER + "|" + Properties.Resources.FILE_FILTER_ALL,
|
||||
FilterIndex = 1,
|
||||
ValidateNames = true,
|
||||
AddExtension = true,
|
||||
FileName = Path.GetFileName(mDataPathName) + ProjectFile.FILENAME_EXT
|
||||
};
|
||||
if (fileDlg.ShowDialog() == DialogResult.OK) {
|
||||
string pathName = Path.GetFullPath(fileDlg.FileName);
|
||||
Debug.WriteLine("Project save path: " + pathName);
|
||||
@ -1839,8 +1834,7 @@ namespace SourceGen.AppForms {
|
||||
|
||||
// Edit > Find... (Ctrl+F)
|
||||
private void findToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
FindBox dlg = new FindBox();
|
||||
dlg.TextToFind = mFindString;
|
||||
FindBox dlg = new FindBox(mFindString);
|
||||
if (dlg.ShowDialog() == DialogResult.OK) {
|
||||
mFindString = dlg.TextToFind;
|
||||
mFindStartIndex = -1;
|
||||
@ -1918,13 +1912,14 @@ namespace SourceGen.AppForms {
|
||||
if (!string.IsNullOrEmpty(mProjectPathName)) {
|
||||
projectDir = Path.GetDirectoryName(mProjectPathName);
|
||||
}
|
||||
EditProjectProperties dlg = new EditProjectProperties(projectDir);
|
||||
dlg.SetInitialProps(mProject.ProjectProps);
|
||||
dlg.NumFormatter = mOutputFormatter;
|
||||
EditProjectProperties dlg = new EditProjectProperties(mProject.ProjectProps,
|
||||
projectDir, mOutputFormatter);
|
||||
dlg.ShowDialog();
|
||||
ProjectProperties newProps = dlg.NewProps;
|
||||
dlg.Dispose();
|
||||
|
||||
// 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);
|
||||
@ -2553,13 +2548,9 @@ namespace SourceGen.AppForms {
|
||||
Debug.Assert(IsSingleItemSelected());
|
||||
int offset = mDisplayList[sel[0]].FileOffset;
|
||||
|
||||
EditAddress dlg = new EditAddress();
|
||||
Anattrib attr = mProject.GetAnattrib(offset);
|
||||
dlg.MaxAddressValue = mProject.CpuDef.MaxAddressValue;
|
||||
dlg.SetInitialAddress(attr.Address);
|
||||
dlg.ShowDialog();
|
||||
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
EditAddress dlg = new EditAddress(attr.Address, mProject.CpuDef.MaxAddressValue);
|
||||
if (dlg.ShowDialog() == DialogResult.OK) {
|
||||
if (offset == 0 && dlg.Address < 0) {
|
||||
// Not allowed. The AddressMap will just put it back, which confuses
|
||||
// the undo operation.
|
||||
@ -2860,13 +2851,10 @@ namespace SourceGen.AppForms {
|
||||
Debug.Assert(IsSingleItemSelected());
|
||||
int offset = mDisplayList[sel[0]].FileOffset;
|
||||
|
||||
EditLabel dlg = new EditLabel(mProject.SymbolTable);
|
||||
Anattrib attr = mProject.GetAnattrib(offset);
|
||||
EditLabel dlg = new EditLabel(attr.Symbol, attr.Address, mProject.SymbolTable);
|
||||
|
||||
dlg.LabelSym = attr.Symbol;
|
||||
dlg.Address = attr.Address;
|
||||
dlg.ShowDialog();
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
if (dlg.ShowDialog() == DialogResult.OK) {
|
||||
// NOTE: if label matching is case-insensitive, we want to allow a situation
|
||||
// where a label is being renamed from "FOO" to "Foo". (We should be able to
|
||||
// test for object equality on the Symbol.)
|
||||
@ -2895,11 +2883,9 @@ namespace SourceGen.AppForms {
|
||||
Debug.Assert(IsSingleItemSelected());
|
||||
int offset = mDisplayList[sel[0]].FileOffset;
|
||||
|
||||
EditStatusFlags dlg = new EditStatusFlags();
|
||||
dlg.HasEmuFlag = mProject.CpuDef.HasEmuFlag;
|
||||
dlg.FlagValue = mProject.StatusFlagOverrides[offset];
|
||||
dlg.ShowDialog();
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
EditStatusFlags dlg = new EditStatusFlags(mProject.StatusFlagOverrides[offset],
|
||||
mProject.CpuDef.HasEmuFlag);
|
||||
if (dlg.ShowDialog() == DialogResult.OK) {
|
||||
if (dlg.FlagValue != mProject.StatusFlagOverrides[offset]) {
|
||||
UndoableChange uc = UndoableChange.CreateStatusFlagChange(offset,
|
||||
mProject.StatusFlagOverrides[offset], dlg.FlagValue);
|
||||
@ -2916,11 +2902,9 @@ namespace SourceGen.AppForms {
|
||||
Debug.Assert(IsSingleItemSelected());
|
||||
int offset = mDisplayList[sel[0]].FileOffset;
|
||||
|
||||
EditComment dlg = new EditComment();
|
||||
string oldComment = dlg.Comment = mProject.Comments[offset];
|
||||
dlg.ShowDialog();
|
||||
|
||||
if (dlg.DialogResult == DialogResult.OK) {
|
||||
string oldComment = mProject.Comments[offset];
|
||||
EditComment dlg = new EditComment(oldComment);
|
||||
if (dlg.ShowDialog() == DialogResult.OK) {
|
||||
if (!oldComment.Equals(dlg.Comment)) {
|
||||
Debug.WriteLine("Changing comment at +" + offset.ToString("x6"));
|
||||
|
||||
@ -4478,9 +4462,10 @@ namespace SourceGen.AppForms {
|
||||
#region Tools items
|
||||
|
||||
private void hexDumpToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
fileDlg.Filter = Properties.Resources.FILE_FILTER_ALL;
|
||||
fileDlg.FilterIndex = 1;
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = Properties.Resources.FILE_FILTER_ALL,
|
||||
FilterIndex = 1
|
||||
};
|
||||
if (fileDlg.ShowDialog() != DialogResult.OK) {
|
||||
return;
|
||||
}
|
||||
|
@ -188,12 +188,7 @@ namespace SourceGen {
|
||||
public string SearchString { get; set; }
|
||||
|
||||
|
||||
public Line(int offset, int span, Type type) {
|
||||
FileOffset = offset;
|
||||
OffsetSpan = span;
|
||||
LineType = type;
|
||||
SubLineIndex = 0;
|
||||
}
|
||||
public Line(int offset, int span, Type type) : this(offset, span, type, 0) { }
|
||||
|
||||
public Line(int offset, int span, Type type, int subLineIndex) {
|
||||
FileOffset = offset;
|
||||
|
@ -167,11 +167,10 @@ namespace SourceGen.Setup {
|
||||
}
|
||||
|
||||
private void selectFileButton_Click(object sender, EventArgs e) {
|
||||
OpenFileDialog fileDlg = new OpenFileDialog();
|
||||
|
||||
fileDlg.Filter = Properties.Resources.FILE_FILTER_ALL;
|
||||
|
||||
fileDlg.FilterIndex = 1;
|
||||
OpenFileDialog fileDlg = new OpenFileDialog() {
|
||||
Filter = Properties.Resources.FILE_FILTER_ALL,
|
||||
FilterIndex = 1
|
||||
};
|
||||
if (fileDlg.ShowDialog() == DialogResult.OK) {
|
||||
FileInfo fi = new FileInfo(fileDlg.FileName);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user