refactor: update MainForm callsites to use PlateManager directly
Replace all backward-compat wrapper calls on EditNestForm (LoadFirstPlate, LoadLastPlate, LoadNextPlate, LoadPreviousPlate, IsFirstPlate, IsLastPlate, EnsureSentinelPlate, CurrentPlateIndex, PlateCount) with direct access to activeForm.PlateManager. Remove the now-unused wrapper methods and properties from EditNestForm. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -232,19 +232,6 @@ namespace OpenNest.Forms
|
|||||||
|
|
||||||
public DateTime LastSaveDate { get; private set; }
|
public DateTime LastSaveDate { get; private set; }
|
||||||
|
|
||||||
public int CurrentPlateIndex => PlateManager.CurrentIndex;
|
|
||||||
|
|
||||||
public int PlateCount => PlateManager.Count;
|
|
||||||
|
|
||||||
// Delegating methods kept for backward compatibility with MainForm (until Task 7)
|
|
||||||
public void LoadFirstPlate() => PlateManager.LoadFirst();
|
|
||||||
public void LoadLastPlate() => PlateManager.LoadLast();
|
|
||||||
public bool LoadNextPlate() => PlateManager.LoadNext();
|
|
||||||
public bool LoadPreviousPlate() => PlateManager.LoadPrevious();
|
|
||||||
public bool IsFirstPlate() => PlateManager.IsFirst;
|
|
||||||
public bool IsLastPlate() => PlateManager.IsLast;
|
|
||||||
public void EnsureSentinelPlate() => PlateManager.EnsureSentinel();
|
|
||||||
|
|
||||||
public void UpdatePlateList()
|
public void UpdatePlateList()
|
||||||
{
|
{
|
||||||
updatingPlateList = true;
|
updatingPlateList = true;
|
||||||
|
|||||||
+17
-24
@@ -190,10 +190,10 @@ namespace OpenNest.Forms
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mnuNestPreviousPlate.Enabled = !activeForm.IsFirstPlate();
|
mnuNestPreviousPlate.Enabled = !activeForm.PlateManager.IsFirst;
|
||||||
mnuNestNextPlate.Enabled = !activeForm.IsLastPlate();
|
mnuNestNextPlate.Enabled = !activeForm.PlateManager.IsLast;
|
||||||
mnuNestFirstPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsFirstPlate();
|
mnuNestFirstPlate.Enabled = activeForm.PlateManager.Count > 0 && !activeForm.PlateManager.IsFirst;
|
||||||
mnuNestLastPlate.Enabled = activeForm.PlateCount > 0 && !activeForm.IsLastPlate();
|
mnuNestLastPlate.Enabled = activeForm.PlateManager.Count > 0 && !activeForm.PlateManager.IsLast;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,10 +206,10 @@ namespace OpenNest.Forms
|
|||||||
mnuPlate.Enabled = !locked;
|
mnuPlate.Enabled = !locked;
|
||||||
|
|
||||||
// Lock plate navigation
|
// Lock plate navigation
|
||||||
mnuNestPreviousPlate.Enabled = !locked && activeForm != null && !activeForm.IsFirstPlate();
|
mnuNestPreviousPlate.Enabled = !locked && activeForm != null && !activeForm.PlateManager.IsFirst;
|
||||||
mnuNestNextPlate.Enabled = !locked && activeForm != null && !activeForm.IsLastPlate();
|
mnuNestNextPlate.Enabled = !locked && activeForm != null && !activeForm.PlateManager.IsLast;
|
||||||
mnuNestFirstPlate.Enabled = !locked && activeForm != null && activeForm.PlateCount > 0 && !activeForm.IsFirstPlate();
|
mnuNestFirstPlate.Enabled = !locked && activeForm != null && activeForm.PlateManager.Count > 0 && !activeForm.PlateManager.IsFirst;
|
||||||
mnuNestLastPlate.Enabled = !locked && activeForm != null && activeForm.PlateCount > 0 && !activeForm.IsLastPlate();
|
mnuNestLastPlate.Enabled = !locked && activeForm != null && activeForm.PlateManager.Count > 0 && !activeForm.PlateManager.IsLast;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLocationStatus()
|
private void UpdateLocationStatus()
|
||||||
@@ -238,8 +238,8 @@ namespace OpenNest.Forms
|
|||||||
|
|
||||||
plateIndexStatusLabel.Text = string.Format(
|
plateIndexStatusLabel.Text = string.Format(
|
||||||
"Plate: {0} of {1}",
|
"Plate: {0} of {1}",
|
||||||
activeForm.CurrentPlateIndex + 1,
|
activeForm.PlateManager.CurrentIndex + 1,
|
||||||
activeForm.PlateCount);
|
activeForm.PlateManager.Count);
|
||||||
|
|
||||||
plateSizeStatusLabel.Text = string.Format(
|
plateSizeStatusLabel.Text = string.Format(
|
||||||
"Size: {0}",
|
"Size: {0}",
|
||||||
@@ -723,7 +723,7 @@ namespace OpenNest.Forms
|
|||||||
foreach (var part in result.Parts)
|
foreach (var part in result.Parts)
|
||||||
plate.Parts.Add(part);
|
plate.Parts.Add(part);
|
||||||
|
|
||||||
activeForm.LoadLastPlate();
|
activeForm.PlateManager.LoadLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
activeForm.Nest.UpdateDrawingQuantities();
|
activeForm.Nest.UpdateDrawingQuantities();
|
||||||
@@ -838,31 +838,30 @@ namespace OpenNest.Forms
|
|||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
activeForm.Nest.Plates.RemoveEmptyPlates();
|
activeForm.Nest.Plates.RemoveEmptyPlates();
|
||||||
activeForm.EnsureSentinelPlate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadFirstPlate_Click(object sender, EventArgs e)
|
private void LoadFirstPlate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
activeForm.LoadFirstPlate();
|
activeForm.PlateManager.LoadFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadLastPlate_Click(object sender, EventArgs e)
|
private void LoadLastPlate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
activeForm.LoadLastPlate();
|
activeForm.PlateManager.LoadLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadPreviousPlate_Click(object sender, EventArgs e)
|
private void LoadPreviousPlate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
activeForm.LoadPreviousPlate();
|
activeForm.PlateManager.LoadPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadNextPlate_Click(object sender, EventArgs e)
|
private void LoadNextPlate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
activeForm.LoadNextPlate();
|
activeForm.PlateManager.LoadNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemnantViewerForm remnantViewer;
|
private RemnantViewerForm remnantViewer;
|
||||||
@@ -975,7 +974,6 @@ namespace OpenNest.Forms
|
|||||||
SetNestingLockout(false);
|
SetNestingLockout(false);
|
||||||
nestingCts.Dispose();
|
nestingCts.Dispose();
|
||||||
nestingCts = null;
|
nestingCts = null;
|
||||||
activeForm.EnsureSentinelPlate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1012,13 +1010,8 @@ namespace OpenNest.Forms
|
|||||||
|
|
||||||
private Plate GetOrCreatePlate(NestProgressForm progressForm)
|
private Plate GetOrCreatePlate(NestProgressForm progressForm)
|
||||||
{
|
{
|
||||||
var currentPlate = activeForm.PlateView.Plate;
|
var plate = activeForm.PlateManager.GetOrCreateEmpty();
|
||||||
|
activeForm.PlateManager.LoadLast();
|
||||||
if (currentPlate.Parts.Count == 0)
|
|
||||||
return currentPlate;
|
|
||||||
|
|
||||||
var plate = activeForm.Nest.CreatePlate();
|
|
||||||
activeForm.LoadLastPlate();
|
|
||||||
progressForm.PreviewPlate = CreatePreviewPlate(plate);
|
progressForm.PreviewPlate = CreatePreviewPlate(plate);
|
||||||
return plate;
|
return plate;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user