From 54e7f6849048d1703f58807a34cff1507da815dc Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Mon, 2 Sep 2019 15:18:55 -0700 Subject: [PATCH] Make modified flags stand out This changes the color of the status flags on lines where the flags have been overridden. --- SourceGen/DisplayList.cs | 10 ++++++++++ SourceGen/LineListGen.cs | 3 +++ SourceGen/WpfGui/CodeListItemStyle.xaml | 18 ++++++++++++++++++ SourceGen/WpfGui/MainWindow.xaml | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/SourceGen/DisplayList.cs b/SourceGen/DisplayList.cs index c161ff0..23df263 100644 --- a/SourceGen/DisplayList.cs +++ b/SourceGen/DisplayList.cs @@ -357,6 +357,9 @@ namespace SourceGen { // Set to true if we want to highlight the address and label fields. public bool HasAddrLabelHighlight { get; private set; } + // Set to true if the Flags field has been modified. + public bool HasModifiedFlags { get; private set; } + public int ListIndex { get; set; } = -1; private static Color NoColor = CommonWPF.Helper.ZeroColor; @@ -375,6 +378,7 @@ namespace SourceGen { newParts.IsLongComment = orig.IsLongComment; newParts.HasAddrLabelHighlight = orig.HasAddrLabelHighlight; + newParts.HasModifiedFlags = orig.HasModifiedFlags; newParts.ListIndex = orig.ListIndex; return newParts; @@ -450,6 +454,12 @@ namespace SourceGen { return newParts; } + public static FormattedParts SetFlagsModified(FormattedParts orig) { + FormattedParts newParts = Clone(orig); + newParts.HasModifiedFlags = true; + return newParts; + } + public override string ToString() { return "[Parts: index=" + ListIndex + " off=" + Offset + "]"; } diff --git a/SourceGen/LineListGen.cs b/SourceGen/LineListGen.cs index 35a7e63..1ce2a83 100644 --- a/SourceGen/LineListGen.cs +++ b/SourceGen/LineListGen.cs @@ -1265,6 +1265,9 @@ namespace SourceGen { FormattedParts parts = FormattedParts.Create(offsetStr, addrStr, bytesStr, flagsStr, attrStr, labelStr, opcodeStr, operandStr, commentStr); + if (mProject.StatusFlagOverrides[offset] != StatusFlags.DefaultValue) { + parts = FormattedParts.SetFlagsModified(parts); + } return parts; } diff --git a/SourceGen/WpfGui/CodeListItemStyle.xaml b/SourceGen/WpfGui/CodeListItemStyle.xaml index dcec7f7..0edd164 100644 --- a/SourceGen/WpfGui/CodeListItemStyle.xaml +++ b/SourceGen/WpfGui/CodeListItemStyle.xaml @@ -200,4 +200,22 @@ See also https://github.com/fadden/DisasmUiTest + + + + + + + + + + \ No newline at end of file diff --git a/SourceGen/WpfGui/MainWindow.xaml b/SourceGen/WpfGui/MainWindow.xaml index c17364c..18fcc73 100644 --- a/SourceGen/WpfGui/MainWindow.xaml +++ b/SourceGen/WpfGui/MainWindow.xaml @@ -553,7 +553,7 @@ limitations under the License. + CellTemplate="{StaticResource flagsHighlightTemplate}"/>