Files
OpenNest/OpenNest/Controls/PreviewManager.cs
T
aj a04460c57b refactor(ui): drop duplicate plate preview from nesting progress dialog
The dialog rendered the same best-parts layout as transparent ghost
parts already shown live on the main plate view, and its embedded view
reset zoom on every improvement while lacking placed parts, work-area
and cut-off context. The progress dialog is now a compact stats strip
(266px wide) with the plate counter preserved for multi-plate runs.
Removes the never-called SetStationaryParts stationary-preview path
along with PreviewPlate/UpdatePreview/CreatePreviewPlate.
2026-09-27 20:43:34 -04:00

63 lines
1.4 KiB
C#

using System.Collections.Generic;
using System.Drawing;
namespace OpenNest.Controls
{
internal class PreviewManager
{
private readonly PlateView view;
private readonly List<LayoutPart> activeParts = new List<LayoutPart>();
public PreviewManager(PlateView view)
{
this.view = view;
}
public IReadOnlyList<LayoutPart> PreviewParts => activeParts;
public Brush PreviewBrush => view.ColorScheme.ActivePreviewPartBrush;
public Pen PreviewPen => view.ColorScheme.ActivePreviewPartPen;
public void SetActiveParts(List<Part> parts)
{
activeParts.Clear();
if (parts != null)
{
foreach (var part in parts)
activeParts.Add(LayoutPart.Create(part, view));
}
view.Invalidate();
}
public void ClearPreviewParts()
{
activeParts.Clear();
view.Invalidate();
}
public void AcceptPreviewParts(List<Part> parts)
{
if (parts != null)
{
foreach (var part in parts)
view.Plate.Parts.Add(part);
}
activeParts.Clear();
}
public void Update()
{
activeParts.ForEach(p => p.Update(view));
}
public void Clear()
{
activeParts.Clear();
}
}
}