Add an indication to changed flag/angle/parameter labels, to show when flags or angle/parameter values have changed behavior.

This commit is contained in:
sphere 2021-04-03 17:06:09 +02:00
parent 83e5cebe8f
commit 8b6406075c
4 changed files with 25 additions and 16 deletions

View file

@ -71,12 +71,16 @@ namespace CodeImp.DoomBuilder.Controls
return c;
}
public void UpdateCheckboxes(IDictionary<string,string> newflags)
public void UpdateCheckboxes(IDictionary<string,string> newflags, IDictionary<string, string> baseflags)
{
int i = 0;
foreach (KeyValuePair<string,string> 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++;
}
}

View file

@ -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)

View file

@ -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<string, string> 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)

View file

@ -284,10 +284,11 @@ namespace CodeImp.DoomBuilder.Windows
if (allsametype)
{
flags.UpdateCheckboxes(newFlags);
flags.UpdateCheckboxes(newFlags, General.Map.Config.ThingFlags);
if (ti != null)
{
groupBox4.Text = ti.AngleText;
groupBox4.BackColor = (groupBox4.Text != "Angle") ? Color.LightGray : Color.White;
label3.Text = ti.FlagsValueText + ":";
}
}
@ -300,6 +301,7 @@ 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
actionhelp.UpdateAction(action.GetValue()); //mxd
@ -635,9 +637,11 @@ namespace CodeImp.DoomBuilder.Windows
}
IDictionary<string, string> 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;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);