1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-02 16:24:09 +00:00

Various tweaks

Changed the code that generates cross-references for pre-labels to
ignore labels in regions with non-addressable parents.  Also, changed
the code that complains about references to labels in non-addressable
areas to ignore pre-labels, because it was complaining about references
to pre-labels on region starts that were followed by a non-addressable
region start.

In the address region edit dialog, split up the descriptive text for
the "resize" option to make it easier to see the new end offset and
length.  It doesn't look quite right because it's not using the mono
font like the text near the top, but it'll do.

When multiple lines are selected, the Info window now shows the first
line/offset, last line/offset, and bytes spanned by the selection.
This is helpful if you're trying to figure out how big something is.
This commit is contained in:
Andy McFadden
2021-10-11 14:44:44 -07:00
parent 387b50d827
commit 6df29e562f
5 changed files with 85 additions and 24 deletions

View File

@ -1603,9 +1603,9 @@ namespace SourceGen {
break;
case CodeListColumn.Opcode:
if (IsPlbInstruction(line) && CanEditDataBank()) {
// Special handling for PLB instruction, so you can update the bank
// value just be double-clicking on it. Only used for PLBs without
// user- or auto-assigned bank changes.
// Special handling for PLB instruction, so you can update the bank
// value just by double-clicking on it. Only used for PLBs without
// user- or auto-assigned bank changes.
EditDataBank();
} else {
JumpToOperandTarget(line, false);
@ -3178,6 +3178,10 @@ namespace SourceGen {
mLineType = LineListGen.Line.Type.Unclassified;
mEntityCounts = new EntityCounts();
}
public override string ToString() {
return "SelState: numSel=" + mNumItemsSelected + " type=" + mLineType;
}
}
/// <summary>
@ -3946,10 +3950,45 @@ namespace SourceGen {
const string CRLF = "\r\n";
mMainWin.ClearInfoPanel();
if (mMainWin.CodeListView_GetSelectionCount() != 1) {
// Nothing selected, or multiple lines selected.
int selCount = mMainWin.CodeListView_GetSelectionCount();
if (selCount < 1) {
// Nothing selected.
return;
} else if (selCount > 1) {
// Multiple lines selected.
mMainWin.InfoLineDescrText = string.Format(Res.Strings.INFO_MULTI_LINE_SUM_FMT,
selCount);
int firstIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
int lastIndex = mMainWin.CodeListView_GetLastSelectedIndex();
int firstOffset = CodeLineList[firstIndex].FileOffset;
int nextOffset = CodeLineList[lastIndex].FileOffset +
CodeLineList[lastIndex].OffsetSpan;
if (firstOffset == nextOffset) {
return; // probably selected a bunch of lines from a long comment or note
}
if (firstOffset < 0 || nextOffset < 0) {
// We're in the header comment or .equ area.
return;
}
if (CodeLineList[lastIndex].LineType == LineListGen.Line.Type.ArEndDirective) {
nextOffset++;
}
StringBuilder msb = new StringBuilder();
msb.AppendFormat(Res.Strings.INFO_MULTI_LINE_START_FMT, firstIndex,
mFormatter.FormatOffset24(firstOffset));
msb.Append(CRLF);
msb.AppendFormat(Res.Strings.INFO_MULTI_LINE_END_FMT, lastIndex,
mFormatter.FormatOffset24(nextOffset - 1));
msb.Append(CRLF);
int len = nextOffset - firstOffset;
string lenStr = len.ToString() + " (" + mFormatter.FormatHexValue(len, 2) + ")";
msb.AppendFormat(Res.Strings.INFO_MULTI_LINE_LEN_FMT, lenStr);
mMainWin.InfoPanelDetail1 = msb.ToString();
return;
}
int lineIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
LineListGen.Line line = CodeLineList[lineIndex];