From abb0197980d8d9378d23a4e820de7b3d268036f7 Mon Sep 17 00:00:00 2001 From: kesac Date: Sat, 15 Jun 2024 21:44:06 -0600 Subject: [PATCH] GraphemeEditors can now enable or disable the grapheme pool they control --- .../Syllabore.Visualizer/GraphemeEditor.cs | 26 +++++++++++ .../Syllabore.Visualizer/GraphemeEditor.tscn | 43 +++++++++++++------ 2 files changed, 55 insertions(+), 14 deletions(-) diff --git a/Syllabore/Syllabore.Visualizer/GraphemeEditor.cs b/Syllabore/Syllabore.Visualizer/GraphemeEditor.cs index 019bed8..2cb0327 100644 --- a/Syllabore/Syllabore.Visualizer/GraphemeEditor.cs +++ b/Syllabore/Syllabore.Visualizer/GraphemeEditor.cs @@ -16,6 +16,13 @@ protected virtual void OnVSliderChanged(float value) GraphemeEditorChanged?.Invoke(); } + protected virtual void OnCheckBoxToggled(bool buttonPressed) + { + this.UpdateEnabledStatus(); + this.GetNode("LeftPanel/CheckBox").ReleaseFocus(); + GraphemeEditorChanged?.Invoke(); + } + public string LabelText { get @@ -41,6 +48,19 @@ public string Text } } + public bool Enabled + { + get + { + return this.GetNode("LeftPanel/CheckBox").ButtonPressed; + } + set + { + this.GetNode("LeftPanel/CheckBox").ButtonPressed = value; + this.UpdateEnabledStatus(); + } + } + public double Probability { get @@ -56,6 +76,12 @@ public double Probability } } + public void UpdateEnabledStatus() + { + this.GetNode("LeftPanel/TextEdit").Editable = this.Enabled; + this.GetNode("RightPanel/VSlider").Editable = this.Enabled; + } + private void UpdatePercentageLabel(double value) { this.GetNode