fix: resizable, scrollable editor so all controls stay reachable

The global controls were one non-wrapping horizontal row that pushed Ceiling off
the right edge, and the window was fixed-size, so some controls (Ceiling, the full
'All' column) couldn't be reached. Wrapped the editor in a ResizableWindow, moved
the global controls into a vertical label|slider grid, and put everything in a
vertical ScrollArea. Placeholder layout still (Stage 6 replaces it), just usable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mikkeli Matlock
2026-06-19 15:49:46 +09:00
parent f6c45123fa
commit 263d5e688f
+40 -22
View File
@@ -1,5 +1,10 @@
use nih_plug::prelude::*;
use nih_plug_egui::{create_egui_editor, egui, widgets, EguiState};
use nih_plug_egui::{
create_egui_editor,
egui::{self, Vec2},
resizable_window::ResizableWindow,
widgets, EguiState,
};
use std::sync::Arc;
mod dsp;
@@ -265,6 +270,7 @@ impl Plugin for Codename206 {
fn editor(&mut self, _async_executor: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
let params = self.params.clone();
let egui_state = self.params.editor_state.clone();
create_egui_editor(
self.params.editor_state.clone(),
(),
@@ -289,28 +295,40 @@ impl Plugin for Codename206 {
ui.add(widgets::ParamSlider::for_param(&p.bypass, setter));
};
egui::CentralPanel::default().show(egui_ctx, |ui| {
ui.heading(Self::NAME);
ui.horizontal(|ui| {
ui.label("Xover Lo/Mid");
ui.add(widgets::ParamSlider::for_param(&params.crossover_low_hz, setter));
ui.label("Xover Mid/Hi");
ui.add(widgets::ParamSlider::for_param(&params.crossover_high_hz, setter));
ui.label("Look-ahead");
ui.add(widgets::ParamSlider::for_param(&params.look_ahead_ms, setter));
ui.label("Ceiling");
ui.add(widgets::ParamSlider::for_param(&params.output_ceiling_db, setter));
ui.label("Lim Release");
ui.add(widgets::ParamSlider::for_param(&params.limiter_release_ms, setter));
// Resizable window; vertical scroll so every control stays reachable even when the
// window is small. (Placeholder layout — Stage 6 will replace it.)
ResizableWindow::new("editor")
.min_size(Vec2::new(480.0, 320.0))
.show(egui_ctx, egui_state.as_ref(), |ui| {
egui::ScrollArea::vertical().show(ui, |ui| {
ui.heading(Self::NAME);
// Global controls stacked vertically so they never overflow sideways.
egui::Grid::new("globals").num_columns(2).show(ui, |ui| {
ui.label("Xover Lo/Mid");
ui.add(widgets::ParamSlider::for_param(&params.crossover_low_hz, setter));
ui.end_row();
ui.label("Xover Mid/Hi");
ui.add(widgets::ParamSlider::for_param(&params.crossover_high_hz, setter));
ui.end_row();
ui.label("Look-ahead");
ui.add(widgets::ParamSlider::for_param(&params.look_ahead_ms, setter));
ui.end_row();
ui.label("Ceiling");
ui.add(widgets::ParamSlider::for_param(&params.output_ceiling_db, setter));
ui.end_row();
ui.label("Lim Release");
ui.add(widgets::ParamSlider::for_param(&params.limiter_release_ms, setter));
ui.end_row();
});
ui.separator();
ui.columns(4, |cols| {
band_col(&mut cols[0], "LOW", &params.low);
band_col(&mut cols[1], "MID", &params.mid);
band_col(&mut cols[2], "HIGH", &params.high);
band_col(&mut cols[3], "ALL", &params.all);
});
});
});
ui.separator();
ui.columns(4, |cols| {
band_col(&mut cols[0], "LOW", &params.low);
band_col(&mut cols[1], "MID", &params.mid);
band_col(&mut cols[2], "HIGH", &params.high);
band_col(&mut cols[3], "ALL", &params.all);
});
});
},
)
}