1
0
Fork 0

Add a visualizer toggle button to SC

This commit is contained in:
Robbert van der Helm 2023-03-18 15:19:19 +01:00
parent 0d5247ee2f
commit 4e304fc65a

View file

@ -55,6 +55,8 @@ pub enum EditorMode {
#[derive(Lens)] #[derive(Lens)]
struct Data { struct Data {
params: Arc<SpectralCompressorParams>, params: Arc<SpectralCompressorParams>,
editor_mode: Arc<AtomicCell<EditorMode>>,
} }
impl Model for Data {} impl Model for Data {}
@ -77,6 +79,8 @@ pub(crate) fn create(
Data { Data {
params: params.clone(), params: params.clone(),
editor_mode: params.editor_mode.clone(),
} }
.build(cx); .build(cx);
@ -90,6 +94,12 @@ pub(crate) fn create(
fn main_column(cx: &mut Context) { fn main_column(cx: &mut Context) {
VStack::new(cx, |cx| { VStack::new(cx, |cx| {
HStack::new(cx, |cx| {
EditorModeButton::new(cx, Data::editor_mode, "Show visualizer")
// Makes this align a bit nicer with the plugin name
.top(Pixels(2.0))
.left(Pixels(2.0));
HStack::new(cx, |cx| { HStack::new(cx, |cx| {
Label::new(cx, "Spectral Compressor") Label::new(cx, "Spectral Compressor")
.font_family(vec![FamilyOwned::Name(String::from( .font_family(vec![FamilyOwned::Name(String::from(
@ -109,11 +119,15 @@ fn main_column(cx: &mut Context) {
.top(Stretch(1.0)) .top(Stretch(1.0))
.bottom(Pixels(4.0)) .bottom(Pixels(4.0))
.left(Pixels(2.0)); .left(Pixels(2.0));
});
}) })
.height(Pixels(30.0)) .height(Pixels(30.0))
.right(Pixels(-22.0)) .right(Pixels(17.0))
.bottom(Pixels(-5.0)) .bottom(Pixels(-5.0))
.top(Pixels(10.0)); .left(Pixels(10.0))
.top(Pixels(10.0))
// This contains the editor mode buttom all the way on the left, and the plugin's name all the way on the right
.col_between(Stretch(1.0));
HStack::new(cx, |cx| { HStack::new(cx, |cx| {
make_column(cx, "Globals", |cx| { make_column(cx, "Globals", |cx| {