Compare commits

...

8 Commits

Author SHA1 Message Date
da631c1100
chore: bump version to 1.3.0 2022-01-15 14:34:48 -05:00
d9d1e9acf6
feat: add /clearlog2 2022-01-15 14:34:31 -05:00
eeda23073b
feat: add new settings ui
Also add window display options.
2022-01-15 14:27:56 -05:00
3c65e224f9
fix: add french glyph 2022-01-15 14:01:23 -05:00
e835ad088b
fix: account for global scale 2022-01-15 13:55:43 -05:00
31c0110085
fix: add missing glyph 2022-01-15 00:24:54 -05:00
47aee321a4
feat: add option to make modern more compact 2022-01-15 00:24:47 -05:00
35330b4038
fix: solve off-by-one issue 2022-01-15 00:24:19 -05:00
11 changed files with 299 additions and 159 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.2.0</Version>
<Version>1.3.0</Version>
<TargetFramework>net5.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

View File

@ -10,10 +10,28 @@ internal class Configuration : IPluginConfiguration {
public bool HideChat = true;
public bool NativeItemTooltips = true;
public bool PrettierTimestamps = true;
public bool MoreCompactPretty;
public bool SidebarTabView;
public bool CanMove = true;
public bool CanResize = true;
public bool ShowTitleBar;
public float FontSize = 17f;
public Dictionary<ChatType, uint> ChatColours = new();
public List<Tab> Tabs = new();
internal void UpdateFrom(Configuration other) {
this.HideChat = other.HideChat;
this.NativeItemTooltips = other.NativeItemTooltips;
this.PrettierTimestamps = other.PrettierTimestamps;
this.MoreCompactPretty = other.MoreCompactPretty;
this.SidebarTabView = other.SidebarTabView;
this.CanMove = other.CanMove;
this.CanResize = other.CanResize;
this.ShowTitleBar = other.ShowTitleBar;
this.FontSize = other.FontSize;
this.ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
this.Tabs = other.Tabs.Select(t => t.Clone()).ToList();
}
}
[Serializable]
@ -55,6 +73,12 @@ internal class Tab {
}
}
internal void Clear() {
this.MessagesMutex.WaitOne();
this.Messages.Clear();
this.MessagesMutex.ReleaseMutex();
}
internal Tab Clone() {
return new Tab {
Name = this.Name,

View File

@ -6,6 +6,7 @@ using ChatTwo.Util;
using Dalamud.Game.ClientState.Objects.SubKinds;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using Dalamud.Logging;
using Dalamud.Utility;
using ImGuiNET;
@ -85,9 +86,11 @@ internal sealed class PayloadHandler {
}
internal void Hover(Payload payload) {
var hoverSize = 250f * ImGuiHelpers.GlobalScale;
switch (payload) {
case StatusPayload status: {
this.DoHover(() => this.HoverStatus(status), 250f);
this.DoHover(() => this.HoverStatus(status), hoverSize);
break;
}
case ItemPayload item: {
@ -105,7 +108,7 @@ internal sealed class PayloadHandler {
break;
}
this.DoHover(() => this.HoverItem(item), 250f);
this.DoHover(() => this.HoverItem(item), hoverSize);
break;
}
}
@ -131,9 +134,10 @@ internal sealed class PayloadHandler {
var lineHeight = ImGui.CalcTextSize("A").Y;
var cursor = ImGui.GetCursorPos();
ImGui.Image(icon.ImGuiHandle, new Vector2(icon.Width, icon.Height));
var size = new Vector2(icon.Width, icon.Height) * ImGuiHelpers.GlobalScale;
ImGui.Image(icon.ImGuiHandle, size);
ImGui.SameLine();
ImGui.SetCursorPos(cursor + new Vector2(icon.Width + 4, (float) icon.Height / 2 - lineHeight / 2));
ImGui.SetCursorPos(cursor + new Vector2(size.X + 4, size.Y / 2 - lineHeight / 2));
}
private void HoverStatus(StatusPayload status) {

View File

@ -61,7 +61,7 @@ internal sealed class PluginUi : IDisposable {
var builder = new ImFontGlyphRangesBuilderPtr(ImGuiNative.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder());
builder.AddRanges(ImGui.GetIO().Fonts.GetGlyphRangesDefault());
builder.AddText("←→↑↓《》■※☀★★☆♥♡ヅツッシ☀☁☂℃℉°♀♂♠♣♦♣♧®©™€$£♯♭♪✓√◎◆◇♦■□〇●△▽▼▲‹›≤≥<«“”─\~");
builder.AddText("←→↑↓《》■※☀★★☆♥♡ヅツッシ☀☁☂℃℉°♀♂♠♣♦♣♧®©™€$£♯♭♪✓√◎◆◇♦■□〇●△▽▼▲‹›≤≥<«“”─\~Œœ");
builder.BuildRanges(out this._ranges);
var regular = this.GetResource("ChatTwo.fonts.NotoSans-Regular.ttf");

View File

@ -1,6 +1,7 @@
using System.Numerics;
using ChatTwo.Code;
using ChatTwo.Util;
using Dalamud.Game.Command;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Interface;
using ImGuiNET;
@ -26,6 +27,9 @@ internal sealed class ChatLog : IUiComponent {
internal ChatLog(PluginUi ui) {
this.Ui = ui;
this.PayloadHandler = new PayloadHandler(this.Ui, this);
this.Ui.Plugin.CommandManager.AddHandler("/clearlog2", new CommandInfo(this.ClearLog) {
HelpMessage = "Clears the Chat 2 chat log",
});
this._fontIcon = this.Ui.Plugin.DataManager.GetImGuiTexture("common/font/fonticon_ps5.tex");
@ -35,6 +39,7 @@ internal sealed class ChatLog : IUiComponent {
public void Dispose() {
this.Ui.Plugin.Functions.Chat.Activated -= this.Activated;
this._fontIcon?.Dispose();
this.Ui.Plugin.CommandManager.RemoveHandler("/clearlog2");
}
private void Activated(string? input) {
@ -44,6 +49,33 @@ internal sealed class ChatLog : IUiComponent {
}
}
private void ClearLog(string command, string arguments) {
switch (arguments) {
case "all":
using (var messages = this.Ui.Plugin.Store.GetMessages()) {
messages.Messages.Clear();
}
foreach (var tab in this.Ui.Plugin.Config.Tabs) {
tab.Clear();
}
break;
case "help":
this.Ui.Plugin.ChatGui.Print("- /clearlog2: clears the active tab's log");
this.Ui.Plugin.ChatGui.Print("- /clearlog2 all: clears all tabs' logs and the global history");
this.Ui.Plugin.ChatGui.Print("- /clearlog2 help: shows this help");
break;
default:
if (this._lastTab > -1 && this._lastTab < this.Ui.Plugin.Config.Tabs.Count) {
this.Ui.Plugin.Config.Tabs[this._lastTab].Clear();
}
break;
}
}
private void AddBacklog(string message) {
for (var i = 0; i < this._inputBacklog.Count; i++) {
if (this._inputBacklog[i] != message) {
@ -65,7 +97,20 @@ internal sealed class ChatLog : IUiComponent {
}
public unsafe void Draw() {
if (!ImGui.Begin($"{this.Ui.Plugin.Name}##chat", ImGuiWindowFlags.NoTitleBar)) {
var flags = ImGuiWindowFlags.None;
if (!this.Ui.Plugin.Config.CanMove) {
flags |= ImGuiWindowFlags.NoMove;
}
if (!this.Ui.Plugin.Config.CanResize) {
flags |= ImGuiWindowFlags.NoResize;
}
if (!this.Ui.Plugin.Config.ShowTitleBar) {
flags |= ImGuiWindowFlags.NoTitleBar;
}
if (!ImGui.Begin($"{this.Ui.Plugin.Name}##chat", flags)) {
ImGui.End();
return;
}
@ -79,7 +124,7 @@ internal sealed class ChatLog : IUiComponent {
}
Tab? activeTab = null;
if (currentTab > -1 && currentTab < this.Ui.Plugin.Config.Tabs.Count - 1) {
if (currentTab > -1 && currentTab < this.Ui.Plugin.Config.Tabs.Count) {
activeTab = this.Ui.Plugin.Config.Tabs[currentTab];
}
@ -174,6 +219,13 @@ internal sealed class ChatLog : IUiComponent {
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);
var table = tab.DisplayTimestamp && this.Ui.Plugin.Config.PrettierTimestamps;
if (this.Ui.Plugin.Config.MoreCompactPretty) {
var padding = ImGui.GetStyle().CellPadding;
padding.Y = 0;
ImGui.PushStyleVar(ImGuiStyleVar.CellPadding, padding);
}
if (table) {
if (!ImGui.BeginTable("timestamp-table", 2, ImGuiTableFlags.PreciseWidths)) {
goto EndChild;
@ -227,7 +279,7 @@ internal sealed class ChatLog : IUiComponent {
// }
} finally {
tab.MessagesMutex.ReleaseMutex();
ImGui.PopStyleVar();
ImGui.PopStyleVar(this.Ui.Plugin.Config.MoreCompactPretty ? 2 : 1);
}
// PluginLog.Log($"numDrawn: {numDrawn}");
@ -344,7 +396,7 @@ internal sealed class ChatLog : IUiComponent {
ImGui.PushID($"tab-context-menu-{i}");
ImGui.SetNextItemWidth(250f);
ImGui.SetNextItemWidth(250f * ImGuiHelpers.GlobalScale);
if (ImGui.InputText("##tab-name", ref tab.Name, 128)) {
anyChanged = true;
}
@ -467,7 +519,7 @@ internal sealed class ChatLog : IUiComponent {
var texSize = new Vector2(this._fontIcon.Width, this._fontIcon.Height);
var sizeRatio = this.Ui.Plugin.Config.FontSize / bounds.Value.W;
var size = new Vector2(bounds.Value.Z, bounds.Value.W) * sizeRatio;
var size = new Vector2(bounds.Value.Z, bounds.Value.W) * sizeRatio * ImGuiHelpers.GlobalScale;
var uv0 = new Vector2(bounds.Value.X, bounds.Value.Y - 2) / texSize;
var uv1 = new Vector2(bounds.Value.X + bounds.Value.Z, bounds.Value.Y - 2 + bounds.Value.W) / texSize;

View File

@ -1,8 +1,6 @@
using System.Numerics;
using ChatTwo.Code;
using ChatTwo.Util;
using ChatTwo.Ui.SettingsTabs;
using Dalamud.Game.Command;
using Dalamud.Interface;
using ImGuiNET;
namespace ChatTwo.Ui;
@ -10,16 +8,19 @@ namespace ChatTwo.Ui;
internal sealed class Settings : IUiComponent {
private PluginUi Ui { get; }
private bool _hideChat;
private bool _nativeItemTooltips;
private bool _sidebarTabView;
private bool _prettierTimestamps;
private float _fontSize;
private Dictionary<ChatType, uint> _chatColours = new();
private List<Tab> _tabs = new();
private Configuration Mutable { get; }
private List<ISettingsTab> Tabs { get; }
internal Settings(PluginUi ui) {
this.Ui = ui;
this.Mutable = new Configuration();
this.Tabs = new List<ISettingsTab> {
new Display(this.Mutable),
new ChatColours(this.Mutable),
new Tabs(this.Mutable),
};
this.Ui.Plugin.CommandManager.AddHandler("/chat2", new CommandInfo(this.Command) {
HelpMessage = "Toggle the Chat 2 settings",
});
@ -34,14 +35,7 @@ internal sealed class Settings : IUiComponent {
}
private void Initialise() {
var config = this.Ui.Plugin.Config;
this._hideChat = config.HideChat;
this._nativeItemTooltips = config.NativeItemTooltips;
this._sidebarTabView = config.SidebarTabView;
this._prettierTimestamps = config.PrettierTimestamps;
this._fontSize = config.FontSize;
this._chatColours = config.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
this._tabs = config.Tabs.Select(tab => tab.Clone()).ToList();
this.Mutable.UpdateFrom(this.Ui.Plugin.Config);
}
public void Draw() {
@ -58,127 +52,26 @@ internal sealed class Settings : IUiComponent {
this.Initialise();
}
var height = ImGui.GetContentRegionAvail().Y
- ImGui.GetStyle().FramePadding.Y * 2
- ImGui.GetStyle().ItemSpacing.Y
- ImGui.GetStyle().ItemInnerSpacing.Y * 2
- ImGui.CalcTextSize("A").Y;
if (ImGui.BeginChild("##chat2-settings", new Vector2(-1, height))) {
ImGui.Checkbox("Hide chat", ref this._hideChat);
ImGui.Checkbox("Show native item tooltips", ref this._nativeItemTooltips);
ImGui.Checkbox("Show tabs in a sidebar", ref this._sidebarTabView);
ImGui.Checkbox("Use modern timestamp layout", ref this._prettierTimestamps);
ImGui.DragFloat("Font size", ref this._fontSize, .0125f, 12f, 36f, "%.1f");
if (ImGui.TreeNodeEx("Chat colours")) {
foreach (var type in Enum.GetValues<ChatType>()) {
if (ImGui.Button($"Default##{type}")) {
this._chatColours.Remove(type);
}
ImGui.SameLine();
var vec = this._chatColours.TryGetValue(type, out var colour)
? ColourUtil.RgbaToVector3(colour)
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) {
this._chatColours[type] = ColourUtil.Vector3ToRgba(vec);
}
if (ImGui.BeginTabBar("settings-tabs")) {
foreach (var settingsTab in this.Tabs) {
if (!ImGui.BeginTabItem(settingsTab.Name)) {
continue;
}
ImGui.TreePop();
var height = ImGui.GetContentRegionAvail().Y
- ImGui.GetStyle().FramePadding.Y * 2
- ImGui.GetStyle().ItemSpacing.Y
- ImGui.GetStyle().ItemInnerSpacing.Y * 2
- ImGui.CalcTextSize("A").Y;
if (ImGui.BeginChild("##chat2-settings", new Vector2(-1, height))) {
settingsTab.Draw();
ImGui.EndChild();
}
ImGui.EndTabItem();
}
if (ImGui.TreeNodeEx("Tabs")) {
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: "Add")) {
this._tabs.Add(new Tab());
}
var toRemove = -1;
for (var i = 0; i < this._tabs.Count; i++) {
var tab = this._tabs[i];
if (ImGui.TreeNodeEx($"{tab.Name}###tab-{i}")) {
ImGui.PushID($"tab-{i}");
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: "Delete")) {
toRemove = i;
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: "Move up") && i > 0) {
(this._tabs[i - 1], this._tabs[i]) = (this._tabs[i], this._tabs[i - 1]);
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: "Move down") && i < this._tabs.Count - 1) {
(this._tabs[i + 1], this._tabs[i]) = (this._tabs[i], this._tabs[i + 1]);
}
ImGui.InputText("Name", ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
ImGui.Checkbox("Show unread count", ref tab.DisplayUnread);
ImGui.Checkbox("Show timestamps", ref tab.DisplayTimestamp);
var input = tab.Channel?.ToChatType().Name() ?? "<None>";
if (ImGui.BeginCombo("Input channel", input)) {
if (ImGui.Selectable("<None>", tab.Channel == null)) {
tab.Channel = null;
}
foreach (var channel in Enum.GetValues<InputChannel>()) {
if (ImGui.Selectable(channel.ToChatType().Name(), tab.Channel == channel)) {
tab.Channel = channel;
}
}
ImGui.EndCombo();
}
if (ImGui.TreeNodeEx("Channels")) {
foreach (var type in Enum.GetValues<ChatType>()) {
var enabled = tab.ChatCodes.ContainsKey(type);
if (ImGui.Checkbox($"##{type.Name()}-{i}", ref enabled)) {
if (enabled) {
tab.ChatCodes[type] = ChatSourceExt.All;
} else {
tab.ChatCodes.Remove(type);
}
}
ImGui.SameLine();
if (ImGui.TreeNodeEx($"{type.Name()}##{i}")) {
tab.ChatCodes.TryGetValue(type, out var sourcesEnum);
var sources = (uint) sourcesEnum;
foreach (var source in Enum.GetValues<ChatSource>()) {
if (ImGui.CheckboxFlags(source.ToString(), ref sources, (uint) source)) {
tab.ChatCodes[type] = (ChatSource) sources;
}
}
ImGui.TreePop();
}
}
ImGui.TreePop();
}
ImGui.TreePop();
ImGui.PopID();
}
}
if (toRemove > -1) {
this._tabs.RemoveAt(toRemove);
}
}
ImGui.EndChild();
ImGui.EndTabBar();
}
ImGui.Separator();
@ -203,16 +96,10 @@ internal sealed class Settings : IUiComponent {
if (save) {
var config = this.Ui.Plugin.Config;
var hideChatChanged = this._hideChat != this.Ui.Plugin.Config.HideChat;
var fontSizeChanged = Math.Abs(this._fontSize - this.Ui.Plugin.Config.FontSize) > float.Epsilon;
var hideChatChanged = this.Mutable.HideChat != this.Ui.Plugin.Config.HideChat;
var fontSizeChanged = Math.Abs(this.Mutable.FontSize - this.Ui.Plugin.Config.FontSize) > float.Epsilon;
config.HideChat = this._hideChat;
config.NativeItemTooltips = this._nativeItemTooltips;
config.SidebarTabView = this._sidebarTabView;
config.PrettierTimestamps = this._prettierTimestamps;
config.FontSize = this._fontSize;
config.ChatColours = this._chatColours;
config.Tabs = this._tabs;
config.UpdateFrom(this.Mutable);
this.Ui.Plugin.SaveConfig();
@ -222,7 +109,7 @@ internal sealed class Settings : IUiComponent {
this.Ui.Plugin.Interface.UiBuilder.RebuildFonts();
}
if (!this._hideChat && hideChatChanged) {
if (!this.Mutable.HideChat && hideChatChanged) {
GameFunctions.GameFunctions.SetChatInteractable(true);
}

View File

@ -0,0 +1,34 @@
using ChatTwo.Code;
using ChatTwo.Util;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class ChatColours : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Chat colours";
internal ChatColours(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
foreach (var type in Enum.GetValues<ChatType>()) {
if (ImGui.Button($"Default##{type}")) {
this.Mutable.ChatColours.Remove(type);
}
ImGui.SameLine();
var vec = this.Mutable.ChatColours.TryGetValue(type, out var colour)
? ColourUtil.RgbaToVector3(colour)
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) {
this.Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec);
}
}
ImGui.TreePop();
}
}

View File

@ -0,0 +1,29 @@
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Display : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Display";
internal Display(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
ImGui.Checkbox("Hide chat", ref this.Mutable.HideChat);
ImGui.Checkbox("Show native item tooltips", ref this.Mutable.NativeItemTooltips);
ImGui.Checkbox("Show tabs in a sidebar", ref this.Mutable.SidebarTabView);
ImGui.Checkbox("Use modern timestamp layout", ref this.Mutable.PrettierTimestamps);
if (this.Mutable.PrettierTimestamps) {
ImGui.Checkbox("More compact modern layout", ref this.Mutable.MoreCompactPretty);
}
ImGui.DragFloat("Font size", ref this.Mutable.FontSize, .0125f, 12f, 36f, "%.1f");
ImGui.Checkbox("Allow moving main window", ref this.Mutable.CanMove);
ImGui.Checkbox("Allow resizing main window", ref this.Mutable.CanResize);
ImGui.Checkbox("Show title bar for main window", ref this.Mutable.ShowTitleBar);
}
}

View File

@ -0,0 +1,6 @@
namespace ChatTwo.Ui.SettingsTabs;
internal interface ISettingsTab {
string Name { get; }
void Draw();
}

105
ChatTwo/Ui/SettingsTabs/Tabs.cs Executable file
View File

@ -0,0 +1,105 @@
using ChatTwo.Code;
using ChatTwo.Util;
using Dalamud.Interface;
using ImGuiNET;
namespace ChatTwo.Ui.SettingsTabs;
internal sealed class Tabs : ISettingsTab {
private Configuration Mutable { get; }
public string Name => "Tabs";
internal Tabs(Configuration mutable) {
this.Mutable = mutable;
}
public void Draw() {
if (ImGuiUtil.IconButton(FontAwesomeIcon.Plus, tooltip: "Add")) {
this.Mutable.Tabs.Add(new Tab());
}
var toRemove = -1;
for (var i = 0; i < this.Mutable.Tabs.Count; i++) {
var tab = this.Mutable.Tabs[i];
if (ImGui.TreeNodeEx($"{tab.Name}###tab-{i}")) {
ImGui.PushID($"tab-{i}");
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: "Delete")) {
toRemove = i;
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: "Move up") && i > 0) {
(this.Mutable.Tabs[i - 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i - 1]);
}
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: "Move down") && i < this.Mutable.Tabs.Count - 1) {
(this.Mutable.Tabs[i + 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i + 1]);
}
ImGui.InputText("Name", ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
ImGui.Checkbox("Show unread count", ref tab.DisplayUnread);
ImGui.Checkbox("Show timestamps", ref tab.DisplayTimestamp);
var input = tab.Channel?.ToChatType().Name() ?? "<None>";
if (ImGui.BeginCombo("Input channel", input)) {
if (ImGui.Selectable("<None>", tab.Channel == null)) {
tab.Channel = null;
}
foreach (var channel in Enum.GetValues<InputChannel>()) {
if (ImGui.Selectable(channel.ToChatType().Name(), tab.Channel == channel)) {
tab.Channel = channel;
}
}
ImGui.EndCombo();
}
if (ImGui.TreeNodeEx("Channels")) {
foreach (var type in Enum.GetValues<ChatType>()) {
var enabled = tab.ChatCodes.ContainsKey(type);
if (ImGui.Checkbox($"##{type.Name()}-{i}", ref enabled)) {
if (enabled) {
tab.ChatCodes[type] = ChatSourceExt.All;
} else {
tab.ChatCodes.Remove(type);
}
}
ImGui.SameLine();
if (ImGui.TreeNodeEx($"{type.Name()}##{i}")) {
tab.ChatCodes.TryGetValue(type, out var sourcesEnum);
var sources = (uint) sourcesEnum;
foreach (var source in Enum.GetValues<ChatSource>()) {
if (ImGui.CheckboxFlags(source.ToString(), ref sources, (uint) source)) {
tab.ChatCodes[type] = (ChatSource) sources;
}
}
ImGui.TreePop();
}
}
ImGui.TreePop();
}
ImGui.TreePop();
ImGui.PopID();
}
}
if (toRemove > -1) {
this.Mutable.Tabs.RemoveAt(toRemove);
}
}
}

View File

@ -52,9 +52,8 @@ internal static class ImGuiUtil {
return;
}
const float scale = 1.0f;
var widthLeft = ImGui.GetContentRegionAvail().X;
var endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, scale, text, textEnd, widthLeft);
var endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, ImGuiHelpers.GlobalScale, text, textEnd, widthLeft);
if (endPrevLine == null) {
return;
}
@ -68,7 +67,7 @@ internal static class ImGuiUtil {
++text;
} // skip a space at start of line
endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, scale, text, textEnd, widthLeft);
endPrevLine = ImGuiNative.ImFont_CalcWordWrapPositionA(ImGui.GetFont().NativePtr, ImGuiHelpers.GlobalScale, text, textEnd, widthLeft);
if (endPrevLine == null) {
ImGui.TextUnformatted("");
ImGui.TextUnformatted("");