sequencer: merge toolbar components

This commit is contained in:
🪞👃🪞 2024-09-29 00:59:24 +03:00
parent 0b5ed23ea6
commit 47fd9de549
2 changed files with 22 additions and 60 deletions

View file

@ -1334,10 +1334,27 @@ impl Content for Sequencer<Tui> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
let toolbar = col!(
SequenceName(&self),
SequenceRange,
SequenceLoopRange,
SequenceNoteRange,
col! { "Name"
, self.name.read().unwrap().as_str(),
}.min_xy(10, 4),
col! { "Start: ", " 1.1.1"
, "End: ", " 2.1.1",
}.min_xy(10, 6),
col! { "Loop [ ]"
, "From: ", " 1.1.1"
, "Length: ", " 1.0.0",
}.min_xy(10, 7),
col! { "Notes: "
, "C#0-C#9 "
, "[ /2 ]"
, "[ x2 ]"
, "[ Rev ]"
, "[ Inv ]"
, "[ Dup ]"
}.min_xy(10, 9),
);
let content = lay!(
SequenceKeys(&self).fill_y(),
@ -1541,59 +1558,6 @@ pub(crate) fn keys_vert () -> Buffer {
///////////////////////////////////////////////////////////////////////////////////////////////////
struct SequenceName<'a>(&'a Sequencer<Tui>);
impl<'a> Content for SequenceName<'a> {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
col! { "Name", self.0.name.read().unwrap().as_str(), }.min_xy(10, 4)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
struct SequenceRange;
impl Content for SequenceRange {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
col! { "Start: ", " 1.1.1"
, "End: ", " 2.1.1", }.min_xy(10, 6)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
struct SequenceLoopRange;
impl Content for SequenceLoopRange {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
col! { "Loop [ ]"
, "From: ", " 1.1.1"
, "Length: ", " 1.0.0", }.min_xy(10, 7)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
struct SequenceNoteRange;
impl Content for SequenceNoteRange {
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
Stack::down(|add|{
//Lozenge(Style::default().fg(Nord::BG2)).draw(to.with_rect(range))?;
add(&"Notes: ")?;//Some(STYLE_LABEL));
add(&"C#0-C#9 ")?;//Some(STYLE_VALUE));
add(&"[ /2 ]")?;//Some(STYLE_LABEL));
add(&"[ x2 ]")?;//Some(STYLE_LABEL));
add(&"[ Rev ]")?;//Some(STYLE_LABEL));
add(&"[ Inv ]")?;//Some(STYLE_LABEL));
add(&"[ Dup ]")?;//Some(STYLE_LABEL));
Ok(())
}).min_xy(10, 9)
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
struct SequenceKeys<'a>(&'a Sequencer<Tui>);
impl<'a> Widget for SequenceKeys<'a> {
type Engine = Tui;