Fix conds in Window

This commit is contained in:
goaaats 2025-04-14 21:06:38 +02:00
parent 47b4a9b502
commit 6858c646a2
15 changed files with 40 additions and 20 deletions

View file

@ -20,7 +20,7 @@ namespace Dalamud.CorePlugin
this.IsOpen = true;
this.Size = new Vector2(810, 520);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
}
/// <inheritdoc/>

View file

@ -23,14 +23,14 @@ internal class AddonPopoutWindow : Window, IDisposable
: base(name)
{
this.addonTree = tree;
this.PositionCondition = ImGuiCond.Once;
this.PositionConditionNew = ImGuiCond.Once;
var pos = ImGui.GetMousePos() + new Vector2(50, -50);
var workSize = ImGui.GetMainViewport().WorkSize;
var pos2 = new Vector2(Math.Min(workSize.X - 750, pos.X), Math.Min(workSize.Y - 250, pos.Y));
this.Position = pos2;
this.SizeCondition = ImGuiCond.Once;
this.SizeConditionNew = ImGuiCond.Once;
this.Size = new(700, 200);
this.IsOpen = true;
this.SizeConstraints = new() { MinimumSize = new(100, 100) };

View file

@ -35,8 +35,8 @@ internal unsafe class NodePopoutWindow : Window, IDisposable
this.Position = pos2;
this.IsOpen = true;
this.PositionCondition = ImGuiCond.Once;
this.SizeCondition = ImGuiCond.Once;
this.PositionConditionNew = ImGuiCond.Once;
this.SizeConditionNew = ImGuiCond.Once;
this.Size = new(700, 200);
this.SizeConstraints = new() { MinimumSize = new(100, 100) };
}

View file

@ -216,7 +216,7 @@ internal sealed class ChangelogWindow : Window, IDisposable
ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f));
this.Size = new Vector2(900, 400);
this.SizeCondition = ImGuiCond.Always;
this.SizeConditionNew = ImGuiCond.Always;
// Center the window on the main viewport
var viewportPos = ImGuiHelpers.MainViewport.Pos;

View file

@ -23,7 +23,7 @@ internal sealed class ColorDemoWindow : Window
: base("Dalamud Colors Demo")
{
this.Size = new Vector2(600, 500);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.colors = new List<(string Name, Vector4 Color)>()
{

View file

@ -38,7 +38,7 @@ internal sealed class ComponentDemoWindow : Window
: base("Dalamud Components Demo")
{
this.Size = new Vector2(600, 500);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;

View file

@ -100,7 +100,7 @@ internal class ConsoleWindow : Window, IDisposable
cm.AddAlias("clear", "cls");
this.Size = new Vector2(500, 400);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;

View file

@ -78,7 +78,7 @@ internal class DataWindow : Window, IDisposable
: base("Dalamud Data", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.Size = new Vector2(400, 300);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;
this.orderedModules = this.modules.OrderBy(module => module.DisplayName);

View file

@ -24,7 +24,7 @@ internal class GamepadModeNotifierWindow : Window
true)
{
this.Size = Vector2.Zero;
this.SizeCondition = ImGuiCond.Always;
this.SizeConditionNew = ImGuiCond.Always;
this.IsOpen = false;
this.RespectCloseHotkey = false;

View file

@ -152,7 +152,7 @@ internal class PluginInstallerWindow : Window, IDisposable
this.imageCache = imageCache;
this.Size = new Vector2(830, 570);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.SizeConstraints = new WindowSizeConstraints
{

View file

@ -36,7 +36,7 @@ internal class PluginStatWindow : Window
this.RespectCloseHotkey = false;
this.Size = new Vector2(810, 520);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
}
/// <inheritdoc/>

View file

@ -71,7 +71,7 @@ internal class SelfTestWindow : Window
: base("Dalamud Self-Test", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse)
{
this.Size = new Vector2(800, 800);
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.RespectCloseHotkey = false;
}

View file

@ -39,7 +39,7 @@ internal class SettingsWindow : Window
MaximumSize = new Vector2(1780, 940),
};
this.SizeCondition = ImGuiCond.FirstUseEver;
this.SizeConditionNew = ImGuiCond.FirstUseEver;
this.tabs =
[

View file

@ -100,7 +100,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable
this.ForceMainWindow = true;
this.Position = new Vector2(0, 200);
this.PositionCondition = ImGuiCond.Always;
this.PositionConditionNew = ImGuiCond.Always;
this.RespectCloseHotkey = false;
this.shadeTexture = new(() => dalamudAssetManager.GetDalamudTextureWrap(DalamudAsset.TitleScreenMenuShade));

View file

@ -158,7 +158,17 @@ public abstract class Window
/// <summary>
/// Gets or sets the condition that defines when the position of this window is set.
/// </summary>
public ImGuiCond PositionCondition { get; set; }
public ImGuiCond PositionConditionNew
{
get => (ImGuiCond)this.PositionCondition;
set => this.PositionCondition = (ImGuiNET.ImGuiCond)value;
}
/// <summary>
/// Gets or sets the condition that defines when the position of this window is set.
/// </summary>
[ImGuiBindingsToDo("Remove. Rename New.")]
public ImGuiNET.ImGuiCond PositionCondition { get; set; }
/// <summary>
/// Gets or sets the size of the window. The size provided will be scaled by the global scale.
@ -168,7 +178,17 @@ public abstract class Window
/// <summary>
/// Gets or sets the condition that defines when the size of this window is set.
/// </summary>
public ImGuiCond SizeCondition { get; set; }
public ImGuiCond SizeConditionNew
{
get => (ImGuiCond)this.SizeCondition;
set => this.SizeCondition = (ImGuiNET.ImGuiCond)value;
}
/// <summary>
/// Gets or sets the condition that defines when the size of this window is set.
/// </summary>
[ImGuiBindingsToDo("Remove. Rename New.")]
public ImGuiNET.ImGuiCond SizeCondition { get; set; }
/// <summary>
/// Gets or sets the size constraints of the window. The size constraints provided will be scaled by the global scale.
@ -588,12 +608,12 @@ public abstract class Window
if (this.ForceMainWindow)
pos += ImGuiHelpers.MainViewport.Pos;
ImGui.SetNextWindowPos(pos, this.PositionCondition);
ImGui.SetNextWindowPos(pos, this.PositionConditionNew);
}
if (this.Size.HasValue)
{
ImGui.SetNextWindowSize(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeCondition);
ImGui.SetNextWindowSize(this.Size.Value * ImGuiHelpers.GlobalScale, this.SizeConditionNew);
}
if (this.Collapsed.HasValue)