Draw Curve Mode, Draw Ellipse Mode, Draw Rectangle Mode: added option to place things at the designated vertex positions instead of drawing geometry (#956)

This commit is contained in:
wisselstem 2023-09-17 15:39:19 +02:00 committed by GitHub
parent 01bcdc01b2
commit 63010d871a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 148 additions and 21 deletions

View file

@ -101,7 +101,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
curve = CurveTools.CurveThroughPoints(verts, 0.5f, 0.75f, segmentlength); curve = CurveTools.CurveThroughPoints(verts, 0.5f, 0.75f, segmentlength);
// Render lines // Render lines
for(int i = 1; i < curve.Shape.Count; i++) if (!placethingsatvertices)
{
for (int i = 1; i < curve.Shape.Count; i++)
{ {
// Determine line color // Determine line color
PixelColor c = snaptonearest ? stitchcolor : losecolor; PixelColor c = snaptonearest ? stitchcolor : losecolor;
@ -109,6 +111,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Render line // Render line
renderer.RenderLine(curve.Shape[i - 1], curve.Shape[i], LINE_THICKNESS, c, true); renderer.RenderLine(curve.Shape[i - 1], curve.Shape[i], LINE_THICKNESS, c, true);
} }
}
//render "inactive" vertices //render "inactive" vertices
for(int i = 1; i < curve.Shape.Count - 1; i++) for(int i = 1; i < curve.Shape.Count - 1; i++)
@ -237,7 +240,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Make the drawing // Make the drawing
if(Tools.DrawLines(verts, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) //mxd if (placethingsatvertices)
{
List<Vector2D> points = new List<Vector2D>();
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 // Snap to map format accuracy
General.Map.Map.SnapAllToAccuracy(); General.Map.Map.SnapAllToAccuracy();
@ -249,11 +272,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Map.Map.Update(); General.Map.Map.Update();
//mxd. Outer sectors may require some splittin... //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? // Edit new sectors?
List<Sector> newsectors = General.Map.Map.GetMarkedSectors(true); List<Sector> newsectors = General.Map.Map.GetMarkedSectors(true);
if(BuilderPlug.Me.EditNewSector && (newsectors.Count > 0)) if (BuilderPlug.Me.EditNewSector && (newsectors.Count > 0))
General.Interface.ShowEditSectors(newsectors); General.Interface.ShowEditSectors(newsectors);
// Update the used textures // Update the used textures
@ -320,10 +343,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
panel.OnValueChanged += OptionsPanelOnValueChanged; panel.OnValueChanged += OptionsPanelOnValueChanged;
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.OnAutoCloseDrawingChanged += OnAutoCloseDrawingChanged; panel.OnAutoCloseDrawingChanged += OnAutoCloseDrawingChanged;
panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged;
// Needs to be set after adding the events... // Needs to be set after adding the events...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawcurvemode.continuousdrawing", false); 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() protected override void AddInterface()
@ -336,7 +361,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Store settings // Store settings
General.Settings.WritePluginSetting("drawcurvemode.segmentlength", segmentlength); General.Settings.WritePluginSetting("drawcurvemode.segmentlength", segmentlength);
General.Settings.WritePluginSetting("drawcurvemode.continuousdrawing", panel.ContinuousDrawing); 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 // Remove the buttons
panel.Unregister(); panel.Unregister();

View file

@ -69,11 +69,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged; panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged;
panel.OnRadialDrawingChanged += OnRadialDrawingChanged; panel.OnRadialDrawingChanged += OnRadialDrawingChanged;
panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged;
// Needs to be set after adding the OnContinuousDrawingChanged event... // Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawellipsemode.continuousdrawing", false); panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawellipsemode.continuousdrawing", false);
panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawellipsemode.showguidelines", false); panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawellipsemode.showguidelines", false);
panel.RadialDrawing = General.Settings.ReadPluginSetting("drawellipsemode.radialdrawing", false); panel.RadialDrawing = General.Settings.ReadPluginSetting("drawellipsemode.radialdrawing", false);
panel.PlaceThingsAtVertices = General.Settings.ReadPluginSetting("drawellipsemode.placethingsatvertices", false);
} }
override protected void AddInterface() override protected void AddInterface()
@ -90,6 +92,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("drawellipsemode.continuousdrawing", panel.ContinuousDrawing); General.Settings.WritePluginSetting("drawellipsemode.continuousdrawing", panel.ContinuousDrawing);
General.Settings.WritePluginSetting("drawellipsemode.showguidelines", panel.ShowGuidelines); General.Settings.WritePluginSetting("drawellipsemode.showguidelines", panel.ShowGuidelines);
General.Settings.WritePluginSetting("drawellipsemode.radialdrawing", panel.RadialDrawing); General.Settings.WritePluginSetting("drawellipsemode.radialdrawing", panel.RadialDrawing);
General.Settings.WritePluginSetting("drawellipsemode.placethingsatvertices", panel.PlaceThingsAtVertices);
// Remove the buttons // Remove the buttons

