run panel and run menu v1
This commit is contained in:
BIN
src/SharpIDE.Godot/Features/Run/Play.png
Normal file
BIN
src/SharpIDE.Godot/Features/Run/Play.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 291 B |
34
src/SharpIDE.Godot/Features/Run/Play.png.import
Normal file
34
src/SharpIDE.Godot/Features/Run/Play.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bnprs1lvjyaji"
|
||||||
|
path="res://.godot/imported/Play.png-f33bbb4899ca2148d51910992d85a9eb.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Features/Run/Play.png"
|
||||||
|
dest_files=["res://.godot/imported/Play.png-f33bbb4899ca2148d51910992d85a9eb.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
33
src/SharpIDE.Godot/Features/Run/RunPanel.cs
Normal file
33
src/SharpIDE.Godot/Features/Run/RunPanel.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using GDExtensionBindgen;
|
||||||
|
using Godot;
|
||||||
|
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
|
||||||
|
namespace SharpIDE.Godot.Features.Run;
|
||||||
|
|
||||||
|
public partial class RunPanel : Control
|
||||||
|
{
|
||||||
|
private Terminal _terminal = null!;
|
||||||
|
private TabBar _tabBar = null!;
|
||||||
|
private Panel _tabsPanel = null!;
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_tabBar = GetNode<TabBar>("%TabBar");
|
||||||
|
_tabsPanel = GetNode<Panel>("%TabsPanel");
|
||||||
|
var test = GetNode<Control>("VBoxContainer/TabsPanel/Terminal");
|
||||||
|
_terminal = new Terminal(test);
|
||||||
|
_terminal.Write("Hello from SharpIDE.Godot!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
//_terminal.Write("a");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NewRunStarted(SharpIdeProjectModel projectModel)
|
||||||
|
{
|
||||||
|
var terminal = new Terminal();
|
||||||
|
_tabBar.AddTab(projectModel.Name);
|
||||||
|
_tabsPanel.AddChild(terminal);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/SharpIDE.Godot/Features/Run/RunPanel.cs.uid
Normal file
1
src/SharpIDE.Godot/Features/Run/RunPanel.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://ddivigavjclyb
|
||||||
42
src/SharpIDE.Godot/Features/Run/RunPanel.tscn
Normal file
42
src/SharpIDE.Godot/Features/Run/RunPanel.tscn
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://bcoytt3bw0gpe"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://ddivigavjclyb" path="res://Features/Run/RunPanel.cs" id="1_sq1l4"]
|
||||||
|
|
||||||
|
[node name="RunPanel" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_sq1l4")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/separation = 0
|
||||||
|
|
||||||
|
[node name="TabBar" type="TabBar" parent="VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
current_tab = 0
|
||||||
|
tab_close_display_policy = 2
|
||||||
|
tab_count = 1
|
||||||
|
tab_0/title = "WebApi"
|
||||||
|
|
||||||
|
[node name="TabsPanel" type="Panel" parent="VBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Terminal" type="Terminal" parent="VBoxContainer/TabsPanel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
1
src/SharpIDE.Godot/GlobalUsings.cs
Normal file
1
src/SharpIDE.Godot/GlobalUsings.cs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
global using static SharpIDE.Godot.NodeExtensions;
|
||||||
1
src/SharpIDE.Godot/GlobalUsings.cs.uid
Normal file
1
src/SharpIDE.Godot/GlobalUsings.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dv0ry6n8t1vb
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Microsoft.Build.Locator;
|
using Microsoft.Build.Locator;
|
||||||
using SharpIDE.Application.Features.Analysis;
|
using SharpIDE.Application.Features.Analysis;
|
||||||
using SharpIDE.Application.Features.Debugging;
|
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
using SharpIDE.Godot.Features.Run;
|
||||||
|
|
||||||
namespace SharpIDE.Godot;
|
namespace SharpIDE.Godot;
|
||||||
|
|
||||||
@@ -15,39 +15,62 @@ public partial class IdeRoot : Control
|
|||||||
private FileDialog _fileDialog = null!;
|
private FileDialog _fileDialog = null!;
|
||||||
private SharpIdeCodeEdit _sharpIdeCodeEdit = null!;
|
private SharpIdeCodeEdit _sharpIdeCodeEdit = null!;
|
||||||
private SolutionExplorerPanel _solutionExplorerPanel = null!;
|
private SolutionExplorerPanel _solutionExplorerPanel = null!;
|
||||||
|
private RunPanel _runPanel = null!;
|
||||||
|
private MenuButton _runMenuButton = null!;
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
MSBuildLocator.RegisterDefaults();
|
MSBuildLocator.RegisterDefaults();
|
||||||
|
|
||||||
_openSlnButton = GetNode<Button>("%OpenSlnButton");
|
_openSlnButton = GetNode<Button>("%OpenSlnButton");
|
||||||
|
_runMenuButton = GetNode<MenuButton>("%RunMenuButton");
|
||||||
|
var popup = _runMenuButton.GetPopup();
|
||||||
|
popup.HideOnItemSelection = false;
|
||||||
|
|
||||||
_sharpIdeCodeEdit = GetNode<SharpIdeCodeEdit>("%SharpIdeCodeEdit");
|
_sharpIdeCodeEdit = GetNode<SharpIdeCodeEdit>("%SharpIdeCodeEdit");
|
||||||
_fileDialog = GetNode<FileDialog>("%OpenSolutionDialog");
|
_fileDialog = GetNode<FileDialog>("%OpenSolutionDialog");
|
||||||
_solutionExplorerPanel = GetNode<SolutionExplorerPanel>("%SolutionExplorerPanel");
|
_solutionExplorerPanel = GetNode<SolutionExplorerPanel>("%SolutionExplorerPanel");
|
||||||
_fileDialog.FileSelected += OnFileSelected;
|
_fileDialog.FileSelected += OnFileSelected;
|
||||||
|
_runPanel = GetNode<RunPanel>("%RunPanel");
|
||||||
_openSlnButton.Pressed += () => _fileDialog.Visible = true;
|
_openSlnButton.Pressed += () => _fileDialog.Visible = true;
|
||||||
//_fileDialog.Visible = true;
|
//_fileDialog.Visible = true;
|
||||||
var test = new DebuggingService();
|
|
||||||
_ = test.Test();
|
|
||||||
OnFileSelected(@"C:\Users\Matthew\Documents\Git\BlazorCodeBreaker\BlazorCodeBreaker.slnx");
|
OnFileSelected(@"C:\Users\Matthew\Documents\Git\BlazorCodeBreaker\BlazorCodeBreaker.slnx");
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnFileSelected(string path)
|
private void OnFileSelected(string path)
|
||||||
{
|
{
|
||||||
try
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
GD.Print($"Selected: {path}");
|
try
|
||||||
var solutionModel = await VsPersistenceMapper.GetSolutionModel(path);
|
{
|
||||||
_solutionExplorerPanel.SolutionModel = solutionModel;
|
GD.Print($"Selected: {path}");
|
||||||
_solutionExplorerPanel.RepopulateTree();
|
var solutionModel = await VsPersistenceMapper.GetSolutionModel(path);
|
||||||
RoslynAnalysis.StartSolutionAnalysis(path);
|
_solutionExplorerPanel.SolutionModel = solutionModel;
|
||||||
var infraProject = solutionModel.AllProjects.Single(s => s.Name == "Infrastructure");
|
Callable.From(_solutionExplorerPanel.RepopulateTree).CallDeferred();
|
||||||
var diFile = infraProject.Files.Single(s => s.Name == "DependencyInjection.cs");
|
RoslynAnalysis.StartSolutionAnalysis(path);
|
||||||
await _sharpIdeCodeEdit.SetSharpIdeFile(diFile);
|
var infraProject = solutionModel.AllProjects.Single(s => s.Name == "Infrastructure");
|
||||||
}
|
var diFile = infraProject.Files.Single(s => s.Name == "DependencyInjection.cs");
|
||||||
catch (Exception e)
|
await this.InvokeAsync(async () => await _sharpIdeCodeEdit.SetSharpIdeFile(diFile));
|
||||||
{
|
|
||||||
GD.PrintErr($"Error loading solution: {e.Message}");
|
var tasks = solutionModel.AllProjects.Select(p => p.MsBuildEvaluationProjectTask).ToList();
|
||||||
GD.PrintErr(e.StackTrace);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
}
|
var runnableProjects = solutionModel.AllProjects.Where(p => p.IsRunnable).ToList();
|
||||||
|
await this.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
var popup = _runMenuButton.GetPopup();
|
||||||
|
foreach (var project in runnableProjects)
|
||||||
|
{
|
||||||
|
popup.AddItem(project.Name);
|
||||||
|
}
|
||||||
|
_runMenuButton.Disabled = false;
|
||||||
|
});
|
||||||
|
//var runnableProject = solutionModel.AllProjects.First(s => s.IsRunnable);
|
||||||
|
//await this.InvokeAsync(() => _runPanel.NewRunStarted(runnableProject));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
GD.PrintErr($"Error loading solution: {e.Message}");
|
||||||
|
GD.PrintErr(e.StackTrace);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://b2oniigcp5ew5"]
|
[gd_scene load_steps=8 format=3 uid="uid://b2oniigcp5ew5"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bavypuy7b375x" path="res://IdeRoot.cs" id="1_whawi"]
|
[ext_resource type="Script" uid="uid://bavypuy7b375x" path="res://IdeRoot.cs" id="1_whawi"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bnprs1lvjyaji" path="res://Features/Run/Play.png" id="2_8x8ub"]
|
||||||
[ext_resource type="Script" uid="uid://du2lt7r1p1qfy" path="res://SharpIdeCodeEdit.cs" id="2_qjf5e"]
|
[ext_resource type="Script" uid="uid://du2lt7r1p1qfy" path="res://SharpIdeCodeEdit.cs" id="2_qjf5e"]
|
||||||
[ext_resource type="FontFile" uid="uid://7jc0nj310cu6" path="res://CascadiaCode.ttf" id="2_rk34b"]
|
[ext_resource type="FontFile" uid="uid://7jc0nj310cu6" path="res://CascadiaCode.ttf" id="2_rk34b"]
|
||||||
[ext_resource type="Script" uid="uid://bai53k7ongbxw" path="res://SolutionExplorerPanel.cs" id="2_tcy02"]
|
[ext_resource type="Script" uid="uid://bai53k7ongbxw" path="res://SolutionExplorerPanel.cs" id="2_tcy02"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bcoytt3bw0gpe" path="res://Features/Run/RunPanel.tscn" id="5_y3aoi"]
|
||||||
|
|
||||||
[sub_resource type="FontVariation" id="FontVariation_y3aoi"]
|
[sub_resource type="FontVariation" id="FontVariation_y3aoi"]
|
||||||
base_font = ExtResource("2_rk34b")
|
base_font = ExtResource("2_rk34b")
|
||||||
@@ -29,16 +31,32 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="VBoxContainer"]
|
[node name="Panel" type="Panel" parent="VBoxContainer"]
|
||||||
custom_minimum_size = Vector2(0, 40)
|
custom_minimum_size = Vector2(0, 42)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="OpenSlnButton" type="Button" parent="VBoxContainer/Panel"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="OpenSlnButton" type="Button" parent="VBoxContainer/Panel/HBoxContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 0
|
layout_mode = 2
|
||||||
offset_right = 78.0
|
|
||||||
offset_bottom = 31.0
|
|
||||||
text = "Open Sln"
|
text = "Open Sln"
|
||||||
|
|
||||||
|
[node name="Spacer" type="Control" parent="VBoxContainer/Panel/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="RunMenuButton" type="MenuButton" parent="VBoxContainer/Panel/HBoxContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
disabled = true
|
||||||
|
icon = ExtResource("2_8x8ub")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
@@ -95,6 +113,10 @@ item_0/id = 0
|
|||||||
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer/VSplitContainer"]
|
[node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer/VSplitContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="RunPanel" parent="VBoxContainer/HBoxContainer/VSplitContainer/Panel" instance=ExtResource("5_y3aoi")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 1
|
||||||
|
|
||||||
[node name="OpenSolutionDialog" type="FileDialog" parent="."]
|
[node name="OpenSolutionDialog" type="FileDialog" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
title = "Open a File"
|
title = "Open a File"
|
||||||
|
|||||||
39
src/SharpIDE.Godot/NodeExtensions.cs
Normal file
39
src/SharpIDE.Godot/NodeExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace SharpIDE.Godot;
|
||||||
|
|
||||||
|
public static class NodeExtensions
|
||||||
|
{
|
||||||
|
public static Task InvokeAsync(this Node node, Action workItem)
|
||||||
|
{
|
||||||
|
var taskCompletionSource = new TaskCompletionSource();
|
||||||
|
//WorkerThreadPool.AddTask();
|
||||||
|
Callable.From(() =>
|
||||||
|
{
|
||||||
|
workItem();
|
||||||
|
taskCompletionSource.SetResult();
|
||||||
|
}).CallDeferred();
|
||||||
|
return taskCompletionSource.Task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task InvokeAsync(this Node node, Func<Task> workItem)
|
||||||
|
{
|
||||||
|
var taskCompletionSource = new TaskCompletionSource();
|
||||||
|
//WorkerThreadPool.AddTask();
|
||||||
|
Callable.From(async void () =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await workItem();
|
||||||
|
taskCompletionSource.SetResult();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
taskCompletionSource.SetException(ex);
|
||||||
|
}
|
||||||
|
}).CallDeferred();
|
||||||
|
return taskCompletionSource.Task;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/SharpIDE.Godot/NodeExtensions.cs.uid
Normal file
1
src/SharpIDE.Godot/NodeExtensions.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cpdxatadoqpmm
|
||||||
Reference in New Issue
Block a user