From 2d25896763dc1df75ee57481d4608539188b8ea8 Mon Sep 17 00:00:00 2001
From: Whatstone <166147148+whatston3@users.noreply.github.com>
Date: Fri, 18 Sep 2026 04:54:08 +0000
Subject: [PATCH] InstrumentMenu: Channels panel expands with the window
(#46033)
* Vertically expanding channels, -pointless Controls
* scamboni
* XAML control for the base midi CFG item
---
.../Instruments/UI/ChannelsControl.xaml | 54 +++++++++----------
.../Instruments/UI/ChannelsControl.xaml.cs | 3 +-
.../UI/InstrumentBoundUserInterface.cs | 5 +-
.../Instruments/UI/InstrumentMenu.xaml | 2 +-
.../Instruments/UI/InstrumentMenu.xaml.cs | 29 +++-------
.../UI/MidiCollectionUtilsControl.xaml | 31 ++++++-----
.../UI/MidiCollectionUtilsControl.xaml.cs | 3 +-
.../UI/MidiConfigurationControl.xaml | 16 ++++++
.../UI/MidiConfigurationControl.xaml.cs | 7 +++
.../Instruments/UI/MinVolumeControl.xaml | 10 ++--
.../Instruments/UI/MinVolumeControl.xaml.cs | 3 +-
11 files changed, 85 insertions(+), 78 deletions(-)
create mode 100644 Content.Client/Instruments/UI/MidiConfigurationControl.xaml
create mode 100644 Content.Client/Instruments/UI/MidiConfigurationControl.xaml.cs
diff --git a/Content.Client/Instruments/UI/ChannelsControl.xaml b/Content.Client/Instruments/UI/ChannelsControl.xaml
index b3c69d660a..f52b622c5f 100644
--- a/Content.Client/Instruments/UI/ChannelsControl.xaml
+++ b/Content.Client/Instruments/UI/ChannelsControl.xaml
@@ -1,27 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Instruments/UI/ChannelsControl.xaml.cs b/Content.Client/Instruments/UI/ChannelsControl.xaml.cs
index adfebdb6d0..2b688a187c 100644
--- a/Content.Client/Instruments/UI/ChannelsControl.xaml.cs
+++ b/Content.Client/Instruments/UI/ChannelsControl.xaml.cs
@@ -1,5 +1,4 @@
using Robust.Client.AutoGenerated;
-using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Audio.Midi;
@@ -7,7 +6,7 @@ using Robust.Shared.Audio.Midi;
namespace Content.Client.Instruments.UI;
[GenerateTypedNameReferences]
-public sealed partial class ChannelsControl : Control
+public sealed partial class ChannelsControl : BoxContainer
{
///
/// Raised when a channel is toggled.
diff --git a/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs b/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs
index 4daecc86df..92cc856d28 100644
--- a/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs
+++ b/Content.Client/Instruments/UI/InstrumentBoundUserInterface.cs
@@ -85,9 +85,12 @@ public sealed partial class InstrumentBoundUserInterface : BoundUserInterface
// Initialize controls used to configure various system parameters.
// Append any additional configuration controls here.
- _instrumentMenu.AddConfigurationControl(
+ var channels = _instrumentMenu.AddConfigurationControl(
_loc.GetString("instruments-component-menu-channels-label"),
_channelsControl);
+ channels.Panel.VerticalExpand = true;
+ channels.VerticalExpand = true;
+
_instrumentMenu.AddConfigurationControl(
_loc.GetString("instruments-component-midi-file-collection-label"),
_midiCollectionUtilsControl);
diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml b/Content.Client/Instruments/UI/InstrumentMenu.xaml
index f9f024de95..cf58db70a0 100644
--- a/Content.Client/Instruments/UI/InstrumentMenu.xaml
+++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml
@@ -1,7 +1,7 @@
diff --git a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs
index 995d5e95c1..5002389e66 100644
--- a/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs
+++ b/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs
@@ -78,37 +78,22 @@ public sealed partial class InstrumentMenu : FancyWindow
///
/// The string to display on the tab header for this configuration.
/// The control used for this configuration.
- public void AddConfigurationControl(string name, Control ctrl)
+ /// The new control.
+ public MidiConfigurationControl AddConfigurationControl(string name, Control ctrl)
{
var formatted = new FormattedMessage();
- var styleBox = new StyleBoxFlat
- {
- BorderColor = Color.FromHex("#3D4059"),
- BorderThickness = new Thickness(2),
- };
-
- var panel = new PanelContainer
- {
- PanelOverride = styleBox,
- Margin = new Thickness(0, 0, 0, 10),
- };
-
- var header = new RichTextLabel
- {
- StyleClasses = { StyleClass.LabelKeyText },
- Margin = new Thickness(10, 0, 0, 0),
- };
+ var cfgCtrl = new MidiConfigurationControl();
ctrl.VerticalExpand = true;
ctrl.Margin = new Thickness(5);
formatted.AddMarkupOrThrow($"[bold]{name}[/bold]");
- header.SetMessage(formatted, Color.FromHex("#A88B5E"));
+ cfgCtrl.Header.SetMessage(formatted, Color.FromHex("#A88B5E"));
- panel.AddChild(ctrl);
+ cfgCtrl.Panel.AddChild(ctrl);
- ConfigurationItemsContainer.AddChild(header);
- ConfigurationItemsContainer.AddChild(panel);
+ ConfigurationItemsContainer.AddChild(cfgCtrl);
+ return cfgCtrl;
}
///
diff --git a/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml b/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml
index 83ea995ad6..2e4fe9dc00 100644
--- a/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml
+++ b/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml
@@ -1,17 +1,16 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
+
diff --git a/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml.cs b/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml.cs
index de76f01626..0f4d7dcdab 100644
--- a/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml.cs
+++ b/Content.Client/Instruments/UI/MidiCollectionUtilsControl.xaml.cs
@@ -2,7 +2,6 @@ using System.Linq;
using Content.Client.Audio.Midi;
using Content.Client.Stylesheets;
using Robust.Client.AutoGenerated;
-using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.ContentPack;
@@ -10,7 +9,7 @@ using Robust.Shared.ContentPack;
namespace Content.Client.Instruments.UI;
[GenerateTypedNameReferences]
-public sealed partial class MidiCollectionUtilsControl : Control
+public sealed partial class MidiCollectionUtilsControl : BoxContainer
{
[Dependency] private MidiFileCollectionManager _midiCollection = default!;
[Dependency] private IResourceManager _resourceManager = default!;
diff --git a/Content.Client/Instruments/UI/MidiConfigurationControl.xaml b/Content.Client/Instruments/UI/MidiConfigurationControl.xaml
new file mode 100644
index 0000000000..a37dfc1bca
--- /dev/null
+++ b/Content.Client/Instruments/UI/MidiConfigurationControl.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
diff --git a/Content.Client/Instruments/UI/MidiConfigurationControl.xaml.cs b/Content.Client/Instruments/UI/MidiConfigurationControl.xaml.cs
new file mode 100644
index 0000000000..c6dd8d2605
--- /dev/null
+++ b/Content.Client/Instruments/UI/MidiConfigurationControl.xaml.cs
@@ -0,0 +1,7 @@
+using Robust.Client.AutoGenerated;
+using Robust.Client.UserInterface.Controls;
+
+namespace Content.Client.Instruments.UI;
+
+[GenerateTypedNameReferences]
+public sealed partial class MidiConfigurationControl : BoxContainer;
diff --git a/Content.Client/Instruments/UI/MinVolumeControl.xaml b/Content.Client/Instruments/UI/MinVolumeControl.xaml
index 8508d69cf7..631c92a0d8 100644
--- a/Content.Client/Instruments/UI/MinVolumeControl.xaml
+++ b/Content.Client/Instruments/UI/MinVolumeControl.xaml
@@ -1,6 +1,4 @@
-
-
-
-
-
-
+
+
+
+
diff --git a/Content.Client/Instruments/UI/MinVolumeControl.xaml.cs b/Content.Client/Instruments/UI/MinVolumeControl.xaml.cs
index ef22e8088e..5da75bdb99 100644
--- a/Content.Client/Instruments/UI/MinVolumeControl.xaml.cs
+++ b/Content.Client/Instruments/UI/MinVolumeControl.xaml.cs
@@ -1,12 +1,13 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Input;
namespace Content.Client.Instruments.UI;
[GenerateTypedNameReferences]
-public sealed partial class MinVolumeControl : Control
+public sealed partial class MinVolumeControl : BoxContainer
{
///
/// Raised when the user changes the min volume for MIDI input.