This commit is contained in:
🪞👃🪞 2024-06-29 22:06:53 +03:00
parent 3886e34519
commit de2e2a2124
7 changed files with 119 additions and 65 deletions

View file

@ -70,8 +70,9 @@ pub fn render (state: &Chain, buf: &mut Buffer, area: Rect)
draw_box_styled(buf, area, selected)
},
ChainView::Row => {
draw_box_styled(buf, area, selected);
let (area, areas) = Row::draw(buf, area, &state.items, 0)?;
draw_box_styled(buf, area, selected)
area
},
ChainView::Column => {
draw_as_column(state, buf, area, selected)?
@ -124,7 +125,7 @@ pub fn draw_as_row (
x = x + 1;
let mut h = 0u16;
let mut frames = vec![];
for device in state.items.iter() {
for (i, device) in state.items.iter().enumerate() {
let mut x2 = 1u16;
let mut y2 = 1u16;
for port in device.midi_ins()?.iter() {
@ -138,7 +139,18 @@ pub fn draw_as_row (
y2 = y2 + 1;
}
let width = width.saturating_sub(x).saturating_sub(x2);
let style = Some(if i == state.focus {
if state.focused {
Style::default().green().not_dim()
} else {
Style::default().green().dim()
}
} else {
Style::default().dim()
});
lozenge_left(buf, x + x2, y, height, style);
let frame = device.render(buf, Rect { x: x + x2, y, width, height })?;
lozenge_right(buf, x + x2 + frame.width - 1, y, height, style);
let mut y2 = 1u16;
for port in device.midi_outs()?.iter() {
port.blit(buf, x + x2 + frame.width, y + y2, Some(Style::default()));