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

View file

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

View file

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

View file

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

View file

@ -54,7 +54,7 @@ public readonly struct MultiModGroupEditDrawer(ModGroupEditDrawer editor, MultiM
var validName = name.Length > 0;
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName
? "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.NewOptionName = null;

View file

@ -59,7 +59,7 @@ public readonly struct SingleModGroupEditDrawer(ModGroupEditDrawer editor, Singl
var validName = name.Length > 0;
if (ImUtf8.IconButton(FontAwesomeIcon.Plus, validName
? "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.NewOptionName = null;