2008-05-15 19:31:11 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Text;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
|
|
|
using CodeImp.DoomBuilder.Interface;
|
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
using System.Drawing;
|
|
|
|
using CodeImp.DoomBuilder.Editing;
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
{
|
|
|
|
public partial class CurveLinedefsForm : DelayedForm
|
|
|
|
{
|
2008-05-16 10:55:25 +00:00
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2008-05-15 19:31:11 +00:00
|
|
|
#region ================== Properties
|
|
|
|
|
|
|
|
public int Vertices { get { return verticesbar.Value; } }
|
|
|
|
public float Distance { get { return (float)distancebar.Value; } }
|
2008-05-15 19:48:07 +00:00
|
|
|
public float Angle { get { return Angle2D.DegToRad((float)anglebar.Value); } }
|
2008-05-15 19:31:11 +00:00
|
|
|
public bool FixedCurve { get { return circular.Checked; } }
|
|
|
|
public bool Backwards { get { return backwards.Checked; } }
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public CurveLinedefsForm()
|
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Interface
|
|
|
|
|
|
|
|
// Window closing
|
|
|
|
private void CurveLinedefsForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
{
|
|
|
|
// User closing the window?
|
|
|
|
if(e.CloseReason == CloseReason.UserClosing)
|
|
|
|
{
|
2008-05-16 10:55:25 +00:00
|
|
|
// Just cancel
|
|
|
|
General.Map.CancelMode();
|
2008-05-15 19:31:11 +00:00
|
|
|
e.Cancel = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-16 10:55:25 +00:00
|
|
|
// This shows the window
|
2008-05-16 21:08:36 +00:00
|
|
|
public void Show(Form owner)
|
2008-05-15 19:31:11 +00:00
|
|
|
{
|
|
|
|
// First time showing?
|
2008-05-16 10:55:25 +00:00
|
|
|
//if((this.Location.X == 0) && (this.Location.Y == 0))
|
2008-05-15 19:31:11 +00:00
|
|
|
{
|
2008-05-16 10:55:25 +00:00
|
|
|
// Position at left-top of owner
|
|
|
|
this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90);
|
2008-05-15 19:31:11 +00:00
|
|
|
}
|
2008-05-16 10:55:25 +00:00
|
|
|
|
|
|
|
// Show window
|
|
|
|
base.Show(owner);
|
2008-05-15 19:31:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Vertices bar changed
|
|
|
|
private void verticesbar_ValueChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
vertices.Text = verticesbar.Value.ToString();
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Vertices loses focus
|
|
|
|
private void vertices_Leave(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
vertices.Text = verticesbar.Value.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Vertices change
|
|
|
|
private void vertices_TextChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
int result = vertices.GetResult(verticesbar.Value);
|
|
|
|
if((result >= verticesbar.Minimum) && (result <= verticesbar.Maximum)) verticesbar.Value = result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Distance bar changed
|
|
|
|
private void distancebar_ValueChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
distance.Text = distancebar.Value.ToString();
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Distance loses focus
|
|
|
|
private void distance_Leave(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
distance.Text = distancebar.Value.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Distance changed
|
|
|
|
private void distance_TextChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
int result = distance.GetResult(distancebar.Value);
|
|
|
|
if((result >= distancebar.Minimum) && (result <= distancebar.Maximum)) distancebar.Value = result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Angle bar changed
|
|
|
|
private void anglebar_ValueChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
angle.Text = anglebar.Value.ToString();
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Angle loses focus
|
|
|
|
private void angle_Leave(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
angle.Text = anglebar.Value.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Angle changed
|
|
|
|
private void angle_TextChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
int result = angle.GetResult(anglebar.Value);
|
|
|
|
if((result >= anglebar.Minimum) && (result <= anglebar.Maximum)) anglebar.Value = result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Circular curve switched
|
|
|
|
private void circular_CheckedChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Enable/disable controls
|
|
|
|
distance.Enabled = !circular.Checked;
|
|
|
|
distancebar.Enabled = !circular.Checked;
|
|
|
|
distancelabel.Enabled = !circular.Checked;
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Curve backwards switched
|
|
|
|
private void backwards_CheckedChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
}
|
2008-05-16 10:55:25 +00:00
|
|
|
|
|
|
|
// Cancel clicked
|
|
|
|
private void cancel_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Cancel now
|
|
|
|
General.Map.CancelMode();
|
|
|
|
}
|
2008-05-15 19:31:11 +00:00
|
|
|
|
2008-05-16 10:55:25 +00:00
|
|
|
// Apply clicked
|
|
|
|
private void apply_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
// Apply now
|
2008-05-16 21:08:36 +00:00
|
|
|
General.Map.AcceptMode();
|
2008-05-16 10:55:25 +00:00
|
|
|
}
|
|
|
|
|
2008-05-15 19:31:11 +00:00
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|