simplify main process callback

This commit is contained in:
🪞👃🪞 2024-07-03 21:32:06 +03:00
parent 9d46cb7619
commit 47b2c5da29
3 changed files with 77 additions and 64 deletions

View file

@ -185,42 +185,42 @@ mod horizontal {
let c = if note % 2 == 0 { "" } else { "" };
c.blit(buf, x, y, Some(style));
}
pub fn footer (
buf: &mut Buffer,
area: Rect,
note0: usize,
note: usize,
time0: usize,
time: usize,
time_z: usize,
) {
let Rect { mut x, y, width, height } = area;
buf.set_string(x, y + height, format!("{}", "-".repeat((width - 2).into())),
Style::default().dim());
buf.set_string(x, y + height + 2, format!("{}", "-".repeat((width - 2).into())),
Style::default().dim());
x = x + 2;
{
for (_, [letter, title, value]) in [
["S", &format!("ync"), &format!("<4/4>")],
["Q", &format!("uant"), &format!("<1/{}>", 4 * time_z)],
["N", &format!("ote"), &format!("{} ({}-{})", note0 + note, note0, "X")],
["T", &format!("ime"), &format!("{} ({}-{})", time0 + time, time0 + 1, "X")],
].iter().enumerate() {
buf.set_string(x, y + height + 1, letter, Style::default().bold().yellow().dim());
x = x + 1;
buf.set_string(x, y + height + 1, &title, Style::default().bold().dim());
x = x + title.len() as u16 + 1;
buf.set_string(x, y + height + 1, &value, Style::default().not_dim());
x = x + value.len() as u16;
buf.set_string(x, y + height + 1, " ", Style::default().dim());
x = x + 2;
}
}
}
}
//pub fn footer (
//buf: &mut Buffer,
//area: Rect,
//note0: usize,
//note: usize,
//time0: usize,
//time: usize,
//time_z: usize,
//) {
//let Rect { mut x, y, width, height } = area;
//buf.set_string(x, y + height, format!("├{}┤", "-".repeat((width - 2).into())),
//Style::default().dim());
//buf.set_string(x, y + height + 2, format!("├{}┤", "-".repeat((width - 2).into())),
//Style::default().dim());
//x = x + 2;
//{
//for (_, [letter, title, value]) in [
//["S", &format!("ync"), &format!("<4/4>")],
//["Q", &format!("uant"), &format!("<1/{}>", 4 * time_z)],
//["N", &format!("ote"), &format!("{} ({}-{})", note0 + note, note0, "X")],
//["T", &format!("ime"), &format!("{} ({}-{})", time0 + time, time0 + 1, "X")],
//].iter().enumerate() {
//buf.set_string(x, y + height + 1, letter, Style::default().bold().yellow().dim());
//x = x + 1;
//buf.set_string(x, y + height + 1, &title, Style::default().bold().dim());
//x = x + title.len() as u16 + 1;
//buf.set_string(x, y + height + 1, &value, Style::default().not_dim());
//x = x + value.len() as u16;
//buf.set_string(x, y + height + 1, " ", Style::default().dim());
//x = x + 2;
//}
//}
//}
//mod vertical {
//use super::*;