mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
lozenges
This commit is contained in:
parent
3886e34519
commit
de2e2a2124
7 changed files with 119 additions and 65 deletions
|
|
@ -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()));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue