- Display name even if invalid channel is selected

- Add NoMove & NoResize to tabs
This commit is contained in:
Infi
2024-12-14 14:54:20 +01:00
parent 6144631b16
commit 97a8b96326
25 changed files with 171 additions and 40 deletions
+11 -13
View File
@@ -813,8 +813,7 @@ public sealed class ChatLogWindow : Window
{
if (!string.IsNullOrWhiteSpace(activeTab.CurrentChannel.TellTarget.Name) && activeTab.CurrentChannel.TellTarget.World != 0)
{
// Note: don't use HidePlayerInString here because
// abbreviation settings do not affect this.
// Note: don't use HidePlayerInString here because abbreviation settings do not affect this.
var playerName = HashPlayer(activeTab.CurrentChannel.TellTarget.Name, activeTab.CurrentChannel.TellTarget.World);
var world = Sheets.WorldSheet.TryGetRow(activeTab.CurrentChannel.TellTarget.World, out var worldRow)
? worldRow.Name.ExtractText()
@@ -830,14 +829,15 @@ public sealed class ChatLogWindow : Window
}
else
{
// We still need to censor the name if we couldn't read
// valid data.
// We still need to censor the name if we couldn't read valid data.
channelNameChunks = [new TextChunk(ChunkSource.None, null, "Tell")];
}
}
else
{
channelNameChunks = activeTab.CurrentChannel.Name.ToArray();
channelNameChunks = activeTab.CurrentChannel.Name.Count > 0
? activeTab.CurrentChannel.Name.ToArray()
: [new TextChunk(ChunkSource.None, null, activeTab.CurrentChannel.Channel.ToChatType().Name())];
}
return channelNameChunks;
@@ -913,8 +913,8 @@ public sealed class ChatLogWindow : Window
Plugin.Functions.Chat.SendTellUsingCommandInner(tellBytes);
TellSpecial = false;
activeTab.CurrentChannel.ResetTempChannel();
activeTab.CurrentChannel.ResetTempChannel();
Chat = string.Empty;
return;
}
@@ -933,6 +933,7 @@ public sealed class ChatLogWindow : Window
ChatBox.SendMessageUnsafe(tellBytes);
activeTab.CurrentChannel.ResetTempChannel();
Chat = string.Empty;
return;
}
@@ -950,9 +951,7 @@ public sealed class ChatLogWindow : Window
Plugin.Functions.Chat.SendTell(reason, target.ContentId, target.Name, (ushort) world.RowId, tellBytes, trimmed);
}
if (activeTab.CurrentChannel.TempChannel is InputChannel.Tell)
activeTab.CurrentChannel.TempTellTarget = null;
activeTab.CurrentChannel.ResetTempChannel();
Chat = string.Empty;
return;
}
@@ -969,6 +968,7 @@ public sealed class ChatLogWindow : Window
ChatBox.SendMessageUnsafe(bytes);
}
activeTab.CurrentChannel.ResetTempChannel();
Chat = string.Empty;
}
@@ -1315,6 +1315,8 @@ public sealed class ChatLogWindow : Window
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.ChatLog_Tabs_Delete))
{
tabs.RemoveAt(i);
Plugin.WantedTab = 0;
anyChanged = true;
}
@@ -1746,10 +1748,6 @@ public sealed class ChatLogWindow : Window
var content = text.Content ?? "";
if (ScreenshotMode)
{
// TODO: the result of hashing the player name should be cached.
// Currently we recalculate the abbreviated player names, the
// hashes and the string replacements every frame when they
// never change.
if (chunk.Link is PlayerPayload playerPayload)
content = HidePlayerInString(content, playerPayload.PlayerName, playerPayload.World.RowId);
else if (Plugin.ClientState.LocalPlayer is { } player)
+23
View File
@@ -1,7 +1,11 @@
using System.Numerics;
using ChatTwo.Code;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using ImGuiNET;
using Lumina.Text.ReadOnly;
namespace ChatTwo.Ui;
@@ -45,9 +49,28 @@ public class DebuggerWindow : Window
if (ImGui.Selectable($"Agent Address: {agent:X}"))
ImGui.SetClipboardText(agent.ToString("X"));
ImGuiHelpers.ScaledDummy(5.0f);
ImGui.TextUnformatted($"Handle Tooltips: {ChatLogWindow.PayloadHandler.HandleTooltips}");
ImGui.TextUnformatted($"Hovered Item: {ChatLogWindow.PayloadHandler.HoveredItem}");
ImGui.TextUnformatted($"Hover Counter: {ChatLogWindow.PayloadHandler.HoverCounter}");
ImGui.TextUnformatted($"Last Hover Counter: {ChatLogWindow.PayloadHandler.LastHoverCounter}");
ImGuiHelpers.ScaledDummy(5.0f);
ImGui.TextColored(ImGuiColors.DalamudOrange, "Current Tab");
ImGui.TextUnformatted($"Name: {Plugin.CurrentTab.Name}");
ImGui.TextUnformatted($"Channel: {Plugin.CurrentTab.CurrentChannel.Channel.ToChatType().Name()}");
ImGui.TextUnformatted($"Tell Target: {Plugin.CurrentTab.CurrentChannel.TellTarget?.ToTargetString() ?? "Null"}");
ImGui.TextUnformatted($"Use Temp? {Plugin.CurrentTab.CurrentChannel.UseTempChannel}");
ImGui.TextUnformatted($"Temp Channel: {Plugin.CurrentTab.CurrentChannel.TempChannel.ToChatType().Name()}");
ImGui.TextUnformatted($"Temp Tell Target: {Plugin.CurrentTab.CurrentChannel.TempTellTarget?.ToTargetString() ?? "Null"}");
ImGui.TextUnformatted($"Name Set? {Plugin.CurrentTab.CurrentChannel.Name.Count > 0}");
ImGui.TextUnformatted($"Name {string.Join(" ", Plugin.CurrentTab.CurrentChannel.Name.Select(c => c.StringValue()))}");
ImGuiHelpers.ScaledDummy(5.0f);
ImGui.TextColored(ImGuiColors.DalamudOrange, "Vanilla Chat");
ImGui.TextUnformatted($"Channel: {new ReadOnlySeString(AgentChatLog.Instance()->ChannelLabel).ExtractText()}");
}
}
+6
View File
@@ -62,6 +62,12 @@ internal class Popout : Window
if (!Plugin.Config.ShowPopOutTitleBar)
Flags |= ImGuiWindowFlags.NoTitleBar;
if (!Tab.CanMove)
Flags |= ImGuiWindowFlags.NoMove;
if (!Tab.CanResize)
Flags |= ImGuiWindowFlags.NoResize;
if (!ChatLogWindow.PopOutDocked[Idx])
{
var alpha = Tab.IndependentOpacity ? Tab.Opacity : Plugin.Config.WindowAlpha;
+1 -1
View File
@@ -39,7 +39,7 @@ public sealed class SettingsWindow : Window
new Preview(Mutable),
new Fonts(Mutable),
new ChatColours(Plugin, Mutable),
new Tabs(Mutable),
new Tabs(Plugin, Mutable),
new Database(Plugin, Mutable),
new Webinterface(Plugin, Mutable),
new Miscellaneous(Mutable),
+1 -1
View File
@@ -86,8 +86,8 @@ internal sealed class ChatLog : ISettingsTab
ImGui.Spacing();
ImGui.TextUnformatted(Language.Options_AdjustPosition_Name);
var pos = Plugin.ChatLogWindow.LastWindowPos;
ImGui.SetNextItemWidth(-1);
var pos = Plugin.ChatLogWindow.LastWindowPos;
if (ImGui.DragFloat2($"##{Language.Options_AdjustPosition_Name}", ref pos, 1, 0, float.MaxValue, "%.0fpx"))
Plugin.ChatLogWindow.Position = pos;
ImGuiUtil.WarningText(Language.Options_AdjustPosition_Warning);
+12 -1
View File
@@ -9,14 +9,16 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Tabs : ISettingsTab
{
private readonly Plugin Plugin;
private Configuration Mutable { get; }
public string Name => Language.Options_Tabs_Tab + "###tabs-tabs";
private int ToOpen = -2;
internal Tabs(Configuration mutable)
internal Tabs(Plugin plugin, Configuration mutable)
{
Plugin = plugin;
Mutable = mutable;
}
@@ -89,6 +91,12 @@ internal sealed class Tabs : ISettingsTab
ImGui.Checkbox(Language.Options_Tabs_IndependentOpacity, ref tab.IndependentOpacity);
if (tab.IndependentOpacity)
ImGuiUtil.DragFloatVertical(Language.Options_Tabs_Opacity, ref tab.Opacity, 0.25f, 0f, 100f, $"{tab.Opacity:N2}%%", ImGuiSliderFlags.AlwaysClamp);
ImGuiUtil.OptionCheckbox(ref tab.CanMove, Language.Options_CanMove_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref tab.CanResize, Language.Options_CanResize_Name);
ImGui.Spacing();
}
using (var combo = ImGuiUtil.BeginComboVertical(Language.Options_Tabs_UnreadMode, tab.UnreadMode.Name()))
@@ -130,7 +138,10 @@ internal sealed class Tabs : ISettingsTab
}
if (toRemove > -1)
{
Mutable.Tabs.RemoveAt(toRemove);
Plugin.WantedTab = 0;
}
if (doOpens)
ToOpen = -2;