using ImGuiNET;
using T3.Editor.Gui.Input;
using T3.Editor.Gui.Styling;
// ReSharper disable StringLiteralTypo
// ReSharper disable FieldCanBeMadeReadOnly.Local
// ReSharper disable ClassNeverInstantiated.Local
// ReSharper disable ArrangeTypeMemberModifiers
namespace T3.Editor.Gui.Windows;
internal static class ConfigurationTest
{
#region user interface
public static void Draw()
{
FormInputs.SetIndentToParameters();
ImGui.Indent(20);
FormInputs.AddSectionHeader("Category test");
if (!_initialized)
{
ImportFromCsv();
_initialized = true;
}
if (ImGui.TreeNode("Definition"))
{
if (ImGui.InputTextMultiline("Options (Tab Separated)", ref _optionsAsCvs, 100000, new Vector2(800, 200)))
{
ImportFromCsv();
}
ImGui.TreePop();
}
DrawCategorySelection();
DrawSelectedOptions();
}
private static void DrawCategorySelection()
{
if (!ImGui.TreeNode("Categories:"))
return;
foreach (var c in _categories)
{
TryGetValidOptionsForCategory(c, out var validOptions);
if (validOptions.Count < 2)
{
ImGui.PushStyleColor(ImGuiCol.Text, UiColors.TextMuted.Rgba);
ImGui.Text(c.Id + $" ({validOptions.Count})");
ImGui.PopStyleColor();
continue;
}
var isCurrent = _selectedCategory == c;
var suffix = validOptions.Count > 0
? $" ({validOptions.Count} options)"
: string.Empty;
if (ImGui.Selectable($"{c.Id} {suffix}", isCurrent))
_selectedCategory = c;
if (isCurrent)
DrawCategoryOptions(validOptions);
}
ImGui.TreePop();
}
private static void DrawCategoryOptions(List