Unify mpdecimate variables, also show settings tooltips on click (not just hover)

This commit is contained in:
N00MKRAD
2024-11-25 18:51:43 +01:00
parent 2c1882c814
commit 1657117a27
8 changed files with 72 additions and 25 deletions

View File

@@ -12,6 +12,7 @@ using System.Drawing;
using Flowframes.MiscUtils;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using Flowframes.Ui;
namespace Flowframes
{
@@ -299,7 +300,7 @@ namespace Flowframes
if (key == null)
key = "";
for (int i = 0; i < dict.Count; i++)
for (int i = 0; i < (dict == null ? 0 : dict.Count); i++)
{
if (ignoreCase)
{
@@ -319,13 +320,13 @@ namespace Flowframes
return "";
}
public static void FillFromEnum<TEnum>(this ComboBox comboBox, Dictionary<string, string> stringMap = null, int defaultIndex = -1, List<TEnum> exclusionList = null) where TEnum : Enum
public static void FillFromEnum<TEnum>(this ComboBox comboBox, Dictionary<string, string> stringMap = null, int defaultIndex = -1, List<TEnum> exclusionList = null, bool useKeyNames = false) where TEnum : Enum
{
if (exclusionList == null)
exclusionList = new List<TEnum>();
var entriesToAdd = Enum.GetValues(typeof(TEnum)).Cast<TEnum>().Except(exclusionList);
var strings = entriesToAdd.Select(x => stringMap.Get(x.ToString(), true));
var strings = useKeyNames ? entriesToAdd.Select(x => UiUtils.PascalCaseToText($"{x}")) : entriesToAdd.Select(x => stringMap.Get($"{x}", true));
comboBox.FillFromStrings(strings, stringMap, defaultIndex);
}