1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-28 09:29:37 +00:00

Make modified flags stand out

This changes the color of the status flags on lines where the flags
have been overridden.
This commit is contained in:
Andy McFadden 2019-09-02 15:18:55 -07:00
parent 9a8df9c498
commit 54e7f68490
4 changed files with 32 additions and 1 deletions

View File

@ -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 + "]";
}

View File

@ -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;
}

View File

@ -200,4 +200,22 @@ See also https://github.com/fadden/DisasmUiTest
</TextBlock.Text>
</TextBlock>
</DataTemplate>
<DataTemplate x:Key="flagsHighlightTemplate">
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="TextTrimming" Value="CharacterEllipsis"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=HasModifiedFlags}" Value="True">
<Setter Property="TextBlock.Foreground" Value="DeepSkyBlue"/>
<Setter Property="TextBlock.FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
<TextBlock.Text>
<Binding Path="Flags"/>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ResourceDictionary>

View File

@ -553,7 +553,7 @@ limitations under the License.
<GridViewColumn Header="Bytes" Width="93"
DisplayMemberBinding="{Binding Bytes}"/>
<GridViewColumn Header="Flags" Width="80"
DisplayMemberBinding="{Binding Flags}"/>
CellTemplate="{StaticResource flagsHighlightTemplate}"/>
<GridViewColumn Header="Attr" Width="54"
DisplayMemberBinding="{Binding Attr}"/>
<GridViewColumn Header="Label" Width="73"