ui scale spinbox

This commit is contained in:
Matt Parker
2025-11-18 00:09:12 +10:00
parent 7775f1100b
commit 761367cc17
4 changed files with 23 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ public class IdeSettings
{
public bool AutoOpenLastSolution { get; set; }
public string? DebuggerExecutablePath { get; set; }
public float UiScale { get; set; } = 1.0f;
}
public record RecentSln

View File

@@ -4,8 +4,20 @@ namespace SharpIDE.Godot.Features.Settings;
public partial class SettingsWindow : Window
{
private SpinBox _uiScaleSpinBox = null!;
public override void _Ready()
{
CloseRequested += Hide;
CloseRequested += Hide;
_uiScaleSpinBox = GetNode<SpinBox>("%UiScaleSpinBox");
//_uiScaleSlider.Value = Singletons.AppState.IdeSettings.UiScale;
_uiScaleSpinBox.ValueChanged += OnUiScaleSpinBoxValueChanged;
}
private void OnUiScaleSpinBoxValueChanged(double value)
{
var valueFloat = (float)value;
Singletons.AppState.IdeSettings.UiScale = valueFloat;
GetTree().GetRoot().ContentScaleFactor = valueFloat;
}
}

View File

@@ -8,6 +8,7 @@ title = "Settings"
initial_position = 2
size = Vector2i(845, 400)
transient = true
transient_to_focused = true
exclusive = true
popup_window = true
popup_wm_hint = true
@@ -27,16 +28,8 @@ layout_mode = 2
layout_mode = 2
text = "UI Scale"
[node name="HSlider" type="HSlider" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
min_value = 0.5
max_value = 8.0
step = 0.1
value = 1.0
[node name="SpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
[node name="UiScaleSpinBox" type="SpinBox" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
min_value = 0.5
max_value = 8.0

View File

@@ -25,6 +25,7 @@ ObservableTrackerRuntimeHook="*res://addons/R3.Godot/ObservableTrackerRuntimeHoo
[display]
window/energy_saving/keep_screen_on=false
window/stretch/scale_mode="integer"
[dotnet]
@@ -34,6 +35,11 @@ project/assembly_name="SharpIDE.Godot"
enabled=PackedStringArray("res://addons/R3.Godot/plugin.cfg", "res://addons/csharp_gdextension_bindgen/plugin.cfg")
[gui]
theme/default_font_multichannel_signed_distance_field=true
theme/default_font_generate_mipmaps=true
[input]
CodeFixes={