diff --git a/Build/Scripting/ZDoom_DECORATE.cfg b/Build/Scripting/ZDoom_DECORATE.cfg index 0896ce981d7b9a2cb5f0ba9aa11c7194bf679bcd..e89c8946c273f526f526437704d0fbaf2647e8ed 100644 --- a/Build/Scripting/ZDoom_DECORATE.cfg +++ b/Build/Scripting/ZDoom_DECORATE.cfg @@ -1418,6 +1418,7 @@ constants PSPF_ADDBOB; PSPF_POWDOUBLE; PSPF_CVARFAST; + PSPF_FLIP; //A_BFGSpray flags BFGF_MISSILEORIGIN; BFGF_HURTSOURCE; diff --git a/Source/Core/Controls/ToolStripNumericUpDown.cs b/Source/Core/Controls/ToolStripNumericUpDown.cs index 3ed3d30dfcc0e9d3e82e383439879c0bb6ed3a7d..9c6c12bc9e4d9ce6dfe8d344a26cb04cd8040437 100644 --- a/Source/Core/Controls/ToolStripNumericUpDown.cs +++ b/Source/Core/Controls/ToolStripNumericUpDown.cs @@ -12,6 +12,7 @@ namespace CodeImp.DoomBuilder.Controls public decimal Value { get { return nud.Value; } set { nud.Value = 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 Increment { get { return nud.Increment; } set { nud.Increment = value; } } private NumericUpDown nud; diff --git a/Source/Core/Editing/ClassicMode.cs b/Source/Core/Editing/ClassicMode.cs index 88feca7ea5dbc31bef564ada77b5e02924faac28..b0d55a0a4731eb5a9fd0dc0e905228dffe6f2298 100644 --- a/Source/Core/Editing/ClassicMode.cs +++ b/Source/Core/Editing/ClassicMode.cs @@ -70,6 +70,7 @@ namespace CodeImp.DoomBuilder.Editing // Selection protected bool selecting; protected bool selectpressed; //mxd + protected bool editpressed; //mxd protected Vector2D selectstart; protected RectangleF selectionrect; protected MarqueSelectionMode marqueSelectionMode; //mxd @@ -761,6 +762,7 @@ namespace CodeImp.DoomBuilder.Editing [BeginAction("classicedit", BaseAction = true)] protected virtual void OnEditBegin() { + editpressed = true; //mxd } /// <summary> @@ -770,6 +772,7 @@ namespace CodeImp.DoomBuilder.Editing [EndAction("classicedit", BaseAction = true)] protected virtual void OnEditEnd() { + editpressed = false; //mxd } /// <summary> diff --git a/Source/Plugins/BuilderModes/BuilderModes.csproj b/Source/Plugins/BuilderModes/BuilderModes.csproj index c169789dbfbb4b53b209cccff109f2a3cabb3677..4b1fa12d76b81b1036527b41e7e63ce219a0beb4 100644 --- a/Source/Plugins/BuilderModes/BuilderModes.csproj +++ b/Source/Plugins/BuilderModes/BuilderModes.csproj @@ -97,12 +97,6 @@ <Compile Include="General\Association.cs" /> <Compile Include="General\BuilderPlug.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"> <SubType>Form</SubType> </Compile> @@ -163,10 +157,6 @@ <EmbeddedResource Include="Resources\SectorsMode.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> @@ -328,6 +318,12 @@ <Compile Include="Interface\BridgeModeForm.Designer.cs"> <DependentUpon>BridgeModeForm.cs</DependentUpon> </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"> <SubType>UserControl</SubType> </Compile> @@ -549,6 +545,9 @@ <EmbeddedResource Include="Resources\DrawGeometryMode.png" /> </ItemGroup> <ItemGroup> + <EmbeddedResource Include="Interface\CurveLinedefsOptionsPanel.resx"> + <DependentUpon>CurveLinedefsOptionsPanel.cs</DependentUpon> + </EmbeddedResource> <EmbeddedResource Include="Interface\DrawLineOptionsPanel.resx"> <DependentUpon>DrawLineOptionsPanel.cs</DependentUpon> </EmbeddedResource> @@ -626,6 +625,12 @@ <ItemGroup> <None Include="Resources\SoundRadius.png" /> </ItemGroup> + <ItemGroup> + <None Include="Resources\Check.png" /> + </ItemGroup> + <ItemGroup> + <None Include="Resources\Close.png" /> + </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. diff --git a/Source/Plugins/BuilderModes/ClassicModes/CurveLinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/CurveLinedefsMode.cs index 297cc7326d1d3328a2b824cbefa1e1ec1c7ecd43..b0780624c473a8e4cf3b58b51b87c88a535141d9 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/CurveLinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/CurveLinedefsMode.cs @@ -18,7 +18,10 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.Windows.Forms; +using CodeImp.DoomBuilder.Actions; +using CodeImp.DoomBuilder.BuilderModes.Interface; using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Geometry; @@ -35,6 +38,9 @@ namespace CodeImp.DoomBuilder.BuilderModes { #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; #endregion @@ -44,6 +50,13 @@ namespace CodeImp.DoomBuilder.BuilderModes // Collections private ICollection<Linedef> selectedlines; 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 @@ -57,91 +70,141 @@ namespace CodeImp.DoomBuilder.BuilderModes #region ================== Constructor / Disposer // Constructor - public CurveLinedefsMode(EditMode basemode) + public CurveLinedefsMode() { // 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 + curves = new Dictionary<Linedef, List<Vector2D>>(selectedlines.Count); //mxd - // Done - base.Dispose(); - } + //mxd. UI + panel = new CurveLinedefsOptionsPanel(); } #endregion #region ================== Methods + //mxd + private void GenerateCurves() + { + foreach(Linedef ld in selectedlines) curves[ld] = GenerateCurve(ld); + } + // This generates the vertices to split the line with, from start to end - private static List<Vector2D> GenerateCurve(Linedef line) + 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; + // 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 List<Vector2D> points = new List<Vector2D>(vertices); - //Added by Anders Åstrand 2008-05-18 - //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 - //calculated from those two - //If the curve is not supposed to be a circular segment it's simply deformed to fit - //the value set for distance. - - //The vertices are generated to be evenly distributed (by angle) along the curve - //and lastly they are rotated and moved to fit with the original line - - //calculate some identities of a circle segment (refer to the graph in the url above) - float c = line.Length; - float theta = angle; - - float d = (c / (float)Math.Tan(theta / 2)) / 2; - float R = d / (float)Math.Cos(theta / 2); - float h = R - d; + float segDelta = 1.0f / (vertices + 1); //mxd + Vector2D linecenter = line.GetCenterPoint(); //mxd - float yDeform = fixedcurve ? 1 : distance / h; - if(backwards) yDeform = -yDeform; - - for(int v = 1; v <= vertices; v++) + //mxd. Special cases... + if(theta == 0.0f) { - //calculate the angle for this vertex - //the curve starts at PI/2 - theta/2 and is segmented into vertices+1 segments - //this assumes the line is horisontal and on y = 0, the point is rotated and moved later + 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 + //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 + //calculated from those two + //If the curve is not supposed to be a circular segment it's simply deformed to fit + //the value set for distance. + + //The vertices are generated to be evenly distributed (by angle) along the curve + //and lastly they are rotated and moved to fit with the original line + + //calculate some identities of a circle segment (refer to the graph in the url above) + float c = line.Length; + + float d = (c / (float)Math.Tan(theta / 2)) / 2; + float R = d / (float)Math.Cos(theta / 2); + float h = R - d; + + float yDeform = (fixedcurve ? 1 : distance / h); + float xDelta = Math.Min(1, yDeform); //mxd + + for(int v = 1; v <= vertices; v++) + { + //calculate the angle for this vertex + //the curve starts at PI/2 - theta/2 and is segmented into vertices+1 segments + //this assumes the line is horisontal and on y = 0, the point is rotated and moved later + + float a = (Angle2D.PI - theta) / 2 + v * (theta / (vertices + 1)); + + //calculate the coordinates of the point, and distort the y coordinate + //using the deform factor calculated above + 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; + + //rotate and transform to fit original line + Vector2D vertex = new Vector2D(x, y).GetRotated(line.Angle + Angle2D.PIHALF) + linecenter; + points.Add(vertex); + } + } - float a = (Angle2D.PI - theta) / 2 + v * (theta / (vertices + 1)); + // Done + return points; + } + + #endregion - //calculate the coordinates of the point, and distort the y coordinate - //using the deform factor calculated above - float x = (float)Math.Cos(a) * R; - float y = ((float)Math.Sin(a) * R - d) * yDeform; + #region ================== Settings panel (mxd) - //rotate and transform to fit original line - Vector2D vertex = new Vector2D(x, y).GetRotated(line.Angle + Angle2D.PIHALF); - vertex = vertex.GetTransformed(line.GetCenterPoint().x, line.GetCenterPoint().y, 1, 1); + 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; + } - points.Add(vertex); - } + 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(); - // Done - return points; + // Redraw display + General.Interface.RedrawDisplay(); } - + #endregion - + #region ================== Events public override void OnHelp() @@ -165,8 +228,9 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnEngage(); renderer.SetPresentation(Presentation.Standard); - // Show toolbox window - BuilderPlug.Me.CurveLinedefsForm.Show((Form)General.Interface); + //mxd + AddInterface(); + GenerateCurves(); } // Disenagaging @@ -175,20 +239,21 @@ namespace CodeImp.DoomBuilder.BuilderModes base.OnDisengage(); // Hide toolbox window - BuilderPlug.Me.CurveLinedefsForm.Hide(); + RemoveInterface(); } // This applies the curves and returns to the base mode public override void OnAccept() { // 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 foreach(Linedef ld in selectedlines) { // Make curve for line - List<Vector2D> points = GenerateCurve(ld); + List<Vector2D> points = curves[ld]; if(points.Count > 0) { // 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 Linedef splitline = ld; - for(int i = 0; i < points.Count; i++) + foreach(Vector2D p in points) { // Make vertex - Vertex v = General.Map.Map.CreateVertex(points[i]); + Vertex v = General.Map.Map.CreateVertex(p); if(v == null) { General.Map.UndoRedo.WithdrawUndo(); @@ -252,10 +317,11 @@ namespace CodeImp.DoomBuilder.BuilderModes if(renderer.StartOverlay(true)) { // Go for all selected lines + float vsize = (renderer.VertexSize + 1.0f) / renderer.Scale; //mxd foreach(Linedef ld in selectedlines) { // Make curve for line - List<Vector2D> points = GenerateCurve(ld); + List<Vector2D> points = curves[ld]; if(points.Count > 0) { Vector2D p1 = ld.Start.Position; @@ -272,6 +338,10 @@ namespace CodeImp.DoomBuilder.BuilderModes // Draw last line 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(); @@ -279,7 +349,83 @@ namespace CodeImp.DoomBuilder.BuilderModes 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 } } diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs index ed5fd0626eb3452902fe351594e12702f3680c3f..973bacc822d430adc73825e3082c8f9aba442b61 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs @@ -1563,7 +1563,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(selected.Count > 0) { // Go into curve linedefs mode - General.Editing.ChangeMode(new CurveLinedefsMode(new LinedefsMode())); + General.Editing.ChangeMode(new CurveLinedefsMode()); } } diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index 8699c7d01d289afc6db9e3c74c888404a7184f99..45743e29c8cc72d545ec6b730d1be5bb083beb02 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -85,7 +85,6 @@ namespace CodeImp.DoomBuilder.BuilderModes // Main objects private MenusForm menusform; - private CurveLinedefsForm curvelinedefsform; private FindReplaceForm findreplaceform; private ErrorCheckForm errorcheckform; private PreferencesForm preferencesform; @@ -143,7 +142,6 @@ namespace CodeImp.DoomBuilder.BuilderModes public override int MinimumRevision { get { return Assembly.GetExecutingAssembly().GetName().Version.Revision; } } 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 ErrorCheckForm ErrorCheckForm { get { return errorcheckform ?? (errorcheckform = new ErrorCheckForm()); } } public PreferencesForm PreferencesForm { get { return preferencesform; } } @@ -243,11 +241,6 @@ namespace CodeImp.DoomBuilder.BuilderModes menusform = null; //mxd. These are created on demand, so they may be nulls. - if(curvelinedefsform != null) - { - curvelinedefsform.Dispose(); - curvelinedefsform = null; - } if(findreplaceform != null) { findreplaceform.Dispose(); diff --git a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.Designer.cs deleted file mode 100644 index 177f0a2900fcfcab4857c4bad6479018518c314d..0000000000000000000000000000000000000000 --- a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.Designer.cs +++ /dev/null @@ -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; - } -} \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.cs b/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.cs deleted file mode 100644 index a71a43ee6b09508805893954ef46439f23401dd6..0000000000000000000000000000000000000000 --- a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.Designer.cs b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..1e7449ccd502708405286703b06dbcc664cdc560 --- /dev/null +++ b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.Designer.cs @@ -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; + } +} diff --git a/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.cs b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.cs new file mode 100644 index 0000000000000000000000000000000000000000..f6b13ce62d2532e3034e8e036833b37439fb89a7 --- /dev/null +++ b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.cs @@ -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 + + } +} diff --git a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.resx b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.resx similarity index 77% rename from Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.resx rename to Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.resx index 87a3d0c6fa637a64030604770ad86e1706933fcb..e9b8a201c2f8c59a71fad8a5407a9ff251abdfbc 100644 --- a/Source/Plugins/BuilderModes/Interface/CurveLinedefsForm.resx +++ b/Source/Plugins/BuilderModes/Interface/CurveLinedefsOptionsPanel.resx @@ -117,31 +117,7 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>False</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 name="toolstrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> </metadata> </root> \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Properties/Resources.Designer.cs b/Source/Plugins/BuilderModes/Properties/Resources.Designer.cs index a3c0b6ce875c2bfb2ba24c46b2cb4ad8761d3d17..9fb5bae2655e7441a4a700d4ecbdcb55f8b833e7 100644 --- a/Source/Plugins/BuilderModes/Properties/Resources.Designer.cs +++ b/Source/Plugins/BuilderModes/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // 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 // 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 { get { object obj = ResourceManager.GetObject("ColorPick", resourceCulture); diff --git a/Source/Plugins/BuilderModes/Properties/Resources.resx b/Source/Plugins/BuilderModes/Properties/Resources.resx index e5efcf603007044ef6c51df3eff0d659a59d9e0f..ed39a84f45dcc18070de32fc8f2704abf5465cb7 100644 --- a/Source/Plugins/BuilderModes/Properties/Resources.resx +++ b/Source/Plugins/BuilderModes/Properties/Resources.resx @@ -205,12 +205,18 @@ <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> </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"> <value>..\Resources\BrightnessGradient.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> <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> </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"> <value>..\Resources\Door.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> @@ -268,7 +274,7 @@ <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> </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 name="Close" type="System.Resources.ResXFileRef, System.Windows.Forms"> + <value>..\Resources\Close.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> </data> </root> \ No newline at end of file diff --git a/Source/Plugins/BuilderModes/Resources/Check.png b/Source/Plugins/BuilderModes/Resources/Check.png new file mode 100644 index 0000000000000000000000000000000000000000..286686e8514bcd5bfb06fa8b8ffbfeb99898338c Binary files /dev/null and b/Source/Plugins/BuilderModes/Resources/Check.png differ diff --git a/Source/Plugins/BuilderModes/Resources/Close.png b/Source/Plugins/BuilderModes/Resources/Close.png new file mode 100644 index 0000000000000000000000000000000000000000..5cc28f5f8ba6ab3fd49a10ebd7bd75b3bbfbcfb6 Binary files /dev/null and b/Source/Plugins/BuilderModes/Resources/Close.png differ diff --git a/Source/Plugins/BuilderModes/Resources/Hints.cfg b/Source/Plugins/BuilderModes/Resources/Hints.cfg index f7bf54f472d0c6d41ddb114dd275a0c099c9d18a..090a5ba1d517e5a6725ce27136051c431ee96002 100644 --- a/Source/Plugins/BuilderModes/Resources/Hints.cfg +++ b/Source/Plugins/BuilderModes/Resources/Hints.cfg @@ -212,6 +212,7 @@ group general "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_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>Ctrl</b> to toggle snapping to nearest vertex" "Hold <b>Alt - Shift</b> to snap to 4 cardinal directions" @@ -233,4 +234,13 @@ group gridlockhelp "Use <k>builder_griddec</k> and <k>builder_gridinc</k> to change grid size." "Hold <b>Alt - Shift</b> to snap to 4 cardinal directions" "Place second vertex to finish drawing" +"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" \ No newline at end of file