From a9a9dc8a0a5335ea999603f0cbe28cdb3feafdd8 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 18 Mar 2026 22:16:55 -0400 Subject: [PATCH] feat(ui): route progress to stationary/active buckets in MainForm Replace SetTemporaryParts/ClearTemporaryParts/AcceptTemporaryParts in all three progress callbacks (RunAutoNest, FillPlate, FillArea) with the new two-bucket API: SetStationaryParts for IsOverallBest updates, SetActiveParts for transient updates, AcceptPreviewParts(parts) and ClearPreviewParts for completion. Also removes the now-redundant highWaterMark guards from FillPlate_Click and FillArea_Click. Co-Authored-By: Claude Sonnet 4.6 --- OpenNest/Forms/MainForm.cs | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/OpenNest/Forms/MainForm.cs b/OpenNest/Forms/MainForm.cs index 64aa35b..463dff2 100644 --- a/OpenNest/Forms/MainForm.cs +++ b/OpenNest/Forms/MainForm.cs @@ -827,7 +827,12 @@ namespace OpenNest.Forms var progress = new Progress(p => { progressForm.UpdateProgress(p); - activeForm.PlateView.SetTemporaryParts(p.BestParts); + + if (p.IsOverallBest) + activeForm.PlateView.SetStationaryParts(p.BestParts); + else + activeForm.PlateView.SetActiveParts(p.BestParts); + activeForm.PlateView.ActiveWorkArea = p.ActiveWorkArea; }); @@ -863,7 +868,7 @@ namespace OpenNest.Forms var nestParts = await Task.Run(() => engine.Nest(remaining, progress, token)); - activeForm.PlateView.ClearTemporaryParts(); + activeForm.PlateView.ClearPreviewParts(); if (nestParts.Count > 0 && (!token.IsCancellationRequested || progressForm.Accepted)) { @@ -881,7 +886,7 @@ namespace OpenNest.Forms } catch (Exception ex) { - activeForm.PlateView.ClearTemporaryParts(); + activeForm.PlateView.ClearPreviewParts(); MessageBox.Show($"Nesting error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -964,7 +969,12 @@ namespace OpenNest.Forms var progress = new Progress(p => { progressForm.UpdateProgress(p); - activeForm.PlateView.SetTemporaryParts(p.BestParts); + + if (p.IsOverallBest) + activeForm.PlateView.SetStationaryParts(p.BestParts); + else + activeForm.PlateView.SetActiveParts(p.BestParts); + activeForm.PlateView.ActiveWorkArea = p.ActiveWorkArea; }); @@ -981,15 +991,15 @@ namespace OpenNest.Forms plate.WorkArea(), progress, token)); if (parts.Count > 0) - activeForm.PlateView.AcceptTemporaryParts(); + activeForm.PlateView.AcceptPreviewParts(parts); else - activeForm.PlateView.ClearTemporaryParts(); + activeForm.PlateView.ClearPreviewParts(); progressForm.ShowCompleted(); } catch (Exception ex) { - activeForm.PlateView.ClearTemporaryParts(); + activeForm.PlateView.ClearPreviewParts(); MessageBox.Show($"Nesting error: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } @@ -1026,16 +1036,21 @@ namespace OpenNest.Forms var progress = new Progress(p => { progressForm.UpdateProgress(p); - activeForm.PlateView.SetTemporaryParts(p.BestParts); + + if (p.IsOverallBest) + activeForm.PlateView.SetStationaryParts(p.BestParts); + else + activeForm.PlateView.SetActiveParts(p.BestParts); + activeForm.PlateView.ActiveWorkArea = p.ActiveWorkArea; }); Action> onComplete = parts => { if (parts != null && parts.Count > 0) - activeForm.PlateView.AcceptTemporaryParts(); + activeForm.PlateView.AcceptPreviewParts(parts); else - activeForm.PlateView.ClearTemporaryParts(); + activeForm.PlateView.ClearPreviewParts(); activeForm.PlateView.ActiveWorkArea = null; progressForm.Close();