1
0
Fork 0

Show the upwards parameter on the left

It makes more sense this way.
This commit is contained in:
Robbert van der Helm 2022-07-24 17:17:10 +02:00
parent 126cf3b141
commit c06b134e93
2 changed files with 37 additions and 37 deletions

View file

@ -102,10 +102,10 @@ pub struct ThresholdParams {
/// Contains the compressor parameters for both the upwards and downwards compressor banks.
#[derive(Params)]
pub struct CompressorBankParams {
#[nested = "downwards"]
pub downwards: Arc<CompressorParams>,
#[nested = "upwards"]
pub upwards: Arc<CompressorParams>,
#[nested = "downwards"]
pub downwards: Arc<CompressorParams>,
}
/// This struct contains the parameters for either the upward or downward compressors. The `Params`

View file

@ -106,41 +106,6 @@ pub(crate) fn create(
.width(Stretch(1.0));
HStack::new(cx, |cx| {
VStack::new(cx, |cx| {
Label::new(cx, "Downwards")
.font(assets::NOTO_SANS_THIN)
.font_size(30.0 * POINT_SCALE)
.left(Stretch(1.0))
.right(Pixels(10.0))
.bottom(Pixels(-10.0));
// We don't want to show the 'Downwards' prefix here, but it should still be in
// the parameter name so the parameter list makes sense
let downwards_compressor_params =
Data::params.map(|p| p.compressors.downwards.clone());
GenericUi::new_custom(
cx,
downwards_compressor_params.clone(),
move |cx, param_ptr| {
let downwards_compressor_params = downwards_compressor_params.clone();
HStack::new(cx, move |cx| {
Label::new(
cx,
unsafe { param_ptr.name() }
.strip_prefix("Downwards ")
.expect("Expected parameter name prefix, this is a bug"),
)
.class("label");
GenericUi::draw_widget(cx, downwards_compressor_params, param_ptr);
})
.class("row");
},
);
})
.width(LEFT_COLUMN_WIDTH)
.height(Auto);
VStack::new(cx, |cx| {
Label::new(cx, "Upwards")
.font(assets::NOTO_SANS_THIN)
@ -149,6 +114,8 @@ pub(crate) fn create(
.right(Pixels(10.0))
.bottom(Pixels(-10.0));
// We don't want to show the 'Upwards' prefix here, but it should still be in
// the parameter name so the parameter list makes sense
let upwards_compressor_params =
Data::params.map(|p| p.compressors.upwards.clone());
GenericUi::new_custom(
@ -173,6 +140,39 @@ pub(crate) fn create(
})
.width(RIGHT_COLUMN_WIDTH)
.height(Auto);
VStack::new(cx, |cx| {
Label::new(cx, "Downwards")
.font(assets::NOTO_SANS_THIN)
.font_size(30.0 * POINT_SCALE)
.left(Stretch(1.0))
.right(Pixels(10.0))
.bottom(Pixels(-10.0));
let downwards_compressor_params =
Data::params.map(|p| p.compressors.downwards.clone());
GenericUi::new_custom(
cx,
downwards_compressor_params.clone(),
move |cx, param_ptr| {
let downwards_compressor_params = downwards_compressor_params.clone();
HStack::new(cx, move |cx| {
Label::new(
cx,
unsafe { param_ptr.name() }
.strip_prefix("Downwards ")
.expect("Expected parameter name prefix, this is a bug"),
)
.class("label");
GenericUi::draw_widget(cx, downwards_compressor_params, param_ptr);
})
.class("row");
},
);
})
.width(LEFT_COLUMN_WIDTH)
.height(Auto);
})
.height(Auto)
.width(Stretch(1.0));