From 6753b46ed109bfcc5eb9db50ed6c91c2abdea43f Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sat, 29 Nov 2025 10:49:15 +1000 Subject: [PATCH] display icon overlays --- .../GenericFileAdornments/PropsFile.svg | 22 +++++-------------- .../PropsFile.svg.import | 18 +++++++++++++++ .../SolutionExplorerPanel.FileIcons.cs | 16 +++++++++++--- .../SolutionExplorer/SolutionExplorerPanel.cs | 4 +++- 4 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg.import diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg b/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg index 551f750..1d357ae 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg @@ -23,9 +23,9 @@ inkscape:pageopacity="0" inkscape:pagecheckerboard="0" inkscape:deskcolor="#505050" - inkscape:zoom="32" - inkscape:cx="10.28125" - inkscape:cy="16.171875" + inkscape:zoom="22.627417" + inkscape:cx="1.5026019" + inkscape:cy="14.473592" inkscape:window-width="2560" inkscape:window-height="1369" inkscape:window-x="-8" @@ -41,22 +41,10 @@ id="path1" sodipodi:nodetypes="csssssscc" style="display:none;stroke-width:1;stroke-dasharray:none" /> + d="M 17.466797 8.5683594 C 16.193511 9.0082857 15.279297 10.217795 15.279297 11.640625 C 15.279297 13.019522 16.137626 14.19805 17.349609 14.669922 L 17.349609 21.746094 C 17.349609 22.372726 17.853837 22.876953 18.480469 22.876953 C 19.107101 22.876953 19.611328 22.372726 19.611328 21.746094 L 19.611328 14.705078 C 20.873049 14.258837 21.777344 13.055186 21.777344 11.640625 C 21.777344 10.217795 20.86313 9.0082856 19.589844 8.5683594 L 19.589844 11.576172 C 19.589844 12.202804 19.115453 12.707031 18.527344 12.707031 C 17.939234 12.707031 17.466797 12.202804 17.466797 11.576172 L 17.466797 8.5683594 z " /> diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg.import b/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg.import new file mode 100644 index 0000000..08632e3 --- /dev/null +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg.import @@ -0,0 +1,18 @@ +[remap] + +importer="svg" +type="DPITexture" +uid="uid://fa7tdmldi206" +path="res://.godot/imported/PropsFile.svg-893cbb231ed52552fc392981ba695c0b.dpitex" + +[deps] + +source_file="res://Features/SolutionExplorer/Resources/FileExtensions/GenericFileAdornments/PropsFile.svg" +dest_files=["res://.godot/imported/PropsFile.svg-893cbb231ed52552fc392981ba695c0b.dpitex"] + +[params] + +base_scale=1.0 +saturation=1.0 +color_map={} +compress=true diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.FileIcons.cs b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.FileIcons.cs index 63f2a41..88ab9e1 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.FileIcons.cs +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.FileIcons.cs @@ -12,8 +12,11 @@ public partial class SolutionExplorerPanel private readonly Texture2D _htmlIcon = ResourceLoader.Load("uid://q0cktiwdkt1e"); private readonly Texture2D _cssIcon = ResourceLoader.Load("uid://b6m4rm5u8hd1c"); private readonly Texture2D _txtIcon = ResourceLoader.Load("uid://b6bpjhs2o1j2l"); + private readonly Texture2D _genericFileIcon = ResourceLoader.Load("uid://bile1h6sq0l08"); + + private readonly Texture2D _propsFileOverlayIcon = ResourceLoader.Load("uid://fa7tdmldi206"); - private Texture2D GetIconForFileExtension(string fileExtension) + private (Texture2D Icon, Texture2D? OverlayIcon) GetIconForFileExtension(string fileExtension) { var texture = fileExtension switch { @@ -24,8 +27,15 @@ public partial class SolutionExplorerPanel ".html" or ".htm" => _htmlIcon, ".css" => _cssIcon, ".txt" => _txtIcon, + ".props" => _genericFileIcon, _ => _csIcon - }; - return texture; + }; + var overlayTexture = fileExtension switch + { + ".props" => _propsFileOverlayIcon, + _ => null + }; + + return (texture, overlayTexture); } } \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs index 7c8607b..a9aaf5a 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs @@ -299,7 +299,9 @@ public partial class SolutionExplorerPanel : MarginContainer } var fileItem = tree.CreateItem(parent, newStartingIndex); fileItem.SetText(0, sharpIdeFile.Name); - fileItem.SetIcon(0, GetIconForFileExtension(sharpIdeFile.Extension)); + var (icon, overlayIcon) = GetIconForFileExtension(sharpIdeFile.Extension); + fileItem.SetIcon(0, icon); + if (overlayIcon is not null) fileItem.SetIconOverlay(0, overlayIcon); fileItem.SetCustomColor(0, GetColorForGitStatus(sharpIdeFile.GitStatus)); fileItem.SetMetadata(0, new RefCountedContainer(sharpIdeFile));