diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs
index d8e0b920..3b592715 100755
--- a/ChatTwo/Configuration.cs
+++ b/ChatTwo/Configuration.cs
@@ -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;
@@ -342,6 +343,7 @@ public Tab Clone()
LastActivity = LastActivity,
DisplayTimestamp = DisplayTimestamp,
Channel = Channel,
+ LockChannel = LockChannel,
PopOut = PopOut,
IndependentOpacity = IndependentOpacity,
Opacity = Opacity,
diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs
index 06aab337..ecac701c 100755
--- a/ChatTwo/Resources/Language.Designer.cs
+++ b/ChatTwo/Resources/Language.Designer.cs
@@ -3516,6 +3516,15 @@ internal static string Options_Tabs_InputChannel {
}
}
+ ///
+ /// Looks up a localized string similar to Lock input channel.
+ ///
+ internal static string Options_Tabs_LockChannel {
+ get {
+ return ResourceManager.GetString("Options_Tabs_LockChannel", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Move down.
///
diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx
index db025214..db247ae3 100644
--- a/ChatTwo/Resources/Language.resx
+++ b/ChatTwo/Resources/Language.resx
@@ -241,6 +241,9 @@
Input channel
+
+ Lock input channel
+
Channels
diff --git a/ChatTwo/Ui/ChatLog/ChatLog.Window.cs b/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
index bda787e9..a1ef1b08 100644
--- a/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
+++ b/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
@@ -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;
@@ -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)
@@ -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)
@@ -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))
diff --git a/ChatTwo/Ui/SettingsTabs/Tabs.cs b/ChatTwo/Ui/SettingsTabs/Tabs.cs
index a724df2d..4cf76b7e 100755
--- a/ChatTwo/Ui/SettingsTabs/Tabs.cs
+++ b/ChatTwo/Ui/SettingsTabs/Tabs.cs
@@ -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)
{