Linedef Edit Form: activation flags check was not updated properly.

This commit is contained in:
MaxED 2014-09-15 14:49:11 +00:00
parent 032c8aaae1
commit 70db005f12
2 changed files with 42 additions and 24 deletions

View file

@ -493,6 +493,7 @@ namespace CodeImp.DoomBuilder.Windows
this.udmfactivates.Size = new System.Drawing.Size(509, 133);
this.udmfactivates.TabIndex = 0;
this.udmfactivates.VerticalSpacing = 1;
this.udmfactivates.OnValueChanged += new System.EventHandler(this.udmfactivates_OnValueChanged);
//
// flagsgroup
//

View file

@ -608,6 +608,7 @@ namespace CodeImp.DoomBuilder.Windows
preventchanges = false;
updateScriptControls(); //mxd
CheckActivationFlagsRequired(); //mxd
//mxd. Set intial script-related values, if required
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1)
@ -669,6 +670,33 @@ namespace CodeImp.DoomBuilder.Windows
}
}
//mxd
private void CheckActivationFlagsRequired()
{
// Display a warning if we have an action and no activation flags
if(action.Value != 0)
{
bool haveactivationflag = false;
foreach(CheckBox c in udmfactivates.Checkboxes)
{
if(c.CheckState != CheckState.Unchecked)
{
haveactivationflag = true;
break;
}
}
//TODO: check if action actually requires activation :)
missingactivation.Visible = !haveactivationflag;
activationGroup.ForeColor = (!haveactivationflag ? Color.DarkRed : SystemColors.ControlText);
}
else
{
missingactivation.Visible = false;
activationGroup.ForeColor = SystemColors.ControlText;
}
}
#endregion
#region ================== Events
@ -914,30 +942,12 @@ namespace CodeImp.DoomBuilder.Windows
}
}
//mxd. Display a warning if we have an action and no activation flags
if (action.Value != 0)
//mxd
if(!preventchanges)
{
bool haveactivationflag = false;
foreach (CheckBox c in udmfactivates.Checkboxes)
{
if (c.CheckState != CheckState.Unchecked)
{
haveactivationflag = true;
break;
}
}
//TODO: check if action actually requires activation :)
missingactivation.Visible = !haveactivationflag;
activationGroup.ForeColor = (!haveactivationflag ? Color.DarkRed : SystemColors.ControlText);
updateScriptControls();
CheckActivationFlagsRequired();
}
else
{
missingactivation.Visible = false;
activationGroup.ForeColor = SystemColors.ControlText;
}
if(!preventchanges) updateScriptControls(); //mxd
}
// Browse Action clicked
@ -1044,11 +1054,18 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
//mxd
private void udmfactivates_OnValueChanged(object sender, EventArgs e)
{
if(preventchanges) return;
CheckActivationFlagsRequired();
}
#endregion
#region Reltime events (sides)
#region ================== mxd. Realtime events (sides)
#region Custom fields changed
#region Custom fields changed
// Custom fields on front sides
private void customfrontbutton_Click(object sender, EventArgs e)