diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs index 8c82d1d..b218471 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.cs @@ -37,7 +37,44 @@ public partial class SolutionExplorerPanel : MarginContainer if (sharpIdeFileContainer is null) return; var sharpIdeFile = sharpIdeFileContainer.Item; Guard.Against.Null(sharpIdeFile, nameof(sharpIdeFile)); - GodotGlobalEvents.Instance.FileSelected.InvokeParallelFireAndForget(sharpIdeFile, null); + + if (mouseButtonIndex is (int)MouseButtonMask.Left) + { + GodotGlobalEvents.Instance.FileSelected.InvokeParallelFireAndForget(sharpIdeFile, null); + } + else if (mouseButtonIndex is (int)MouseButtonMask.Right) + { + var menu = new PopupMenu(); + AddChild(menu); + menu.AddItem("Open", 0); + menu.AddItem("Reveal in File Explorer", 1); + menu.AddSeparator(); + menu.AddItem("Copy Full Path", 2); + menu.PopupHide += () => + { + GD.Print("QueueFree menu"); + menu.QueueFree(); + }; + menu.IdPressed += id => + { + if (id is 0) + { + GodotGlobalEvents.Instance.FileSelected.InvokeParallelFireAndForget(sharpIdeFile, null); + } + else if (id is 1) + { + OS.ShellOpen(Path.GetDirectoryName(sharpIdeFile.Path)!); + } + else if (id is 2) + { + DisplayServer.ClipboardSet(sharpIdeFile.Path); + } + }; + + var globalMousePosition = GetGlobalMousePosition(); + menu.Position = new Vector2I((int)globalMousePosition.X, (int)globalMousePosition.Y); + menu.Popup(); + } } private async Task OnFileExternallySelected(SharpIdeFile file, SharpIdeFileLinePosition? fileLinePosition) diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.tscn b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.tscn index 6f1ec9c..9d57e74 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.tscn +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/SolutionExplorerPanel.tscn @@ -26,3 +26,4 @@ theme_override_colors/font_color = Color(0.830335, 0.830335, 0.830335, 1) theme_override_constants/v_separation = 1 theme_override_constants/inner_item_margin_left = 2 theme_override_constants/draw_guides = 0 +allow_rmb_select = true