From 3beca104299a9688a21e309f33f88dbaad0c3258 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 15 Apr 2026 21:52:00 -0400 Subject: [PATCH] feat(ui): add color scheme picker to Options dialog Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/Forms/OptionsForm.Designer.cs | 38 ++++++++++++++++++++++---- OpenNest/Forms/OptionsForm.cs | 12 ++++++++ 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/OpenNest/Forms/OptionsForm.Designer.cs b/OpenNest/Forms/OptionsForm.Designer.cs index 993d03d..58c0fec 100644 --- a/OpenNest/Forms/OptionsForm.Designer.cs +++ b/OpenNest/Forms/OptionsForm.Designer.cs @@ -42,6 +42,8 @@ this.bottomPanel1 = new OpenNest.Controls.BottomPanel(); this.strategyGrid = new System.Windows.Forms.DataGridView(); this.strategyGroupBox = new System.Windows.Forms.GroupBox(); + this.colorSchemeLabel = new System.Windows.Forms.Label(); + this.colorSchemeCombo = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.bottomPanel1.SuspendLayout(); @@ -86,7 +88,7 @@ this.toolTip1.SetToolTip(this.numericUpDown1, "The amount to round the plate size up."); // // tableLayoutPanel1 - // + // this.tableLayoutPanel1.ColumnCount = 4; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); @@ -95,15 +97,18 @@ this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1); this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.colorSchemeLabel, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.colorSchemeCombo, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 3); this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.button1, 3, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.34F)); + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(684, 160); this.tableLayoutPanel1.TabIndex = 0; // @@ -198,6 +203,25 @@ this.strategyGroupBox.TabStop = false; this.strategyGroupBox.Text = "Fill Strategies"; // + // colorSchemeLabel + // + this.colorSchemeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.colorSchemeLabel.AutoSize = true; + this.colorSchemeLabel.Location = new System.Drawing.Point(3, 92); + this.colorSchemeLabel.Name = "colorSchemeLabel"; + this.colorSchemeLabel.Size = new System.Drawing.Size(145, 16); + this.colorSchemeLabel.TabIndex = 10; + this.colorSchemeLabel.Text = "Color scheme:"; + // + // colorSchemeCombo + // + this.colorSchemeCombo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.colorSchemeCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.colorSchemeCombo.Location = new System.Drawing.Point(154, 89); + this.colorSchemeCombo.Name = "colorSchemeCombo"; + this.colorSchemeCombo.Size = new System.Drawing.Size(130, 24); + this.colorSchemeCombo.TabIndex = 11; + // // OptionsForm // this.AcceptButton = this.saveButton; @@ -239,5 +263,7 @@ private System.Windows.Forms.Button button1; private System.Windows.Forms.DataGridView strategyGrid; private System.Windows.Forms.GroupBox strategyGroupBox; + private System.Windows.Forms.Label colorSchemeLabel; + private System.Windows.Forms.ComboBox colorSchemeCombo; } } \ No newline at end of file diff --git a/OpenNest/Forms/OptionsForm.cs b/OpenNest/Forms/OptionsForm.cs index 2b959a1..6e16442 100644 --- a/OpenNest/Forms/OptionsForm.cs +++ b/OpenNest/Forms/OptionsForm.cs @@ -68,6 +68,13 @@ namespace OpenNest.Forms checkBox1.Checked = Settings.Default.CreateNewNestOnOpen; numericUpDown1.Value = (decimal)Settings.Default.AutoSizePlateFactor; + colorSchemeCombo.Items.Clear(); + foreach (var scheme in ColorSchemeRegistry.AllSchemes) + colorSchemeCombo.Items.Add(scheme.Name); + var active = Settings.Default.ActiveColorScheme; + var idx = colorSchemeCombo.Items.IndexOf(active); + colorSchemeCombo.SelectedIndex = idx >= 0 ? idx : 0; + var disabledNames = ParseDisabledStrategies(Settings.Default.DisabledStrategies); foreach (DataGridViewRow row in strategyGrid.Rows) row.Cells["Enabled"].Value = !disabledNames.Contains((string)row.Cells["Name"].Value); @@ -78,6 +85,7 @@ namespace OpenNest.Forms Settings.Default.NestTemplatePath = textBox1.Text; Settings.Default.CreateNewNestOnOpen = checkBox1.Checked; Settings.Default.AutoSizePlateFactor = (double)numericUpDown1.Value; + Settings.Default.ActiveColorScheme = colorSchemeCombo.SelectedItem as string ?? "Classic"; var disabledNames = new List(); foreach (DataGridViewRow row in strategyGrid.Rows) @@ -89,6 +97,10 @@ namespace OpenNest.Forms Settings.Default.Save(); ApplyDisabledStrategies(); + ColorSchemeRegistry.ApplyActiveFromSettings(); + + foreach (Form f in Application.OpenForms) + f.Invalidate(invalidateChildren: true); } ///