mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
beginning of curve lines editing mode
This commit is contained in:
parent
4dd8877eba
commit
7416731833
10 changed files with 846 additions and 7 deletions
|
@ -33,11 +33,18 @@
|
|||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClassicModes\CurveLinedefsMode.cs" />
|
||||
<Compile Include="ClassicModes\DragLinedefsMode.cs" />
|
||||
<Compile Include="ClassicModes\DragSectorsMode.cs" />
|
||||
<Compile Include="ClassicModes\DragGeometryMode.cs" />
|
||||
<Compile Include="ClassicModes\DrawGeometryMode.cs" />
|
||||
<Compile Include="General\BuilderPlug.cs" />
|
||||
<Compile Include="Interface\CurveLinedefsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Interface\CurveLinedefsForm.Designer.cs">
|
||||
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Interface\MenusForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -69,13 +76,6 @@
|
|||
<Compile Include="ClassicModes\VerticesMode.cs" />
|
||||
<Compile Include="VisualModes\VisualUpper.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Builder.csproj">
|
||||
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
|
||||
<Name>Builder</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\Actions.cfg" />
|
||||
</ItemGroup>
|
||||
|
@ -99,12 +99,22 @@
|
|||
<EmbeddedResource Include="Resources\WAuthor.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Interface\CurveLinedefsForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Interface\MenusForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>MenusForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\VisualMode.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Builder.csproj">
|
||||
<Project>{818B3D10-F791-4C3F-9AF5-BB2D0079B63C}</Project>
|
||||
<Name>Builder</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
215
Source/BuilderModes/ClassicModes/CurveLinedefsMode.cs
Normal file
215
Source/BuilderModes/ClassicModes/CurveLinedefsMode.cs
Normal file
|
@ -0,0 +1,215 @@
|
|||
|
||||
#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
|
||||
{
|
||||
[EditMode(Volatile = true)]
|
||||
public sealed class CurveLinedefsMode : ClassicMode
|
||||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const float LINE_THICKNESS = 0.6f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
// Mode to return to
|
||||
private EditMode basemode;
|
||||
|
||||
// Collections
|
||||
private ICollection<Linedef> selectedlines;
|
||||
private ICollection<Linedef> unselectedlines;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Properties
|
||||
|
||||
// Just keep the base mode button checked
|
||||
public override string EditModeButtonName { get { return basemode.GetType().Name; } }
|
||||
|
||||
internal EditMode BaseMode { get { return basemode; } }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Constructor / Disposer
|
||||
|
||||
// Constructor
|
||||
public CurveLinedefsMode(EditMode basemode)
|
||||
{
|
||||
this.basemode = basemode;
|
||||
|
||||
// Make collections by selection
|
||||
selectedlines = General.Map.Map.GetSelectedLinedefs(true);
|
||||
unselectedlines = General.Map.Map.GetSelectedLinedefs(false);
|
||||
}
|
||||
|
||||
// Disposer
|
||||
public override void Dispose()
|
||||
{
|
||||
// Not already disposed?
|
||||
if(!isdisposed)
|
||||
{
|
||||
// Clean up
|
||||
|
||||
// Done
|
||||
base.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
// Cancelled
|
||||
public override void OnCancel()
|
||||
{
|
||||
// Cancel base class
|
||||
base.OnCancel();
|
||||
|
||||
// Return to vertices mode
|
||||
General.Map.ChangeMode(basemode);
|
||||
}
|
||||
|
||||
// Mode engages
|
||||
public override void OnEngage()
|
||||
{
|
||||
base.OnEngage();
|
||||
|
||||
// Show toolbox window
|
||||
BuilderPlug.Me.CurveLinedefsForm.Show(General.Interface);
|
||||
|
||||
// Keep focus on main window
|
||||
General.Interface.Focus();
|
||||
}
|
||||
|
||||
// Disenagaging
|
||||
public override void OnDisengage()
|
||||
{
|
||||
base.OnDisengage();
|
||||
|
||||
// Hide toolbox window
|
||||
BuilderPlug.Me.CurveLinedefsForm.Hide();
|
||||
|
||||
// Hide highlight info
|
||||
General.Interface.HideInfo();
|
||||
}
|
||||
|
||||
// This generates the vertices to split the line with, from start to end
|
||||
private List<Vector2D> GenerateCurve(Linedef line)
|
||||
{
|
||||
// Fetch settings from window
|
||||
int vertices = BuilderPlug.Me.CurveLinedefsForm.Vertices;
|
||||
float distance = BuilderPlug.Me.CurveLinedefsForm.Distance;
|
||||
float angle = BuilderPlug.Me.CurveLinedefsForm.Angle;
|
||||
bool fixedcurve = BuilderPlug.Me.CurveLinedefsForm.FixedCurve;
|
||||
bool backwards = BuilderPlug.Me.CurveLinedefsForm.Backwards;
|
||||
|
||||
// Make list
|
||||
List<Vector2D> points = new List<Vector2D>(vertices);
|
||||
|
||||
// Anders Astrand, this is where your code goes.
|
||||
// "line" is the original linedef to create a curve from
|
||||
// "vertices" is the number of points to generate evenly along
|
||||
// the curve (excluding line start and end)
|
||||
// "distance" is the curve distance from the line (same as in Doom Builder 1)
|
||||
// "angle" is the delta angle (same as in Doom Builder 1)
|
||||
// "fixedcurve" is true when the curve must be forced circular (same as in Doom Builder 1)
|
||||
// "backwards" is true, then the curve should go towards the back side of the line
|
||||
// otherwise the curve goes to the front side of the line (like Doom Builder 1 did)
|
||||
// Return value should be a list of Vector2D points
|
||||
|
||||
// TEST:
|
||||
points.Add(line.GetCenterPoint());
|
||||
|
||||
// Done
|
||||
return points;
|
||||
}
|
||||
|
||||
// Redrawing display
|
||||
public override void OnRedrawDisplay()
|
||||
{
|
||||
// Render lines
|
||||
if(renderer.StartPlotter(true))
|
||||
{
|
||||
renderer.PlotLinedefSet(unselectedlines);
|
||||
renderer.PlotVerticesSet(General.Map.Map.Vertices);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render things
|
||||
if(renderer.StartThings(true))
|
||||
{
|
||||
renderer.SetThingsRenderOrder(false);
|
||||
renderer.RenderThingSet(General.Map.Map.Things);
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
// Render overlay
|
||||
if(renderer.StartOverlay(true))
|
||||
{
|
||||
// Go for all selected lines
|
||||
foreach(Linedef ld in selectedlines)
|
||||
{
|
||||
// Make curve for line
|
||||
List<Vector2D> points = GenerateCurve(ld);
|
||||
if(points.Count > 0)
|
||||
{
|
||||
Vector2D p1 = ld.Start.Position;
|
||||
Vector2D p2 = points[0];
|
||||
for(int i = 1; i <= points.Count; i++)
|
||||
{
|
||||
// Draw the line
|
||||
renderer.RenderLine(p1, p2, LINE_THICKNESS, General.Colors.Highlight, true);
|
||||
|
||||
// Next points
|
||||
p1 = p2;
|
||||
if(i < points.Count) p2 = points[i];
|
||||
}
|
||||
|
||||
// Draw last line
|
||||
renderer.RenderLine(p2, ld.End.Position, LINE_THICKNESS, General.Colors.Highlight, true);
|
||||
}
|
||||
}
|
||||
renderer.Finish();
|
||||
}
|
||||
|
||||
renderer.Present();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -393,6 +393,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
#region ================== Actions
|
||||
|
||||
[BeginAction("curvelinesmode")]
|
||||
public void CurveLinedefs()
|
||||
{
|
||||
// No selected lines?
|
||||
ICollection<Linedef> selected = General.Map.Map.GetSelectedLinedefs(true);
|
||||
if(selected.Count == 0)
|
||||
{
|
||||
// Anything highlighted?
|
||||
if(highlighted != null)
|
||||
{
|
||||
// Select the highlighted item
|
||||
highlighted.Selected = true;
|
||||
selected.Add(highlighted);
|
||||
}
|
||||
}
|
||||
|
||||
// Any selected lines?
|
||||
if(selected.Count > 0)
|
||||
{
|
||||
// Go into curve linedefs mode
|
||||
General.Map.ChangeMode(new CurveLinedefsMode(new LinedefsMode()));
|
||||
}
|
||||
}
|
||||
|
||||
[BeginAction("fliplinedefs")]
|
||||
public void FlipLinedefs()
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Main objects
|
||||
private MenusForm menusform;
|
||||
private CurveLinedefsForm curvelinedefsform;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -58,6 +59,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public static BuilderPlug Me { get { return me; } }
|
||||
|
||||
public MenusForm MenusForm { get { return menusform; } }
|
||||
public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform; } }
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -72,6 +74,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Load menus form and register it
|
||||
menusform = new MenusForm();
|
||||
menusform.Register();
|
||||
|
||||
// Load curve linedefs form
|
||||
curvelinedefsform = new CurveLinedefsForm();
|
||||
}
|
||||
|
||||
// Disposer
|
||||
|
@ -83,6 +88,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Clean up
|
||||
menusform.Unregister();
|
||||
menusform.Dispose();
|
||||
menusform = null;
|
||||
curvelinedefsform.Dispose();
|
||||
curvelinedefsform = null;
|
||||
|
||||
// Done
|
||||
me = null;
|
||||
|
|
237
Source/BuilderModes/Interface/CurveLinedefsForm.Designer.cs
generated
Normal file
237
Source/BuilderModes/Interface/CurveLinedefsForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,237 @@
|
|||
using CodeImp.DoomBuilder.Interface;
|
||||
|
||||
namespace CodeImp.DoomBuilder.BuilderModes
|
||||
{
|
||||
partial class CurveLinedefsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if(disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.Label label1;
|
||||
this.distancelabel = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.vertices = new CodeImp.DoomBuilder.Interface.NumericTextbox();
|
||||
this.distance = new CodeImp.DoomBuilder.Interface.NumericTextbox();
|
||||
this.angle = new CodeImp.DoomBuilder.Interface.NumericTextbox();
|
||||
this.verticesbar = new System.Windows.Forms.VScrollBar();
|
||||
this.distancebar = new System.Windows.Forms.VScrollBar();
|
||||
this.anglebar = new System.Windows.Forms.VScrollBar();
|
||||
this.cancel = new System.Windows.Forms.Button();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
this.circular = new System.Windows.Forms.CheckBox();
|
||||
this.backwards = new System.Windows.Forms.CheckBox();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(12, 15);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(51, 14);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Vertices:";
|
||||
//
|
||||
// distancelabel
|
||||
//
|
||||
this.distancelabel.AutoSize = true;
|
||||
this.distancelabel.Location = new System.Drawing.Point(11, 47);
|
||||
this.distancelabel.Name = "distancelabel";
|
||||
this.distancelabel.Size = new System.Drawing.Size(52, 14);
|
||||
this.distancelabel.TabIndex = 1;
|
||||
this.distancelabel.Text = "Distance:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(25, 79);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(38, 14);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "Angle:";
|
||||
//
|
||||
// vertices
|
||||
//
|
||||
this.vertices.AllowNegative = false;
|
||||
this.vertices.AllowRelative = false;
|
||||
this.vertices.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.vertices.Location = new System.Drawing.Point(78, 12);
|
||||
this.vertices.Name = "vertices";
|
||||
this.vertices.Size = new System.Drawing.Size(45, 20);
|
||||
this.vertices.TabIndex = 3;
|
||||
this.vertices.Text = "8";
|
||||
this.vertices.TextChanged += new System.EventHandler(this.vertices_TextChanged);
|
||||
this.vertices.Leave += new System.EventHandler(this.vertices_Leave);
|
||||
//
|
||||
// distance
|
||||
//
|
||||
this.distance.AllowNegative = false;
|
||||
this.distance.AllowRelative = false;
|
||||
this.distance.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.distance.Location = new System.Drawing.Point(78, 44);
|
||||
this.distance.Name = "distance";
|
||||
this.distance.Size = new System.Drawing.Size(45, 20);
|
||||
this.distance.TabIndex = 4;
|
||||
this.distance.Text = "128";
|
||||
this.distance.TextChanged += new System.EventHandler(this.distance_TextChanged);
|
||||
this.distance.Leave += new System.EventHandler(this.distance_Leave);
|
||||
//
|
||||
// angle
|
||||
//
|
||||
this.angle.AllowNegative = false;
|
||||
this.angle.AllowRelative = false;
|
||||
this.angle.ImeMode = System.Windows.Forms.ImeMode.Off;
|
||||
this.angle.Location = new System.Drawing.Point(78, 76);
|
||||
this.angle.Name = "angle";
|
||||
this.angle.Size = new System.Drawing.Size(45, 20);
|
||||
this.angle.TabIndex = 5;
|
||||
this.angle.Text = "180";
|
||||
this.angle.TextChanged += new System.EventHandler(this.angle_TextChanged);
|
||||
this.angle.Leave += new System.EventHandler(this.angle_Leave);
|
||||
//
|
||||
// verticesbar
|
||||
//
|
||||
this.verticesbar.Location = new System.Drawing.Point(125, 10);
|
||||
this.verticesbar.Maximum = 200;
|
||||
this.verticesbar.Minimum = 1;
|
||||
this.verticesbar.Name = "verticesbar";
|
||||
this.verticesbar.Size = new System.Drawing.Size(19, 24);
|
||||
this.verticesbar.TabIndex = 6;
|
||||
this.verticesbar.Value = 1;
|
||||
this.verticesbar.ValueChanged += new System.EventHandler(this.verticesbar_ValueChanged);
|
||||
//
|
||||
// distancebar
|
||||
//
|
||||
this.distancebar.Location = new System.Drawing.Point(125, 42);
|
||||
this.distancebar.Maximum = 10000;
|
||||
this.distancebar.Name = "distancebar";
|
||||
this.distancebar.Size = new System.Drawing.Size(19, 24);
|
||||
this.distancebar.TabIndex = 7;
|
||||
this.distancebar.ValueChanged += new System.EventHandler(this.distancebar_ValueChanged);
|
||||
//
|
||||
// anglebar
|
||||
//
|
||||
this.anglebar.Location = new System.Drawing.Point(125, 74);
|
||||
this.anglebar.Maximum = 180;
|
||||
this.anglebar.Name = "anglebar";
|
||||
this.anglebar.Size = new System.Drawing.Size(19, 24);
|
||||
this.anglebar.TabIndex = 8;
|
||||
this.anglebar.ValueChanged += new System.EventHandler(this.anglebar_ValueChanged);
|
||||
//
|
||||
// cancel
|
||||
//
|
||||
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancel.Location = new System.Drawing.Point(84, 167);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(70, 25);
|
||||
this.cancel.TabIndex = 22;
|
||||
this.cancel.Text = "Cancel";
|
||||
this.cancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// apply
|
||||
//
|
||||
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.apply.Location = new System.Drawing.Point(7, 167);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(70, 25);
|
||||
this.apply.TabIndex = 21;
|
||||
this.apply.Text = "OK";
|
||||
this.apply.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// circular
|
||||
//
|
||||
this.circular.AutoSize = true;
|
||||
this.circular.Location = new System.Drawing.Point(22, 108);
|
||||
this.circular.Name = "circular";
|
||||
this.circular.Size = new System.Drawing.Size(122, 18);
|
||||
this.circular.TabIndex = 23;
|
||||
this.circular.Text = "Fixed circular curve";
|
||||
this.circular.UseVisualStyleBackColor = true;
|
||||
this.circular.CheckedChanged += new System.EventHandler(this.circular_CheckedChanged);
|
||||
//
|
||||
// backwards
|
||||
//
|
||||
this.backwards.AutoSize = true;
|
||||
this.backwards.Location = new System.Drawing.Point(22, 132);
|
||||
this.backwards.Name = "backwards";
|
||||
this.backwards.Size = new System.Drawing.Size(113, 18);
|
||||
this.backwards.TabIndex = 24;
|
||||
this.backwards.Text = "Curve backwards";
|
||||
this.backwards.UseVisualStyleBackColor = true;
|
||||
this.backwards.CheckedChanged += new System.EventHandler(this.backwards_CheckedChanged);
|
||||
//
|
||||
// CurveLinedefsForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(160, 199);
|
||||
this.Controls.Add(this.backwards);
|
||||
this.Controls.Add(this.circular);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
this.Controls.Add(this.anglebar);
|
||||
this.Controls.Add(this.distancebar);
|
||||
this.Controls.Add(this.verticesbar);
|
||||
this.Controls.Add(this.angle);
|
||||
this.Controls.Add(this.distance);
|
||||
this.Controls.Add(this.vertices);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.distancelabel);
|
||||
this.Controls.Add(label1);
|
||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CurveLinedefsForm";
|
||||
this.Opacity = 0;
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Curve Linedefs";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CurveLinedefsForm_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label3;
|
||||
private CodeImp.DoomBuilder.Interface.NumericTextbox vertices;
|
||||
private NumericTextbox distance;
|
||||
private NumericTextbox angle;
|
||||
private System.Windows.Forms.VScrollBar verticesbar;
|
||||
private System.Windows.Forms.VScrollBar distancebar;
|
||||
private System.Windows.Forms.VScrollBar anglebar;
|
||||
private System.Windows.Forms.Button cancel;
|
||||
private System.Windows.Forms.Button apply;
|
||||
private System.Windows.Forms.CheckBox circular;
|
||||
private System.Windows.Forms.Label distancelabel;
|
||||
private System.Windows.Forms.CheckBox backwards;
|
||||
}
|
||||
}
|
168
Source/BuilderModes/Interface/CurveLinedefsForm.cs
Normal file
168
Source/BuilderModes/Interface/CurveLinedefsForm.cs
Normal file
|
@ -0,0 +1,168 @@
|
|||
|
||||
#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
|
||||
{
|
||||
#region ================== Properties
|
||||
|
||||
public int Vertices { get { return verticesbar.Value; } }
|
||||
public float Distance { get { return (float)distancebar.Value; } }
|
||||
public float Angle { get { return (float)anglebar.Value; } }
|
||||
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)
|
||||
{
|
||||
// Just return to linedefs mode
|
||||
General.Map.ChangeMode(new LinedefsMode());
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Window is shown
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
// First time showing?
|
||||
if((this.Location.X == 0) && (this.Location.Y == 0))
|
||||
{
|
||||
// Position in left-top of owner
|
||||
this.Location = new Point(this.Owner.Location.X + 20, this.Owner.Location.Y + 80);
|
||||
}
|
||||
|
||||
// Continue
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
165
Source/BuilderModes/Interface/CurveLinedefsForm.resx
Normal file
165
Source/BuilderModes/Interface/CurveLinedefsForm.resx
Normal file
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="distancelabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="vertices.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="distance.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="angle.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="verticesbar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="distancebar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="anglebar.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="apply.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="circular.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="backwards.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -106,6 +106,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(mode is DragGeometryMode) mode = (mode as DragGeometryMode).BaseMode;
|
||||
if(mode is DragThingsMode) mode = (mode as DragThingsMode).BaseMode;
|
||||
if(mode is DrawGeometryMode) mode = (mode as DrawGeometryMode).BaseMode;
|
||||
if(mode is CurveLinedefsMode) mode = (mode as CurveLinedefsMode).BaseMode;
|
||||
|
||||
// Final decision
|
||||
if(mode is LinedefsMode) HideAllMenusExcept(linedefsmenu);
|
||||
|
|
|
@ -136,3 +136,12 @@ flipsidedefs
|
|||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
||||
curvelinesmode
|
||||
{
|
||||
title = "Lines: Curve Linedefs";
|
||||
description = "Curves the selected linedefs with a given number of vertices and distance from the line.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
}
|
||||
|
|
2
Source/Interface/PreferencesForm.Designer.cs
generated
2
Source/Interface/PreferencesForm.Designer.cs
generated
|
@ -669,7 +669,9 @@ namespace CodeImp.DoomBuilder.Interface
|
|||
//
|
||||
// PreferencesForm
|
||||
//
|
||||
this.AcceptButton = this.apply;
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.CancelButton = this.cancel;
|
||||
this.ClientSize = new System.Drawing.Size(619, 464);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
|
|
Loading…
Reference in a new issue