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 DrawRectangleOptionsPanel : UserControl
|
2014-01-16 09:32:05 +00:00
|
|
|
|
{
|
|
|
|
|
public event EventHandler OnValueChanged;
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public event EventHandler OnContinuousDrawingChanged;
|
2016-09-26 12:53:50 +00:00
|
|
|
|
public event EventHandler OnShowGuidelinesChanged;
|
|
|
|
|
|
2016-02-17 22:23:18 +00:00
|
|
|
|
private bool blockevents;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public int BevelWidth { get { return (int)radius.Value; } set { blockevents = true; radius.Value = value; blockevents = false; } }
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public int MaxBevelWidth { get { return (int)radius.Maximum; } set { radius.Maximum = value; } }
|
|
|
|
|
public int MinBevelWidth { get { return (int)radius.Minimum; } set { radius.Minimum = value; } }
|
2016-02-17 22:23:18 +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; } }
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
|
2016-09-26 12:53:50 +00:00
|
|
|
|
public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.Checked = value; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public DrawRectangleOptionsPanel()
|
|
|
|
|
{
|
2014-01-16 09:32:05 +00:00
|
|
|
|
InitializeComponent();
|
2014-07-02 10:12:53 +00:00
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Register()
|
|
|
|
|
{
|
2014-01-16 09:32:05 +00:00
|
|
|
|
radius.ValueChanged += ValueChanged;
|
|
|
|
|
subdivs.ValueChanged += ValueChanged;
|
2014-02-28 14:32:20 +00:00
|
|
|
|
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.BeginToolbarUpdate();
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.AddButton(continuousdrawing);
|
2016-09-26 12:53:50 +00:00
|
|
|
|
General.Interface.AddButton(showguidelines);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.AddButton(toolStripSeparator1);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.AddButton(radiuslabel);
|
|
|
|
|
General.Interface.AddButton(radius);
|
|
|
|
|
General.Interface.AddButton(subdivslabel);
|
|
|
|
|
General.Interface.AddButton(subdivs);
|
|
|
|
|
General.Interface.AddButton(reset);
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.EndToolbarUpdate();
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
2014-01-16 09:32:05 +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-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.RemoveButton(reset);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.RemoveButton(subdivs);
|
|
|
|
|
General.Interface.RemoveButton(subdivslabel);
|
|
|
|
|
General.Interface.RemoveButton(radius);
|
|
|
|
|
General.Interface.RemoveButton(radiuslabel);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.RemoveButton(toolStripSeparator1);
|
2016-09-26 12:53:50 +00:00
|
|
|
|
General.Interface.RemoveButton(showguidelines);
|
2016-02-17 22:23:18 +00:00
|
|
|
|
General.Interface.RemoveButton(continuousdrawing);
|
2016-11-26 00:02:56 +00:00
|
|
|
|
General.Interface.EndToolbarUpdate();
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-02-17 22:23:18 +00:00
|
|
|
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
private void reset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-03-08 20:37:44 +00:00
|
|
|
|
// Reset values
|
2016-02-17 22:23:18 +00:00
|
|
|
|
blockevents = true;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
radius.Value = 0;
|
|
|
|
|
subdivs.Value = 0;
|
2016-03-08 20:37:44 +00:00
|
|
|
|
blockevents = false;
|
|
|
|
|
|
|
|
|
|
// Dispatch event
|
|
|
|
|
OnValueChanged(this, EventArgs.Empty);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
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-09-26 12:53:50 +00:00
|
|
|
|
|
|
|
|
|
private void showguidelines_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(OnShowGuidelinesChanged != null) OnShowGuidelinesChanged(showguidelines.Checked, EventArgs.Empty);
|
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|