From 7462d1bdcaab6266049be1cc2706b4a4c3400e74 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 15 Mar 2026 22:01:06 -0400 Subject: [PATCH] feat(ui): add engine selector dropdown to main toolstrip ToolStripComboBox populated from NestEngineRegistry.AvailableEngines. Changing selection sets NestEngineRegistry.ActiveEngineName globally. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/Forms/MainForm.Designer.cs | 30 +++++++++++++++++++++++++++-- OpenNest/Forms/MainForm.cs | 12 ++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/OpenNest/Forms/MainForm.Designer.cs b/OpenNest/Forms/MainForm.Designer.cs index e32d58d..8e608af 100644 --- a/OpenNest/Forms/MainForm.Designer.cs +++ b/OpenNest/Forms/MainForm.Designer.cs @@ -145,6 +145,9 @@ this.btnZoomOut = new System.Windows.Forms.ToolStripButton(); this.btnZoomIn = new System.Windows.Forms.ToolStripButton(); this.btnZoomToFit = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.engineLabel = new System.Windows.Forms.ToolStripLabel(); + this.engineComboBox = new System.Windows.Forms.ToolStripComboBox(); this.pEPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openNestToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); @@ -996,7 +999,10 @@ this.toolStripSeparator3, this.btnZoomOut, this.btnZoomIn, - this.btnZoomToFit}); + this.btnZoomToFit, + this.toolStripSeparator4, + this.engineLabel, + this.engineComboBox}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(1098, 35); @@ -1149,7 +1155,24 @@ this.btnZoomToFit.Size = new System.Drawing.Size(38, 32); this.btnZoomToFit.Text = "Zoom To Fit"; this.btnZoomToFit.Click += new System.EventHandler(this.ZoomToFit_Click); - // + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(6, 35); + // + // engineLabel + // + this.engineLabel.Name = "engineLabel"; + this.engineLabel.Size = new System.Drawing.Size(46, 32); + this.engineLabel.Text = "Engine:"; + // + // engineComboBox + // + this.engineComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.engineComboBox.Name = "engineComboBox"; + this.engineComboBox.Size = new System.Drawing.Size(100, 35); + // // pEPToolStripMenuItem // this.pEPToolStripMenuItem.Name = "pEPToolStripMenuItem"; @@ -1309,5 +1332,8 @@ private System.Windows.Forms.ToolStripButton btnSaveAs; private System.Windows.Forms.ToolStripMenuItem centerPartsToolStripMenuItem; private System.Windows.Forms.ToolStripStatusLabel gpuStatusLabel; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripLabel engineLabel; + private System.Windows.Forms.ToolStripComboBox engineComboBox; } } \ No newline at end of file diff --git a/OpenNest/Forms/MainForm.cs b/OpenNest/Forms/MainForm.cs index afdf448..c540656 100644 --- a/OpenNest/Forms/MainForm.cs +++ b/OpenNest/Forms/MainForm.cs @@ -56,6 +56,12 @@ namespace OpenNest.Forms var enginesDir = Path.Combine(Application.StartupPath, "Engines"); NestEngineRegistry.LoadPlugins(enginesDir); + + foreach (var engine in NestEngineRegistry.AvailableEngines) + engineComboBox.Items.Add(engine.Name); + + engineComboBox.SelectedItem = NestEngineRegistry.ActiveEngineName; + engineComboBox.SelectedIndexChanged += EngineComboBox_SelectedIndexChanged; } private Nest CreateDefaultNest() @@ -252,6 +258,12 @@ namespace OpenNest.Forms } } + private void EngineComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (engineComboBox.SelectedItem is string name) + NestEngineRegistry.ActiveEngineName = name; + } + private void UpdateLocationMode() { if (activeForm == null)