feat(nest-info): redesign Edit Nest and share plate settings with Edit Plate

The Info tab showed the thickness name twice: the thickness box's list label
("1/4" - 0.25") and the separate Thickness name box. The box now shows the bare
decimal with a Name box beside it; the list still names each entry, and a
picked entry keeps its name when the box switches to the number. Fields are
grouped into Nest and Material sections and the dates are one gray line.

The Defaults tab and Edit Plate edited the same size, spacing and quadrant
with duplicated controls, and the Defaults tab always stepped spacing by 0.25
even in millimeters. Both now host one PlateSettingsEditor; the forms stay
separate because each has its own extras (quantity and outline, or use for
new nests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-12-02 22:16:47 -05:00
1 parent 037d154a91
commit 3edf65524f
11 files changed
+1032 -1164

No files matched your search

+2 -1
View File
@@ -117,7 +117,8 @@ public static partial class StandardThicknesses
&& double.IsFinite(value) && value >= 0;
}
private static string FormatNumber(double value, Units units) =>
/// <summary>The bare number for <paramref name="value"/>, without a listed name.</summary>
public static string FormatNumber(double value, Units units) =>
value.ToString(units == Units.Millimeters ? "0.###" : "0.####", CultureInfo.CurrentCulture);
/// <summary>Reads "3/16", "1-1/4" or "1 1/4\"" as inches; null when not a fraction.</summary>
@@ -60,7 +60,7 @@ public class EditNestInfoFormTests
var thickness = (OpenNest.Controls.ThicknessComboBox)form.Controls.Find("thicknessBox", true).Single();
var apply = form.Controls.Find("applyButton", true).Single();
Assert.Equal("1/4\" - 0.25", thickness.Text);
Assert.Equal("0.25", thickness.Text);
thickness.SelectedItem = "16 ga - 0.0598";
Assert.Equal(0.0598, form.Thickness);
Assert.True(apply.Enabled);
@@ -108,6 +108,10 @@ public class EditNestInfoFormTests
thickness.SelectedItem = "16 ga - 0.0598";
Assert.Equal("16 ga", form.ThicknessName);
// The box then shows the pick as its bare number, beside the name, which stays.
thickness.Text = "0.0598";
Assert.Equal("16 ga", form.ThicknessName);
// A typed name stays through a material change, not through a new thickness.
thickness.Text = "0.135";
form.ThicknessName = "Ten";
@@ -18,7 +18,7 @@ public class EditPlateFormOutlineTests
{
var plate = new Plate(60, 120);
using var form = new EditPlateForm(plate);
var size = (TextBox)form.Controls.Find("textBoxSize", true)[0];
var size = (TextBox)form.Controls.Find("sizeBox", true)[0];
var clear = (Button)form.Controls.Find("buttonClearOutline", true)[0];
Assert.False(size.ReadOnly);
Assert.False(clear.Enabled);
@@ -42,7 +42,7 @@ public class EditPlateFormOutlineTests
{
var plate = new Plate { Outline = Ell(), Quadrant = 2 };
using var form = new EditPlateForm(plate);
var size = (TextBox)form.Controls.Find("textBoxSize", true)[0];
var size = (TextBox)form.Controls.Find("sizeBox", true)[0];
Assert.True(size.ReadOnly);
form.Outline = null; // what Clear does
+331
View File
@@ -0,0 +1,331 @@
namespace OpenNest.Controls
{
partial class PlateSettingsEditor
{
/// <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.sizeTable = new System.Windows.Forms.TableLayoutPanel();
this.labelSize = new System.Windows.Forms.Label();
this.sizeBox = new System.Windows.Forms.TextBox();
this.labelPartSpacing = new System.Windows.Forms.Label();
this.partSpacingBox = new OpenNest.Controls.NumericUpDown();
this.edgeSpacingGroup = new System.Windows.Forms.GroupBox();
this.edgeSpacingTable = new System.Windows.Forms.TableLayoutPanel();
this.labelEdgeSpacingLeft = new System.Windows.Forms.Label();
this.labelEdgeSpacingTop = new System.Windows.Forms.Label();
this.labelEdgeSpacingRight = new System.Windows.Forms.Label();
this.labelEdgeSpacingBottom = new System.Windows.Forms.Label();
this.leftSpacingBox = new OpenNest.Controls.NumericUpDown();
this.topSpacingBox = new OpenNest.Controls.NumericUpDown();
this.rightSpacingBox = new OpenNest.Controls.NumericUpDown();
this.bottomSpacingBox = new OpenNest.Controls.NumericUpDown();
this.quadrantGroup = new System.Windows.Forms.GroupBox();
this.quadrantSelect = new OpenNest.Controls.QuadrantSelect();
this.sizeTable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.partSpacingBox)).BeginInit();
this.edgeSpacingGroup.SuspendLayout();
this.edgeSpacingTable.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.leftSpacingBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.topSpacingBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rightSpacingBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bottomSpacingBox)).BeginInit();
this.quadrantGroup.SuspendLayout();
this.SuspendLayout();
//
// sizeTable
//
this.sizeTable.ColumnCount = 2;
this.sizeTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 104F));
this.sizeTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.sizeTable.Controls.Add(this.labelSize, 0, 0);
this.sizeTable.Controls.Add(this.sizeBox, 1, 0);
this.sizeTable.Controls.Add(this.labelPartSpacing, 0, 1);
this.sizeTable.Controls.Add(this.partSpacingBox, 1, 1);
this.sizeTable.Location = new System.Drawing.Point(0, 0);
this.sizeTable.Name = "sizeTable";
this.sizeTable.RowCount = 2;
this.sizeTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.sizeTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.sizeTable.Size = new System.Drawing.Size(264, 64);
this.sizeTable.TabIndex = 0;
//
// labelSize
//
this.labelSize.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelSize.AutoSize = true;
this.labelSize.Name = "labelSize";
this.labelSize.TabIndex = 0;
this.labelSize.Text = "Size :";
//
// sizeBox
//
this.sizeBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.sizeBox.Name = "sizeBox";
this.sizeBox.Size = new System.Drawing.Size(160, 22);
this.sizeBox.TabIndex = 1;
this.sizeBox.TextChanged += new System.EventHandler(this.sizeBox_TextChanged);
//
// labelPartSpacing
//
this.labelPartSpacing.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelPartSpacing.AutoSize = true;
this.labelPartSpacing.Name = "labelPartSpacing";
this.labelPartSpacing.TabIndex = 2;
this.labelPartSpacing.Text = "Part Spacing :";
//
// partSpacingBox
//
this.partSpacingBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.partSpacingBox.DecimalPlaces = 4;
this.partSpacingBox.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.partSpacingBox.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.partSpacingBox.Name = "partSpacingBox";
this.partSpacingBox.Size = new System.Drawing.Size(160, 22);
this.partSpacingBox.Suffix = "";
this.partSpacingBox.TabIndex = 3;
this.partSpacingBox.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// edgeSpacingGroup
//
this.edgeSpacingGroup.Controls.Add(this.edgeSpacingTable);
this.edgeSpacingGroup.Location = new System.Drawing.Point(0, 70);
this.edgeSpacingGroup.Name = "edgeSpacingGroup";
this.edgeSpacingGroup.Padding = new System.Windows.Forms.Padding(6, 4, 6, 6);
this.edgeSpacingGroup.Size = new System.Drawing.Size(270, 166);
this.edgeSpacingGroup.TabIndex = 1;
this.edgeSpacingGroup.TabStop = false;
this.edgeSpacingGroup.Text = "Edge Spacing";
//
// edgeSpacingTable
//
this.edgeSpacingTable.ColumnCount = 2;
this.edgeSpacingTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.edgeSpacingTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.edgeSpacingTable.Controls.Add(this.labelEdgeSpacingLeft, 0, 0);
this.edgeSpacingTable.Controls.Add(this.leftSpacingBox, 1, 0);
this.edgeSpacingTable.Controls.Add(this.labelEdgeSpacingTop, 0, 1);
this.edgeSpacingTable.Controls.Add(this.topSpacingBox, 1, 1);
this.edgeSpacingTable.Controls.Add(this.labelEdgeSpacingRight, 0, 2);
this.edgeSpacingTable.Controls.Add(this.rightSpacingBox, 1, 2);
this.edgeSpacingTable.Controls.Add(this.labelEdgeSpacingBottom, 0, 3);
this.edgeSpacingTable.Controls.Add(this.bottomSpacingBox, 1, 3);
this.edgeSpacingTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.edgeSpacingTable.Name = "edgeSpacingTable";
this.edgeSpacingTable.RowCount = 4;
this.edgeSpacingTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.edgeSpacingTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.edgeSpacingTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.edgeSpacingTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.edgeSpacingTable.TabIndex = 0;
//
// labelEdgeSpacingLeft
//
this.labelEdgeSpacingLeft.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelEdgeSpacingLeft.AutoSize = true;
this.labelEdgeSpacingLeft.Name = "labelEdgeSpacingLeft";
this.labelEdgeSpacingLeft.TabIndex = 0;
this.labelEdgeSpacingLeft.Text = "Left :";
//
// labelEdgeSpacingTop
//
this.labelEdgeSpacingTop.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelEdgeSpacingTop.AutoSize = true;
this.labelEdgeSpacingTop.Name = "labelEdgeSpacingTop";
this.labelEdgeSpacingTop.TabIndex = 2;
this.labelEdgeSpacingTop.Text = "Top :";
//
// labelEdgeSpacingRight
//
this.labelEdgeSpacingRight.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelEdgeSpacingRight.AutoSize = true;
this.labelEdgeSpacingRight.Name = "labelEdgeSpacingRight";
this.labelEdgeSpacingRight.TabIndex = 4;
this.labelEdgeSpacingRight.Text = "Right :";
//
// labelEdgeSpacingBottom
//
this.labelEdgeSpacingBottom.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelEdgeSpacingBottom.AutoSize = true;
this.labelEdgeSpacingBottom.Name = "labelEdgeSpacingBottom";
this.labelEdgeSpacingBottom.TabIndex = 6;
this.labelEdgeSpacingBottom.Text = "Bottom :";
//
// leftSpacingBox
//
this.leftSpacingBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.leftSpacingBox.DecimalPlaces = 4;
this.leftSpacingBox.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.leftSpacingBox.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.leftSpacingBox.Name = "leftSpacingBox";
this.leftSpacingBox.Size = new System.Drawing.Size(160, 22);
this.leftSpacingBox.Suffix = "";
this.leftSpacingBox.TabIndex = 1;
this.leftSpacingBox.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// topSpacingBox
//
this.topSpacingBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.topSpacingBox.DecimalPlaces = 4;
this.topSpacingBox.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.topSpacingBox.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.topSpacingBox.Name = "topSpacingBox";
this.topSpacingBox.Size = new System.Drawing.Size(160, 22);
this.topSpacingBox.Suffix = "";
this.topSpacingBox.TabIndex = 3;
this.topSpacingBox.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// rightSpacingBox
//
this.rightSpacingBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.rightSpacingBox.DecimalPlaces = 4;
this.rightSpacingBox.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.rightSpacingBox.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.rightSpacingBox.Name = "rightSpacingBox";
this.rightSpacingBox.Size = new System.Drawing.Size(160, 22);
this.rightSpacingBox.Suffix = "";
this.rightSpacingBox.TabIndex = 5;
this.rightSpacingBox.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// bottomSpacingBox
//
this.bottomSpacingBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.bottomSpacingBox.DecimalPlaces = 4;
this.bottomSpacingBox.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.bottomSpacingBox.Maximum = new decimal(new int[] {
999999,
0,
0,
0});
this.bottomSpacingBox.Name = "bottomSpacingBox";
this.bottomSpacingBox.Size = new System.Drawing.Size(160, 22);
this.bottomSpacingBox.Suffix = "";
this.bottomSpacingBox.TabIndex = 7;
this.bottomSpacingBox.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// quadrantGroup
//
this.quadrantGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.quadrantGroup.Controls.Add(this.quadrantSelect);
this.quadrantGroup.Location = new System.Drawing.Point(282, 0);
this.quadrantGroup.Name = "quadrantGroup";
this.quadrantGroup.Padding = new System.Windows.Forms.Padding(8, 6, 8, 8);
this.quadrantGroup.Size = new System.Drawing.Size(268, 236);
this.quadrantGroup.TabIndex = 2;
this.quadrantGroup.TabStop = false;
this.quadrantGroup.Text = "Quadrant";
//
// quadrantSelect
//
this.quadrantSelect.BackColor = System.Drawing.Color.White;
this.quadrantSelect.Dock = System.Windows.Forms.DockStyle.Fill;
this.quadrantSelect.Name = "quadrantSelect";
this.quadrantSelect.Quadrant = 1;
this.quadrantSelect.TabIndex = 0;
this.quadrantSelect.Text = "quadrantSelect";
//
// PlateSettingsEditor
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.Controls.Add(this.quadrantGroup);
this.Controls.Add(this.edgeSpacingGroup);
this.Controls.Add(this.sizeTable);
this.Name = "PlateSettingsEditor";
this.Size = new System.Drawing.Size(550, 236);
this.sizeTable.ResumeLayout(false);
this.sizeTable.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.partSpacingBox)).EndInit();
this.edgeSpacingGroup.ResumeLayout(false);
this.edgeSpacingTable.ResumeLayout(false);
this.edgeSpacingTable.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.leftSpacingBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.topSpacingBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rightSpacingBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bottomSpacingBox)).EndInit();
this.quadrantGroup.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel sizeTable;
private System.Windows.Forms.Label labelSize;
private System.Windows.Forms.TextBox sizeBox;
private System.Windows.Forms.Label labelPartSpacing;
private OpenNest.Controls.NumericUpDown partSpacingBox;
private System.Windows.Forms.GroupBox edgeSpacingGroup;
private System.Windows.Forms.TableLayoutPanel edgeSpacingTable;
private System.Windows.Forms.Label labelEdgeSpacingLeft;
private System.Windows.Forms.Label labelEdgeSpacingTop;
private System.Windows.Forms.Label labelEdgeSpacingRight;
private System.Windows.Forms.Label labelEdgeSpacingBottom;
private OpenNest.Controls.NumericUpDown leftSpacingBox;
private OpenNest.Controls.NumericUpDown topSpacingBox;
private OpenNest.Controls.NumericUpDown rightSpacingBox;
private OpenNest.Controls.NumericUpDown bottomSpacingBox;
private System.Windows.Forms.GroupBox quadrantGroup;
private OpenNest.Controls.QuadrantSelect quadrantSelect;
}
}
+121
View File
@@ -0,0 +1,121 @@
using System;
using System.ComponentModel;
using System.Windows.Forms;
using OpenNest.Desktop;
namespace OpenNest.Controls
{
/// <summary>
/// The settings a plate is laid out by: its size, part spacing, edge spacing and quadrant.
/// Edit Plate edits one plate's; Edit Nest's Defaults tab edits the ones new plates start from.
/// </summary>
public partial class PlateSettingsEditor : UserControl
{
private Units units = Units.Inches;
public PlateSettingsEditor()
{
InitializeComponent();
UpdateUnits();
}
/// <summary>The size box's text changed.</summary>
public event EventHandler SizeTextChanged;
/// <summary>A spacing value changed.</summary>
public event EventHandler SpacingChanged;
/// <summary>The units the spacing boxes show and step in.</summary>
[DefaultValue(Units.Inches)]
public Units Units
{
get { return units; }
set
{
units = value;
UpdateUnits();
}
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string SizeText
{
get { return sizeBox.Text; }
set { sizeBox.Text = value; }
}
/// <summary>True while something else, such as a sheet outline, sets the size.</summary>
[DefaultValue(false)]
public bool SizeReadOnly
{
get { return sizeBox.ReadOnly; }
set { sizeBox.ReadOnly = value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double PartSpacing
{
get { return (double)partSpacingBox.Value; }
set { partSpacingBox.Value = (decimal)value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double LeftSpacing
{
get { return (double)leftSpacingBox.Value; }
set { leftSpacingBox.Value = (decimal)value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double TopSpacing
{
get { return (double)topSpacingBox.Value; }
set { topSpacingBox.Value = (decimal)value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double RightSpacing
{
get { return (double)rightSpacingBox.Value; }
set { rightSpacingBox.Value = (decimal)value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double BottomSpacing
{
get { return (double)bottomSpacingBox.Value; }
set { bottomSpacingBox.Value = (decimal)value; }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Quadrant
{
get { return quadrantSelect.Quadrant; }
set { quadrantSelect.Quadrant = value; }
}
private void UpdateUnits()
{
var suffix = " " + UnitsHelper.GetShortString(units);
var increment = (decimal)PlateEditValues.SpacingIncrement(units);
foreach (var box in new[] { partSpacingBox, leftSpacingBox, topSpacingBox, rightSpacingBox, bottomSpacingBox })
{
box.Suffix = suffix;
box.Increment = increment;
box.Invalidate(true);
}
}
private void sizeBox_TextChanged(object sender, EventArgs e) => SizeTextChanged?.Invoke(this, EventArgs.Empty);
private void spacing_ValueChanged(object sender, EventArgs e) => SpacingChanged?.Invoke(this, EventArgs.Empty);
}
}
+20 -1
View File
@@ -48,12 +48,19 @@ namespace OpenNest.Controls
public bool IsValid => TryGetValue(out _);
/// <summary>The thickness in <see cref="Units"/>; 0 when blank or unreadable.</summary>
/// <summary>
/// False shows a thickness as its bare number ("0.25") once picked or left, for a box
/// with its own name field beside it; the list still names each entry.
/// </summary>
[DefaultValue(true)]
public bool ShowNames { get; set; } = true;
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double Value
{
get { return TryGetValue(out var value) ? value : 0; }
set { Text = StandardThicknesses.Format(value, units); }
set { Text = ShowNames ? StandardThicknesses.Format(value, units) : StandardThicknesses.FormatNumber(value, units); }
}
public bool TryGetValue(out double value) => StandardThicknesses.TryParse(Text, units, out value);
@@ -85,6 +92,18 @@ namespace OpenNest.Controls
base.OnLeave(e);
}
protected override void OnDropDownClosed(EventArgs e)
{
base.OnDropDownClosed(e);
// The edit text takes the picked label after this event, so show the number after it.
if (!ShowNames && IsHandleCreated)
BeginInvoke(() =>
{
if (!IsDisposed && TryGetValue(out var value) && Text.Trim().Length > 0)
Value = value;
});
}
private void FillItems()
{
var text = Text;
File diff suppressed because it is too large. Load diff
+32 -39
View File
@@ -46,14 +46,14 @@ namespace OpenNest.Forms
thicknessBox.TextChanged += (sender, e) =>
{
EnableCheck();
RefreshThicknessName();
RefreshThicknessName(thicknessEdited: true);
};
materialBox.TextChanged += (sender, e) =>
{
RefreshGrades();
RefreshThicknessName();
RefreshThicknessName(thicknessEdited: false);
};
gradeBox.TextChanged += (sender, e) => RefreshThicknessName();
gradeBox.TextChanged += (sender, e) => RefreshThicknessName(thicknessEdited: false);
EnableCheck();
}
@@ -114,8 +114,8 @@ namespace OpenNest.Forms
public string SizeString
{
get { return sizeBox.Text; }
set { sizeBox.Text = value; }
get { return plateSettings.SizeText; }
set { plateSettings.SizeText = value; }
}
public DateTime DateCreated
@@ -124,7 +124,7 @@ namespace OpenNest.Forms
set
{
dateCreated = value;
textBox1.Text = dateCreated.ToShortDateString();
UpdateDates();
}
}
@@ -134,38 +134,41 @@ namespace OpenNest.Forms
set
{
dateLastModified = value;
textBox2.Text = dateLastModified.ToShortDateString();
UpdateDates();
}
}
private void UpdateDates() =>
datesLabel.Text = $"Created {dateCreated.ToShortDateString()} Last modified {dateLastModified.ToShortDateString()}";
public double LeftSpacing
{
get { return (double)leftSpacingBox.Value; }
set { leftSpacingBox.Value = (decimal)value; }
get { return plateSettings.LeftSpacing; }
set { plateSettings.LeftSpacing = value; }
}
public double TopSpacing
{
get { return (double)topSpacingBox.Value; }
set { topSpacingBox.Value = (decimal)value; }
get { return plateSettings.TopSpacing; }
set { plateSettings.TopSpacing = value; }
}
public double RightSpacing
{
get { return (double)rightSpacingBox.Value; }
set { rightSpacingBox.Value = (decimal)value; }
get { return plateSettings.RightSpacing; }
set { plateSettings.RightSpacing = value; }
}
public double BottomSpacing
{
get { return (double)bottomSpacingBox.Value; }
set { bottomSpacingBox.Value = (decimal)value; }
get { return plateSettings.BottomSpacing; }
set { plateSettings.BottomSpacing = value; }
}
public double PartSpacing
{
get { return (double)partSpacingBox.Value; }
set { partSpacingBox.Value = (decimal)value; }
get { return plateSettings.PartSpacing; }
set { plateSettings.PartSpacing = value; }
}
public double Thickness
@@ -192,10 +195,10 @@ namespace OpenNest.Forms
public void SetThicknessMachines(IEnumerable<MachineConfig> machines)
{
thicknessMachines = (machines ?? Enumerable.Empty<MachineConfig>()).Where(m => m != null).ToList();
RefreshThicknessName();
RefreshThicknessName(thicknessEdited: false);
}
private void RefreshThicknessName()
private void RefreshThicknessName(bool thicknessEdited)
{
if (!thicknessBox.TryGetValue(out var value))
return;
@@ -204,6 +207,9 @@ namespace OpenNest.Forms
var text = thicknessBox.Text.Trim();
var picked = StandardThicknesses.Entries.FirstOrDefault(entry =>
string.Equals(StandardThicknesses.Label(entry, GetUnits()), text, StringComparison.OrdinalIgnoreCase));
// The box then shows a picked entry as its bare number: the same thickness keeps its name.
if (thicknessEdited && picked == null && namedThickness == value)
return;
var suggested = picked?.Name
?? ThicknessNames.For(thicknessMachines, MaterialName, MaterialGrade, value, GetUnits());
var current = ThicknessName;
@@ -287,11 +293,11 @@ namespace OpenNest.Forms
switch (units)
{
case OpenNest.Units.Inches:
radioButton1.Checked = true;
inchesButton.Checked = true;
break;
case OpenNest.Units.Millimeters:
radioButton2.Checked = true;
millimetersButton.Checked = true;
break;
}
@@ -300,10 +306,10 @@ namespace OpenNest.Forms
public Units GetUnits()
{
if (radioButton1.Checked)
if (inchesButton.Checked)
return Units.Inches;
if (radioButton2.Checked)
if (millimetersButton.Checked)
return Units.Millimeters;
return OpenNest.Units.Inches;
@@ -311,27 +317,14 @@ namespace OpenNest.Forms
private void UpdateUnitSuffix()
{
var unitBoxes = new Controls.NumericUpDown[]
{
partSpacingBox,
leftSpacingBox,
topSpacingBox,
rightSpacingBox,
bottomSpacingBox,
};
var unitString = " " + UnitsHelper.GetShortString(GetUnits());
foreach (var box in unitBoxes)
box.Suffix = unitString;
plateSettings.Units = GetUnits();
thicknessBox.Units = GetUnits();
}
public int Quadrant
{
get { return quadrantSelect1.Quadrant; }
set { quadrantSelect1.Quadrant = value; }
get { return plateSettings.Quadrant; }
set { plateSettings.Quadrant = value; }
}
public void EnableCheck() => applyButton.Enabled = GetValues().CanApply(thicknessBox.IsValid);
+93 -373
View File
@@ -28,375 +28,121 @@
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.labelQty = new System.Windows.Forms.Label();
this.labelSize = new System.Windows.Forms.Label();
this.textBoxSize = new System.Windows.Forms.TextBox();
this.labelPartSpacing = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.labelEdgeSpacingLeft = new System.Windows.Forms.Label();
this.labelEdgeSpacingTop = new System.Windows.Forms.Label();
this.labelEdgeSpacingRight = new System.Windows.Forms.Label();
this.labelEdgeSpacingBottom = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.applyButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.bottomPanel1 = new OpenNest.Controls.BottomPanel();
this.quadrantSelect1 = new OpenNest.Controls.QuadrantSelect();
this.numericUpDownQty = new OpenNest.Controls.NumericUpDown();
this.labelOutline = new System.Windows.Forms.Label();
this.buttonImportOutline = new System.Windows.Forms.Button();
this.buttonClearOutline = new System.Windows.Forms.Button();
this.numericUpDownEdgeSpacingLeft = new OpenNest.Controls.NumericUpDown();
this.numericUpDownEdgeSpacingTop = new OpenNest.Controls.NumericUpDown();
this.numericUpDownEdgeSpacingRight = new OpenNest.Controls.NumericUpDown();
this.numericUpDownEdgeSpacingBottom = new OpenNest.Controls.NumericUpDown();
this.numericUpDownQty = new OpenNest.Controls.NumericUpDown();
this.numericUpDownPartSpacing = new OpenNest.Controls.NumericUpDown();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.groupBox2.SuspendLayout();
this.bottomPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingLeft)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingTop)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).BeginInit();
this.plateSettings = new OpenNest.Controls.PlateSettingsEditor();
this.bottomPanel1 = new OpenNest.Controls.BottomPanel();
this.applyButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).BeginInit();
this.bottomPanel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.labelQty, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.labelSize, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.textBoxSize, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownQty, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.labelPartSpacing, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownPartSpacing, 1, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(18, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(236, 108);
this.tableLayoutPanel1.TabIndex = 0;
//
// labelQty
//
this.labelQty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelQty.AutoSize = true;
this.labelQty.Location = new System.Drawing.Point(3, 46);
this.labelQty.Name = "labelQty";
this.labelQty.Size = new System.Drawing.Size(91, 16);
this.labelQty.TabIndex = 2;
this.labelQty.Text = "Quantity :";
this.labelQty.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelSize
//
this.labelSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelSize.AutoSize = true;
this.labelSize.Location = new System.Drawing.Point(3, 10);
this.labelSize.Name = "labelSize";
this.labelSize.Size = new System.Drawing.Size(91, 16);
this.labelSize.TabIndex = 0;
this.labelSize.Text = "Size :";
this.labelSize.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// textBoxSize
//
this.textBoxSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBoxSize.Location = new System.Drawing.Point(100, 7);
this.textBoxSize.Name = "textBoxSize";
this.textBoxSize.Size = new System.Drawing.Size(133, 22);
this.textBoxSize.TabIndex = 1;
this.textBoxSize.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// labelPartSpacing
//
this.labelPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelPartSpacing.AutoSize = true;
this.labelPartSpacing.Location = new System.Drawing.Point(3, 118);
this.labelPartSpacing.Name = "labelPartSpacing";
this.labelPartSpacing.Size = new System.Drawing.Size(91, 16);
this.labelPartSpacing.TabIndex = 6;
this.labelPartSpacing.Text = "Part Spacing :";
this.labelPartSpacing.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tableLayoutPanel2);
this.groupBox1.Location = new System.Drawing.Point(12, 173);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(248, 175);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Edge Spacing";
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.labelEdgeSpacingLeft, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.labelEdgeSpacingTop, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.labelEdgeSpacingRight, 0, 2);
this.tableLayoutPanel2.Controls.Add(this.labelEdgeSpacingBottom, 0, 3);
this.tableLayoutPanel2.Controls.Add(this.numericUpDownEdgeSpacingLeft, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.numericUpDownEdgeSpacingTop, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.numericUpDownEdgeSpacingRight, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.numericUpDownEdgeSpacingBottom, 1, 3);
this.tableLayoutPanel2.Location = new System.Drawing.Point(6, 21);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 4;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(236, 148);
this.tableLayoutPanel2.TabIndex = 0;
//
// labelEdgeSpacingLeft
//
this.labelEdgeSpacingLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelEdgeSpacingLeft.AutoSize = true;
this.labelEdgeSpacingLeft.Location = new System.Drawing.Point(3, 10);
this.labelEdgeSpacingLeft.Name = "labelEdgeSpacingLeft";
this.labelEdgeSpacingLeft.Size = new System.Drawing.Size(56, 16);
this.labelEdgeSpacingLeft.TabIndex = 0;
this.labelEdgeSpacingLeft.Text = "Left :";
this.labelEdgeSpacingLeft.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelEdgeSpacingTop
//
this.labelEdgeSpacingTop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelEdgeSpacingTop.AutoSize = true;
this.labelEdgeSpacingTop.Location = new System.Drawing.Point(3, 47);
this.labelEdgeSpacingTop.Name = "labelEdgeSpacingTop";
this.labelEdgeSpacingTop.Size = new System.Drawing.Size(56, 16);
this.labelEdgeSpacingTop.TabIndex = 2;
this.labelEdgeSpacingTop.Text = "Top :";
this.labelEdgeSpacingTop.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelEdgeSpacingRight
//
this.labelEdgeSpacingRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelEdgeSpacingRight.AutoSize = true;
this.labelEdgeSpacingRight.Location = new System.Drawing.Point(3, 84);
this.labelEdgeSpacingRight.Name = "labelEdgeSpacingRight";
this.labelEdgeSpacingRight.Size = new System.Drawing.Size(56, 16);
this.labelEdgeSpacingRight.TabIndex = 4;
this.labelEdgeSpacingRight.Text = "Right :";
this.labelEdgeSpacingRight.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelEdgeSpacingBottom
//
this.labelEdgeSpacingBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelEdgeSpacingBottom.AutoSize = true;
this.labelEdgeSpacingBottom.Location = new System.Drawing.Point(3, 121);
this.labelEdgeSpacingBottom.Name = "labelEdgeSpacingBottom";
this.labelEdgeSpacingBottom.Size = new System.Drawing.Size(56, 16);
this.labelEdgeSpacingBottom.TabIndex = 6;
this.labelEdgeSpacingBottom.Text = "Bottom :";
this.labelEdgeSpacingBottom.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.quadrantSelect1);
this.groupBox2.Location = new System.Drawing.Point(277, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(261, 209);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Quadrant";
//
// applyButton
//
this.applyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.applyButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.applyButton.Enabled = false;
this.applyButton.Location = new System.Drawing.Point(352, 11);
this.applyButton.Name = "applyButton";
this.applyButton.Size = new System.Drawing.Size(90, 28);
this.applyButton.TabIndex = 3;
this.applyButton.Text = "Done";
this.applyButton.UseVisualStyleBackColor = true;
this.applyButton.Click += new System.EventHandler(this.button1_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(448, 11);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(90, 28);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// bottomPanel1
//
this.bottomPanel1.Controls.Add(this.applyButton);
this.bottomPanel1.Controls.Add(this.cancelButton);
this.bottomPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.bottomPanel1.Location = new System.Drawing.Point(0, 359);
this.bottomPanel1.Name = "bottomPanel1";
this.bottomPanel1.Size = new System.Drawing.Size(550, 50);
this.bottomPanel1.TabIndex = 7;
//
// labelQty
//
this.labelQty.AutoSize = true;
this.labelQty.Location = new System.Drawing.Point(15, 19);
this.labelQty.Name = "labelQty";
this.labelQty.TabIndex = 0;
this.labelQty.Text = "Quantity :";
//
// numericUpDownQty
//
this.numericUpDownQty.Location = new System.Drawing.Point(119, 16);
this.numericUpDownQty.Name = "numericUpDownQty";
this.numericUpDownQty.Size = new System.Drawing.Size(154, 22);
this.numericUpDownQty.Suffix = "";
this.numericUpDownQty.TabIndex = 1;
//
// labelOutline
//
this.labelOutline.AutoSize = true;
this.labelOutline.Location = new System.Drawing.Point(21, 131);
//
this.labelOutline.AutoEllipsis = true;
this.labelOutline.Location = new System.Drawing.Point(294, 19);
this.labelOutline.Name = "labelOutline";
this.labelOutline.Size = new System.Drawing.Size(103, 16);
this.labelOutline.TabIndex = 8;
this.labelOutline.Size = new System.Drawing.Size(132, 18);
this.labelOutline.TabIndex = 2;
this.labelOutline.Text = "Rectangular sheet";
//
//
// buttonImportOutline
//
this.buttonImportOutline.Location = new System.Drawing.Point(130, 125);
//
this.buttonImportOutline.Location = new System.Drawing.Point(430, 13);
this.buttonImportOutline.Name = "buttonImportOutline";
this.buttonImportOutline.Size = new System.Drawing.Size(70, 28);
this.buttonImportOutline.TabIndex = 9;
this.buttonImportOutline.Size = new System.Drawing.Size(72, 28);
this.buttonImportOutline.TabIndex = 3;
this.buttonImportOutline.Text = "Outline...";
this.buttonImportOutline.UseVisualStyleBackColor = true;
this.buttonImportOutline.Click += new System.EventHandler(this.buttonImportOutline_Click);
//
//
// buttonClearOutline
//
//
this.buttonClearOutline.Enabled = false;
this.buttonClearOutline.Location = new System.Drawing.Point(204, 125);
this.buttonClearOutline.Location = new System.Drawing.Point(506, 13);
this.buttonClearOutline.Name = "buttonClearOutline";
this.buttonClearOutline.Size = new System.Drawing.Size(56, 28);
this.buttonClearOutline.TabIndex = 10;
this.buttonClearOutline.TabIndex = 4;
this.buttonClearOutline.Text = "Clear";
this.buttonClearOutline.UseVisualStyleBackColor = true;
this.buttonClearOutline.Click += new System.EventHandler(this.buttonClearOutline_Click);
//
// quadrantSelect1
//
this.quadrantSelect1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.quadrantSelect1.Location = new System.Drawing.Point(6, 19);
this.quadrantSelect1.Name = "quadrantSelect1";
this.quadrantSelect1.Quadrant = 1;
this.quadrantSelect1.Size = new System.Drawing.Size(249, 184);
this.quadrantSelect1.TabIndex = 5;
this.quadrantSelect1.Text = "quadrantSelect1";
//
// numericUpDownEdgeSpacingLeft
//
this.numericUpDownEdgeSpacingLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownEdgeSpacingLeft.DecimalPlaces = 4;
this.numericUpDownEdgeSpacingLeft.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownEdgeSpacingLeft.Location = new System.Drawing.Point(65, 7);
this.numericUpDownEdgeSpacingLeft.Name = "numericUpDownEdgeSpacingLeft";
this.numericUpDownEdgeSpacingLeft.Size = new System.Drawing.Size(168, 22);
this.numericUpDownEdgeSpacingLeft.Suffix = "";
this.numericUpDownEdgeSpacingLeft.TabIndex = 1;
this.numericUpDownEdgeSpacingLeft.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// numericUpDownEdgeSpacingTop
//
this.numericUpDownEdgeSpacingTop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownEdgeSpacingTop.DecimalPlaces = 4;
this.numericUpDownEdgeSpacingTop.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownEdgeSpacingTop.Location = new System.Drawing.Point(65, 44);
this.numericUpDownEdgeSpacingTop.Name = "numericUpDownEdgeSpacingTop";
this.numericUpDownEdgeSpacingTop.Size = new System.Drawing.Size(168, 22);
this.numericUpDownEdgeSpacingTop.Suffix = "";
this.numericUpDownEdgeSpacingTop.TabIndex = 3;
this.numericUpDownEdgeSpacingTop.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// numericUpDownEdgeSpacingRight
//
this.numericUpDownEdgeSpacingRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownEdgeSpacingRight.DecimalPlaces = 4;
this.numericUpDownEdgeSpacingRight.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownEdgeSpacingRight.Location = new System.Drawing.Point(65, 81);
this.numericUpDownEdgeSpacingRight.Name = "numericUpDownEdgeSpacingRight";
this.numericUpDownEdgeSpacingRight.Size = new System.Drawing.Size(168, 22);
this.numericUpDownEdgeSpacingRight.Suffix = "";
this.numericUpDownEdgeSpacingRight.TabIndex = 5;
this.numericUpDownEdgeSpacingRight.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// numericUpDownEdgeSpacingBottom
//
this.numericUpDownEdgeSpacingBottom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownEdgeSpacingBottom.DecimalPlaces = 4;
this.numericUpDownEdgeSpacingBottom.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownEdgeSpacingBottom.Location = new System.Drawing.Point(65, 118);
this.numericUpDownEdgeSpacingBottom.Name = "numericUpDownEdgeSpacingBottom";
this.numericUpDownEdgeSpacingBottom.Size = new System.Drawing.Size(168, 22);
this.numericUpDownEdgeSpacingBottom.Suffix = "";
this.numericUpDownEdgeSpacingBottom.TabIndex = 7;
this.numericUpDownEdgeSpacingBottom.ValueChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// numericUpDownQty
//
this.numericUpDownQty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownQty.Location = new System.Drawing.Point(100, 43);
this.numericUpDownQty.Name = "numericUpDownQty";
this.numericUpDownQty.Size = new System.Drawing.Size(133, 22);
this.numericUpDownQty.Suffix = "";
this.numericUpDownQty.TabIndex = 3;
//
// numericUpDownPartSpacing
//
this.numericUpDownPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownPartSpacing.DecimalPlaces = 4;
this.numericUpDownPartSpacing.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownPartSpacing.Location = new System.Drawing.Point(100, 115);
this.numericUpDownPartSpacing.Name = "numericUpDownPartSpacing";
this.numericUpDownPartSpacing.Size = new System.Drawing.Size(133, 22);
this.numericUpDownPartSpacing.Suffix = "";
this.numericUpDownPartSpacing.TabIndex = 7;
//
// plateSettings
//
this.plateSettings.Location = new System.Drawing.Point(12, 50);
this.plateSettings.Name = "plateSettings";
this.plateSettings.Size = new System.Drawing.Size(550, 236);
this.plateSettings.TabIndex = 5;
this.plateSettings.SizeTextChanged += new System.EventHandler(this.plateSettings_SizeTextChanged);
this.plateSettings.SpacingChanged += new System.EventHandler(this.spacing_ValueChanged);
//
// bottomPanel1
//
this.bottomPanel1.Controls.Add(this.applyButton);
this.bottomPanel1.Controls.Add(this.cancelButton);
this.bottomPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.bottomPanel1.Location = new System.Drawing.Point(0, 298);
this.bottomPanel1.Name = "bottomPanel1";
this.bottomPanel1.Size = new System.Drawing.Size(574, 50);
this.bottomPanel1.TabIndex = 6;
//
// applyButton
//
this.applyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.applyButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.applyButton.Enabled = false;
this.applyButton.Location = new System.Drawing.Point(376, 11);
this.applyButton.Name = "applyButton";
this.applyButton.Size = new System.Drawing.Size(90, 28);
this.applyButton.TabIndex = 0;
this.applyButton.Text = "Done";
this.applyButton.UseVisualStyleBackColor = true;
this.applyButton.Click += new System.EventHandler(this.button1_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(472, 11);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(90, 28);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// EditPlateForm
//
//
this.AcceptButton = this.applyButton;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(550, 409);
this.Controls.Add(this.bottomPanel1);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.tableLayoutPanel1);
this.ClientSize = new System.Drawing.Size(574, 348);
this.Controls.Add(this.labelQty);
this.Controls.Add(this.numericUpDownQty);
this.Controls.Add(this.labelOutline);
this.Controls.Add(this.buttonImportOutline);
this.Controls.Add(this.buttonClearOutline);
this.Controls.Add(this.plateSettings);
this.Controls.Add(this.bottomPanel1);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
@@ -406,49 +152,23 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Plate";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.bottomPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingLeft)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingTop)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).EndInit();
this.bottomPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label labelSize;
private System.Windows.Forms.Button applyButton;
private System.Windows.Forms.Label labelQty;
private OpenNest.Controls.NumericUpDown numericUpDownQty;
private System.Windows.Forms.Label labelOutline;
private System.Windows.Forms.Button buttonImportOutline;
private System.Windows.Forms.Button buttonClearOutline;
private System.Windows.Forms.TextBox textBoxSize;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label labelEdgeSpacingLeft;
private System.Windows.Forms.Label labelEdgeSpacingTop;
private System.Windows.Forms.Label labelEdgeSpacingRight;
private System.Windows.Forms.Label labelEdgeSpacingBottom;
private Controls.NumericUpDown numericUpDownEdgeSpacingLeft;
private Controls.NumericUpDown numericUpDownEdgeSpacingTop;
private Controls.NumericUpDown numericUpDownEdgeSpacingRight;
private Controls.NumericUpDown numericUpDownEdgeSpacingBottom;
private OpenNest.Controls.PlateSettingsEditor plateSettings;
private OpenNest.Controls.BottomPanel bottomPanel1;
private System.Windows.Forms.Button applyButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Label labelQty;
private Controls.NumericUpDown numericUpDownQty;
private Controls.QuadrantSelect quadrantSelect1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label labelPartSpacing;
private Controls.NumericUpDown numericUpDownPartSpacing;
private Controls.BottomPanel bottomPanel1;
}
}
}
+19 -39
View File
@@ -52,62 +52,42 @@ namespace OpenNest.Forms
}
}
private void SetUnits(Units units)
{
string suffix = " " + UnitsHelper.GetShortString(units);
var increment = (decimal)PlateEditValues.SpacingIncrement(units);
var controls = new[]
{
numericUpDownPartSpacing,
numericUpDownEdgeSpacingBottom,
numericUpDownEdgeSpacingLeft,
numericUpDownEdgeSpacingRight,
numericUpDownEdgeSpacingTop,
};
foreach (var control in controls)
{
control.Suffix = suffix;
control.Increment = increment;
control.Invalidate(true);
}
}
private void SetUnits(Units units) => plateSettings.Units = units;
public string SizeString
{
get { return textBoxSize.Text; }
set { textBoxSize.Text = value; }
get { return plateSettings.SizeText; }
set { plateSettings.SizeText = value; }
}
public double LeftSpacing
{
get { return (double)numericUpDownEdgeSpacingLeft.Value; }
set { numericUpDownEdgeSpacingLeft.Value = (decimal)value; }
get { return plateSettings.LeftSpacing; }
set { plateSettings.LeftSpacing = value; }
}
public double TopSpacing
{
get { return (double)numericUpDownEdgeSpacingTop.Value; }
set { numericUpDownEdgeSpacingTop.Value = (decimal)value; }
get { return plateSettings.TopSpacing; }
set { plateSettings.TopSpacing = value; }
}
public double RightSpacing
{
get { return (double)numericUpDownEdgeSpacingRight.Value; }
set { numericUpDownEdgeSpacingRight.Value = (decimal)value; }
get { return plateSettings.RightSpacing; }
set { plateSettings.RightSpacing = value; }
}
public double BottomSpacing
{
get { return (double)numericUpDownEdgeSpacingBottom.Value; }
set { numericUpDownEdgeSpacingBottom.Value = (decimal)value; }
get { return plateSettings.BottomSpacing; }
set { plateSettings.BottomSpacing = value; }
}
public double PartSpacing
{
get { return (double)numericUpDownPartSpacing.Value; }
set { numericUpDownPartSpacing.Value = (decimal)value; }
get { return plateSettings.PartSpacing; }
set { plateSettings.PartSpacing = value; }
}
public int Quantity
@@ -118,8 +98,8 @@ namespace OpenNest.Forms
public int Quadrant
{
get { return quadrantSelect1.Quadrant; }
set { quadrantSelect1.Quadrant = value; }
get { return plateSettings.Quadrant; }
set { plateSettings.Quadrant = value; }
}
/// <summary>
@@ -133,10 +113,10 @@ namespace OpenNest.Forms
set
{
outline = value;
textBoxSize.ReadOnly = value != null;
plateSettings.SizeReadOnly = value != null;
buttonClearOutline.Enabled = value != null;
if (value != null)
textBoxSize.Text = value.Size.ToString(4);
plateSettings.SizeText = value.Size.ToString(4);
labelOutline.Text = PlateEditValues.OutlineText(value);
EnableCheck();
}
@@ -160,7 +140,7 @@ namespace OpenNest.Forms
private new void Load(Plate plate)
{
var values = PlateEditValues.FromPlate(plate);
textBoxSize.Text = values.Size.ToString();
plateSettings.SizeText = values.Size.ToString();
LeftSpacing = values.LeftSpacing;
TopSpacing = values.TopSpacing;
RightSpacing = values.RightSpacing;
@@ -178,7 +158,7 @@ namespace OpenNest.Forms
private void Save() =>
(Values with { Size = Outline?.Size ?? OpenNest.Geometry.Size.Parse(SizeString) }).ApplyTo(plate);
private void textBox1_TextChanged(object sender, EventArgs e)
private void plateSettings_SizeTextChanged(object sender, EventArgs e)
{
timer.Stop();
timer.Start();
+5 -4
View File
@@ -1134,10 +1134,11 @@ The Open list's Thickness column shows the name with the decimal in parentheses,
"10 ga (0.135)", still sorting by the decimal. A record without a name is named for
display only (`ThicknessNames`): the first machine configuration that names its
material and thickness, otherwise the nearest standard steel gauge or plate fraction
within 0.001 in, so 0.135 reads as 10 ga and 0.188 as 3/16". Nest Information has a
**Thickness name** box that fills in the same way (a picked list entry names itself,
the nest's own machine is asked first); a new thickness replaces the name, a new
material only a blank or suggested one, and a typed name is kept.
within 0.001 in, so 0.135 reads as 10 ga and 0.188 as 3/16". Edit Nest shows the
thickness as its bare decimal with a **Name** box beside it that fills in the same way
(a picked list entry names itself, the nest's own machine is asked first); a new
thickness replaces the name, a new material only a blank or suggested one, and a typed
name is kept.
## Material list endpoints