mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 13:51:40 +00:00
71 lines
2.4 KiB
C#
Executable file
71 lines
2.4 KiB
C#
Executable file
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
{
|
|
internal partial class DrawCurveOptionsPanel : UserControl
|
|
{
|
|
public event EventHandler OnValueChanged;
|
|
public event EventHandler OnContinuousDrawingChanged;
|
|
public event EventHandler OnAutoCloseDrawingChanged;
|
|
private bool blockevents;
|
|
|
|
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; } }
|
|
public bool AutoCloseDrawing { get { return autoclosedrawing.Checked; } set { autoclosedrawing.Checked = value; } }
|
|
|
|
public DrawCurveOptionsPanel(int minLength, int maxLength)
|
|
{
|
|
InitializeComponent();
|
|
|
|
seglen.Minimum = minLength;
|
|
seglen.Maximum = maxLength;
|
|
}
|
|
|
|
private DrawCurveOptionsPanel() { InitializeComponent(); }
|
|
|
|
public void Register()
|
|
{
|
|
General.Interface.BeginToolbarUpdate();
|
|
General.Interface.AddButton(continuousdrawing);
|
|
General.Interface.AddButton(autoclosedrawing);
|
|
General.Interface.AddButton(toolStripSeparator1);
|
|
General.Interface.AddButton(seglabel);
|
|
General.Interface.AddButton(seglen);
|
|
General.Interface.AddButton(reset);
|
|
General.Interface.EndToolbarUpdate();
|
|
}
|
|
|
|
public void Unregister()
|
|
{
|
|
General.Interface.BeginToolbarUpdate();
|
|
General.Interface.RemoveButton(reset);
|
|
General.Interface.RemoveButton(seglen);
|
|
General.Interface.RemoveButton(seglabel);
|
|
General.Interface.RemoveButton(toolStripSeparator1);
|
|
General.Interface.RemoveButton(autoclosedrawing);
|
|
General.Interface.RemoveButton(continuousdrawing);
|
|
General.Interface.EndToolbarUpdate();
|
|
}
|
|
|
|
private void seglen_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
|
}
|
|
|
|
private void reset_Click(object sender, EventArgs e)
|
|
{
|
|
seglen.Value = seglen.Minimum;
|
|
}
|
|
|
|
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if(OnContinuousDrawingChanged != null) OnContinuousDrawingChanged(continuousdrawing.Checked, EventArgs.Empty);
|
|
}
|
|
|
|
private void autoclosedrawing_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if(OnAutoCloseDrawingChanged != null) OnAutoCloseDrawingChanged(autoclosedrawing.Checked, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|