Update Spectral Compressor for upstream changes
This commit is contained in:
parent
0dd58cd4bb
commit
b07220abe8
|
@ -139,11 +139,13 @@ fn main_column(cx: &mut Context) {
|
|||
.top(Stretch(1.0))
|
||||
.bottom(Pixels(4.0))
|
||||
.left(Pixels(2.0));
|
||||
});
|
||||
})
|
||||
.size(Auto);
|
||||
})
|
||||
.height(Pixels(30.0))
|
||||
.right(Pixels(17.0))
|
||||
.bottom(Pixels(-5.0))
|
||||
// Somehow this overrides the 'row-between' value now
|
||||
.bottom(Pixels(8.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
|
||||
|
@ -163,72 +165,59 @@ fn main_column(cx: &mut Context) {
|
|||
use this in a project, make sure to bounce things to audio just in case \
|
||||
they'll sound different later.",
|
||||
)
|
||||
.text_wrap(true)
|
||||
.font_size(11.0)
|
||||
.left(Pixels(15.0))
|
||||
.right(Pixels(8.0))
|
||||
// The column isn't tall enough without this, for some reason
|
||||
.bottom(Pixels(20.0))
|
||||
.width(Stretch(1.0));
|
||||
});
|
||||
})
|
||||
.height(Auto)
|
||||
.width(Stretch(1.0));
|
||||
.size(Auto);
|
||||
|
||||
HStack::new(cx, |cx| {
|
||||
make_column(cx, "Upwards", |cx| {
|
||||
// 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(
|
||||
cx,
|
||||
upwards_compressor_params.clone(),
|
||||
move |cx, param_ptr| {
|
||||
let upwards_compressor_params = upwards_compressor_params.clone();
|
||||
HStack::new(cx, move |cx| {
|
||||
Label::new(
|
||||
cx,
|
||||
unsafe { param_ptr.name() }
|
||||
.strip_prefix("Upwards ")
|
||||
.expect("Expected parameter name prefix, this is a bug"),
|
||||
)
|
||||
.class("label");
|
||||
GenericUi::new_custom(cx, upwards_compressor_params, |cx, param_ptr| {
|
||||
HStack::new(cx, |cx| {
|
||||
Label::new(
|
||||
cx,
|
||||
unsafe { param_ptr.name() }
|
||||
.strip_prefix("Upwards ")
|
||||
.expect("Expected parameter name prefix, this is a bug"),
|
||||
)
|
||||
.class("label");
|
||||
|
||||
GenericUi::draw_widget(cx, upwards_compressor_params, param_ptr);
|
||||
})
|
||||
.class("row");
|
||||
},
|
||||
);
|
||||
GenericUi::draw_widget(cx, upwards_compressor_params, param_ptr);
|
||||
})
|
||||
.class("row");
|
||||
});
|
||||
});
|
||||
|
||||
make_column(cx, "Downwards", |cx| {
|
||||
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::new_custom(cx, downwards_compressor_params, |cx, param_ptr| {
|
||||
HStack::new(cx, |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");
|
||||
},
|
||||
);
|
||||
GenericUi::draw_widget(cx, downwards_compressor_params, param_ptr);
|
||||
})
|
||||
.class("row");
|
||||
});
|
||||
});
|
||||
})
|
||||
.height(Auto)
|
||||
.width(Stretch(1.0));
|
||||
.size(Auto);
|
||||
})
|
||||
.width(Pixels(COLLAPSED_GUI_WIDTH as f32))
|
||||
.row_between(Pixels(15.0))
|
||||
.row_between(Pixels(10.0))
|
||||
.child_left(Stretch(1.0))
|
||||
.child_right(Stretch(1.0));
|
||||
}
|
||||
|
|
|
@ -101,12 +101,8 @@ impl View for Analyzer {
|
|||
// TODO: Display the frequency range below the graph
|
||||
|
||||
// Draw the border last
|
||||
let border_width = match cx.border_width() {
|
||||
Units::Pixels(val) => val,
|
||||
Units::Percentage(val) => bounds.w.min(bounds.h) * (val / 100.0),
|
||||
_ => 0.0,
|
||||
};
|
||||
let border_color: vg::Color = cx.border_color().cloned().unwrap_or_default().into();
|
||||
let border_width = cx.border_width();
|
||||
let border_color: vg::Color = cx.border_color().into();
|
||||
|
||||
let mut path = vg::Path::new();
|
||||
{
|
||||
|
@ -206,7 +202,7 @@ fn draw_spectrum(
|
|||
|
||||
previous_physical_x_coord = physical_x_coord;
|
||||
}
|
||||
canvas.stroke_path(&mut bars_path, &bars_paint);
|
||||
canvas.stroke_path(&bars_path, &bars_paint);
|
||||
|
||||
// The mesh path starts at the bottom left, follows the top envelope of the spectrum analyzer,
|
||||
// and ends in the bottom right
|
||||
|
@ -249,7 +245,7 @@ fn draw_spectrum(
|
|||
0.0,
|
||||
previous_physical_x_coord,
|
||||
0.0,
|
||||
&[
|
||||
[
|
||||
(0.0, lighter_text_color),
|
||||
(0.707, text_color),
|
||||
(1.0, text_color),
|
||||
|
@ -257,7 +253,7 @@ fn draw_spectrum(
|
|||
)
|
||||
// NOTE: This is very important, otherwise this looks all kinds of gnarly
|
||||
.with_anti_alias(false);
|
||||
canvas.fill_path(&mut mesh_path, &mesh_paint);
|
||||
canvas.fill_path(&mesh_path, &mesh_paint);
|
||||
}
|
||||
|
||||
/// Overlays the threshold curve over the spectrum analyzer. If either the upwards or downwards
|
||||
|
|
|
@ -29,13 +29,13 @@ pub struct EditorModeButton {
|
|||
|
||||
impl EditorModeButton {
|
||||
/// Creates a new button bound to the editor mode setting.
|
||||
pub fn new<L, T>(cx: &mut Context, lens: L, label: impl Res<T>) -> Handle<Self>
|
||||
pub fn new<L, T>(cx: &mut Context, lens: L, label: impl Res<T> + Clone) -> Handle<Self>
|
||||
where
|
||||
L: Lens<Target = Arc<AtomicCell<EditorMode>>>,
|
||||
T: ToString,
|
||||
{
|
||||
Self { mode: lens.get(cx) }
|
||||
.build(cx, move |cx| {
|
||||
.build(cx, |cx| {
|
||||
Label::new(cx, label).hoverable(false);
|
||||
})
|
||||
.checked(lens.map(|v| v.load() == EditorMode::AnalyzerVisible))
|
||||
|
|
Loading…
Reference in a new issue