54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using Mesen.GUI.Config;
|
|
using Mesen.GUI.Debugger.Controls;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mesen.GUI.Debugger.Code
|
|
{
|
|
public abstract class BaseStyleProvider : ILineStyleProvider
|
|
{
|
|
public int? ActiveAddress { get; set; }
|
|
|
|
public abstract string GetLineComment(int lineIndex);
|
|
public abstract LineProperties GetLineStyle(CodeLineData lineData, int lineIndex);
|
|
|
|
protected void SetBreakpointLineProperties(LineProperties props, Breakpoint breakpoint)
|
|
{
|
|
DebuggerInfo config = ConfigManager.Config.Debug.Debugger;
|
|
Color fgColor = Color.White;
|
|
Color? bgColor = null;
|
|
Color bpColor = breakpoint.BreakOnExec ? config.CodeExecBreakpointColor : (breakpoint.BreakOnWrite ? config.CodeWriteBreakpointColor : config.CodeReadBreakpointColor);
|
|
Color outlineColor = bpColor;
|
|
LineSymbol symbol;
|
|
if(breakpoint.Enabled) {
|
|
bgColor = bpColor;
|
|
symbol = LineSymbol.Circle;
|
|
} else {
|
|
fgColor = Color.Black;
|
|
symbol = LineSymbol.CircleOutline;
|
|
}
|
|
|
|
if(breakpoint.MarkEvent) {
|
|
symbol |= LineSymbol.Mark;
|
|
}
|
|
|
|
if(!string.IsNullOrWhiteSpace(breakpoint.Condition)) {
|
|
symbol |= LineSymbol.Plus;
|
|
}
|
|
|
|
props.FgColor = fgColor;
|
|
props.TextBgColor = bgColor;
|
|
props.OutlineColor = outlineColor;
|
|
props.Symbol = symbol;
|
|
}
|
|
|
|
public List<CodeColor> GetCodeColors(CodeLineData lineData, bool highlightCode, string addressFormat, Color? textColor, bool showMemoryValues)
|
|
{
|
|
return CodeHighlighting.GetCpuHighlights(lineData, highlightCode, addressFormat, textColor, showMemoryValues);
|
|
}
|
|
}
|
|
}
|