View file

@ -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 autoclosedrawing; //mxd. Finish drawing when new points and existing geometry form a closed shape
protected bool drawingautoclosed; //mxd protected bool drawingautoclosed; //mxd
protected bool showguidelines; //mxd protected bool showguidelines; //mxd
protected bool placethingsatvertices;
//mxd. Map area bounds //mxd. Map area bounds
private Line2D top, bottom, left, right; private Line2D top, bottom, left, right;
@ -952,6 +953,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RedrawDisplay(); General.Interface.RedrawDisplay();
} }
protected void OnPlaceThingsAtVerticesChanged(object value, EventArgs e)
{
placethingsatvertices = (bool)value;
General.Interface.RedrawDisplay();
}
#endregion #endregion
#region ================== Actions #region ================== Actions

View file

@ -104,11 +104,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged; panel.OnContinuousDrawingChanged += OnContinuousDrawingChanged;
panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged; panel.OnShowGuidelinesChanged += OnShowGuidelinesChanged;
panel.OnRadialDrawingChanged += OnRadialDrawingChanged; panel.OnRadialDrawingChanged += OnRadialDrawingChanged;
panel.OnPlaceThingsAtVerticesChanged += OnPlaceThingsAtVerticesChanged;
// Needs to be set after adding the OnContinuousDrawingChanged event... // Needs to be set after adding the OnContinuousDrawingChanged event...
panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.continuousdrawing", false); panel.ContinuousDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.continuousdrawing", false);
panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawrectanglemode.showguidelines", false); panel.ShowGuidelines = General.Settings.ReadPluginSetting("drawrectanglemode.showguidelines", false);
panel.RadialDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.radialdrawing", false); panel.RadialDrawing = General.Settings.ReadPluginSetting("drawrectanglemode.radialdrawing", false);
panel.PlaceThingsAtVertices = General.Settings.ReadPluginSetting("drawrectanglemode.placethingsatvertices", false);
} }
protected override void AddInterface() protected override void AddInterface()
@ -124,6 +126,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Settings.WritePluginSetting("drawrectanglemode.continuousdrawing", panel.ContinuousDrawing); General.Settings.WritePluginSetting("drawrectanglemode.continuousdrawing", panel.ContinuousDrawing);
General.Settings.WritePluginSetting("drawrectanglemode.showguidelines", panel.ShowGuidelines); General.Settings.WritePluginSetting("drawrectanglemode.showguidelines", panel.ShowGuidelines);
General.Settings.WritePluginSetting("drawrectanglemode.radialdrawing", panel.RadialDrawing); General.Settings.WritePluginSetting("drawrectanglemode.radialdrawing", panel.RadialDrawing);
General.Settings.WritePluginSetting("drawrectanglemode.placethingsatvertices", panel.PlaceThingsAtVertices);
// Remove the buttons // Remove the buttons
panel.Unregister(); panel.Unregister();
@ -173,8 +176,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
RenderGuidelines(startrotated, endrotated, General.Colors.Guideline.WithAlpha(80), -General.Map.Grid.GridRotate); RenderGuidelines(startrotated, endrotated, General.Colors.Guideline.WithAlpha(80), -General.Map.Grid.GridRotate);
//render shape //render shape
for(int i = 1; i < shape.Length; i++) if (!placethingsatvertices)
{
for (int i = 1; i < shape.Length; i++)
renderer.RenderLine(shape[i - 1], shape[i], LINE_THICKNESS, color, true); renderer.RenderLine(shape[i - 1], shape[i], LINE_THICKNESS, color, true);
}
//vertices //vertices
for(int i = 0; i < shape.Length; i++) 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 + "."); General.Interface.DisplayStatus(StatusType.Action, "Created " + a + word + " " + shapename + ".");
// Make the drawing // Make the drawing
if(Tools.DrawLines(points, true, BuilderPlug.Me.AutoAlignTextureOffsetsOnCreate)) if (placethingsatvertices)
{
List<Vector2D> verts = new List<Vector2D>();
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 // Snap to map format accuracy
General.Map.Map.SnapAllToAccuracy(); General.Map.Map.SnapAllToAccuracy();

View file

@ -31,6 +31,7 @@
this.toolstrip = new System.Windows.Forms.ToolStrip(); this.toolstrip = new System.Windows.Forms.ToolStrip();
this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.continuousdrawing = new System.Windows.Forms.ToolStripButton();
this.autoclosedrawing = 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.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.seglabel = new System.Windows.Forms.ToolStripLabel(); this.seglabel = new System.Windows.Forms.ToolStripLabel();
this.seglen = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); this.seglen = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
@ -43,6 +44,7 @@
this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolstrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.continuousdrawing, this.continuousdrawing,
this.autoclosedrawing, this.autoclosedrawing,
this.placethingsatvertices,
this.toolStripSeparator1, this.toolStripSeparator1,
this.seglabel, this.seglabel,
this.seglen, this.seglen,
@ -74,6 +76,16 @@
this.autoclosedrawing.Text = "Auto-close drawing"; this.autoclosedrawing.Text = "Auto-close drawing";
this.autoclosedrawing.CheckedChanged += new System.EventHandler(this.autoclosedrawing_CheckedChanged); 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 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -142,6 +154,6 @@
private System.Windows.Forms.ToolStripButton continuousdrawing; private System.Windows.Forms.ToolStripButton continuousdrawing;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton autoclosedrawing; private System.Windows.Forms.ToolStripButton autoclosedrawing;
private System.Windows.Forms.ToolStripButton placethingsatvertices;
} }
} }

