add: air alarm scrubber select all gases button (#39296)

* add select all gases button

* now make it work

* localize

* refactor

* remove redundant Orientation

Co-authored-by: Perry Fraser <perryprog@users.noreply.github.com>

* remove useless HorizontalExpand

Co-authored-by: Perry Fraser <perryprog@users.noreply.github.com>

* add nice newline

Co-authored-by: Perry Fraser <perryprog@users.noreply.github.com>

* deduplicate Enum.GetValues<Gas> usage

---------

Co-authored-by: Perry Fraser <perryprog@users.noreply.github.com>
This commit is contained in:
qwerltaz
2025-08-05 02:34:10 +02:00
committed by GitHub
parent 1d07b77707
commit 2c933c8de7
3 changed files with 25 additions and 2 deletions

View File

@@ -22,6 +22,8 @@ public sealed partial class ScrubberControl : BoxContainer
private FloatSpinBox _volumeRate => CVolumeRate;
private CheckBox _wideNet => CWideNet;
private Button _copySettings => CCopySettings;
private Button _selectAll => CSelectAll;
private Button _deselectAll => CDeselectAll;
private GridContainer _gases => CGasContainer;
private Dictionary<Gas, Button> _gasControls = new();
@@ -78,7 +80,20 @@ public sealed partial class ScrubberControl : BoxContainer
ScrubberDataCopied?.Invoke(_data);
};
foreach (var value in Enum.GetValues<Gas>())
var allGases = Enum.GetValues<Gas>();
_selectAll.OnPressed += _ =>
{
_data.FilterGases = new HashSet<Gas>(allGases);
ScrubberDataChanged?.Invoke(_address, _data);
};
_deselectAll.OnPressed += _ =>
{
_data.FilterGases = [];
ScrubberDataChanged?.Invoke(_address, _data);
};
foreach (var value in allGases)
{
var gasButton = new Button
{