From 8b6406075c395946decff98672fad2bd5830d930 Mon Sep 17 00:00:00 2001 From: sphere Date: Sat, 3 Apr 2021 17:06:09 +0200 Subject: [PATCH] Add an indication to changed flag/angle/parameter labels, to show when flags or angle/parameter values have changed behavior. --- Source/Core/Controls/CheckboxArrayControl.cs | 22 ++++++++++++-------- Source/Core/Controls/ThingBrowserControl.cs | 1 + Source/Core/Windows/LinedefEditForm.cs | 4 ++-- Source/Core/Windows/ThingEditForm.cs | 14 ++++++++----- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Source/Core/Controls/CheckboxArrayControl.cs b/Source/Core/Controls/CheckboxArrayControl.cs index e9682cc..6f8db8c 100644 --- a/Source/Core/Controls/CheckboxArrayControl.cs +++ b/Source/Core/Controls/CheckboxArrayControl.cs @@ -71,15 +71,19 @@ namespace CodeImp.DoomBuilder.Controls return c; } - public void UpdateCheckboxes(IDictionary newflags) - { - int i = 0; - foreach (KeyValuePair p in newflags) - { - checkboxes[i].Text = p.Value; - i++; - } - } + public void UpdateCheckboxes(IDictionary newflags, IDictionary baseflags) + { + int i = 0; + foreach (KeyValuePair p in newflags) + { + checkboxes[i].Text = p.Value; + + baseflags.TryGetValue(p.Key, out string basevalue); + checkboxes[i].BackColor = (p.Value != basevalue) ? Color.LightGray : Color.White; + + i++; + } + } //mxd public int GetWidth() diff --git a/Source/Core/Controls/ThingBrowserControl.cs b/Source/Core/Controls/ThingBrowserControl.cs index 9b33457..d010904 100644 --- a/Source/Core/Controls/ThingBrowserControl.cs +++ b/Source/Core/Controls/ThingBrowserControl.cs @@ -371,6 +371,7 @@ namespace CodeImp.DoomBuilder.Controls int offset = 2 + (int)g.MeasureString(parametercaption.Text, parametercaption.Font).Width; parametercaption.Location = new System.Drawing.Point(Math.Max(60 - offset, 0), 27); parametercaption.Size = new System.Drawing.Size(offset, 13); + parametercaption.BackColor = (parametercaption.Text != "Parameter:") ? Color.LightGray : Color.White; } if(doupdatenode) diff --git a/Source/Core/Windows/LinedefEditForm.cs b/Source/Core/Windows/LinedefEditForm.cs index f2939a1..8a70b38 100644 --- a/Source/Core/Windows/LinedefEditForm.cs +++ b/Source/Core/Windows/LinedefEditForm.cs @@ -339,7 +339,7 @@ namespace CodeImp.DoomBuilder.Windows linedefprops.Add(new LinedefProperties(l)); } - if (allsameaction) flags.UpdateCheckboxes(newFlags); + if (allsameaction) flags.UpdateCheckboxes(newFlags, General.Map.Config.LinedefFlags); // Refresh controls so that they show their image backhigh.Refresh(); @@ -560,7 +560,7 @@ namespace CodeImp.DoomBuilder.Windows LinedefActionInfo li = General.Map.Config.GetLinedefActionInfo(action.Value); IDictionary newFlags = (li == null || li.Flags.Count == 0) ? General.Map.Config.LinedefFlags : li.Flags; - flags.UpdateCheckboxes(newFlags); + flags.UpdateCheckboxes(newFlags, General.Map.Config.LinedefFlags); // (Re)set hacky flat alignment foreach (Linedef l in lines) diff --git a/Source/Core/Windows/ThingEditForm.cs b/Source/Core/Windows/ThingEditForm.cs index ff116e7..80a4dfd 100644 --- a/Source/Core/Windows/ThingEditForm.cs +++ b/Source/Core/Windows/ThingEditForm.cs @@ -284,11 +284,12 @@ namespace CodeImp.DoomBuilder.Windows if (allsametype) { - flags.UpdateCheckboxes(newFlags); + flags.UpdateCheckboxes(newFlags, General.Map.Config.ThingFlags); if (ti != null) { groupBox4.Text = ti.AngleText; - label3.Text = ti.FlagsValueText + ":"; + groupBox4.BackColor = (groupBox4.Text != "Angle") ? Color.LightGray : Color.White; + label3.Text = ti.FlagsValueText + ":"; } } @@ -300,8 +301,9 @@ namespace CodeImp.DoomBuilder.Windows flags_OnValueChanged(flags, EventArgs.Empty); preventmapchange = false; flagsvalue.Text = evaluateFlagsValue(); + label3.BackColor = (label3.Text != "Flags value:") ? Color.LightGray : Color.White; - argscontrol.UpdateScriptControls(); //mxd + argscontrol.UpdateScriptControls(); //mxd actionhelp.UpdateAction(action.GetValue()); //mxd } @@ -635,11 +637,13 @@ namespace CodeImp.DoomBuilder.Windows } IDictionary newFlags = (thinginfo == null || thinginfo.Flags.Count == 0) ? General.Map.Config.ThingFlags : thinginfo.Flags; - flags.UpdateCheckboxes(newFlags); + flags.UpdateCheckboxes(newFlags, General.Map.Config.ThingFlags); groupBox4.Text = (thinginfo == null) ? "Angle" : thinginfo.AngleText; + groupBox4.BackColor = (groupBox4.Text != "Angle") ? Color.LightGray : Color.White; label3.Text = (thinginfo == null) ? "Flags value:" : thinginfo.FlagsValueText + ":"; + label3.BackColor = (label3.Text != "Flags value:") ? Color.LightGray : Color.White; - General.Map.IsChanged = true; + General.Map.IsChanged = true; if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); }