Disable window sounds and remove goto

This commit is contained in:
Infi
2024-04-16 16:31:24 +02:00
parent 30ccf8e416
commit 51658c178c
6 changed files with 36 additions and 41 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Version>1.21.1</Version> <Version>1.21.2</Version>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
+31 -40
View File
@@ -87,6 +87,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
SizeCondition = ImGuiCond.FirstUseEver; SizeCondition = ImGuiCond.FirstUseEver;
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true;
PayloadHandler = new PayloadHandler(this); PayloadHandler = new PayloadHandler(this);
HandlerLender = new Lender<PayloadHandler>(() => new PayloadHandler(this)); HandlerLender = new Lender<PayloadHandler>(() => new PayloadHandler(this));
@@ -831,7 +832,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
var table = tab.DisplayTimestamp && Plugin.Config.PrettierTimestamps; var table = tab.DisplayTimestamp && Plugin.Config.PrettierTimestamps;
var oldCellPaddingY = ImGui.GetStyle().CellPadding.Y; var oldCellPaddingY = ImGui.GetStyle().CellPadding.Y;
if (Plugin.Config.PrettierTimestamps && Plugin.Config.MoreCompactPretty) if (Plugin.Config is { PrettierTimestamps: true, MoreCompactPretty: true })
{ {
var padding = ImGui.GetStyle().CellPadding; var padding = ImGui.GetStyle().CellPadding;
padding.Y = 0; padding.Y = 0;
@@ -842,7 +843,10 @@ public sealed class ChatLogWindow : Window, IUiComponent
if (table) if (table)
{ {
if (!ImGui.BeginTable("timestamp-table", 2, ImGuiTableFlags.PreciseWidths)) if (!ImGui.BeginTable("timestamp-table", 2, ImGuiTableFlags.PreciseWidths))
goto EndChild; {
ImGui.EndChild();
return;
}
ImGui.TableSetupColumn("timestamps", ImGuiTableColumnFlags.WidthFixed); ImGui.TableSetupColumn("timestamps", ImGuiTableColumnFlags.WidthFixed);
ImGui.TableSetupColumn("messages", ImGuiTableColumnFlags.WidthStretch); ImGui.TableSetupColumn("messages", ImGuiTableColumnFlags.WidthStretch);
@@ -878,7 +882,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
{ {
var messageHash = message.Hash; var messageHash = message.Hash;
var same = lastMessageHash == messageHash; var same = lastMessageHash == messageHash;
if (same) { if (same)
{
sameCount += 1; sameCount += 1;
if (i != tab.Messages.Count - 1) if (i != tab.Messages.Count - 1)
@@ -888,14 +893,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
if (sameCount > 0) if (sameCount > 0)
{ {
ImGui.SameLine(); ImGui.SameLine();
DrawChunks(new[] DrawChunks(
{ new[] { new TextChunk(ChunkSource.None, null, $" ({sameCount + 1}x)") { FallbackColour = ChatType.System, Italic = true, } },
new TextChunk(ChunkSource.None, null, $" ({sameCount + 1}x)")
{
FallbackColour = ChatType.System,
Italic = true,
},
},
true, true,
handler, handler,
ImGui.GetContentRegionAvail().X ImGui.GetContentRegionAvail().X
@@ -914,31 +913,29 @@ public sealed class ChatLogWindow : Window, IUiComponent
ImGui.TableNextColumn(); ImGui.TableNextColumn();
// message has rendered once // message has rendered once
if (message.Height.HasValue) // message isn't visible, so render dummy
if (message is { Height: not null, IsVisible: false })
{ {
// message isn't visible, so render dummy var beforeDummy = ImGui.GetCursorPos();
if (!message.IsVisible)
// skip to the message column for vis test
if (table)
ImGui.TableNextColumn();
ImGui.Dummy(new Vector2(10f, message.Height.Value));
message.IsVisible = ImGui.IsItemVisible();
if (message.IsVisible)
{ {
var beforeDummy = ImGui.GetCursorPos();
// skip to the message column for vis test
if (table) if (table)
ImGui.TableNextColumn(); ImGui.TableSetColumnIndex(0);
ImGui.Dummy(new Vector2(10f, message.Height.Value)); ImGui.SetCursorPos(beforeDummy);
message.IsVisible = ImGui.IsItemVisible(); }
else
if (message.IsVisible) {
{ lastPos = ImGui.GetCursorPosY();
if (table) continue;
ImGui.TableSetColumnIndex(0);
ImGui.SetCursorPos(beforeDummy);
}
else
{
goto UpdateMessage;
}
} }
} }
@@ -954,10 +951,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
} }
else else
{ {
DrawChunk(new TextChunk(ChunkSource.None, null, $"[{timestamp}]") DrawChunk(new TextChunk(ChunkSource.None, null, $"[{timestamp}]") { Foreground = 0xFFFFFFFF, });
{
Foreground = 0xFFFFFFFF,
});
ImGui.SameLine(); ImGui.SameLine();
} }
} }
@@ -990,15 +984,13 @@ public sealed class ChatLogWindow : Window, IUiComponent
} }
message.IsVisible = ImGui.IsRectVisible(beforeDraw, afterDraw); message.IsVisible = ImGui.IsRectVisible(beforeDraw, afterDraw);
UpdateMessage:
lastPos = ImGui.GetCursorPosY(); lastPos = ImGui.GetCursorPosY();
} }
} }
finally finally
{ {
tab.MessagesMutex.Release(); tab.MessagesMutex.Release();
ImGui.PopStyleVar(Plugin.Config.PrettierTimestamps && Plugin.Config.MoreCompactPretty ? 2 : 1); ImGui.PopStyleVar(Plugin.Config is { PrettierTimestamps: true, MoreCompactPretty: true } ? 2 : 1);
} }
if (switchedTab || ImGui.GetScrollY() >= ImGui.GetScrollMaxY()) if (switchedTab || ImGui.GetScrollY() >= ImGui.GetScrollMaxY())
@@ -1009,7 +1001,6 @@ public sealed class ChatLogWindow : Window, IUiComponent
ImGui.EndTable(); ImGui.EndTable();
} }
EndChild:
ImGui.EndChild(); ImGui.EndChild();
} }
+1
View File
@@ -20,6 +20,7 @@ public class CommandHelpWindow : Window {
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.AlwaysAutoResize; ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.AlwaysAutoResize;
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true;
} }
// Sets IsOpen to true if it should be drawn // Sets IsOpen to true if it should be drawn
+1
View File
@@ -21,6 +21,7 @@ internal class Popout : Window
SizeCondition = ImGuiCond.FirstUseEver; SizeCondition = ImGuiCond.FirstUseEver;
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true;
} }
public override void PreDraw() public override void PreDraw()
+1
View File
@@ -24,6 +24,7 @@ public class SeStringDebugger : Window
}; };
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true;
#if DEBUG #if DEBUG
Plugin.Commands.Register("/chat2Debugger").Execute += Toggle; Plugin.Commands.Register("/chat2Debugger").Execute += Toggle;
+1
View File
@@ -41,6 +41,7 @@ public sealed class SettingsWindow : Window, IUiComponent
}; };
RespectCloseHotkey = false; RespectCloseHotkey = false;
DisableWindowSounds = true;
Initialise(); Initialise();