2014-01-16 09:32:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2015-01-16 23:37:20 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
|
|
|
|
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; } }
|
2015-01-16 23:37:20 +00:00
|
|
|
|
public InterpolationTools.Mode HorizontalInterpolationMode
|
|
|
|
|
{
|
|
|
|
|
get { return gridlock.Checked ? InterpolationTools.Mode.LINEAR : (InterpolationTools.Mode)interphmode.SelectedIndex; }
|
|
|
|
|
set { interphmode.SelectedIndex = (int)value; }
|
|
|
|
|
}
|
|
|
|
|
public InterpolationTools.Mode VerticalInterpolationMode
|
|
|
|
|
{
|
|
|
|
|
get { return gridlock.Checked ? InterpolationTools.Mode.LINEAR : (InterpolationTools.Mode)interpvmode.SelectedIndex; }
|
|
|
|
|
set { interpvmode.SelectedIndex = (int)value; }
|
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public DrawGridOptionsPanel()
|
|
|
|
|
{
|
2014-01-16 09:32:05 +00:00
|
|
|
|
InitializeComponent();
|
2015-01-16 23:37:20 +00:00
|
|
|
|
|
|
|
|
|
// Fill them menus
|
|
|
|
|
interphmode.Items.AddRange(new[] { MenusForm.GradientInterpolationModes.Linear, MenusForm.GradientInterpolationModes.EaseInOutSine, MenusForm.GradientInterpolationModes.EaseInSine, MenusForm.GradientInterpolationModes.EaseOutSine });
|
|
|
|
|
interphmode.SelectedIndex = 0;
|
|
|
|
|
interpvmode.Items.AddRange(new[] { MenusForm.GradientInterpolationModes.Linear, MenusForm.GradientInterpolationModes.EaseInOutSine, MenusForm.GradientInterpolationModes.EaseInSine, MenusForm.GradientInterpolationModes.EaseOutSine });
|
|
|
|
|
interpvmode.SelectedIndex = 0;
|
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 Register()
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.AddButton(sliceshlabel);
|
|
|
|
|
General.Interface.AddButton(slicesH);
|
|
|
|
|
General.Interface.AddButton(slicesvlabel);
|
|
|
|
|
General.Interface.AddButton(slicesV);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.AddButton(reset);
|
2015-01-16 23:37:20 +00:00
|
|
|
|
General.Interface.AddButton(cbseparator1);
|
|
|
|
|
General.Interface.AddButton(interphlabel);
|
|
|
|
|
General.Interface.AddButton(interphmode);
|
|
|
|
|
General.Interface.AddButton(interpvlabel);
|
|
|
|
|
General.Interface.AddButton(interpvmode);
|
|
|
|
|
General.Interface.AddButton(cbseparator2);
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.AddButton(gridlock);
|
|
|
|
|
General.Interface.AddButton(triangulate);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public void Unregister()
|
|
|
|
|
{
|
2014-02-28 14:32:20 +00:00
|
|
|
|
General.Interface.RemoveButton(triangulate);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.RemoveButton(gridlock);
|
2015-01-16 23:37:20 +00:00
|
|
|
|
General.Interface.RemoveButton(cbseparator2);
|
|
|
|
|
General.Interface.RemoveButton(interpvmode);
|
|
|
|
|
General.Interface.RemoveButton(interpvlabel);
|
|
|
|
|
General.Interface.RemoveButton(interphmode);
|
|
|
|
|
General.Interface.RemoveButton(interphlabel);
|
|
|
|
|
General.Interface.RemoveButton(cbseparator1);
|
2014-03-04 09:04:43 +00:00
|
|
|
|
General.Interface.RemoveButton(reset);
|
|
|
|
|
General.Interface.RemoveButton(slicesV);
|
|
|
|
|
General.Interface.RemoveButton(slicesvlabel);
|
|
|
|
|
General.Interface.RemoveButton(slicesH);
|
|
|
|
|
General.Interface.RemoveButton(sliceshlabel);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-03 23:15:26 +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
|
|
|
|
}
|
|
|
|
|
|
2015-01-16 23:37:20 +00:00
|
|
|
|
private void gridlock_CheckedChanged(object sender, EventArgs e)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2014-01-17 09:44:08 +00:00
|
|
|
|
slicesH.Enabled = !gridlock.Checked;
|
|
|
|
|
slicesV.Enabled = !gridlock.Checked;
|
2015-01-16 23:37:20 +00:00
|
|
|
|
interpvmode.Enabled = !gridlock.Checked;
|
|
|
|
|
interpvlabel.Enabled = !gridlock.Checked;
|
|
|
|
|
interphmode.Enabled = !gridlock.Checked;
|
|
|
|
|
interphlabel.Enabled = !gridlock.Checked;
|
|
|
|
|
reset.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
|
|
|
|
}
|
|
|
|
|
|
2015-01-16 23:37:20 +00:00
|
|
|
|
private void interpmode_DropDownClosed(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
General.Interface.FocusDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|