fix some warnings

This commit is contained in:
goat 2024-12-26 14:11:14 +01:00
parent ce5ee71c91
commit 2e2feb144f
9 changed files with 40 additions and 34 deletions

View file

@ -182,7 +182,10 @@ public static partial class ImGuiComponents
/// </summary>
/// <param name="icon">Icon to show.</param>
/// <param name="text">Text to show.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param>
/// <param name="size">
/// Sets the size of the button. If either dimension is set to 0,
/// that dimension will conform to the size of the icon and text.
/// </param>
/// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector2 size) => IconButtonWithText(icon, text, null, null, null, size);
@ -194,7 +197,10 @@ public static partial class ImGuiComponents
/// <param name="defaultColor">The default color of the button.</param>
/// <param name="activeColor">The color of the button when active.</param>
/// <param name="hoveredColor">The color of the button when hovered.</param>
/// <param name="size">Sets the size of the button. If either dimension is set to 0, that dimension will conform to the size of the icon & text.</param>
/// <param name="size">
/// Sets the size of the button. If either dimension is set to 0,
/// that dimension will conform to the size of the icon and text.
/// </param>
/// <returns>Indicator if button is clicked.</returns>
public static bool IconButtonWithText(FontAwesomeIcon icon, string text, Vector4? defaultColor = null, Vector4? activeColor = null, Vector4? hoveredColor = null, Vector2? size = null)
{

View file

@ -8,6 +8,9 @@ using ImGuiNET;
namespace Dalamud.Interface.Components;
/// <summary>
/// ImGui component used to create a radio-like input that uses icon buttons.
/// </summary>
public static partial class ImGuiComponents
{
/// <summary>

View file

@ -18,7 +18,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
public class IconBrowserWidget : IDataWindowWidget
{
private const int MaxIconId = 250_000;
private Vector2 iconSize = new(64.0f, 64.0f);
private Vector2 editIconSize = new(64.0f, 64.0f);
@ -126,7 +126,6 @@ public class IconBrowserWidget : IDataWindowWidget
this.valueRange = null;
}
ImGui.NextColumn();
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X);
if (ImGui.InputInt("##StopRange", ref this.stopRange, 0, 0))
@ -204,7 +203,7 @@ public class IconBrowserWidget : IDataWindowWidget
ImGui.GetColorU32(ImGuiColors.DalamudRed),
iconText);
}
if (ImGui.IsItemHovered())
ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%"));
@ -224,7 +223,7 @@ public class IconBrowserWidget : IDataWindowWidget
cursor + ((this.iconSize - textSize) / 2),
color,
text);
if (ImGui.IsItemHovered())
ImGui.SetTooltip(iconId.ToString());

View file

@ -1,7 +1,7 @@
using Dalamud.Game.Text;
using ImGuiNET;
using System.Linq;
using System.Linq;
using Dalamud.Game.Text;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;

View file

@ -196,6 +196,14 @@ public class DevPluginsSettingsEntry : SettingsEntry
}
}
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
private void AddDevPlugin()
{
if (this.devPluginLocations.Any(
@ -223,16 +231,7 @@ public class DevPluginsSettingsEntry : SettingsEntry
this.devPluginTempLocation = string.Empty;
}
var config = Service<DalamudConfiguration>.Get();
if (!config.ImGuiAssertsEnabledAtStartup.HasValue)
config.ImGuiAssertsEnabledAtStartup = true;
// Enable ImGui asserts if a dev plugin is added, if no choice was made prior
Service<DalamudConfiguration>.Get().ImGuiAssertsEnabledAtStartup ??= true;
}
public override void PostDraw()
{
this.fileDialogManager.Draw();
}
private static bool ValidDevPluginPath(string path)
=> Path.IsPathRooted(path) && Path.GetExtension(path) == ".dll";
}