Add option to limit the amount of shown log lines
This commit is contained in:
@@ -39,6 +39,7 @@ internal class Configuration : IPluginConfiguration
|
||||
public bool SortAutoTranslate;
|
||||
public bool CollapseDuplicateMessages;
|
||||
public bool PlaySounds = true;
|
||||
public int MaxLinesToRender = 10_000;
|
||||
|
||||
public bool FontsEnabled = true;
|
||||
public ExtraGlyphRanges ExtraGlyphRanges = 0;
|
||||
@@ -83,6 +84,7 @@ internal class Configuration : IPluginConfiguration
|
||||
SortAutoTranslate = other.SortAutoTranslate;
|
||||
CollapseDuplicateMessages = other.CollapseDuplicateMessages;
|
||||
PlaySounds = other.PlaySounds;
|
||||
MaxLinesToRender = other.MaxLinesToRender;
|
||||
FontsEnabled = other.FontsEnabled;
|
||||
ExtraGlyphRanges = other.ExtraGlyphRanges;
|
||||
FontSize = other.FontSize;
|
||||
|
||||
Generated
+18
@@ -2093,6 +2093,24 @@ namespace ChatTwo.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Limits the amount of log lines to show in the chat window. This may slightly improve performance..
|
||||
/// </summary>
|
||||
internal static string Options_MaxLinesToShow_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_MaxLinesToShow_Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Maximum amount of log lines to display in the chat window.
|
||||
/// </summary>
|
||||
internal static string Options_MaxLinesToShow_Name {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_MaxLinesToShow_Name", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Miscellaneous.
|
||||
/// </summary>
|
||||
|
||||
@@ -841,4 +841,10 @@
|
||||
<data name="Options_CollapseDuplicateMessages_Description">
|
||||
<value>Vervang opeenvolgende dubbele berichten door een teller die is toegevoegd aan het eerste exemplaar van het bericht.</value>
|
||||
</data>
|
||||
<data name="Options_MaxLinesToShow_Name" xml:space="preserve">
|
||||
<value>Maximum aantal regels om te tonen in het chat venster</value>
|
||||
</data>
|
||||
<data name="Options_MaxLinesToShow_Description" xml:space="preserve">
|
||||
<value>Limiteer het maximum aantal regels die worden getoont in het chatvester.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -994,4 +994,10 @@
|
||||
<data name="Options_PlaySounds_Description" xml:space="preserve">
|
||||
<value>Play sounds on interaction.</value>
|
||||
</data>
|
||||
<data name="Options_MaxLinesToShow_Name" xml:space="preserve">
|
||||
<value>Maximum amount of log lines to display in the chat window</value>
|
||||
</data>
|
||||
<data name="Options_MaxLinesToShow_Description" xml:space="preserve">
|
||||
<value>Limits the amount of log lines to show in the chat window. This may slightly improve performance.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -874,7 +874,11 @@ public sealed class ChatLogWindow : Window, IUiComponent
|
||||
var lastTimestamp = string.Empty;
|
||||
int? lastMessageHash = null;
|
||||
var sameCount = 0;
|
||||
for (var i = 0; i < tab.Messages.Count; i++)
|
||||
|
||||
int maxLines = Plugin.Config.MaxLinesToRender;
|
||||
int startLine = tab.Messages.Count > maxLines ? tab.Messages.Count - maxLines : 0;
|
||||
|
||||
for (int i = startLine; i < tab.Messages.Count; i++)
|
||||
{
|
||||
var message = tab.Messages[i];
|
||||
|
||||
|
||||
@@ -87,6 +87,12 @@ internal sealed class Display : ISettingsTab {
|
||||
ImGuiUtil.DragFloatVertical(Language.Options_WindowOpacity_Name, ref Mutable.WindowAlpha, .25f, 0f, 100f, $"{Mutable.WindowAlpha:N2}%%", ImGuiSliderFlags.AlwaysClamp);
|
||||
ImGui.Spacing();
|
||||
|
||||
|
||||
if (ImGuiUtil.InputIntVertical(Language.Options_MaxLinesToShow_Name, Language.Options_MaxLinesToShow_Description, ref Mutable.MaxLinesToRender)) {
|
||||
Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000);
|
||||
}
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGuiUtil.OptionCheckbox(ref Mutable.CanMove, Language.Options_CanMove_Name);
|
||||
ImGui.Spacing();
|
||||
|
||||
|
||||
@@ -234,6 +234,15 @@ internal static class ImGuiUtil {
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static bool InputIntVertical(string label, string description, ref int value, int step = 1, int stepFast = 100, ImGuiInputTextFlags flags = ImGuiInputTextFlags.None) {
|
||||
ImGui.TextUnformatted(label);
|
||||
ImGui.SetNextItemWidth(-1);
|
||||
var r = ImGui.InputInt($"##{label}", ref value, step, stepFast, flags);
|
||||
HelpText(description);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
internal static bool CtrlShiftButton(string label, string tooltip = "")
|
||||
{
|
||||
var io = ImGui.GetIO();
|
||||
|
||||
Reference in New Issue
Block a user