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 DrawGridOptionsPanel : UserControl
|
2014-01-16 09:32:05 +00:00
|
|
|
|
{
|
|
|
|
|
public event EventHandler OnValueChanged;
|
2014-01-17 09:44:08 +00:00
|
|
|
|
public event EventHandler OnGridLockChanged;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
private bool blockEvents;
|
|
|
|
|
|
|
|
|
|
public bool Triangulate { get { return triangulate.Checked; } set { blockEvents = true; triangulate.Checked = value; blockEvents = false; } }
|
2014-01-17 09:44:08 +00:00
|
|
|
|
public bool LockToGrid { get { return gridlock.Checked; } set { blockEvents = true; gridlock.Checked = value; blockEvents = false; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
public int HorizontalSlices { get { return (int)slicesH.Value; } set { blockEvents = true; slicesH.Value = value; blockEvents = false; } }
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public int MaxHorizontalSlices { get { return (int)slicesH.Maximum; } set { slicesH.Maximum = value; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
public int VerticalSlices { get { return (int)slicesV.Value; } set { blockEvents = true; slicesV.Value = value; blockEvents = false; } }
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public int MaxVerticalSlices { get { return (int)slicesV.Maximum; } set { slicesV.Maximum = value; } }
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
|
|
|
|
public DrawGridOptionsPanel() {
|
|
|
|
|
InitializeComponent();
|
2014-02-28 14:32:20 +00:00
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-02-28 14:32:20 +00:00
|
|
|
|
public void Register() {
|
|
|
|
|
General.Interface.AddButton(sliceshlabel);
|
|
|
|
|
General.Interface.AddButton(slicesH);
|
|
|
|
|
General.Interface.AddButton(slicesvlabel);
|
|
|
|
|
General.Interface.AddButton(slicesV);
|
|
|
|
|
General.Interface.AddButton(cbseparator);
|
|
|
|
|
General.Interface.AddButton(gridlock);
|
|
|
|
|
General.Interface.AddButton(triangulate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Unregister() {
|
|
|
|
|
General.Interface.RemoveButton(sliceshlabel);
|
|
|
|
|
General.Interface.RemoveButton(slicesH);
|
|
|
|
|
General.Interface.RemoveButton(slicesvlabel);
|
|
|
|
|
General.Interface.RemoveButton(slicesV);
|
|
|
|
|
General.Interface.RemoveButton(cbseparator);
|
|
|
|
|
General.Interface.RemoveButton(gridlock);
|
|
|
|
|
General.Interface.RemoveButton(triangulate);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ValueChanged(object sender, EventArgs e) {
|
2014-02-26 14:11:06 +00:00
|
|
|
|
if(!blockEvents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-17 09:44:08 +00:00
|
|
|
|
private void gridlock_CheckedChanged(object sender, EventArgs e) {
|
|
|
|
|
slicesH.Enabled = !gridlock.Checked;
|
|
|
|
|
slicesV.Enabled = !gridlock.Checked;
|
2014-02-28 14:32:20 +00:00
|
|
|
|
if(!blockEvents && OnGridLockChanged != null) OnGridLockChanged(this, EventArgs.Empty);
|
2014-01-17 09:44:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|