Temporarily add more widgets to vizia Gain GUI
This commit is contained in:
parent
4f9a83860b
commit
1a9db3ab8e
|
@ -307,7 +307,10 @@ impl View for ParamSlider {
|
||||||
match window_event {
|
match window_event {
|
||||||
WindowEvent::MouseDown(MouseButton::Left) => {
|
WindowEvent::MouseDown(MouseButton::Left) => {
|
||||||
if cx.modifiers.alt() {
|
if cx.modifiers.alt() {
|
||||||
|
// ALt+Click brings up a text entry dialog
|
||||||
cx.emit(ParamSliderInternalEvent::SetTextInputActive(true));
|
cx.emit(ParamSliderInternalEvent::SetTextInputActive(true));
|
||||||
|
cx.current.set_active(cx, true);
|
||||||
|
|
||||||
// TODO: Once vizia implements it: (and probably do this from
|
// TODO: Once vizia implements it: (and probably do this from
|
||||||
// `SetTextInputActive`)
|
// `SetTextInputActive`)
|
||||||
// - Focus the text box
|
// - Focus the text box
|
||||||
|
|
|
@ -24,7 +24,7 @@ impl Model for Data {}
|
||||||
|
|
||||||
// Makes sense to also define this here, makes it a bit easier to keep track of
|
// Makes sense to also define this here, makes it a bit easier to keep track of
|
||||||
pub(crate) fn default_state() -> Arc<ViziaState> {
|
pub(crate) fn default_state() -> Arc<ViziaState> {
|
||||||
ViziaState::from_size(200, 150)
|
ViziaState::from_size(200, 250)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn create(
|
pub(crate) fn create(
|
||||||
|
@ -41,7 +41,7 @@ pub(crate) fn create(
|
||||||
}
|
}
|
||||||
.build(cx);
|
.build(cx);
|
||||||
|
|
||||||
VStack::new(cx, move |cx| {
|
VStack::new(cx, |cx| {
|
||||||
Label::new(cx, "Gain GUI")
|
Label::new(cx, "Gain GUI")
|
||||||
.font(assets::NOTO_SANS_THIN)
|
.font(assets::NOTO_SANS_THIN)
|
||||||
.font_size(40.0 * POINT_SCALE)
|
.font_size(40.0 * POINT_SCALE)
|
||||||
|
@ -52,7 +52,17 @@ pub(crate) fn create(
|
||||||
// compensate for that
|
// compensate for that
|
||||||
Label::new(cx, "Gain").bottom(Pixels(-1.0));
|
Label::new(cx, "Gain").bottom(Pixels(-1.0));
|
||||||
|
|
||||||
|
VStack::new(cx, |cx| {
|
||||||
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.gain);
|
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.gain);
|
||||||
|
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.gain)
|
||||||
|
.set_style(ParamSliderStyle::FromLeft);
|
||||||
|
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.foo);
|
||||||
|
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.foo)
|
||||||
|
.set_style(ParamSliderStyle::CurrentStep);
|
||||||
|
ParamSlider::new(cx, Data::params, setter, |params| ¶ms.foo)
|
||||||
|
.set_style(ParamSliderStyle::CurrentStepLabeled);
|
||||||
|
})
|
||||||
|
.row_between(Pixels(5.0));
|
||||||
|
|
||||||
// TODO: Add a peak meter
|
// TODO: Add a peak meter
|
||||||
})
|
})
|
||||||
|
|
|
@ -26,6 +26,14 @@ struct Gain {
|
||||||
pub struct GainParams {
|
pub struct GainParams {
|
||||||
#[id = "gain"]
|
#[id = "gain"]
|
||||||
pub gain: FloatParam,
|
pub gain: FloatParam,
|
||||||
|
#[id = "foo"]
|
||||||
|
pub foo: EnumParam<Foo>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Enum)]
|
||||||
|
pub enum Foo {
|
||||||
|
Foo,
|
||||||
|
Bar,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Gain {
|
impl Default for Gain {
|
||||||
|
@ -54,6 +62,7 @@ impl Default for GainParams {
|
||||||
.with_smoother(SmoothingStyle::Linear(50.0))
|
.with_smoother(SmoothingStyle::Linear(50.0))
|
||||||
.with_step_size(0.01)
|
.with_step_size(0.01)
|
||||||
.with_unit(" dB"),
|
.with_unit(" dB"),
|
||||||
|
foo: EnumParam::new("Foo", Foo::Bar),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue