Small updates.

This commit is contained in:
Ottermandias 2024-06-02 01:03:51 +02:00
parent 3b26e97231
commit 3deda68eec
9 changed files with 21 additions and 25 deletions

@ -1 +1 @@
Subproject commit 0b5afffda19d3e16aec9e8682d18c8f11f67f1c6 Subproject commit becacbca4f35595d16ff40dc9639cfa24be3461f

@ -1 +1 @@
Subproject commit 29b71cf7b3cc68995d38f0954fa38c4b9500a81d Subproject commit fed687b536b7c709484db251b690b8821c5ef403

View file

@ -149,7 +149,6 @@ public static class StaticServiceManager
private static ServiceManager AddInterface(this ServiceManager services) private static ServiceManager AddInterface(this ServiceManager services)
=> services.AddSingleton<FileDialogService>() => services.AddSingleton<FileDialogService>()
.AddSingleton<TutorialService>() .AddSingleton<TutorialService>()
.AddSingleton<IncognitoService>()
.AddSingleton<PenumbraChangelog>() .AddSingleton<PenumbraChangelog>()
.AddSingleton<LaunchButton>() .AddSingleton<LaunchButton>()
.AddSingleton<ConfigWindow>() .AddSingleton<ConfigWindow>()
@ -182,7 +181,6 @@ public static class StaticServiceManager
.AddSingleton<ItemSwapTab>() .AddSingleton<ItemSwapTab>()
.AddSingleton<ModMergeTab>() .AddSingleton<ModMergeTab>()
.AddSingleton<ChangedItemDrawer>() .AddSingleton<ChangedItemDrawer>()
.AddSingleton<ResourceTreeViewerFactory>()
.AddSingleton(p => new Diagnostics(p)); .AddSingleton(p => new Diagnostics(p));
private static ServiceManager AddModEditor(this ServiceManager services) private static ServiceManager AddModEditor(this ServiceManager services)

View file

@ -158,7 +158,7 @@ public class ResourceTreeViewer
ImGui.SetNextItemWidth(fieldWidth); ImGui.SetNextItemWidth(fieldWidth);
filterChanged |= ImGui.InputTextWithHint("##NodeFilter", "Filter by Item/Part Name or Path...", ref _nodeFilter, 128); filterChanged |= ImGui.InputTextWithHint("##NodeFilter", "Filter by Item/Part Name or Path...", ref _nodeFilter, 128);
ImGui.SameLine(0, checkSpacing); ImGui.SameLine(0, checkSpacing);
_incognito.DrawToggle(); _incognito.DrawToggle(ImGui.GetFrameHeightWithSpacing());
if (filterChanged) if (filterChanged)
_filterCache.Clear(); _filterCache.Clear();

View file

