Changed, Curve Linedefs mode: re-designed the mode UI. Alternative control options are now available (check Help tab while the mode is active).

Changed, Curve Linedefs mode: changed curve generation logic. Setting Distance to 0 will now divide selected linedefs into equal parts.
Changed, Curve Linedefs mode: curve vertices are now drawn.
Updated ZDoom_DECORATE.cfg.
This commit is contained in:
MaxED 2016-10-26 22:33:36 +00:00
parent a6351a9d69
commit 3e132f1cf2
17 changed files with 652 additions and 572 deletions

View file

@ -1418,6 +1418,7 @@ constants
PSPF_ADDBOB; PSPF_ADDBOB;
PSPF_POWDOUBLE; PSPF_POWDOUBLE;
PSPF_CVARFAST; PSPF_CVARFAST;
PSPF_FLIP;
//A_BFGSpray flags //A_BFGSpray flags
BFGF_MISSILEORIGIN; BFGF_MISSILEORIGIN;
BFGF_HURTSOURCE; BFGF_HURTSOURCE;

View file

@ -12,6 +12,7 @@ namespace CodeImp.DoomBuilder.Controls
public decimal Value { get { return nud.Value; } set { nud.Value = value; } } public decimal Value { get { return nud.Value; } set { nud.Value = value; } }
public decimal Minimum { get { return nud.Minimum; } set { nud.Minimum = value; } } public decimal Minimum { get { return nud.Minimum; } set { nud.Minimum = value; } }
public decimal Maximum { get { return nud.Maximum; } set { nud.Maximum = value; } } public decimal Maximum { get { return nud.Maximum; } set { nud.Maximum = value; } }
public decimal Increment { get { return nud.Increment; } set { nud.Increment = value; } }
private NumericUpDown nud; private NumericUpDown nud;

View file

@ -70,6 +70,7 @@ namespace CodeImp.DoomBuilder.Editing
// Selection // Selection
protected bool selecting; protected bool selecting;
protected bool selectpressed; //mxd protected bool selectpressed; //mxd
protected bool editpressed; //mxd
protected Vector2D selectstart; protected Vector2D selectstart;
protected RectangleF selectionrect; protected RectangleF selectionrect;
protected MarqueSelectionMode marqueSelectionMode; //mxd protected MarqueSelectionMode marqueSelectionMode; //mxd
@ -761,6 +762,7 @@ namespace CodeImp.DoomBuilder.Editing
[BeginAction("classicedit", BaseAction = true)] [BeginAction("classicedit", BaseAction = true)]
protected virtual void OnEditBegin() protected virtual void OnEditBegin()
{ {
editpressed = true; //mxd
} }
/// <summary> /// <summary>
@ -770,6 +772,7 @@ namespace CodeImp.DoomBuilder.Editing
[EndAction("classicedit", BaseAction = true)] [EndAction("classicedit", BaseAction = true)]
protected virtual void OnEditEnd() protected virtual void OnEditEnd()
{ {
editpressed = false; //mxd
} }
/// <summary> /// <summary>

View file