View file

@ -8,11 +8,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
public event EventHandler OnValueChanged; public event EventHandler OnValueChanged;
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
public event EventHandler OnAutoCloseDrawingChanged; public event EventHandler OnAutoCloseDrawingChanged;
public event EventHandler OnPlaceThingsAtVerticesChanged;
private bool blockevents; private bool blockevents;
public int SegmentLength { get { return (int)seglen.Value; } set { blockevents = true; seglen.Value = value; blockevents = false; } } 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 ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
public bool AutoCloseDrawing { get { return autoclosedrawing.Checked; } set { autoclosedrawing.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) public DrawCurveOptionsPanel(int minLength, int maxLength)
{ {
@ -29,6 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.BeginToolbarUpdate(); General.Interface.BeginToolbarUpdate();
General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(autoclosedrawing); General.Interface.AddButton(autoclosedrawing);
General.Interface.AddButton(placethingsatvertices);
General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(toolStripSeparator1);
General.Interface.AddButton(seglabel); General.Interface.AddButton(seglabel);
General.Interface.AddButton(seglen); General.Interface.AddButton(seglen);
@ -43,6 +46,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(seglen); General.Interface.RemoveButton(seglen);
General.Interface.RemoveButton(seglabel); General.Interface.RemoveButton(seglabel);
General.Interface.RemoveButton(toolStripSeparator1); General.Interface.RemoveButton(toolStripSeparator1);
General.Interface.RemoveButton(placethingsatvertices);
General.Interface.RemoveButton(autoclosedrawing); General.Interface.RemoveButton(autoclosedrawing);
General.Interface.RemoveButton(continuousdrawing); General.Interface.RemoveButton(continuousdrawing);
General.Interface.EndToolbarUpdate(); General.Interface.EndToolbarUpdate();
@ -67,5 +71,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(OnAutoCloseDrawingChanged != null) OnAutoCloseDrawingChanged(autoclosedrawing.Checked, EventArgs.Empty); if(OnAutoCloseDrawingChanged != null) OnAutoCloseDrawingChanged(autoclosedrawing.Checked, EventArgs.Empty);
} }
private void placethingsatvertices_CheckedChanged(object sender, EventArgs e)
{
if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty);
}
} }
} }

