Revert "refactor(Dalamud): switch to file-scoped namespaces"

This reverts commit b5f34c3199.
This commit is contained in:
goat 2021-11-18 15:23:40 +01:00
parent d473826247
commit 1561fbac00
No known key found for this signature in database
GPG key ID: 7773BB5B43BA52E5
325 changed files with 45549 additions and 45209 deletions

View file

@ -1,93 +1,97 @@
using System.Numerics;
using System.Numerics;
using Dalamud.Interface.Colors;
using Newtonsoft.Json;
namespace Dalamud.Interface.Style;
#pragma warning disable SA1600
public class DalamudColors
namespace Dalamud.Interface.Style
{
[JsonProperty("a")]
public Vector4? DalamudRed { get; set; }
#pragma warning disable SA1600
[JsonProperty("b")]
public Vector4? DalamudGrey { get; set; }
[JsonProperty("c")]
public Vector4? DalamudGrey2 { get; set; }
[JsonProperty("d")]
public Vector4? DalamudGrey3 { get; set; }
[JsonProperty("e")]
public Vector4? DalamudWhite { get; set; }
[JsonProperty("f")]
public Vector4? DalamudWhite2 { get; set; }
[JsonProperty("g")]
public Vector4? DalamudOrange { get; set; }
[JsonProperty("h")]
public Vector4? TankBlue { get; set; }
[JsonProperty("i")]
public Vector4? HealerGreen { get; set; }
[JsonProperty("j")]
public Vector4? DPSRed { get; set; }
public void Apply()
{
if (this.DalamudRed.HasValue)
public class DalamudColors
{
ImGuiColors.DalamudRed = this.DalamudRed.Value;
[JsonProperty("a")]
public Vector4? DalamudRed { get; set; }
[JsonProperty("b")]
public Vector4? DalamudGrey { get; set; }
[JsonProperty("c")]
public Vector4? DalamudGrey2 { get; set; }
[JsonProperty("d")]
public Vector4? DalamudGrey3 { get; set; }
[JsonProperty("e")]
public Vector4? DalamudWhite { get; set; }
[JsonProperty("f")]
public Vector4? DalamudWhite2 { get; set; }
[JsonProperty("g")]
public Vector4? DalamudOrange { get; set; }
[JsonProperty("h")]
public Vector4? TankBlue { get; set; }
[JsonProperty("i")]
public Vector4? HealerGreen { get; set; }
[JsonProperty("j")]
public Vector4? DPSRed { get; set; }
public void Apply()
{
if (this.DalamudRed.HasValue)
{
ImGuiColors.DalamudRed = this.DalamudRed.Value;
}
if (this.DalamudGrey.HasValue)
{
ImGuiColors.DalamudGrey = this.DalamudGrey.Value;
}
if (this.DalamudGrey2.HasValue)
{
ImGuiColors.DalamudGrey2 = this.DalamudGrey2.Value;
}
if (this.DalamudGrey3.HasValue)
{
ImGuiColors.DalamudGrey3 = this.DalamudGrey3.Value;
}
if (this.DalamudWhite.HasValue)
{
ImGuiColors.DalamudWhite = this.DalamudWhite.Value;
}
if (this.DalamudWhite2.HasValue)
{
ImGuiColors.DalamudWhite2 = this.DalamudWhite2.Value;
}
if (this.DalamudOrange.HasValue)
{
ImGuiColors.DalamudOrange = this.DalamudOrange.Value;
}
if (this.TankBlue.HasValue)
{
ImGuiColors.TankBlue = this.TankBlue.Value;
}
if (this.HealerGreen.HasValue)
{
ImGuiColors.HealerGreen = this.HealerGreen.Value;
}
if (this.DPSRed.HasValue)
{
ImGuiColors.DPSRed = this.DPSRed.Value;
}
}
}
if (this.DalamudGrey.HasValue)
{
ImGuiColors.DalamudGrey = this.DalamudGrey.Value;
}
if (this.DalamudGrey2.HasValue)
{
ImGuiColors.DalamudGrey2 = this.DalamudGrey2.Value;
}
if (this.DalamudGrey3.HasValue)
{
ImGuiColors.DalamudGrey3 = this.DalamudGrey3.Value;
}
if (this.DalamudWhite.HasValue)
{
ImGuiColors.DalamudWhite = this.DalamudWhite.Value;
}
if (this.DalamudWhite2.HasValue)
{
ImGuiColors.DalamudWhite2 = this.DalamudWhite2.Value;
}
if (this.DalamudOrange.HasValue)
{
ImGuiColors.DalamudOrange = this.DalamudOrange.Value;
}
if (this.TankBlue.HasValue)
{
ImGuiColors.TankBlue = this.TankBlue.Value;
}
if (this.HealerGreen.HasValue)
{
ImGuiColors.HealerGreen = this.HealerGreen.Value;
}
if (this.DPSRed.HasValue)
{
ImGuiColors.DPSRed = this.DPSRed.Value;
}
}
#pragma warning restore SA1600
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@ -8,120 +8,121 @@ using Dalamud.Utility;
using Newtonsoft.Json;
using Serilog;
namespace Dalamud.Interface.Style;
/// <summary>
/// Superclass for all versions of the Dalamud style model.
/// </summary>
public abstract class StyleModel
namespace Dalamud.Interface.Style
{
/// <summary>
/// Gets or sets the name of the style model.
/// Superclass for all versions of the Dalamud style model.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; } = "Unknown";
/// <summary>
/// Gets or sets class representing Dalamud-builtin <see cref="ImGuiColors"/>.
/// </summary>
[JsonProperty("dol")]
public DalamudColors? BuiltInColors { get; set; }
/// <summary>
/// Gets or sets version number of this model.
/// </summary>
[JsonProperty("ver")]
public int Version { get; set; }
/// <summary>
/// Get a StyleModel based on the current Dalamud style, with the current version.
/// </summary>
/// <returns>The current style.</returns>
public static StyleModel GetFromCurrent() => StyleModelV1.Get();
/// <summary>
/// Get the current style model, as per configuration.
/// </summary>
/// <returns>The current style, as per configuration.</returns>
public static StyleModel? GetConfiguredStyle()
public abstract class StyleModel
{
var configuration = Service<DalamudConfiguration>.Get();
return configuration.SavedStyles?.FirstOrDefault(x => x.Name == configuration.ChosenStyle);
}
/// <summary>
/// Gets or sets the name of the style model.
/// </summary>
[JsonProperty("name")]
public string Name { get; set; } = "Unknown";
/// <summary>
/// Get an enumerable of all saved styles.
/// </summary>
/// <returns>Enumerable of saved styles.</returns>
public static IEnumerable<StyleModel>? GetConfiguredStyles() => Service<DalamudConfiguration>.Get().SavedStyles;
/// <summary>
/// Gets or sets class representing Dalamud-builtin <see cref="ImGuiColors"/>.
/// </summary>
[JsonProperty("dol")]
public DalamudColors? BuiltInColors { get; set; }
/// <summary>
/// Deserialize a style model.
/// </summary>
/// <param name="model">The serialized model.</param>
/// <returns>The deserialized model.</returns>
/// <exception cref="ArgumentException">Thrown in case the version of the model is not known.</exception>
public static StyleModel? Deserialize(string model)
{
var json = Util.DecompressString(Convert.FromBase64String(model.Substring(3)));
/// <summary>
/// Gets or sets version number of this model.
/// </summary>
[JsonProperty("ver")]
public int Version { get; set; }
if (model.StartsWith(StyleModelV1.SerializedPrefix))
return JsonConvert.DeserializeObject<StyleModelV1>(json);
/// <summary>
/// Get a StyleModel based on the current Dalamud style, with the current version.
/// </summary>
/// <returns>The current style.</returns>
public static StyleModel GetFromCurrent() => StyleModelV1.Get();
throw new ArgumentException("Was not a compressed style model.");
}
/// <summary>
/// [TEMPORARY] Transfer old non-polymorphic style models to the new format.
/// </summary>
public static void TransferOldModels()
{
var configuration = Service<DalamudConfiguration>.Get();
if (configuration.SavedStylesOld == null)
return;
configuration.SavedStyles = new List<StyleModel>();
configuration.SavedStyles.AddRange(configuration.SavedStylesOld);
Log.Information("Transferred {0} styles", configuration.SavedStyles.Count);
configuration.SavedStylesOld = null;
configuration.Save();
}
/// <summary>
/// Serialize this style model.
/// </summary>
/// <returns>Serialized style model as string.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the version of the style model is unknown.</exception>
public string Serialize()
{
string prefix;
switch (this)
/// <summary>
/// Get the current style model, as per configuration.
/// </summary>
/// <returns>The current style, as per configuration.</returns>
public static StyleModel? GetConfiguredStyle()
{
case StyleModelV1:
prefix = StyleModelV1.SerializedPrefix;
break;
default:
throw new ArgumentOutOfRangeException();
var configuration = Service<DalamudConfiguration>.Get();
return configuration.SavedStyles?.FirstOrDefault(x => x.Name == configuration.ChosenStyle);
}
return prefix + Convert.ToBase64String(Util.CompressString(JsonConvert.SerializeObject(this)));
/// <summary>
/// Get an enumerable of all saved styles.
/// </summary>
/// <returns>Enumerable of saved styles.</returns>
public static IEnumerable<StyleModel>? GetConfiguredStyles() => Service<DalamudConfiguration>.Get().SavedStyles;
/// <summary>
/// Deserialize a style model.
/// </summary>
/// <param name="model">The serialized model.</param>
/// <returns>The deserialized model.</returns>
/// <exception cref="ArgumentException">Thrown in case the version of the model is not known.</exception>
public static StyleModel? Deserialize(string model)
{
var json = Util.DecompressString(Convert.FromBase64String(model.Substring(3)));
if (model.StartsWith(StyleModelV1.SerializedPrefix))
return JsonConvert.DeserializeObject<StyleModelV1>(json);
throw new ArgumentException("Was not a compressed style model.");
}
/// <summary>
/// [TEMPORARY] Transfer old non-polymorphic style models to the new format.
/// </summary>
public static void TransferOldModels()
{
var configuration = Service<DalamudConfiguration>.Get();
if (configuration.SavedStylesOld == null)
return;
configuration.SavedStyles = new List<StyleModel>();
configuration.SavedStyles.AddRange(configuration.SavedStylesOld);
Log.Information("Transferred {0} styles", configuration.SavedStyles.Count);
configuration.SavedStylesOld = null;
configuration.Save();
}
/// <summary>
/// Serialize this style model.
/// </summary>
/// <returns>Serialized style model as string.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the version of the style model is unknown.</exception>
public string Serialize()
{
string prefix;
switch (this)
{
case StyleModelV1:
prefix = StyleModelV1.SerializedPrefix;
break;
default:
throw new ArgumentOutOfRangeException();
}
return prefix + Convert.ToBase64String(Util.CompressString(JsonConvert.SerializeObject(this)));
}
/// <summary>
/// Apply this style model to ImGui.
/// </summary>
public abstract void Apply();
/// <summary>
/// Push this StyleModel into the ImGui style/color stack.
/// </summary>
public abstract void Push();
/// <summary>
/// Pop this style model from the ImGui style/color stack.
/// </summary>
public abstract void Pop();
}
/// <summary>
/// Apply this style model to ImGui.
/// </summary>
public abstract void Apply();
/// <summary>
/// Push this StyleModel into the ImGui style/color stack.
/// </summary>
public abstract void Push();
/// <summary>
/// Pop this style model from the ImGui style/color stack.
/// </summary>
public abstract void Pop();
}

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Numerics;
@ -6,58 +6,58 @@ using Dalamud.Interface.Colors;
using ImGuiNET;
using Newtonsoft.Json;
namespace Dalamud.Interface.Style;
/// <summary>
/// Version one of the Dalamud style model.
/// </summary>
public class StyleModelV1 : StyleModel
namespace Dalamud.Interface.Style
{
/// <summary>
/// Initializes a new instance of the <see cref="StyleModelV1"/> class.
/// Version one of the Dalamud style model.
/// </summary>
private StyleModelV1()
public class StyleModelV1 : StyleModel
{
this.Colors = new Dictionary<string, Vector4>();
this.Name = "Unknown";
}
/// <summary>
/// Initializes a new instance of the <see cref="StyleModelV1"/> class.
/// </summary>
private StyleModelV1()
{
this.Colors = new Dictionary<string, Vector4>();
this.Name = "Unknown";
}
/// <summary>
/// Gets the standard Dalamud look.
/// </summary>
public static StyleModelV1 DalamudStandard => new()
{
Name = "Dalamud Standard",
/// <summary>
/// Gets the standard Dalamud look.
/// </summary>
public static StyleModelV1 DalamudStandard => new()
{
Name = "Dalamud Standard",
Alpha = 1,
WindowPadding = new Vector2(8, 8),
WindowRounding = 4,
WindowBorderSize = 0,
WindowTitleAlign = new Vector2(0, 0.5f),
WindowMenuButtonPosition = ImGuiDir.Right,
ChildRounding = 0,
ChildBorderSize = 1,
PopupRounding = 0,
FramePadding = new Vector2(4, 3),
FrameRounding = 4,
FrameBorderSize = 0,
ItemSpacing = new Vector2(8, 4),
ItemInnerSpacing = new Vector2(4, 4),
CellPadding = new Vector2(4, 2),
TouchExtraPadding = new Vector2(0, 0),
IndentSpacing = 21,
ScrollbarSize = 16,
ScrollbarRounding = 9,
GrabMinSize = 13,
GrabRounding = 3,
LogSliderDeadzone = 4,
TabRounding = 4,
TabBorderSize = 0,
ButtonTextAlign = new Vector2(0.5f, 0.5f),
SelectableTextAlign = new Vector2(0, 0),
DisplaySafeAreaPadding = new Vector2(3, 3),
Alpha = 1,
WindowPadding = new Vector2(8, 8),
WindowRounding = 4,
WindowBorderSize = 0,
WindowTitleAlign = new Vector2(0, 0.5f),
WindowMenuButtonPosition = ImGuiDir.Right,
ChildRounding = 0,
ChildBorderSize = 1,
PopupRounding = 0,
FramePadding = new Vector2(4, 3),
FrameRounding = 4,
FrameBorderSize = 0,
ItemSpacing = new Vector2(8, 4),
ItemInnerSpacing = new Vector2(4, 4),
CellPadding = new Vector2(4, 2),
TouchExtraPadding = new Vector2(0, 0),
IndentSpacing = 21,
ScrollbarSize = 16,
ScrollbarRounding = 9,
GrabMinSize = 13,
GrabRounding = 3,
LogSliderDeadzone = 4,
TabRounding = 4,
TabBorderSize = 0,
ButtonTextAlign = new Vector2(0.5f, 0.5f),
SelectableTextAlign = new Vector2(0, 0),
DisplaySafeAreaPadding = new Vector2(3, 3),
Colors = new Dictionary<string, Vector4>
Colors = new Dictionary<string, Vector4>
{
{ "Text", new Vector4(1, 1, 1, 1) },
{ "TextDisabled", new Vector4(0.5f, 0.5f, 0.5f, 1) },
@ -116,57 +116,57 @@ public class StyleModelV1 : StyleModel
{ "ModalWindowDimBg", new Vector4(0.8f, 0.8f, 0.8f, 0.35f) },
},
BuiltInColors = new DalamudColors
BuiltInColors = new DalamudColors
{
DalamudRed = new Vector4(1f, 0f, 0f, 1f),
DalamudGrey = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey2 = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey3 = new Vector4(0.5f, 0.5f, 0.5f, 1f),
DalamudWhite = new Vector4(1f, 1f, 1f, 1f),
DalamudWhite2 = new Vector4(0.878f, 0.878f, 0.878f, 1f),
DalamudOrange = new Vector4(1f, 0.709f, 0f, 1f),
TankBlue = new Vector4(0f, 0.6f, 1f, 1f),
HealerGreen = new Vector4(0f, 0.8f, 0.1333333f, 1f),
DPSRed = new Vector4(0.7058824f, 0f, 0f, 1f),
},
};
/// <summary>
/// Gets the standard Dalamud look.
/// </summary>
public static StyleModelV1 DalamudClassic => new()
{
DalamudRed = new Vector4(1f, 0f, 0f, 1f),
DalamudGrey = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey2 = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey3 = new Vector4(0.5f, 0.5f, 0.5f, 1f),
DalamudWhite = new Vector4(1f, 1f, 1f, 1f),
DalamudWhite2 = new Vector4(0.878f, 0.878f, 0.878f, 1f),
DalamudOrange = new Vector4(1f, 0.709f, 0f, 1f),
TankBlue = new Vector4(0f, 0.6f, 1f, 1f),
HealerGreen = new Vector4(0f, 0.8f, 0.1333333f, 1f),
DPSRed = new Vector4(0.7058824f, 0f, 0f, 1f),
},
};
Name = "Dalamud Classic",
/// <summary>
/// Gets the standard Dalamud look.
/// </summary>
public static StyleModelV1 DalamudClassic => new()
{
Name = "Dalamud Classic",
Alpha = 1,
WindowPadding = new Vector2(8, 8),
WindowRounding = 4,
WindowBorderSize = 0,
WindowTitleAlign = new Vector2(0, 0.5f),
WindowMenuButtonPosition = ImGuiDir.Right,
ChildRounding = 0,
ChildBorderSize = 1,
PopupRounding = 0,
FramePadding = new Vector2(4, 3),
FrameRounding = 4,
FrameBorderSize = 0,
ItemSpacing = new Vector2(8, 4),
ItemInnerSpacing = new Vector2(4, 4),
CellPadding = new Vector2(4, 2),
TouchExtraPadding = new Vector2(0, 0),
IndentSpacing = 21,
ScrollbarSize = 16,
ScrollbarRounding = 9,
GrabMinSize = 10,
GrabRounding = 3,
LogSliderDeadzone = 4,
TabRounding = 4,
TabBorderSize = 0,
ButtonTextAlign = new Vector2(0.5f, 0.5f),
SelectableTextAlign = new Vector2(0, 0),
DisplaySafeAreaPadding = new Vector2(3, 3),
Alpha = 1,
WindowPadding = new Vector2(8, 8),
WindowRounding = 4,
WindowBorderSize = 0,
WindowTitleAlign = new Vector2(0, 0.5f),
WindowMenuButtonPosition = ImGuiDir.Right,
ChildRounding = 0,
ChildBorderSize = 1,
PopupRounding = 0,
FramePadding = new Vector2(4, 3),
FrameRounding = 4,
FrameBorderSize = 0,
ItemSpacing = new Vector2(8, 4),
ItemInnerSpacing = new Vector2(4, 4),
CellPadding = new Vector2(4, 2),
TouchExtraPadding = new Vector2(0, 0),
IndentSpacing = 21,
ScrollbarSize = 16,
ScrollbarRounding = 9,
GrabMinSize = 10,
GrabRounding = 3,
LogSliderDeadzone = 4,
TabRounding = 4,
TabBorderSize = 0,
ButtonTextAlign = new Vector2(0.5f, 0.5f),
SelectableTextAlign = new Vector2(0, 0),
DisplaySafeAreaPadding = new Vector2(3, 3),
Colors = new Dictionary<string, Vector4>
Colors = new Dictionary<string, Vector4>
{
{ "Text", new Vector4(1f, 1f, 1f, 1f) },
{ "TextDisabled", new Vector4(0.5f, 0.5f, 0.5f, 1f) },
@ -225,240 +225,241 @@ public class StyleModelV1 : StyleModel
{ "ModalWindowDimBg", new Vector4(0.8f, 0.8f, 0.8f, 0.35f) },
},
BuiltInColors = new DalamudColors
{
DalamudRed = new Vector4(1f, 0f, 0f, 1f),
DalamudGrey = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey2 = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey3 = new Vector4(0.5f, 0.5f, 0.5f, 1f),
DalamudWhite = new Vector4(1f, 1f, 1f, 1f),
DalamudWhite2 = new Vector4(0.878f, 0.878f, 0.878f, 1f),
DalamudOrange = new Vector4(1f, 0.709f, 0f, 1f),
TankBlue = new Vector4(0f, 0.6f, 1f, 1f),
HealerGreen = new Vector4(0f, 0.8f, 0.1333333f, 1f),
DPSRed = new Vector4(0.7058824f, 0f, 0f, 1f),
},
};
BuiltInColors = new DalamudColors
{
DalamudRed = new Vector4(1f, 0f, 0f, 1f),
DalamudGrey = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey2 = new Vector4(0.7f, 0.7f, 0.7f, 1f),
DalamudGrey3 = new Vector4(0.5f, 0.5f, 0.5f, 1f),
DalamudWhite = new Vector4(1f, 1f, 1f, 1f),
DalamudWhite2 = new Vector4(0.878f, 0.878f, 0.878f, 1f),
DalamudOrange = new Vector4(1f, 0.709f, 0f, 1f),
TankBlue = new Vector4(0f, 0.6f, 1f, 1f),
HealerGreen = new Vector4(0f, 0.8f, 0.1333333f, 1f),
DPSRed = new Vector4(0.7058824f, 0f, 0f, 1f),
},
};
/// <summary>
/// Gets the version prefix for this version.
/// </summary>
public static string SerializedPrefix => "DS1";
/// <summary>
/// Gets the version prefix for this version.
/// </summary>
public static string SerializedPrefix => "DS1";
#pragma warning disable SA1600
[JsonProperty("a")]
public float Alpha { get; set; }
[JsonProperty("a")]
public float Alpha { get; set; }
[JsonProperty("b")]
public Vector2 WindowPadding { get; set; }
[JsonProperty("b")]
public Vector2 WindowPadding { get; set; }
[JsonProperty("c")]
public float WindowRounding { get; set; }
[JsonProperty("c")]
public float WindowRounding { get; set; }
[JsonProperty("d")]
public float WindowBorderSize { get; set; }
[JsonProperty("d")]
public float WindowBorderSize { get; set; }
[JsonProperty("e")]
public Vector2 WindowTitleAlign { get; set; }
[JsonProperty("e")]
public Vector2 WindowTitleAlign { get; set; }
[JsonProperty("f")]
public ImGuiDir WindowMenuButtonPosition { get; set; }
[JsonProperty("f")]
public ImGuiDir WindowMenuButtonPosition { get; set; }
[JsonProperty("g")]
public float ChildRounding { get; set; }
[JsonProperty("g")]
public float ChildRounding { get; set; }
[JsonProperty("h")]
public float ChildBorderSize { get; set; }
[JsonProperty("h")]
public float ChildBorderSize { get; set; }
[JsonProperty("i")]
public float PopupRounding { get; set; }
[JsonProperty("i")]
public float PopupRounding { get; set; }
[JsonProperty("j")]
public Vector2 FramePadding { get; set; }
[JsonProperty("j")]
public Vector2 FramePadding { get; set; }
[JsonProperty("k")]
public float FrameRounding { get; set; }
[JsonProperty("k")]
public float FrameRounding { get; set; }
[JsonProperty("l")]
public float FrameBorderSize { get; set; }
[JsonProperty("l")]
public float FrameBorderSize { get; set; }
[JsonProperty("m")]
public Vector2 ItemSpacing { get; set; }
[JsonProperty("m")]
public Vector2 ItemSpacing { get; set; }
[JsonProperty("n")]
public Vector2 ItemInnerSpacing { get; set; }
[JsonProperty("n")]
public Vector2 ItemInnerSpacing { get; set; }
[JsonProperty("o")]
public Vector2 CellPadding { get; set; }
[JsonProperty("o")]
public Vector2 CellPadding { get; set; }
[JsonProperty("p")]
public Vector2 TouchExtraPadding { get; set; }
[JsonProperty("p")]
public Vector2 TouchExtraPadding { get; set; }
[JsonProperty("q")]
public float IndentSpacing { get; set; }
[JsonProperty("q")]
public float IndentSpacing { get; set; }
[JsonProperty("r")]
public float ScrollbarSize { get; set; }
[JsonProperty("r")]
public float ScrollbarSize { get; set; }
[JsonProperty("s")]
public float ScrollbarRounding { get; set; }
[JsonProperty("s")]
public float ScrollbarRounding { get; set; }
[JsonProperty("t")]
public float GrabMinSize { get; set; }
[JsonProperty("t")]
public float GrabMinSize { get; set; }
[JsonProperty("u")]
public float GrabRounding { get; set; }
[JsonProperty("u")]
public float GrabRounding { get; set; }
[JsonProperty("v")]
public float LogSliderDeadzone { get; set; }
[JsonProperty("v")]
public float LogSliderDeadzone { get; set; }
[JsonProperty("w")]
public float TabRounding { get; set; }
[JsonProperty("w")]
public float TabRounding { get; set; }
[JsonProperty("x")]
public float TabBorderSize { get; set; }
[JsonProperty("x")]
public float TabBorderSize { get; set; }
[JsonProperty("y")]
public Vector2 ButtonTextAlign { get; set; }
[JsonProperty("y")]
public Vector2 ButtonTextAlign { get; set; }
[JsonProperty("z")]
public Vector2 SelectableTextAlign { get; set; }
[JsonProperty("z")]
public Vector2 SelectableTextAlign { get; set; }
[JsonProperty("aa")]
public Vector2 DisplaySafeAreaPadding { get; set; }
[JsonProperty("aa")]
public Vector2 DisplaySafeAreaPadding { get; set; }
#pragma warning restore SA1600
/// <summary>
/// Gets or sets a dictionary mapping ImGui color names to colors.
/// </summary>
[JsonProperty("col")]
public Dictionary<string, Vector4> Colors { get; set; }
/// <summary>
/// Gets or sets a dictionary mapping ImGui color names to colors.
/// </summary>
[JsonProperty("col")]
public Dictionary<string, Vector4> Colors { get; set; }
/// <summary>
/// Get a <see cref="StyleModel"/> instance via ImGui.
/// </summary>
/// <returns>The newly created <see cref="StyleModel"/> instance.</returns>
public static StyleModelV1 Get()
{
var model = new StyleModelV1();
var style = ImGui.GetStyle();
model.Alpha = style.Alpha;
model.WindowPadding = style.WindowPadding;
model.WindowRounding = style.WindowRounding;
model.WindowBorderSize = style.WindowBorderSize;
model.WindowTitleAlign = style.WindowTitleAlign;
model.WindowMenuButtonPosition = style.WindowMenuButtonPosition;
model.ChildRounding = style.ChildRounding;
model.ChildBorderSize = style.ChildBorderSize;
model.PopupRounding = style.PopupRounding;
model.FramePadding = style.FramePadding;
model.FrameRounding = style.FrameRounding;
model.FrameBorderSize = style.FrameBorderSize;
model.ItemSpacing = style.ItemSpacing;
model.ItemInnerSpacing = style.ItemInnerSpacing;
model.CellPadding = style.CellPadding;
model.TouchExtraPadding = style.TouchExtraPadding;
model.IndentSpacing = style.IndentSpacing;
model.ScrollbarSize = style.ScrollbarSize;
model.ScrollbarRounding = style.ScrollbarRounding;
model.GrabMinSize = style.GrabMinSize;
model.GrabRounding = style.GrabRounding;
model.LogSliderDeadzone = style.LogSliderDeadzone;
model.TabRounding = style.TabRounding;
model.TabBorderSize = style.TabBorderSize;
model.ButtonTextAlign = style.ButtonTextAlign;
model.SelectableTextAlign = style.SelectableTextAlign;
model.DisplaySafeAreaPadding = style.DisplaySafeAreaPadding;
model.Colors = new Dictionary<string, Vector4>();
foreach (var imGuiCol in Enum.GetValues<ImGuiCol>())
/// <summary>
/// Get a <see cref="StyleModel"/> instance via ImGui.
/// </summary>
/// <returns>The newly created <see cref="StyleModel"/> instance.</returns>
public static StyleModelV1 Get()
{
if (imGuiCol == ImGuiCol.COUNT)
var model = new StyleModelV1();
var style = ImGui.GetStyle();
model.Alpha = style.Alpha;
model.WindowPadding = style.WindowPadding;
model.WindowRounding = style.WindowRounding;
model.WindowBorderSize = style.WindowBorderSize;
model.WindowTitleAlign = style.WindowTitleAlign;
model.WindowMenuButtonPosition = style.WindowMenuButtonPosition;
model.ChildRounding = style.ChildRounding;
model.ChildBorderSize = style.ChildBorderSize;
model.PopupRounding = style.PopupRounding;
model.FramePadding = style.FramePadding;
model.FrameRounding = style.FrameRounding;
model.FrameBorderSize = style.FrameBorderSize;
model.ItemSpacing = style.ItemSpacing;
model.ItemInnerSpacing = style.ItemInnerSpacing;
model.CellPadding = style.CellPadding;
model.TouchExtraPadding = style.TouchExtraPadding;
model.IndentSpacing = style.IndentSpacing;
model.ScrollbarSize = style.ScrollbarSize;
model.ScrollbarRounding = style.ScrollbarRounding;
model.GrabMinSize = style.GrabMinSize;
model.GrabRounding = style.GrabRounding;
model.LogSliderDeadzone = style.LogSliderDeadzone;
model.TabRounding = style.TabRounding;
model.TabBorderSize = style.TabBorderSize;
model.ButtonTextAlign = style.ButtonTextAlign;
model.SelectableTextAlign = style.SelectableTextAlign;
model.DisplaySafeAreaPadding = style.DisplaySafeAreaPadding;
model.Colors = new Dictionary<string, Vector4>();
foreach (var imGuiCol in Enum.GetValues<ImGuiCol>())
{
continue;
if (imGuiCol == ImGuiCol.COUNT)
{
continue;
}
model.Colors[imGuiCol.ToString()] = style.Colors[(int)imGuiCol];
}
model.Colors[imGuiCol.ToString()] = style.Colors[(int)imGuiCol];
model.BuiltInColors = new DalamudColors
{
DalamudRed = ImGuiColors.DalamudRed,
DalamudGrey = ImGuiColors.DalamudGrey,
DalamudGrey2 = ImGuiColors.DalamudGrey2,
DalamudGrey3 = ImGuiColors.DalamudGrey3,
DalamudWhite = ImGuiColors.DalamudWhite,
DalamudWhite2 = ImGuiColors.DalamudWhite2,
DalamudOrange = ImGuiColors.DalamudOrange,
TankBlue = ImGuiColors.TankBlue,
HealerGreen = ImGuiColors.HealerGreen,
DPSRed = ImGuiColors.DPSRed,
};
return model;
}
model.BuiltInColors = new DalamudColors
/// <summary>
/// Apply this StyleModel via ImGui.
/// </summary>
public override void Apply()
{
DalamudRed = ImGuiColors.DalamudRed,
DalamudGrey = ImGuiColors.DalamudGrey,
DalamudGrey2 = ImGuiColors.DalamudGrey2,
DalamudGrey3 = ImGuiColors.DalamudGrey3,
DalamudWhite = ImGuiColors.DalamudWhite,
DalamudWhite2 = ImGuiColors.DalamudWhite2,
DalamudOrange = ImGuiColors.DalamudOrange,
TankBlue = ImGuiColors.TankBlue,
HealerGreen = ImGuiColors.HealerGreen,
DPSRed = ImGuiColors.DPSRed,
};
var style = ImGui.GetStyle();
return model;
}
style.Alpha = this.Alpha;
style.WindowPadding = this.WindowPadding;
style.WindowRounding = this.WindowRounding;
style.WindowBorderSize = this.WindowBorderSize;
style.WindowTitleAlign = this.WindowTitleAlign;
style.WindowMenuButtonPosition = this.WindowMenuButtonPosition;
style.ChildRounding = this.ChildRounding;
style.ChildBorderSize = this.ChildBorderSize;
style.PopupRounding = this.PopupRounding;
style.FramePadding = this.FramePadding;
style.FrameRounding = this.FrameRounding;
style.FrameBorderSize = this.FrameBorderSize;
style.ItemSpacing = this.ItemSpacing;
style.ItemInnerSpacing = this.ItemInnerSpacing;
style.CellPadding = this.CellPadding;
style.TouchExtraPadding = this.TouchExtraPadding;
style.IndentSpacing = this.IndentSpacing;
style.ScrollbarSize = this.ScrollbarSize;
style.ScrollbarRounding = this.ScrollbarRounding;
style.GrabMinSize = this.GrabMinSize;
style.GrabRounding = this.GrabRounding;
style.LogSliderDeadzone = this.LogSliderDeadzone;
style.TabRounding = this.TabRounding;
style.TabBorderSize = this.TabBorderSize;
style.ButtonTextAlign = this.ButtonTextAlign;
style.SelectableTextAlign = this.SelectableTextAlign;
style.DisplaySafeAreaPadding = this.DisplaySafeAreaPadding;
/// <summary>
/// Apply this StyleModel via ImGui.
/// </summary>
public override void Apply()
{
var style = ImGui.GetStyle();
style.Alpha = this.Alpha;
style.WindowPadding = this.WindowPadding;
style.WindowRounding = this.WindowRounding;
style.WindowBorderSize = this.WindowBorderSize;
style.WindowTitleAlign = this.WindowTitleAlign;
style.WindowMenuButtonPosition = this.WindowMenuButtonPosition;
style.ChildRounding = this.ChildRounding;
style.ChildBorderSize = this.ChildBorderSize;
style.PopupRounding = this.PopupRounding;
style.FramePadding = this.FramePadding;
style.FrameRounding = this.FrameRounding;
style.FrameBorderSize = this.FrameBorderSize;
style.ItemSpacing = this.ItemSpacing;
style.ItemInnerSpacing = this.ItemInnerSpacing;
style.CellPadding = this.CellPadding;
style.TouchExtraPadding = this.TouchExtraPadding;
style.IndentSpacing = this.IndentSpacing;
style.ScrollbarSize = this.ScrollbarSize;
style.ScrollbarRounding = this.ScrollbarRounding;
style.GrabMinSize = this.GrabMinSize;
style.GrabRounding = this.GrabRounding;
style.LogSliderDeadzone = this.LogSliderDeadzone;
style.TabRounding = this.TabRounding;
style.TabBorderSize = this.TabBorderSize;
style.ButtonTextAlign = this.ButtonTextAlign;
style.SelectableTextAlign = this.SelectableTextAlign;
style.DisplaySafeAreaPadding = this.DisplaySafeAreaPadding;
foreach (var imGuiCol in Enum.GetValues<ImGuiCol>())
{
if (imGuiCol == ImGuiCol.COUNT)
foreach (var imGuiCol in Enum.GetValues<ImGuiCol>())
{
continue;
if (imGuiCol == ImGuiCol.COUNT)
{
continue;
}
style.Colors[(int)imGuiCol] = this.Colors[imGuiCol.ToString()];
}
style.Colors[(int)imGuiCol] = this.Colors[imGuiCol.ToString()];
this.BuiltInColors?.Apply();
}
this.BuiltInColors?.Apply();
}
/// <inheritdoc/>
public override void Push()
{
throw new NotImplementedException();
}
/// <inheritdoc/>
public override void Push()
{
throw new NotImplementedException();
}
/// <inheritdoc/>
public override void Pop()
{
throw new NotImplementedException();
/// <inheritdoc/>
public override void Pop()
{
throw new NotImplementedException();
}
}
}