@ -97,12 +97,6 @@
<Compile Include="General\Association.cs" /> <Compile Include="General\Association.cs" />
<Compile Include="General\BuilderPlug.cs" /> <Compile Include="General\BuilderPlug.cs" />
<Compile Include="General\CopyStructures.cs" /> <Compile Include="General\CopyStructures.cs" />
<Compile Include="Interface\CurveLinedefsForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Interface\CurveLinedefsForm.Designer.cs">
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
</Compile>
<Compile Include="Interface\ErrorCheckForm.cs"> <Compile Include="Interface\ErrorCheckForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -163,10 +157,6 @@
<EmbeddedResource Include="Resources\SectorsMode.png" /> <EmbeddedResource Include="Resources\SectorsMode.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Interface\CurveLinedefsForm.resx">
<SubType>Designer</SubType>
<DependentUpon>CurveLinedefsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Interface\MenusForm.resx"> <EmbeddedResource Include="Interface\MenusForm.resx">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<DependentUpon>MenusForm.cs</DependentUpon> <DependentUpon>MenusForm.cs</DependentUpon>
@ -328,6 +318,12 @@
<Compile Include="Interface\BridgeModeForm.Designer.cs"> <Compile Include="Interface\BridgeModeForm.Designer.cs">
<DependentUpon>BridgeModeForm.cs</DependentUpon> <DependentUpon>BridgeModeForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Interface\CurveLinedefsOptionsPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Interface\CurveLinedefsOptionsPanel.Designer.cs">
<DependentUpon>CurveLinedefsOptionsPanel.cs</DependentUpon>
</Compile>
<Compile Include="Interface\DrawCurveOptionsPanel.cs"> <Compile Include="Interface\DrawCurveOptionsPanel.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
@ -549,6 +545,9 @@
<EmbeddedResource Include="Resources\DrawGeometryMode.png" /> <EmbeddedResource Include="Resources\DrawGeometryMode.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Interface\CurveLinedefsOptionsPanel.resx">
<DependentUpon>CurveLinedefsOptionsPanel.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Interface\DrawLineOptionsPanel.resx"> <EmbeddedResource Include="Interface\DrawLineOptionsPanel.resx">
<DependentUpon>DrawLineOptionsPanel.cs</DependentUpon> <DependentUpon>DrawLineOptionsPanel.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@ -626,6 +625,12 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\SoundRadius.png" /> <None Include="Resources\SoundRadius.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\Check.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Close.png" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -18,7 +18,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using CodeImp.DoomBuilder.Actions;
using CodeImp.DoomBuilder.BuilderModes.Interface;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
@ -35,6 +38,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
#region ================== Constants #region ================== Constants
internal const int DEFAULT_VERTICES_COUNT = 8; //mxd
internal const int DEFAULT_DISTANCE = 128; //mxd
internal const int DEFAULT_ANGLE = 180; //mxd
private const float LINE_THICKNESS = 0.6f; private const float LINE_THICKNESS = 0.6f;
#endregion #endregion
@ -44,6 +50,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Collections // Collections
private ICollection<Linedef> selectedlines; private ICollection<Linedef> selectedlines;
private ICollection<Linedef> unselectedlines; private ICollection<Linedef> unselectedlines;
private Dictionary<Linedef, List<Vector2D>> curves; //mxd
//mxd. UI and controls
private CurveLinedefsOptionsPanel panel;
private Linedef closestline;
private Vector2D mousedownoffset;
private int prevoffset;
#endregion #endregion
@ -57,43 +70,58 @@ namespace CodeImp.DoomBuilder.BuilderModes
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public CurveLinedefsMode(EditMode basemode) public CurveLinedefsMode()
{ {
// Make collections by selection // Make collections by selection
selectedlines = General.Map.Map.GetSelectedLinedefs(true); selectedlines = General.Map.Map.GetSelectedLinedefs(true);
unselectedlines = General.Map.Map.GetSelectedLinedefs(false); unselectedlines = General.Map.Map.GetSelectedLinedefs(false);
} curves = new Dictionary<Linedef, List<Vector2D>>(selectedlines.Count); //mxd
// Disposer //mxd. UI
public override void Dispose() panel = new CurveLinedefsOptionsPanel();
{
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Done
base.Dispose();
}
} }
#endregion #endregion
#region ================== Methods #region ================== Methods
// This generates the vertices to split the line with, from start to end //mxd
private static List<Vector2D> GenerateCurve(Linedef line) private void GenerateCurves()
{ {
// Fetch settings from window foreach(Linedef ld in selectedlines) curves[ld] = GenerateCurve(ld);
int vertices = BuilderPlug.Me.CurveLinedefsForm.Vertices; }
float distance = BuilderPlug.Me.CurveLinedefsForm.Distance;
float angle = BuilderPlug.Me.CurveLinedefsForm.Angle; // This generates the vertices to split the line with, from start to end
bool fixedcurve = BuilderPlug.Me.CurveLinedefsForm.FixedCurve; private List<Vector2D> GenerateCurve(Linedef line)
bool backwards = BuilderPlug.Me.CurveLinedefsForm.Backwards; {
// Fetch settings from the panel
bool fixedcurve = panel.FixedCurve;
int vertices = Math.Min(panel.Vertices, (int)Math.Ceiling(line.Length / 4));
int distance = panel.Distance;
int angle = (!fixedcurve && distance == 0 ? Math.Max(5, panel.Angle) : panel.Angle);
float theta = Angle2D.DegToRad(angle);
if(distance < 0) theta = -theta; //mxd
// Make list // Make list
List<Vector2D> points = new List<Vector2D>(vertices); List<Vector2D> points = new List<Vector2D>(vertices);
float segDelta = 1.0f / (vertices + 1); //mxd
Vector2D linecenter = line.GetCenterPoint(); //mxd
//mxd. Special cases...
if(theta == 0.0f)
{
for(int v = 1; v <= vertices; v++)
{
float x = (line.Length * segDelta) * (vertices - v + 1) - line.Length * 0.5f; // Line segment coord
// Rotate and transform to fit original line
Vector2D vertex = new Vector2D(x, 0).GetRotated(line.Angle + Angle2D.PIHALF) + linecenter;
points.Add(vertex);
}
}
else
{
//Added by Anders Åstrand 2008-05-18 //Added by Anders Åstrand 2008-05-18
//The formulas used are taken from http://mathworld.wolfram.com/CircularSegment.html //The formulas used are taken from http://mathworld.wolfram.com/CircularSegment.html
//c and theta are known (length of line and angle parameter). d, R and h are //c and theta are known (length of line and angle parameter). d, R and h are
@ -106,14 +134,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
//calculate some identities of a circle segment (refer to the graph in the url above) //calculate some identities of a circle segment (refer to the graph in the url above)
float c = line.Length; float c = line.Length;
float theta = angle;
float d = (c / (float)Math.Tan(theta / 2)) / 2; float d = (c / (float)Math.Tan(theta / 2)) / 2;
float R = d / (float)Math.Cos(theta / 2); float R = d / (float)Math.Cos(theta / 2);
float h = R - d; float h = R - d;
float yDeform = fixedcurve ? 1 : distance / h; float yDeform = (fixedcurve ? 1 : distance / h);
if(backwards) yDeform = -yDeform; float xDelta = Math.Min(1, yDeform); //mxd
for(int v = 1; v <= vertices; v++) for(int v = 1; v <= vertices; v++)
{ {
@ -125,16 +152,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
//calculate the coordinates of the point, and distort the y coordinate //calculate the coordinates of the point, and distort the y coordinate
//using the deform factor calculated above //using the deform factor calculated above
float x = (float)Math.Cos(a) * R; float xr = (float)Math.Cos(a) * R; //mxd. Circle segment coord
float xl = (line.Length * segDelta) * (vertices - v + 1) - line.Length * 0.5f; // mxd. Line segment coord
float x = InterpolationTools.Linear(xl, xr, xDelta); //mxd
float y = ((float)Math.Sin(a) * R - d) * yDeform; float y = ((float)Math.Sin(a) * R - d) * yDeform;
//rotate and transform to fit original line //rotate and transform to fit original line
Vector2D vertex = new Vector2D(x, y).GetRotated(line.Angle + Angle2D.PIHALF); Vector2D vertex = new Vector2D(x, y).GetRotated(line.Angle + Angle2D.PIHALF) + linecenter;
vertex = vertex.GetTransformed(line.GetCenterPoint().x, line.GetCenterPoint().y, 1, 1);
points.Add(vertex); points.Add(vertex);
} }
}
// Done // Done
return points; return points;
@ -142,6 +169,42 @@ namespace CodeImp.DoomBuilder.BuilderModes
#endregion #endregion
#region ================== Settings panel (mxd)
private void AddInterface()
{
panel = new CurveLinedefsOptionsPanel();
int vertices = General.Settings.ReadPluginSetting("curvelinedefsmode.vertices", DEFAULT_VERTICES_COUNT);
int distance = General.Settings.ReadPluginSetting("curvelinedefsmode.distance", DEFAULT_DISTANCE);
int angle = General.Settings.ReadPluginSetting("curvelinedefsmode.angle", DEFAULT_ANGLE);
bool fixedcurve = General.Settings.ReadPluginSetting("curvelinedefsmode.fixedcurve", false);
panel.SetValues(vertices, distance, angle, fixedcurve);
panel.Register();
panel.OnValueChanged += OnValuesChanged;
}
private void RemoveInterface()
{
panel.OnValueChanged -= OnValuesChanged;
General.Settings.WritePluginSetting("curvelinedefsmode.vertices", panel.Vertices);
General.Settings.WritePluginSetting("curvelinedefsmode.distance", panel.Distance);
General.Settings.WritePluginSetting("curvelinedefsmode.angle", panel.Angle);
General.Settings.WritePluginSetting("curvelinedefsmode.fixedcurve", panel.FixedCurve);
panel.Unregister();
}
private void OnValuesChanged(object sender, EventArgs e)
{
// Update curves
GenerateCurves();
// Redraw display
General.Interface.RedrawDisplay();
}
#endregion
#region ================== Events #region ================== Events
public override void OnHelp() public override void OnHelp()
@ -165,8 +228,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnEngage(); base.OnEngage();
renderer.SetPresentation(Presentation.Standard); renderer.SetPresentation(Presentation.Standard);
// Show toolbox window //mxd
BuilderPlug.Me.CurveLinedefsForm.Show((Form)General.Interface); AddInterface();
GenerateCurves();
} }
// Disenagaging // Disenagaging
@ -175,20 +239,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
base.OnDisengage(); base.OnDisengage();
// Hide toolbox window // Hide toolbox window
BuilderPlug.Me.CurveLinedefsForm.Hide(); RemoveInterface();
} }
// This applies the curves and returns to the base mode // This applies the curves and returns to the base mode
public override void OnAccept() public override void OnAccept()
{ {
// Create undo // Create undo
General.Map.UndoRedo.CreateUndo("Curve linedefs"); string rest = (selectedlines.Count == 1 ? "a linedef" : selectedlines.Count + " linedefs"); //mxd
General.Map.UndoRedo.CreateUndo("Curve " + rest);
// Go for all selected lines // Go for all selected lines
foreach(Linedef ld in selectedlines) foreach(Linedef ld in selectedlines)
{ {
// Make curve for line // Make curve for line
List<Vector2D> points = GenerateCurve(ld); List<Vector2D> points = curves[ld];
if(points.Count > 0) if(points.Count > 0)
{ {
// TODO: We may want some sector create/join code in here // TODO: We may want some sector create/join code in here
@ -196,10 +261,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Go for all points to split the line // Go for all points to split the line
Linedef splitline = ld; Linedef splitline = ld;
for(int i = 0; i < points.Count; i++) foreach(Vector2D p in points)
{ {
// Make vertex // Make vertex
Vertex v = General.Map.Map.CreateVertex(points[i]); Vertex v = General.Map.Map.CreateVertex(p);
if(v == null) if(v == null)
{ {
General.Map.UndoRedo.WithdrawUndo(); General.Map.UndoRedo.WithdrawUndo();
@ -252,10 +317,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(renderer.StartOverlay(true)) if(renderer.StartOverlay(true))
{ {
// Go for all selected lines // Go for all selected lines
float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale; //mxd
foreach(Linedef ld in selectedlines) foreach(Linedef ld in selectedlines)
{ {
// Make curve for line // Make curve for line
List<Vector2D> points = GenerateCurve(ld); List<Vector2D> points = curves[ld];
if(points.Count > 0) if(points.Count > 0)
{ {
Vector2D p1 = ld.Start.Position; Vector2D p1 = ld.Start.Position;
@ -272,6 +338,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Draw last line // Draw last line
renderer.RenderLine(p2, ld.End.Position, LINE_THICKNESS, General.Colors.Highlight, true); renderer.RenderLine(p2, ld.End.Position, LINE_THICKNESS, General.Colors.Highlight, true);
//mxd. Draw verts
foreach(Vector2D p in points)
renderer.RenderRectangleFilled(new RectangleF(p.x - vsize, p.y - vsize, vsize * 2.0f, vsize * 2.0f), General.Colors.Selection, true);
} }
} }
renderer.Finish(); renderer.Finish();
@ -280,6 +350,82 @@ namespace CodeImp.DoomBuilder.BuilderModes
renderer.Present(); renderer.Present();
} }
//mxd
public override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
closestline = MapSet.NearestLinedef(selectedlines, mousedownmappos);
// Store offset between intial mouse position and curve top
Vector2D perpendicular = closestline.Line.GetPerpendicular().GetNormal();
if(panel.Distance != 0) perpendicular *= panel.Distance; // Special cases...
Vector2D curvetop = closestline.GetCenterPoint() - perpendicular;
mousedownoffset = mousedownmappos - curvetop;
}
//mxd
public override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseUp(e);
closestline = null;
prevoffset = 0;
}
//mxd
public override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
// Anything to do?
if((!selectpressed && !editpressed) || closestline == null) return;
// Do something...
Vector2D perpendicular = closestline.Line.GetPerpendicular().GetNormal();
if(panel.Distance != 0) perpendicular *= panel.Distance; // Special cases...
Vector2D center = closestline.GetCenterPoint();
Line2D radius = new Line2D(center, center - perpendicular);
float u = radius.GetNearestOnLine(mousemappos - mousedownoffset);
int dist = (panel.Distance == 0 ? 1 : panel.Distance); // Special cases...
int offset = (int)Math.Round(dist * u - dist);
// Change distance
if(selectpressed)
{
if(float.IsNaN(u)) panel.Distance = 0; // Special cases...
else panel.Distance += offset;
}
// Change angle
else if(editpressed && prevoffset != 0)
{
int diff = (int)Math.Round((offset - prevoffset) * renderer.Scale);
if(panel.Angle + diff > 0) panel.Angle += diff;
}
prevoffset = offset;
}
#endregion
#region ================== Actions (mxd)
[BeginAction("increasesubdivlevel")]
private void IncreaseSubdivLevel() { panel.Vertices += 1; }
[BeginAction("decreasesubdivlevel")]
private void DecreaseSubdivLevel() { panel.Vertices -= 1; }
[BeginAction("increasebevel")]
private void IncreaseBevel() { panel.Distance += panel.DistanceIncrement; }
[BeginAction("decreasebevel")]
private void DecreaseBevel() { panel.Distance -= panel.DistanceIncrement; }
[BeginAction("rotateclockwise")]
private void IncreaseAngle() { panel.Angle += panel.AngleIncrement; }
[BeginAction("rotatecounterclockwise")]
private void DecreaseAngle() { panel.Angle -= panel.AngleIncrement; }
#endregion #endregion
} }
} }

View file

@ -1563,7 +1563,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(selected.Count > 0) if(selected.Count > 0)
{ {
// Go into curve linedefs mode // Go into curve linedefs mode
General.Editing.ChangeMode(new CurveLinedefsMode(new LinedefsMode())); General.Editing.ChangeMode(new CurveLinedefsMode());
} }
} }

View file

@ -85,7 +85,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Main objects // Main objects
private MenusForm menusform; private MenusForm menusform;
private CurveLinedefsForm curvelinedefsform;
private FindReplaceForm findreplaceform; private FindReplaceForm findreplaceform;
private ErrorCheckForm errorcheckform; private ErrorCheckForm errorcheckform;
private PreferencesForm preferencesform; private PreferencesForm preferencesform;
@ -143,7 +142,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } } public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } }
public MenusForm MenusForm { get { return menusform; } } public MenusForm MenusForm { get { return menusform; } }
public CurveLinedefsForm CurveLinedefsForm { get { return curvelinedefsform ?? (curvelinedefsform = new CurveLinedefsForm()); } }
public FindReplaceForm FindReplaceForm { get { return findreplaceform ?? (findreplaceform = new FindReplaceForm()); } } public FindReplaceForm FindReplaceForm { get { return findreplaceform ?? (findreplaceform = new FindReplaceForm()); } }
public ErrorCheckForm ErrorCheckForm { get { return errorcheckform ?? (errorcheckform = new ErrorCheckForm()); } } public ErrorCheckForm ErrorCheckForm { get { return errorcheckform ?? (errorcheckform = new ErrorCheckForm()); } }
public PreferencesForm PreferencesForm { get { return preferencesform; } } public PreferencesForm PreferencesForm { get { return preferencesform; } }
@ -243,11 +241,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
menusform = null; menusform = null;
//mxd. These are created on demand, so they may be nulls. //mxd. These are created on demand, so they may be nulls.
if(curvelinedefsform != null)
{
curvelinedefsform.Dispose();
curvelinedefsform = null;
}
if(findreplaceform != null) if(findreplaceform != null)
{ {
findreplaceform.Dispose(); findreplaceform.Dispose();

View file

@ -1,255 +0,0 @@
using CodeImp.DoomBuilder.Windows;
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.Controls.NumericTextbox();
this.distance = new CodeImp.DoomBuilder.Controls.NumericTextbox();
this.angle = new CodeImp.DoomBuilder.Controls.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(24, 15);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(48, 13);
label1.TabIndex = 0;
label1.Text = "Vertices:";
//
// distancelabel
//
this.distancelabel.AutoSize = true;
this.distancelabel.Location = new System.Drawing.Point(20, 47);
this.distancelabel.Name = "distancelabel";
this.distancelabel.Size = new System.Drawing.Size(52, 13);
this.distancelabel.TabIndex = 1;
this.distancelabel.Text = "Distance:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(35, 79);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(37, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Angle:";
//
// vertices
//
this.vertices.AllowDecimal = false;
this.vertices.AllowNegative = false;
this.vertices.AllowRelative = false;
this.vertices.ForeColor = System.Drawing.SystemColors.WindowText;
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 = 0;
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.AllowDecimal = false;
this.distance.AllowNegative = false;
this.distance.AllowRelative = false;
this.distance.ForeColor = System.Drawing.SystemColors.WindowText;
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 = 2;
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.AllowDecimal = false;
this.angle.AllowNegative = false;
this.angle.AllowRelative = false;
this.angle.ForeColor = System.Drawing.SystemColors.WindowText;
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 = 4;
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.LargeChange = 1;
this.verticesbar.Location = new System.Drawing.Point(125, 10);
this.verticesbar.Maximum = -1;
this.verticesbar.Minimum = -200;
this.verticesbar.Name = "verticesbar";
this.verticesbar.Size = new System.Drawing.Size(19, 24);
this.verticesbar.TabIndex = 1;
this.verticesbar.Value = -8;
this.verticesbar.ValueChanged += new System.EventHandler(this.verticesbar_ValueChanged);
//
// distancebar
//
this.distancebar.LargeChange = 8;
this.distancebar.Location = new System.Drawing.Point(125, 42);
this.distancebar.Maximum = 0;
this.distancebar.Minimum = -10000;
this.distancebar.Name = "distancebar";
this.distancebar.Size = new System.Drawing.Size(19, 24);
this.distancebar.SmallChange = 8;
this.distancebar.TabIndex = 3;
this.distancebar.Value = -128;
this.distancebar.ValueChanged += new System.EventHandler(this.distancebar_ValueChanged);
//
// anglebar
//
this.anglebar.LargeChange = 5;
this.anglebar.Location = new System.Drawing.Point(125, 74);
this.anglebar.Maximum = 0;
this.anglebar.Minimum = -180;
this.anglebar.Name = "anglebar";
this.anglebar.Size = new System.Drawing.Size(19, 24);
this.anglebar.SmallChange = 5;
this.anglebar.TabIndex = 5;
this.anglebar.Value = -180;
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 = 9;
this.cancel.Text = "Cancel";
this.cancel.UseVisualStyleBackColor = true;
this.cancel.Click += new System.EventHandler(this.cancel_Click);
//
// 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 = 8;
this.apply.Text = "OK";
this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click);
//
// 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(118, 17);
this.circular.TabIndex = 6;
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(109, 17);
this.backwards.TabIndex = 7;
this.backwards.Text = "Curve backwards";
this.backwards.UseVisualStyleBackColor = true;
this.backwards.CheckedChanged += new System.EventHandler(this.backwards_CheckedChanged);
//
// CurveLinedefsForm
//
this.AcceptButton = this.apply;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
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.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.CurveLinedefsForm_HelpRequested);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label3;
private CodeImp.DoomBuilder.Controls.NumericTextbox vertices;
private CodeImp.DoomBuilder.Controls.NumericTextbox distance;
private CodeImp.DoomBuilder.Controls.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;
}
}

