Add floating option for recipenote and synthhelper windows
This commit is contained in:
@@ -94,6 +94,9 @@ public class Configuration : IPluginConfiguration
|
||||
public bool ShowOptimalMacroStat { get; set; } = true;
|
||||
public int SynthHelperStepCount { get; set; } = 5;
|
||||
|
||||
public bool PinSynthHelperToWindow { get; set; } = true;
|
||||
public bool PinRecipeNoteToWindow { get; set; } = true;
|
||||
|
||||
public MacroCopyConfiguration MacroCopy { get; set; } = new();
|
||||
|
||||
public void AddMacro(Macro macro)
|
||||
|
||||
@@ -36,11 +36,16 @@ namespace Craftimizer.Windows;
|
||||
|
||||
public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
{
|
||||
private const ImGuiWindowFlags WindowFlags = ImGuiWindowFlags.NoDecoration
|
||||
| ImGuiWindowFlags.AlwaysAutoResize
|
||||
| ImGuiWindowFlags.NoSavedSettings
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||
| ImGuiWindowFlags.NoNavFocus;
|
||||
private const ImGuiWindowFlags WindowFlagsPinned = WindowFlagsFloating
|
||||
| ImGuiWindowFlags.NoDecoration
|
||||
| ImGuiWindowFlags.NoSavedSettings;
|
||||
|
||||
private const ImGuiWindowFlags WindowFlagsFloating =
|
||||
ImGuiWindowFlags.AlwaysAutoResize
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing;
|
||||
|
||||
private const string WindowNamePinned = "Craftimizer Crafting Log Helper###CraftimizerRecipeNote";
|
||||
private const string WindowNameFloating = $"{WindowNamePinned}Floating";
|
||||
|
||||
public enum CraftableStatus
|
||||
{
|
||||
@@ -72,7 +77,7 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
private IDalamudTextureWrap NoManipulationBadge { get; }
|
||||
private IFontHandle AxisFont { get; }
|
||||
|
||||
public RecipeNote() : base("Craftimizer RecipeNote", WindowFlags)
|
||||
public RecipeNote() : base(WindowNamePinned)
|
||||
{
|
||||
ExpertBadge = Service.IconManager.GetAssemblyTexture("Graphics.expert_badge.png");
|
||||
CollectibleBadge = Service.IconManager.GetAssemblyTexture("Graphics.collectible_badge.png");
|
||||
@@ -92,6 +97,17 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
MaximumSize = new(10000, 10000)
|
||||
};
|
||||
|
||||
TitleBarButtons = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
};
|
||||
|
||||
Service.WindowSystem.AddWindow(this);
|
||||
}
|
||||
|
||||
@@ -186,6 +202,10 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
base.PreDraw();
|
||||
|
||||
if (Service.Configuration.PinRecipeNoteToWindow)
|
||||
{
|
||||
ref var unit = ref Addon->AtkUnitBase;
|
||||
var scale = unit.Scale;
|
||||
@@ -196,6 +216,15 @@ public sealed unsafe class RecipeNote : Window, IDisposable
|
||||
var nodeParent = Addon->Unk258; // unit.GetNodeById(57);
|
||||
|
||||
Position = ImGuiHelpers.MainViewport.Pos + pos + new Vector2(size.X, (nodeParent->Y + node->Y) * scale);
|
||||
Flags = WindowFlagsPinned;
|
||||
WindowName = WindowNamePinned;
|
||||
}
|
||||
else
|
||||
{
|
||||
Position = null;
|
||||
Flags = WindowFlagsFloating;
|
||||
WindowName = WindowNameFloating;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
|
||||
@@ -183,6 +183,15 @@ public sealed class Settings : Window, IDisposable
|
||||
ref isDirty
|
||||
);
|
||||
|
||||
DrawOption(
|
||||
"Pin Crafting Log Window",
|
||||
"Pins the helper window to the right of your crafting log. Disabling this will " +
|
||||
"allow you to move it around.",
|
||||
Config.PinRecipeNoteToWindow,
|
||||
v => Config.PinRecipeNoteToWindow = v,
|
||||
ref isDirty
|
||||
);
|
||||
|
||||
DrawOption(
|
||||
"Show Only One Macro Stat in Crafting Log",
|
||||
"Only one stat will be shown for a macro. If a craft will be finished, quality " +
|
||||
@@ -657,7 +666,16 @@ public sealed class Settings : Window, IDisposable
|
||||
var isDirty = false;
|
||||
|
||||
DrawOption(
|
||||
"Disable when running macro",
|
||||
"Pin Window",
|
||||
"Pins the synthesis helper to the right of your synthesis window. Disabling this will " +
|
||||
"allow you to move it around.",
|
||||
Config.PinSynthHelperToWindow,
|
||||
v => Config.PinSynthHelperToWindow = v,
|
||||
ref isDirty
|
||||
);
|
||||
|
||||
DrawOption(
|
||||
"Disable When Running Macro",
|
||||
"Disables itself when an in-game macro is running.",
|
||||
Config.DisableSynthHelperOnMacro,
|
||||
v => Config.DisableSynthHelperOnMacro = v,
|
||||
|
||||
@@ -4,6 +4,7 @@ using Craftimizer.Simulator;
|
||||
using Craftimizer.Simulator.Actions;
|
||||
using Craftimizer.Utils;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.GameFonts;
|
||||
using Dalamud.Interface.ManagedFontAtlas;
|
||||
@@ -31,11 +32,16 @@ namespace Craftimizer.Windows;
|
||||
|
||||
public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
{
|
||||
private const ImGuiWindowFlags WindowFlags = ImGuiWindowFlags.NoDecoration
|
||||
| ImGuiWindowFlags.AlwaysAutoResize
|
||||
| ImGuiWindowFlags.NoSavedSettings
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||
| ImGuiWindowFlags.NoNavFocus;
|
||||
private const ImGuiWindowFlags WindowFlagsPinned = WindowFlagsFloating
|
||||
| ImGuiWindowFlags.NoDecoration
|
||||
| ImGuiWindowFlags.NoSavedSettings;
|
||||
|
||||
private const ImGuiWindowFlags WindowFlagsFloating =
|
||||
ImGuiWindowFlags.AlwaysAutoResize
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing;
|
||||
|
||||
private const string WindowNamePinned = "Craftimizer Synthesis Helper###CraftimizerSynthHelper";
|
||||
private const string WindowNameFloating = $"{WindowNamePinned}Floating";
|
||||
|
||||
public AddonSynthesis* Addon { get; private set; }
|
||||
public RecipeData? RecipeData { get; private set; }
|
||||
@@ -69,7 +75,7 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
|
||||
private IFontHandle AxisFont { get; }
|
||||
|
||||
public SynthHelper() : base("Craftimizer SynthHelper", WindowFlags)
|
||||
public SynthHelper() : base(WindowNamePinned)
|
||||
{
|
||||
AxisFont = Service.PluginInterface.UiBuilder.FontAtlas.NewGameFontHandle(new(GameFontFamilyAndSize.Axis14));
|
||||
|
||||
@@ -86,6 +92,17 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
MaximumSize = new(494, 10000)
|
||||
};
|
||||
|
||||
TitleBarButtons = new()
|
||||
{
|
||||
new()
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new(2.5f, 1),
|
||||
Click = _ => Service.Plugin.OpenSettingsWindow(),
|
||||
ShowTooltip = () => ImGuiUtils.Tooltip("Open Craftimizer Settings")
|
||||
}
|
||||
};
|
||||
|
||||
Service.WindowSystem.AddWindow(this);
|
||||
}
|
||||
|
||||
@@ -154,6 +171,10 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
base.PreDraw();
|
||||
|
||||
if (Service.Configuration.PinSynthHelperToWindow)
|
||||
{
|
||||
ref var unit = ref Addon->AtkUnitBase;
|
||||
var scale = unit.Scale;
|
||||
@@ -163,6 +184,15 @@ public sealed unsafe class SynthHelper : Window, IDisposable
|
||||
var offset = 5;
|
||||
|
||||
Position = ImGuiHelpers.MainViewport.Pos + pos + new Vector2(size.X, offset * scale);
|
||||
Flags = WindowFlagsPinned;
|
||||
WindowName = WindowNamePinned;
|
||||
}
|
||||
else
|
||||
{
|
||||
Position = null;
|
||||
Flags = WindowFlagsFloating;
|
||||
WindowName = WindowNameFloating;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw()
|
||||
|
||||
Reference in New Issue
Block a user