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">
<PropertyGroup>
<Version>1.21.1</Version>
<Version>1.21.2</Version>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
+15 -24
View File
@@ -87,6 +87,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
SizeCondition = ImGuiCond.FirstUseEver;
RespectCloseHotkey = false;
DisableWindowSounds = true;
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 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;
padding.Y = 0;
@@ -842,7 +843,10 @@ public sealed class ChatLogWindow : Window, IUiComponent
if (table)
{
if (!ImGui.BeginTable("timestamp-table", 2, ImGuiTableFlags.PreciseWidths))
goto EndChild;
{
ImGui.EndChild();
return;
}
ImGui.TableSetupColumn("timestamps", ImGuiTableColumnFlags.WidthFixed);
ImGui.TableSetupColumn("messages", ImGuiTableColumnFlags.WidthStretch);
@@ -878,7 +882,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
{
var messageHash = message.Hash;
var same = lastMessageHash == messageHash;
if (same) {
if (same)
{
sameCount += 1;
if (i != tab.Messages.Count - 1)
@@ -888,14 +893,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
if (sameCount > 0)
{
ImGui.SameLine();
DrawChunks(new[]
{
new TextChunk(ChunkSource.None, null, $" ({sameCount + 1}x)")
{
FallbackColour = ChatType.System,
Italic = true,
},
},
DrawChunks(
new[] { new TextChunk(ChunkSource.None, null, $" ({sameCount + 1}x)") { FallbackColour = ChatType.System, Italic = true, } },
true,
handler,
ImGui.GetContentRegionAvail().X
@@ -914,10 +913,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
ImGui.TableNextColumn();
// message has rendered once
if (message.Height.HasValue)
{
// message isn't visible, so render dummy
if (!message.IsVisible)
if (message is { Height: not null, IsVisible: false })
{
var beforeDummy = ImGui.GetCursorPos();
@@ -937,8 +934,8 @@ public sealed class ChatLogWindow : Window, IUiComponent
}
else
{
goto UpdateMessage;
}
lastPos = ImGui.GetCursorPosY();
continue;
}
}
@@ -954,10 +951,7 @@ public sealed class ChatLogWindow : Window, IUiComponent
}
else
{
DrawChunk(new TextChunk(ChunkSource.None, null, $"[{timestamp}]")
{
Foreground = 0xFFFFFFFF,
});
DrawChunk(new TextChunk(ChunkSource.None, null, $"[{timestamp}]") { Foreground = 0xFFFFFFFF, });
ImGui.SameLine();
}
}
@@ -990,15 +984,13 @@ public sealed class ChatLogWindow : Window, IUiComponent
}
message.IsVisible = ImGui.IsRectVisible(beforeDraw, afterDraw);
UpdateMessage:
lastPos = ImGui.GetCursorPosY();
}
}
finally
{
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())
@@ -1009,7 +1001,6 @@ public sealed class ChatLogWindow : Window, IUiComponent
ImGui.EndTable();
}
EndChild:
ImGui.EndChild();
}
+1
View File
@@ -20,6 +20,7 @@ public class CommandHelpWindow : Window {
ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.AlwaysAutoResize;
RespectCloseHotkey = false;
DisableWindowSounds = true;
}
// Sets IsOpen to true if it should be drawn
+1
View File
@@ -21,6 +21,7 @@ internal class Popout : Window
SizeCondition = ImGuiCond.FirstUseEver;
RespectCloseHotkey = false;
DisableWindowSounds = true;
}
public override void PreDraw()
+1
View File
@@ -24,6 +24,7 @@ public class SeStringDebugger : Window
};
RespectCloseHotkey = false;
DisableWindowSounds = true;
#if DEBUG
Plugin.Commands.Register("/chat2Debugger").Execute += Toggle;
+1
View File
@@ -41,6 +41,7 @@ public sealed class SettingsWindow : Window, IUiComponent
};
RespectCloseHotkey = false;
DisableWindowSounds = true;
Initialise();