From fcb61f3b3e87f040eb1775fa8125e74304fd2d83 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 27 Oct 2026 22:37:35 -0400 Subject: [PATCH] feat(ui): choose Plan Cutting's plate scope in the panel The panel gains a Current plate only / All plates selector, shown when the two scopes differ. Changing it takes the unapplied scrap cut-offs off, cancels any running plan and replans. The toolbar button opens with the scope last chosen there (default all plates); the Plate and Nest menu items keep their fixed scopes. Co-Authored-By: Claude Opus 5.5 --- .../Forms/CuttingInspectionPanelTests.cs | 92 +++++++++++++ OpenNest/Forms/CuttingInspectionPanel.cs | 124 ++++++++++++++++-- OpenNest/Forms/MainForm.Plate.cs | 4 + OpenNest/Forms/MainForm.cs | 2 +- OpenNest/Properties/Settings.Designer.cs | 13 ++ OpenNest/Properties/Settings.settings | 3 + docs/cutting-planner.md | 4 + 7 files changed, 228 insertions(+), 14 deletions(-) diff --git a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs index 9a475422..e8a57986 100644 --- a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs +++ b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs @@ -187,6 +187,88 @@ public class CuttingInspectionPanelTests Assert.Same(original, editor.PlateView.Plate); }); + [Fact] + public void ScopeSelectorReplansForAllPlatesAndBackAndRemembersTheChoice() => RunSta(() => + { + using var editor = TwoPlateEditor(); + editor.Show(); + editor.PlateManager.LoadAt(0); + editor.OpenCuttingInspection(); + var panel = editor.CuttingInspection!; + var remembered = new List(); + panel.RememberScope = remembered.Add; + PumpUntil(() => panel.Proposal != null && !panel.IsPlanning); + var scope = Field(panel, "scopeSelector"); + Assert.True(scope.Visible); + Assert.Equal(0, scope.SelectedIndex); + Assert.Equal("All plates (2)", scope.Items[1]); + Assert.Single(panel.Proposal.Plates); + + scope.SelectedIndex = 1; + PumpUntil(() => panel.Proposal != null && !panel.IsPlanning); + Assert.True(panel.AllPlates); + Assert.Equal(2, panel.Proposal.Plates.Count); + Assert.True(Field