Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChatTwo/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ public class Tab
public bool UnhideOnActivity;
public bool DisplayTimestamp = true;
public InputChannel? Channel;
public bool LockChannel = true;
public bool PopOut;
public bool IndependentOpacity;
public float Opacity = 100f;
Expand Down Expand Up @@ -342,6 +343,7 @@ public Tab Clone()
LastActivity = LastActivity,
DisplayTimestamp = DisplayTimestamp,
Channel = Channel,
LockChannel = LockChannel,
PopOut = PopOut,
IndependentOpacity = IndependentOpacity,
Opacity = Opacity,
Expand Down
9 changes: 9 additions & 0 deletions ChatTwo/Resources/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ChatTwo/Resources/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@
<data name="Options_Tabs_InputChannel">
<value>Input channel</value>
</data>
<data name="Options_Tabs_LockChannel">
<value>Lock input channel</value>
</data>
<data name="Options_Tabs_Channels">
<value>Channels</value>
</data>
Expand Down
18 changes: 14 additions & 4 deletions ChatTwo/Ui/ChatLog/ChatLog.Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public partial class ChatLog : Window, IChatWindow
private bool WasDocked;

private bool DrewThisFrame;
private DateTime? ApplyDefaultChannelAt;

public bool IsHidden;
public HideState CurrentHideState { get; set; } = HideState.None;
Expand Down Expand Up @@ -91,6 +92,7 @@ private void Logout(int _, int __)
private void Login()
{
Plugin.MessageManager.FilterAllTabsAsync();
ApplyDefaultChannelAt = DateTime.UtcNow.AddSeconds(3);
}

public unsafe void Activated(ChatActivatedArgs args)
Expand Down Expand Up @@ -375,8 +377,15 @@ private unsafe void DrawChatLog()

var activeTab = Plugin.CurrentTab;

// This tab has a fixed channel, so we force this channel to be always set as current
if (activeTab.Channel is not null)
if (ApplyDefaultChannelAt is { } applyAt && DateTime.UtcNow >= applyAt)
{
ApplyDefaultChannelAt = null;
if (activeTab.Channel is not null && !activeTab.LockChannel)
Plugin.Functions.Chat.SetChannelWithExtraChat(activeTab.Channel);
}

// This tab has a locked channel, so we force this channel to be always set as current
if (activeTab.Channel is not null && activeTab.LockChannel)
activeTab.CurrentChannel.SetChannel(activeTab.Channel.Value);

if (Plugin.Config.PreviewPosition is PreviewPosition.Inside && Plugin.InputPreview.IsDrawable)
Expand All @@ -385,10 +394,11 @@ private unsafe void DrawChatLog()
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
DrawChannelName(activeTab);

if (ImGuiUtil.IconButton(FontAwesomeIcon.Comment) && activeTab.Channel is null)
var switcherDisabled = activeTab.Channel is not null && activeTab.LockChannel;
if (ImGuiUtil.IconButton(FontAwesomeIcon.Comment) && !switcherDisabled)
ImGui.OpenPopup(ChatChannelPicker);

if (activeTab.Channel is not null && ImGui.IsItemHovered())
if (switcherDisabled && ImGui.IsItemHovered())
ImGuiUtil.Tooltip(Language.ChatLog_SwitcherDisabled);

using (var popup = ImRaii.Popup(ChatChannelPicker))
Expand Down
3 changes: 3 additions & 0 deletions ChatTwo/Ui/SettingsTabs/Tabs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ public void Draw(bool changed)
}
}

if (tab.Channel is not null)
ImGui.Checkbox(Language.Options_Tabs_LockChannel, ref tab.LockChannel);

var player = Plugin.ObjectTable.LocalPlayer;
if (tab.Channel == InputChannel.Tell && player != null)
{
Expand Down