mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-24 20:47:42 -05:00
The Cutting Parameters dialog had grown taller than many screens. It now
puts the leads in a column of their own beside Tabs, Cutouts, Marks and
Pierce (about 780 x 580 instead of 410 x 985). The Place Lead-in side
panel and Machine Configuration keep the single stacked column. The tab
size range is one "Narrow side from ... to ..." row, with its details in
tooltips.
Since e1ccd692 every tabbed part counts as steady, but "Tab alone holds
parts up to" (TabHeldMaxLength, default 6) still picked short parts' tab
points from the center-of-gravity line and treated every tab as equally
steady in the last-resort entry fallback. The setting is removed: every
part the support grid cannot hold level is tabbed and held by its tab,
however long it is. Settings and nests saved with the old value read
unchanged and ignore it.
The problem-nest corpus (entries, every nest) plans identically to master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
103 lines
3.3 KiB
C#
103 lines
3.3 KiB
C#
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using OpenNest.CNC.CuttingStrategy;
|
|
using OpenNest.Controls;
|
|
|
|
namespace OpenNest.Forms
|
|
{
|
|
public class CuttingParametersDialog : Form
|
|
{
|
|
private readonly CuttingPanel cuttingPanel;
|
|
|
|
public CuttingParametersDialog()
|
|
{
|
|
Text = "Cutting Parameters";
|
|
FormBorderStyle = FormBorderStyle.FixedDialog;
|
|
MaximizeBox = false;
|
|
MinimizeBox = false;
|
|
ShowInTaskbar = false;
|
|
StartPosition = FormStartPosition.CenterParent;
|
|
|
|
// The leads beside the other settings, so the dialog stays short.
|
|
cuttingPanel = new CuttingPanel(showLeads: true, sideBySide: true) { Dock = DockStyle.Fill };
|
|
|
|
var btnOk = new Button
|
|
{
|
|
Text = "OK",
|
|
DialogResult = DialogResult.OK,
|
|
Size = new Size(80, 28),
|
|
};
|
|
|
|
var btnCancel = new Button
|
|
{
|
|
Text = "Cancel",
|
|
DialogResult = DialogResult.Cancel,
|
|
Size = new Size(80, 28),
|
|
};
|
|
|
|
var buttonPanel = new FlowLayoutPanel
|
|
{
|
|
Dock = DockStyle.Bottom,
|
|
FlowDirection = FlowDirection.RightToLeft,
|
|
AutoSize = true,
|
|
Padding = new Padding(8),
|
|
};
|
|
buttonPanel.Paint += (s, e) => e.Graphics.DrawLine(SystemPens.ControlLight, 0, 0, buttonPanel.Width, 0);
|
|
buttonPanel.Controls.Add(btnCancel);
|
|
buttonPanel.Controls.Add(btnOk);
|
|
|
|
Controls.Add(cuttingPanel);
|
|
Controls.Add(buttonPanel);
|
|
|
|
AcceptButton = btnOk;
|
|
CancelButton = btnCancel;
|
|
this.buttonPanel = buttonPanel;
|
|
FitContent();
|
|
}
|
|
|
|
private readonly FlowLayoutPanel buttonPanel;
|
|
|
|
// Sized again once shown, since the source line set after construction adds a row.
|
|
protected override void OnLoad(System.EventArgs e)
|
|
{
|
|
FitContent();
|
|
base.OnLoad(e);
|
|
}
|
|
|
|
// Fit the whole panel so nothing scrolls, unless the screen is too short for it.
|
|
private void FitContent()
|
|
{
|
|
var content = cuttingPanel.GetPreferredSize(Size.Empty);
|
|
var maxHeight = Screen.FromPoint(Cursor.Position).WorkingArea.Height - 80;
|
|
ClientSize = new Size(
|
|
System.Math.Max(380, content.Width + SystemInformation.VerticalScrollBarWidth),
|
|
System.Math.Min(maxHeight, content.Height + buttonPanel.GetPreferredSize(Size.Empty).Height)
|
|
);
|
|
}
|
|
|
|
/// <summary>Where the settings are saved, shown above them.</summary>
|
|
public string Source
|
|
{
|
|
get => cuttingPanel.Source;
|
|
set => cuttingPanel.Source = value;
|
|
}
|
|
|
|
/// <summary>Offers only the leads a machine thickness can hold (see <see cref="CuttingPanel.MachineLeads"/>).</summary>
|
|
public bool MachineLeads
|
|
{
|
|
get => cuttingPanel.MachineLeads;
|
|
set => cuttingPanel.MachineLeads = value;
|
|
}
|
|
|
|
public void LoadParameters(CuttingParameters parameters)
|
|
{
|
|
cuttingPanel.LoadFromParameters(parameters);
|
|
}
|
|
|
|
public CuttingParameters GetParameters()
|
|
{
|
|
return cuttingPanel.BuildParameters();
|
|
}
|
|
}
|
|
}
|