mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
wip: 21 errors!
This commit is contained in:
parent
694970bf0d
commit
ea5bc2e3b1
30 changed files with 392 additions and 362 deletions
|
|
@ -9,7 +9,11 @@ pub struct Plugin {
|
|||
pub mapping: bool,
|
||||
pub ports: JackPorts,
|
||||
}
|
||||
handle!(Plugin |self, e| handle_keymap(self, e, KEYMAP_PLUGIN));
|
||||
impl Handle<Tui> for Plugin {
|
||||
fn handle (&mut self, e: &Tui) -> Perhaps<bool> {
|
||||
handle_keymap(self, event, KEYMAP_PLUGIN)
|
||||
}
|
||||
}
|
||||
process!(Plugin = Plugin::process);
|
||||
impl Render<Tui> for Plugin {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
|
|
@ -36,7 +40,7 @@ impl Render<Tui> for Plugin {
|
|||
} else {
|
||||
None
|
||||
} ;
|
||||
label.blit(to.buffer(), x + 2, y + 1 + i as u16 - start as u16, style)?;
|
||||
to.blit(&label, x + 2, y + 1 + i as u16 - start as u16, style)?;
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
|
@ -44,7 +48,7 @@ impl Render<Tui> for Plugin {
|
|||
},
|
||||
_ => {}
|
||||
};
|
||||
draw_header(self, to.buffer(), area.x, area.y, width)?;
|
||||
draw_header(self, to, area.x, area.y, width)?;
|
||||
Ok(Some(Rect { width, ..to.area() }))
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +62,7 @@ pub enum PluginKind {
|
|||
VST3,
|
||||
}
|
||||
impl Plugin {
|
||||
pub fn new_lv2 <E> (name: &str, path: &str) -> Usually<JackDevice<E>> {
|
||||
pub fn new_lv2 (name: &str, path: &str) -> Usually<JackDevice<Tui>> {
|
||||
let plugin = LV2Plugin::new(path)?;
|
||||
jack_from_lv2(name, &plugin.plugin)?
|
||||
.run(|ports|Box::new(Self {
|
||||
|
|
@ -137,13 +141,13 @@ impl Plugin {
|
|||
Control::Continue
|
||||
}
|
||||
}
|
||||
fn draw_header (state: &Plugin, buf: &mut Buffer, x: u16, y: u16, w: u16) -> Usually<Rect> {
|
||||
fn draw_header (state: &Plugin, to: &mut Tui, x: u16, y: u16, w: u16) -> Usually<Rect> {
|
||||
let style = Style::default().gray();
|
||||
let label1 = format!(" {}", state.name);
|
||||
label1.blit(buf, x + 1, y, Some(style.white().bold()))?;
|
||||
to.blit(&label1, x + 1, y, Some(style.white().bold()))?;
|
||||
if let Some(ref path) = state.path {
|
||||
let label2 = format!("{}…", &path[..((w as usize - 10).min(path.len()))]);
|
||||
label2.blit(buf, x + 2 + label1.len() as u16, y, Some(style.not_dim()))?;
|
||||
to.blit(&label2, x + 2 + label1.len() as u16, y, Some(style.not_dim()))?;
|
||||
}
|
||||
Ok(Rect { x, y, width: w, height: 1 })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue