feat(DTR): configurable spacing

This commit is contained in:
goaaats 2022-02-02 21:36:56 +01:00
parent e90ef9da9e
commit 976c26e544
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
3 changed files with 18 additions and 7 deletions

View file

@ -256,6 +256,11 @@ namespace Dalamud.Configuration.Internal
/// </summary>
public List<string>? DtrIgnore { get; set; }
/// <summary>
/// Gets or sets the spacing used for DTR entries.
/// </summary>
public int DtrSpacing { get; set; } = 10;
/// <summary>
/// Gets or sets a value indicating whether the title screen menu is shown.
/// </summary>

View file

@ -19,11 +19,6 @@ namespace Dalamud.Game.Gui.Dtr
[InterfaceVersion("1.0")]
public sealed unsafe class DtrBar : IDisposable
{
/// <summary>
/// The amount of padding between Server Info UI elements.
/// </summary>
private const int ElementPadding = 30;
private List<DtrBarEntry> entries = new();
private uint runningNodeIds = 1000;
@ -174,7 +169,7 @@ namespace Dalamud.Game.Gui.Dtr
if (!isHide)
{
runningXPos -= data.TextNode->AtkResNode.Width + ElementPadding;
runningXPos -= data.TextNode->AtkResNode.Width + configuration.DtrSpacing;
data.TextNode->AtkResNode.SetPositionFloat(runningXPos, 2);
}

View file

@ -48,6 +48,7 @@ namespace Dalamud.Interface.Internal.Windows
private List<string>? dtrOrder;
private List<string>? dtrIgnore;
private int dtrSpacing;
private List<ThirdPartyRepoSettings> thirdRepoList;
private bool thirdRepoListChanged;
@ -97,6 +98,8 @@ namespace Dalamud.Interface.Internal.Windows
this.doFocus = configuration.IsFocusManagementEnabled;
this.doTsm = configuration.ShowTsm;
this.dtrSpacing = configuration.DtrSpacing;
this.doPluginTest = configuration.DoPluginTest;
this.thirdRepoList = configuration.ThirdRepoList.Select(x => x.Clone()).ToList();
this.devPluginLocations = configuration.DevPluginLoadLocations.Select(x => x.Clone()).ToList();
@ -324,7 +327,7 @@ namespace Dalamud.Interface.Internal.Windows
ImGui.Text(Loc.Localize("DalamudSettingServerInfoBar", "Server Info Bar configuration"));
ImGui.TextColored(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."));
ImGuiHelpers.ScaledDummy(10, 10);
ImGuiHelpers.ScaledDummy(10);
var configuration = Service<DalamudConfiguration>.Get();
var dtrBar = Service<DtrBar>.Get();
@ -407,6 +410,12 @@ namespace Dalamud.Interface.Internal.Windows
if (isOrderChange)
dtrBar.ApplySort();
ImGuiHelpers.ScaledDummy(10);
ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarSpacing", "Server Info Bar spacing"));
ImGui.TextColored(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarSpacingHint", "Configure the amount of space between entries in the server info bar here."));
ImGui.SliderInt("Spacing", ref this.dtrSpacing, 0, 40);
}
private void DrawExperimentalTab()
@ -813,6 +822,8 @@ namespace Dalamud.Interface.Internal.Windows
this.dtrOrder = configuration.DtrOrder;
this.dtrIgnore = configuration.DtrIgnore;
configuration.DtrSpacing = this.dtrSpacing;
configuration.DoPluginTest = this.doPluginTest;
configuration.ThirdRepoList = this.thirdRepoList.Select(x => x.Clone()).ToList();
configuration.DevPluginLoadLocations = this.devPluginLocations.Select(x => x.Clone()).ToList();