wip: layout

This commit is contained in:
🪞👃🪞 2024-06-12 23:21:56 +03:00
parent ac865824cc
commit d627d257ad
13 changed files with 220 additions and 131 deletions

View file

@ -107,28 +107,28 @@ impl Sample {
}
pub fn render (state: &Sampler, buf: &mut Buffer, Rect { x, y, width, height }: Rect)
-> Usually<(u16, u16)>
-> Usually<Rect>
{
let style = Style::default().gray();
draw_box(buf, Rect { x, y: y, width: 40, height: 12 });
buf.set_string(x + 1, y + 1, &format!(" {}", state.name), style.white().bold());
buf.set_string(x + 0, y + 2, &format!("├--------------------------------------┤"), style.dim());
buf.set_string(x + 2, y + 3, &format!("C0 Sample#000"), style.bold());
buf.set_string(x + 2, y + 3, &format!("C4 Sample#000"), style.bold());
buf.set_string(x + 2, y + 4, &format!(" {:.03}s",
100000.0/44100.0), style);
buf.set_string(x + 2, y + 5, &format!("C#0 Sample#001"), style.bold());
buf.set_string(x + 2, y + 5, &format!("C#4 Sample#001"), style.bold());
buf.set_string(x + 2, y + 6, &format!(" {:.03}-{:.03}s",
50000.0/44100.0, 100000.0/44100.0), style);
buf.set_string(x + 2, y + 7, &format!("D0 Sample#002"), style.bold());
buf.set_string(x + 2, y + 7, &format!("D4 Sample#002"), style.bold());
buf.set_string(x + 2, y + 8, &format!(" {:.03}-{:.03}/{:.03}s",
0.0, 50000.0/44100.0, 100000.0/44100.0), style);
buf.set_string(x + 2, y + 9, &format!("D#0 Sample#003"), style.bold());
buf.set_string(x + 2, y + 9, &format!("D#4 Sample#003"), style.bold());
buf.set_string(x + 2, y + 10, &format!(" {:.03}-[{:.03}-{:.03}]/{:.03}s ",
10000.0/44100.0, 25000.0/44100.0, 50000.0/44100.0, 100000.0/44100.0), style);
//buf.set_string(x + 1, y + 7 + 6, &format!(" Inputs... │ Outputs... "), style.dim());
//render_table(state, stdout, offset)?;
//render_meters(state, stdout, offset)?;
Ok((40, 11))
Ok(Rect { x, y, width: 40, height: 11 })
}
//fn render_table (