Move preview config to its own tab

This commit is contained in:
Infi
2024-05-21 10:53:37 +02:00
parent 140343e654
commit 6daa0bb9e2
5 changed files with 60 additions and 31 deletions
+11 -2
View File
@@ -1689,7 +1689,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Command help side.
/// Looks up a localized string similar to Command help side (None = off).
/// </summary>
internal static string Options_CommandHelpSide_Name {
get {
@@ -2427,7 +2427,7 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to Message preview.
/// Looks up a localized string similar to Position (None = off).
/// </summary>
internal static string Options_Preview_Name {
get {
@@ -2444,6 +2444,15 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Preview.
/// </summary>
internal static string Options_Preview_Tab {
get {
return ResourceManager.GetString("Options_Preview_Tab", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Tooltip.
/// </summary>
+5 -2
View File
@@ -389,7 +389,7 @@
<value>Right</value>
</data>
<data name="Options_CommandHelpSide_Name">
<value>Command help side</value>
<value>Command help side (None = off)</value>
</data>
<data name="Options_CommandHelpSide_Description">
<value>The side of {0} to display help for commands on.</value>
@@ -1055,7 +1055,7 @@
<value>Displays a preview with special parameter evaluated, like emotes and &lt;item&gt;</value>
</data>
<data name="Options_Preview_Name" xml:space="preserve">
<value>Message preview</value>
<value>Position (None = off)</value>
</data>
<data name="Options_Preview_None" xml:space="preserve">
<value>None</value>
@@ -1087,4 +1087,7 @@
<data name="Options_PreviewMinimum_Description" xml:space="preserve">
<value>Show only if the text length is greater-than or equal</value>
</data>
<data name="Options_Preview_Tab" xml:space="preserve">
<value>Preview</value>
</data>
</root>
+1
View File
@@ -36,6 +36,7 @@ public sealed class SettingsWindow : Window
new Display(Mutable),
new ChatLog(Plugin, Mutable),
new Emote(Plugin, Mutable),
new Preview(Plugin, Mutable),
new Ui.SettingsTabs.Fonts(Mutable),
new ChatColours(Plugin, Mutable),
new Tabs(Plugin, Mutable),
-27
View File
@@ -22,33 +22,6 @@ internal sealed class Miscellaneous(Configuration mutable) : ISettingsTab
}
ImGuiUtil.HelpText(string.Format(Language.Options_Language_Description, Plugin.PluginName));
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_Preview_Name, Mutable.PreviewPosition.Name()))
{
if (combo)
{
foreach (var position in Enum.GetValues<PreviewPosition>())
if (ImGui.Selectable(position.Name(), Mutable.PreviewPosition == position))
Mutable.PreviewPosition = position;
}
}
ImGuiUtil.HelpText(Language.Options_Preview_Description);
ImGui.Spacing();
if (Mutable.PreviewPosition is not PreviewPosition.None)
{
ImGuiUtil.OptionCheckbox(ref Mutable.OnlyPreviewIf, Language.Options_PreviewOnlyIf_Name, Language.Options_PreviewOnlyIf_Description);
ImGui.Spacing();
if (ImGuiUtil.InputIntVertical(Language.Options_PreviewMinimum_Name, Language.Options_PreviewMinimum_Description, ref Mutable.PreviewMinimum))
Mutable.PreviewMinimum = Math.Clamp(Mutable.PreviewMinimum, 1, 250);
}
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_CommandHelpSide_Name, Mutable.CommandHelpSide.Name()))
+43
View File
@@ -0,0 +1,43 @@
using ChatTwo.Resources;
using ChatTwo.Util;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Preview : ISettingsTab
{
private readonly Plugin Plugin;
private Configuration Mutable { get; }
public string Name => Language.Options_Preview_Tab + "###tabs-preview";
internal Preview(Plugin plugin, Configuration mutable)
{
Plugin = plugin;
Mutable = mutable;
}
public void Draw(bool changed)
{
using var wrap = ImGuiUtil.TextWrapPos();
using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_Preview_Name, Mutable.PreviewPosition.Name()))
{
if (combo)
{
foreach (var position in Enum.GetValues<PreviewPosition>())
if (ImGui.Selectable(position.Name(), Mutable.PreviewPosition == position))
Mutable.PreviewPosition = position;
}
}
ImGuiUtil.HelpText(Language.Options_Preview_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.OnlyPreviewIf, Language.Options_PreviewOnlyIf_Name, Language.Options_PreviewOnlyIf_Description);
ImGui.Spacing();
if (ImGuiUtil.InputIntVertical(Language.Options_PreviewMinimum_Name, Language.Options_PreviewMinimum_Description, ref Mutable.PreviewMinimum))
Mutable.PreviewMinimum = Math.Clamp(Mutable.PreviewMinimum, 1, 250);
ImGui.Spacing();
}
}