nav history v2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Godot;
|
||||
using R3;
|
||||
using SharpIDE.Application.Features.NavigationHistory;
|
||||
|
||||
namespace SharpIDE.Godot.Features.Navigation;
|
||||
@@ -14,5 +15,24 @@ public partial class ForwardBackwardButtonContainer : HBoxContainer
|
||||
{
|
||||
_backwardButton = GetNode<Button>("BackwardButton");
|
||||
_forwardButton = GetNode<Button>("ForwardButton");
|
||||
_backwardButton.Pressed += OnBackwardButtonPressed;
|
||||
_forwardButton.Pressed += OnForwardButtonPressed;
|
||||
Observable.EveryValueChanged(_navigationHistoryService, navigationHistoryService => navigationHistoryService.Current)
|
||||
.Where(s => s is not null)
|
||||
.Subscribe(s =>
|
||||
{
|
||||
_backwardButton.Disabled = !_navigationHistoryService.CanGoBack;
|
||||
_forwardButton.Disabled = !_navigationHistoryService.CanGoForward;
|
||||
}).AddTo(this);
|
||||
}
|
||||
|
||||
private void OnBackwardButtonPressed()
|
||||
{
|
||||
_navigationHistoryService.GoBack();
|
||||
}
|
||||
|
||||
private void OnForwardButtonPressed()
|
||||
{
|
||||
_navigationHistoryService.GoForward();
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,12 @@
|
||||
[node name="ForwardBackwardButtonContainer" type="HBoxContainer"]
|
||||
script = ExtResource("1_vep4b")
|
||||
|
||||
[node name="ForwardButton" type="Button" parent="."]
|
||||
[node name="BackwardButton" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
text = " < "
|
||||
|
||||
[node name="BackwardButton" type="Button" parent="."]
|
||||
[node name="ForwardButton" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
text = " > "
|
||||
|
||||
@@ -104,7 +104,6 @@ public partial class SolutionExplorerPanel : MarginContainer
|
||||
_tree.QueueRedraw();
|
||||
});
|
||||
}
|
||||
_navigationHistoryService.RecordNavigation(file, fileLinePosition ?? new SharpIdeFileLinePosition(0, 0));
|
||||
await task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user