2014-01-16 09:32:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
2016-03-04 13:41:55 +00:00
|
|
|
|
using InterpolationMode = CodeImp.DoomBuilder.Geometry.InterpolationTools.Mode;
|
|
|
|
|
using GridLockMode = CodeImp.DoomBuilder.BuilderModes.DrawGridMode.GridLockMode;
|
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;
|
2016-03-04 13:41:55 +00:00
|
|
|
|
public event EventHandler OnGridLockModeChanged;
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public event EventHandler OnContinuousDrawingChanged;
|
2015-06-25 18:32:29 +00:00
|
|
|
|
private bool blockevents;
|
2014-01-16 09:32:05 +00:00
|
|
|
|
|
2015-06-25 18:32:29 +00:00
|
|
|
|
public bool Triangulate { get { return triangulate.Checked; } set { blockevents = true; triangulate.Checked = value; blockevents = false; } }
|
2016-03-04 13:41:55 +00:00
|
|
|
|
public GridLockMode GridLockMode { get { return (GridLockMode)gridlockmode.SelectedIndex; } set { blockevents = true; gridlockmode.SelectedIndex = (int)value; blockevents = false; } }
|
2015-06-25 18:32:29 +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; } }
|
2015-06-25 18:32:29 +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; } }
|
2016-02-17 22:23:18 +00:00
|
|
|
|
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
|
2016-03-04 13:41:55 +00:00
|
|
|
|
public InterpolationMode HorizontalInterpolationMode
|
2015-01-16 23:37:20 +00:00
|
|
|
|
{
|
2016-03-04 13:41:55 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
|
|
|
|
|
return (mode == GridLockMode.BOTH || mode == GridLockMode.HORIZONTAL)
|
|
|
|
|
? InterpolationMode.LINEAR : (InterpolationMode)interphmode.SelectedIndex;
|
|
|
|
|
}
|
2015-01-16 23:37:20 +00:00
|
|
|
|
set { interphmode.SelectedIndex = (int)value; }
|
|
|
|
|
}
|
2016-03-04 13:41:55 +00:00
|
|
|
|
public InterpolationMode VerticalInterpolationMode
|
2015-01-16 23:37:20 +00:00
|
|
|
|
{
|
2016-03-04 13:41:55 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
|
|
|
|
|
return (mode == GridLockMode.BOTH || mode == GridLockMode.VERTICAL)
|
|
|
|
|
? InterpolationMode.LINEAR : (InterpolationMode)interpvmode.SelectedIndex;
|
|
|
|
|
}
|
2015-01-16 23:37:20 +00:00
|
|
|
|
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
|
2015-06-25 18:32:29 +00:00
|
|
|
|
interphmode.Items.AddRange(new object[] { MenusForm.GradientInterpolationModes.Linear, MenusForm.GradientInterpolationModes.EaseInOutSine, MenusForm.GradientInterpolationModes.EaseInSine, MenusForm.GradientInterpolationModes.EaseOutSine });
|
2015-01-16 23:37:20 +00:00
|
|
|
|
interphmode.SelectedIndex = 0;
|
2015-06-25 18:32:29 +00:00
|
|
|
|
interpvmode.Items.AddRange(new object[] { MenusForm.GradientInterpolationModes.Linear, MenusForm.GradientInterpolationModes.EaseInOutSine, MenusForm.GradientInterpolationModes.EaseInSine, MenusForm.GradientInterpolationModes.EaseOutSine });
|
2015-01-16 23:37:20 +00:00
|
|
|
|
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
|
|
|
|
private void ValueChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-06-25 18:32:29 +00:00
|
|
|
|
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-03-04 13:41:55 +00:00
|
|
|
|
private void gridlockmode_SelectedIndexChanged(object sender, EventArgs e)
|
2014-12-03 23:15:26 +00:00
|
|
|
|
{
|
2016-03-04 13:41:55 +00:00
|
|
|
|
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
|
|
|
|
|
slicesH.Enabled = (mode == GridLockMode.NONE || mode == GridLockMode.VERTICAL);
|
|
|
|
|
slicesV.Enabled = (mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL);
|
|
|
|
|
interphmode.Enabled = slicesH.Enabled;
|
|
|
|
|
interpvmode.Enabled = slicesV.Enabled;
|
|
|
|
|
reset.Enabled = (mode != GridLockMode.BOTH);
|
|
|
|
|
|
|
|
|
|
if(!blockevents && OnGridLockModeChanged != null) OnGridLockModeChanged(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();
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-25 18:32:29 +00:00
|
|
|
|
private void reset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2016-03-04 13:41:55 +00:00
|
|
|
|
GridLockMode mode = (GridLockMode)gridlockmode.SelectedIndex;
|
|
|
|
|
|
2015-06-25 18:32:29 +00:00
|
|
|
|
blockevents = true;
|
2016-03-04 13:41:55 +00:00
|
|
|
|
if((mode == GridLockMode.NONE || mode == GridLockMode.VERTICAL)) slicesH.Value = 3;
|
|
|
|
|
if(mode == GridLockMode.NONE || mode == GridLockMode.HORIZONTAL) slicesV.Value = 3;
|
2015-06-25 18:32:29 +00:00
|
|
|
|
blockevents = false;
|
|
|
|
|
|
|
|
|
|
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
|
|
|
|
|
}
|
2016-02-17 22:23:18 +00:00
|
|
|
|
|
|
|
|
|
private void continuousdrawing_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(OnContinuousDrawingChanged != null) OnContinuousDrawingChanged(continuousdrawing.Checked, EventArgs.Empty);
|
|
|
|
|
}
|
2014-01-16 09:32:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|