mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-14 12:44:19 +01:00
Make line endings explicit in editorconfig and share in sub projects, also apply editorconfig everywhere and move some namespaces.
This commit is contained in:
parent
53adb6fa54
commit
2b4a01df06
155 changed files with 1620 additions and 1614 deletions
|
|
@ -10,20 +10,20 @@ namespace Penumbra.UI.AdvancedWindow;
|
|||
public class ResourceTreeViewer
|
||||
{
|
||||
private readonly Configuration _config;
|
||||
private readonly ResourceTreeFactory _treeFactory;
|
||||
private readonly ResourceTreeFactory _treeFactory;
|
||||
private readonly ChangedItemDrawer _changedItemDrawer;
|
||||
private readonly int _actionCapacity;
|
||||
private readonly Action _onRefresh;
|
||||
private readonly Action<ResourceNode, Vector2> _drawActions;
|
||||
private readonly HashSet<nint> _unfolded;
|
||||
|
||||
private Task<ResourceTree[]>? _task;
|
||||
private Task<ResourceTree[]>? _task;
|
||||
|
||||
public ResourceTreeViewer(Configuration config, ResourceTreeFactory treeFactory, ChangedItemDrawer changedItemDrawer,
|
||||
public ResourceTreeViewer(Configuration config, ResourceTreeFactory treeFactory, ChangedItemDrawer changedItemDrawer,
|
||||
int actionCapacity, Action onRefresh, Action<ResourceNode, Vector2> drawActions)
|
||||
{
|
||||
_config = config;
|
||||
_treeFactory = treeFactory;
|
||||
_treeFactory = treeFactory;
|
||||
_changedItemDrawer = changedItemDrawer;
|
||||
_actionCapacity = actionCapacity;
|
||||
_onRefresh = onRefresh;
|
||||
|
|
@ -87,7 +87,7 @@ public class ResourceTreeViewer
|
|||
|
||||
private Task<ResourceTree[]> RefreshCharacterList()
|
||||
=> Task.Run(() =>
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
return _treeFactory.FromObjectTable();
|
||||
|
|
@ -107,38 +107,39 @@ public class ResourceTreeViewer
|
|||
foreach (var (resourceNode, index) in resourceNodes.WithIndex())
|
||||
{
|
||||
if (resourceNode.Internal && !debugMode)
|
||||
continue;
|
||||
|
||||
var textColor = ImGui.GetColorU32(ImGuiCol.Text);
|
||||
var textColorInternal = (textColor & 0x00FFFFFFu) | ((textColor & 0xFE000000u) >> 1); // Half opacity
|
||||
|
||||
using var mutedColor = ImRaii.PushColor(ImGuiCol.Text, textColorInternal, resourceNode.Internal);
|
||||
|
||||
continue;
|
||||
|
||||
var textColor = ImGui.GetColorU32(ImGuiCol.Text);
|
||||
var textColorInternal = (textColor & 0x00FFFFFFu) | ((textColor & 0xFE000000u) >> 1); // Half opacity
|
||||
|
||||
using var mutedColor = ImRaii.PushColor(ImGuiCol.Text, textColorInternal, resourceNode.Internal);
|
||||
|
||||
var nodePathHash = unchecked(pathHash + resourceNode.ResourceHandle);
|
||||
|
||||
using var id = ImRaii.PushId(index);
|
||||
ImGui.TableNextColumn();
|
||||
var unfolded = _unfolded.Contains(nodePathHash);
|
||||
using (var indent = ImRaii.PushIndent(level))
|
||||
{
|
||||
var unfoldable = debugMode
|
||||
? resourceNode.Children.Count > 0
|
||||
: resourceNode.Children.Any(child => !child.Internal);
|
||||
if (unfoldable)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
var icon = (unfolded ? FontAwesomeIcon.CaretDown : FontAwesomeIcon.CaretRight).ToIconString();
|
||||
var offset = (ImGui.GetFrameHeight() - ImGui.CalcTextSize(icon).X) / 2;
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset);
|
||||
ImGui.TextUnformatted(icon);
|
||||
ImGui.SameLine(0f, offset + ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Dummy(new Vector2(ImGui.GetFrameHeight()));
|
||||
ImGui.SameLine(0f, ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
}
|
||||
_changedItemDrawer.DrawCategoryIcon(resourceNode.Icon);
|
||||
{
|
||||
var unfoldable = debugMode
|
||||
? resourceNode.Children.Count > 0
|
||||
: resourceNode.Children.Any(child => !child.Internal);
|
||||
if (unfoldable)
|
||||
{
|
||||
using var font = ImRaii.PushFont(UiBuilder.IconFont);
|
||||
var icon = (unfolded ? FontAwesomeIcon.CaretDown : FontAwesomeIcon.CaretRight).ToIconString();
|
||||
var offset = (ImGui.GetFrameHeight() - ImGui.CalcTextSize(icon).X) / 2;
|
||||
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + offset);
|
||||
ImGui.TextUnformatted(icon);
|
||||
ImGui.SameLine(0f, offset + ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Dummy(new Vector2(ImGui.GetFrameHeight()));
|
||||
ImGui.SameLine(0f, ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
}
|
||||
|
||||
_changedItemDrawer.DrawCategoryIcon(resourceNode.Icon);
|
||||
ImGui.SameLine(0f, ImGui.GetStyle().ItemInnerSpacing.X);
|
||||
ImGui.TableHeader(resourceNode.Name);
|
||||
if (ImGui.IsItemClicked() && unfoldable)
|
||||
|
|
@ -150,11 +151,11 @@ public class ResourceTreeViewer
|
|||
unfolded = !unfolded;
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
using var _ = ImRaii.PushFont(UiBuilder.MonoFont);
|
||||
ImGuiUtil.HoverTooltip(
|
||||
$"Resource Type: {resourceNode.Type}\nObject Address: 0x{resourceNode.ObjectAddress:X16}\nResource Handle: 0x{resourceNode.ResourceHandle:X16}\nLength: 0x{resourceNode.Length:X16}");
|
||||
$"Resource Type: {resourceNode.Type}\nObject Address: 0x{resourceNode.ObjectAddress:X16}\nResource Handle: 0x{resourceNode.ResourceHandle:X16}\nLength: 0x{resourceNode.Length:X16}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,8 +188,8 @@ public class ResourceTreeViewer
|
|||
ImGui.Selectable("(unavailable)", false, ImGuiSelectableFlags.Disabled,
|
||||
new Vector2(ImGui.GetContentRegionAvail().X, cellHeight));
|
||||
ImGuiUtil.HoverTooltip("The actual path to this file is unavailable.\nIt may be managed by another plug-in.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mutedColor.Dispose();
|
||||
|
||||
if (_actionCapacity > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue