mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-08-28 12:56:57 +02:00
wip: show single-device chain in launcher
This commit is contained in:
parent
1f194dafd8
commit
2f52e97c58
7 changed files with 315 additions and 239 deletions
|
|
@ -47,31 +47,38 @@ pub fn render (state: &Plugin, buf: &mut Buffer, area: Rect)
|
|||
{
|
||||
let header = draw_header(state, buf, area)?;
|
||||
let Rect { x, y, width, height } = area;
|
||||
let height = height - header.height;
|
||||
let height = height.saturating_sub(header.height);
|
||||
let style = Style::default().gray();
|
||||
let mut width = 40u16;
|
||||
match &state.plugin {
|
||||
Some(PluginKind::LV2(ports, instance)) => {
|
||||
let mut height = 3;
|
||||
for (i, port) in ports
|
||||
.iter()
|
||||
.filter(|port|port.port_type == ::livi::PortType::ControlInput)
|
||||
.skip(state.offset)
|
||||
.enumerate()
|
||||
{
|
||||
if i >= 20 {
|
||||
break
|
||||
}
|
||||
buf.set_string(x + 2, y + 3 + i as u16, &format!("C·· M·· {:25} = {:03}",
|
||||
port.name,
|
||||
port.default_value
|
||||
), if i + state.offset == state.selected {
|
||||
Style::default().white().bold()
|
||||
} else {
|
||||
Style::default().not_dim()
|
||||
});
|
||||
height = height + 1;
|
||||
for i in 0..height - 4 {
|
||||
let port = &ports[i as usize];
|
||||
let label = &format!("C·· M·· {:25} = {:03}", port.name, port.default_value);
|
||||
width = width.max(label.len() as u16);
|
||||
label.blit(buf, x + 2, y + 3 + i as u16, None);
|
||||
}
|
||||
Ok(draw_box(buf, Rect { x, y, width, height: height.max(20) }))
|
||||
//let mut height = 3;
|
||||
//for (i, port) in ports
|
||||
//.iter()
|
||||
//.filter(|port|port.port_type == ::livi::PortType::ControlInput)
|
||||
//.skip(state.offset)
|
||||
//.enumerate()
|
||||
//{
|
||||
//if i >= 20 {
|
||||
//break
|
||||
//}
|
||||
//buf.set_string(x + 2, y + 3 + i as u16, &format!("C·· M·· {:25} = {:03}",
|
||||
//port.name,
|
||||
//port.default_value
|
||||
//), if i + state.offset == state.selected {
|
||||
//Style::default().white().bold()
|
||||
//} else {
|
||||
//Style::default().not_dim()
|
||||
//});
|
||||
//height = height + 1;
|
||||
//}
|
||||
Ok(draw_box(buf, Rect { x, y, width, height }))
|
||||
},
|
||||
_ => {
|
||||
buf.set_string(x + 1, y + 3, &format!(" Parameter 1 0.0"), style);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue