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:
+21
-3
@@ -1,5 +1,10 @@
|
|||||||
use nih_plug::prelude::*;
|
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;
|
use std::sync::Arc;
|
||||||
|
|
||||||
mod dsp;
|
mod dsp;
|
||||||
@@ -265,6 +270,7 @@ impl Plugin for Codename206 {
|
|||||||
|
|
||||||
fn editor(&mut self, _async_executor: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
fn editor(&mut self, _async_executor: AsyncExecutor<Self>) -> Option<Box<dyn Editor>> {
|
||||||
let params = self.params.clone();
|
let params = self.params.clone();
|
||||||
|
let egui_state = self.params.editor_state.clone();
|
||||||
create_egui_editor(
|
create_egui_editor(
|
||||||
self.params.editor_state.clone(),
|
self.params.editor_state.clone(),
|
||||||
(),
|
(),
|
||||||
@@ -289,19 +295,30 @@ impl Plugin for Codename206 {
|
|||||||
ui.add(widgets::ParamSlider::for_param(&p.bypass, setter));
|
ui.add(widgets::ParamSlider::for_param(&p.bypass, setter));
|
||||||
};
|
};
|
||||||
|
|
||||||
egui::CentralPanel::default().show(egui_ctx, |ui| {
|
// 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);
|
ui.heading(Self::NAME);
|
||||||
ui.horizontal(|ui| {
|
// 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.label("Xover Lo/Mid");
|
||||||
ui.add(widgets::ParamSlider::for_param(¶ms.crossover_low_hz, setter));
|
ui.add(widgets::ParamSlider::for_param(¶ms.crossover_low_hz, setter));
|
||||||
|
ui.end_row();
|
||||||
ui.label("Xover Mid/Hi");
|
ui.label("Xover Mid/Hi");
|
||||||
ui.add(widgets::ParamSlider::for_param(¶ms.crossover_high_hz, setter));
|
ui.add(widgets::ParamSlider::for_param(¶ms.crossover_high_hz, setter));
|
||||||
|
ui.end_row();
|
||||||
ui.label("Look-ahead");
|
ui.label("Look-ahead");
|
||||||
ui.add(widgets::ParamSlider::for_param(¶ms.look_ahead_ms, setter));
|
ui.add(widgets::ParamSlider::for_param(¶ms.look_ahead_ms, setter));
|
||||||
|
ui.end_row();
|
||||||
ui.label("Ceiling");
|
ui.label("Ceiling");
|
||||||
ui.add(widgets::ParamSlider::for_param(¶ms.output_ceiling_db, setter));
|
ui.add(widgets::ParamSlider::for_param(¶ms.output_ceiling_db, setter));
|
||||||
|
ui.end_row();
|
||||||
ui.label("Lim Release");
|
ui.label("Lim Release");
|
||||||
ui.add(widgets::ParamSlider::for_param(¶ms.limiter_release_ms, setter));
|
ui.add(widgets::ParamSlider::for_param(¶ms.limiter_release_ms, setter));
|
||||||
|
ui.end_row();
|
||||||
});
|
});
|
||||||
ui.separator();
|
ui.separator();
|
||||||
ui.columns(4, |cols| {
|
ui.columns(4, |cols| {
|
||||||
@@ -311,6 +328,7 @@ impl Plugin for Codename206 {
|
|||||||
band_col(&mut cols[3], "ALL", ¶ms.all);
|
band_col(&mut cols[3], "ALL", ¶ms.all);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user