mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-08-28 12:56:57 +02:00
wip: clip launcher
This commit is contained in:
parent
2f52e97c58
commit
90998b1c6e
3 changed files with 78 additions and 52 deletions
|
|
@ -45,9 +45,8 @@ pub fn process (_: &mut Plugin, _: &Client, _: &ProcessScope) -> Control {
|
|||
pub fn render (state: &Plugin, buf: &mut Buffer, area: Rect)
|
||||
-> Usually<Rect>
|
||||
{
|
||||
let header = draw_header(state, buf, area)?;
|
||||
let Rect { x, y, width, height } = area;
|
||||
let height = height.saturating_sub(header.height);
|
||||
let height = height.saturating_sub(3);
|
||||
let style = Style::default().gray();
|
||||
let mut width = 40u16;
|
||||
match &state.plugin {
|
||||
|
|
@ -58,6 +57,8 @@ pub fn render (state: &Plugin, buf: &mut Buffer, area: Rect)
|
|||
width = width.max(label.len() as u16);
|
||||
label.blit(buf, x + 2, y + 3 + i as u16, None);
|
||||
}
|
||||
draw_box(buf, Rect { x, y, width, height });
|
||||
|
||||
//let mut height = 3;
|
||||
//for (i, port) in ports
|
||||
//.iter()
|
||||
|
|
@ -78,27 +79,29 @@ pub fn render (state: &Plugin, buf: &mut Buffer, area: Rect)
|
|||
//});
|
||||
//height = height + 1;
|
||||
//}
|
||||
Ok(draw_box(buf, Rect { x, y, width, height }))
|
||||
//Ok(draw_box(buf, rect { x, y, width, height }))
|
||||
},
|
||||
_ => {
|
||||
buf.set_string(x + 1, y + 3, &format!(" Parameter 1 0.0"), style);
|
||||
buf.set_string(x + 1, y + 4, &format!(" Parameter 2 0.0"), style);
|
||||
buf.set_string(x + 1, y + 5, &format!(" Parameter 3 0.0"), style);
|
||||
buf.set_string(x + 1, y + 6, &format!(" Parameter 4 0.0"), style);
|
||||
Ok(draw_box(buf, Rect { x, y, width: 40, height: 7 }))
|
||||
//Ok(draw_box(buf, Rect { x, y, width: 40, height: 7 }))
|
||||
}
|
||||
}
|
||||
};
|
||||
draw_header(state, buf, area.x, area.y, width);
|
||||
Ok(area)
|
||||
}
|
||||
|
||||
fn draw_header (state: &Plugin, buf: &mut Buffer, Rect {x, y, width, ..}: Rect) -> Usually<Rect> {
|
||||
fn draw_header (state: &Plugin, buf: &mut Buffer, x: u16, y: u16, w: u16) -> Usually<Rect> {
|
||||
let style = Style::default().gray();
|
||||
buf.set_string(x + 1, y + 1,
|
||||
&format!(" {}", state.name), style.white().bold());
|
||||
buf.set_string(x + 13, y + 1,
|
||||
&format!("│ {}...", &HELM[..(width as usize - 20).min(HELM.len())]), style.not_dim());
|
||||
&format!("│ {}...", &HELM[..(w as usize - 20).min(HELM.len())]), style.not_dim());
|
||||
buf.set_string(x + 0, y + 2,
|
||||
&format!("├{}┤", "-".repeat(width as usize - 2)), style.dim());
|
||||
Ok(Rect { x, y, width, height: 3 })
|
||||
&format!("├{}┤", "-".repeat(w as usize - 2)), style.dim());
|
||||
Ok(Rect { x, y, width: w, height: 3 })
|
||||
}
|
||||
|
||||
pub fn handle (s: &mut Plugin, event: &AppEvent) -> Usually<bool> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue