diff --git a/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs b/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs index d6fe54c..7d56e39 100644 --- a/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs +++ b/src/SharpIDE.Godot/Features/BottomPanel/BottomPanelManager.cs @@ -1,13 +1,25 @@ using Godot; +using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence; +using SharpIDE.Godot.Features.Problems; namespace SharpIDE.Godot.Features.BottomPanel; public partial class BottomPanelManager : Panel { + public SharpIdeSolutionModel? Solution + { + get; + set + { + field = value; + _problemsPanel.Solution = value; + } + } + private Control _runPanel = null!; private Control _debugPanel = null!; private Control _buildPanel = null!; - private Control _problemsPanel = null!; + private ProblemsPanel _problemsPanel = null!; private Dictionary _panelTypeMap = []; @@ -16,7 +28,7 @@ public partial class BottomPanelManager : Panel _runPanel = GetNode("%RunPanel"); _debugPanel = GetNode("%DebugPanel"); _buildPanel = GetNode("%BuildPanel"); - _problemsPanel = GetNode("%ProblemsPanel"); + _problemsPanel = GetNode("%ProblemsPanel"); _panelTypeMap = new Dictionary { diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs b/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs new file mode 100644 index 0000000..5fedc43 --- /dev/null +++ b/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs @@ -0,0 +1,8 @@ +using Godot; + +namespace SharpIDE.Godot.Features.Problems; + +public partial class ProblemEntry : Control +{ + +} \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs.uid b/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs.uid new file mode 100644 index 0000000..8119a60 --- /dev/null +++ b/src/SharpIDE.Godot/Features/Problems/ProblemEntry.cs.uid @@ -0,0 +1 @@ +uid://dkgiknux4rqit diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs new file mode 100644 index 0000000..41c3d12 --- /dev/null +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs @@ -0,0 +1,30 @@ +using System.Collections.Specialized; +using Godot; +using ObservableCollections; +using R3; +using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence; + +namespace SharpIDE.Godot.Features.Problems; + +public partial class ProblemsPanel : Control +{ + private PackedScene _problemsPanelProjectEntryScene = GD.Load("uid://do72lghjvfdp3"); + private VBoxContainer _vBoxContainer = null!; + // TODO: Use observable collections in the solution model and downwards + public SharpIdeSolutionModel? Solution { get; set; } + private readonly ObservableHashSet _projects = []; + + public override void _Ready() + { + Observable.EveryValueChanged(this, manager => manager.Solution) + .Where(s => s is not null) + .Subscribe(s => + { + GD.Print($"ProblemsPanel: Solution changed to {s?.Name ?? "null"}"); + _projects.Clear(); + _projects.AddRange(s!.AllProjects); + }); + _vBoxContainer = GetNode("ScrollContainer/VBoxContainer"); + _vBoxContainer.BindChildren(_projects, _problemsPanelProjectEntryScene); + } +} \ No newline at end of file diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs.uid b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs.uid new file mode 100644 index 0000000..76ad7ea --- /dev/null +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.cs.uid @@ -0,0 +1 @@ +uid://b1r3no4u3khik diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn index 1c30411..ff60dc8 100644 --- a/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanel.tscn @@ -1,4 +1,7 @@ -[gd_scene format=3 uid="uid://tqpmww430cor"] +[gd_scene load_steps=3 format=3 uid="uid://tqpmww430cor"] + +[ext_resource type="Script" uid="uid://b1r3no4u3khik" path="res://Features/Problems/ProblemsPanel.cs" id="1_bnenc"] +[ext_resource type="PackedScene" uid="uid://do72lghjvfdp3" path="res://Features/Problems/ProblemsPanelProjectEntry.tscn" id="2_xj8le"] [node name="ProblemsPanel" type="Control"] layout_mode = 3 @@ -7,3 +10,23 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +script = ExtResource("1_bnenc") + +[node name="ScrollContainer" type="ScrollContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="ProblemsPanelProjectEntry" parent="ScrollContainer/VBoxContainer" instance=ExtResource("2_xj8le")] +layout_mode = 2 + +[node name="ProblemsPanelProjectEntry2" parent="ScrollContainer/VBoxContainer" instance=ExtResource("2_xj8le")] +layout_mode = 2 diff --git a/src/SharpIDE.Godot/Features/Problems/ProblemsPanelProjectEntry.cs b/src/SharpIDE.Godot/Features/Problems/ProblemsPanelProjectEntry.cs new file mode 100644 index 0000000..60d0235 --- /dev/null +++ b/src/SharpIDE.Godot/Features/Problems/ProblemsPanelProjectEntry.cs @@ -0,0 +1,14 @@ +using Godot; +using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence; + +namespace SharpIDE.Godot.Features.Problems; + +public partial class ProblemsPanelProjectEntry : MarginContainer +{ + public SharpIdeProjectModel Project { get; set; } = null!; + + public override void _Ready() + { + GetNode