View file

@ -31,6 +31,7 @@
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.continuousdrawing = new System.Windows.Forms.ToolStripButton();
this.radialdrawing = 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.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.subdivslabel = new System.Windows.Forms.ToolStripLabel(); this.subdivslabel = new System.Windows.Forms.ToolStripLabel();
this.subdivs = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); this.subdivs = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
@ -49,6 +50,7 @@
this.continuousdrawing, this.continuousdrawing,
this.showguidelines, this.showguidelines,
this.radialdrawing, this.radialdrawing,
this.placethingsatvertices,
this.toolStripSeparator1, this.toolStripSeparator1,
this.subdivslabel, this.subdivslabel,
this.subdivs, this.subdivs,
@ -73,6 +75,16 @@
this.continuousdrawing.Text = "Continuous drawing"; this.continuousdrawing.Text = "Continuous drawing";
this.continuousdrawing.CheckedChanged += new System.EventHandler(this.continuousdrawing_CheckedChanged); 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 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
@ -225,5 +237,6 @@
private System.Windows.Forms.ToolStripLabel anglelabel; private System.Windows.Forms.ToolStripLabel anglelabel;
private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown angle; private CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown angle;
private System.Windows.Forms.ToolStripButton showguidelines; private System.Windows.Forms.ToolStripButton showguidelines;
private System.Windows.Forms.ToolStripButton placethingsatvertices;
} }
} }

View file

@ -9,6 +9,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
public event EventHandler OnShowGuidelinesChanged; public event EventHandler OnShowGuidelinesChanged;
public event EventHandler OnRadialDrawingChanged; public event EventHandler OnRadialDrawingChanged;
public event EventHandler OnPlaceThingsAtVerticesChanged;
private bool blockevents; private bool blockevents;
@ -22,6 +23,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.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 RadialDrawing { get { return radialdrawing.Checked; } set { radialdrawing.Checked = value; } }
public bool PlaceThingsAtVertices { get { return placethingsatvertices.Checked; } set { placethingsatvertices.Checked = value; } }
public DrawEllipseOptionsPanel() public DrawEllipseOptionsPanel()
{ {
@ -38,6 +40,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(showguidelines); General.Interface.AddButton(showguidelines);
General.Interface.AddButton(radialdrawing); General.Interface.AddButton(radialdrawing);
General.Interface.AddButton(placethingsatvertices);
General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(toolStripSeparator1);
General.Interface.AddButton(subdivslabel); General.Interface.AddButton(subdivslabel);
General.Interface.AddButton(subdivs); General.Interface.AddButton(subdivs);
@ -63,6 +66,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(showguidelines); General.Interface.RemoveButton(showguidelines);
General.Interface.RemoveButton(continuousdrawing); General.Interface.RemoveButton(continuousdrawing);
General.Interface.RemoveButton(radialdrawing); General.Interface.RemoveButton(radialdrawing);
General.Interface.RemoveButton(placethingsatvertices);
General.Interface.EndToolbarUpdate(); General.Interface.EndToolbarUpdate();
} }
@ -98,5 +102,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty); if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty);
} }
private void placethingsatvertices_CheckedChanged(object sender, EventArgs e)
{
if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty);
}
} }
} }

View file

