Files
OpenNest/OpenNest.Core/PostSettings/PostSettingAttribute.cs
T
ajandClaude Opus 5.5 70e8666335 feat(posts): give the Cincinnati CL-707 settings the CI Fiber sectioned editor
The CL-707 config now declares sections, sentence-case labels and ranges,
so its dialog matches the CI Fiber one instead of the generic PropertyGrid.
The sectioned editor gains what the CL-707 config needs: optional (nullable)
numbers behind an enable box, editable tables for lists of simple records,
and a text field that suggests values from a table column (Selected library).
"Lead-in arc line 2 feedrate" is relabeled "Lead-in arc feedrate", which is
what #127 drives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 19:04:57 -04:00

67 lines
2.4 KiB
C#

using System;
namespace OpenNest.PostSettings
{
/// <summary>
/// Places a post-processor config property in a section of the desktop
/// settings editor. A config type opts into the sectioned editor by marking
/// at least one property; unmarked configs keep the generic PropertyGrid.
/// Label and help text come from <c>DisplayName</c> and <c>Description</c>.
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class PostSettingAttribute : Attribute
{
public PostSettingAttribute(string section, int order = 0)
{
Section = section;
Order = order;
}
public string Section { get; }
public int Order { get; }
/// <summary>Lower bound for numeric fields; NaN uses the kind's default.</summary>
public double Minimum { get; set; } = double.NaN;
/// <summary>Upper bound for numeric fields; NaN uses the kind's default.</summary>
public double Maximum { get; set; } = double.NaN;
/// <summary>Decimal places for decimal fields; negative uses the default.</summary>
public int DecimalPlaces { get; set; } = -1;
/// <summary>Column header for the key of a name/value table.</summary>
public string KeyHeader { get; set; }
/// <summary>Column header for the value of a name/value table.</summary>
public string ValueHeader { get; set; }
/// <summary>
/// For a text field: the record table property whose column, named by
/// <see cref="SuggestionsColumn"/>, lists the values offered in a drop-down.
/// The field still accepts any text.
/// </summary>
public string SuggestionsTable { get; set; }
/// <summary>The column of <see cref="SuggestionsTable"/> offered as suggestions.</summary>
public string SuggestionsColumn { get; set; }
}
/// <summary>Declares a settings section's order and description.</summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public sealed class PostSettingsSectionAttribute : Attribute
{
public PostSettingsSectionAttribute(string name, int order)
{
Name = name;
Order = order;
}
public string Name { get; }
public int Order { get; }
public string Description { get; set; }
}
}