@ -1,3 +1,4 @@
using OtterGui.Services;
using Penumbra.Interop.ResourceTree; using Penumbra.Interop.ResourceTree;
namespace Penumbra.UI.AdvancedWindow; namespace Penumbra.UI.AdvancedWindow;
@ -6,7 +7,7 @@ public class ResourceTreeViewerFactory(
Configuration config, Configuration config,
ResourceTreeFactory treeFactory, ResourceTreeFactory treeFactory,
ChangedItemDrawer changedItemDrawer, ChangedItemDrawer changedItemDrawer,
IncognitoService incognito) IncognitoService incognito) : IService
{ {
public ResourceTreeViewer Create(int actionCapacity, Action onRefresh, Action<ResourceNode, Vector2> drawActions) public ResourceTreeViewer Create(int actionCapacity, Action onRefresh, Action<ResourceNode, Vector2> drawActions)
=> new(config, treeFactory, changedItemDrawer, incognito, actionCapacity, onRefresh, drawActions); => new(config, treeFactory, changedItemDrawer, incognito, actionCapacity, onRefresh, drawActions);

View file

@ -1,29 +1,26 @@
using Dalamud.Interface.Utility;
using Dalamud.Interface; using Dalamud.Interface;
using ImGuiNET;
using OtterGui;
using Penumbra.UI.Classes; using Penumbra.UI.Classes;
using OtterGui.Raii; using OtterGui.Raii;
using OtterGui.Services;
using OtterGui.Text;
namespace Penumbra.UI; namespace Penumbra.UI;
public class IncognitoService(TutorialService tutorial) public class IncognitoService(TutorialService tutorial) : IService
{ {
public bool IncognitoMode; public bool IncognitoMode;
public void DrawToggle(float? buttonWidth = null) public void DrawToggle(float width)
{ {
using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale); var color = ColorId.FolderExpanded.Value();
using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value()) using (ImRaii.PushFrameBorder(ImUtf8.GlobalScale, color))
.Push(ImGuiCol.Border, ColorId.FolderExpanded.Value()); {
if (ImGuiUtil.DrawDisabledButton( var tt = IncognitoMode ? "Toggle incognito mode off."u8 : "Toggle incognito mode on."u8;
$"{(IncognitoMode ? FontAwesomeIcon.Eye : FontAwesomeIcon.EyeSlash).ToIconString()}###IncognitoMode", var icon = IncognitoMode ? FontAwesomeIcon.EyeSlash : FontAwesomeIcon.Eye;
new Vector2(buttonWidth ?? ImGui.GetFrameHeightWithSpacing(), ImGui.GetFrameHeight()), string.Empty, false, true)) if (ImUtf8.IconButton(icon, tt, new Vector2(width, ImUtf8.FrameHeight), false, color))
IncognitoMode = !IncognitoMode; IncognitoMode = !IncognitoMode;
var hovered = ImGui.IsItemHovered(); }
tutorial.OpenTutorial(BasicTutorialSteps.Incognito); tutorial.OpenTutorial(BasicTutorialSteps.Incognito);
color.Pop(2);
if (hovered)
ImGui.SetTooltip(IncognitoMode ? "Toggle incognito mode off." : "Toggle incognito mode on.");
} }
} }

View file

@ -118,7 +118,7 @@ public readonly struct ImcModGroupEditDrawer(ModGroupEditDrawer editor, ImcModGr
: validName : validName
? "Add a new option to this group."u8 ? "Add a new option to this group."u8
: "Please enter a name for the new option."u8; : "Please enter a name for the new option."u8;
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, tt, !validName || dis)) if (ImUtf8.IconButton(FontAwesomeIcon.Plus, tt, default, !validName || dis))
{ {
editor.ModManager.OptionEditor.ImcEditor.AddOption(group, cache, name); editor.ModManager.OptionEditor.ImcEditor.AddOption(group, cache, name);
editor.NewOptionName = null; editor.NewOptionName = null;

View file

@ -54,7 +54,7 @@ public readonly struct MultiModGroupEditDrawer(ModGroupEditDrawer editor, MultiM
var validName = name.Length > 0; var validName = name.Length > 0;
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName
? "Add a new option to this group."u8 ? "Add a new option to this group."u8
: "Please enter a name for the new option."u8, !validName)) : "Please enter a name for the new option."u8, default, !validName))
{ {
editor.ModManager.OptionEditor.MultiEditor.AddOption(group, name); editor.ModManager.OptionEditor.MultiEditor.AddOption(group, name);
editor.NewOptionName = null; editor.NewOptionName = null;

View file

@ -59,7 +59,7 @@ public readonly struct SingleModGroupEditDrawer(ModGroupEditDrawer editor, Singl
var validName = name.Length > 0; var validName = name.Length > 0;
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName
? "Add a new option to this group."u8 ? "Add a new option to this group."u8
: "Please enter a name for the new option."u8, !validName)) : "Please enter a name for the new option."u8, default, !validName))
{ {
editor.ModManager.OptionEditor.SingleEditor.AddOption(group, name); editor.ModManager.OptionEditor.SingleEditor.AddOption(group, name);
editor.NewOptionName = null; editor.NewOptionName = null;