diff --git a/Glamourer/DesignPanelFlag.cs b/Glamourer/DesignPanelFlag.cs index f9465d9..1b049d2 100644 --- a/Glamourer/DesignPanelFlag.cs +++ b/Glamourer/DesignPanelFlag.cs @@ -1,96 +1,103 @@ -using Glamourer.Designs; -using Dalamud.Bindings.ImGui; -using OtterGui.Text; -using OtterGui.Text.EndObjects; +using Luna.Generators; +using ImSharp; +using Luna; namespace Glamourer; [Flags] +[NamedEnum(Utf16: false)] public enum DesignPanelFlag : uint { - Customization = 0x0001, - Equipment = 0x0002, + [Name("Customization")] + Customization = 0x0001, + + [Name("Equipment")] + Equipment = 0x0002, + + [Name("Advanced Customization")] AdvancedCustomizations = 0x0004, - AdvancedDyes = 0x0008, - AppearanceDetails = 0x0010, - DesignDetails = 0x0020, - ModAssociations = 0x0040, - DesignLinks = 0x0080, - ApplicationRules = 0x0100, - DebugData = 0x0200, + + [Name("Advanced Dyes")] + AdvancedDyes = 0x0008, + + [Name("Appearance Details")] + AppearanceDetails = 0x0010, + + [Name("Design Details")] + DesignDetails = 0x0020, + + [Name("Mod Associations")] + ModAssociations = 0x0040, + + [Name("Design Links")] + DesignLinks = 0x0080, + + [Name("Application Rules")] + ApplicationRules = 0x0100, + + [Name("Debug Data")] + DebugData = 0x0200, } -public static class DesignPanelFlagExtensions +public static partial class DesignPanelFlagExtensions { - public static ReadOnlySpan ToName(this DesignPanelFlag flag) - => flag switch - { - DesignPanelFlag.Customization => "Customization"u8, - DesignPanelFlag.Equipment => "Equipment"u8, - DesignPanelFlag.AdvancedCustomizations => "Advanced Customization"u8, - DesignPanelFlag.AdvancedDyes => "Advanced Dyes"u8, - DesignPanelFlag.DesignDetails => "Design Details"u8, - DesignPanelFlag.ApplicationRules => "Application Rules"u8, - DesignPanelFlag.ModAssociations => "Mod Associations"u8, - DesignPanelFlag.DesignLinks => "Design Links"u8, - DesignPanelFlag.DebugData => "Debug Data"u8, - DesignPanelFlag.AppearanceDetails => "Appearance Details"u8, - _ => ""u8, - }; + private static readonly SizedString Expand = new("Expand"u8); + private static readonly SizedString AdvancedCustomization = new(DesignPanelFlag.AdvancedCustomizations.ToNameU8()); - public static CollapsingHeader Header(this DesignPanelFlag flag, Configuration config) + public static Im.HeaderDisposable Header(this DesignPanelFlag flag, Configuration config) { if (config.HideDesignPanel.HasFlag(flag)) - return new CollapsingHeader() - { - Disposed = true, - }; + return default; var expand = config.AutoExpandDesignPanel.HasFlag(flag); - return ImUtf8.CollapsingHeaderId(flag.ToName(), expand ? ImGuiTreeNodeFlags.DefaultOpen : ImGuiTreeNodeFlags.None); + return Im.Tree.HeaderId(flag.ToNameU8(), expand ? TreeNodeFlags.DefaultOpen : TreeNodeFlags.None); } public static void DrawTable(ReadOnlySpan label, DesignPanelFlag hidden, DesignPanelFlag expanded, Action setterHide, Action setterExpand) { - var checkBoxWidth = Math.Max(ImGui.GetFrameHeight(), ImUtf8.CalcTextSize("Expand"u8).X); - var textWidth = ImUtf8.CalcTextSize(DesignPanelFlag.AdvancedCustomizations.ToName()).X; - var tableSize = 2 * (textWidth + 2 * checkBoxWidth) + 10 * ImGui.GetStyle().CellPadding.X + 2 * ImGui.GetStyle().WindowPadding.X + 2 * ImGui.GetStyle().FrameBorderSize; - using var table = ImUtf8.Table(label, 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Borders, new Vector2(tableSize, 6 * ImGui.GetFrameHeight())); + var checkBoxWidth = Math.Max(Im.Style.FrameHeight, Expand.Size.X); + var textWidth = AdvancedCustomization.Size.X; + var tableSize = 2 * (textWidth + 2 * checkBoxWidth) + + 10 * Im.Style.CellPadding.X + + 2 * Im.Style.WindowPadding.X + + 2 * Im.Style.FrameBorderThickness; + using var table = Im.Table.Begin(label, 6, TableFlags.RowBackground | TableFlags.SizingFixedFit | TableFlags.Borders, + new Vector2(tableSize, 6 * Im.Style.FrameHeight)); if (!table) return; - var headerColor = ImGui.GetColorU32(ImGuiCol.TableHeaderBg); - var checkBoxOffset = (checkBoxWidth - ImGui.GetFrameHeight()) / 2; - ImUtf8.TableSetupColumn("Panel##1"u8, ImGuiTableColumnFlags.WidthFixed, textWidth); - ImUtf8.TableSetupColumn("Show##1"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth); - ImUtf8.TableSetupColumn("Expand##1"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth); - ImUtf8.TableSetupColumn("Panel##2"u8, ImGuiTableColumnFlags.WidthFixed, textWidth); - ImUtf8.TableSetupColumn("Show##2"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth); - ImUtf8.TableSetupColumn("Expand##2"u8, ImGuiTableColumnFlags.WidthFixed, checkBoxWidth); + var headerColor = Im.Color.Get(ImGuiColor.TableHeaderBackground); + var checkBoxOffset = (checkBoxWidth - Im.Style.FrameHeight) / 2; + table.SetupColumn("Panel##1"u8, TableColumnFlags.WidthFixed, textWidth); + table.SetupColumn("Show##1"u8, TableColumnFlags.WidthFixed, checkBoxWidth); + table.SetupColumn("Expand##1"u8, TableColumnFlags.WidthFixed, checkBoxWidth); + table.SetupColumn("Panel##2"u8, TableColumnFlags.WidthFixed, textWidth); + table.SetupColumn("Show##2"u8, TableColumnFlags.WidthFixed, checkBoxWidth); + table.SetupColumn("Expand##2"u8, TableColumnFlags.WidthFixed, checkBoxWidth); - ImGui.TableHeadersRow(); - foreach (var panel in Enum.GetValues()) + table.HeaderRow(); + foreach (var panel in DesignPanelFlag.Values) { - using var id = ImUtf8.PushId((int)panel); - ImGui.TableNextColumn(); - ImGui.TableSetBgColor(ImGuiTableBgTarget.CellBg, headerColor); - ImUtf8.TextFrameAligned(panel.ToName()); + using var id = Im.Id.Push((int)panel); + table.NextColumn(); + table.SetBackgroundColor(TableBackgroundTarget.Cell, headerColor); + ImEx.TextFrameAligned(panel.ToNameU8()); var isShown = !hidden.HasFlag(panel); var isExpanded = expanded.HasFlag(panel); - ImGui.TableNextColumn(); - ImGui.SetCursorPosX(ImGui.GetCursorPosX() + checkBoxOffset); - if (ImUtf8.Checkbox("##show"u8, ref isShown)) + table.NextColumn(); + Im.Cursor.X += checkBoxOffset; + if (Im.Checkbox("##show"u8, ref isShown)) setterHide.Invoke(isShown ? hidden & ~panel : hidden | panel); - ImUtf8.HoverTooltip( + Im.Tooltip.OnHover( "Show this panel and associated functionality in all relevant tabs.\n\nToggling this off does NOT disable any functionality, just the display of it, so hide panels at your own risk."u8); - ImGui.TableNextColumn(); - ImGui.SetCursorPosX(ImGui.GetCursorPosX() + checkBoxOffset); - if (ImUtf8.Checkbox("##expand"u8, ref isExpanded)) + table.NextColumn(); + Im.Cursor.X += checkBoxOffset; + if (Im.Checkbox("##expand"u8, ref isExpanded)) setterExpand.Invoke(isExpanded ? expanded | panel : expanded & ~panel); - ImUtf8.HoverTooltip("Expand this panel by default in all relevant tabs."u8); + Im.Tooltip.OnHover("Expand this panel by default in all relevant tabs."u8); } } } diff --git a/Glamourer/Designs/MetaIndex.cs b/Glamourer/Designs/MetaIndex.cs index 1842ae3..c8e6677 100644 --- a/Glamourer/Designs/MetaIndex.cs +++ b/Glamourer/Designs/MetaIndex.cs @@ -1,19 +1,36 @@ using Glamourer.Api.Enums; using Glamourer.State; +using Luna.Generators; namespace Glamourer.Designs; +[NamedEnum] +[TooltipEnum] public enum MetaIndex { - Wetness = StateIndex.MetaWetness, - HatState = StateIndex.MetaHatState, - VisorState = StateIndex.MetaVisorState, + [Name("Force Wetness")] + [Tooltip("Force the character to be wet or not.")] + Wetness = StateIndex.MetaWetness, + + [Name("Hat Visible")] + [Tooltip("Hide or show the characters head gear.")] + HatState = StateIndex.MetaHatState, + + [Name("Visor Toggled")] + [Tooltip("Toggle the visor state of the characters head gear.")] + VisorState = StateIndex.MetaVisorState, + + [Name("Weapon Visible")] + [Tooltip("Hide or show the characters weapons when not drawn.")] WeaponState = StateIndex.MetaWeaponState, - ModelId = StateIndex.MetaModelId, - EarState = StateIndex.MetaEarState, + ModelId = StateIndex.MetaModelId, + + [Name("Ears Visible")] + [Tooltip("Hide or show the characters ears through the head gear. (Viera only)")] + EarState = StateIndex.MetaEarState, } -public static class MetaExtensions +public static partial class MetaExtensions { public static readonly IReadOnlyList AllRelevant = [MetaIndex.Wetness, MetaIndex.HatState, MetaIndex.VisorState, MetaIndex.WeaponState, MetaIndex.EarState]; @@ -55,26 +72,4 @@ public static class MetaExtensions if (index.HasFlag(MetaFlag.EarState)) yield return MetaIndex.EarState; } - - public static string ToName(this MetaIndex index) - => index switch - { - MetaIndex.HatState => "Hat Visible", - MetaIndex.VisorState => "Visor Toggled", - MetaIndex.WeaponState => "Weapon Visible", - MetaIndex.Wetness => "Force Wetness", - MetaIndex.EarState => "Ears Visible", - _ => "Unknown Meta", - }; - - public static string ToTooltip(this MetaIndex index) - => index switch - { - MetaIndex.HatState => "Hide or show the characters head gear.", - MetaIndex.VisorState => "Toggle the visor state of the characters head gear.", - MetaIndex.WeaponState => "Hide or show the characters weapons when not drawn.", - MetaIndex.Wetness => "Force the character to be wet or not.", - MetaIndex.EarState => "Hide or show the characters ears through the head gear. (Viera only)", - _ => string.Empty, - }; } diff --git a/Glamourer/GameData/CustomizeData.cs b/Glamourer/GameData/CustomizeData.cs index 62828ae..0faf440 100644 --- a/Glamourer/GameData/CustomizeData.cs +++ b/Glamourer/GameData/CustomizeData.cs @@ -1,4 +1,5 @@ -using Penumbra.GameData.Enums; +using ImSharp; +using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; namespace Glamourer.GameData; @@ -28,7 +29,7 @@ public readonly struct CustomizeData : IEquatable /// An ID for an associated color. [FieldOffset(4)] - public readonly uint Color; + public readonly Rgba32 Color; /// Construct a CustomizeData from single data values. public CustomizeData(CustomizeIndex index, CustomizeValue value, uint data = 0, ushort customizeId = 0) diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.Color.cs b/Glamourer/Gui/Customization/CustomizationDrawer.Color.cs index 4f463d6..58b4300 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.Color.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.Color.cs @@ -1,43 +1,41 @@ using Dalamud.Interface; -using Dalamud.Interface.Utility; using Glamourer.GameData; -using Dalamud.Bindings.ImGui; -using OtterGui; -using OtterGui.Raii; -using OtterGui.Text; -using OtterGui.Text.EndObjects; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; -using System; +using ImSharp; +using Luna; namespace Glamourer.Gui.Customization; public partial class CustomizationDrawer { - private const string ColorPickerPopupName = "ColorPicker"; - private CustomizeValue _draggedColorValue; - private CustomizeIndex _draggedColorType; + private static ReadOnlySpan ColorPickerPopupName + => "ColorPicker"u8; + + private static readonly AwesomeIcon UnknownCustomization = FontAwesomeIcon.Question; + + private CustomizeValue _draggedColorValue; + private CustomizeIndex _draggedColorType; private void DrawDragDropSource(CustomizeIndex index, CustomizeData custom) { - using var dragDropSource = ImUtf8.DragDropSource(); + using var dragDropSource = Im.DragDrop.Source(); if (!dragDropSource) return; - if (!DragDropSource.SetPayload("##colorDragDrop"u8)) + if (!dragDropSource.SetPayload("##colorDragDrop"u8)) _draggedColorValue = _customize[index]; - ImUtf8.Text( - $"Dragging {(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption)} #{_draggedColorValue.Value}..."); + Im.Text($"Dragging {(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption)} #{_draggedColorValue.Value}..."); _draggedColorType = index; } private void DrawDragDropTarget(CustomizeIndex index) { - using var dragDropTarget = ImUtf8.DragDropTarget(); - if (!dragDropTarget.Success || !dragDropTarget.IsDropping("##colorDragDrop"u8)) + using var dragDropTarget = Im.DragDrop.Target(); + if (!dragDropTarget.IsDropping("##colorDragDrop"u8)) return; - + var idx = _set.DataByValue(_draggedColorType, _draggedColorValue, out var draggedData, _customize.Face); var bestMatch = _draggedColorValue; if (draggedData.HasValue) @@ -70,12 +68,12 @@ public partial class CustomizationDrawer UpdateValue(bestMatch); return; - static uint Diff(uint color1, uint color2) + static uint Diff(Rgba32 color1, Rgba32 color2) { - var r = (color1 & 0xFF) - (color2 & 0xFF); - var g = ((color1 >> 8) & 0xFF) - ((color2 >> 8) & 0xFF); - var b = ((color1 >> 16) & 0xFF) - ((color2 >> 16) & 0xFF); - return 30 * r * r + 59 * g * g + 11 * b * b; + var r = color1.R - color2.R; + var g = color1.G - color2.G; + var b = color1.B - color2.B; + return (uint) (30 * r * r + 59 * g * g + 11 * b * b); } } @@ -84,13 +82,13 @@ public partial class CustomizationDrawer using var id = SetId(index); var (current, custom) = GetCurrentCustomization(index); - var color = ImGui.ColorConvertU32ToFloat4(current < 0 ? ImGui.GetColorU32(ImGuiCol.FrameBg) : custom.Color); + var color = (current < 0 ? Im.Color.Get(ImGuiColor.FrameBackground) : custom.Color).ToVector(); - using (_ = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 2 * ImGuiHelpers.GlobalScale, current < 0)) + using (ImStyleSingle.FrameBorderThickness.Push(2 * Im.Style.GlobalScale, current < 0)) { - if (ImGui.ColorButton($"{_customize[index].Value}##color", color, ImGuiColorEditFlags.NoDragDrop, _framedIconSize)) + if (Im.Color.Button($"{_customize[index].Value}##color", color, ColorButtonFlags.NoDragDrop, _framedIconSize)) { - ImGui.OpenPopup(ColorPickerPopupName); + Im.Popup.Open(ColorPickerPopupName); } else if (current >= 0 && !_locked && CaptureMouseWheel(ref current, 0, _currentCount)) { @@ -105,27 +103,26 @@ public partial class CustomizationDrawer var npc = false; if (current < 0) { - using var font = ImRaii.PushFont(UiBuilder.IconFont); - var size = ImGui.CalcTextSize(FontAwesomeIcon.Question.ToIconString()); - var pos = ImGui.GetItemRectMin() + (ImGui.GetItemRectSize() - size) / 2; - ImGui.GetWindowDrawList().AddText(pos, ImGui.GetColorU32(ImGuiCol.Text), FontAwesomeIcon.Question.ToIconString()); + using var font = Im.Font.Push(AwesomeIcon.Font); + var size = Im.Font.CalculateSize(UnknownCustomization.Span); + var pos = Im.Item.UpperLeftCorner + (Im.Item.Size - size) / 2; + Im.Window.DrawList.Text(pos, Im.Color.Get(ImGuiColor.Text), UnknownCustomization.Span); current = 0; npc = true; } - ImGui.SameLine(); + Im.Line.Same(); - using (_ = ImRaii.Group()) + using (Im.Group()) { DataInputInt(current, npc); if (_withApply) { ApplyCheckbox(); - ImGui.SameLine(); + Im.Line.Same(); } - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(custom.Color == 0 ? $"{_currentOption} (NPC)" : _currentOption); + ImEx.TextFrameAligned(custom.Color.IsTransparent ? $"{_currentOption} (NPC)" : _currentOption); } DrawColorPickerPopup(current); @@ -133,30 +130,29 @@ public partial class CustomizationDrawer private void DrawColorPickerPopup(int current) { - using var popup = ImRaii.Popup(ColorPickerPopupName, ImGuiWindowFlags.AlwaysAutoResize); + using var popup = Im.Popup.Begin(ColorPickerPopupName, WindowFlags.AlwaysAutoResize); if (!popup) return; - using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero) - .Push(ImGuiStyleVar.FrameRounding, 0); + using var style = ImStyleDouble.ItemSpacing.Push(Vector2.Zero) + .Push(ImStyleSingle.FrameRounding, 0); for (var i = 0; i < _currentCount; ++i) { var custom = _set.Data(_currentIndex, i, _customize[CustomizeIndex.Face]); - if (ImGui.ColorButton(custom.Value.ToString(), ImGui.ColorConvertU32ToFloat4(custom.Color)) && !_locked) + if (Im.Color.Button($"{custom.Value}", custom.Color) && !_locked) { UpdateValue(custom.Value); - ImGui.CloseCurrentPopup(); + Im.Popup.CloseCurrent(); } if (i == current) { - var size = ImGui.GetItemRectSize(); - ImGui.GetWindowDrawList() - .AddCircleFilled(ImGui.GetItemRectMin() + size / 2, size.X / 4, ImGuiUtil.ContrastColorBw(custom.Color)); + var size = Im.Item.Size; + Im.Window.DrawList.Shape.CircleFilled(Im.Item.UpperLeftCorner + size / 2, size.X / 4, custom.Color.ContrastColor()); } - if (i % 8 != 7) - ImGui.SameLine(); + if (i % 8 is not 7) + Im.Line.Same(); } } diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.GenderRace.cs b/Glamourer/Gui/Customization/CustomizationDrawer.GenderRace.cs index 26e9002..1e1de88 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.GenderRace.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.GenderRace.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.GameData.Enums; @@ -12,7 +13,7 @@ public partial class CustomizationDrawer private void DrawRaceGenderSelector() { DrawGenderSelector(); - ImGui.SameLine(); + Im.Line.Same(); using var group = ImRaii.Group(); DrawRaceCombo(); if (_withApply) @@ -21,11 +22,11 @@ public partial class CustomizationDrawer if (UiHelpers.DrawCheckbox("##applyGender", "Apply gender of this design.", ChangeApply.HasFlag(CustomizeFlag.Gender), out var applyGender, _locked)) ChangeApply = applyGender ? ChangeApply | CustomizeFlag.Gender : ChangeApply & ~CustomizeFlag.Gender; - ImGui.SameLine(); + Im.Line.Same(); if (UiHelpers.DrawCheckbox("##applyClan", "Apply clan of this design.", ChangeApply.HasFlag(CustomizeFlag.Clan), out var applyClan, _locked)) ChangeApply = applyClan ? ChangeApply | CustomizeFlag.Clan : ChangeApply & ~CustomizeFlag.Clan; - ImGui.SameLine(); + Im.Line.Same(); } ImGui.AlignTextToFramePadding(); @@ -45,7 +46,7 @@ public partial class CustomizationDrawer if (ImGuiUtil.DrawDisabledButton(icon.ToIconString(), _framedIconSize, string.Empty, icon is not FontAwesomeIcon.Mars and not FontAwesomeIcon.Venus, true)) - Changed |= _service.ChangeGender(ref _customize, icon is FontAwesomeIcon.Mars ? Gender.Female : Gender.Male); + Changed |= service.ChangeGender(ref _customize, icon is FontAwesomeIcon.Mars ? Gender.Female : Gender.Male); } if (_lockedRedraw && ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) @@ -58,13 +59,13 @@ public partial class CustomizationDrawer using (ImRaii.Disabled(_locked || _lockedRedraw)) { ImGui.SetNextItemWidth(_raceSelectorWidth); - using (var combo = ImRaii.Combo("##subRaceCombo", _service.ClanName(_customize.Clan, _customize.Gender))) + using (var combo = ImRaii.Combo("##subRaceCombo", service.ClanName(_customize.Clan, _customize.Gender))) { if (combo) foreach (var subRace in Enum.GetValues().Skip(1)) // Skip Unknown { - if (ImGui.Selectable(_service.ClanName(subRace, _customize.Gender), subRace == _customize.Clan)) - Changed |= _service.ChangeClan(ref _customize, subRace); + if (ImGui.Selectable(service.ClanName(subRace, _customize.Gender), subRace == _customize.Clan)) + Changed |= service.ChangeClan(ref _customize, subRace); } } } diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.Icon.cs b/Glamourer/Gui/Customization/CustomizationDrawer.Icon.cs index 8599f8c..8e128d1 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.Icon.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.Icon.cs @@ -2,6 +2,7 @@ using Glamourer.GameData; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Extensions; using OtterGui.Raii; @@ -31,7 +32,7 @@ public partial class CustomizationDrawer npc = true; } - var icon = _service.Manager.GetIcon(custom!.Value.IconId); + var icon = service.Manager.GetIcon(custom!.Value.IconId); var hasIcon = icon.TryGetWrap(out var wrap, out _); using (_ = ImRaii.Disabled(_locked || _currentIndex is CustomizeIndex.Face && _lockedRedraw)) { @@ -49,7 +50,7 @@ public partial class CustomizationDrawer if (hasIcon) ImGuiUtil.HoverIconTooltip(wrap!, _iconSize); - ImGui.SameLine(); + Im.Line.Same(); using (_ = ImRaii.Group()) { DataInputInt(current, npc); @@ -60,7 +61,7 @@ public partial class CustomizationDrawer if (_withApply) { ApplyCheckbox(); - ImGui.SameLine(); + Im.Line.Same(); } ImGui.TextUnformatted(label); @@ -80,10 +81,10 @@ public partial class CustomizationDrawer for (var i = 0; i < _currentCount; ++i) { var custom = _set.Data(_currentIndex, i, _customize.Face); - var icon = _service.Manager.GetIcon(custom.IconId); + var icon = service.Manager.GetIcon(custom.IconId); using (var _ = ImRaii.Group()) { - var isFavorite = _favorites.Contains(_set.Gender, _set.Clan, _currentIndex, custom.Value); + var isFavorite = favorites.Contains(_set.Gender, _set.Clan, _currentIndex, custom.Value); using var frameColor = current == i ? ImRaii.PushColor(ImGuiCol.Button, Colors.SelectedRed) : ImRaii.PushColor(ImGuiCol.Button, ColorId.FavoriteStarOn.Value(), isFavorite); @@ -97,9 +98,9 @@ public partial class CustomizationDrawer if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) if (isFavorite) - _favorites.Remove(_set.Gender, _set.Clan, _currentIndex, custom.Value); + favorites.Remove(_set.Gender, _set.Clan, _currentIndex, custom.Value); else - _favorites.TryAdd(_set.Gender, _set.Clan, _currentIndex, custom.Value); + favorites.TryAdd(_set.Gender, _set.Clan, _currentIndex, custom.Value); if (hasIcon) ImGuiUtil.HoverIconTooltip(wrap!, _iconSize, @@ -112,7 +113,7 @@ public partial class CustomizationDrawer } if (i % 8 != 7) - ImGui.SameLine(); + Im.Line.Same(); } } @@ -123,19 +124,19 @@ public partial class CustomizationDrawer using var bigGroup = ImRaii.Group(); using var disabled = ImRaii.Disabled(_locked); DrawMultiIcons(); - ImGui.SameLine(); + Im.Line.Same(); using var group = ImRaii.Group(); _currentCount = 256; if (_withApply) { ApplyCheckbox(CustomizeIndex.FacialFeature1); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + _spacing.X); ApplyCheckbox(CustomizeIndex.FacialFeature2); - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(CustomizeIndex.FacialFeature3); - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(CustomizeIndex.FacialFeature4); } else @@ -166,7 +167,7 @@ public partial class CustomizationDrawer if (_set.DataByValue(CustomizeIndex.Face, _customize.Face, out _, _customize.Face) < 0) { - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); using var _ = ImRaii.Enabled(); ImGui.TextUnformatted("(Using Face 1)"); @@ -182,12 +183,12 @@ public partial class CustomizationDrawer if (_withApply) { ApplyCheckbox(CustomizeIndex.FacialFeature5); - ImGui.SameLine(); + Im.Line.Same(); ImGui.SetCursorPosX(ImGui.GetCursorPosX() + _spacing.X); ApplyCheckbox(CustomizeIndex.FacialFeature6); - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(CustomizeIndex.FacialFeature7); - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(CustomizeIndex.LegacyTattoo); } } @@ -204,7 +205,7 @@ public partial class CustomizationDrawer var feature = _set.Data(featureIdx, 0, face); bool hasIcon; IDalamudTextureWrap? wrap; - var icon = _service.Manager.GetIcon(feature.IconId); + var icon = service.Manager.GetIcon(feature.IconId); if (featureIdx is CustomizeIndex.LegacyTattoo) { wrap = _legacyTattoo; @@ -225,7 +226,7 @@ public partial class CustomizationDrawer if (hasIcon) ImGuiUtil.HoverIconTooltip(wrap!, _iconSize); if (idx % 4 != 3) - ImGui.SameLine(); + Im.Line.Same(); } } } diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs index ec5523f..cd1d48a 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs @@ -1,4 +1,5 @@ using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGuiInternal; @@ -17,16 +18,16 @@ public partial class CustomizationDrawer using (var disabled = ImRaii.Disabled(_locked)) { DrawPercentageSlider(); - ImGui.SameLine(); + Im.Line.Same(); PercentageInputInt(); if (_withApply) { - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(); } } - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted(_currentOption); if (_currentIndex is CustomizeIndex.Height) @@ -35,13 +36,13 @@ public partial class CustomizationDrawer private void DrawHeight() { - if (_config.HeightDisplayType is HeightDisplayType.None) + if (config.HeightDisplayType is HeightDisplayType.None) return; - var height = _heightService.Height(_customize); - ImGui.SameLine(); + var height = heightService.Height(_customize); + Im.Line.Same(); - var heightString = _config.HeightDisplayType switch + var heightString = config.HeightDisplayType switch { HeightDisplayType.Centimetre => FormattableString.Invariant($"({height * 100:F1} cm)"), HeightDisplayType.Metre => FormattableString.Invariant($"({height:F2} m)"), @@ -105,13 +106,13 @@ public partial class CustomizationDrawer if (!_withApply) ImGuiUtil.HoverTooltip("Hold Control to force updates with invalid/unknown options at your own risk."); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("-", new Vector2(ImGui.GetFrameHeight()), "Select the previous available option in order.", currentIndex <= 0)) UpdateValue(_set.Data(_currentIndex, currentIndex - 1, _customize.Face).Value); else CheckWheel(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("+", new Vector2(ImGui.GetFrameHeight()), "Select the next available option in order.", currentIndex >= _currentCount - 1 || npc)) UpdateValue(_set.Data(_currentIndex, currentIndex + 1, _customize.Face).Value); @@ -139,24 +140,24 @@ public partial class CustomizationDrawer if (indexedBy1) { ListCombo1(); - ImGui.SameLine(); + Im.Line.Same(); ListInputInt1(); } else { ListCombo0(); - ImGui.SameLine(); + Im.Line.Same(); ListInputInt0(); } if (_withApply) { - ImGui.SameLine(); + Im.Line.Same(); ApplyCheckbox(); } } - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted(_currentOption); } @@ -282,7 +283,7 @@ public partial class CustomizationDrawer } } - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted(_currentIndex.ToDefaultName()); } } diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.cs b/Glamourer/Gui/Customization/CustomizationDrawer.cs index 349891c..84f2753 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.cs @@ -4,9 +4,8 @@ using Dalamud.Plugin.Services; using Glamourer.GameData; using Glamourer.Services; using Glamourer.Unlocks; -using Dalamud.Bindings.ImGui; -using OtterGui; -using OtterGui.Raii; +using ImSharp; +using Luna; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -14,10 +13,10 @@ namespace Glamourer.Gui.Customization; public partial class CustomizationDrawer( ITextureProvider textures, - CustomizeService _service, - Configuration _config, - FavoriteManager _favorites, - HeightService _heightService) + CustomizeService service, + Configuration config, + FavoriteManager favorites, + HeightService heightService) : IDisposable { private readonly Vector4 _redTint = new(0.6f, 0.3f, 0.3f, 1f); @@ -61,7 +60,7 @@ public partial class CustomizationDrawer( { ChangeApply = apply; _initialApply = apply; - _withApply = !_config.HideApplyCheckmarks; + _withApply = !config.HideApplyCheckmarks; Init(current, locked, lockedRedraw); return DrawInternal(); } @@ -85,7 +84,7 @@ public partial class CustomizationDrawer( private string _currentOption = string.Empty; // Prepare a new customization option. - private ImRaii.Id SetId(CustomizeIndex index) + private Im.IdDisposable SetId(CustomizeIndex index) { _currentIndex = index; _currentFlag = index.ToFlag(); @@ -93,7 +92,7 @@ public partial class CustomizationDrawer( _currentByte = _customize[index]; _currentCount = _set.Count(index, _customize.Face); _currentOption = _set.Option(index); - return ImRaii.PushId((int)index); + return Im.Id.Push((int)index); } // Update the current id with a new value. @@ -112,19 +111,24 @@ public partial class CustomizationDrawer( private bool DrawInternal() { - using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _spacing); + using var spacing = ImStyleDouble.ItemSpacing.Push(_spacing); try { DrawRaceGenderSelector(); DrawBodyType(); - _set = _service.Manager.GetSet(_customize.Clan, _customize.Gender); + _set = service.Manager.GetSet(_customize.Clan, _customize.Gender); foreach (var id in _set.Order[MenuType.Percentage]) PercentageSelector(id); - Functions.IteratePairwise(_set.Order[MenuType.IconSelector], DrawIconSelector, ImGui.SameLine); + foreach (var (i, icon) in _set.Order[MenuType.IconSelector].Index()) + { + if ((i & 1) is 1) + Im.Line.Same(); + DrawIconSelector(icon); + } DrawMultiIconSelector(); @@ -134,29 +138,40 @@ public partial class CustomizationDrawer( foreach (var id in _set.Order[MenuType.List1Selector]) DrawListSelector(id, true); - Functions.IteratePairwise(_set.Order[MenuType.ColorPicker], DrawColorPicker, ImGui.SameLine); + foreach (var (i, color) in _set.Order[MenuType.ColorPicker].Index()) + { + if ((i & 1) is 1) + Im.Line.Same(); + DrawColorPicker(color); + } - Functions.IteratePairwise(_set.Order[MenuType.Checkmark], DrawCheckbox, - () => ImGui.SameLine(_comboSelectorSize - _framedIconSize.X + ImGui.GetStyle().WindowPadding.X)); - return Changed != 0 || ChangeApply != _initialApply; + var offset = _comboSelectorSize - _framedIconSize.X + Im.Style.WindowPadding.X; + foreach (var (i, check) in _set.Order[MenuType.Checkmark].Index()) + { + if ((i & 1) is 1) + Im.Line.Same(offset); + DrawCheckbox(check); + } + + return Changed is not 0 || ChangeApply != _initialApply; } catch (Exception ex) { _terminate = ex; - using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF4040FF); - ImGui.NewLine(); - ImGuiUtil.TextWrapped(_terminate.ToString()); + using var color = ImGuiColor.Text.Push(LunaStyle.ErrorBorderColor); + Im.Line.New(); + Im.TextWrapped($"{_terminate}"); return false; } } private void UpdateSizes() { - _spacing = ImGui.GetStyle().ItemSpacing with { X = ImGui.GetStyle().ItemInnerSpacing.X }; - _iconSize = new Vector2(ImGui.GetTextLineHeight() * 2 + _spacing.Y + 2 * ImGui.GetStyle().FramePadding.Y); - _framedIconSize = _iconSize + 2 * ImGui.GetStyle().FramePadding; + _spacing = Im.Style.ItemSpacing with { X = Im.Style.ItemInnerSpacing.X }; + _iconSize = new Vector2(Im.Style.TextHeight * 2 + _spacing.Y + 2 * Im.Style.FramePadding.Y); + _framedIconSize = _iconSize + 2 * Im.Style.FramePadding; _inputIntSize = 2 * _framedIconSize.X + 1 * _spacing.X; - _inputIntSizeNoButtons = _inputIntSize - 2 * _spacing.X - 2 * ImGui.GetFrameHeight(); + _inputIntSizeNoButtons = _inputIntSize - 2 * _spacing.X - 2 * Im.Style.FrameHeight; _comboSelectorSize = 4 * _framedIconSize.X + 3 * _spacing.X; _raceSelectorWidth = _inputIntSize + _comboSelectorSize - _framedIconSize.X; } diff --git a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs index a7ba056..30e4fb4 100644 --- a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs @@ -4,6 +4,7 @@ using Glamourer.GameData; using Glamourer.Interop.PalettePlus; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -131,7 +132,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import DrawColorDisplayOptions(); DrawColorFormatOptions(withApply); var value = config.ShowColorConfig; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Checkbox("Show Config", ref value)) { config.ShowColorConfig = value; @@ -151,7 +152,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.RadioButton("HSV", !config.UseRgbForColors) && config.UseRgbForColors) { config.UseRgbForColors = false; @@ -177,7 +178,7 @@ public class CustomizeParameterDrawer(Configuration config, PaletteImport import config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.RadioButton("Integer", !config.UseFloatForColors) && config.UseFloatForColors) { config.UseFloatForColors = false; diff --git a/Glamourer/Gui/DesignQuickBar.cs b/Glamourer/Gui/DesignQuickBar.cs index 1b3f4c7..b5df21a 100644 --- a/Glamourer/Gui/DesignQuickBar.cs +++ b/Glamourer/Gui/DesignQuickBar.cs @@ -8,6 +8,7 @@ using Glamourer.Designs; using Glamourer.Interop.Penumbra; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Text; using Penumbra.GameData.Actors; using Penumbra.GameData.Interop; @@ -117,7 +118,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos { var comboSize = width - _numButtons * (buttonSize.X + spacing.X); _designCombo.Draw(comboSize); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyButton(buttonSize); } @@ -183,7 +184,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos var (clicked, id, data, state) = ResolveTarget(FontAwesomeIcon.PlayCircle, size, available); - ImGui.SameLine(); + Im.Line.Same(); if (!clicked) return; @@ -227,7 +228,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos "Neither player character nor target are available, have state modified by Glamourer, or their state is locked."); var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.UndoAlt, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) _stateManager.ResetState(state!, StateSource.Manual, isFinal: true); } @@ -264,7 +265,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos "Neither player character nor target are available, have state modified by Glamourer, or their state is locked."); var (clicked, id, data, state) = ResolveTarget(FontAwesomeIcon.SyncAlt, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (!clicked) return; @@ -307,7 +308,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos "Neither player character nor target are available, have state modified by Glamourer, or their state is locked."); var (clicked, id, data, state) = ResolveTarget(FontAwesomeIcon.Repeat, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (!clicked) return; @@ -346,7 +347,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos _tooltipBuilder.Append("Neither player character nor target are available or their state is locked."); var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.PaintBrush, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) _stateManager.ResetAdvancedCustomizations(state!, StateSource.Manual); } @@ -379,7 +380,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos _tooltipBuilder.Append("Neither player character nor target are available or their state is locked."); var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.Palette, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) _stateManager.ResetAdvancedDyes(state!, StateSource.Manual); } @@ -412,7 +413,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos _tooltipBuilder.Append("Neither player character nor target are available or their state is locked."); var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.User, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) _stateManager.ResetCustomize(state!, StateSource.Manual); } @@ -445,7 +446,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos _tooltipBuilder.Append("Neither player character nor target are available or their state is locked."); var (clicked, _, _, state) = ResolveTarget(FontAwesomeIcon.Vest, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) _stateManager.ResetEquip(state!, StateSource.Manual); } @@ -484,7 +485,7 @@ public sealed class DesignQuickBar : Dalamud.Interface.Windowing.Window, IDispos _tooltipBuilder.Append("Neither player character nor target are available to identify their collections."); var (clicked, _, data, _) = ResolveTarget(FontAwesomeIcon.Cog, buttonSize, available); - ImGui.SameLine(); + Im.Line.Same(); if (clicked) { _penumbra.RemoveAllTemporarySettings(data.Objects[0].Index, StateSource.Manual); diff --git a/Glamourer/Gui/Equipment/BonusItemCombo.cs b/Glamourer/Gui/Equipment/BonusItemCombo.cs index aa43da7..f23262a 100644 --- a/Glamourer/Gui/Equipment/BonusItemCombo.cs +++ b/Glamourer/Gui/Equipment/BonusItemCombo.cs @@ -2,6 +2,7 @@ using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using Lumina.Excel.Sheets; using OtterGui; using OtterGui.Classes; @@ -11,6 +12,7 @@ using OtterGui.Raii; using OtterGui.Widgets; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Equipment; @@ -72,9 +74,9 @@ public sealed class BonusItemCombo : FilterComboCache CurrentSelection = default; } - ImGui.SameLine(); + Im.Line.Same(); var ret = ImGui.Selectable(name, selected); - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); ImGuiUtil.RightAlign($"({obj.PrimaryId.Id}-{obj.Variant.Id})"); return ret; diff --git a/Glamourer/Gui/Equipment/EquipmentDrawer.cs b/Glamourer/Gui/Equipment/EquipmentDrawer.cs index 01ec938..0123129 100644 --- a/Glamourer/Gui/Equipment/EquipmentDrawer.cs +++ b/Glamourer/Gui/Equipment/EquipmentDrawer.cs @@ -6,15 +6,16 @@ using Glamourer.Gui.Materials; using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Extensions; using OtterGui.Raii; using OtterGui.Text; using OtterGui.Text.EndObjects; -using OtterGui.Widgets; using Penumbra.GameData.Data; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Equipment; @@ -149,7 +150,7 @@ public class EquipmentDrawer { if (data.DisplayApplication) { - var (valueChanged, applyChanged) = UiHelpers.DrawMetaToggle(data.Label, data.CurrentValue, data.CurrentApply, out var newValue, + var (valueChanged, applyChanged) = UiHelpers.DrawMetaToggle(data.Label.ToString(), data.CurrentValue, data.CurrentApply, out var newValue, out var newApply, data.Locked); if (valueChanged) data.SetValue(newValue); @@ -158,7 +159,7 @@ public class EquipmentDrawer } else { - if (UiHelpers.DrawCheckbox(data.Label, data.Tooltip, data.CurrentValue, out var newValue, data.Locked)) + if (UiHelpers.DrawCheckbox(data.Label.ToString(), data.Tooltip.ToString(), data.CurrentValue, out var newValue, data.Locked)) data.SetValue(newValue); } } @@ -194,13 +195,13 @@ public class EquipmentDrawer private void DrawEquipSmall(in EquipDrawData equipDrawData) { DrawStain(equipDrawData, true); - ImGui.SameLine(); + Im.Line.Same(); DrawItem(equipDrawData, out var label, true, false, false); if (equipDrawData.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(equipDrawData); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(equipDrawData); } else if (equipDrawData.IsState) @@ -217,11 +218,11 @@ public class EquipmentDrawer private void DrawBonusItemSmall(in BonusDrawData bonusDrawData) { ImGui.Dummy(new Vector2(StainId.NumStains * ImUtf8.FrameHeight + (StainId.NumStains - 1) * ImUtf8.ItemSpacing.X, ImUtf8.FrameHeight)); - ImGui.SameLine(); + Im.Line.Same(); DrawBonusItem(bonusDrawData, out var label, true, false, false); if (bonusDrawData.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(bonusDrawData); } else if (bonusDrawData.IsState) @@ -235,13 +236,13 @@ public class EquipmentDrawer private void DrawWeaponsSmall(EquipDrawData mainhand, EquipDrawData offhand, bool allWeapons) { DrawStain(mainhand, true); - ImGui.SameLine(); + Im.Line.Same(); DrawMainhand(ref mainhand, ref offhand, out var mainhandLabel, allWeapons, true, false); if (mainhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(mainhand); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(mainhand); } else if (mainhand.IsState) @@ -257,13 +258,13 @@ public class EquipmentDrawer return; DrawStain(offhand, true); - ImGui.SameLine(); + Im.Line.Same(); DrawOffhand(mainhand, offhand, out var offhandLabel, true, false, false); if (offhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(offhand); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(offhand); } else if (offhand.IsState) @@ -283,12 +284,12 @@ public class EquipmentDrawer equipDrawData.CurrentItem.DrawIcon(_textures, _iconSize, equipDrawData.Slot); var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); - ImGui.SameLine(); + Im.Line.Same(); using var group = ImRaii.Group(); DrawItem(equipDrawData, out var label, false, right, left); if (equipDrawData.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(equipDrawData); } @@ -297,7 +298,7 @@ public class EquipmentDrawer DrawStain(equipDrawData, false); if (equipDrawData.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(equipDrawData); } else if (equipDrawData.IsState) @@ -307,7 +308,7 @@ public class EquipmentDrawer if (VerifyRestrictedGear(equipDrawData)) { - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("(Restricted)"u8); } } @@ -317,11 +318,11 @@ public class EquipmentDrawer bonusDrawData.CurrentItem.DrawIcon(_textures, _iconSize, bonusDrawData.Slot); var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); - ImGui.SameLine(); + Im.Line.Same(); DrawBonusItem(bonusDrawData, out var label, false, right, left); if (bonusDrawData.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(bonusDrawData); } else if (bonusDrawData.IsState) @@ -339,13 +340,13 @@ public class EquipmentDrawer mainhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.MainHand); var left = ImGui.IsItemClicked(ImGuiMouseButton.Left); - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { DrawMainhand(ref mainhand, ref offhand, out var mainhandLabel, allWeapons, false, left); if (mainhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(mainhand); } @@ -355,7 +356,7 @@ public class EquipmentDrawer DrawStain(mainhand, false); if (mainhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(mainhand); } else if (mainhand.IsState) @@ -370,13 +371,13 @@ public class EquipmentDrawer offhand.CurrentItem.DrawIcon(_textures, _iconSize, EquipSlot.OffHand); var right = ImGui.IsItemClicked(ImGuiMouseButton.Right); left = ImGui.IsItemClicked(ImGuiMouseButton.Left); - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { DrawOffhand(mainhand, offhand, out var offhandLabel, false, right, left); if (offhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApply(offhand); } @@ -385,7 +386,7 @@ public class EquipmentDrawer DrawStain(offhand, false); if (offhand.DisplayApplication) { - ImGui.SameLine(); + Im.Line.Same(); DrawApplyStain(offhand); } else if (offhand.IsState) @@ -671,7 +672,7 @@ public class EquipmentDrawer private void WeaponHelpMarker(bool hasAdvancedDyes, string label, string? type = null) { - ImGui.SameLine(); + Im.Line.Same(); ImGuiComponents.HelpMarker( "Changing weapons to weapons of different types can cause crashes, freezes, soft- and hard locks and cheating, " + "thus it is only allowed to change weapons to other weapons of the same type."); @@ -688,7 +689,7 @@ public class EquipmentDrawer [MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)] private void DrawEquipLabel(bool hasAdvancedDyes, string label) { - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.PushColor(ImGuiCol.Text, _advancedMaterialColor, hasAdvancedDyes)) { ImUtf8.Text(label); diff --git a/Glamourer/Gui/Equipment/GlamourerColorCombo.cs b/Glamourer/Gui/Equipment/GlamourerColorCombo.cs index 3149e67..3b3fd3f 100644 --- a/Glamourer/Gui/Equipment/GlamourerColorCombo.cs +++ b/Glamourer/Gui/Equipment/GlamourerColorCombo.cs @@ -3,9 +3,11 @@ using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Widgets; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Structs; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Equipment; @@ -26,7 +28,7 @@ public sealed class GlamourerColorCombo(float _comboWidth, DictStain _stains, Fa UiHelpers.DrawFavoriteStar(_favorites, Items[globalIdx].Key); } - ImGui.SameLine(); + Im.Line.Same(); } var buttonWidth = ImGui.GetContentRegionAvail().X; diff --git a/Glamourer/Gui/Equipment/ItemCombo.cs b/Glamourer/Gui/Equipment/ItemCombo.cs index 7c0c3bc..eb67629 100644 --- a/Glamourer/Gui/Equipment/ItemCombo.cs +++ b/Glamourer/Gui/Equipment/ItemCombo.cs @@ -2,6 +2,7 @@ using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using Lumina.Excel.Sheets; using OtterGui.Classes; using OtterGui.Extensions; @@ -11,6 +12,7 @@ using OtterGui.Text; using OtterGui.Widgets; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Equipment; @@ -72,9 +74,9 @@ public sealed class ItemCombo : FilterComboCache CurrentSelection = default; } - ImGui.SameLine(); + Im.Line.Same(); var ret = ImGui.Selectable(name, selected); - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.Variant.Id})"); return ret; diff --git a/Glamourer/Gui/Equipment/WeaponCombo.cs b/Glamourer/Gui/Equipment/WeaponCombo.cs index 3029db7..7129e77 100644 --- a/Glamourer/Gui/Equipment/WeaponCombo.cs +++ b/Glamourer/Gui/Equipment/WeaponCombo.cs @@ -1,6 +1,7 @@ using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Classes; using OtterGui.Extensions; using OtterGui.Log; @@ -9,6 +10,7 @@ using OtterGui.Text; using OtterGui.Widgets; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Equipment; @@ -71,9 +73,9 @@ public sealed class WeaponCombo : FilterComboCache CurrentSelection = default; } - ImGui.SameLine(); + Im.Line.Same(); var ret = ImGui.Selectable(name, selected); - ImGui.SameLine(); + Im.Line.Same(); using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF808080); ImUtf8.TextRightAligned($"({obj.PrimaryId.Id}-{obj.SecondaryId.Id}-{obj.Variant.Id})"); return ret; diff --git a/Glamourer/Gui/GenericPopupWindow.cs b/Glamourer/Gui/GenericPopupWindow.cs index 5061862..79c55d1 100644 --- a/Glamourer/Gui/GenericPopupWindow.cs +++ b/Glamourer/Gui/GenericPopupWindow.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Windowing; using Dalamud.Plugin.Services; using Glamourer.Gui.Materials; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; @@ -84,7 +85,7 @@ public class GenericPopupWindow : Window ImGui.CloseCurrentPopup(); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.Button("Not Right Now.", buttonWidth)) { _config.DisableFestivals = 2; diff --git a/Glamourer/Gui/MainWindow.cs b/Glamourer/Gui/MainWindow.cs index a7f28ad..962e103 100644 --- a/Glamourer/Gui/MainWindow.cs +++ b/Glamourer/Gui/MainWindow.cs @@ -12,6 +12,7 @@ using Glamourer.Gui.Tabs.SettingsTab; using Glamourer.Gui.Tabs.UnlocksTab; using Glamourer.Interop.Penumbra; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -260,7 +261,7 @@ public class MainWindow : Window, IDisposable _penumbra.Reattach(); var ignoreAllowed = _config.DeleteDesignModifier.IsActive(); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Ignore Penumbra This Time"u8, $"Some functionality, like automation or retaining state, will not work correctly without Penumbra.\n\nIgnore this at your own risk!{(ignoreAllowed ? string.Empty : $"\n\nHold {_config.DeleteDesignModifier} while clicking to enable this button.")}", default, !ignoreAllowed)) @@ -269,7 +270,7 @@ public class MainWindow : Window, IDisposable ImGui.NewLine(); ImGui.NewLine(); SupportButton.Discord(Glamourer.Messager, 0); - ImGui.SameLine(); + Im.Line.Same(); ImGui.NewLine(); ImGui.NewLine(); } diff --git a/Glamourer/Gui/Materials/AdvancedDyePopup.cs b/Glamourer/Gui/Materials/AdvancedDyePopup.cs index 4d6d42b..447e48c 100644 --- a/Glamourer/Gui/Materials/AdvancedDyePopup.cs +++ b/Glamourer/Gui/Materials/AdvancedDyePopup.cs @@ -4,11 +4,11 @@ using Dalamud.Interface.Utility; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; -using FFXIVClientStructs.Interop; using Glamourer.Designs; using Glamourer.Interop.Material; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui.Raii; using OtterGui.Text; @@ -60,7 +60,7 @@ public sealed unsafe class AdvancedDyePopup( if (config.HideDesignPanel.HasFlag(DesignPanelFlag.AdvancedDyes)) return; - ImGui.SameLine(); + Im.Line.Same(); using var id = ImUtf8.PushId(index.SlotIndex | ((int)index.DrawObject << 8)); var isOpen = index == _drawIndex; @@ -98,7 +98,7 @@ public sealed unsafe class AdvancedDyePopup( return (path, gamePath); } - private void DrawTabBar(ReadOnlySpan> textures, ReadOnlySpan> materials, ref bool firstAvailable) + private void DrawTabBar(ReadOnlySpan> textures, ReadOnlySpan> materials, ref bool firstAvailable) { using var bar = ImUtf8.TabBar("tabs"u8); if (!bar) @@ -180,7 +180,7 @@ public sealed unsafe class AdvancedDyePopup( } } - private void DrawContent(ReadOnlySpan> textures, ReadOnlySpan> materials) + private void DrawContent(ReadOnlySpan> textures, ReadOnlySpan> materials) { var firstAvailable = true; DrawTabBar(textures, materials, ref firstAvailable); @@ -189,7 +189,7 @@ public sealed unsafe class AdvancedDyePopup( ImUtf8.Text("No Editable Materials available."u8); } - private void DrawWindow(ReadOnlySpan> textures, ReadOnlySpan> materials) + private void DrawWindow(ReadOnlySpan> textures, ReadOnlySpan> materials) { var flags = ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoCollapse @@ -326,7 +326,7 @@ public sealed unsafe class AdvancedDyePopup( ImUtf8.IconButton(FontAwesomeIcon.Crosshairs, "Highlight all affected colors on the character."u8, buttonSize); if (ImGui.IsItemHovered()) preview.OnHover(materialIndex with { RowIndex = byte.MaxValue }, _actor.Index, table); - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); using (ImRaii.PushFont(UiBuilder.MonoFont)) { @@ -391,7 +391,7 @@ public sealed unsafe class AdvancedDyePopup( if (ImGui.IsItemHovered()) preview.OnHover(index, _actor.Index, table); - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); using (ImRaii.PushFont(UiBuilder.MonoFont)) { diff --git a/Glamourer/Gui/Materials/MaterialDrawer.cs b/Glamourer/Gui/Materials/MaterialDrawer.cs index ea31dfa..ce3db82 100644 --- a/Glamourer/Gui/Materials/MaterialDrawer.cs +++ b/Glamourer/Gui/Materials/MaterialDrawer.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Utility.Raii; using Glamourer.Designs; using Glamourer.Interop.Material; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Text; @@ -58,7 +59,7 @@ public class MaterialDrawer(DesignManager designManager, Configuration config) : ; if (disabled && any) ImUtf8.HoverTooltip($"Hold {config.DeleteDesignModifier} while clicking to enable."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Disable All Advanced Dyes"u8, any ? "Disable the application of all contained advanced dyes without deleting them."u8 diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs index d422e64..d504cc0 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs @@ -12,15 +12,16 @@ using Glamourer.Gui.Materials; using Glamourer.Interop; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; using OtterGui.Text; -using OtterGui.Text.HelperObjects; using Penumbra.GameData.Actors; using Penumbra.GameData.DataContainers; using Penumbra.GameData.Enums; using Penumbra.GameData.Interop; +using TextStringHandlerBuffer = OtterGui.Text.HelperObjects.TextStringHandlerBuffer; namespace Glamourer.Gui.Tabs.ActorTab; @@ -165,7 +166,7 @@ public class ActorPanel -Vector2.UnitX, Colors.SelectedRed); DrawApplyToSelf(); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyToTarget(); RevertButtons(); @@ -276,7 +277,7 @@ public class ActorPanel ImUtf8.DrawTableColumn("Game Object ID"u8); DrawCopyColumn($"{string.Join(", ", _data.Objects.Select(d => d.AsObject->GetGameObjectId().ObjectId))}"); - static void DrawCopyColumn(ref Utf8StringHandler text) + static void DrawCopyColumn(ref OtterGui.Text.HelperObjects.Utf8StringHandler text) { ImUtf8.DrawTableColumn(ref text); if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -292,21 +293,21 @@ public class ActorPanel EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(CrestFlag.Head, _stateManager, _state!)); } - ImGui.SameLine(); + Im.Line.Same(); using (_ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(MetaIndex.VisorState, _stateManager, _state!)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(CrestFlag.Body, _stateManager, _state!)); } - ImGui.SameLine(); + Im.Line.Same(); using (_ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(MetaIndex.WeaponState, _stateManager, _state!)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromState(CrestFlag.OffHand, _stateManager, _state!)); } - ImGui.SameLine(); + Im.Line.Same(); using (_ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromState(MetaIndex.EarState, _stateManager, _state!)); @@ -340,7 +341,7 @@ public class ActorPanel ImGui.TextUnformatted($"{b.Value,3}"); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.GetContentRegionAvail().X < ImGui.GetStyle().ItemSpacing.X + ImGui.CalcTextSize("XXX").X) ImGui.NewLine(); } @@ -361,7 +362,7 @@ public class ActorPanel ImGui.TextUnformatted($"{b,3}"); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.GetContentRegionAvail().X < ImGui.GetStyle().ItemSpacing.X + ImGui.CalcTextSize("XXX").X) ImGui.NewLine(); } @@ -394,7 +395,7 @@ public class ActorPanel _state!.IsLocked)) _stateManager.ResetState(_state!, StateSource.Manual, isFinal: true); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Reapply Automation", Vector2.Zero, "Reapply the current automation state for the character on top of its current state..", @@ -404,7 +405,7 @@ public class ActorPanel _stateManager.ReapplyAutomationState(_actor, forcedRedraw, false, StateSource.Manual); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Revert to Automation", Vector2.Zero, "Try to revert the character to the state it would have using automated designs.", !_config.EnableAutoDesigns || _state!.IsLocked)) @@ -413,7 +414,7 @@ public class ActorPanel _stateManager.ReapplyAutomationState(_actor, forcedRedraw, true, StateSource.Manual); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Reapply", Vector2.Zero, "Try to reapply the configured state if something went wrong. Should generally not be necessary.", _state!.IsLocked)) diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs b/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs index 7d132a1..4cd007c 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs @@ -1,5 +1,6 @@ using Dalamud.Interface; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Classes; using OtterGui.Raii; @@ -124,7 +125,7 @@ public class ActorSelector(ActorObjectManager objects, ActorManager actors, Ephe if (ImUtf8.IconButton(FontAwesomeIcon.UserCircle, "Select the local player character."u8, buttonWidth, !objects.Player)) _identifier = objects.Player.GetIdentifier(actors); - ImGui.SameLine(); + Im.Line.Same(); var (id, data) = objects.TargetData; var tt = data.Valid ? $"Select the current target {id} in the list." : id.IsValid ? $"The target {id} is not in the list." : "No target selected."; diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs b/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs index 9751a71..0b3ee50 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Widgets; namespace Glamourer.Gui.Tabs.ActorTab; @@ -12,7 +13,7 @@ public class ActorTab(ActorSelector selector, ActorPanel panel) : ITab public void DrawContent() { selector.Draw(200 * ImGuiHelpers.GlobalScale); - ImGui.SameLine(); + Im.Line.Same(); panel.Draw(); } } diff --git a/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs b/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs index da3b636..f0d40d1 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Widgets; namespace Glamourer.Gui.Tabs.AutomationTab; @@ -15,7 +16,7 @@ public class AutomationTab(SetSelector selector, SetPanel panel, Configuration c public void DrawContent() { selector.Draw(GetSetSelectorSize()); - ImGui.SameLine(); + Im.Line.Same(); panel.Draw(); } diff --git a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs index 02d1bd0..e4b064b 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs @@ -5,6 +5,7 @@ using Glamourer.Designs; using Glamourer.Designs.Special; using Glamourer.Events; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -260,7 +261,7 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable _autoDesignManager.ChangeData(_set!, _designIndex, list); } - ImGui.SameLine(); + Im.Line.Same(); DrawLookup(predicate, buttonSize); } } diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs index 06a35d6..1842ac5 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs @@ -7,6 +7,7 @@ using Glamourer.Interop; using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Extensions; using OtterGui.Log; @@ -16,6 +17,7 @@ using OtterGui.Widgets; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; using Action = System.Action; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Tabs.AutomationTab; @@ -81,7 +83,7 @@ public class SetPanel( } } - ImGui.SameLine(); + Im.Line.Same(); using (ImUtf8.Group()) { using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing)) @@ -381,12 +383,12 @@ public class SetPanel( $"{type.ToDefaultName()} Customization {customizeUnlocks.Unlockable[data.Value].Name} is not unlocked but should be applied."); } - ImGui.SameLine(); + Im.Line.Same(); tt = config.UnlockedItemMode ? "\nThese customizations will be skipped when applied automatically.\n\nTo change this, disable the Obtained Item Mode setting." : string.Empty; DrawWarning(sb2, config.UnlockedItemMode ? 0xA03030F0 : 0x0, size, tt, "All customizations to be applied are unlocked."); - ImGui.SameLine(); + Im.Line.Same(); return; static void DrawWarning(StringBuilder sb, uint color, Vector2 size, string suffix, string good) @@ -466,17 +468,17 @@ public class SetPanel( ImUtf8.HoverTooltip(description); } - ImGui.SameLine(); + Im.Line.Same(); Box(0); - ImGui.SameLine(); + Im.Line.Same(); Box(1); if (singleLine) - ImGui.SameLine(); + Im.Line.Same(); Box(2); - ImGui.SameLine(); + Im.Line.Same(); Box(3); - ImGui.SameLine(); + Im.Line.Same(); Box(4); } @@ -487,19 +489,19 @@ public class SetPanel( { using var id = ImUtf8.PushId("Identifiers"u8); identifierDrawer.DrawWorld(130); - ImGui.SameLine(); + Im.Line.Same(); identifierDrawer.DrawName(200 - ImGui.GetStyle().ItemSpacing.X); identifierDrawer.DrawNpcs(330); var buttonWidth = new Vector2(165 * ImGuiHelpers.GlobalScale - ImGui.GetStyle().ItemSpacing.X / 2, 0); if (ImUtf8.ButtonEx("Set to Character"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetPlayer)) manager.ChangeIdentifier(setIndex, identifierDrawer.PlayerIdentifier); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Set to NPC"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetNpc)) manager.ChangeIdentifier(setIndex, identifierDrawer.NpcIdentifier); if (ImUtf8.ButtonEx("Set to Retainer"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer)) manager.ChangeIdentifier(setIndex, identifierDrawer.RetainerIdentifier); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Set to Mannequin"u8, string.Empty, buttonWidth, !identifierDrawer.CanSetRetainer)) manager.ChangeIdentifier(setIndex, identifierDrawer.MannequinIdentifier); diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs b/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs index 8a235ae..bf0b5a4 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs @@ -3,6 +3,7 @@ using Dalamud.Interface.Utility; using Glamourer.Automation; using Glamourer.Events; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Classes; using OtterGui.Extensions; @@ -141,7 +142,7 @@ public class SetSelector : IDisposable ImGui.SetNextItemWidth(_width - ImGui.GetFrameHeight()); if (LowerString.InputWithHint("##filter", "Filter...", ref _filter, 64)) _dirty = true; - ImGui.SameLine(); + Im.Line.Same(); var f = _enabledFilter; if (ImGui.CheckboxFlags("##enabledFilter", ref f, 3u)) @@ -214,11 +215,11 @@ public class SetSelector : IDisposable .Push(ImGuiStyleVar.FrameRounding, 0); var buttonWidth = new Vector2(_width / 4, 0); NewSetButton(buttonWidth); - ImGui.SameLine(); + Im.Line.Same(); DuplicateSetButton(buttonWidth); - ImGui.SameLine(); + Im.Line.Same(); HelpButton(buttonWidth); - ImGui.SameLine(); + Im.Line.Same(); DeleteSetButton(buttonWidth); } diff --git a/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs b/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs index 02ca42d..1841f03 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ActiveStatePanel.cs @@ -28,7 +28,7 @@ public sealed class ActiveStatePanel(StateManager stateManager, ActorObjectManag string.Empty, !stateManager.ContainsKey(identifier), true)) stateManager.DeleteState(identifier); - ImGui.SameLine(); + Im.Line.Same(); using var t = ImRaii.TreeNode(actors.Label); if (!t) continue; diff --git a/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs b/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs index 60b06ab..f1105ce 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DesignTesterPanel.cs @@ -2,6 +2,7 @@ using Glamourer.Designs; using Glamourer.Services; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Extensions; using OtterGui.Raii; @@ -87,7 +88,7 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans) { using var color = ImRaii.PushColor(ImGuiCol.Text, 0xFF4040D0, c1 != c2); ImGui.TextUnformatted(c1.ToString()); - ImGui.SameLine(); + Im.Line.Same(); } } @@ -103,7 +104,7 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans) ImGui.TextUnformatted(b2.ToString("X2")); } - ImGui.SameLine(); + Im.Line.Same(); } ImGui.NewLine(); @@ -123,7 +124,7 @@ public sealed class DesignTesterPanel(ItemManager items, HumanModelList humans) ImGui.TextUnformatted(b.ToString("X2")); } - ImGui.SameLine(); + Im.Line.Same(); } ImGui.NewLine(); diff --git a/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs b/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs index 9fcf33c..fed5b75 100644 --- a/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/GlamourPlatePanel.cs @@ -6,6 +6,7 @@ using Glamourer.Designs; using Glamourer.Services; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Extensions; using OtterGui.Text; using Penumbra.GameData; @@ -51,13 +52,13 @@ public sealed unsafe class GlamourPlatePanel : IGameDataDrawer ImUtf8.Text("Is Applying Glamour Plates:"u8); } - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.Group()) { ImUtf8.CopyOnClickSelectable($"0x{(ulong)manager:X}"); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlates.Length.ToString()); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesRequested.ToString()); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.SmallButton("Request Update"u8)) RequestGlamour(); ImUtf8.Text(manager == null ? "-" : manager->GlamourPlatesLoaded.ToString()); @@ -90,7 +91,7 @@ public sealed unsafe class GlamourPlatePanel : IGameDataDrawer ImUtf8.Text(slot.ToName()); } - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.Group()) { foreach (var (_, index) in EquipSlotExtensions.FullSlots.WithIndex()) diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterHelpers.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterHelpers.cs index 61dad53..d4d9035 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterHelpers.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterHelpers.cs @@ -1,5 +1,6 @@ using Glamourer.Api.Enums; using Dalamud.Bindings.ImGui; +using ImSharp; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; @@ -11,17 +12,17 @@ public static class IpcTesterHelpers if (ImGui.Checkbox("Apply Once", ref value)) flags = value ? flags | ApplyFlag.Once : flags & ~ApplyFlag.Once; - ImGui.SameLine(); + Im.Line.Same(); value = (flags & ApplyFlag.Equipment) != 0; if (ImGui.Checkbox("Apply Equipment", ref value)) flags = value ? flags | ApplyFlag.Equipment : flags & ~ApplyFlag.Equipment; - ImGui.SameLine(); + Im.Line.Same(); value = (flags & ApplyFlag.Customization) != 0; if (ImGui.Checkbox("Apply Customization", ref value)) flags = value ? flags | ApplyFlag.Customization : flags & ~ApplyFlag.Customization; - ImGui.SameLine(); + Im.Line.Same(); value = (flags & ApplyFlag.Lock) != 0; if (ImGui.Checkbox("Lock Actor", ref value)) flags = value ? flags | ApplyFlag.Lock : flags & ~ApplyFlag.Lock; diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs index 9210c38..e63d06a 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/IpcTesterPanel.cs @@ -2,6 +2,7 @@ using Dalamud.Plugin.Services; using Glamourer.Api.IpcSubscribers; using Dalamud.Bindings.ImGui; +using ImSharp; using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab.IpcTester; @@ -30,12 +31,12 @@ public sealed class IpcTesterPanel( Subscribe(); ImGui.TextUnformatted(ApiVersion.Label); var (major, minor) = new ApiVersion(pluginInterface).Invoke(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted($"({major}.{minor:D4})"); ImGui.TextUnformatted(AutoReloadGearEnabled.Label); var autoRedraw = new AutoReloadGearEnabled(pluginInterface).Invoke(); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted(autoRedraw ? "Enabled" : "Disabled"); designs.Draw(); diff --git a/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs b/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs index 519bfdf..4e640f6 100644 --- a/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs +++ b/Glamourer/Gui/Tabs/DebugTab/IpcTester/StateIpcTester.cs @@ -6,6 +6,7 @@ using Glamourer.Api.Enums; using Glamourer.Api.Helpers; using Glamourer.Api.IpcSubscribers; using Glamourer.Designs; +using ImSharp; using Luna; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -136,14 +137,14 @@ public class StateIpcTester : IUiService, IDisposable IpcTesterHelpers.DrawIntro(ApplyState.Label); if (ImGuiUtil.DrawDisabledButton("Apply Last##Idx", Vector2.Zero, string.Empty, _state == null)) _lastError = new ApplyState(_pluginInterface).Invoke(_state!, _gameObjectIndex, _key, _flags); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Apply Base64##Idx"u8)) _lastError = new ApplyState(_pluginInterface).Invoke(_base64State, _gameObjectIndex, _key, _flags); IpcTesterHelpers.DrawIntro(ApplyStateName.Label); if (ImGuiUtil.DrawDisabledButton("Apply Last##Name", Vector2.Zero, string.Empty, _state == null)) _lastError = new ApplyStateName(_pluginInterface).Invoke(_state!, _gameObjectName, _key, _flags); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Apply Base64##Name"u8)) _lastError = new ApplyStateName(_pluginInterface).Invoke(_base64State, _gameObjectName, _key, _flags); @@ -174,7 +175,7 @@ public class StateIpcTester : IUiService, IDisposable IpcTesterHelpers.DrawIntro(UnlockAll.Label); if (ImUtf8.Button("Unlock##All"u8)) _numUnlocked = new UnlockAll(_pluginInterface).Invoke(_key); - ImGui.SameLine(); + Im.Line.Same(); ImGui.TextUnformatted($"Unlocked {_numUnlocked}"); IpcTesterHelpers.DrawIntro(RevertToAutomation.Label); @@ -200,7 +201,7 @@ public class StateIpcTester : IUiService, IDisposable ImUtf8.SetClipboardText(_stateString); if (_stateString[0] is '{') { - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Copy as Base64"u8) && _state != null) ImUtf8.SetClipboardText(DesignConverter.ToBase64(_state)); } @@ -217,13 +218,13 @@ public class StateIpcTester : IUiService, IDisposable ImUtf8.Text(_lastStateChangeName.Span); ImGui.SameLine(0, 0); ImUtf8.Text($" ({_lastStateChangeType})"); - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.PushFont(UiBuilder.MonoFont)) { ImUtf8.CopyOnClickSelectable($"0x{_lastStateChangeActor:X}"); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text($"at {_lastStateChangeTime.ToLocalTime().TimeOfDay}"); } @@ -232,13 +233,13 @@ public class StateIpcTester : IUiService, IDisposable ImUtf8.Text(_lastStateFinalizeName.Span); ImGui.SameLine(0, 0); ImUtf8.Text($" ({_lastStateFinalizeType})"); - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.PushFont(UiBuilder.MonoFont)) { ImUtf8.CopyOnClickSelectable($"0x{_lastStateFinalizeActor:X}"); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text($"at {_lastStateFinalizeTime.ToLocalTime().TimeOfDay}"); } diff --git a/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs b/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs index 2a8d585..3387bf3 100644 --- a/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/ModelEvaluationPanel.cs @@ -3,6 +3,7 @@ using Glamourer.GameData; using Glamourer.Interop; using Glamourer.Interop.Structs; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Text; @@ -129,10 +130,10 @@ public sealed unsafe class ModelEvaluationPanel( if (ImGui.SmallButton("Set True")) visorService.SetVisorState(model, true); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Set False")) visorService.SetVisorState(model, false); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Toggle")) visorService.SetVisorState(model, !VisorService.GetVisorState(model)); } @@ -149,10 +150,10 @@ public sealed unsafe class ModelEvaluationPanel( if (ImGui.SmallButton("Set True")) vieraEarService.SetVieraEarState(model, true); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Set False")) vieraEarService.SetVieraEarState(model, false); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Toggle")) vieraEarService.SetVieraEarState(model, !model.VieraEarsVisible); } @@ -173,10 +174,10 @@ public sealed unsafe class ModelEvaluationPanel( if (ImGui.SmallButton("Hide")) updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, CharacterArmor.Empty); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Show")) updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, actor.GetArmor(EquipSlot.Head)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Toggle")) updateSlotService.UpdateEquipSlot(model, EquipSlot.Head, model.AsHuman->Head.Value == 0 ? actor.GetArmor(EquipSlot.Head) : CharacterArmor.Empty); @@ -226,10 +227,10 @@ public sealed unsafe class ModelEvaluationPanel( if (ImGui.SmallButton("GPose On")) actor.IsGPoseWet = true; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("GPose Off")) actor.IsGPoseWet = false; - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("GPose Toggle")) actor.IsGPoseWet = !actor.IsGPoseWet; } @@ -250,10 +251,10 @@ public sealed unsafe class ModelEvaluationPanel( if (ImGui.SmallButton("Change Piece")) updateSlotService.UpdateArmor(model, slot, new CharacterArmor((PrimaryId)(slot == EquipSlot.Hands ? 6064 : slot == EquipSlot.Head ? 6072 : 1), 1, StainIds.None)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Change Stain")) updateSlotService.UpdateStain(model, slot, new StainIds(5, 7)); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Reset")) updateSlotService.UpdateEquipSlot(model, slot, actor.GetArmor(slot)); } @@ -314,7 +315,7 @@ public sealed unsafe class ModelEvaluationPanel( changeCustomizeService.UpdateCustomize(model, modelCustomize); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("--")) { var value = modelCustomize[type].Value; @@ -325,7 +326,7 @@ public sealed unsafe class ModelEvaluationPanel( changeCustomizeService.UpdateCustomize(model, modelCustomize); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Reset")) { modelCustomize.Set(type, actorCustomize[type]); diff --git a/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs b/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs index 030b7f4..5561760 100644 --- a/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/PenumbraPanel.cs @@ -1,6 +1,7 @@ using Dalamud.Interface.Utility; using Glamourer.Interop.Penumbra; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using Penumbra.Api.Enums; @@ -33,7 +34,7 @@ public sealed class PenumbraPanel(PenumbraService penumbra, PenumbraChangedItemT ImGui.TableNextColumn(); if (ImGui.SmallButton("Unattach")) penumbra.Unattach(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGui.SmallButton("Reattach")) penumbra.Reattach(); diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs b/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs index e704809..139cf96 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs @@ -135,7 +135,7 @@ public class DesignDetailTab if (ImUtf8.RadioButton("Display##qdb"u8, _selector.Selected.QuickDesign)) _manager.SetQuickDesign(_selector.Selected!, true); var hovered = ImGui.IsItemHovered(); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.RadioButton("Hide##qdb"u8, !_selector.Selected.QuickDesign)) _manager.SetQuickDesign(_selector.Selected!, false); if (hovered || ImGui.IsItemHovered()) @@ -184,13 +184,13 @@ public class DesignDetailTab if (_colors.TryGetValue(_selector.Selected!.Color, out var currentColor)) { - ImGui.SameLine(); + Im.Line.Same(); if (DesignColorUi.DrawColorButton($"Color associated with {_selector.Selected!.Color}", currentColor, out var newColor)) _colors.SetColor(_selector.Selected!.Color, newColor); } else if (_selector.Selected!.Color.Length != 0) { - ImGui.SameLine(); + Im.Line.Same(); ImEx.Icon.Draw(LunaStyle.WarningIcon, _colors.MissingColor); Im.Tooltip.OnHover("The color associated with this design does not exist."u8); } diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs b/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs index 504435f..2d1773f 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignLinkDrawer.cs @@ -26,7 +26,7 @@ public class DesignLinkDrawer( public void Draw() { using var h = DesignPanelFlag.DesignLinks.Header(config); - if (h.Disposed) + if (!h.Alive) return; ImGuiUtil.HoverTooltip( @@ -185,7 +185,7 @@ public class DesignLinkDrawer( linkManager.MoveDesignLink(selector.Selected!, selector.Selected!.Links.Before.Count - 1, LinkOrder.Before, 0, LinkOrder.Before); } - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.ArrowCircleDown.ToIconString(), buttonSize, ttAfter, !canAddAfter, true)) linkManager.AddDesignLink(selector.Selected!, design!, LinkOrder.After); } @@ -227,16 +227,16 @@ public class DesignLinkDrawer( ImGuiUtil.HoverTooltip("Toggle all application modes at once."); - ImGui.SameLine(); + Im.Line.Same(); Box(0); - ImGui.SameLine(); + Im.Line.Same(); Box(1); - ImGui.SameLine(); + Im.Line.Same(); Box(2); - ImGui.SameLine(); + Im.Line.Same(); Box(3); - ImGui.SameLine(); + Im.Line.Same(); Box(4); if (newType != current) linkManager.ChangeApplicationType(selector.Selected!, idx, order, newType); diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs index 5cfaa9d..1e2266d 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignPanel.cs @@ -13,6 +13,7 @@ using Glamourer.Gui.Materials; using Glamourer.Interop; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; @@ -141,21 +142,21 @@ public class DesignPanel EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(CrestFlag.Head, _manager, _selector.Selected!)); } - ImGui.SameLine(); + Im.Line.Same(); using (var _ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(MetaIndex.VisorState, _manager, _selector.Selected!)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(CrestFlag.Body, _manager, _selector.Selected!)); } - ImGui.SameLine(); + Im.Line.Same(); using (var _ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(MetaIndex.WeaponState, _manager, _selector.Selected!)); EquipmentDrawer.DrawMetaToggle(ToggleDrawData.CrestFromDesign(CrestFlag.OffHand, _manager, _selector.Selected!)); } - ImGui.SameLine(); + Im.Line.Same(); using (var _ = ImRaii.Group()) { EquipmentDrawer.DrawMetaToggle(ToggleDrawData.FromDesign(MetaIndex.EarState, _manager, _selector.Selected!)); @@ -338,7 +339,7 @@ public class DesignPanel if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Enable Everything"u8, "Enable application of everything, including any existing advanced dyes, advanced customizations, crests and wetness."u8, size, !enabled)) @@ -361,7 +362,7 @@ public class DesignPanel if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Customization Only"u8, "Enable application of anything related to customization, disable anything that is not related to customization."u8, size, !enabled)) @@ -385,7 +386,7 @@ public class DesignPanel if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Disable Advanced"u8, "Disable all advanced dyes and customizations but keep everything else as is."u8, size, !enabled)) @@ -530,11 +531,11 @@ public class DesignPanel private void DrawButtonRow() { DrawApplyToSelf(); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyToTarget(); - ImGui.SameLine(); + Im.Line.Same(); _modAssociations.DrawApplyButton(); - ImGui.SameLine(); + Im.Line.Same(); DrawSaveToDat(); } diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs b/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs index 9b787c8..72aaf43 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs @@ -2,6 +2,7 @@ using Glamourer.Designs; using Glamourer.Interop; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; namespace Glamourer.Gui.Tabs.DesignTab; @@ -21,7 +22,7 @@ public class DesignTab(DesignFileSystemSelector selector, DesignPanel panel, Imp Glamourer.Messager.NotificationMessage($"Imported Anamnesis .chara file {name} as new design {newDesign.Name}", NotificationType.Success, false); } - ImGui.SameLine(); + Im.Line.Same(); panel.Draw(); importService.CreateCharaSource(); } diff --git a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs index 91f2925..11a9af8 100644 --- a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs @@ -6,6 +6,7 @@ using Glamourer.Designs; using Glamourer.Interop.Penumbra; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Classes; @@ -24,7 +25,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect public void Draw() { using var h = DesignPanelFlag.ModAssociations.Header(config); - if (h.Disposed) + if (!h.Alive) return; ImGuiUtil.HoverTooltip( @@ -46,7 +47,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect if (ImGui.Button("Copy All to Clipboard", size)) _copy = selector.Selected!.AssociatedMods.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Add from Clipboard", size, _copy != null @@ -55,7 +56,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect foreach (var (mod, setting) in _copy!) manager.UpdateMod(selector.Selected!, mod, setting); - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Set from Clipboard", size, _copy != null diff --git a/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs index a68c191..995e31b 100644 --- a/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs @@ -3,6 +3,7 @@ using Dalamud.Interface.Utility; using Glamourer.Designs; using Glamourer.Interop.Material; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Extensions; using OtterGui.Raii; using OtterGui.Text; @@ -159,7 +160,7 @@ public class MultiDesignPanel( private float DrawMultiTagger(Vector2 width) { ImUtf8.TextFrameAligned("Multi Tagger:"u8); - ImGui.SameLine(); + Im.Line.Same(); var offset = ImGui.GetItemRectSize().X + ImGui.GetStyle().WindowPadding.X; ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 2 * (width.X + ImGui.GetStyle().ItemSpacing.X)); ImUtf8.InputText("##tag"u8, ref _tag, "Tag Name..."u8); @@ -173,7 +174,7 @@ public class MultiDesignPanel( ? "No tag specified." : $"All designs selected already contain the tag \"{_tag}\"." : $"Add the tag \"{_tag}\" to {_addDesigns.Count} designs as a local tag:\n\n\t{string.Join("\n\t", _addDesigns.Select(m => m.Name.Text))}"; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx(label, tooltip, width, _addDesigns.Count == 0)) foreach (var design in _addDesigns) editor.AddTag(design, _tag); @@ -186,7 +187,7 @@ public class MultiDesignPanel( ? "No tag specified." : $"No selected design contains the tag \"{_tag}\" locally." : $"Remove the local tag \"{_tag}\" from {_removeDesigns.Count} designs:\n\n\t{string.Join("\n\t", _removeDesigns.Select(m => m.Item1.Name.Text))}"; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx(label, tooltip, width, _removeDesigns.Count == 0)) foreach (var (design, index) in _removeDesigns) editor.RemoveTag(design, index); @@ -209,7 +210,7 @@ public class MultiDesignPanel( editor.SetQuickDesign(design.Value, true); } - ImGui.SameLine(); + Im.Line.Same(); tt = _numQuickDesignEnabled == 0 ? $"All {_numDesigns} selected designs are already hidden in the quick design bar." : $"Hide all {_numDesigns} selected designs in the quick design bar. Changes {_numQuickDesignEnabled} designs."; @@ -235,7 +236,7 @@ public class MultiDesignPanel( foreach (var design in selector.SelectedPaths.OfType()) editor.SetWriteProtection(design.Value, true); - ImGui.SameLine(); + Im.Line.Same(); tt = _numDesignsLocked == 0 ? $"None of the {_numDesigns} selected designs are write-protected." : $"Remove the write protection of the {_numDesigns} selected designs. Changes {_numDesignsLocked} designs."; @@ -258,7 +259,7 @@ public class MultiDesignPanel( foreach (var design in selector.SelectedPaths.OfType()) editor.ChangeResetTemporarySettings(design.Value, true); - ImGui.SameLine(); + Im.Line.Same(); tt = _numDesignsResetSettings == 0 ? $"None of the {_numDesigns} selected designs reset temporary settings." : $"Stop all {_numDesigns} selected designs from resetting temporary settings. Changes {_numDesignsResetSettings} designs."; @@ -281,7 +282,7 @@ public class MultiDesignPanel( foreach (var design in selector.SelectedPaths.OfType()) editor.ChangeResetAdvancedDyes(design.Value, true); - ImGui.SameLine(); + Im.Line.Same(); tt = _numDesignsLocked == 0 ? $"None of the {_numDesigns} selected designs reset advanced dyes." : $"Stop all {_numDesigns} selected designs from resetting advanced dyes. Changes {_numDesignsResetDyes} designs."; @@ -304,7 +305,7 @@ public class MultiDesignPanel( foreach (var design in selector.SelectedPaths.OfType()) editor.ChangeForcedRedraw(design.Value, true); - ImGui.SameLine(); + Im.Line.Same(); tt = _numDesignsLocked == 0 ? $"None of the {_numDesigns} selected designs force redraws." : $"Stop all {_numDesigns} selected designs from forcing redraws. Changes {_numDesignsForcedRedraw} designs."; @@ -333,7 +334,7 @@ public class MultiDesignPanel( _ => $"All designs selected are already set to the color \"{_colorCombo.CurrentSelection}\".", } : $"Set the color of {_addDesigns.Count} designs to \"{_colorCombo.CurrentSelection}\"\n\n\t{string.Join("\n\t", _addDesigns.Select(m => m.Name.Text))}"; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx(label, tooltip, width, _addDesigns.Count == 0)) { foreach (var design in _addDesigns) @@ -346,7 +347,7 @@ public class MultiDesignPanel( tooltip = _removeDesigns.Count == 0 ? "No selected design is set to a non-automatic color." : $"Set {_removeDesigns.Count} designs to use automatic color again:\n\n\t{string.Join("\n\t", _removeDesigns.Select(m => m.Item1.Name.Text))}"; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx(label, tooltip, width, _removeDesigns.Count == 0)) { foreach (var (design, _) in _removeDesigns) @@ -399,7 +400,7 @@ public class MultiDesignPanel( if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Enable Everything"u8, _numDesigns > 0 ? $"Enable application of everything, including any existing advanced dyes, advanced customizations, crests and wetness for all {_numDesigns} designs." @@ -424,7 +425,7 @@ public class MultiDesignPanel( if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Customization Only"u8, _numDesigns > 0 ? $"Enable application of anything related to customization, disable anything that is not related to customization for all {_numDesigns} designs." @@ -450,7 +451,7 @@ public class MultiDesignPanel( if (!enabled) ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {config.DeleteDesignModifier} while clicking."); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Disable Advanced"u8, _numDesigns > 0 ? $"Disable all advanced dyes and customizations but keep everything else as is for all {_numDesigns} designs." : "No designs selected.", width, !enabled)) diff --git a/Glamourer/Gui/Tabs/HeaderDrawer.cs b/Glamourer/Gui/Tabs/HeaderDrawer.cs index cb169ba..a456b1b 100644 --- a/Glamourer/Gui/Tabs/HeaderDrawer.cs +++ b/Glamourer/Gui/Tabs/HeaderDrawer.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; @@ -88,7 +89,7 @@ public static class HeaderDrawer foreach (var button in leftButtons.Where(b => b.Visible)) { button.Draw(width); - ImGui.SameLine(); + Im.Line.Same(); leftButtonSize += width; } @@ -106,7 +107,7 @@ public static class HeaderDrawer foreach (var button in rightButtons.Where(b => b.Visible)) { - ImGui.SameLine(); + Im.Line.Same(); button.Draw(width); } } diff --git a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs index 7d8ce6c..0aa3826 100644 --- a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs +++ b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs @@ -138,7 +138,7 @@ public class NpcPanel private void DrawButtonRow() { DrawApplyToSelf(); - ImGui.SameLine(); + Im.Line.Same(); DrawApplyToTarget(); } @@ -277,13 +277,13 @@ public class NpcPanel if (_colors.TryGetValue(color, out var currentColor)) { - ImGui.SameLine(); + Im.Line.Same(); if (DesignColorUi.DrawColorButton($"Color associated with {color}", currentColor, out var newColor)) _colors.SetColor(color, newColor); } else if (color.Length is not 0) { - ImGui.SameLine(); + Im.Line.Same(); var size = new Vector2(ImGui.GetFrameHeight()); using var font = ImRaii.PushFont(UiBuilder.IconFont); ImEx.TextFramed(LunaStyle.WarningIcon.Span, size, _colors.MissingColor); diff --git a/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs b/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs index 318e017..867b4ec 100644 --- a/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs +++ b/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs @@ -1,5 +1,6 @@ using Dalamud.Interface.Utility; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Widgets; namespace Glamourer.Gui.Tabs.NpcTab; @@ -12,7 +13,7 @@ public class NpcTab(NpcSelector _selector, NpcPanel _panel) : ITab public void DrawContent() { _selector.Draw(200 * ImGuiHelpers.GlobalScale); - ImGui.SameLine(); + Im.Line.Same(); _panel.Draw(); } } diff --git a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs index 6c23da5..aa11715 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs @@ -2,6 +2,7 @@ using Glamourer.Services; using Glamourer.State; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui.Filesystem; using OtterGui.Raii; @@ -49,7 +50,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule _currentCode = string.Empty; } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Icon(FontAwesomeIcon.ExclamationCircle, ImGui.GetColorU32(ImGuiCol.TextDisabled)); DrawTooltip(); } @@ -62,7 +63,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule ImUtf8.HoverTooltip( "Copy your characters actual current appearance including cheat codes or holiday events to the clipboard as a design."u8); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Who is that!?!"u8, buttonSize)) funModule.WhoIsThat(); @@ -102,7 +103,7 @@ public class CodeDrawer(Configuration config, CodeService codeService, FunModule } var hovered = ImGui.IsItemHovered(); - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Selectable(code, false); hovered |= ImGui.IsItemHovered(); DrawSource(i, code); diff --git a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs index 25dab34..ef0e9b2 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs @@ -1,11 +1,13 @@ using Dalamud.Interface; using Glamourer.Interop.Penumbra; using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using OtterGui; using OtterGui.Raii; using OtterGui.Widgets; using Logger = OtterGui.Log.Logger; +using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Tabs.SettingsTab; @@ -24,7 +26,7 @@ public sealed class CollectionCombo(Configuration config, PenumbraService penumb } var ret = ImGui.Selectable(name, selected); - ImGui.SameLine(); + Im.Line.Same(); using (ImRaii.PushFont(UiBuilder.MonoFont)) { using var color = ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled)); diff --git a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs index e35aa3d..27f25c4 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs @@ -126,7 +126,7 @@ public class SettingsTab( "Add the actor's glamourer state when a PCP is created by Penumbra, and create a design and apply it if possible when a PCP is installed by Penumbra."u8, config.AttachToPcp, pcpService.Set); var active = config.DeleteDesignModifier.IsActive(); - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.ButtonEx("Delete all PCP Designs"u8, "Deletes all designs tagged with 'PCP' from the design list."u8, disabled: !active)) pcpService.CleanPcpDesigns(); if (!active) @@ -371,7 +371,7 @@ public class SettingsTab( if (!config.ShowPalettePlusImport) return; - ImGui.SameLine(); + Im.Line.Same(); if (ImUtf8.Button("Import Palette+ to Designs"u8)) paletteImport.ImportDesigns(); ImUtf8.HoverTooltip( @@ -416,7 +416,7 @@ public class SettingsTab( config.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker(label, tooltip); } @@ -431,7 +431,7 @@ public class SettingsTab( config.Ephemeral.Save(); } - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.LabeledHelpMarker(label, tooltip); } @@ -479,11 +479,11 @@ public class SettingsTab( } } - ImGui.SameLine(); + Im.Line.Same(); const string tt = "Select which of the two renaming input fields are visible when opening the right-click context menu of a design in the design selector."; ImGuiComponents.HelpMarker(tt); - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("Rename Fields in Design Context Menu"u8); ImUtf8.HoverTooltip(tt); } @@ -504,10 +504,10 @@ public class SettingsTab( } } - ImGui.SameLine(); + Im.Line.Same(); const string tt = "Select how to display the height of characters in real-world units, if at all."; ImGuiComponents.HelpMarker(tt); - ImGui.SameLine(); + Im.Line.Same(); ImUtf8.Text("Character Height Display Type"u8); ImUtf8.HoverTooltip(tt); } diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlockOverview.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlockOverview.cs index 8644aeb..a7f322a 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlockOverview.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlockOverview.cs @@ -6,6 +6,7 @@ using Glamourer.Interop.Penumbra; using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Raii; using OtterGui.Text; using Penumbra.GameData.Enums; @@ -84,7 +85,7 @@ public class UnlockOverview( { using var color = ImRaii.PushColor(ImGuiCol.Border, ImGui.GetColorU32(ImGuiCol.TableBorderStrong)); DrawSelector(); - ImGui.SameLine(); + Im.Line.Same(); DrawPanel(); } @@ -143,7 +144,7 @@ public class UnlockOverview( if (counter != iconsPerRow - 1) { - ImGui.SameLine(); + Im.Line.Same(); ++counter; } else @@ -172,7 +173,7 @@ public class UnlockOverview( DrawItem(item); if (counter != iconsPerRow - 1) { - ImGui.SameLine(); + Im.Line.Same(); ++counter; } else @@ -243,7 +244,7 @@ public class UnlockOverview( DrawItem(value[idx]); if (counter != iconsPerRow - 1) { - ImGui.SameLine(); + Im.Line.Same(); ++counter; } else diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs index ea3f2e0..9b798d4 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlockTable.cs @@ -7,6 +7,7 @@ using Glamourer.Interop.Penumbra; using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui; using OtterGui.Raii; using OtterGui.Table; @@ -192,7 +193,7 @@ public class UnlockTable : Table, IDisposable ImGuiUtil.HoverIcon(iconHandle, new Vector2(ImGui.GetFrameHeight())); else ImGui.Dummy(new Vector2(ImGui.GetFrameHeight())); - ImGui.SameLine(); + Im.Line.Same(); ImGui.AlignTextToFramePadding(); if (ImGui.Selectable(item.Name) && item.Id is { IsBonusItem: false, IsCustom: false }) Glamourer.Messager.Chat.Print(new SeStringBuilder().AddItemLink(item.ItemId.Id, false).BuiltString); diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs index 661b2a4..5c676c3 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs @@ -1,6 +1,7 @@ using Dalamud.Interface; using Dalamud.Interface.Windowing; using Dalamud.Bindings.ImGui; +using ImSharp; using OtterGui.Raii; using OtterGui; using OtterGui.Widgets; @@ -70,14 +71,14 @@ public class UnlocksTab : Window, ITab if (ImGuiUtil.DrawDisabledButton("Overview Mode", buttonSize, "Show tinted icons of sets of unlocks.", !DetailMode)) DetailMode = false; - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton("Detailed Mode", buttonSize, "Show all unlockable data as a combined filterable and sortable table.", DetailMode)) DetailMode = true; if (DetailMode) { - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Expand.ToIconString(), new Vector2(ImGui.GetFrameHeight()), "Restore all columns to their original size.", false, true)) _table.Flags &= ~ImGuiTableFlags.Resizable; @@ -85,7 +86,7 @@ public class UnlocksTab : Window, ITab if (!IsOpen) { - ImGui.SameLine(); + Im.Line.Same(); if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.SquareArrowUpRight.ToIconString(), new Vector2(ImGui.GetFrameHeight()), "Pop the unlocks tab out into its own window.", false, true)) IsOpen = true; diff --git a/Glamourer/Gui/ToggleDrawData.cs b/Glamourer/Gui/ToggleDrawData.cs index 28afc2c..4245edc 100644 --- a/Glamourer/Gui/ToggleDrawData.cs +++ b/Glamourer/Gui/ToggleDrawData.cs @@ -1,6 +1,7 @@ using Glamourer.Api.Enums; using Glamourer.Designs; using Glamourer.State; +using ImSharp; using Penumbra.GameData.Enums; namespace Glamourer.Gui; @@ -17,8 +18,8 @@ public struct ToggleDrawData public bool CurrentValue; public bool CurrentApply; - public string Label = string.Empty; - public string Tooltip = string.Empty; + public StringU8 Label = StringU8.Empty; + public StringU8 Tooltip = StringU8.Empty; public ToggleDrawData() @@ -58,8 +59,8 @@ public struct ToggleDrawData _index = index, _editor = manager, _data = design, - Label = index.ToName(), - Tooltip = string.Empty, + Label = index.ToNameU8(), + Tooltip = StringU8.Empty, Locked = design.WriteProtected(), DisplayApplication = true, CurrentValue = design.DesignData.GetMeta(index), @@ -72,8 +73,8 @@ public struct ToggleDrawData _index = index, _editor = manager, _data = state, - Label = index.ToName(), - Tooltip = index.ToTooltip(), + Label = index.ToNameU8(), + Tooltip = index.Tooltip(), Locked = state.IsLocked, CurrentValue = state.ModelData.GetMeta(index), }; @@ -84,22 +85,24 @@ public struct ToggleDrawData _index = slot, _editor = manager, _data = design, - Label = $"{slot.ToLabel()} Crest", - Tooltip = string.Empty, + Label = slot.Tooltip(), + Tooltip = StringU8.Empty, Locked = design.WriteProtected(), DisplayApplication = true, CurrentValue = design.DesignData.Crest(slot), CurrentApply = design.DoApplyCrest(slot), }; + private static readonly StringU8 CrestTooltip = new("Hide or show your free company crest on this piece of gear."u8); + public static ToggleDrawData CrestFromState(CrestFlag slot, StateManager manager, ActorState state) => new() { _index = slot, _editor = manager, _data = state, - Label = $"{slot.ToLabel()} Crest", - Tooltip = "Hide or show your free company crest on this piece of gear.", + Label = slot.Tooltip(), + Tooltip = CrestTooltip, Locked = state.IsLocked, CurrentValue = state.ModelData.Crest(slot), }; @@ -108,8 +111,8 @@ public struct ToggleDrawData => new() { _index = index, - Label = index.ToName(), - Tooltip = index.ToTooltip(), + Label = index.ToNameU8(), + Tooltip = index.Tooltip(), Locked = true, CurrentValue = value, }; diff --git a/Glamourer/Gui/UiHelpers.cs b/Glamourer/Gui/UiHelpers.cs index 94ddb06..798e85e 100644 --- a/Glamourer/Gui/UiHelpers.cs +++ b/Glamourer/Gui/UiHelpers.cs @@ -3,6 +3,7 @@ using Dalamud.Interface.Utility; using Glamourer.Services; using Glamourer.Unlocks; using Dalamud.Bindings.ImGui; +using ImSharp; using Lumina.Misc; using OtterGui; using OtterGui.Raii; @@ -33,14 +34,14 @@ public static class UiHelpers : (ImGui.GetColorU32(ImGuiCol.FrameBgActive), new Vector4(0.3f, 0.3f, 0.3f, 1f)); var pos = ImGui.GetCursorScreenPos(); ImGui.GetWindowDrawList().AddRectFilled(pos, pos + size, bgColor, 5 * ImGuiHelpers.GlobalScale); - if (ptr != nint.Zero) - ImGui.Image(ptr, size, Vector2.Zero, Vector2.One, tint); + if (!ptr.IsNull) + Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint); else ImGui.Dummy(size); } else { - ImGuiUtil.HoverIcon(ptr, textureSize, size); + Im.Image.DrawScaled(ptr, size, textureSize); } } @@ -55,14 +56,14 @@ public static class UiHelpers : (ImGui.GetColorU32(ImGuiCol.FrameBgActive), new Vector4(0.3f, 0.3f, 0.3f, 1f)); var pos = ImGui.GetCursorScreenPos(); ImGui.GetWindowDrawList().AddRectFilled(pos, pos + size, bgColor, 5 * ImGuiHelpers.GlobalScale); - if (ptr != nint.Zero) - ImGui.Image(ptr, size, Vector2.Zero, Vector2.One, tint); + if (!ptr.IsNull) + Im.Image.Draw(ptr, size, Vector2.Zero, Vector2.One, tint); else ImGui.Dummy(size); } else { - ImGuiUtil.HoverIcon(ptr, textureSize, size); + Im.Image.DrawScaled(ptr, size, textureSize); } } diff --git a/Glamourer/Interop/ImportService.cs b/Glamourer/Interop/ImportService.cs index b9b5f97..6d4725d 100644 --- a/Glamourer/Interop/ImportService.cs +++ b/Glamourer/Interop/ImportService.cs @@ -3,7 +3,7 @@ using Dalamud.Interface.ImGuiNotification; using Glamourer.Designs; using Glamourer.Interop.CharaFile; using Glamourer.Services; -using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using Penumbra.GameData.Enums; using Penumbra.GameData.Files; @@ -16,16 +16,17 @@ public class ImportService(CustomizeService customizations, IDragDropManager dra public void CreateDatSource() => dragDropManager.CreateImGuiSource("DatDragger", m => m.Files.Count == 1 && m.Extensions.Contains(".dat"), m => { - ImGui.TextUnformatted($"Dragging {Path.GetFileName(m.Files[0])} to import customizations for Glamourer..."); + Im.Text($"Dragging {Path.GetFileName(m.Files[0])} to import customizations for Glamourer..."); return true; }); public void CreateCharaSource() - => dragDropManager.CreateImGuiSource("CharaDragger", m => m.Files.Count == 1 && m.Extensions.Contains(".chara") || m.Extensions.Contains(".cma"), m => - { - ImGui.TextUnformatted($"Dragging {Path.GetFileName(m.Files[0])} to import Anamnesis/CMTool data for Glamourer..."); - return true; - }); + => dragDropManager.CreateImGuiSource("CharaDragger", + m => m.Files.Count == 1 && m.Extensions.Contains(".chara") || m.Extensions.Contains(".cma"), m => + { + Im.Text($"Dragging {Path.GetFileName(m.Files[0])} to import Anamnesis/CMTool data for Glamourer..."); + return true; + }); public bool CreateDatTarget(out DatCharacterFile file) { @@ -46,7 +47,7 @@ public class ImportService(CustomizeService customizations, IDragDropManager dra name = string.Empty; return false; } - + return Path.GetExtension(files[0]) is ".chara" ? LoadChara(files[0], out design, out name) : LoadCma(files[0], out design, out name); } diff --git a/Glamourer/Interop/Material/LiveColorTablePreviewer.cs b/Glamourer/Interop/Material/LiveColorTablePreviewer.cs index 53a8c97..e182886 100644 --- a/Glamourer/Interop/Material/LiveColorTablePreviewer.cs +++ b/Glamourer/Interop/Material/LiveColorTablePreviewer.cs @@ -1,5 +1,5 @@ using Dalamud.Plugin.Services; -using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; using Penumbra.GameData.Files.MaterialStructs; using Penumbra.GameData.Structs; @@ -114,9 +114,7 @@ public sealed unsafe class LiveColorTablePreviewer : IService, IDisposable var frame = DateTimeOffset.UtcNow.UtcTicks; var hueByte = frame % (steps * frameLength) / frameLength; var hue = (float)hueByte / steps; - Vector3 ret; - ImGui.ColorConvertHSVtoRGB(hue, 1, 1, &ret.X, &ret.Y, &ret.Z); - return ret; + return Im.Color.ToRgb(new Vector3(hue, 1, 1)); } public void Dispose() diff --git a/Glamourer/Services/CommandService.cs b/Glamourer/Services/CommandService.cs index d48111a..e078557 100644 --- a/Glamourer/Services/CommandService.cs +++ b/Glamourer/Services/CommandService.cs @@ -9,9 +9,8 @@ using Glamourer.Gui; using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Interop.Penumbra; using Glamourer.State; -using Dalamud.Bindings.ImGui; +using ImSharp; using Luna; -using OtterGui.Extensions; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using Penumbra.GameData.Interop; @@ -103,10 +102,13 @@ public class CommandService : IDisposable, IApiService return; default: _chat.Print("Use without argument to toggle the main window."); - _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of "), "/glamourer") + _chat.Print(SeStringBuilderExtensions + .AddRed(new SeStringBuilder().AddText("Use ").AddPurple("/glamour").AddText(" instead of "), "/glamourer") .AddText(" for application commands.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "qdb", "Toggles the quick design bar on or off.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "lock", "Toggles the lock of the main window on or off.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "qdb", "Toggles the quick design bar on or off.") + .BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddCommand(new SeStringBuilder(), "lock", "Toggles the lock of the main window on or off.").BuiltString); return; } @@ -150,10 +152,13 @@ public class CommandService : IDisposable, IApiService else _chat.Print("Valid arguments for /glamour are:"); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "apply", "Applies a given design to a given character. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions + .AddCommand(new SeStringBuilder(), "apply", "Applies a given design to a given character. Use without arguments for help.") .BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapply", "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "revert", "Reverts a given character to its game state. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapply", + "Re-applies the current supposed state of a given character. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddCommand(new SeStringBuilder(), "revert", "Reverts a given character to its game state. Use without arguments for help.") .BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "reapplyautomation", "Reapplies the current automation state on top of the characters current state.. Use without arguments for help.").BuiltString); @@ -161,12 +166,19 @@ public class CommandService : IDisposable, IApiService "Reverts a given character to its supposed state using automated designs. Use without arguments for help.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "resetdesign", "Reapplies the current automation and resets the random design. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "clearsettings", "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "copy", "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "save", "Save the current state of a character to a named design. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "automation", "Change the state of automated design sets. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applyitem", "Apply a specific item to a character. Use without arguments for help.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applycustomization", "Apply a specific customization value to a character. Use without arguments for help.") + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "clearsettings", + "Clears all temporary settings applied by Glamourer. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "copy", + "Copy the current state of a character to clipboard. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "save", + "Save the current state of a character to a named design. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "automation", + "Change the state of automated design sets. Use without arguments for help.").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddCommand(new SeStringBuilder(), "applyitem", "Apply a specific item to a character. Use without arguments for help.") + .BuiltString); + _chat.Print(SeStringBuilderExtensions.AddCommand(new SeStringBuilder(), "applycustomization", + "Apply a specific customization value to a character. Use without arguments for help.") .BuiltString); return true; } @@ -176,15 +188,17 @@ public class CommandService : IDisposable, IApiService var argumentList = argument.Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (argumentList.Length < 1) { - _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour clearsettings ").AddGreen("[Character Identifier]").AddText(" | ") - .AddPurple("").AddText(" | "), "").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour clearsettings ") + .AddGreen("[Character Identifier]").AddText(" | ") + .AddPurple("").AddText(" | "), "").BuiltString); PlayerIdentifierHelp(false, true); _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder() - .AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '"), "all") + .AddText(" 》 The character identifier specifies the collection to clear settings from. It also accepts '"), "all") .AddText("' to clear all collections.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first") - .AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second") - .AddText(" determines whether "), "automatically").AddText(" applied settings are cleared.").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder() + .AddText(" 》 The booleans are optional and default to 'true', the ").AddPurple("first") + .AddText(" determines whether ").AddPurple("manually").AddText(" applied settings are cleared, the ").AddBlue("second") + .AddText(" determines whether "), "automatically").AddText(" applied settings are cleared.").BuiltString); return false; } @@ -234,24 +248,27 @@ public class CommandService : IDisposable, IApiService var argumentList = arguments.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (argumentList.Length != 2) { - _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("Use with /glamour automation ").AddBlue("enable, disable or application", true) - .AddText(" ") - .AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("").AddText(" "), "") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText("Use with /glamour automation ") + .AddBlue("enable, disable or application", true) + .AddText(" ") + .AddRed("Automated Design Set Index or Name", true).AddText(" | ").AddYellow("").AddText(" "), + "") .BuiltString); _chat.Print( " 》 If the design set name is a valid natural number it will be used as a index. Design names that are such numbers can not be dealt with."); _chat.Print(" 》 If multiple design sets have the same name, the first one will be changed."); _chat.Print(" 》 The name is case-insensitive."); _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application") - .AddText(" the ").AddYellow("design index").AddText(" and "), "flags").AddText(" are required.").BuiltString); + .AddText(" the ").AddYellow("design index").AddText(" and "), "flags").AddText(" are required.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 The "), "design index") .AddText(" is the number in front of the relevant design in the automated design set.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ") - .AddInitialPurple("Customizations, ") - .AddInitialPurple("Equipment, ") - .AddInitialPurple("Accessories, ") - .AddInitialPurple("Dyes & Crests and ") - .AddInitialPurple("Weapons, where "), "CEADW") + _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags") + .AddText(" are a combination of the letters ") + .AddInitialPurple("Customizations, ") + .AddInitialPurple("Equipment, ") + .AddInitialPurple("Accessories, ") + .AddInitialPurple("Dyes & Crests and ") + .AddInitialPurple("Weapons, where "), "CEADW") .AddText(" means everything should be toggled on, and no value means nothing should be toggled on.") .BuiltString); return false; @@ -278,8 +295,9 @@ public class CommandService : IDisposable, IApiService case "application": return HandleApplication(argumentList[1]); default: _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("The command ") - .AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ").AddBlue("disable") - .AddText(" or "), "application") + .AddBlue(argumentList[0], true).AddText(" is unknown. Currently only ").AddBlue("enable").AddText(", ") + .AddBlue("disable") + .AddText(" or "), "application") .AddText(" are supported.").BuiltString); return false; } @@ -301,7 +319,9 @@ public class CommandService : IDisposable, IApiService if (idx >= 0) return true; - _chat.Print(SeStringBuilderExtensions.AddRed(new SeStringBuilder().AddText("Could not change state of automated design set "), name, true).AddText(" No automated design set of that name or index exists.").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddRed(new SeStringBuilder().AddText("Could not change state of automated design set "), name, true) + .AddText(" No automated design set of that name or index exists.").BuiltString); return false; } @@ -362,7 +382,8 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText($"Use with /glamour {command} "), "[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddGreen(new SeStringBuilder().AddText($"Use with /glamour {command} "), "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -392,7 +413,8 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]") + .BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -414,7 +436,8 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour revert "), "[Character Identifier]") + .BuiltString); PlayerIdentifierHelp(false, true); return true; } @@ -440,8 +463,9 @@ public class CommandService : IDisposable, IApiService var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length is not 2) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applyitem ").AddYellow("[Item ID or Item Name]") - .AddText(" | "), "[Character Identifier]") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applyitem ") + .AddYellow("[Item ID or Item Name]") + .AddText(" | "), "[Character Identifier]") .BuiltString); _chat.Print(new SeStringBuilder() .AddText( @@ -457,7 +481,7 @@ public class CommandService : IDisposable, IApiService if (_items.ItemData.Primary.TryGetValue(id, out var main)) items[0] = main; } - else if (ArrayExtensions.FindFirst(_items.ItemData.Primary, pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase), + else if (_items.ItemData.Primary.FindFirst(pair => string.Equals(pair.Value.Name, split[0], StringComparison.OrdinalIgnoreCase), out var i)) { items[0] = i.Value; @@ -523,7 +547,8 @@ public class CommandService : IDisposable, IApiService || customizeInt < 0 || customizeInt >= CustomizationExtensions.AllBasic.Length) { - _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("The customization type "), customizationSplit[0], true) + _chat.Print(SeStringBuilderExtensions + .AddYellow(new SeStringBuilder().AddText("The customization type "), customizationSplit[0], true) .AddText(" could not be identified as a valid type.").BuiltString); return false; } @@ -623,20 +648,23 @@ public class CommandService : IDisposable, IApiService bool PrintCustomizationHelp() { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applycustomization ").AddYellow("[Customization Type]") - .AddPurple(" [Value, Next, Previous, Minus, or Plus] ") - .AddBlue("") - .AddText(" | "), "[Character Identifier]") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour applycustomization ") + .AddYellow("[Customization Type]") + .AddPurple(" [Value, Next, Previous, Minus, or Plus] ") + .AddBlue("") + .AddText(" | "), "[Character Identifier]") .BuiltString); _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 Valid "), "values") .AddText(" depend on the the character's gender, clan, and the customization type.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ").AddPurple("Minus") - .AddText(" are the same as pressing the + and - buttons in the UI, times the optional "), " amount").AddText(".") + _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText(" 》 ").AddPurple("Plus").AddText(" and ") + .AddPurple("Minus") + .AddText(" are the same as pressing the + and - buttons in the UI, times the optional "), " amount").AddText(".") .BuiltString); - _chat.Print(SeStringBuilderExtensions.AddPurple(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and "), "Previous") + _chat.Print(SeStringBuilderExtensions + .AddPurple(new SeStringBuilder().AddText(" 》 ").AddPurple("Next").AddText(" and "), "Previous") .AddText(" is similar to Plus and Minus, but with wrap-around on reaching the end.").BuiltString); var builder = SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText(" 》 Available ").AddYellow("Customization Types") - .AddText(" are either a number in "), $"[0, {CustomizationExtensions.AllBasic.Length}]") + .AddText(" are either a number in "), $"[0, {CustomizationExtensions.AllBasic.Length}]") .AddText(" or one of "); foreach (var index in CustomizationExtensions.AllBasic.SkipLast(1)) SeStringBuilderExtensions.AddYellow(builder, index.ToString()).AddText(", "); @@ -655,10 +683,10 @@ public class CommandService : IDisposable, IApiService if (split.Length is not 2) { _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("Use with /glamour apply ") - .AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]") - .AddText(" | ") - .AddGreen("[Character Identifier]") - .AddText("; "), "") + .AddYellow("[Design Name, Path or Identifier, Quick, Selection, Random, or Clipboard]") + .AddText(" | ") + .AddGreen("[Character Identifier]") + .AddText("; "), "") .BuiltString); _chat.Print(new SeStringBuilder() .AddText( @@ -678,13 +706,13 @@ public class CommandService : IDisposable, IApiService _chat.Print(new SeStringBuilder() .AddText(" 》 Clipboard as a single word will try to apply a design string currently in your clipboard.").BuiltString); _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder() - .AddText(" 》 "), "Random") + .AddText(" 》 "), "Random") .AddText( " supports many restrictions, see the Restriction Builder when adding a Random design to Automations for valid strings.") .BuiltString); _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder() - .AddText(" 》 ").AddBlue("").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true") - .AddText(" or "), "false").AddText(".").BuiltString); + .AddText(" 》 ").AddBlue("").AddText(" is optional and can be omitted (together with the ;), ").AddBlue("true") + .AddText(" or "), "false").AddText(".").BuiltString); _chat.Print(SeStringBuilderExtensions.AddBlue(new SeStringBuilder().AddText("If "), "true") .AddText(", it will try to apply mod associations to the collection assigned to the identified character.").BuiltString); PlayerIdentifierHelp(false, true); @@ -749,7 +777,8 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(SeStringBuilderExtensions.AddYellow(new SeStringBuilder().AddText("Use with /glamour delete "), "[Design Name, Path or Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddYellow(new SeStringBuilder().AddText("Use with /glamour delete "), "[Design Name, Path or Identifier]").BuiltString); _chat.Print(new SeStringBuilder() .AddText( " 》 The design name is case-insensitive. If multiple designs of that name up to case exist, the first one is chosen.") @@ -776,7 +805,8 @@ public class CommandService : IDisposable, IApiService { if (argument.Length == 0) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour copy "), "[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour copy "), "[Character Identifier]") + .BuiltString); PlayerIdentifierHelp(false, true); } @@ -794,7 +824,7 @@ public class CommandService : IDisposable, IApiService try { var text = _converter.ShareBase64(state, ApplicationRules.AllButParameters(state)); - ImGui.SetClipboardText(text); + Im.Clipboard.Set(text); return true; } catch @@ -815,7 +845,9 @@ public class CommandService : IDisposable, IApiService var split = arguments.Split('|', 2, StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); if (split.Length != 2) { - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | "), "[Character Identifier]").BuiltString); + _chat.Print(SeStringBuilderExtensions + .AddGreen(new SeStringBuilder().AddText("Use with /glamour save ").AddYellow("[New Design Name]").AddText(" | "), + "[Character Identifier]").BuiltString); PlayerIdentifierHelp(false, true); } @@ -889,27 +921,33 @@ public class CommandService : IDisposable, IApiService private void PlayerIdentifierHelp(bool allowAnyWorld, bool allowIndex) { - var npcGuide = SeStringBuilderExtensions.AddInitialPurple(new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ").AddPurple("[NPC Type]").AddText(" : ") - .AddRed("[NPC Name]").AddBlue(allowIndex ? "@" : string.Empty).AddText(", where NPC Type can be ") - .AddInitialPurple("Mount") - .AddInitialPurple("Companion") - .AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or "), "Battle NPC", false); + var npcGuide = SeStringBuilderExtensions.AddInitialPurple(new SeStringBuilder().AddText(" 》》》").AddGreen("n").AddText(" | ") + .AddPurple("[NPC Type]").AddText(" : ") + .AddRed("[NPC Name]").AddBlue(allowIndex ? "@" : string.Empty).AddText(", where NPC Type can be ") + .AddInitialPurple("Mount") + .AddInitialPurple("Companion") + .AddInitialPurple("Accessory").AddInitialPurple("Event NPC").AddText("or "), "Battle NPC", false); if (allowIndex) - npcGuide = SeStringBuilderExtensions.AddBlue(npcGuide.AddText(", and the "), "index").AddText(" is an optional non-negative number in the object table."); + npcGuide = SeStringBuilderExtensions.AddBlue(npcGuide.AddText(", and the "), "index") + .AddText(" is an optional non-negative number in the object table."); else npcGuide = npcGuide.AddText("."); _chat.Print(new SeStringBuilder().AddText(" 》 Valid Character Identifiers have the form:").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText(" 》》》").AddGreen("").AddText(" or ").AddGreen("").AddText(" or ").AddGreen("") - .AddText(" or "), "") + _chat.Print(SeStringBuilderExtensions.AddGreen(new SeStringBuilder().AddText(" 》》》").AddGreen("").AddText(" or ").AddGreen("") + .AddText(" or ").AddGreen("") + .AddText(" or "), "") .AddText(" as placeholders for your character, your target, your mouseover or your focus, if they exist.").BuiltString); - _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | "), "[Player Name]@[World Name]") + _chat.Print(SeStringBuilderExtensions + .AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("p").AddText(" | "), "[Player Name]@[World Name]") .AddText(allowAnyWorld ? ", if no @ is provided, Any World is used." : ".") .BuiltString); - _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | "), "[Retainer Name]").AddText(".").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》").AddGreen("r").AddText(" | "), "[Retainer Name]") + .AddText(".").BuiltString); _chat.Print(npcGuide.BuiltString); - _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ").AddPurple("[NPC Type]") - .AddText(" : ") - .AddRed("[NPC Name]").AddText(" | "), "[Player Name]@").AddText(".").BuiltString); + _chat.Print(SeStringBuilderExtensions.AddWhite(new SeStringBuilder().AddText(" 》》》 ").AddGreen("o").AddText(" | ") + .AddPurple("[NPC Type]") + .AddText(" : ") + .AddRed("[NPC Name]").AddText(" | "), "[Player Name]@").AddText(".").BuiltString); } } diff --git a/Glamourer/Services/DesignResolver.cs b/Glamourer/Services/DesignResolver.cs index f7259f3..d78454f 100644 --- a/Glamourer/Services/DesignResolver.cs +++ b/Glamourer/Services/DesignResolver.cs @@ -4,8 +4,8 @@ using Glamourer.Designs; using Glamourer.Designs.Special; using Glamourer.Gui; using Glamourer.Gui.Tabs.DesignTab; -using Dalamud.Bindings.ImGui; using Luna; +using ImSharp; namespace Glamourer.Services; @@ -91,7 +91,7 @@ public class DesignResolver( { try { - var clipboardText = ImGui.GetClipboardText(); + var clipboardText = Im.Clipboard.GetUtf16(); if (clipboardText.Length > 0) design = converter.FromBase64(clipboardText, true, true, out _); } diff --git a/Glamourer/Services/TextureService.cs b/Glamourer/Services/TextureService.cs index a0ec443..635584f 100644 --- a/Glamourer/Services/TextureService.cs +++ b/Glamourer/Services/TextureService.cs @@ -1,7 +1,8 @@ -using Dalamud.Bindings.ImGui; using Dalamud.Interface; using Dalamud.Interface.Textures.TextureWraps; using Dalamud.Plugin.Services; +using ImSharp; +using Luna; using OtterGui.Classes; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; @@ -13,21 +14,21 @@ public sealed class TextureService(IUiBuilder uiBuilder, IDataManager dataManage { private readonly IDalamudTextureWrap?[] _slotIcons = CreateSlotIcons(uiBuilder); - public (ImTextureID, Vector2, bool) GetIcon(EquipItem item, EquipSlot slot) + public (ImTextureId, Vector2, bool) GetIcon(EquipItem item, EquipSlot slot) { if (item.IconId.Id != 0 && TryLoadIcon(item.IconId.Id, out var ret)) - return (ret.Handle, new Vector2(ret.Width, ret.Height), false); + return (ret.Id, new Vector2(ret.Width, ret.Height), false); var idx = slot.ToIndex(); return idx < 12 && _slotIcons[idx] != null - ? (_slotIcons[idx]!.Handle, new Vector2(_slotIcons[idx]!.Width, _slotIcons[idx]!.Height), true) + ? (_slotIcons[idx]!.Id, new Vector2(_slotIcons[idx]!.Width, _slotIcons[idx]!.Height), true) : (default, Vector2.Zero, true); } - public (ImTextureID, Vector2, bool) GetIcon(EquipItem item, BonusItemFlag slot) + public (ImTextureId, Vector2, bool) GetIcon(EquipItem item, BonusItemFlag slot) { if (item.IconId.Id != 0 && TryLoadIcon(item.IconId.Id, out var ret)) - return (ret.Handle, new Vector2(ret.Width, ret.Height), false); + return (ret.Id, new Vector2(ret.Width, ret.Height), false); var idx = slot.ToIndex(); if (idx == uint.MaxValue) @@ -35,7 +36,7 @@ public sealed class TextureService(IUiBuilder uiBuilder, IDataManager dataManage idx += 12; return idx < 13 && _slotIcons[idx] != null - ? (_slotIcons[idx]!.Handle, new Vector2(_slotIcons[idx]!.Width, _slotIcons[idx]!.Height), true) + ? (_slotIcons[idx]!.Id, new Vector2(_slotIcons[idx]!.Width, _slotIcons[idx]!.Height), true) : (default, Vector2.Zero, true); } diff --git a/Glamourer/State/FunModule.cs b/Glamourer/State/FunModule.cs index 5592712..7f8f833 100644 --- a/Glamourer/State/FunModule.cs +++ b/Glamourer/State/FunModule.cs @@ -4,7 +4,7 @@ using Glamourer.Designs; using Glamourer.GameData; using Glamourer.Gui; using Glamourer.Services; -using Dalamud.Bindings.ImGui; +using ImSharp; using Penumbra.GameData.Enums; using Penumbra.GameData.Interop; using Penumbra.GameData.Structs; @@ -471,7 +471,7 @@ public unsafe class FunModule : IDisposable var tmp = _designManager.CreateTemporary(); tmp.SetDesignData(_customizations, _stateManager.FromActor(actor, true, true)); var data = _designConverter.ShareBase64(tmp); - ImGui.SetClipboardText(data); + Im.Clipboard.Set(data); Glamourer.Messager.NotificationMessage($"Copied current actual design of {actor.Utf8Name} to clipboard.", NotificationType.Info, false); } diff --git a/Luna b/Luna index 1887502..4f9ff17 160000 --- a/Luna +++ b/Luna @@ -1 +1 @@ -Subproject commit 1887502aa892743e9db84c9adc084d748219f1f3 +Subproject commit 4f9ff17be4a1235a3bf66d9a80932e59e97d7e99