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,15 +71,19 @@ namespace CodeImp.DoomBuilder.Controls
return c;
}
public void UpdateCheckboxes(IDictionary<string,string> newflags)
{
int i = 0;
foreach (KeyValuePair<string,string> p in newflags)
{
checkboxes[i].Text = p.Value;
i++;
}
}
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++;
}
}
//mxd
public int GetWidth()

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,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<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;
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}