2014-02-26 14:11:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
internal partial class DrawCurveOptionsPanel : UserControl
|
2014-02-26 14:11:06 +00:00
|
|
|
|
{
|
|
|
|
|
public event EventHandler OnValueChanged;
|
|
|
|
|
private bool blockEvents;
|
|
|
|
|
|
|
|
|
|
public int SegmentLength { get { return (int)seglen.Value; } set { blockEvents = true; seglen.Value = value; blockEvents = false; } }
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public DrawCurveOptionsPanel(int minLength, int maxLength)
|
|
|
|
|
{
|
2014-02-26 14:11:06 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
seglen.Minimum = minLength;
|
|
|
|
|
seglen.Maximum = maxLength;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DrawCurveOptionsPanel() { InitializeComponent(); }
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Register()
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.AddButton(seglabel);
|
|
|
|
|
General.Interface.AddButton(seglen);
|
2014-07-02 10:12:53 +00:00
|
|
|
|
General.Interface.AddButton(reset);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Unregister()
|
|
|
|
|
{
|
2014-07-02 10:12:53 +00:00
|
|
|
|
General.Interface.RemoveButton(reset);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.RemoveButton(seglen);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.RemoveButton(seglabel);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void seglen_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-02-26 14:11:06 +00:00
|
|
|
|
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
|
|
|
|
}
|
2014-07-02 10:12:53 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void reset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2014-07-02 10:12:53 +00:00
|
|
|
|
seglen.Value = seglen.Minimum;
|
|
|
|
|
}
|
2014-02-26 14:11:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|