mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
update layout macro invocations
This commit is contained in:
parent
e677d1d7d4
commit
83eb9dd2fa
19 changed files with 153 additions and 169 deletions
|
|
@ -136,29 +136,29 @@ render!(Tui: (self: Groovebox) => {
|
|||
GrooveboxSamples(self)
|
||||
)), x);
|
||||
let status = EditStatus(&self.sampler, &self.editor, note_pt, pool(sampler(&self.editor)));
|
||||
Fill::xy(lay!([
|
||||
Fill::xy(lay!(
|
||||
&self.size,
|
||||
Fill::xy(Align::s(Fixed::y(2, GrooveboxStatus::from(self)))),
|
||||
Shrink::y(2, col!(![
|
||||
Shrink::y(2, col!(
|
||||
transport,
|
||||
selector,
|
||||
status
|
||||
]))
|
||||
]))
|
||||
))
|
||||
))
|
||||
});
|
||||
|
||||
struct EditStatus<'a, T: Content<Tui>>(&'a Sampler, &'a MidiEditor, usize, T);
|
||||
impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
Some(Split::n(false, 9, col!([
|
||||
row!(|add|{
|
||||
if let Some(sample) = &self.0.mapped[self.2] {
|
||||
add(&format!("Sample {}", sample.read().unwrap().end))?;
|
||||
}
|
||||
add(&MidiEditStatus(&self.1))?;
|
||||
Ok(())
|
||||
}),
|
||||
lay!([
|
||||
Some(Split::n(false, 9, col!(
|
||||
row!(
|
||||
Cond::opt(
|
||||
&self.0.mapped[self.2],
|
||||
|sample|format!("Sample {}", sample.read().unwrap().end)
|
||||
),
|
||||
MidiEditStatus(&self.1),
|
||||
),
|
||||
lay!(
|
||||
Outer(Style::default().fg(TuiTheme::g(128))),
|
||||
Fill::x(Fixed::y(8, if let Some((_, sample)) = &self.0.recording {
|
||||
SampleViewer(Some(sample.clone()))
|
||||
|
|
@ -167,16 +167,8 @@ impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
|
|||
} else {
|
||||
SampleViewer(None)
|
||||
})),
|
||||
]),
|
||||
]), &self.3))
|
||||
}
|
||||
}
|
||||
impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
|
||||
fn min_size (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
self.content().unwrap().min_size(to)
|
||||
}
|
||||
fn render (&self, to: &mut TuiOutput) -> Usually<()> {
|
||||
self.content().unwrap().render(to)
|
||||
),
|
||||
), &self.3))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +177,7 @@ render!(Tui: (self: GrooveboxSamples<'a>) => {
|
|||
let note_lo = self.0.editor.note_lo().load(Relaxed);
|
||||
let note_pt = self.0.editor.note_point();
|
||||
let note_hi = self.0.editor.note_hi();
|
||||
Fill::xy(col_iter!((note_lo..=note_hi).rev() => |note| {
|
||||
Fill::xy(Coll::map((note_lo..=note_hi).rev(), |note, i| {
|
||||
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
|
||||
let mut fg = TuiTheme::g(160);
|
||||
if let Some((index, _)) = self.0.sampler.recording {
|
||||
|
|
@ -196,11 +188,11 @@ render!(Tui: (self: GrooveboxSamples<'a>) => {
|
|||
} else if self.0.sampler.mapped[note].is_some() {
|
||||
fg = TuiTheme::g(224);
|
||||
}
|
||||
Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] {
|
||||
Push::y(i, Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] {
|
||||
Tui::fg(fg, format!("{note:3} ?????? "))
|
||||
} else {
|
||||
Tui::fg(fg, format!("{note:3} (none) "))
|
||||
})
|
||||
}))
|
||||
}))
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue