Adjustable chat log position through sliders

This commit is contained in:
Infi
2024-05-03 11:36:05 +02:00
parent fd08ec20ef
commit bdb308ec02
35 changed files with 55 additions and 491 deletions
+8 -2
View File
@@ -95,6 +95,8 @@ public sealed class ChatLogWindow : Window
Size = new Vector2(500, 250);
SizeCondition = ImGuiCond.FirstUseEver;
PositionCondition = ImGuiCond.Always;
IsOpen = true;
RespectCloseHotkey = false;
DisableWindowSounds = true;
@@ -482,8 +484,12 @@ public sealed class ChatLogWindow : Window
private unsafe void DrawChatLog()
{
var resized = LastWindowSize != ImGui.GetWindowSize();
LastWindowSize = ImGui.GetWindowSize();
// Position change has applied, so we set it to null again
Position = null;
var currentSize = ImGui.GetWindowSize();
var resized = LastWindowSize != currentSize;
LastWindowSize = currentSize;
LastWindowPos = ImGui.GetWindowPos();
if (resized)
+3 -3
View File
@@ -34,11 +34,11 @@ public sealed class SettingsWindow : Window
Tabs = new List<ISettingsTab>
{
new Display(Mutable),
new ChatLog(Mutable),
new ChatLog(Plugin, Mutable),
new Ui.SettingsTabs.Fonts(Mutable),
new ChatColours(Mutable, Plugin),
new ChatColours(Plugin, Mutable),
new Tabs(Plugin, Mutable),
new Database(Mutable, Plugin),
new Database(Plugin, Mutable),
new Miscellaneous(Mutable),
new About(),
};
+3 -3
View File
@@ -8,15 +8,15 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class ChatColours : ISettingsTab
{
private Configuration Mutable { get; }
private Plugin Plugin { get; }
private Configuration Mutable { get; }
public string Name => Language.Options_ChatColours_Tab + "###tabs-chat-colours";
internal ChatColours(Configuration mutable, Plugin plugin)
internal ChatColours(Plugin plugin, Configuration mutable)
{
Mutable = mutable;
Plugin = plugin;
Mutable = mutable;
#if DEBUG
// Users can set colours for ExtraChat linkshells in the ExtraChat plugin directly.
+15 -1
View File
@@ -8,12 +8,14 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class ChatLog : ISettingsTab
{
private readonly Plugin Plugin;
private Configuration Mutable { get; }
public string Name => Language.Options_ChatLog_Tab + "###tabs-chatlog";
internal ChatLog(Configuration mutable)
internal ChatLog(Plugin plugin, Configuration mutable)
{
Plugin = plugin;
Mutable = mutable;
}
@@ -59,6 +61,18 @@ internal sealed class ChatLog : ISettingsTab
ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc);
ImGui.Spacing();
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
ImGui.TextUnformatted(Language.Options_AdjustPosition_Name);
var pos = Plugin.ChatLogWindow.LastWindowPos;
ImGui.SetNextItemWidth(-1);
if (ImGui.DragFloat2($"##{Language.Options_AdjustPosition_Name}", ref pos, 1, 0, float.MaxValue, "%.0fpx"))
Plugin.ChatLogWindow.Position = pos;
ImGuiUtil.WarningText(Language.Options_AdjustPosition_Warning);
ImGui.Spacing();
ImGui.PopTextWrapPos();
if (!Mutable.OverrideStyle)
+2 -2
View File
@@ -12,12 +12,12 @@ namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Database : ISettingsTab
{
private Configuration Mutable { get; }
private Plugin Plugin { get; }
private Configuration Mutable { get; }
public string Name => Language.Options_Database_Tab + "###tabs-database";
internal Database(Configuration mutable, Plugin plugin)
internal Database(Plugin plugin, Configuration mutable)
{
Plugin = plugin;
Mutable = mutable;