View file

@ -1,203 +0,0 @@
#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.Windows.Forms;
using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.Geometry;
using System.Drawing;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
public partial class CurveLinedefsForm : DelayedForm
{
#region ================== Constants
private const int MIN_VERTICES = 1;
private const int MAX_VERTICES = 200;
private const int MIN_DISTANCE = 0;
private const int MAX_DISTANCE = 10000;
private const int MIN_ANGLE = 1;
private const int MAX_ANGLE = 350;
#endregion
#region ================== Properties
public int Vertices { get { return -verticesbar.Value; } }
public float Distance { get { return -distancebar.Value; } }
public float Angle { get { return Angle2D.DegToRad(-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();
// Set negative properties for stupid
// scrollbars that work the other way around
verticesbar.Maximum = -MIN_VERTICES;
verticesbar.Minimum = -MAX_VERTICES;
distancebar.Maximum = -MIN_DISTANCE;
distancebar.Minimum = -MAX_DISTANCE;
anglebar.Maximum = -MIN_ANGLE;
anglebar.Minimum = -MAX_ANGLE;
}
#endregion
#region ================== Interface
// Window closing
private void CurveLinedefsForm_FormClosing(object sender, FormClosingEventArgs e)
{
// User closing the window?
if(e.CloseReason == CloseReason.UserClosing)
{
// Just cancel
General.Editing.CancelMode();
e.Cancel = true;
}
}
// This shows the window
public void Show(Form owner)
{
// First time showing?
//if((this.Location.X == 0) && (this.Location.Y == 0))
{
// Position at left-top of owner
this.Location = new Point(owner.Location.X + 20, owner.Location.Y + 90);
}
// Show window
base.Show(owner);
}
// Vertices bar changed
private void verticesbar_ValueChanged(object sender, EventArgs e)
{
int v = -verticesbar.Value;
vertices.Text = v.ToString();
General.Interface.RedrawDisplay();
}
// Vertices loses focus
private void vertices_Leave(object sender, EventArgs e)
{
int v = -verticesbar.Value;
vertices.Text = v.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)
{
int v = -distancebar.Value;
distance.Text = v.ToString();
General.Interface.RedrawDisplay();
}
// Distance loses focus
private void distance_Leave(object sender, EventArgs e)
{
int v = -distancebar.Value;
distance.Text = v.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)
{
int v = -anglebar.Value;
angle.Text = v.ToString();
General.Interface.RedrawDisplay();
}
// Angle loses focus
private void angle_Leave(object sender, EventArgs e)
{
int v = -anglebar.Value;
angle.Text = v.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();
}
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
// Cancel now
General.Editing.CancelMode();
}
// Apply clicked
private void apply_Click(object sender, EventArgs e)
{
// Apply now
General.Editing.AcceptMode();
}
private void CurveLinedefsForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{
General.ShowHelp("e_curvelinedefs.html");
}
#endregion
}
}

