Mesen-SX/UI/Debugger/Code/BaseStyleProvider.cs

50 lines
1.4 KiB
C#
Raw Normal View History

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 : ctrlTextbox.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;
}
}
}