@ -32,6 +32,7 @@
this.continuousdrawing = new System.Windows.Forms.ToolStripButton(); this.continuousdrawing = new System.Windows.Forms.ToolStripButton();
this.showguidelines = new System.Windows.Forms.ToolStripButton(); this.showguidelines = new System.Windows.Forms.ToolStripButton();
this.radialdrawing = 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.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.radiuslabel = new System.Windows.Forms.ToolStripLabel(); this.radiuslabel = new System.Windows.Forms.ToolStripLabel();
this.radius = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown(); this.radius = new CodeImp.DoomBuilder.Controls.ToolStripNumericUpDown();
@ -47,6 +48,7 @@
this.continuousdrawing, this.continuousdrawing,
this.showguidelines, this.showguidelines,
this.radialdrawing, this.radialdrawing,
this.placethingsatvertices,
this.toolStripSeparator1, this.toolStripSeparator1,
this.radiuslabel, this.radiuslabel,
this.radius, this.radius,
@ -69,6 +71,16 @@
this.continuousdrawing.Text = "Continuous drawing"; this.continuousdrawing.Text = "Continuous drawing";
this.continuousdrawing.CheckedChanged += new System.EventHandler(this.continuousdrawing_CheckedChanged); 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 // showguidelines
// //
this.showguidelines.CheckOnClick = true; this.showguidelines.CheckOnClick = true;
@ -190,5 +202,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton showguidelines; private System.Windows.Forms.ToolStripButton showguidelines;
private System.Windows.Forms.ToolStripButton radialdrawing; private System.Windows.Forms.ToolStripButton radialdrawing;
private System.Windows.Forms.ToolStripButton placethingsatvertices;
} }
} }

View file

@ -9,6 +9,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public event EventHandler OnContinuousDrawingChanged; public event EventHandler OnContinuousDrawingChanged;
public event EventHandler OnShowGuidelinesChanged; public event EventHandler OnShowGuidelinesChanged;
public event EventHandler OnRadialDrawingChanged; public event EventHandler OnRadialDrawingChanged;
public event EventHandler OnPlaceThingsAtVerticesChanged;
private bool blockevents; private bool blockevents;
@ -21,6 +22,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } } public bool ContinuousDrawing { get { return continuousdrawing.Checked; } set { continuousdrawing.Checked = value; } }
public bool ShowGuidelines { get { return showguidelines.Checked; } set { showguidelines.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 RadialDrawing { get { return radialdrawing.Checked; } set { radialdrawing.Checked = value; } }
public bool PlaceThingsAtVertices { get { return placethingsatvertices.Checked; } set { placethingsatvertices.Checked = value; } }
public DrawRectangleOptionsPanel() public DrawRectangleOptionsPanel()
{ {
@ -36,6 +38,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.AddButton(continuousdrawing); General.Interface.AddButton(continuousdrawing);
General.Interface.AddButton(showguidelines); General.Interface.AddButton(showguidelines);
General.Interface.AddButton(radialdrawing); General.Interface.AddButton(radialdrawing);
General.Interface.AddButton(placethingsatvertices);
General.Interface.AddButton(toolStripSeparator1); General.Interface.AddButton(toolStripSeparator1);
General.Interface.AddButton(radiuslabel); General.Interface.AddButton(radiuslabel);
General.Interface.AddButton(radius); General.Interface.AddButton(radius);
@ -55,6 +58,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
General.Interface.RemoveButton(radiuslabel); General.Interface.RemoveButton(radiuslabel);
General.Interface.RemoveButton(toolStripSeparator1); General.Interface.RemoveButton(toolStripSeparator1);
General.Interface.RemoveButton(showguidelines); General.Interface.RemoveButton(showguidelines);
General.Interface.RemoveButton(placethingsatvertices);
General.Interface.RemoveButton(continuousdrawing); General.Interface.RemoveButton(continuousdrawing);
General.Interface.RemoveButton(radialdrawing); General.Interface.RemoveButton(radialdrawing);
General.Interface.EndToolbarUpdate(); General.Interface.EndToolbarUpdate();
@ -91,5 +95,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty); if(OnRadialDrawingChanged != null) OnRadialDrawingChanged(radialdrawing.Checked, EventArgs.Empty);
} }
private void placethingsatvertices_CheckedChanged(object sender, EventArgs e)
{
if (OnPlaceThingsAtVerticesChanged != null) OnPlaceThingsAtVerticesChanged(placethingsatvertices.Checked, EventArgs.Empty);
}
} }
} }