move hex editor colors from Config to the tool itself using ConfigPersist
This commit is contained in:
parent
b1ef7bcbbb
commit
9f06e442ab
|
@ -312,14 +312,6 @@ namespace BizHawk.Client.Common
|
||||||
public PreviousType RamWatchDefinePrevious = PreviousType.LastFrame;
|
public PreviousType RamWatchDefinePrevious = PreviousType.LastFrame;
|
||||||
public bool DisplayRamWatch = false;
|
public bool DisplayRamWatch = false;
|
||||||
|
|
||||||
// Hex Editor Colors
|
|
||||||
public Color HexBackgrndColor = SystemColors.Control;
|
|
||||||
public Color HexForegrndColor = SystemColors.ControlText;
|
|
||||||
public Color HexMenubarColor = SystemColors.Control;
|
|
||||||
public Color HexFreezeColor = Color.LightBlue;
|
|
||||||
public Color HexHighlightColor = Color.Pink;
|
|
||||||
public Color HexHighlightFreezeColor = Color.Violet;
|
|
||||||
|
|
||||||
// Video dumping settings
|
// Video dumping settings
|
||||||
public string VideoWriter = "";
|
public string VideoWriter = "";
|
||||||
public int JMDCompression = 3;
|
public int JMDCompression = 3;
|
||||||
|
@ -344,8 +336,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
public object GetCoreSettings(Type t)
|
public object GetCoreSettings(Type t)
|
||||||
{
|
{
|
||||||
object ret;
|
CoreSettings.TryGetValue(t.ToString(), out var ret);
|
||||||
CoreSettings.TryGetValue(t.ToString(), out ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,32 +9,30 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public partial class HexColorsForm : Form
|
public partial class HexColorsForm : Form
|
||||||
{
|
{
|
||||||
private readonly HexEditor _hexEditor;
|
private readonly HexEditor _hexEditor;
|
||||||
private readonly Config _config;
|
|
||||||
|
|
||||||
public HexColorsForm(HexEditor hexEditor, Config config)
|
public HexColorsForm(HexEditor hexEditor)
|
||||||
{
|
{
|
||||||
_hexEditor = hexEditor;
|
_hexEditor = hexEditor;
|
||||||
_config = config;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HexColors_Form_Load(object sender, EventArgs e)
|
private void HexColors_Form_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
HexBackgrnd.BackColor = _config.HexBackgrndColor;
|
HexBackgrnd.BackColor = _hexEditor.Colors.Background;
|
||||||
HexForegrnd.BackColor = _config.HexForegrndColor;
|
HexForegrnd.BackColor = _hexEditor.Colors.Foreground;
|
||||||
HexMenubar.BackColor = _config.HexMenubarColor;
|
HexMenubar.BackColor = _hexEditor.Colors.MenuBar;
|
||||||
HexFreeze.BackColor = _config.HexFreezeColor;
|
HexFreeze.BackColor = _hexEditor.Colors.Freeze;
|
||||||
HexFreezeHL.BackColor = _config.HexHighlightFreezeColor;
|
HexFreezeHL.BackColor = _hexEditor.Colors.HighlightFreeze;
|
||||||
HexHighlight.BackColor = _config.HexHighlightColor;
|
HexHighlight.BackColor = _hexEditor.Colors.Highlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HexBackground_Click(object sender, MouseEventArgs e)
|
private void HexBackground_Click(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_config.HexBackgrndColor = colorDialog1.Color;
|
_hexEditor.Colors.Background = colorDialog1.Color;
|
||||||
_hexEditor.Header.BackColor = colorDialog1.Color;
|
_hexEditor.Header.BackColor = colorDialog1.Color;
|
||||||
_hexEditor.MemoryViewerBox.BackColor = _config.HexBackgrndColor;
|
_hexEditor.MemoryViewerBox.BackColor = _hexEditor.Colors.Background;
|
||||||
HexBackgrnd.BackColor = colorDialog1.Color;
|
HexBackgrnd.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,9 +41,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_config.HexForegrndColor = colorDialog1.Color;
|
_hexEditor.Colors.Foreground = colorDialog1.Color;
|
||||||
_hexEditor.Header.ForeColor = colorDialog1.Color;
|
_hexEditor.Header.ForeColor = colorDialog1.Color;
|
||||||
_hexEditor.MemoryViewerBox.ForeColor = _config.HexForegrndColor;
|
_hexEditor.MemoryViewerBox.ForeColor = _hexEditor.Colors.Foreground;
|
||||||
HexForegrnd.BackColor = colorDialog1.Color;
|
HexForegrnd.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +52,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
if (colorDialog1.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
_config.HexMenubarColor = colorDialog1.Color;
|
_hexEditor.Colors.MenuBar = colorDialog1.Color;
|
||||||
_hexEditor.HexMenuStrip.BackColor = _config.HexMenubarColor;
|
_hexEditor.HexMenuStrip.BackColor = _hexEditor.Colors.MenuBar;
|
||||||
HexMenubar.BackColor = colorDialog1.Color;
|
HexMenubar.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog().IsOk())
|
if (colorDialog1.ShowDialog().IsOk())
|
||||||
{
|
{
|
||||||
_config.HexHighlightColor = colorDialog1.Color;
|
_hexEditor.Colors.Highlight = colorDialog1.Color;
|
||||||
HexHighlight.BackColor = colorDialog1.Color;
|
HexHighlight.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog().IsOk())
|
if (colorDialog1.ShowDialog().IsOk())
|
||||||
{
|
{
|
||||||
_config.HexFreezeColor = colorDialog1.Color;
|
_hexEditor.Colors.Freeze = colorDialog1.Color;
|
||||||
HexFreeze.BackColor = colorDialog1.Color;
|
HexFreeze.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +80,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (colorDialog1.ShowDialog().IsOk())
|
if (colorDialog1.ShowDialog().IsOk())
|
||||||
{
|
{
|
||||||
_config.HexHighlightFreezeColor = colorDialog1.Color;
|
_hexEditor.Colors.HighlightFreeze = colorDialog1.Color;
|
||||||
HexFreezeHL.BackColor = colorDialog1.Color;
|
HexFreezeHL.BackColor = colorDialog1.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,27 @@ namespace BizHawk.Client.EmuHawk
|
||||||
[ConfigPersist]
|
[ConfigPersist]
|
||||||
private RecentFiles RecentTables { get; set; }
|
private RecentFiles RecentTables { get; set; }
|
||||||
|
|
||||||
|
internal class ColorConfig
|
||||||
|
{
|
||||||
|
public Color Background { get; set; } = SystemColors.Control;
|
||||||
|
public Color Foreground { get; set; } = SystemColors.ControlText;
|
||||||
|
public Color MenuBar { get; set; } = SystemColors.Control;
|
||||||
|
public Color Freeze { get; set; }= Color.LightBlue;
|
||||||
|
public Color Highlight { get; set; } = Color.Pink;
|
||||||
|
public Color HighlightFreeze { get; set; } = Color.Violet;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConfigPersist]
|
||||||
|
internal ColorConfig Colors { get; set; } = new ColorConfig();
|
||||||
|
|
||||||
|
private WatchSize WatchSize => (WatchSize)DataSize;
|
||||||
|
|
||||||
|
private readonly Pen _blackPen = new Pen(Color.Black);
|
||||||
|
private SolidBrush _freezeBrush;
|
||||||
|
private SolidBrush _freezeHighlightBrush;
|
||||||
|
private SolidBrush _highlightBrush;
|
||||||
|
private SolidBrush _secondaryHighlightBrush;
|
||||||
|
|
||||||
public HexEditor()
|
public HexEditor()
|
||||||
{
|
{
|
||||||
_hexFind = new HexFind(this);
|
_hexFind = new HexFind(this);
|
||||||
|
@ -116,7 +137,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
AddressLabel.Font = font;
|
AddressLabel.Font = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WatchSize WatchSize => (WatchSize)DataSize;
|
private void HexEditor_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadConfigSettings();
|
||||||
|
DataSize = _domain.WordSize;
|
||||||
|
SetDataSize(DataSize);
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(LastDomain)
|
||||||
|
&& MemoryDomains.Any(m => m.Name == LastDomain))
|
||||||
|
{
|
||||||
|
SetMemoryDomain(LastDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RecentTables.AutoLoad)
|
||||||
|
{
|
||||||
|
LoadFileFromRecent(RecentTables[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
FullUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
|
|
||||||
|
@ -439,33 +478,18 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HexEditor_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadConfigSettings();
|
|
||||||
DataSize = _domain.WordSize;
|
|
||||||
SetDataSize(DataSize);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(LastDomain)
|
|
||||||
&& MemoryDomains.Any(m => m.Name == LastDomain))
|
|
||||||
{
|
|
||||||
SetMemoryDomain(LastDomain);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RecentTables.AutoLoad)
|
|
||||||
{
|
|
||||||
LoadFileFromRecent(RecentTables[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
FullUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadConfigSettings()
|
private void LoadConfigSettings()
|
||||||
{
|
{
|
||||||
HexMenuStrip.BackColor = Config.HexMenubarColor;
|
HexMenuStrip.BackColor = Colors.MenuBar;
|
||||||
MemoryViewerBox.BackColor = Config.HexBackgrndColor;
|
MemoryViewerBox.BackColor = Colors.Background;
|
||||||
MemoryViewerBox.ForeColor = Config.HexForegrndColor;
|
MemoryViewerBox.ForeColor = Colors.Foreground;
|
||||||
Header.BackColor = Config.HexBackgrndColor;
|
Header.BackColor = Colors.Background;
|
||||||
Header.ForeColor = Config.HexForegrndColor;
|
Header.ForeColor = Colors.Foreground;
|
||||||
|
|
||||||
|
_freezeBrush = new SolidBrush(Colors.Freeze);
|
||||||
|
_freezeHighlightBrush = new SolidBrush(Colors.HighlightFreeze);
|
||||||
|
_highlightBrush = new SolidBrush(Colors.Highlight);
|
||||||
|
_secondaryHighlightBrush = new SolidBrush(Color.FromArgb(0x44, Colors.Highlight));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseHexFind()
|
private void CloseHexFind()
|
||||||
|
@ -1670,7 +1694,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void SetColorsMenuItem_Click(object sender, EventArgs e)
|
private void SetColorsMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
using var form = new HexColorsForm(this, Config);
|
using var form = new HexColorsForm(this);
|
||||||
form.ShowHawkDialog();
|
form.ShowHawkDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1681,12 +1705,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
HexMenuStrip.BackColor = Color.FromName("Control");
|
HexMenuStrip.BackColor = Color.FromName("Control");
|
||||||
Header.BackColor = Color.FromName("Control");
|
Header.BackColor = Color.FromName("Control");
|
||||||
Header.ForeColor = Color.FromName("ControlText");
|
Header.ForeColor = Color.FromName("ControlText");
|
||||||
Config.HexMenubarColor = Color.FromName("Control");
|
Colors = new ColorConfig();
|
||||||
Config.HexForegrndColor = Color.FromName("ControlText");
|
|
||||||
Config.HexBackgrndColor = Color.FromName("Control");
|
|
||||||
Config.HexFreezeColor = Color.LightBlue;
|
|
||||||
Config.HexHighlightColor = Color.Pink;
|
|
||||||
Config.HexHighlightFreezeColor = Color.Violet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -2060,12 +2079,6 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Pen _blackPen = new Pen(Color.Black);
|
|
||||||
private readonly SolidBrush _freezeBrush = new SolidBrush(Global.Config.HexFreezeColor);
|
|
||||||
private readonly SolidBrush _freezeHighlightBrush = new SolidBrush(Global.Config.HexHighlightFreezeColor);
|
|
||||||
private readonly SolidBrush _highlightBrush = new SolidBrush(Global.Config.HexHighlightColor);
|
|
||||||
private readonly SolidBrush _secondaryHighlightBrush = new SolidBrush(Color.FromArgb(0x44, Global.Config.HexHighlightColor));
|
|
||||||
|
|
||||||
private void MemoryViewerBox_Paint(object sender, PaintEventArgs e)
|
private void MemoryViewerBox_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
var activeCheats = Global.CheatList.Where(x => x.Enabled);
|
var activeCheats = Global.CheatList.Where(x => x.Enabled);
|
||||||
|
@ -2088,7 +2101,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
var rect = new Rectangle(GetAddressCoordinates(cheat.Address ?? 0), new Size(width, _fontHeight));
|
var rect = new Rectangle(GetAddressCoordinates(cheat.Address ?? 0), new Size(width, _fontHeight));
|
||||||
e.Graphics.DrawRectangle(_blackPen, rect);
|
e.Graphics.DrawRectangle(_blackPen, rect);
|
||||||
_freezeBrush.Color = Config.HexFreezeColor;
|
_freezeBrush.Color = Colors.Freeze;
|
||||||
e.Graphics.FillRectangle(_freezeBrush, rect);
|
e.Graphics.FillRectangle(_freezeBrush, rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2110,13 +2123,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Global.CheatList.IsActive(_domain, addressHighlighted))
|
if (Global.CheatList.IsActive(_domain, addressHighlighted))
|
||||||
{
|
{
|
||||||
_freezeHighlightBrush.Color = Config.HexHighlightFreezeColor;
|
_freezeHighlightBrush.Color = Colors.HighlightFreeze;
|
||||||
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
|
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
|
||||||
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
|
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_highlightBrush.Color = Config.HexHighlightColor;
|
_highlightBrush.Color = Colors.Highlight;
|
||||||
e.Graphics.FillRectangle(_highlightBrush, rect);
|
e.Graphics.FillRectangle(_highlightBrush, rect);
|
||||||
e.Graphics.FillRectangle(_highlightBrush, textRect);
|
e.Graphics.FillRectangle(_highlightBrush, textRect);
|
||||||
}
|
}
|
||||||
|
@ -2137,13 +2150,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
if (Global.CheatList.IsActive(_domain, address))
|
if (Global.CheatList.IsActive(_domain, address))
|
||||||
{
|
{
|
||||||
_freezeHighlightBrush.Color = Config.HexHighlightFreezeColor;
|
_freezeHighlightBrush.Color = Colors.HighlightFreeze;
|
||||||
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
|
e.Graphics.FillRectangle(_freezeHighlightBrush, rect);
|
||||||
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
|
e.Graphics.FillRectangle(_freezeHighlightBrush, textRect);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_secondaryHighlightBrush.Color = Color.FromArgb(0x44, Config.HexHighlightColor);
|
_secondaryHighlightBrush.Color = Color.FromArgb(0x44, Colors.Highlight);
|
||||||
e.Graphics.FillRectangle(_secondaryHighlightBrush, rect);
|
e.Graphics.FillRectangle(_secondaryHighlightBrush, rect);
|
||||||
e.Graphics.FillRectangle(_secondaryHighlightBrush, textRect);
|
e.Graphics.FillRectangle(_secondaryHighlightBrush, textRect);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,7 @@
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=filenames/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=filenames/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=filesize/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=filesize/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Finetuned/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Finetuned/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fmpeg/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=fname/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=fname/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEUX/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEUX/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|
Loading…
Reference in New Issue