mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
refactor: device abstraction, layout components
This commit is contained in:
parent
d330d31ce4
commit
788dc1ccde
21 changed files with 1144 additions and 1166 deletions
|
|
@ -1,37 +1,56 @@
|
|||
let mut x = areas[1].x;
|
||||
for (index, track) in [
|
||||
"Track 1",
|
||||
"Track 2",
|
||||
"Track 3",
|
||||
"Track 4",
|
||||
"Track 5",
|
||||
"Bus 1",
|
||||
"Bus 2",
|
||||
"Mix",
|
||||
].iter().enumerate() {
|
||||
buffer.set_string(
|
||||
x + 10 * (index + 1) as u16, areas[1].y,
|
||||
"┬", Style::default().not_bold().dim()
|
||||
);
|
||||
buffer.set_string(
|
||||
x + 10 * (index + 1) as u16, areas[1].y + areas[1].height - 1,
|
||||
"┴", Style::default().not_bold().dim()
|
||||
);
|
||||
for y in areas[1].y+1..areas[1].y+areas[1].height - 1 {
|
||||
buffer.set_string(
|
||||
x + 10 * (index + 1) as u16, y,
|
||||
"│", Style::default().not_bold().gray().dim()
|
||||
);
|
||||
}
|
||||
for y in areas[1].y+2..areas[1].y+areas[1].height - 1 {
|
||||
buffer.set_string(
|
||||
x + 10 * index as u16 + 1, y,
|
||||
"--------", Style::default().not_bold().gray().dim()
|
||||
);
|
||||
}
|
||||
buffer.set_string(
|
||||
x + 10 * index as u16 + 1, areas[1].y + 1,
|
||||
track, Style::default().bold().not_dim()
|
||||
);
|
||||
}
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct Launcher {
|
||||
name: String
|
||||
}
|
||||
|
||||
impl Launcher {
|
||||
pub fn new (name: &str) -> Result<DynamicDevice<Self>, Box<dyn Error>> {
|
||||
Ok(DynamicDevice::new(render, handle, |_|{}, Self {
|
||||
name: name.into(),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) {}
|
||||
|
||||
pub fn handle (state: &mut Launcher, event: &Event) -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
//let mut x = areas[1].x;
|
||||
//for (index, track) in [
|
||||
//"Track 1",
|
||||
//"Track 2",
|
||||
//"Track 3",
|
||||
//"Track 4",
|
||||
//"Track 5",
|
||||
//"Bus 1",
|
||||
//"Bus 2",
|
||||
//"Mix",
|
||||
//].iter().enumerate() {
|
||||
//buffer.set_string(
|
||||
//x + 10 * (index + 1) as u16, areas[1].y,
|
||||
//"┬", Style::default().not_bold().dim()
|
||||
//);
|
||||
//buffer.set_string(
|
||||
//x + 10 * (index + 1) as u16, areas[1].y + areas[1].height - 1,
|
||||
//"┴", Style::default().not_bold().dim()
|
||||
//);
|
||||
//for y in areas[1].y+1..areas[1].y+areas[1].height - 1 {
|
||||
//buffer.set_string(
|
||||
//x + 10 * (index + 1) as u16, y,
|
||||
//"│", Style::default().not_bold().gray().dim()
|
||||
//);
|
||||
//}
|
||||
//for y in areas[1].y+2..areas[1].y+areas[1].height - 1 {
|
||||
//buffer.set_string(
|
||||
//x + 10 * index as u16 + 1, y,
|
||||
//"--------", Style::default().not_bold().gray().dim()
|
||||
//);
|
||||
//}
|
||||
//buffer.set_string(
|
||||
//x + 10 * index as u16 + 1, areas[1].y + 1,
|
||||
//track, Style::default().bold().not_dim()
|
||||
//);
|
||||
//}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue