diff --git a/PKHeX.WinForms/App.config b/PKHeX.WinForms/App.config
index 9b8b533ac..7ce18838d 100644
--- a/PKHeX.WinForms/App.config
+++ b/PKHeX.WinForms/App.config
@@ -73,6 +73,9 @@
False
+
+
+
diff --git a/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs b/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
index 7e57d7376..3b9a114b7 100644
--- a/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
+++ b/PKHeX.WinForms/Controls/PKM Editor/DrawConfig.cs
@@ -1,37 +1,81 @@
using System;
+using System.Collections.Generic;
+using System.ComponentModel;
using System.Drawing;
+using PKHeX.Core;
-namespace PKHeX.WinForms.Controls
+namespace PKHeX.WinForms
{
///
/// Drawing Configuration for painting and updating controls
///
- [Serializable]
- public class DrawConfig : IDisposable
+ public sealed class DrawConfig : IDisposable
{
- public Color InvalidSelection { get; set; } = Color.DarkSalmon;
- public Color MarkBlue { get; set; } = Color.FromArgb(000, 191, 255);
- public Color MarkPink { get; set; } = Color.FromArgb(255, 117, 179);
- public Color MarkDefault { get; set; } = Color.Black;
- public Color BackLegal { get; set; } = Color.FromArgb(200, 255, 200);
- public Color TextColor { get; set; } = SystemColors.WindowText;
- public Color BackColor { get; set; } = SystemColors.Window;
- public Color TextHighlighted { get; set; } = SystemColors.HighlightText;
- public Color BackHighlighted { get; set; } = SystemColors.Highlight;
+ private const string PKM = "Pokémon Editor";
+ private const string Moves = "Moves";
+ private const string Hovering = "Hovering";
+
+ [Category(Hovering), Description("Hovering over a PKM color 1.")]
public Color GlowInitial { get; set; } = Color.White;
+
+ [Category(Hovering), Description("Hovering over a PKM color 2.")]
public Color GlowFinal { get; set; } = Color.LightSkyBlue;
- public string ShinyDefault { get; set; } = "*";
+ #region PKM
+
+ [Category(PKM), Description("Background color of a ComboBox when the selected item is not valid.")]
+ public Color InvalidSelection { get; set; } = Color.DarkSalmon;
+
+ [Category(PKM), Description("Default colored marking.")]
+ public Color MarkDefault { get; set; } = Color.Black;
+
+ [Category(PKM), Description("Blue colored marking.")]
+ public Color MarkBlue { get; set; } = Color.FromArgb(000, 191, 255);
+
+ [Category(PKM), Description("Pink colored marking.")]
+ public Color MarkPink { get; set; } = Color.FromArgb(255, 117, 179);
+
+ [Category(PKM), Description("Blue colored marking.")]
+ public Color Male { get; set; } = Color.Red;
+
+ [Category(PKM), Description("Pink colored marking.")]
+ public Color Female { get; set; } = Color.Blue;
+
+ [Category(PKM), Description("Shiny star when using unicode characters.")]
public string ShinyUnicode { get; set; } = "☆";
+ [Category(PKM), Description("Shiny star when not using unicode characters.")]
+ public string ShinyDefault { get; set; } = "*";
+
+ #endregion
+
+ #region Moves
+
+ [Category(Moves), Description("Legal move choice background color.")]
+ public Color BackLegal { get; set; } = Color.FromArgb(200, 255, 200);
+
+ [Category(Moves), Description("Legal move choice text color.")]
+ public Color TextColor { get; set; } = SystemColors.WindowText;
+
+ [Category(Moves), Description("Illegal Legal move choice background color.")]
+ public Color BackColor { get; set; } = SystemColors.Window;
+
+ [Category(Moves), Description("Highlighted move choice background color.")]
+ public Color BackHighlighted { get; set; } = SystemColors.Highlight;
+
+ [Category(Moves), Description("Highlighted move choice text color.")]
+ public Color TextHighlighted { get; set; } = SystemColors.HighlightText;
+
+ #endregion
+
public DrawConfig() => LoadBrushes();
public Color GetGenderColor(int gender)
{
switch (gender)
{
- case 0: return Color.Blue;
- case 1: return Color.Red;
+ case 0: return Male;
+ case 1: return Female;
default: return TextColor;
}
}
@@ -62,7 +106,7 @@ namespace PKHeX.WinForms.Controls
public void Dispose() => Brushes.Dispose();
- public class BrushSet : IDisposable
+ public sealed class BrushSet : IDisposable
{
public Brush Text { get; set; }
public Brush BackLegal { get; set; }
@@ -82,5 +126,54 @@ namespace PKHeX.WinForms.Controls
BackHighlighted.Dispose();
}
}
+
+ public override string ToString()
+ {
+ var props = ReflectUtil.GetAllPropertyInfoCanWritePublic(typeof(DrawConfig));
+ var lines = new List();
+ foreach (var p in props)
+ {
+ if (p.PropertyType == typeof(BrushSet))
+ continue;
+
+ var name = p.Name;
+ object value;
+ if (p.PropertyType == typeof(Color))
+ value = ((Color)p.GetValue(this)).ToArgb();
+ else
+ value = p.GetValue(this);
+ lines.Add($"{name}\t{value}");
+ }
+ return string.Join("\n", lines);
+ }
+
+ public static DrawConfig GetConfig(string data)
+ {
+ var config = new DrawConfig();
+ if (string.IsNullOrWhiteSpace(data))
+ return config;
+
+ var lines = data.Split('\n');
+ var t = typeof(DrawConfig);
+ foreach (var l in lines)
+ {
+ var split = l.Split('\t');
+ var name = split[0];
+ var value = split[1];
+
+ var pi = t.GetProperty(name);
+ if (pi.PropertyType == typeof(Color))
+ {
+ var color = Color.FromArgb(int.Parse(value));
+ pi.SetValue(config, color);
+ }
+ else
+ {
+ pi.SetValue(config, split[1]);
+ }
+ }
+
+ return config;
+ }
}
}
diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs
index 3ae62928d..f87d3807b 100644
--- a/PKHeX.WinForms/MainWindow/Main.cs
+++ b/PKHeX.WinForms/MainWindow/Main.cs
@@ -275,10 +275,12 @@ namespace PKHeX.WinForms
BAKprompt = Settings.BAKPrompt = true;
}
+ public static DrawConfig Draw;
+
private void FormInitializeSecond()
{
var settings = Settings.Default;
- C_SAV.M.Draw = PKME_Tabs.Draw = new DrawConfig();
+ Draw = C_SAV.M.Draw = PKME_Tabs.Draw = DrawConfig.GetConfig(settings.Draw);
ReloadProgramSettings(settings);
CB_MainLanguage.Items.AddRange(main_langlist);
PB_Legal.Visible = !HaX;
@@ -418,6 +420,7 @@ namespace PKHeX.WinForms
private void ReloadProgramSettings(Settings settings)
{
+ Draw.LoadBrushes();
PKME_Tabs.Unicode = Unicode = settings.Unicode;
PKME_Tabs.UpdateUnicode(GenderSymbols);
PKX.AllowShinySprite = settings.ShinySprites;
@@ -1168,9 +1171,23 @@ namespace PKHeX.WinForms
}
}
- try { Settings.Default.Save(); }
- catch (Exception x) { File.WriteAllLines("config error.txt", new[] { x.ToString() }); }
+ SaveSettings();
}
+
+ private static void SaveSettings()
+ {
+ try
+ {
+ var settings = Settings.Default;
+ settings.Draw = Draw.ToString();
+ Settings.Default.Save();
+ }
+ catch (Exception x)
+ {
+ File.WriteAllLines("config error.txt", new[] {x.ToString()});
+ }
+ }
+
#endregion
#region //// SAVE FILE FUNCTIONS ////
diff --git a/PKHeX.WinForms/Properties/Settings.Designer.cs b/PKHeX.WinForms/Properties/Settings.Designer.cs
index 540c770fd..3f5878878 100644
--- a/PKHeX.WinForms/Properties/Settings.Designer.cs
+++ b/PKHeX.WinForms/Properties/Settings.Designer.cs
@@ -286,5 +286,17 @@ namespace PKHeX.WinForms.Properties {
this["IgnoreLegalPopup"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string Draw {
+ get {
+ return ((string)(this["Draw"]));
+ }
+ set {
+ this["Draw"] = value;
+ }
+ }
}
}
diff --git a/PKHeX.WinForms/Properties/Settings.settings b/PKHeX.WinForms/Properties/Settings.settings
index 9529f2e5e..32e93dfa5 100644
--- a/PKHeX.WinForms/Properties/Settings.settings
+++ b/PKHeX.WinForms/Properties/Settings.settings
@@ -68,5 +68,8 @@
False
+
+
+
\ No newline at end of file