2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 16:33:43 -04:00

[Core] Settings improvements: Grouping w/labels, support for doubles (#137)

* [Core] Settings improvements: Grouping w/labels, support for doubles

Layout improvements:
* Plugins can set `[SettingSuggestedColumnWidth(123)]` on a settings class to adjust the settings view column width to make it wider or narrower to fit things nicely.
* Plugins can set `[SettingNewGroup("label")]` on any setting property to force a "new paragraph", or group, of settings. If "label" is also provided, a grouping header with that text will also be created.
* A double precision up/down numeric control has been added. In support of this, there is now a precision value on the existing `[SettingNumericBounds]` attribute to specify the number of digits of precision the control displays/allows.

Plugins:
* The above have been applied/demonstrated on the Botanist and Explorer plugin settings.
This commit is contained in:
F K
2024-01-29 15:37:00 -05:00
committed by GitHub
parent a555c86083
commit 351dcdb732
5 changed files with 227 additions and 28 deletions

View File

@ -1,12 +1,14 @@
using Observatory.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Observatory.Explorer
{
[SettingSuggestedColumnWidth(300)]
public class ExplorerSettings
{
public ExplorerSettings()
@ -14,6 +16,12 @@ namespace Observatory.Explorer
CustomCriteriaFile = $"{Environment.GetFolderPath(Environment.SpecialFolder.Personal)}{System.IO.Path.DirectorySeparatorChar}ObservatoryCriteria.lua";
}
[SettingNewGroup("Display")]
[SettingDisplayName("Only Show Current System")]
public bool OnlyShowCurrentSystem { get; set; }
[SettingNewGroup("Built-in Criteria")]
[SettingDisplayName("Landable & Terraformable")]
public bool LandableTerraformable { get; set; }
@ -83,12 +91,9 @@ namespace Observatory.Explorer
[SettingDisplayName("High-Value Body")]
public bool HighValueMappable { get; set; }
[SettingNewGroup("Custom Criteria")]
[SettingDisplayName("Enable Custom Criteria")]
public bool EnableCustomCriteria { get; set; }
[SettingDisplayName("Only Show Current System")]
public bool OnlyShowCurrentSystem { get; set; }
[SettingDisplayName("Custom Criteria File")]
[System.Text.Json.Serialization.JsonIgnore]
public System.IO.FileInfo CustomCriteria {get => new System.IO.FileInfo(CustomCriteriaFile); set => CustomCriteriaFile = value.FullName;}