feat: add context menu to delete drawings from the drawing list
Adds a right-click "Delete" option on the drawings tab that removes the selected drawing and all its placed parts from every plate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -225,6 +225,7 @@ namespace OpenNest.Forms
|
||||
|
||||
Text = Nest.Name;
|
||||
drawingListBox1.Units = Nest.Units;
|
||||
drawingListBox1.DeleteRequested += drawingListBox1_DeleteRequested;
|
||||
}
|
||||
|
||||
public string LastSavePath { get; private set; }
|
||||
@@ -1026,6 +1027,32 @@ namespace OpenNest.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void drawingListBox1_DeleteRequested(object sender, Drawing drawing)
|
||||
{
|
||||
var result = MessageBox.Show(
|
||||
$"Delete drawing '{drawing.Name}' and all its parts from every plate?",
|
||||
"Delete Drawing",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Warning,
|
||||
MessageBoxDefaultButton.Button2);
|
||||
|
||||
if (result != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
foreach (var plate in Nest.Plates)
|
||||
{
|
||||
for (var i = plate.Parts.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (plate.Parts[i].BaseDrawing == drawing)
|
||||
plate.Parts.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
Nest.Drawings.Remove(drawing);
|
||||
UpdateDrawingList();
|
||||
PlateView.Invalidate();
|
||||
}
|
||||
|
||||
private void drawingListBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
addPart = true;
|
||||
|
||||
Reference in New Issue
Block a user