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;
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public event EventHandler OnContinuousDrawingChanged;
|
2016-03-14 10:25:27 +00:00
|
|
|
|
public event EventHandler OnAutoCloseDrawingChanged;
|
2023-09-08 00:57:22 +00:00
|
|
|
|
public event EventHandler OnDrawThingsAtVerticesChanged;
|
2016-02-17 22:23:18 +00:00
|
|
|
|
private bool blockevents;
|
2014-02-26 14:11:06 +00:00
|
|
|
|
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public int SegmentLength { get { return (int)seglen.Value; } set { blockevents = true; seglen.Value = value; blockevents = false; } }
|
|
|
|
|
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
|
2016-03-14 10:25:27 +00:00
|
|
|
|
public bool AutoCloseDrawing { get { return autoclosedrawing.Checked; } set { autoclosedrawing.Checked = value; } }
|
2023-09-08 00:57:22 +00:00
|
|
|
|
public bool DrawThingsAtVertices { get { return drawthingsatvertices.Checked; } set { drawthingsatvertices.Checked = value; } }
|
2014-02-26 14:11:06 +00:00
|
|
|
|
|
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()
|
|
|
|
|
{
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.BeginToolbarUpdate();
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.AddButton(continuousdrawing);
|
2016-03-14 10:25:27 +00:00
|
|
|
|
General.Interface.AddButton(autoclosedrawing);
|
2023-09-08 00:57:22 +00:00
|
|
|
|
General.Interface.AddButton(drawthingsatvertices);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.AddButton(toolStripSeparator1);
|
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);
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.EndToolbarUpdate();
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Unregister()
|
|
|
|
|
{
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.BeginToolbarUpdate();
|
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);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.RemoveButton(toolStripSeparator1);
|
2023-09-08 00:57:22 +00:00
|
|
|
|
General.Interface.RemoveButton(drawthingsatvertices);
|
2016-03-14 10:25:27 +00:00
|
|
|
|
General.Interface.RemoveButton(autoclosedrawing);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.RemoveButton(continuousdrawing);
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.EndToolbarUpdate();
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void seglen_ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-02-17 22:23:18 +00:00
|
|
|
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
2014-02-26 14:11:06 +00:00
|
|
|
|
}
|
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;
|
|
|
|
|
}
|
2016-02-17 22:23:18 +00:00
|
|
|
|
|
|
|
|
|
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(OnContinuousDrawingChanged != null) OnContinuousDrawingChanged(continuousdrawing.Checked, EventArgs.Empty);
|
|
|
|
|
}
|
2016-03-14 10:25:27 +00:00
|
|
|
|
|
|
|
|
|
private void autoclosedrawing_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(OnAutoCloseDrawingChanged != null) OnAutoCloseDrawingChanged(autoclosedrawing.Checked, EventArgs.Empty);
|
|
|
|
|
}
|
2023-09-08 00:57:22 +00:00
|
|
|
|
|
|
|
|
|
private void drawthingsatvertices_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (OnDrawThingsAtVerticesChanged != null) OnDrawThingsAtVerticesChanged(drawthingsatvertices.Checked, EventArgs.Empty);
|
|
|
|
|
}
|
2014-02-26 14:11:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|