From ee34f3744603a19b1d313bc9919bd67faaa419a6 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Tue, 26 Sep 2023 23:17:38 +0200 Subject: [PATCH] Improve tooltips for tri-state toggles. --- .../Gui/Customization/CustomizationDrawer.Simple.cs | 5 +---- Glamourer/Gui/Customization/CustomizationDrawer.cs | 3 +-- Glamourer/Gui/Equipment/EquipmentDrawer.cs | 10 +++------- Glamourer/Gui/UiHelpers.cs | 4 ++-- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs index 6474ae1..ad87938 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs @@ -153,10 +153,7 @@ public partial class CustomizationDrawer var tmp = _currentByte != CustomizeValue.Zero; if (_withApply) { - switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), - $"This attribute will be {(_currentApply ? tmp ? "enabled." : "disabled." : "kept as is.")}", tmp, _currentApply, - out var newValue, - out var newApply, _locked)) + switch (UiHelpers.DrawMetaToggle(_currentIndex.ToDefaultName(), tmp, _currentApply, out var newValue, out var newApply, _locked)) { case DataChange.Item: _customize.Set(idx, newValue ? CustomizeValue.Max : CustomizeValue.Zero); diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.cs b/Glamourer/Gui/Customization/CustomizationDrawer.cs index 60ab3fa..b72f1f4 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.cs @@ -128,8 +128,7 @@ public partial class CustomizationDrawer : IDisposable => UiHelpers.DrawCheckbox("Force Wetness", "Force the character to be wet or not.", currentValue, out newValue, locked); public DataChange DrawWetnessState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked) - => UiHelpers.DrawMetaToggle("Force Wetness", "Change the characters forced wetness state: Disabled, Enabled or Don't Apply.", - currentValue, currentApply, out newValue, out newApply, locked); + => UiHelpers.DrawMetaToggle("Force Wetness", currentValue, currentApply, out newValue, out newApply, locked); private bool DrawInternal() { diff --git a/Glamourer/Gui/Equipment/EquipmentDrawer.cs b/Glamourer/Gui/Equipment/EquipmentDrawer.cs index 0a9e5cf..b265e26 100644 --- a/Glamourer/Gui/Equipment/EquipmentDrawer.cs +++ b/Glamourer/Gui/Equipment/EquipmentDrawer.cs @@ -161,23 +161,19 @@ public class EquipmentDrawer => UiHelpers.DrawCheckbox("Hat Visible", "Hide or show the characters head gear.", currentValue, out newValue, locked); public static DataChange DrawHatState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked) - => UiHelpers.DrawMetaToggle("Hat Visible", "Change the visibility of the characters head gear: Hidden, Visible or Don't Apply.", - currentValue, currentApply, out newValue, out newApply, locked); + => UiHelpers.DrawMetaToggle("Hat Visible", currentValue, currentApply, out newValue, out newApply, locked); public static bool DrawVisorState(bool currentValue, out bool newValue, bool locked) => UiHelpers.DrawCheckbox("Visor Toggled", "Toggle the visor state of the characters head gear.", currentValue, out newValue, locked); public static DataChange DrawVisorState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked) - => UiHelpers.DrawMetaToggle("Visor Toggled", "Change the toggled state of the characters head gear: Normal, Toggled or Don't Apply.", - currentValue, currentApply, out newValue, out newApply, locked); + => UiHelpers.DrawMetaToggle("Visor Toggled", currentValue, currentApply, out newValue, out newApply, locked); public static bool DrawWeaponState(bool currentValue, out bool newValue, bool locked) => UiHelpers.DrawCheckbox("Weapon Visible", "Hide or show the characters weapons when not drawn.", currentValue, out newValue, locked); public static DataChange DrawWeaponState(bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked) - => UiHelpers.DrawMetaToggle("Weapon Visible", - "Change the visibility of the characters weapons when not drawn: Hidden, Visible or Don't Apply.", currentValue, currentApply, - out newValue, out newApply, locked); + => UiHelpers.DrawMetaToggle("Weapon Visible", currentValue, currentApply, out newValue, out newApply, locked); private bool DrawMainhand(EquipItem current, bool drawAll, out EquipItem weapon, out string label, bool locked, bool small, bool open) { diff --git a/Glamourer/Gui/UiHelpers.cs b/Glamourer/Gui/UiHelpers.cs index 16d1369..98d1cdd 100644 --- a/Glamourer/Gui/UiHelpers.cs +++ b/Glamourer/Gui/UiHelpers.cs @@ -66,7 +66,7 @@ public static class UiHelpers return ret; } - public static DataChange DrawMetaToggle(string label, string tooltip, bool currentValue, bool currentApply, out bool newValue, + public static DataChange DrawMetaToggle(string label, bool currentValue, bool currentApply, out bool newValue, out bool newApply, bool locked) { @@ -78,7 +78,7 @@ public static class UiHelpers ret = ImGui.CheckboxFlags("##" + label, ref flags, 3); } - ImGuiUtil.HoverTooltip(tooltip); + ImGuiUtil.HoverTooltip($"This attribute will be {(currentApply ? currentValue ? "enabled." : "disabled." : "kept as is.")}"); ImGui.SameLine(); ImGui.TextUnformatted(label);