2014-01-16 09:32:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
internal partial class DrawEllipseOptionsPanel : UserControl
|
2014-01-16 09:32:05 +00:00
|
|
|
|
{
|
|
|
|
|
public event EventHandler OnValueChanged;
|
|
|
|
|
private bool blockEvents;
|
|
|
|
|
|
|
|
|
|
private static int aquityValue;
|
|
|
|
|
private static int subdivsValue = 8;
|
|
|
|
|
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public int Spikiness { get { return (int)spikiness.Value; } set { blockEvents = true; spikiness.Value = value; blockEvents = false; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
public int Subdivisions { get { return (int)subdivs.Value; } set { blockEvents = true; subdivs.Value = value; blockEvents = false; } }
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public int MaxSubdivisions { get { return (int)subdivs.Maximum; } set { subdivs.Maximum = value; } }
|
|
|
|
|
public int MinSubdivisions { get { return (int)subdivs.Minimum; } set { subdivs.Minimum = value; } }
|
|
|
|
|
public int MaxSpikiness { get { return (int)spikiness.Maximum; } set { spikiness.Maximum = value; } }
|
|
|
|
|
public int MinSpikiness { get { return (int)spikiness.Minimum; } set { spikiness.Minimum = value; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
|
|
|
|
public DrawEllipseOptionsPanel() {
|
|
|
|
|
InitializeComponent();
|
2014-07-02 10:12:53 +00:00
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-07-02 10:12:53 +00:00
|
|
|
|
public void Register() {
|
2014-01-16 09:32:05 +00:00
|
|
|
|
spikiness.Value = aquityValue;
|
|
|
|
|
subdivs.Value = subdivsValue;
|
|
|
|
|
spikiness.ValueChanged += ValueChanged;
|
|
|
|
|
subdivs.ValueChanged += ValueChanged;
|
2014-02-28 14:32:20 +00:00
|
|
|
|
|
|
|
|
|
General.Interface.AddButton(subdivslabel);
|
|
|
|
|
General.Interface.AddButton(subdivs);
|
|
|
|
|
General.Interface.AddButton(spikinesslabel);
|
|
|
|
|
General.Interface.AddButton(spikiness);
|
|
|
|
|
General.Interface.AddButton(reset);
|
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public void Unregister() {
|
|
|
|
|
General.Interface.RemoveButton(reset);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.RemoveButton(spikiness);
|
|
|
|
|
General.Interface.RemoveButton(spikinesslabel);
|
|
|
|
|
General.Interface.RemoveButton(subdivs);
|
|
|
|
|
General.Interface.RemoveButton(subdivslabel);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ValueChanged(object sender, EventArgs e) {
|
|
|
|
|
aquityValue = (int)spikiness.Value;
|
|
|
|
|
subdivsValue = (int)subdivs.Value;
|
2014-02-26 14:11:06 +00:00
|
|
|
|
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void reset_Click(object sender, EventArgs e) {
|
2014-02-28 14:32:20 +00:00
|
|
|
|
blockEvents = true;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
spikiness.Value = 0;
|
2014-02-28 14:32:20 +00:00
|
|
|
|
blockEvents = false;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
subdivs.Value = subdivs.Minimum;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|