Expose DefaultDisplayDuration

This commit is contained in:
Soreepeong 2024-02-26 02:28:33 +09:00
parent 1ca2d2000b
commit df9212ac58
2 changed files with 36 additions and 35 deletions

View file

@ -2,10 +2,10 @@ using System.Numerics;
using Dalamud.Interface.Utility;
namespace Dalamud.Interface.ImGuiNotification.Internal;
namespace Dalamud.Interface.ImGuiNotification;
/// <summary>Constants for drawing notification windows.</summary>
internal static class NotificationConstants
public static class NotificationConstants
{
// .............................[..]
// ..when.......................[XX]
@ -19,47 +19,47 @@ internal static class NotificationConstants
// .. action buttons ..
// .................................
/// <summary>The string to show in place of this_plugin if the notification is shown by Dalamud.</summary>
public const string DefaultInitiator = "Dalamud";
/// <summary>The size of the icon.</summary>
public const float IconSize = 32;
/// <summary>The background opacity of a notification window.</summary>
public const float BackgroundOpacity = 0.82f;
/// <summary>The duration of indeterminate progress bar loop in milliseconds.</summary>
public const float IndeterminateProgressbarLoopDuration = 2000f;
/// <summary>Duration of show animation.</summary>
public static readonly TimeSpan ShowAnimationDuration = TimeSpan.FromMilliseconds(300);
/// <summary>Default duration of the notification.</summary>
public static readonly TimeSpan DefaultDisplayDuration = TimeSpan.FromSeconds(3);
/// <summary>Default duration of the notification.</summary>
/// <summary>Default duration of the notification, after the mouse cursor leaves the notification window.</summary>
public static readonly TimeSpan DefaultHoverExtendDuration = TimeSpan.FromSeconds(3);
/// <summary>Duration of hide animation.</summary>
public static readonly TimeSpan HideAnimationDuration = TimeSpan.FromMilliseconds(300);
/// <summary>The string to show in place of this_plugin if the notification is shown by Dalamud.</summary>
internal const string DefaultInitiator = "Dalamud";
/// <summary>The size of the icon.</summary>
internal const float IconSize = 32;
/// <summary>The background opacity of a notification window.</summary>
internal const float BackgroundOpacity = 0.82f;
/// <summary>The duration of indeterminate progress bar loop in milliseconds.</summary>
internal const float IndeterminateProgressbarLoopDuration = 2000f;
/// <summary>Duration of show animation.</summary>
internal static readonly TimeSpan ShowAnimationDuration = TimeSpan.FromMilliseconds(300);
/// <summary>Duration of hide animation.</summary>
public static readonly TimeSpan ProgressAnimationDuration = TimeSpan.FromMilliseconds(200);
internal static readonly TimeSpan HideAnimationDuration = TimeSpan.FromMilliseconds(300);
/// <summary>Duration of hide animation.</summary>
internal static readonly TimeSpan ProgressAnimationDuration = TimeSpan.FromMilliseconds(200);
/// <summary>Text color for the when.</summary>
public static readonly Vector4 WhenTextColor = new(0.8f, 0.8f, 0.8f, 1f);
internal static readonly Vector4 WhenTextColor = new(0.8f, 0.8f, 0.8f, 1f);
/// <summary>Text color for the close button [X].</summary>
public static readonly Vector4 CloseTextColor = new(0.8f, 0.8f, 0.8f, 1f);
internal static readonly Vector4 CloseTextColor = new(0.8f, 0.8f, 0.8f, 1f);
/// <summary>Text color for the title.</summary>
public static readonly Vector4 TitleTextColor = new(1f, 1f, 1f, 1f);
internal static readonly Vector4 TitleTextColor = new(1f, 1f, 1f, 1f);
/// <summary>Text color for the name of the initiator.</summary>
public static readonly Vector4 BlameTextColor = new(0.8f, 0.8f, 0.8f, 1f);
internal static readonly Vector4 BlameTextColor = new(0.8f, 0.8f, 0.8f, 1f);
/// <summary>Text color for the body.</summary>
public static readonly Vector4 BodyTextColor = new(0.9f, 0.9f, 0.9f, 1f);
internal static readonly Vector4 BodyTextColor = new(0.9f, 0.9f, 0.9f, 1f);
/// <summary>Gets the relative time format strings.</summary>
private static readonly (TimeSpan MinSpan, string? FormatString)[] RelativeFormatStrings =
@ -77,32 +77,32 @@ internal static class NotificationConstants
};
/// <summary>Gets the scaled padding of the window (dot(.) in the above diagram).</summary>
public static float ScaledWindowPadding => MathF.Round(16 * ImGuiHelpers.GlobalScale);
internal static float ScaledWindowPadding => MathF.Round(16 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the distance from the right bottom border of the viewport
/// to the right bottom border of a notification window.
/// </summary>
public static float ScaledViewportEdgeMargin => MathF.Round(20 * ImGuiHelpers.GlobalScale);
internal static float ScaledViewportEdgeMargin => MathF.Round(20 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the scaled gap between two notification windows.</summary>
public static float ScaledWindowGap => MathF.Round(10 * ImGuiHelpers.GlobalScale);
internal static float ScaledWindowGap => MathF.Round(10 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the scaled gap between components.</summary>
public static float ScaledComponentGap => MathF.Round(5 * ImGuiHelpers.GlobalScale);
internal static float ScaledComponentGap => MathF.Round(5 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the scaled size of the icon.</summary>
public static float ScaledIconSize => MathF.Round(IconSize * ImGuiHelpers.GlobalScale);
internal static float ScaledIconSize => MathF.Round(IconSize * ImGuiHelpers.GlobalScale);
/// <summary>Gets the height of the expiry progress bar.</summary>
public static float ScaledExpiryProgressBarHeight => MathF.Round(2 * ImGuiHelpers.GlobalScale);
internal static float ScaledExpiryProgressBarHeight => MathF.Round(2 * ImGuiHelpers.GlobalScale);
/// <summary>Gets the string format of the initiator name field, if the initiator is unloaded.</summary>
public static string UnloadedInitiatorNameFormat => "{0} (unloaded)";
internal static string UnloadedInitiatorNameFormat => "{0} (unloaded)";
/// <summary>Formats an instance of <see cref="DateTime"/> as a relative time.</summary>
/// <param name="when">When.</param>
/// <returns>The formatted string.</returns>
public static string FormatRelativeDateTime(this DateTime when)
internal static string FormatRelativeDateTime(this DateTime when)
{
var ts = DateTime.Now - when;
foreach (var (minSpan, formatString) in RelativeFormatStrings)
@ -120,5 +120,5 @@ internal static class NotificationConstants
/// <summary>Formats an instance of <see cref="DateTime"/> as an absolute time.</summary>
/// <param name="when">When.</param>
/// <returns>The formatted string.</returns>
public static string FormatAbsoluteDateTime(this DateTime when) => $"{when:G}";
internal static string FormatAbsoluteDateTime(this DateTime when) => $"{when:G}";
}

View file

@ -2,6 +2,7 @@
using System.Threading.Tasks;
using Dalamud.Game.Text;
using Dalamud.Interface.ImGuiNotification;
using Dalamud.Interface.ImGuiNotification.IconSource;
using Dalamud.Interface.ImGuiNotification.Internal;
using Dalamud.Interface.Internal.Notifications;