diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 0add0af..8c70b88 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -1644,7 +1644,7 @@ namespace ChatTwo.Resources { } /// - /// Looks up a localized string similar to Chat Type. + /// Looks up a localized string similar to Channel. /// internal static string DbViewer_TableField_Type { get { diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index c52cb97..5abd122 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -1286,7 +1286,7 @@ Date - Chat Type + Channel Sender diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index e6ea4ba..8984b06 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -553,7 +553,7 @@ public sealed class ChatLogWindow : Window ImGui.OpenPopup(ChatChannelPicker); if (activeTab.Channel is not null && ImGui.IsItemHovered()) - ImGui.SetTooltip(Language.ChatLog_SwitcherDisabled); + ImGuiUtil.Tooltip(Language.ChatLog_SwitcherDisabled); using (var popup = ImRaii.Popup(ChatChannelPicker)) { @@ -1148,11 +1148,11 @@ public sealed class ChatLogWindow : Window ImGui.TextUnformatted(timestamp); // We use an IsItemHovered() check here instead of - // just calling SetTooltip() to avoid computing the + // just calling Tooltip() to avoid computing the // tooltip string for all visible items on every // frame. if (ImGui.IsItemHovered()) - ImGui.SetTooltip(message.Date.ToLocalTime().ToString("F")); + ImGuiUtil.Tooltip(message.Date.ToLocalTime().ToString("F")); } else { @@ -1704,7 +1704,7 @@ public sealed class ChatLogWindow : Window ImGui.Dummy(emoteSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(emotePayload.Code); + ImGuiUtil.Tooltip(emotePayload.Code); return; } diff --git a/ChatTwo/Ui/DbViewer.cs b/ChatTwo/Ui/DbViewer.cs index 0ef8b47..93c7359 100644 --- a/ChatTwo/Ui/DbViewer.cs +++ b/ChatTwo/Ui/DbViewer.cs @@ -47,7 +47,7 @@ public class DbViewer : Window ChatCodes = TabsUtil.MostlyPlayer; DateFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern; - DateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat.FullDateTimePattern; + DateTimeFormat = "ddd, dd MMM yyy HH:mm:ss"; LastProcessed = (AfterDate, BeforeDate, CurrentPage, OnlyCurrentCharacter, ChatCodes.Count); DateReset(); @@ -181,7 +181,7 @@ public class DbViewer : Window ImGui.SetCursorPos(pos); ImGui.Dummy(columnWidth); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(message.Code.Type.Name()); + ImGuiUtil.Tooltip(message.Code.Type.Name()); ImGui.TableNextColumn(); Plugin.ChatLogWindow.DrawChunks(message.Sender); diff --git a/ChatTwo/Ui/InputPreview.cs b/ChatTwo/Ui/InputPreview.cs index d4fd01b..b096253 100644 --- a/ChatTwo/Ui/InputPreview.cs +++ b/ChatTwo/Ui/InputPreview.cs @@ -205,7 +205,7 @@ public partial class InputPreview : Window ImGui.Dummy(emoteSize); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(emotePayload.Code); + ImGuiUtil.Tooltip(emotePayload.Code); CursorPosition += emotePayload.Code.Length; return; diff --git a/ChatTwo/Ui/SettingsTabs/Database.cs b/ChatTwo/Ui/SettingsTabs/Database.cs index 66f104e..d2dee7c 100755 --- a/ChatTwo/Ui/SettingsTabs/Database.cs +++ b/ChatTwo/Ui/SettingsTabs/Database.cs @@ -107,16 +107,16 @@ internal sealed class Database : ISettingsTab if (ImGui.IsItemHovered()) { ImGui.SetMouseCursor(ImGuiMouseCursor.Hand); - ImGui.SetTooltip(Language.Options_Database_Metadata_CopyConfigPath); + ImGuiUtil.Tooltip(Language.Options_Database_Metadata_CopyConfigPath); } ImGuiUtil.HelpText(string.Format(Language.Options_Database_Metadata_Size, StringUtil.BytesToString(DatabaseSize))); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(StringUtil.BytesToString(DatabaseSize)); + ImGuiUtil.Tooltip(StringUtil.BytesToString(DatabaseSize)); ImGuiUtil.HelpText(string.Format(Language.Options_Database_Metadata_LogSize, StringUtil.BytesToString(DatabaseLogSize))); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(StringUtil.BytesToString(DatabaseLogSize)); + ImGuiUtil.Tooltip(StringUtil.BytesToString(DatabaseLogSize)); ImGuiUtil.HelpText(string.Format(Language.Options_Database_Metadata_MessageCount, DatabaseMessageCount)); diff --git a/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs b/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs index 2fee8d6..cd2466c 100755 --- a/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs +++ b/ChatTwo/Ui/SettingsTabs/Miscellaneous.cs @@ -13,7 +13,7 @@ internal sealed class Miscellaneous(Configuration mutable) : ISettingsTab { using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_Language_Name, Mutable.LanguageOverride.Name())) { - if (combo) + if (combo.Success) { foreach (var language in Enum.GetValues()) if (ImGui.Selectable(language.Name())) @@ -26,7 +26,7 @@ internal sealed class Miscellaneous(Configuration mutable) : ISettingsTab using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_CommandHelpSide_Name, Mutable.CommandHelpSide.Name())) { - if (combo) + if (combo.Success) { foreach (var side in Enum.GetValues()) if (ImGui.Selectable(side.Name(), Mutable.CommandHelpSide == side)) @@ -39,7 +39,7 @@ internal sealed class Miscellaneous(Configuration mutable) : ISettingsTab using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_KeybindMode_Name, Mutable.KeybindMode.Name())) { - if (combo) + if (combo.Success) { foreach (var mode in Enum.GetValues()) { @@ -47,7 +47,7 @@ internal sealed class Miscellaneous(Configuration mutable) : ISettingsTab Mutable.KeybindMode = mode; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(mode.Tooltip()); + ImGuiUtil.Tooltip(mode.Tooltip() ?? ""); } } } diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs index f8f050d..b152055 100755 --- a/ChatTwo/Ui/SettingsTabs/Tabs.cs +++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs @@ -101,7 +101,7 @@ internal sealed class Tabs : ISettingsTab tab.UnreadMode = mode; if (mode.Tooltip() is { } tooltip && ImGui.IsItemHovered()) - ImGui.SetTooltip(tooltip); + ImGuiUtil.Tooltip(tooltip); } } } diff --git a/ChatTwo/Util/ImGuiUtil.cs b/ChatTwo/Util/ImGuiUtil.cs index 8e24435..173cd47 100755 --- a/ChatTwo/Util/ImGuiUtil.cs +++ b/ChatTwo/Util/ImGuiUtil.cs @@ -191,11 +191,8 @@ internal static class ImGuiUtil var ret = ImGui.Button(label, size); Plugin.FontManager.FontAwesome.Pop(); - if (tooltip != null && ImGui.IsItemHovered()) - { - using var startedTooltip = ImRaii.Tooltip(); - ImGuiHelpers.SafeTextWrapped(tooltip); - } + if (!string.IsNullOrEmpty(tooltip) && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) + Tooltip(tooltip); return ret; } @@ -266,6 +263,15 @@ internal static class ImGuiUtil return r; } + internal static void Tooltip(string tooltip) + { + using (ImRaii.Tooltip()) + using (ImRaii.TextWrapPos(ImGui.GetFontSize() * 35.0f)) + { + ImGui.TextUnformatted(tooltip); + } + } + public static SingleFontChooserDialog? FontChooser(string label, SingleFontSpec font, bool checkbox, ref bool checkboxValue, Predicate? exclusion = null, string? preview = null) { using var id = ImRaii.PushId(label); @@ -325,10 +331,7 @@ internal static class ImGuiUtil ret = ImGui.Button(label) && ctrlShiftHeld; if (!string.IsNullOrEmpty(tooltip) && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - { - using var startedTooltip = ImRaii.Tooltip(); - ImGuiHelpers.SafeTextWrapped(tooltip); - } + Tooltip(tooltip); return ret; } @@ -345,10 +348,7 @@ internal static class ImGuiUtil var ret = ImGui.Button(label) && ctrlShiftHeld; if (!string.IsNullOrEmpty(tooltip) && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - { - using var startedTooltip = ImRaii.Tooltip(); - ImGuiHelpers.SafeTextWrapped(tooltip); - } + Tooltip(tooltip); return ret; }