mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-08 20:30:47 +00:00
Set background color on Notes in the code list
This commit is contained in:
parent
131d1a7a63
commit
c3d03b29ad
@ -19,6 +19,7 @@ using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SourceGenWPF {
|
||||
/// <summary>
|
||||
@ -349,12 +350,17 @@ namespace SourceGenWPF {
|
||||
public string Operand { get; private set; }
|
||||
public string Comment { get; private set; }
|
||||
public bool IsLongComment { get; private set; }
|
||||
public bool HasBackgroundColor { get; private set; }
|
||||
public Brush BackgroundBrush { get; private set; }
|
||||
|
||||
// Set to true if we want to highlight the address and label fields.
|
||||
public bool HasAddrLabelHighlight { get; private set; }
|
||||
|
||||
public int ListIndex { get; set; } = -1;
|
||||
|
||||
private static Color NoColor = Color.FromArgb(0, 0, 0, 0);
|
||||
|
||||
|
||||
// Private constructor -- create instances with factory methods.
|
||||
private FormattedParts() { }
|
||||
|
||||
@ -403,6 +409,17 @@ namespace SourceGenWPF {
|
||||
return parts;
|
||||
}
|
||||
|
||||
public static FormattedParts CreateNote(string comment, Color color) {
|
||||
FormattedParts parts = new FormattedParts();
|
||||
parts.Comment = comment;
|
||||
parts.IsLongComment = true;
|
||||
if (color != NoColor) {
|
||||
parts.HasBackgroundColor = true;
|
||||
parts.BackgroundBrush = new SolidColorBrush(color);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
public static FormattedParts CreateDirective(string opstr, string addrStr) {
|
||||
FormattedParts parts = new FormattedParts();
|
||||
parts.Opcode = opstr;
|
||||
|
@ -1025,7 +1025,7 @@ namespace SourceGenWPF {
|
||||
Color color, List<Line> lines) {
|
||||
foreach (string str in list) {
|
||||
Line line = new Line(offset, 0, lineType);
|
||||
FormattedParts parts = FormattedParts.CreateLongComment(str);
|
||||
FormattedParts parts = FormattedParts.CreateNote(str, color);
|
||||
line.Parts = parts;
|
||||
line.BackgroundColor = color;
|
||||
lines.Add(line);
|
||||
|
@ -154,6 +154,9 @@ See also https://github.com/fadden/DisasmUiTest
|
||||
<DataTrigger Binding="{Binding Path=IsLongComment}" Value="True">
|
||||
<Setter Property="Template" Value="{StaticResource longCommentTemplate}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Path=HasBackgroundColor}" Value="True">
|
||||
<Setter Property="Background" Value="{Binding Path=BackgroundBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user