mirror of
https://github.com/fadden/6502bench.git
synced 2024-08-13 12:29:01 +00:00
Define a max asm column width
This commit is contained in:
parent
69681f8e8d
commit
7f06fdc079
@ -428,22 +428,29 @@ namespace SourceGen.AppForms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AssemblerConfig GetAsmConfigFromUi() {
|
private AssemblerConfig GetAsmConfigFromUi() {
|
||||||
|
const int MIN_WIDTH = 1;
|
||||||
|
const int MAX_WIDTH = 200;
|
||||||
|
|
||||||
int[] widths = new int[4];
|
int[] widths = new int[4];
|
||||||
for (int i = 0; i < widths.Length; i++) {
|
for (int i = 0; i < widths.Length; i++) {
|
||||||
widths[i] = 1; // minimum width for all fields is 1
|
widths[i] = MIN_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
if (int.TryParse(asmLabelColWidthTextBox.Text, out result) && result > 0) {
|
if (int.TryParse(asmLabelColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
|
||||||
|
result <= MAX_WIDTH) {
|
||||||
widths[0] = result;
|
widths[0] = result;
|
||||||
}
|
}
|
||||||
if (int.TryParse(asmOpcodeColWidthTextBox.Text, out result) && result > 0) {
|
if (int.TryParse(asmOpcodeColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
|
||||||
|
result <= MAX_WIDTH) {
|
||||||
widths[1] = result;
|
widths[1] = result;
|
||||||
}
|
}
|
||||||
if (int.TryParse(asmOperandColWidthTextBox.Text, out result) && result > 0) {
|
if (int.TryParse(asmOperandColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
|
||||||
|
result <= MAX_WIDTH) {
|
||||||
widths[2] = result;
|
widths[2] = result;
|
||||||
}
|
}
|
||||||
if (int.TryParse(asmCommentColWidthTextBox.Text, out result) && result > 0) {
|
if (int.TryParse(asmCommentColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
|
||||||
|
result <= MAX_WIDTH) {
|
||||||
widths[3] = result;
|
widths[3] = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user