mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Update texts in SettingsWindow when locale changes
This commit is contained in:
parent
f3e462eb6b
commit
3aa5aa4a82
19 changed files with 309 additions and 267 deletions
|
|
@ -1,14 +1,16 @@
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings;
|
using Dalamud.Utility.Internal;
|
||||||
|
|
||||||
|
namespace Dalamud.Interface.Internal.Windows.Settings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basic, drawable settings entry.
|
/// Basic, drawable settings entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class SettingsEntry
|
internal abstract class SettingsEntry
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the public, searchable name of this settings entry.
|
/// Gets or sets the public, searchable name of this settings entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? Name { get; protected set; }
|
public LocRef Name { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether this entry is valid.
|
/// Gets or sets a value indicating whether this entry is valid.
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings;
|
namespace Dalamud.Interface.Internal.Windows.Settings;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public abstract class SettingsTab : IDisposable
|
internal abstract class SettingsTab : IDisposable
|
||||||
{
|
{
|
||||||
public abstract SettingsEntry[] Entries { get; }
|
public abstract SettingsEntry[] Entries { get; }
|
||||||
|
|
||||||
public abstract string Title { get; }
|
public abstract string Title { get; }
|
||||||
|
|
||||||
|
public abstract SettingsOpenKind Kind { get; }
|
||||||
|
|
||||||
public bool IsOpen { get; set; } = false;
|
public bool IsOpen { get; set; } = false;
|
||||||
|
|
||||||
public virtual bool IsVisible { get; } = true;
|
public virtual bool IsVisible { get; } = true;
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,9 @@ namespace Dalamud.Interface.Internal.Windows.Settings;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The window that allows for general configuration of Dalamud itself.
|
/// The window that allows for general configuration of Dalamud itself.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SettingsWindow : Window
|
internal sealed class SettingsWindow : Window
|
||||||
{
|
{
|
||||||
private readonly SettingsTab[] tabs;
|
private readonly SettingsTab[] tabs;
|
||||||
|
|
||||||
private string searchInput = string.Empty;
|
private string searchInput = string.Empty;
|
||||||
private bool isSearchInputPrefilled = false;
|
private bool isSearchInputPrefilled = false;
|
||||||
|
|
||||||
|
|
@ -30,7 +29,7 @@ internal class SettingsWindow : Window
|
||||||
/// Initializes a new instance of the <see cref="SettingsWindow"/> class.
|
/// Initializes a new instance of the <see cref="SettingsWindow"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SettingsWindow()
|
public SettingsWindow()
|
||||||
: base(Loc.Localize("DalamudSettingsHeader", "Dalamud Settings") + "###XlSettings2", ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar)
|
: base(Title, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar)
|
||||||
{
|
{
|
||||||
this.Size = new Vector2(740, 550);
|
this.Size = new Vector2(740, 550);
|
||||||
this.SizeConstraints = new WindowSizeConstraints()
|
this.SizeConstraints = new WindowSizeConstraints()
|
||||||
|
|
@ -52,6 +51,8 @@ internal class SettingsWindow : Window
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string Title => Loc.Localize("DalamudSettingsHeader", "Dalamud Settings") + "###XlSettings2";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Open the settings window to the tab specified by <paramref name="kind"/>.
|
/// Open the settings window to the tab specified by <paramref name="kind"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -59,7 +60,7 @@ internal class SettingsWindow : Window
|
||||||
public void OpenTo(SettingsOpenKind kind)
|
public void OpenTo(SettingsOpenKind kind)
|
||||||
{
|
{
|
||||||
this.IsOpen = true;
|
this.IsOpen = true;
|
||||||
this.SetOpenTab(kind);
|
this.setActiveTab = this.tabs.Single(tab => tab.Kind == kind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -83,12 +84,19 @@ internal class SettingsWindow : Window
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void OnOpen()
|
public override void OnOpen()
|
||||||
{
|
{
|
||||||
|
var localization = Service<Localization>.Get();
|
||||||
|
|
||||||
foreach (var settingsTab in this.tabs)
|
foreach (var settingsTab in this.tabs)
|
||||||
{
|
{
|
||||||
settingsTab.Load();
|
settingsTab.Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isSearchInputPrefilled) this.searchInput = string.Empty;
|
if (!this.isSearchInputPrefilled)
|
||||||
|
{
|
||||||
|
this.searchInput = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
localization.LocalizationChanged += this.OnLocalizationChanged;
|
||||||
|
|
||||||
base.OnOpen();
|
base.OnOpen();
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +107,7 @@ internal class SettingsWindow : Window
|
||||||
var configuration = Service<DalamudConfiguration>.Get();
|
var configuration = Service<DalamudConfiguration>.Get();
|
||||||
var interfaceManager = Service<InterfaceManager>.Get();
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
var fontAtlasFactory = Service<FontAtlasFactory>.Get();
|
var fontAtlasFactory = Service<FontAtlasFactory>.Get();
|
||||||
|
var localization = Service<Localization>.Get();
|
||||||
|
|
||||||
var scaleChanged = !Equals(ImGui.GetIO().FontGlobalScale, configuration.GlobalUiScale);
|
var scaleChanged = !Equals(ImGui.GetIO().FontGlobalScale, configuration.GlobalUiScale);
|
||||||
var rebuildFont = !Equals(fontAtlasFactory.DefaultFontSpec, configuration.DefaultFontSpec);
|
var rebuildFont = !Equals(fontAtlasFactory.DefaultFontSpec, configuration.DefaultFontSpec);
|
||||||
|
|
@ -107,7 +116,7 @@ internal class SettingsWindow : Window
|
||||||
ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale;
|
ImGui.GetIO().FontGlobalScale = configuration.GlobalUiScale;
|
||||||
if (scaleChanged)
|
if (scaleChanged)
|
||||||
{
|
{
|
||||||
Service<InterfaceManager>.Get().InvokeGlobalScaleChanged();
|
interfaceManager.InvokeGlobalScaleChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
fontAtlasFactory.DefaultFontSpecOverride = null;
|
fontAtlasFactory.DefaultFontSpecOverride = null;
|
||||||
|
|
@ -115,7 +124,7 @@ internal class SettingsWindow : Window
|
||||||
if (rebuildFont)
|
if (rebuildFont)
|
||||||
{
|
{
|
||||||
interfaceManager.RebuildFonts();
|
interfaceManager.RebuildFonts();
|
||||||
Service<InterfaceManager>.Get().InvokeFontChanged();
|
interfaceManager.InvokeFontChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var settingsTab in this.tabs)
|
foreach (var settingsTab in this.tabs)
|
||||||
|
|
@ -133,98 +142,28 @@ internal class SettingsWindow : Window
|
||||||
this.isSearchInputPrefilled = false;
|
this.isSearchInputPrefilled = false;
|
||||||
this.searchInput = string.Empty;
|
this.searchInput = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
localization.LocalizationChanged -= this.OnLocalizationChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
|
ImGui.SetNextItemWidth(-1);
|
||||||
|
ImGui.InputTextWithHint("###searchInput"u8, "Search for settings..."u8, ref this.searchInput, 100);
|
||||||
|
ImGui.Spacing();
|
||||||
|
|
||||||
var windowSize = ImGui.GetWindowSize();
|
var windowSize = ImGui.GetWindowSize();
|
||||||
|
|
||||||
if (ImGui.BeginTabBar("###settingsTabs"u8))
|
using (var tabBar = ImRaii.TabBar("###settingsTabs"u8))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(this.searchInput))
|
if (tabBar)
|
||||||
{
|
{
|
||||||
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
|
if (string.IsNullOrEmpty(this.searchInput))
|
||||||
{
|
this.DrawTabs();
|
||||||
var flags = ImGuiTabItemFlags.NoCloseWithMiddleMouseButton;
|
else
|
||||||
if (this.setActiveTab == settingsTab)
|
this.DrawSearchResults();
|
||||||
{
|
|
||||||
flags |= ImGuiTabItemFlags.SetSelected;
|
|
||||||
this.setActiveTab = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
using var tab = ImRaii.TabItem(settingsTab.Title, flags);
|
|
||||||
if (tab)
|
|
||||||
{
|
|
||||||
if (!settingsTab.IsOpen)
|
|
||||||
{
|
|
||||||
settingsTab.IsOpen = true;
|
|
||||||
settingsTab.OnOpen();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't add padding for the about tab(credits)
|
|
||||||
{
|
|
||||||
using var padding = ImRaii.PushStyle(
|
|
||||||
ImGuiStyleVar.WindowPadding,
|
|
||||||
new Vector2(2, 2),
|
|
||||||
settingsTab is not SettingsTabAbout);
|
|
||||||
using var borderColor = ImRaii.PushColor(
|
|
||||||
ImGuiCol.Border,
|
|
||||||
ImGui.GetColorU32(ImGuiCol.ChildBg));
|
|
||||||
using var tabChild = ImRaii.Child(
|
|
||||||
$"###settings_scrolling_{settingsTab.Title}",
|
|
||||||
new Vector2(-1, -1),
|
|
||||||
true);
|
|
||||||
if (tabChild)
|
|
||||||
settingsTab.Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsTab.PostDraw();
|
|
||||||
}
|
|
||||||
else if (settingsTab.IsOpen)
|
|
||||||
{
|
|
||||||
settingsTab.IsOpen = false;
|
|
||||||
settingsTab.OnClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ImGui.BeginTabItem("Search Results"u8))
|
|
||||||
{
|
|
||||||
var any = false;
|
|
||||||
|
|
||||||
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
|
|
||||||
{
|
|
||||||
var eligible = settingsTab.Entries.Where(x => !x.Name.IsNullOrEmpty() && x.Name.ToLowerInvariant().Contains(this.searchInput.ToLowerInvariant())).ToArray();
|
|
||||||
|
|
||||||
if (!eligible.Any())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
any = true;
|
|
||||||
|
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey, settingsTab.Title);
|
|
||||||
ImGui.Dummy(new Vector2(5));
|
|
||||||
|
|
||||||
foreach (var settingsTabEntry in eligible)
|
|
||||||
{
|
|
||||||
settingsTabEntry.Draw();
|
|
||||||
ImGuiHelpers.ScaledDummy(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Separator();
|
|
||||||
|
|
||||||
ImGui.Dummy(new Vector2(10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!any)
|
|
||||||
ImGui.TextColored(ImGuiColors.DalamudGrey, "No results found..."u8);
|
|
||||||
|
|
||||||
ImGui.EndTabItem();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.EndTabBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetCursorPos(windowSize - ImGuiHelpers.ScaledVector2(70));
|
ImGui.SetCursorPos(windowSize - ImGuiHelpers.ScaledVector2(70));
|
||||||
|
|
@ -256,10 +195,92 @@ internal class SettingsWindow : Window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SetCursorPos(new Vector2(windowSize.X - 250, ImGui.GetTextLineHeightWithSpacing() + (ImGui.GetStyle().FramePadding.Y * 2)));
|
private void DrawTabs()
|
||||||
ImGui.SetNextItemWidth(240);
|
{
|
||||||
ImGui.InputTextWithHint("###searchInput"u8, "Search for settings..."u8, ref this.searchInput, 100);
|
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
|
||||||
|
{
|
||||||
|
var flags = ImGuiTabItemFlags.NoCloseWithMiddleMouseButton;
|
||||||
|
|
||||||
|
if (this.setActiveTab == settingsTab)
|
||||||
|
{
|
||||||
|
flags |= ImGuiTabItemFlags.SetSelected;
|
||||||
|
this.setActiveTab = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
using var tab = ImRaii.TabItem(settingsTab.Title, flags);
|
||||||
|
if (tab)
|
||||||
|
{
|
||||||
|
if (!settingsTab.IsOpen)
|
||||||
|
{
|
||||||
|
settingsTab.IsOpen = true;
|
||||||
|
settingsTab.OnOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't add padding for the about tab(credits)
|
||||||
|
{
|
||||||
|
using var padding = ImRaii.PushStyle(
|
||||||
|
ImGuiStyleVar.WindowPadding,
|
||||||
|
new Vector2(2, 2),
|
||||||
|
settingsTab is not SettingsTabAbout);
|
||||||
|
using var borderColor = ImRaii.PushColor(
|
||||||
|
ImGuiCol.Border,
|
||||||
|
ImGui.GetColorU32(ImGuiCol.ChildBg));
|
||||||
|
using var tabChild = ImRaii.Child(
|
||||||
|
$"###settings_scrolling_{settingsTab.Title}",
|
||||||
|
new Vector2(-1, -1),
|
||||||
|
true);
|
||||||
|
if (tabChild)
|
||||||
|
settingsTab.Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
settingsTab.PostDraw();
|
||||||
|
}
|
||||||
|
else if (settingsTab.IsOpen)
|
||||||
|
{
|
||||||
|
settingsTab.IsOpen = false;
|
||||||
|
settingsTab.OnClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawSearchResults()
|
||||||
|
{
|
||||||
|
using var tab = ImRaii.TabItem("Search Results"u8);
|
||||||
|
if (!tab) return;
|
||||||
|
|
||||||
|
var any = false;
|
||||||
|
|
||||||
|
foreach (var settingsTab in this.tabs.Where(x => x.IsVisible))
|
||||||
|
{
|
||||||
|
var eligible = settingsTab.Entries.Where(x =>
|
||||||
|
{
|
||||||
|
var name = x.Name.ToString();
|
||||||
|
return !name.IsNullOrEmpty() && name.Contains(this.searchInput, StringComparison.InvariantCultureIgnoreCase);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!eligible.Any())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
any |= true;
|
||||||
|
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey, settingsTab.Title);
|
||||||
|
ImGui.Dummy(new Vector2(5));
|
||||||
|
|
||||||
|
foreach (var settingsTabEntry in eligible)
|
||||||
|
{
|
||||||
|
settingsTabEntry.Draw();
|
||||||
|
ImGuiHelpers.ScaledDummy(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.Separator();
|
||||||
|
|
||||||
|
ImGui.Dummy(new Vector2(10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!any)
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudGrey, "No results found..."u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Save()
|
private void Save()
|
||||||
|
|
@ -301,17 +322,8 @@ internal class SettingsWindow : Window
|
||||||
Service<InterfaceManager>.Get().RebuildFonts();
|
Service<InterfaceManager>.Get().RebuildFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetOpenTab(SettingsOpenKind kind)
|
private void OnLocalizationChanged(string langCode)
|
||||||
{
|
{
|
||||||
this.setActiveTab = kind switch
|
this.WindowName = Title;
|
||||||
{
|
|
||||||
SettingsOpenKind.General => this.tabs[0],
|
|
||||||
SettingsOpenKind.LookAndFeel => this.tabs[1],
|
|
||||||
SettingsOpenKind.AutoUpdates => this.tabs[2],
|
|
||||||
SettingsOpenKind.ServerInfoBar => this.tabs[3],
|
|
||||||
SettingsOpenKind.Experimental => this.tabs[4],
|
|
||||||
SettingsOpenKind.About => this.tabs[5],
|
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(kind), kind, null),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class SettingsTabAbout : SettingsTab
|
internal sealed class SettingsTabAbout : SettingsTab
|
||||||
{
|
{
|
||||||
private const float CreditFps = 60.0f;
|
private const float CreditFps = 60.0f;
|
||||||
private const string ThankYouText = "Thank you!";
|
private const string ThankYouText = "Thank you!";
|
||||||
|
|
@ -209,10 +209,12 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
||||||
.CreateFontAtlas(nameof(SettingsTabAbout), FontAtlasAutoRebuildMode.Async);
|
.CreateFontAtlas(nameof(SettingsTabAbout), FontAtlasAutoRebuildMode.Async);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override SettingsEntry[] Entries { get; } = { };
|
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudAbout", "About");
|
public override string Title => Loc.Localize("DalamudAbout", "About");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.About;
|
||||||
|
|
||||||
|
public override SettingsEntry[] Entries { get; } = [];
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override unsafe void OnOpen()
|
public override unsafe void OnOpen()
|
||||||
{
|
{
|
||||||
|
|
@ -287,7 +289,7 @@ Contribute at: https://github.com/goatcorp/Dalamud
|
||||||
|
|
||||||
var windowX = ImGui.GetWindowSize().X;
|
var windowX = ImGui.GetWindowSize().X;
|
||||||
|
|
||||||
foreach (var creditsLine in this.creditsText.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None))
|
foreach (var creditsLine in this.creditsText.Split(["\r\n", "\r", "\n"], StringSplitOptions.None))
|
||||||
{
|
{
|
||||||
var lineLenX = ImGui.CalcTextSize(creditsLine).X;
|
var lineLenX = ImGui.CalcTextSize(creditsLine).X;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
@ -18,7 +18,7 @@ using Dalamud.Plugin.Internal.Types;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class SettingsTabAutoUpdates : SettingsTab
|
internal sealed class SettingsTabAutoUpdates : SettingsTab
|
||||||
{
|
{
|
||||||
private AutoUpdateBehavior behavior;
|
private AutoUpdateBehavior behavior;
|
||||||
private bool updateDisabledPlugins;
|
private bool updateDisabledPlugins;
|
||||||
|
|
@ -31,6 +31,8 @@ public class SettingsTabAutoUpdates : SettingsTab
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudSettingsAutoUpdates", "Auto-Updates");
|
public override string Title => Loc.Localize("DalamudSettingsAutoUpdates", "Auto-Updates");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.AutoUpdates;
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
ImGui.TextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint",
|
ImGui.TextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint",
|
||||||
|
|
|
||||||
|
|
@ -14,17 +14,19 @@ using Dalamud.Interface.Utility;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class SettingsTabDtr : SettingsTab
|
internal sealed class SettingsTabDtr : SettingsTab
|
||||||
{
|
{
|
||||||
private List<string>? dtrOrder;
|
private List<string>? dtrOrder;
|
||||||
private List<string>? dtrIgnore;
|
private List<string>? dtrIgnore;
|
||||||
private int dtrSpacing;
|
private int dtrSpacing;
|
||||||
private bool dtrSwapDirection;
|
private bool dtrSwapDirection;
|
||||||
|
|
||||||
public override SettingsEntry[] Entries { get; } = Array.Empty<SettingsEntry>();
|
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudSettingsServerInfoBar", "Server Info Bar");
|
public override string Title => Loc.Localize("DalamudSettingsServerInfoBar", "Server Info Bar");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.ServerInfoBar;
|
||||||
|
|
||||||
|
public override SettingsEntry[] Entries { get; } = [];
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
ImGui.TextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarHint", "Plugins can put additional information into your server information bar(where world & time can be seen).\nYou can reorder and disable these here."));
|
ImGui.TextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarHint", "Plugins can put additional information into your server information bar(where world & time can be seen).\nYou can reorder and disable these here."));
|
||||||
|
|
@ -125,8 +127,8 @@ public class SettingsTabDtr : SettingsTab
|
||||||
ImGui.GetIO().MousePos = moveMouseTo[moveMouseToIndex];
|
ImGui.GetIO().MousePos = moveMouseTo[moveMouseToIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration.DtrOrder = order.Concat(orderLeft).ToList();
|
configuration.DtrOrder = [.. order, .. orderLeft];
|
||||||
configuration.DtrIgnore = ignore.Concat(ignoreLeft).ToList();
|
configuration.DtrIgnore = [.. ignore, .. ignoreLeft];
|
||||||
|
|
||||||
if (isOrderChange)
|
if (isOrderChange)
|
||||||
dtrBar.ApplySort();
|
dtrBar.ApplySort();
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Internal.ReShadeHandling;
|
using Dalamud.Interface.Internal.ReShadeHandling;
|
||||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
|
||||||
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Plugin.Internal;
|
using Dalamud.Plugin.Internal;
|
||||||
|
|
@ -18,33 +17,28 @@ namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
"StyleCop.CSharp.DocumentationRules",
|
"StyleCop.CSharp.DocumentationRules",
|
||||||
"SA1600:Elements should be documented",
|
"SA1600:Elements should be documented",
|
||||||
Justification = "Internals")]
|
Justification = "Internals")]
|
||||||
public class SettingsTabExperimental : SettingsTab
|
internal sealed class SettingsTabExperimental : SettingsTab
|
||||||
{
|
{
|
||||||
|
public override string Title => Loc.Localize("DalamudSettingsExperimental", "Experimental");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.Experimental;
|
||||||
|
|
||||||
public override SettingsEntry[] Entries { get; } =
|
public override SettingsEntry[] Entries { get; } =
|
||||||
[
|
[
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsPluginTest", "Get plugin testing builds"),
|
("DalamudSettingsPluginTest", "Get plugin testing builds"),
|
||||||
string.Format(
|
("DalamudSettingsPluginTestHint", "Receive testing prereleases for selected plugins.\nTo opt-in to testing builds for a plugin, you have to right click it in the \"Installed Plugins\" tab of the plugin installer and select \"Receive plugin testing versions\"."),
|
||||||
Loc.Localize(
|
|
||||||
"DalamudSettingsPluginTestHint",
|
|
||||||
"Receive testing prereleases for selected plugins.\nTo opt-in to testing builds for a plugin, you have to right click it in the \"{0}\" tab of the plugin installer and select \"{1}\"."),
|
|
||||||
PluginCategoryManager.Locs.Group_Installed,
|
|
||||||
PluginInstallerWindow.Locs.PluginContext_TestingOptIn),
|
|
||||||
c => c.DoPluginTest,
|
c => c.DoPluginTest,
|
||||||
(v, c) => c.DoPluginTest = v),
|
(v, c) => c.DoPluginTest = v),
|
||||||
new HintSettingsEntry(
|
new HintSettingsEntry(
|
||||||
Loc.Localize(
|
("DalamudSettingsPluginTestWarning", "Testing plugins may contain bugs or crash your game. Please only enable this if you are aware of the risks."),
|
||||||
"DalamudSettingsPluginTestWarning",
|
|
||||||
"Testing plugins may contain bugs or crash your game. Please only enable this if you are aware of the risks."),
|
|
||||||
ImGuiColors.DalamudRed),
|
ImGuiColors.DalamudRed),
|
||||||
|
|
||||||
new GapSettingsEntry(5),
|
new GapSettingsEntry(5),
|
||||||
|
|
||||||
new ButtonSettingsEntry(
|
new ButtonSettingsEntry(
|
||||||
Loc.Localize("DalamudSettingsClearHidden", "Clear hidden plugins"),
|
("DalamudSettingsClearHidden", "Clear hidden plugins"),
|
||||||
Loc.Localize(
|
("DalamudSettingsClearHiddenHint", "Restore plugins you have previously hidden from the plugin installer."),
|
||||||
"DalamudSettingsClearHiddenHint",
|
|
||||||
"Restore plugins you have previously hidden from the plugin installer."),
|
|
||||||
() =>
|
() =>
|
||||||
{
|
{
|
||||||
Service<DalamudConfiguration>.Get().HiddenPluginInternalName.Clear();
|
Service<DalamudConfiguration>.Get().HiddenPluginInternalName.Clear();
|
||||||
|
|
@ -56,23 +50,16 @@ public class SettingsTabExperimental : SettingsTab
|
||||||
new DevPluginsSettingsEntry(),
|
new DevPluginsSettingsEntry(),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize(
|
("DalamudSettingEnableImGuiAsserts", "Enable ImGui asserts"),
|
||||||
"DalamudSettingEnableImGuiAsserts",
|
("DalamudSettingEnableImGuiAssertsHint",
|
||||||
"Enable ImGui asserts"),
|
|
||||||
Loc.Localize(
|
|
||||||
"DalamudSettingEnableImGuiAssertsHint",
|
|
||||||
"If this setting is enabled, a window containing further details will be shown when an internal assertion in ImGui fails.\nWe recommend enabling this when developing plugins. " +
|
"If this setting is enabled, a window containing further details will be shown when an internal assertion in ImGui fails.\nWe recommend enabling this when developing plugins. " +
|
||||||
"This setting does not persist and will reset when the game restarts.\nUse the setting below to enable it at startup."),
|
"This setting does not persist and will reset when the game restarts.\nUse the setting below to enable it at startup."),
|
||||||
c => Service<InterfaceManager>.Get().ShowAsserts,
|
c => Service<InterfaceManager>.Get().ShowAsserts,
|
||||||
(v, _) => Service<InterfaceManager>.Get().ShowAsserts = v),
|
(v, _) => Service<InterfaceManager>.Get().ShowAsserts = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize(
|
("DalamudSettingEnableImGuiAssertsAtStartup", "Always enable ImGui asserts at startup"),
|
||||||
"DalamudSettingEnableImGuiAssertsAtStartup",
|
("DalamudSettingEnableImGuiAssertsAtStartupHint", "This will enable ImGui asserts every time the game starts."),
|
||||||
"Always enable ImGui asserts at startup"),
|
|
||||||
Loc.Localize(
|
|
||||||
"DalamudSettingEnableImGuiAssertsAtStartupHint",
|
|
||||||
"This will enable ImGui asserts every time the game starts."),
|
|
||||||
c => c.ImGuiAssertsEnabledAtStartup ?? false,
|
c => c.ImGuiAssertsEnabledAtStartup ?? false,
|
||||||
(v, c) => c.ImGuiAssertsEnabledAtStartup = v),
|
(v, c) => c.ImGuiAssertsEnabledAtStartup = v),
|
||||||
|
|
||||||
|
|
@ -83,10 +70,8 @@ public class SettingsTabExperimental : SettingsTab
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new EnumSettingsEntry<ReShadeHandlingMode>(
|
new EnumSettingsEntry<ReShadeHandlingMode>(
|
||||||
Loc.Localize("DalamudSettingsReShadeHandlingMode", "ReShade handling mode"),
|
("DalamudSettingsReShadeHandlingMode", "ReShade handling mode"),
|
||||||
Loc.Localize(
|
("DalamudSettingsReShadeHandlingModeHint", "You may try different options to work around problems you may encounter.\nRestart is required for changes to take effect."),
|
||||||
"DalamudSettingsReShadeHandlingModeHint",
|
|
||||||
"You may try different options to work around problems you may encounter.\nRestart is required for changes to take effect."),
|
|
||||||
c => c.ReShadeHandlingMode,
|
c => c.ReShadeHandlingMode,
|
||||||
(v, c) => c.ReShadeHandlingMode = v,
|
(v, c) => c.ReShadeHandlingMode = v,
|
||||||
fallbackValue: ReShadeHandlingMode.Default,
|
fallbackValue: ReShadeHandlingMode.Default,
|
||||||
|
|
@ -146,8 +131,6 @@ public class SettingsTabExperimental : SettingsTab
|
||||||
*/
|
*/
|
||||||
];
|
];
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudSettingsExperimental", "Experimental");
|
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
base.Draw();
|
base.Draw();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
using CheapLoc;
|
using CheapLoc;
|
||||||
using Dalamud.Game.Text;
|
using Dalamud.Game.Text;
|
||||||
|
|
@ -7,17 +7,21 @@ using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class SettingsTabGeneral : SettingsTab
|
internal sealed class SettingsTabGeneral : SettingsTab
|
||||||
{
|
{
|
||||||
|
public override string Title => Loc.Localize("DalamudSettingsGeneral", "General");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.General;
|
||||||
|
|
||||||
public override SettingsEntry[] Entries { get; } =
|
public override SettingsEntry[] Entries { get; } =
|
||||||
{
|
[
|
||||||
new LanguageChooserSettingsEntry(),
|
new LanguageChooserSettingsEntry(),
|
||||||
|
|
||||||
new GapSettingsEntry(5),
|
new GapSettingsEntry(5),
|
||||||
|
|
||||||
new EnumSettingsEntry<XivChatType>(
|
new EnumSettingsEntry<XivChatType>(
|
||||||
Loc.Localize("DalamudSettingsChannel", "Dalamud Chat Channel"),
|
("DalamudSettingsChannel", "Dalamud Chat Channel"),
|
||||||
Loc.Localize("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."),
|
("DalamudSettingsChannelHint", "Select the chat channel that is to be used for general Dalamud messages."),
|
||||||
c => c.GeneralChatType,
|
c => c.GeneralChatType,
|
||||||
(v, c) => c.GeneralChatType = v,
|
(v, c) => c.GeneralChatType = v,
|
||||||
warning: v =>
|
warning: v =>
|
||||||
|
|
@ -33,49 +37,47 @@ public class SettingsTabGeneral : SettingsTab
|
||||||
new GapSettingsEntry(5),
|
new GapSettingsEntry(5),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsWaitForPluginsOnStartup", "Wait for plugins before game loads"),
|
("DalamudSettingsWaitForPluginsOnStartup", "Wait for plugins before game loads"),
|
||||||
Loc.Localize("DalamudSettingsWaitForPluginsOnStartupHint", "Do not let the game load, until plugins are loaded."),
|
("DalamudSettingsWaitForPluginsOnStartupHint", "Do not let the game load, until plugins are loaded."),
|
||||||
c => c.IsResumeGameAfterPluginLoad,
|
c => c.IsResumeGameAfterPluginLoad,
|
||||||
(v, c) => c.IsResumeGameAfterPluginLoad = v),
|
(v, c) => c.IsResumeGameAfterPluginLoad = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsFlash", "Flash FFXIV window on duty pop"),
|
("DalamudSettingsFlash", "Flash FFXIV window on duty pop"),
|
||||||
Loc.Localize("DalamudSettingsFlashHint", "Flash the FFXIV window in your task bar when a duty is ready."),
|
("DalamudSettingsFlashHint", "Flash the FFXIV window in your task bar when a duty is ready."),
|
||||||
c => c.DutyFinderTaskbarFlash,
|
c => c.DutyFinderTaskbarFlash,
|
||||||
(v, c) => c.DutyFinderTaskbarFlash = v),
|
(v, c) => c.DutyFinderTaskbarFlash = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsDutyFinderMessage", "Chatlog message on duty pop"),
|
("DalamudSettingsDutyFinderMessage", "Chatlog message on duty pop"),
|
||||||
Loc.Localize("DalamudSettingsDutyFinderMessageHint", "Send a message in FFXIV chat when a duty is ready."),
|
("DalamudSettingsDutyFinderMessageHint", "Send a message in FFXIV chat when a duty is ready."),
|
||||||
c => c.DutyFinderChatMessage,
|
c => c.DutyFinderChatMessage,
|
||||||
(v, c) => c.DutyFinderChatMessage = v),
|
(v, c) => c.DutyFinderChatMessage = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsPrintDalamudWelcomeMsg", "Display Dalamud's welcome message"),
|
("DalamudSettingsPrintDalamudWelcomeMsg", "Display Dalamud's welcome message"),
|
||||||
Loc.Localize("DalamudSettingsPrintDalamudWelcomeMsgHint", "Display Dalamud's welcome message in FFXIV chat when logging in with a character."),
|
("DalamudSettingsPrintDalamudWelcomeMsgHint", "Display Dalamud's welcome message in FFXIV chat when logging in with a character."),
|
||||||
c => c.PrintDalamudWelcomeMsg,
|
c => c.PrintDalamudWelcomeMsg,
|
||||||
(v, c) => c.PrintDalamudWelcomeMsg = v),
|
(v, c) => c.PrintDalamudWelcomeMsg = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsPrintPluginsWelcomeMsg", "Display loaded plugins in the welcome message"),
|
("DalamudSettingsPrintPluginsWelcomeMsg", "Display loaded plugins in the welcome message"),
|
||||||
Loc.Localize("DalamudSettingsPrintPluginsWelcomeMsgHint", "Display loaded plugins in FFXIV chat when logging in with a character."),
|
("DalamudSettingsPrintPluginsWelcomeMsgHint", "Display loaded plugins in FFXIV chat when logging in with a character."),
|
||||||
c => c.PrintPluginsWelcomeMsg,
|
c => c.PrintPluginsWelcomeMsg,
|
||||||
(v, c) => c.PrintPluginsWelcomeMsg = v),
|
(v, c) => c.PrintPluginsWelcomeMsg = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"),
|
("DalamudSettingsSystemMenu", "Dalamud buttons in system menu"),
|
||||||
Loc.Localize("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."),
|
("DalamudSettingsSystemMenuMsgHint", "Add buttons for Dalamud plugins and settings to the system menu."),
|
||||||
c => c.DoButtonsSystemMenu,
|
c => c.DoButtonsSystemMenu,
|
||||||
(v, c) => c.DoButtonsSystemMenu = v),
|
(v, c) => c.DoButtonsSystemMenu = v),
|
||||||
|
|
||||||
new GapSettingsEntry(5),
|
new GapSettingsEntry(5),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingDoMbCollect", "Anonymously upload market board data"),
|
("DalamudSettingDoMbCollect", "Anonymously upload market board data"),
|
||||||
Loc.Localize("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!"),
|
("DalamudSettingDoMbCollectHint", "Anonymously provide data about in-game economics to Universalis when browsing the market board. This data can't be tied to you in any way and everyone benefits!"),
|
||||||
c => c.IsMbCollect,
|
c => c.IsMbCollect,
|
||||||
(v, c) => c.IsMbCollect = v),
|
(v, c) => c.IsMbCollect = v),
|
||||||
};
|
];
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudSettingsGeneral", "General");
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,11 @@ using CheapLoc;
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Game;
|
using Dalamud.Game;
|
||||||
using Dalamud.Game.Text;
|
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.FontIdentifier;
|
using Dalamud.Interface.FontIdentifier;
|
||||||
using Dalamud.Interface.GameFonts;
|
using Dalamud.Interface.GameFonts;
|
||||||
using Dalamud.Interface.ImGuiFontChooserDialog;
|
using Dalamud.Interface.ImGuiFontChooserDialog;
|
||||||
using Dalamud.Interface.ImGuiNotification.Internal;
|
using Dalamud.Interface.ImGuiNotification.Internal;
|
||||||
using Dalamud.Interface.Internal.Windows.PluginInstaller;
|
|
||||||
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
using Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
using Dalamud.Interface.ManagedFontAtlas.Internals;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
|
@ -23,38 +21,42 @@ using Serilog;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Tabs;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class SettingsTabLook : SettingsTab
|
internal sealed class SettingsTabLook : SettingsTab
|
||||||
{
|
{
|
||||||
private static readonly (string, float)[] GlobalUiScalePresets =
|
private static readonly (string, float)[] GlobalUiScalePresets =
|
||||||
{
|
[
|
||||||
("80%##DalamudSettingsGlobalUiScaleReset96", 0.8f),
|
("80%##DalamudSettingsGlobalUiScaleReset96", 0.8f),
|
||||||
("100%##DalamudSettingsGlobalUiScaleReset12", 1f),
|
("100%##DalamudSettingsGlobalUiScaleReset12", 1f),
|
||||||
("117%##DalamudSettingsGlobalUiScaleReset14", 14 / 12f),
|
("117%##DalamudSettingsGlobalUiScaleReset14", 14 / 12f),
|
||||||
("150%##DalamudSettingsGlobalUiScaleReset18", 1.5f),
|
("150%##DalamudSettingsGlobalUiScaleReset18", 1.5f),
|
||||||
("200%##DalamudSettingsGlobalUiScaleReset24", 2f),
|
("200%##DalamudSettingsGlobalUiScaleReset24", 2f),
|
||||||
("300%##DalamudSettingsGlobalUiScaleReset36", 3f),
|
("300%##DalamudSettingsGlobalUiScaleReset36", 3f),
|
||||||
};
|
];
|
||||||
|
|
||||||
private float globalUiScale;
|
private float globalUiScale;
|
||||||
private IFontSpec defaultFontSpec = null!;
|
private IFontSpec defaultFontSpec = null!;
|
||||||
|
|
||||||
|
public override string Title => Loc.Localize("DalamudSettingsVisual", "Look & Feel");
|
||||||
|
|
||||||
|
public override SettingsOpenKind Kind => SettingsOpenKind.LookAndFeel;
|
||||||
|
|
||||||
public override SettingsEntry[] Entries { get; } =
|
public override SettingsEntry[] Entries { get; } =
|
||||||
[
|
[
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new ButtonSettingsEntry(
|
new ButtonSettingsEntry(
|
||||||
Loc.Localize("DalamudSettingsOpenStyleEditor", "Open Style Editor"),
|
("DalamudSettingsOpenStyleEditor", "Open Style Editor"),
|
||||||
Loc.Localize("DalamudSettingsStyleEditorHint", "Modify the look & feel of Dalamud windows."),
|
("DalamudSettingsStyleEditorHint", "Modify the look & feel of Dalamud windows."),
|
||||||
() => Service<DalamudInterface>.Get().OpenStyleEditor()),
|
() => Service<DalamudInterface>.Get().OpenStyleEditor()),
|
||||||
|
|
||||||
new ButtonSettingsEntry(
|
new ButtonSettingsEntry(
|
||||||
Loc.Localize("DalamudSettingsOpenNotificationEditor", "Modify Notification Position"),
|
("DalamudSettingsOpenNotificationEditor", "Modify Notification Position"),
|
||||||
Loc.Localize("DalamudSettingsNotificationEditorHint", "Choose where Dalamud notifications appear on the screen."),
|
("DalamudSettingsNotificationEditorHint", "Choose where Dalamud notifications appear on the screen."),
|
||||||
() => Service<NotificationManager>.Get().StartPositionChooser()),
|
() => Service<NotificationManager>.Get().StartPositionChooser()),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingsUseDarkMode", "Use Windows immersive/dark mode"),
|
("DalamudSettingsUseDarkMode", "Use Windows immersive/dark mode"),
|
||||||
Loc.Localize("DalamudSettingsUseDarkModeHint", "This will cause the FFXIV window title bar to follow your preferred Windows color settings, and switch to dark mode if enabled."),
|
("DalamudSettingsUseDarkModeHint", "This will cause the FFXIV window title bar to follow your preferred Windows color settings, and switch to dark mode if enabled."),
|
||||||
c => c.WindowIsImmersive,
|
c => c.WindowIsImmersive,
|
||||||
(v, c) => c.WindowIsImmersive = v,
|
(v, c) => c.WindowIsImmersive = v,
|
||||||
b =>
|
b =>
|
||||||
|
|
@ -72,91 +74,87 @@ public class SettingsTabLook : SettingsTab
|
||||||
|
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new HintSettingsEntry(Loc.Localize("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below.")),
|
new HintSettingsEntry(("DalamudSettingToggleUiHideOptOutNote", "Plugins may independently opt out of the settings below.")),
|
||||||
new GapSettingsEntry(3),
|
new GapSettingsEntry(3),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"),
|
("DalamudSettingToggleUiHide", "Hide plugin UI when the game UI is toggled off"),
|
||||||
Loc.Localize("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."),
|
("DalamudSettingToggleUiHideHint", "Hide any open windows by plugins when toggling the game overlay."),
|
||||||
c => c.ToggleUiHide,
|
c => c.ToggleUiHide,
|
||||||
(v, c) => c.ToggleUiHide = v),
|
(v, c) => c.ToggleUiHide = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleUiHideDuringCutscenes", "Hide plugin UI during cutscenes"),
|
("DalamudSettingToggleUiHideDuringCutscenes", "Hide plugin UI during cutscenes"),
|
||||||
Loc.Localize("DalamudSettingToggleUiHideDuringCutscenesHint", "Hide any open windows by plugins during cutscenes."),
|
("DalamudSettingToggleUiHideDuringCutscenesHint", "Hide any open windows by plugins during cutscenes."),
|
||||||
c => c.ToggleUiHideDuringCutscenes,
|
c => c.ToggleUiHideDuringCutscenes,
|
||||||
(v, c) => c.ToggleUiHideDuringCutscenes = v),
|
(v, c) => c.ToggleUiHideDuringCutscenes = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleUiHideDuringGpose", "Hide plugin UI while gpose is active"),
|
("DalamudSettingToggleUiHideDuringGpose", "Hide plugin UI while gpose is active"),
|
||||||
Loc.Localize("DalamudSettingToggleUiHideDuringGposeHint", "Hide any open windows by plugins while gpose is active."),
|
("DalamudSettingToggleUiHideDuringGposeHint", "Hide any open windows by plugins while gpose is active."),
|
||||||
c => c.ToggleUiHideDuringGpose,
|
c => c.ToggleUiHideDuringGpose,
|
||||||
(v, c) => c.ToggleUiHideDuringGpose = v),
|
(v, c) => c.ToggleUiHideDuringGpose = v),
|
||||||
|
|
||||||
new GapSettingsEntry(5, true),
|
new GapSettingsEntry(5, true),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleFocusManagement", "Use escape to close Dalamud windows"),
|
("DalamudSettingToggleFocusManagement", "Use escape to close Dalamud windows"),
|
||||||
Loc.Localize("DalamudSettingToggleFocusManagementHint", "This will cause Dalamud windows to behave like in-game windows when pressing escape.\nThey will close one after another until all are closed. May not work for all plugins."),
|
("DalamudSettingToggleFocusManagementHint", "This will cause Dalamud windows to behave like in-game windows when pressing escape.\nThey will close one after another until all are closed. May not work for all plugins."),
|
||||||
c => c.IsFocusManagementEnabled,
|
c => c.IsFocusManagementEnabled,
|
||||||
(v, c) => c.IsFocusManagementEnabled = v),
|
(v, c) => c.IsFocusManagementEnabled = v),
|
||||||
|
|
||||||
// This is applied every frame in InterfaceManager::CheckViewportState()
|
// This is applied every frame in InterfaceManager::CheckViewportState()
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleViewports", "Enable multi-monitor windows"),
|
("DalamudSettingToggleViewports", "Enable multi-monitor windows"),
|
||||||
Loc.Localize("DalamudSettingToggleViewportsHint", "This will allow you move plugin windows onto other monitors.\nWill only work in Borderless Window or Windowed mode."),
|
("DalamudSettingToggleViewportsHint", "This will allow you move plugin windows onto other monitors.\nWill only work in Borderless Window or Windowed mode."),
|
||||||
c => !c.IsDisableViewport,
|
c => !c.IsDisableViewport,
|
||||||
(v, c) => c.IsDisableViewport = !v),
|
(v, c) => c.IsDisableViewport = !v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleDocking", "Enable window docking"),
|
("DalamudSettingToggleDocking", "Enable window docking"),
|
||||||
Loc.Localize("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."),
|
("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."),
|
||||||
c => c.IsDocking,
|
c => c.IsDocking,
|
||||||
(v, c) => c.IsDocking = v),
|
(v, c) => c.IsDocking = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize(
|
("DalamudSettingEnablePluginUIAdditionalOptions", "Add a button to the title bar of plugin windows to open additional options"),
|
||||||
"DalamudSettingEnablePluginUIAdditionalOptions",
|
("DalamudSettingEnablePluginUIAdditionalOptionsHint", "This will allow you to pin certain plugin windows, make them clickthrough or adjust their opacity.\nThis may not be supported by all of your plugins. Contact the plugin author if you want them to support this feature."),
|
||||||
"Add a button to the title bar of plugin windows to open additional options"),
|
|
||||||
Loc.Localize(
|
|
||||||
"DalamudSettingEnablePluginUIAdditionalOptionsHint",
|
|
||||||
"This will allow you to pin certain plugin windows, make them clickthrough or adjust their opacity.\nThis may not be supported by all of your plugins. Contact the plugin author if you want them to support this feature."),
|
|
||||||
c => c.EnablePluginUiAdditionalOptions,
|
c => c.EnablePluginUiAdditionalOptions,
|
||||||
(v, c) => c.EnablePluginUiAdditionalOptions = v),
|
(v, c) => c.EnablePluginUiAdditionalOptions = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"),
|
("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"),
|
||||||
Loc.Localize("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."),
|
("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."),
|
||||||
c => c.EnablePluginUISoundEffects,
|
c => c.EnablePluginUISoundEffects,
|
||||||
(v, c) => c.EnablePluginUISoundEffects = v),
|
(v, c) => c.EnablePluginUISoundEffects = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
||||||
Loc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
||||||
c => c.IsGamepadNavigationEnabled,
|
c => c.IsGamepadNavigationEnabled,
|
||||||
(v, c) => c.IsGamepadNavigationEnabled = v),
|
(v, c) => c.IsGamepadNavigationEnabled = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleTsm", "Show title screen menu"),
|
("DalamudSettingToggleTsm", "Show title screen menu"),
|
||||||
Loc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."),
|
("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."),
|
||||||
c => c.ShowTsm,
|
c => c.ShowTsm,
|
||||||
(v, c) => c.ShowTsm = v),
|
(v, c) => c.ShowTsm = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"),
|
||||||
Loc.Localize("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."),
|
||||||
c => c.PluginInstallerOpen == PluginInstallerOpenKind.InstalledPlugins,
|
c => c.PluginInstallerOpen == PluginInstallerOpenKind.InstalledPlugins,
|
||||||
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerOpenKind.InstalledPlugins : PluginInstallerOpenKind.AllPlugins),
|
(v, c) => c.PluginInstallerOpen = v ? PluginInstallerOpenKind.InstalledPlugins : PluginInstallerOpenKind.AllPlugins),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingReducedMotion", "Reduce motions"),
|
("DalamudSettingReducedMotion", "Reduce motions"),
|
||||||
Loc.Localize("DalamudSettingReducedMotionHint", "This will suppress certain animations from Dalamud, such as the notification popup."),
|
("DalamudSettingReducedMotionHint", "This will suppress certain animations from Dalamud, such as the notification popup."),
|
||||||
c => c.ReduceMotions ?? false,
|
c => c.ReduceMotions ?? false,
|
||||||
(v, c) => c.ReduceMotions = v),
|
(v, c) => c.ReduceMotions = v),
|
||||||
|
|
||||||
new SettingsEntry<float>(
|
new SettingsEntry<float>(
|
||||||
Loc.Localize("DalamudSettingImeStateIndicatorOpacity", "IME State Indicator Opacity (CJK only)"),
|
("DalamudSettingImeStateIndicatorOpacity", "IME State Indicator Opacity (CJK only)"),
|
||||||
Loc.Localize("DalamudSettingImeStateIndicatorOpacityHint", "When any of CJK IMEs is in use, the state of IME will be shown with the opacity specified here."),
|
("DalamudSettingImeStateIndicatorOpacityHint", "When any of CJK IMEs is in use, the state of IME will be shown with the opacity specified here."),
|
||||||
c => c.ImeStateIndicatorOpacity,
|
c => c.ImeStateIndicatorOpacity,
|
||||||
(v, c) => c.ImeStateIndicatorOpacity = v)
|
(v, c) => c.ImeStateIndicatorOpacity = v)
|
||||||
{
|
{
|
||||||
|
|
@ -176,8 +174,6 @@ public class SettingsTabLook : SettingsTab
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
public override string Title => Loc.Localize("DalamudSettingsVisual", "Look & Feel");
|
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
var interfaceManager = Service<InterfaceManager>.Get();
|
var interfaceManager = Service<InterfaceManager>.Get();
|
||||||
|
|
@ -212,7 +208,7 @@ public class SettingsTabLook : SettingsTab
|
||||||
var p = stackalloc byte[len];
|
var p = stackalloc byte[len];
|
||||||
Encoding.UTF8.GetBytes(buildingFonts, new(p, len));
|
Encoding.UTF8.GetBytes(buildingFonts, new(p, len));
|
||||||
ImGui.Text(
|
ImGui.Text(
|
||||||
new ReadOnlySpan<byte>(p, len)[..((len + ((Environment.TickCount / 200) % 3)) - 2)]);
|
new ReadOnlySpan<byte>(p, len)[..(len + (Environment.TickCount / 200 % 3) - 2)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Utility.Internal;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class ButtonSettingsEntry : SettingsEntry
|
internal sealed class ButtonSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private readonly string description;
|
private readonly LocRef description;
|
||||||
private readonly Action runs;
|
private readonly Action runs;
|
||||||
|
|
||||||
public ButtonSettingsEntry(string name, string description, Action runs)
|
public ButtonSettingsEntry(LocRef name, LocRef description, Action runs)
|
||||||
{
|
{
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.runs = runs;
|
this.runs = runs;
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ using Dalamud.Plugin.Internal;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class DevPluginsSettingsEntry : SettingsEntry
|
internal sealed class DevPluginsSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private List<DevPluginLocationSettings> devPluginLocations = new();
|
private List<DevPluginLocationSettings> devPluginLocations = [];
|
||||||
private bool devPluginLocationsChanged;
|
private bool devPluginLocationsChanged;
|
||||||
private string devPluginTempLocation = string.Empty;
|
private string devPluginTempLocation = string.Empty;
|
||||||
private string devPluginLocationAddError = string.Empty;
|
private string devPluginLocationAddError = string.Empty;
|
||||||
|
|
@ -29,25 +29,25 @@ public class DevPluginsSettingsEntry : SettingsEntry
|
||||||
|
|
||||||
public DevPluginsSettingsEntry()
|
public DevPluginsSettingsEntry()
|
||||||
{
|
{
|
||||||
this.Name = Loc.Localize("DalamudSettingsDevPluginLocation", "Dev Plugin Locations");
|
this.Name = ("DalamudSettingsDevPluginLocation", "Dev Plugin Locations");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnClose()
|
public override void OnClose()
|
||||||
{
|
{
|
||||||
this.devPluginLocations =
|
this.devPluginLocations =
|
||||||
Service<DalamudConfiguration>.Get().DevPluginLoadLocations.Select(x => x.Clone()).ToList();
|
[.. Service<DalamudConfiguration>.Get().DevPluginLoadLocations.Select(x => x.Clone())];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
this.devPluginLocations =
|
this.devPluginLocations =
|
||||||
Service<DalamudConfiguration>.Get().DevPluginLoadLocations.Select(x => x.Clone()).ToList();
|
[.. Service<DalamudConfiguration>.Get().DevPluginLoadLocations.Select(x => x.Clone())];
|
||||||
this.devPluginLocationsChanged = false;
|
this.devPluginLocationsChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
Service<DalamudConfiguration>.Get().DevPluginLoadLocations = this.devPluginLocations.Select(x => x.Clone()).ToList();
|
Service<DalamudConfiguration>.Get().DevPluginLoadLocations = [.. this.devPluginLocations.Select(x => x.Clone())];
|
||||||
|
|
||||||
if (this.devPluginLocationsChanged)
|
if (this.devPluginLocationsChanged)
|
||||||
{
|
{
|
||||||
|
|
@ -59,7 +59,9 @@ public class DevPluginsSettingsEntry : SettingsEntry
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
using var id = ImRaii.PushId("devPluginLocation"u8);
|
using var id = ImRaii.PushId("devPluginLocation"u8);
|
||||||
|
|
||||||
ImGui.Text(this.Name);
|
ImGui.Text(this.Name);
|
||||||
|
|
||||||
if (this.devPluginLocationsChanged)
|
if (this.devPluginLocationsChanged)
|
||||||
{
|
{
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.HealerGreen))
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
using CheapLoc;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
|
|
@ -23,8 +25,8 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
||||||
private T valueBacking;
|
private T valueBacking;
|
||||||
|
|
||||||
public EnumSettingsEntry(
|
public EnumSettingsEntry(
|
||||||
string name,
|
(string Key, string Fallback) name,
|
||||||
string description,
|
(string Key, string Fallback) description,
|
||||||
LoadSettingDelegate load,
|
LoadSettingDelegate load,
|
||||||
SaveSettingDelegate save,
|
SaveSettingDelegate save,
|
||||||
Action<T>? change = null,
|
Action<T>? change = null,
|
||||||
|
|
@ -61,7 +63,7 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description { get; }
|
public (string Key, string Fallback) Description { get; }
|
||||||
|
|
||||||
public Action<EnumSettingsEntry<T>>? CustomDraw { get; init; }
|
public Action<EnumSettingsEntry<T>>? CustomDraw { get; init; }
|
||||||
|
|
||||||
|
|
@ -79,7 +81,10 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
Debug.Assert(this.Name != null, "this.Name != null");
|
var name = Loc.Localize(this.Name.Key, this.Name.Fallback);
|
||||||
|
var description = Loc.Localize(this.Description.Key, this.Description.Fallback);
|
||||||
|
|
||||||
|
Debug.Assert(!string.IsNullOrWhiteSpace(name), "Name is empty");
|
||||||
|
|
||||||
if (this.CustomDraw is not null)
|
if (this.CustomDraw is not null)
|
||||||
{
|
{
|
||||||
|
|
@ -87,7 +92,7 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped(this.Name);
|
ImGui.TextWrapped(name);
|
||||||
|
|
||||||
var idx = this.valueBacking;
|
var idx = this.valueBacking;
|
||||||
var values = Enum.GetValues<T>();
|
var values = Enum.GetValues<T>();
|
||||||
|
|
@ -117,13 +122,14 @@ internal sealed class EnumSettingsEntry<T> : SettingsEntry
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
||||||
{
|
{
|
||||||
var desc = this.FriendlyEnumDescriptionGetter(this.valueBacking);
|
var desc = this.FriendlyEnumDescriptionGetter(this.valueBacking);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(desc))
|
if (!string.IsNullOrWhiteSpace(desc))
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped(desc);
|
ImGui.TextWrapped(desc);
|
||||||
ImGuiHelpers.ScaledDummy(2);
|
ImGuiHelpers.ScaledDummy(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.TextWrapped(this.Description);
|
ImGui.TextWrapped(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CheckValidity != null)
|
if (this.CheckValidity != null)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
|
|
@ -6,7 +6,7 @@ using Dalamud.Interface.Utility;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public sealed class GapSettingsEntry : SettingsEntry
|
internal sealed class GapSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private readonly float size;
|
private readonly float size;
|
||||||
private readonly bool hr;
|
private readonly bool hr;
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,17 @@ using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
|
using Dalamud.Utility.Internal;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class HintSettingsEntry : SettingsEntry
|
internal sealed class HintSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private readonly string text;
|
private readonly LocRef text;
|
||||||
private readonly Vector4 color;
|
private readonly Vector4 color;
|
||||||
|
|
||||||
public HintSettingsEntry(string text, Vector4? color = null)
|
public HintSettingsEntry(LocRef text, Vector4? color = null)
|
||||||
{
|
{
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.color = color ?? ImGuiColors.DalamudGrey;
|
this.color = color ?? ImGuiColors.DalamudGrey;
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,11 @@ using CheapLoc;
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Utility;
|
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public sealed class LanguageChooserSettingsEntry : SettingsEntry
|
internal sealed class LanguageChooserSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private readonly string[] languages;
|
private readonly string[] languages;
|
||||||
private readonly string[] locLanguages;
|
private readonly string[] locLanguages;
|
||||||
|
|
@ -20,9 +19,9 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
|
||||||
|
|
||||||
public LanguageChooserSettingsEntry()
|
public LanguageChooserSettingsEntry()
|
||||||
{
|
{
|
||||||
this.languages = Localization.ApplicableLangCodes.Prepend("en").ToArray();
|
this.languages = [.. Localization.ApplicableLangCodes.Prepend("en")];
|
||||||
|
|
||||||
this.Name = Loc.Localize("DalamudSettingsLanguage", "Language");
|
this.Name = ("DalamudSettingsLanguage", "Language");
|
||||||
this.IsValid = true;
|
this.IsValid = true;
|
||||||
this.IsVisible = true;
|
this.IsVisible = true;
|
||||||
|
|
||||||
|
|
@ -46,7 +45,7 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.locLanguages = locLanguagesList.ToArray();
|
this.locLanguages = [.. locLanguagesList];
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Dalamud.Bindings.ImGui;
|
using Dalamud.Bindings.ImGui;
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Interface.Colors;
|
using Dalamud.Interface.Colors;
|
||||||
using Dalamud.Interface.Utility;
|
|
||||||
using Dalamud.Interface.Utility.Raii;
|
using Dalamud.Interface.Utility.Raii;
|
||||||
|
using Dalamud.Utility.Internal;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
|
|
@ -20,8 +20,8 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
private object? valueBacking;
|
private object? valueBacking;
|
||||||
|
|
||||||
public SettingsEntry(
|
public SettingsEntry(
|
||||||
string name,
|
LocRef name,
|
||||||
string description,
|
LocRef description,
|
||||||
LoadSettingDelegate load,
|
LoadSettingDelegate load,
|
||||||
SaveSettingDelegate save,
|
SaveSettingDelegate save,
|
||||||
Action<T?>? change = null,
|
Action<T?>? change = null,
|
||||||
|
|
@ -55,7 +55,7 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Description { get; }
|
public LocRef Description { get; }
|
||||||
|
|
||||||
public Action<SettingsEntry<T>>? CustomDraw { get; init; }
|
public Action<SettingsEntry<T>>? CustomDraw { get; init; }
|
||||||
|
|
||||||
|
|
@ -69,7 +69,10 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
Debug.Assert(this.Name != null, "this.Name != null");
|
var name = this.Name.ToString();
|
||||||
|
var description = this.Description.ToString();
|
||||||
|
|
||||||
|
Debug.Assert(!string.IsNullOrWhiteSpace(name), "Name is empty");
|
||||||
|
|
||||||
var type = typeof(T);
|
var type = typeof(T);
|
||||||
|
|
||||||
|
|
@ -79,7 +82,7 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
else if (type == typeof(DirectoryInfo))
|
else if (type == typeof(DirectoryInfo))
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped(this.Name);
|
ImGui.TextWrapped(name);
|
||||||
|
|
||||||
var value = this.Value as DirectoryInfo;
|
var value = this.Value as DirectoryInfo;
|
||||||
var nativeBuffer = value?.FullName ?? string.Empty;
|
var nativeBuffer = value?.FullName ?? string.Empty;
|
||||||
|
|
@ -91,7 +94,7 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
}
|
}
|
||||||
else if (type == typeof(string))
|
else if (type == typeof(string))
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped(this.Name);
|
ImGui.TextWrapped(name);
|
||||||
|
|
||||||
var nativeBuffer = this.Value as string ?? string.Empty;
|
var nativeBuffer = this.Value as string ?? string.Empty;
|
||||||
|
|
||||||
|
|
@ -104,16 +107,19 @@ internal sealed class SettingsEntry<T> : SettingsEntry
|
||||||
{
|
{
|
||||||
var nativeValue = this.Value as bool? ?? false;
|
var nativeValue = this.Value as bool? ?? false;
|
||||||
|
|
||||||
if (ImGui.Checkbox($"{this.Name}###{this.Id.ToString()}", ref nativeValue))
|
if (ImGui.Checkbox($"{name}###{this.Id.ToString()}", ref nativeValue))
|
||||||
{
|
{
|
||||||
this.valueBacking = nativeValue;
|
this.valueBacking = nativeValue;
|
||||||
this.change?.Invoke(this.Value);
|
this.change?.Invoke(this.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
if (!string.IsNullOrWhiteSpace(description))
|
||||||
{
|
{
|
||||||
ImGui.TextWrapped(this.Description);
|
using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey))
|
||||||
|
{
|
||||||
|
ImGui.TextWrapped(this.Description);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.CheckValidity != null)
|
if (this.CheckValidity != null)
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ using Dalamud.Utility;
|
||||||
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
namespace Dalamud.Interface.Internal.Windows.Settings.Widgets;
|
||||||
|
|
||||||
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")]
|
||||||
public class ThirdRepoSettingsEntry : SettingsEntry
|
internal class ThirdRepoSettingsEntry : SettingsEntry
|
||||||
{
|
{
|
||||||
private List<ThirdPartyRepoSettings> thirdRepoList = new();
|
private List<ThirdPartyRepoSettings> thirdRepoList = [];
|
||||||
private bool thirdRepoListChanged;
|
private bool thirdRepoListChanged;
|
||||||
private string thirdRepoTempUrl = string.Empty;
|
private string thirdRepoTempUrl = string.Empty;
|
||||||
private string thirdRepoAddError = string.Empty;
|
private string thirdRepoAddError = string.Empty;
|
||||||
|
|
@ -34,20 +34,20 @@ public class ThirdRepoSettingsEntry : SettingsEntry
|
||||||
public override void OnClose()
|
public override void OnClose()
|
||||||
{
|
{
|
||||||
this.thirdRepoList =
|
this.thirdRepoList =
|
||||||
Service<DalamudConfiguration>.Get().ThirdRepoList.Select(x => x.Clone()).ToList();
|
[.. Service<DalamudConfiguration>.Get().ThirdRepoList.Select(x => x.Clone())];
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
this.thirdRepoList =
|
this.thirdRepoList =
|
||||||
Service<DalamudConfiguration>.Get().ThirdRepoList.Select(x => x.Clone()).ToList();
|
[.. Service<DalamudConfiguration>.Get().ThirdRepoList.Select(x => x.Clone())];
|
||||||
this.thirdRepoListChanged = false;
|
this.thirdRepoListChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Save()
|
public override void Save()
|
||||||
{
|
{
|
||||||
Service<DalamudConfiguration>.Get().ThirdRepoList =
|
Service<DalamudConfiguration>.Get().ThirdRepoList =
|
||||||
this.thirdRepoList.Select(x => x.Clone()).ToList();
|
[.. this.thirdRepoList.Select(x => x.Clone())];
|
||||||
|
|
||||||
if (this.thirdRepoListChanged)
|
if (this.thirdRepoListChanged)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
25
Dalamud/Utility/Internal/LocRef.cs
Normal file
25
Dalamud/Utility/Internal/LocRef.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
using CheapLoc;
|
||||||
|
|
||||||
|
using Dalamud.Bindings.ImGui;
|
||||||
|
|
||||||
|
namespace Dalamud.Utility.Internal;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a localization reference consisting of a key and a fallback text.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Key">The localization key used to retrieve the localized text.</param>
|
||||||
|
/// <param name="Fallback">The fallback text to use if the localization key is not found.</param>
|
||||||
|
internal readonly record struct LocRef(string Key, string Fallback)
|
||||||
|
{
|
||||||
|
public static implicit operator LocRef((string Key, string Fallback) tuple)
|
||||||
|
=> new(tuple.Key, tuple.Fallback);
|
||||||
|
|
||||||
|
public static implicit operator ImU8String(LocRef locRef)
|
||||||
|
=> new(locRef.ToString());
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Loc.Localize(this.Key, this.Fallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -301,7 +301,7 @@ public ref struct ImU8String
|
||||||
{
|
{
|
||||||
var startingPos = this.Length;
|
var startingPos = this.Length;
|
||||||
this.AppendFormatted(value, format);
|
this.AppendFormatted(value, format);
|
||||||
FixAlignment(startingPos, alignment);
|
this.FixAlignment(startingPos, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendFormatted(ReadOnlySpan<char> value) => this.AppendFormatted(value, null);
|
public void AppendFormatted(ReadOnlySpan<char> value) => this.AppendFormatted(value, null);
|
||||||
|
|
@ -322,7 +322,7 @@ public ref struct ImU8String
|
||||||
{
|
{
|
||||||
var startingPos = this.Length;
|
var startingPos = this.Length;
|
||||||
this.AppendFormatted(value, format);
|
this.AppendFormatted(value, format);
|
||||||
FixAlignment(startingPos, alignment);
|
this.FixAlignment(startingPos, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendFormatted(object? value) => this.AppendFormatted<object>(value!);
|
public void AppendFormatted(object? value) => this.AppendFormatted<object>(value!);
|
||||||
|
|
@ -358,13 +358,13 @@ public ref struct ImU8String
|
||||||
{
|
{
|
||||||
var startingPos = this.Length;
|
var startingPos = this.Length;
|
||||||
this.AppendFormatted(value, format);
|
this.AppendFormatted(value, format);
|
||||||
FixAlignment(startingPos, alignment);
|
this.FixAlignment(startingPos, alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reserve(int length)
|
public void Reserve(int length)
|
||||||
{
|
{
|
||||||
if (length >= AllocFreeBufferSize)
|
if (length >= AllocFreeBufferSize)
|
||||||
IncreaseBuffer(out _, length);
|
this.IncreaseBuffer(out _, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixAlignment(int startingPos, int alignment)
|
private void FixAlignment(int startingPos, int alignment)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue