lanes and grids

This commit is contained in:
🪞👃🪞 2024-06-12 18:38:16 +03:00
parent 788dc1ccde
commit ac865824cc
12 changed files with 213 additions and 112 deletions

View file

@ -41,7 +41,15 @@ impl Mixer {
}
}
pub fn render (state: &Mixer, buf: &mut Buffer, area: Rect) {
pub fn render (state: &Mixer, buf: &mut Buffer, mut area: Rect)
-> Usually<(u16, u16)>
{
if area.height < 2 {
return Ok((0, 0))
}
area.x = area.width.saturating_sub(80) / 2;
area.width = area.width.min(80);
area.height = state.tracks.len() as u16 + 2;
draw_box(buf, area);
let x = area.x + 1;
let y = area.y + 1;
@ -52,7 +60,7 @@ pub fn render (state: &Mixer, buf: &mut Buffer, area: Rect) {
//&track.name, Style::default().bold().not_dim()
//);
for (j, (column, field)) in [
(0, format!(" {:7} ", track.name)),
(0, format!(" {:10} ", track.name)),
(12, format!(" {:.1}dB ", track.gain)),
(22, format!(" [ ] ")),
(30, format!(" C ")),
@ -94,6 +102,7 @@ pub fn render (state: &Mixer, buf: &mut Buffer, area: Rect) {
//}
}
}
Ok((20,10))
}
pub fn handle (state: &mut Mixer, event: &EngineEvent) -> Result<(), Box<dyn Error>> {