From 660781393ed563568767da3f2bcf99253970166a Mon Sep 17 00:00:00 2001 From: Critical Impact Date: Fri, 5 Sep 2025 16:19:32 +1000 Subject: [PATCH] Minor formatting changes --- Dalamud/Interface/Windowing/IWindow.cs | 10 +++------ Dalamud/Interface/Windowing/IWindowSystem.cs | 7 +++---- Dalamud/Interface/Windowing/Window.cs | 5 ++--- Dalamud/Interface/Windowing/WindowHost.cs | 21 ++++++++++++------- .../Windowing/WindowSizeConstraints.cs | 17 +++++++++++++++ Dalamud/Interface/Windowing/WindowSystem.cs | 4 +--- 6 files changed, 40 insertions(+), 24 deletions(-) diff --git a/Dalamud/Interface/Windowing/IWindow.cs b/Dalamud/Interface/Windowing/IWindow.cs index 74fb593db..ff4c0bce9 100644 --- a/Dalamud/Interface/Windowing/IWindow.cs +++ b/Dalamud/Interface/Windowing/IWindow.cs @@ -1,7 +1,3 @@ -// -// Copyright (c) PlaceholderCompany. All rights reserved. -// - using System.Collections.Generic; using System.Numerics; @@ -27,7 +23,7 @@ public interface IWindow string WindowName { get; set; } /// - /// Gets a value indicating whether the window is focused. + /// Gets or sets a value indicating whether the window is focused. /// bool IsFocused { get; set; } @@ -137,7 +133,7 @@ public interface IWindow bool IsOpen { get; set; } /// - /// Gets or sets a value indicating whether this window will request focus from the window system next frame + /// Gets or sets a value indicating whether this window will request focus from the window system next frame. /// public bool RequestFocus { get; set; } @@ -199,7 +195,7 @@ public interface IWindow /// /// Code to be executed when the window is safe to be disposed or removed from the window system. - /// Doing so in may result in animations not playing correctly. + /// Doing so in may result in animations not playing correctly. /// void OnSafeToRemove(); diff --git a/Dalamud/Interface/Windowing/IWindowSystem.cs b/Dalamud/Interface/Windowing/IWindowSystem.cs index 2b6d23878..500f3d96b 100644 --- a/Dalamud/Interface/Windowing/IWindowSystem.cs +++ b/Dalamud/Interface/Windowing/IWindowSystem.cs @@ -1,11 +1,10 @@ -// -// Copyright (c) PlaceholderCompany. All rights reserved. -// - using System.Collections.Generic; namespace Dalamud.Interface.Windowing; +/// +/// Class running a WindowSystem using implementations to simplify ImGui windowing. +/// public interface IWindowSystem { /// diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index d15c112e9..82a8d4e04 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -9,7 +9,7 @@ namespace Dalamud.Interface.Windowing; public abstract class Window : IWindow { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The name/ID of this window. /// If you have multiple windows with the same name, you will need to @@ -25,7 +25,7 @@ public abstract class Window : IWindow } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The name/ID of this window. /// If you have multiple windows with the same name, you will need to @@ -36,7 +36,6 @@ public abstract class Window : IWindow { } - /// public string? Namespace { get; set; } diff --git a/Dalamud/Interface/Windowing/WindowHost.cs b/Dalamud/Interface/Windowing/WindowHost.cs index 959fca94b..1bd924086 100644 --- a/Dalamud/Interface/Windowing/WindowHost.cs +++ b/Dalamud/Interface/Windowing/WindowHost.cs @@ -51,6 +51,10 @@ public class WindowHost private Vector2 fadeOutSize = Vector2.Zero; private Vector2 fadeOutOrigin = Vector2.Zero; + /// + /// Initializes a new instance of the class. + /// + /// A plugin provided window. internal WindowHost(IWindow window) { this.Window = window; @@ -88,10 +92,13 @@ public class WindowHost IsReducedMotion = 1 << 3, } - private bool CanShowCloseButton => this.Window.ShowCloseButton && !this.internalIsClickthrough; - + /// + /// Gets or sets the backing window provided by the plugin. + /// public IWindow Window { get; set; } + private bool CanShowCloseButton => this.Window.ShowCloseButton && !this.internalIsClickthrough; + /// /// Draw the window via ImGui. /// @@ -158,12 +165,13 @@ public class WindowHost UIGlobals.PlaySoundEffect(this.Window.OnOpenSfxId); } - //TODO: We may have to allow for windows to configure if they should fade + // TODO: We may have to allow for windows to configure if they should fade if (this.internalAlpha.HasValue) { ImGui.PushStyleVar(ImGuiStyleVar.Alpha, this.internalAlpha.Value); this.didPushInternalAlpha = true; } + this.Window.PreDraw(); this.ApplyConditionals(); @@ -404,6 +412,7 @@ public class WindowHost ImGui.PopStyleVar(); this.didPushInternalAlpha = false; } + this.Window.PostDraw(); this.PostHandlePreset(persistence); @@ -439,8 +448,7 @@ public class WindowHost var (min, max) = this.GetValidatedConstraints(this.Window.SizeConstraints.Value); ImGui.SetNextWindowSizeConstraints( min * ImGuiHelpers.GlobalScale, - max * ImGuiHelpers.GlobalScale - ); + max * ImGuiHelpers.GlobalScale); } var maxBgAlpha = this.internalAlpha ?? this.Window.BgAlpha; @@ -460,7 +468,7 @@ public class WindowHost } } - private (Vector2 min, Vector2 max) GetValidatedConstraints(WindowSizeConstraints constraints) + private (Vector2 Min, Vector2 Max) GetValidatedConstraints(WindowSizeConstraints constraints) { var min = constraints.MinimumSize; var max = constraints.MaximumSize; @@ -472,7 +480,6 @@ public class WindowHost return (min, max); } - private void PreHandlePreset(WindowSystemPersistence? persistence) { if (persistence == null || this.hasInitializedFromPreset) diff --git a/Dalamud/Interface/Windowing/WindowSizeConstraints.cs b/Dalamud/Interface/Windowing/WindowSizeConstraints.cs index 75d90bf7b..2389ed95e 100644 --- a/Dalamud/Interface/Windowing/WindowSizeConstraints.cs +++ b/Dalamud/Interface/Windowing/WindowSizeConstraints.cs @@ -2,8 +2,25 @@ using System.Numerics; namespace Dalamud.Interface.Windowing; +/// +/// Structure detailing the size constraints of a window. +/// public struct WindowSizeConstraints { + /// + /// Initializes a new instance of the struct. + /// + public WindowSizeConstraints() + { + } + + /// + /// Gets or sets the minimum size of the window. + /// public Vector2 MinimumSize { get; set; } + + /// + /// Gets or sets the maximum size of the window. + /// public Vector2 MaximumSize { get; set; } } diff --git a/Dalamud/Interface/Windowing/WindowSystem.cs b/Dalamud/Interface/Windowing/WindowSystem.cs index a5ca9cb84..9676a9939 100644 --- a/Dalamud/Interface/Windowing/WindowSystem.cs +++ b/Dalamud/Interface/Windowing/WindowSystem.cs @@ -8,9 +8,7 @@ using Serilog; namespace Dalamud.Interface.Windowing; -/// -/// Class running a WindowSystem using implementations to simplify ImGui windowing. -/// +/// public class WindowSystem : IWindowSystem { private static DateTimeOffset lastAnyFocus;