diff --git a/Yafc.UI/Rendering/Font.cs b/Yafc.UI/Rendering/Font.cs index 58ce3fb3..b20828d1 100644 --- a/Yafc.UI/Rendering/Font.cs +++ b/Yafc.UI/Rendering/Font.cs @@ -6,6 +6,7 @@ namespace Yafc.UI { public class Font { public static Font header; public static Font subheader; + public static Font subsubheader; public static Font text; public readonly float size; diff --git a/Yafc/Program.cs b/Yafc/Program.cs index e756a98e..ba23a905 100644 --- a/Yafc/Program.cs +++ b/Yafc/Program.cs @@ -25,6 +25,7 @@ private static void Main(string[] args) { Font.header = new Font(overriddenFontFile ?? new FontFile("Data/Roboto-Light.ttf"), 2f); var regular = overriddenFontFile ?? new FontFile("Data/Roboto-Regular.ttf"); Font.subheader = new Font(regular, 1.5f); + Font.subsubheader = new Font(regular, 1.23f); Font.text = new Font(regular, 1f); ProjectDefinition cliProject = CommandLineParser.Parse(args); diff --git a/Yafc/Widgets/ImmediateWidgets.cs b/Yafc/Widgets/ImmediateWidgets.cs index 3a83bf2d..3156d81a 100644 --- a/Yafc/Widgets/ImmediateWidgets.cs +++ b/Yafc/Widgets/ImmediateWidgets.cs @@ -115,7 +115,7 @@ public static bool BuildFactorioObjectButtonWithText(this ImGui gui, FactorioObj public static bool BuildInlineObjectList(this ImGui gui, IEnumerable list, IComparer ordering, string header, out T selected, int maxCount = 10, Predicate checkMark = null, Func extra = null) where T : FactorioObject { - gui.BuildText(header, Font.subheader); + gui.BuildText(header, Font.subsubheader); var sortedList = ordering == DataUtils.AlreadySortedRecipe ? list.AsEnumerable() : list.OrderBy(e => e, ordering ?? DataUtils.DefaultOrdering); selected = null; foreach (var elem in sortedList.Take(maxCount)) { @@ -152,10 +152,6 @@ public static void BuildInlineObjectListAndButton(this ImGui gui, ICollection SelectSingleObjectPanel.Select(list, header, select, ordering, allowNone); } } - - if (multiple && list.Count > 1) { - gui.BuildText("Hint: ctrl+click to add multiple", wrap: true, color: SchemeColor.BackgroundTextFaint); - } } } diff --git a/Yafc/Workspace/ProductionTable/ProductionTableView.cs b/Yafc/Workspace/ProductionTable/ProductionTableView.cs index 1415d510..60517e91 100644 --- a/Yafc/Workspace/ProductionTable/ProductionTableView.cs +++ b/Yafc/Workspace/ProductionTable/ProductionTableView.cs @@ -756,8 +756,10 @@ void DropDownContent(ImGui gui) { } } + int multiple = 0; if (type != ProductDropdownType.Product && goods != null && allProduction.Length > 0) { gui.BuildInlineObjectListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 6, true, recipeExists); + multiple += allProduction.Length; if (link == null) { Rect iconRect = new Rect(gui.lastRect.Right - 2f, gui.lastRect.Top, 2f, 2f); gui.DrawIcon(iconRect.Expand(-0.2f), Icon.OpenNew, gui.textColor); @@ -773,14 +775,21 @@ void DropDownContent(ImGui gui) { if (type != ProductDropdownType.Fuel && goods != null && type != ProductDropdownType.Ingredient && goods.usages.Length > 0) { gui.BuildInlineObjectListAndButton(goods.usages, DataUtils.DefaultRecipeOrdering, addRecipe, "Add consumption recipe", type == ProductDropdownType.Product ? 6 : 3, true, recipeExists); + multiple += goods.usages.Length; } if (type != ProductDropdownType.Fuel && goods != null && type != ProductDropdownType.Ingredient && fuelUseList.Length > 0) { gui.BuildInlineObjectListAndButton(fuelUseList, DataUtils.AlreadySortedRecipe, (x) => { selectedFuel = goods; addRecipe(x); }, "Add fuel usage", type == ProductDropdownType.Product ? 6 : 3, true, recipeExists); + multiple += fuelUseList.Length; } if (type == ProductDropdownType.Product && goods != null && allProduction.Length > 0) { gui.BuildInlineObjectListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 1, true, recipeExists); + multiple += allProduction.Length; + } + + if (multiple > 1) { + gui.BuildText("Hint: ctrl+click to add multiple", wrap: true, color: SchemeColor.BackgroundTextFaint); } if (link != null && gui.BuildCheckBox("Allow overproduction", link.algorithm == LinkAlgorithm.AllowOverProduction, out bool newValue)) {