View file

@ -0,0 +1,256 @@
namespace CodeImp.DoomBuilder.BuilderModes.Interface
{
partial class CurveLinedefsOptionsPanel
{
/// <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 Component 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()
{
this.toolstrip = new System.Windows.Forms.ToolStrip();
this.vertslabel = new System.Windows.Forms.ToolStripLabel();
this.verts = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.distancelabel = new System.Windows.Forms.ToolStripLabel();
this.distance = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.anglelabel = new System.Windows.Forms.ToolStripLabel();
this.angle = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
this.separator1 = new System.Windows.Forms.ToolStripSeparator();
this.fixedcurve = new System.Windows.Forms.ToolStripButton();
this.separator2 = new System.Windows.Forms.ToolStripSeparator();
this.apply = new System.Windows.Forms.ToolStripButton();
this.cancel = new System.Windows.Forms.ToolStripButton();
this.reset = new System.Windows.Forms.ToolStripButton();
this.toolstrip.SuspendLayout();
this.SuspendLayout();
//
// toolstrip
//
this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.vertslabel,
this.verts,
this.distancelabel,
this.distance,
this.anglelabel,
this.angle,
this.reset,
this.separator1,
this.fixedcurve,
this.separator2,
this.apply,
this.cancel});
this.toolstrip.Location = new System.Drawing.Point(0, 0);
this.toolstrip.Name = "toolstrip";
this.toolstrip.Size = new System.Drawing.Size(620, 25);
this.toolstrip.TabIndex = 0;
this.toolstrip.Text = "toolStrip1";
//
// vertslabel
//
this.vertslabel.Name = "vertslabel";
this.vertslabel.Size = new System.Drawing.Size(54, 22);
this.vertslabel.Text = "Vertices: ";
//
// verts
//
this.verts.AutoSize = false;
this.verts.Increment = new decimal(new int[] {
1,
0,
0,
0});
this.verts.Margin = new System.Windows.Forms.Padding(3, 0, 6, 0);
this.verts.Maximum = new decimal(new int[] {
200,
0,
0,
0});
this.verts.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.verts.Name = "verts";
this.verts.Size = new System.Drawing.Size(56, 22);
this.verts.Text = "8";
this.verts.Value = new decimal(new int[] {
8,
0,
0,
0});
this.verts.ValueChanged += new System.EventHandler(this.OnUIValuesChanged);
//
// distancelabel
//
this.distancelabel.Name = "distancelabel";
this.distancelabel.Size = new System.Drawing.Size(55, 22);
this.distancelabel.Text = "Distance:";
//
// distance
//
this.distance.AutoSize = false;
this.distance.Increment = new decimal(new int[] {
8,
0,
0,
0});
this.distance.Margin = new System.Windows.Forms.Padding(3, 0, 6, 0);
this.distance.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.distance.Minimum = new decimal(new int[] {
10000,
0,
0,
-2147483648});
this.distance.Name = "distance";
this.distance.Size = new System.Drawing.Size(56, 25);
this.distance.Text = "128";
this.distance.Value = new decimal(new int[] {
128,
0,
0,
0});
this.distance.ValueChanged += new System.EventHandler(this.OnUIValuesChanged);
//
// anglelabel
//
this.anglelabel.Name = "anglelabel";
this.anglelabel.Size = new System.Drawing.Size(41, 22);
this.anglelabel.Text = "Angle:";
//
// angle
//
this.angle.AutoSize = false;
this.angle.Increment = new decimal(new int[] {
8,
0,
0,
0});
this.angle.Margin = new System.Windows.Forms.Padding(3, 0, 6, 0);
this.angle.Maximum = new decimal(new int[] {
350,
0,
0,
0});
this.angle.Minimum = new decimal(new int[] {
0,
0,
0,
0});
this.angle.Name = "angle";
this.angle.Size = new System.Drawing.Size(56, 22);
this.angle.Text = "180";
this.angle.Value = new decimal(new int[] {
180,
0,
0,
0});
this.angle.ValueChanged += new System.EventHandler(this.OnUIValuesChanged);
//
// separator1
//
this.separator1.Name = "separator1";
this.separator1.Size = new System.Drawing.Size(6, 25);
//
// fixedcurve
//
this.fixedcurve.CheckOnClick = true;
this.fixedcurve.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.DrawCurveMode;
this.fixedcurve.ImageTransparentColor = System.Drawing.Color.Magenta;
this.fixedcurve.Margin = new System.Windows.Forms.Padding(3, 1, 3, 2);
this.fixedcurve.Name = "fixedcurve";
this.fixedcurve.Size = new System.Drawing.Size(128, 22);
this.fixedcurve.Text = "Fixed circular curve";
this.fixedcurve.CheckedChanged += new System.EventHandler(this.fixedcurve_CheckedChanged);
//
// separator2
//
this.separator2.Name = "separator2";
this.separator2.Size = new System.Drawing.Size(6, 25);
//
// apply
//
this.apply.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.apply.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Check;
this.apply.ImageTransparentColor = System.Drawing.Color.Magenta;
this.apply.Margin = new System.Windows.Forms.Padding(6, 1, 0, 2);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(23, 22);
this.apply.Text = "Apply";
this.apply.Click += new System.EventHandler(this.apply_Click);
//
// cancel
//
this.cancel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.cancel.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Close;
this.cancel.ImageTransparentColor = System.Drawing.Color.Magenta;
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(23, 22);
this.cancel.Text = "Cancel";
this.cancel.Click += new System.EventHandler(this.cancel_Click);
//
// reset
//
this.reset.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.reset.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.Reset;
this.reset.ImageTransparentColor = System.Drawing.Color.Magenta;
this.reset.Margin = new System.Windows.Forms.Padding(0, 1, 3, 2);
this.reset.Name = "reset";
this.reset.Size = new System.Drawing.Size(23, 22);
this.reset.Text = "Reset";
this.reset.Click += new System.EventHandler(this.reset_Click);
//
// CurveLinedefsOptionsPanel
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.toolstrip);
this.Name = "CurveLinedefsOptionsPanel";
this.Size = new System.Drawing.Size(620, 60);
this.toolstrip.ResumeLayout(false);
this.toolstrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolstrip;
private System.Windows.Forms.ToolStripLabel vertslabel;
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown verts;
private System.Windows.Forms.ToolStripLabel distancelabel;
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown distance;
private System.Windows.Forms.ToolStripLabel anglelabel;
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown angle;
private System.Windows.Forms.ToolStripSeparator separator1;
private System.Windows.Forms.ToolStripButton fixedcurve;
private System.Windows.Forms.ToolStripSeparator separator2;
private System.Windows.Forms.ToolStripButton apply;
private System.Windows.Forms.ToolStripButton cancel;
private System.Windows.Forms.ToolStripButton reset;
}
}

