From 63010d871a814fc5c659d2b4eec0fc2b58420318 Mon Sep 17 00:00:00 2001 From: wisselstem <36791160+spherallic@users.noreply.github.com> Date: Sun, 17 Sep 2023 15:39:19 +0200 Subject: [PATCH] Draw Curve Mode, Draw Ellipse Mode, Draw Rectangle Mode: added option to place things at the designated vertex positions instead of drawing geometry (#956) --- .../ClassicModes/DrawCurveMode.cs | 46 +++++++++++++++---- .../ClassicModes/DrawEllipseMode.cs | 5 +- .../ClassicModes/DrawGeometryMode.cs | 13 ++++-- .../ClassicModes/DrawRectangleMode.cs | 32 +++++++++++-- .../DrawCurveOptionsPanel.Designer.cs | 16 ++++++- .../Interface/DrawCurveOptionsPanel.cs | 9 ++++ .../DrawEllipseOptionsPanel.Designer.cs | 15 +++++- .../Interface/DrawEllipseOptionsPanel.cs | 11 ++++- .../DrawRectangleOptionsPanel.Designer.cs | 13 ++++++ .../Interface/DrawRectangleOptionsPanel.cs | 9 ++++ 10 files changed, 148 insertions(+), 21 deletions(-) diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs index 15e1c303..8044fa80 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawCurveMode.cs @@ -101,13 +101,16 @@ namespace CodeImp.DoomBuilder.BuilderModes curve = CurveTools.CurveThroughPoints(verts, 0.5f, 0.75f, segmentlength); // Render lines - for(int i = 1; i < curve.Shape.Count; i++) + if (!placethingsatvertices) { - // Determine line color - PixelColor c = snaptonearest ? stitchcolor : losecolor; + for (int i = 1; i < curve.Shape.Count; i++) + { + // Determine line color + PixelColor c = snaptonearest ? stitchcolor : losecolor; - // Render line - renderer.RenderLine(curve.Shape[i - 1], curve.Shape[i], LINE_THICKNESS, c, true); + // Render line + renderer.RenderLine(curve.Shape[i - 1], curve.Shape[i], LINE_THICKNESS, c, true); + } } //render "inactive" vertices @@ -237,7 +240,27 @@ namespace CodeImp.DoomBuilder.BuilderModes } // Make the drawing - if(Tools.DrawLines(verts, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) //mxd + if (placethingsatvertices) + { + List points = new List(); + for (int i = 0; i < verts.Count; i++) + if (!points.Contains(verts[i].pos)) points.Add(verts[i].pos); + + PlaceThingsAtPositions(points); + + // Snap to map format accuracy + General.Map.Map.SnapAllToAccuracy(); + + // Clear selection + General.Map.Map.ClearAllSelected(); + + // Update cached values + General.Map.Map.Update(); + + // Map is changed + General.Map.IsChanged = true; + } + else if (Tools.DrawLines(verts, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) //mxd { // Snap to map format accuracy General.Map.Map.SnapAllToAccuracy(); @@ -249,11 +272,11 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Map.Map.Update(); //mxd. Outer sectors may require some splittin... - if(General.Settings.SplitJoinedSectors) Tools.SplitOuterSectors(General.Map.Map.GetMarkedLinedefs(true)); + if (General.Settings.SplitJoinedSectors) Tools.SplitOuterSectors(General.Map.Map.GetMarkedLinedefs(true)); // Edit new sectors? List newsectors = General.Map.Map.GetMarkedSectors(true); - if(BuilderPlug.Me.EditNewSector && (newsectors.Count > 0)) + if (BuilderPlug.Me.EditNewSector && (newsectors.Count > 0)) General.Interface.ShowEditSectors(newsectors); // Update the used textures @@ -320,10 +343,12 @@ namespace CodeImp.DoomBuilder.BuilderModes panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnAutoCloseDrawingChanged += OnAutoCloseDrawingChanged; + panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged; // Needs to be set after adding the events... panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawcurvemode.continuousdrawing", false); - panel.AutoCloseDrawing = General.Settings.ReadPluginSetting("drawlinesmode.autoclosedrawing", false); + panel.AutoCloseDrawing = General.Settings.ReadPluginSetting("drawcurvemode.autoclosedrawing", false); + panel.PlaceThingsAtVertices = General.Settings.ReadPluginSetting("drawcurvemode.placethingsatvertices", false); } protected override void AddInterface() @@ -336,7 +361,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // Store settings General.Settings.WritePluginSetting("drawcurvemode.segmentlength", segmentlength); General.Settings.WritePluginSetting("drawcurvemode.continuousdrawing", panel.ContinuousDrawing); - General.Settings.WritePluginSetting("drawlinesmode.autoclosedrawing", panel.AutoCloseDrawing); + General.Settings.WritePluginSetting("drawcurvemode.autoclosedrawing", panel.AutoCloseDrawing); + General.Settings.WritePluginSetting("drawcurvemode.placethingsatvertices", panel.PlaceThingsAtVertices); // Remove the buttons panel.Unregister(); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs index f462069a..118cd00d 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawEllipseMode.cs @@ -69,11 +69,13 @@ namespace CodeImp.DoomBuilder.BuilderModes panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged; panel.OnRadialDrawingChanged += OnRadialDrawingChanged; + panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged; // Needs to be set after adding the OnContinuousDrawingChanged event... panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawellipsemode.continuousdrawing", false); panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawellipsemode.showguidelines", false); panel.RadialDrawing = General.Settings.ReadPluginSetting("drawellipsemode.radialdrawing", false); + panel.PlaceThingsAtVertices = General.Settings.ReadPluginSetting("drawellipsemode.placethingsatvertices", false); } override protected void AddInterface() @@ -90,7 +92,8 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Settings.WritePluginSetting("drawellipsemode.continuousdrawing", panel.ContinuousDrawing); General.Settings.WritePluginSetting("drawellipsemode.showguidelines", panel.ShowGuidelines); General.Settings.WritePluginSetting("drawellipsemode.radialdrawing", panel.RadialDrawing); - + General.Settings.WritePluginSetting("drawellipsemode.placethingsatvertices", panel.PlaceThingsAtVertices); + // Remove the buttons panel.Unregister(); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs index a3ab3a12..5f482d78 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawGeometryMode.cs @@ -65,6 +65,7 @@ namespace CodeImp.DoomBuilder.BuilderModes protected bool autoclosedrawing; //mxd. Finish drawing when new points and existing geometry form a closed shape protected bool drawingautoclosed; //mxd protected bool showguidelines; //mxd + protected bool placethingsatvertices; //mxd. Map area bounds private Line2D top, bottom, left, right; @@ -951,11 +952,17 @@ namespace CodeImp.DoomBuilder.BuilderModes showguidelines = (bool)value; General.Interface.RedrawDisplay(); } - + + protected void OnPlaceThingsAtVerticesChanged(object value, EventArgs e) + { + placethingsatvertices = (bool)value; + General.Interface.RedrawDisplay(); + } + #endregion - + #region ================== Actions - + // Drawing a point [BeginAction("drawpoint")] public void DrawPoint() diff --git a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs index 9b3da24f..6a5da358 100755 --- a/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DrawRectangleMode.cs @@ -104,11 +104,13 @@ namespace CodeImp.DoomBuilder.BuilderModes panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged; panel.OnRadialDrawingChanged += OnRadialDrawingChanged; + panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged; // Needs to be set after adding the OnContinuousDrawingChanged event... panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.continuousdrawing", false); panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawrectanglemode.showguidelines", false); panel.RadialDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.radialdrawing", false); + panel.PlaceThingsAtVertices = General.Settings.ReadPluginSetting("drawrectanglemode.placethingsatvertices", false); } protected override void AddInterface() @@ -124,6 +126,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Settings.WritePluginSetting("drawrectanglemode.continuousdrawing", panel.ContinuousDrawing); General.Settings.WritePluginSetting("drawrectanglemode.showguidelines", panel.ShowGuidelines); General.Settings.WritePluginSetting("drawrectanglemode.radialdrawing", panel.RadialDrawing); + General.Settings.WritePluginSetting("drawrectanglemode.placethingsatvertices", panel.PlaceThingsAtVertices); // Remove the buttons panel.Unregister(); @@ -173,8 +176,11 @@ namespace CodeImp.DoomBuilder.BuilderModes RenderGuidelines(startrotated, endrotated, General.Colors.Guideline.WithAlpha(80), -General.Map.Grid.GridRotate); //render shape - for(int i = 1; i < shape.Length; i++) - renderer.RenderLine(shape[i - 1], shape[i], LINE_THICKNESS, color, true); + if (!placethingsatvertices) + { + for (int i = 1; i < shape.Length; i++) + renderer.RenderLine(shape[i - 1], shape[i], LINE_THICKNESS, color, true); + } //vertices for(int i = 0; i < shape.Length; i++) @@ -440,7 +446,27 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.DisplayStatus(StatusType.Action, "Created " + a + word + " " + shapename + "."); // Make the drawing - if(Tools.DrawLines(points, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) + if (placethingsatvertices) + { + List verts = new List(); + for (int i = 0; i < points.Count; i++) + if (!verts.Contains(new Vector2D(points[i].pos.x, points[i].pos.y))) verts.Add(new Vector2D(points[i].pos.x, points[i].pos.y)); + + PlaceThingsAtPositions(verts); + + // Snap to map format accuracy + General.Map.Map.SnapAllToAccuracy(); + + // Clear selection + General.Map.Map.ClearAllSelected(); + + // Update cached values + General.Map.Map.Update(); + + // Map is changed + General.Map.IsChanged = true; + } + else if (Tools.DrawLines(points, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) { // Snap to map format accuracy General.Map.Map.SnapAllToAccuracy(); diff --git a/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.Designer.cs b/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.Designer.cs index 853cf270..46fab6a7 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.Designer.cs @@ -31,6 +31,7 @@ this.toolstrip = new System.Windows.Forms.ToolStrip(); this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.autoclosedrawing = new System.Windows.Forms.ToolStripButton(); + this.placethingsatvertices = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.seglabel = new System.Windows.Forms.ToolStripLabel(); this.seglen = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); @@ -43,7 +44,8 @@ this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.continuousdrawing, this.autoclosedrawing, - this.toolStripSeparator1, + this.placethingsatvertices, + this.toolStripSeparator1, this.seglabel, this.seglen, this.reset}); @@ -74,6 +76,16 @@ this.autoclosedrawing.Text = "Auto-close drawing"; this.autoclosedrawing.CheckedChanged += new System.EventHandler(this.autoclosedrawing_CheckedChanged); // + // placethingsatvertices + // + this.placethingsatvertices.CheckOnClick = true; + this.placethingsatvertices.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PlaceThings; + this.placethingsatvertices.ImageTransparentColor = System.Drawing.Color.Magenta; + this.placethingsatvertices.Name = "placethingsatvertices"; + this.placethingsatvertices.Size = new System.Drawing.Size(135, 22); + this.placethingsatvertices.Text = "Place things"; + this.placethingsatvertices.CheckedChanged += new System.EventHandler(this.placethingsatvertices_CheckedChanged); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -142,6 +154,6 @@ private System.Windows.Forms.ToolStripButton continuousdrawing; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripButton autoclosedrawing; - + private System.Windows.Forms.ToolStripButton placethingsatvertices; } } diff --git a/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.cs b/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.cs index 6342b03f..059e2834 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawCurveOptionsPanel.cs @@ -8,11 +8,13 @@ namespace CodeImp.DoomBuilder.BuilderModes public event EventHandler OnValueChanged; public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnAutoCloseDrawingChanged; + public event EventHandler OnPlaceThingsAtVerticesChanged; private bool blockevents; public int SegmentLength { get { return (int)seglen.Value; } set { blockevents = true; seglen.Value = value; blockevents = false; } } public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool AutoCloseDrawing { get { return autoclosedrawing.Checked; } set { autoclosedrawing.Checked = value; } } + public bool PlaceThingsAtVertices { get { return placethingsatvertices.Checked; } set { placethingsatvertices.Checked = value; } } public DrawCurveOptionsPanel(int minLength, int maxLength) { @@ -29,6 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.BeginToolbarUpdate(); General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(autoclosedrawing); + General.Interface.AddButton(placethingsatvertices); General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(seglabel); General.Interface.AddButton(seglen); @@ -43,6 +46,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.RemoveButton(seglen); General.Interface.RemoveButton(seglabel); General.Interface.RemoveButton(toolStripSeparator1); + General.Interface.RemoveButton(placethingsatvertices); General.Interface.RemoveButton(autoclosedrawing); General.Interface.RemoveButton(continuousdrawing); General.Interface.EndToolbarUpdate(); @@ -67,5 +71,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(OnAutoCloseDrawingChanged != null) OnAutoCloseDrawingChanged(autoclosedrawing.Checked, EventArgs.Empty); } + + private void placethingsatvertices_CheckedChanged(object sender, EventArgs e) + { + if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty); + } } } diff --git a/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.Designer.cs b/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.Designer.cs index 28291417..4ee927b5 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.Designer.cs @@ -31,6 +31,7 @@ this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.radialdrawing = new System.Windows.Forms.ToolStripButton(); + this.placethingsatvertices = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.subdivslabel = new System.Windows.Forms.ToolStripLabel(); this.subdivs = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); @@ -49,7 +50,8 @@ this.continuousdrawing, this.showguidelines, this.radialdrawing, - this.toolStripSeparator1, + this.placethingsatvertices, + this.toolStripSeparator1, this.subdivslabel, this.subdivs, this.spikinesslabel, @@ -73,6 +75,16 @@ this.continuousdrawing.Text = "Continuous drawing"; this.continuousdrawing.CheckedChanged += new System.EventHandler(this.continuousdrawing_CheckedChanged); // + // placethingsatvertices + // + this.placethingsatvertices.CheckOnClick = true; + this.placethingsatvertices.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PlaceThings; + this.placethingsatvertices.ImageTransparentColor = System.Drawing.Color.Magenta; + this.placethingsatvertices.Name = "placethingsatvertices"; + this.placethingsatvertices.Size = new System.Drawing.Size(135, 22); + this.placethingsatvertices.Text = "Place things"; + this.placethingsatvertices.CheckedChanged += new System.EventHandler(this.placethingsatvertices_CheckedChanged); + // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; @@ -225,5 +237,6 @@ private System.Windows.Forms.ToolStripLabel anglelabel; private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown angle; private System.Windows.Forms.ToolStripButton showguidelines; + private System.Windows.Forms.ToolStripButton placethingsatvertices; } } diff --git a/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.cs b/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.cs index af681df7..309d73b2 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawEllipseOptionsPanel.cs @@ -9,6 +9,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnShowGuidelinesChanged; public event EventHandler OnRadialDrawingChanged; + public event EventHandler OnPlaceThingsAtVerticesChanged; private bool blockevents; @@ -22,7 +23,8 @@ namespace CodeImp.DoomBuilder.BuilderModes public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.Checked = value; } } public bool RadialDrawing { get { return radialdrawing.Checked; } set { radialdrawing.Checked = value; } } - + public bool PlaceThingsAtVertices { get { return placethingsatvertices.Checked; } set { placethingsatvertices.Checked = value; } } + public DrawEllipseOptionsPanel() { InitializeComponent(); @@ -38,6 +40,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(showguidelines); General.Interface.AddButton(radialdrawing); + General.Interface.AddButton(placethingsatvertices); General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(subdivslabel); General.Interface.AddButton(subdivs); @@ -63,6 +66,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.RemoveButton(showguidelines); General.Interface.RemoveButton(continuousdrawing); General.Interface.RemoveButton(radialdrawing); + General.Interface.RemoveButton(placethingsatvertices); General.Interface.EndToolbarUpdate(); } @@ -98,5 +102,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty); } + + private void placethingsatvertices_CheckedChanged(object sender, EventArgs e) + { + if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty); + } } } diff --git a/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.Designer.cs b/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.Designer.cs index 002bdc53..bfaae798 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.Designer.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.Designer.cs @@ -32,6 +32,7 @@ this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.showguidelines = new System.Windows.Forms.ToolStripButton(); this.radialdrawing = new System.Windows.Forms.ToolStripButton(); + this.placethingsatvertices = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.radiuslabel = new System.Windows.Forms.ToolStripLabel(); this.radius = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); @@ -47,6 +48,7 @@ this.continuousdrawing, this.showguidelines, this.radialdrawing, + this.placethingsatvertices, this.toolStripSeparator1, this.radiuslabel, this.radius, @@ -69,6 +71,16 @@ this.continuousdrawing.Text = "Continuous drawing"; this.continuousdrawing.CheckedChanged += new System.EventHandler(this.continuousdrawing_CheckedChanged); // + // placethingsatvertices + // + this.placethingsatvertices.CheckOnClick = true; + this.placethingsatvertices.Image = global::CodeImp.DoomBuilder.BuilderModes.Properties.Resources.PlaceThings; + this.placethingsatvertices.ImageTransparentColor = System.Drawing.Color.Magenta; + this.placethingsatvertices.Name = "placethingsatvertices"; + this.placethingsatvertices.Size = new System.Drawing.Size(135, 22); + this.placethingsatvertices.Text = "Place things"; + this.placethingsatvertices.CheckedChanged += new System.EventHandler(this.placethingsatvertices_CheckedChanged); + // // showguidelines // this.showguidelines.CheckOnClick = true; @@ -190,5 +202,6 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripButton showguidelines; private System.Windows.Forms.ToolStripButton radialdrawing; + private System.Windows.Forms.ToolStripButton placethingsatvertices; } } diff --git a/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.cs b/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.cs index f60b60d4..efbfaa4e 100755 --- a/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.cs +++ b/Source/Plugins/BuilderModes/Interface/DrawRectangleOptionsPanel.cs @@ -9,6 +9,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnShowGuidelinesChanged; public event EventHandler OnRadialDrawingChanged; + public event EventHandler OnPlaceThingsAtVerticesChanged; private bool blockevents; @@ -21,6 +22,7 @@ namespace CodeImp.DoomBuilder.BuilderModes public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.Checked = value; } } public bool RadialDrawing { get { return radialdrawing.Checked; } set { radialdrawing.Checked = value; } } + public bool PlaceThingsAtVertices { get { return placethingsatvertices.Checked; } set { placethingsatvertices.Checked = value; } } public DrawRectangleOptionsPanel() { @@ -36,6 +38,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(showguidelines); General.Interface.AddButton(radialdrawing); + General.Interface.AddButton(placethingsatvertices); General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(radiuslabel); General.Interface.AddButton(radius); @@ -55,6 +58,7 @@ namespace CodeImp.DoomBuilder.BuilderModes General.Interface.RemoveButton(radiuslabel); General.Interface.RemoveButton(toolStripSeparator1); General.Interface.RemoveButton(showguidelines); + General.Interface.RemoveButton(placethingsatvertices); General.Interface.RemoveButton(continuousdrawing); General.Interface.RemoveButton(radialdrawing); General.Interface.EndToolbarUpdate(); @@ -91,5 +95,10 @@ namespace CodeImp.DoomBuilder.BuilderModes { if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty); } + + private void placethingsatvertices_CheckedChanged(object sender, EventArgs e) + { + if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty); + } } }