Skip to content

Commit

Permalink
WIP gui layout
Browse files Browse the repository at this point in the history
  • Loading branch information
magnetophon committed Apr 6, 2024
1 parent d940262 commit 930f51a
Showing 1 changed file with 59 additions and 27 deletions.
86 changes: 59 additions & 27 deletions src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl Model for LambData {}
// Makes sense to also define this here, makes it a bit easier to keep track of
pub(crate) fn default_state() -> Arc<ViziaState> {
// width , height
// ViziaState::new(|| (((16.0 / 9.0) * 677.0) as u32, 677))
ViziaState::new(|| (((16.0 / 9.0) * 677.0) as u32, 677))
}

Expand Down Expand Up @@ -103,9 +104,9 @@ pub(crate) fn create(
Label::new(cx, "link").class("fader-label");
ParamSlider::new(cx, LambData::params, |params| &params.link);
}) // level
.height(Percentage(100.0))
.class("center")
.right(Percentage(2.5));
.height(Auto)
.class("center")
.right(Percentage(2.5));
// time
VStack::new(cx, |cx| {
Label::new(cx, "attack").class("fader-label");
Expand All @@ -120,40 +121,69 @@ pub(crate) fn create(
Label::new(cx, "release hold").class("fader-label");
ParamSlider::new(cx, LambData::params, |params| &params.release_hold);
}) // time
.height(Auto)
.class("center")
.left(Percentage(2.5));
})
.width(Percentage(100.0)); // level + time
// .height(Percentage(100.0))
.height(Auto)
.width(Percentage(100.0)); // level + time

Label::new(cx, "output gain").class("fader-label");
ParamSlider::new(cx, LambData::params, |params| &params.output_gain)
.bottom(Pixels(6.0));
}) // parameters
// .height(Percentage(100.0))
.background_color(Color::blue())
.height(Auto)
.right(Percentage(2.5))
.class("center");
// graph + zoom
VStack::new(cx, |cx| {
// Label::new(cx, "") // spacer
Label::new(cx, "lamb") // title
.class("plugin-name")
.left(Stretch(1.0))
.right(Pixels(0.0));
VStack::new(cx, |cx| {
// label & slider
Label::new(cx, "zoom mode").class("fader-label");
ParamSlider::new(cx, LambData::params, |params| &params.zoom_mode)
.set_style(ParamSliderStyle::CurrentStepLabeled { even: true })
.bottom(Pixels(6.0));
Label::new(cx, "").class("fader-label"); // spacer
AttackReleaseGraph::new(cx, LambData::params);
}) // label & slider
.width(Percentage(100.0))
.class("center");
}) // graph + zoom
// // Label::new(cx, "lamb") // title
// // .class("plugin-name")
// // .left(Stretch(1.0))
// // .right(Pixels(0.0));
// // VStack::new(cx, |cx| {
// // // label & slider
// // Label::new(cx, "zoom mode").class("fader-label");
// // ParamSlider::new(cx, LambData::params, |params| &params.zoom_mode)
// // .set_style(ParamSliderStyle::CurrentStepLabeled { even: true })
// // .background_color(Color::red())
// // .bottom(Pixels(6.0));
// // Label::new(cx, "above graph").class("fader-label")
// // .background_color(Color::green())
// // ; // spacer
// // // AttackReleaseGraph::new(cx, LambData::params)
// Label::new(cx, "graph")
// .bottom(Pixels(2.0))
// .height(Percentage(100.0))
// .background_color(Color::red())
// .height(Stretch(1.0))
// // // .height(Auto)
// ;
// // Label::new(cx, "below graph")
// // .class("fader-label")
// // .background_color(Color::green())
// // ; // spacer
// // }) // label & slider
// // .height(Auto)
// // .width(Percentage(100.0))
// // .class("center");
}) // graph + zoom
.background_color(Color::yellow())
.class("center")
.height(Percentage(100.0)); // graph + zoom
// .height(Stretch(1.0))
// .height(Auto)
.height(Percentage(100.0))
.position_type(PositionType::ParentDirected)
.bottom(Pixels(2.0))
.background_color(Color::green())
;
})
.width(Percentage(100.0)); // parameters + graph
.height(Auto)
.width(Percentage(100.0)); // parameters + graph

// meters
VStack::new(cx, |cx| {
Expand All @@ -171,22 +201,24 @@ pub(crate) fn create(
.map(|gain_reduction_left| gain_reduction_left.load(Ordering::Relaxed)),
Some(Duration::from_millis(600)),
)
.width(Percentage(100.0));
.width(Percentage(100.0));
Label::new(cx, "gain reduction right").class("fader-label");
GainReductionMeter::new(
cx,
LambData::gain_reduction_right
.map(|gain_reduction_right| gain_reduction_right.load(Ordering::Relaxed)),
Some(Duration::from_millis(600)),
)
.width(Percentage(100.0));
.width(Percentage(100.0));
}) // meters
.width(Percentage(100.0))
.height(Auto)
.class("center"); // meters
// .height(Percentage(100.0))
.height(Auto)
.class("center"); // meters
}) // everything
.width(Percentage(95.0))
.height(Percentage(95.0))
// .height(Percentage(95.0))
.height(Auto)
.left(Percentage(2.5))
.right(Percentage(2.5))
.class("center");
Expand Down

0 comments on commit 930f51a

Please sign in to comment.