View file

@ -0,0 +1,127 @@
using System;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Geometry;
namespace CodeImp.DoomBuilder.BuilderModes.Interface
{
public partial class CurveLinedefsOptionsPanel : UserControl
{
#region ================== Event Handlers
public event EventHandler OnValueChanged;
#endregion
#region ================== Variables
private bool blockevents;
#endregion
#region ================== Properties
public int Vertices { get { return (int)verts.Value; } set { verts.Value = General.Clamp(value, (int)verts.Minimum, (int)verts.Maximum); } }
public int Distance { get { return (int)distance.Value; } set { distance.Value = General.Clamp(value, (int)distance.Minimum, (int)distance.Maximum); } }
public int DistanceIncrement { get { return (int)distance.Increment; } }
public int Angle { get { return (int)angle.Value; } set { angle.Value = (decimal)General.Clamp(value, (float)angle.Minimum, (float)angle.Maximum); } }
public int AngleIncrement { get { return (int)angle.Increment; } }
public bool FixedCurve { get { return fixedcurve.Checked; } }
#endregion
#region ================== Constructor
public CurveLinedefsOptionsPanel()
{
InitializeComponent();
}
#endregion
#region ================== Mathods
public void SetValues(int verts, int distance, int angle, bool fixedcurve)
{
blockevents = true;
this.verts.Value = verts;
this.distance.Value = distance;
this.angle.Value = angle;
this.fixedcurve.Checked = fixedcurve;
blockevents = false;
}
public void Register()
{
General.Interface.AddButton(vertslabel);
General.Interface.AddButton(verts);
General.Interface.AddButton(distancelabel);
General.Interface.AddButton(distance);
General.Interface.AddButton(anglelabel);
General.Interface.AddButton(angle);
General.Interface.AddButton(reset);
General.Interface.AddButton(separator1);
General.Interface.AddButton(fixedcurve);
General.Interface.AddButton(separator2);
General.Interface.AddButton(apply);
General.Interface.AddButton(cancel);
}
public void Unregister()
{
General.Interface.RemoveButton(cancel);
General.Interface.RemoveButton(apply);
General.Interface.RemoveButton(anglelabel);
General.Interface.RemoveButton(separator2);
General.Interface.RemoveButton(fixedcurve);
General.Interface.RemoveButton(separator1);
General.Interface.RemoveButton(reset);
General.Interface.RemoveButton(angle);
General.Interface.RemoveButton(anglelabel);
General.Interface.RemoveButton(distance);
General.Interface.RemoveButton(distancelabel);
General.Interface.RemoveButton(verts);
General.Interface.RemoveButton(vertslabel);
}
#endregion
#region ================== Events
private void apply_Click(object sender, EventArgs e)
{
// Apply now
General.Editing.AcceptMode();
}
private void cancel_Click(object sender, EventArgs e)
{
// Cancel now
General.Editing.CancelMode();
}
private void OnUIValuesChanged(object sender, EventArgs e)
{
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void fixedcurve_CheckedChanged(object sender, EventArgs e)
{
// Enable/disable controls
distance.Enabled = !fixedcurve.Checked;
distancelabel.Enabled = !fixedcurve.Checked;
if(!blockevents && OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
private void reset_Click(object sender, EventArgs e)
{
SetValues(CurveLinedefsMode.DEFAULT_VERTICES_COUNT, CurveLinedefsMode.DEFAULT_DISTANCE, CurveLinedefsMode.DEFAULT_ANGLE, false);
if(OnValueChanged != null) OnValueChanged(this, EventArgs.Empty);
}
#endregion
}
}

View file

@ -117,31 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="toolstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>False</value> <value>17, 17</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="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>
</root> </root>

View file

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.5466 // Runtime Version:2.0.50727.5485
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -95,6 +95,20 @@ namespace CodeImp.DoomBuilder.BuilderModes.Properties {
} }
} }
internal static System.Drawing.Bitmap Check {
get {
object obj = ResourceManager.GetObject("Check", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap Close {
get {
object obj = ResourceManager.GetObject("Close", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap ColorPick { internal static System.Drawing.Bitmap ColorPick {
get { get {
object obj = ResourceManager.GetObject("ColorPick", resourceCulture); object obj = ResourceManager.GetObject("ColorPick", resourceCulture);

View file

@ -205,12 +205,18 @@
<data name="Text" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Text" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Text.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="SoundRadius" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SoundRadius.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="BrightnessGradient" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="BrightnessGradient" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\BrightnessGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\BrightnessGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="FlipSelectionV" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="FlipSelectionV" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FlipSelectionV.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\FlipSelectionV.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Check.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Door" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Door" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Door.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Door.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@ -268,7 +274,7 @@
<data name="Show3" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Show3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Show3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Show3.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="SoundRadius" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\SoundRadius.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

View file

@ -212,6 +212,7 @@ group general
"Press <k>builder_classicselect</k> to place a vertex" "Press <k>builder_classicselect</k> to place a vertex"
"Use <k>buildermodes_increasebevel</k> and <k>buildermodes_decreasebevel</k> to change bevel by current grid size" "Use <k>buildermodes_increasebevel</k> and <k>buildermodes_decreasebevel</k> to change bevel by current grid size"
"Use <k>buildermodes_increasesubdivlevel</k> and <k>buildermodes_decreasesubdivlevel</k> to change the number of points in ellipse" "Use <k>buildermodes_increasesubdivlevel</k> and <k>buildermodes_decreasesubdivlevel</k> to change the number of points in ellipse"
"Use <k>buildermodes_rotateclockwise</k> and <k>buildermodes_rotatecounterclockwise</k> to rotate ellipse shape"
"Hold <b>Shift</b> to toggle grid snapping" "Hold <b>Shift</b> to toggle grid snapping"
"Hold <b>Ctrl</b> to toggle snapping to nearest vertex" "Hold <b>Ctrl</b> to toggle snapping to nearest vertex"
"Hold <b>Alt - Shift</b> to snap to 4 cardinal directions" "Hold <b>Alt - Shift</b> to snap to 4 cardinal directions"
@ -234,3 +235,12 @@ group gridlockhelp
"Hold <b>Alt - Shift</b> to snap to 4 cardinal directions" "Hold <b>Alt - Shift</b> to snap to 4 cardinal directions"
"Place second vertex to finish drawing" "Place second vertex to finish drawing"
"Press <k>builder_cancelmode</k> or <k>builder_classicedit</k> to cancel" "Press <k>builder_cancelmode</k> or <k>builder_classicedit</k> to cancel"
class CurveLinedefsMode
group general
"<b>LMB-drag</b> or use <k>buildermodes_increasebevel</k> and <k>buildermodes_decreasebevel</k> to change curve depth"
"<b>RMB-drag</b> or use <k>buildermodes_rotateclockwise</k> and <k>buildermodes_rotatecounterclockwise</k> to change curve bulginess"
"Use <k>buildermodes_increasesubdivlevel</k> and <k>buildermodes_decreasesubdivlevel</k> to change the number of points in the curve"
"Press <k>builder_acceptmode</k> to accept"
"Press <k>builder_cancelmode</k> or <k>builder_classicedit</k> to cancel"