wip: render: remove render! macro

This commit is contained in:
🪞👃🪞 2024-09-04 03:20:58 +03:00
parent bf165c6be1
commit 1d4db3c629
13 changed files with 337 additions and 304 deletions

View file

@ -1,35 +1,37 @@
use crate::*;
use tek_core::Direction;
render!(Track |self, buf, area| TrackView {
chain: Some(&self),
direction: tek_core::Direction::Right,
focused: true,
entered: true,
//pub channels: u8,
//pub input_ports: Vec<Port<AudioIn>>,
//pub pre_gain_meter: f64,
//pub gain: f64,
//pub insert_ports: Vec<Port<AudioOut>>,
//pub return_ports: Vec<Port<AudioIn>>,
//pub post_gain_meter: f64,
//pub post_insert_meter: f64,
//pub level: f64,
//pub pan: f64,
//pub output_ports: Vec<Port<AudioOut>>,
//pub post_fader_meter: f64,
//pub route: String,
}.render(buf, area));
impl<'a> Render<TuiOutput<'a>, Rect> for Track {
fn render (&self, to: &mut TuiOutput<'a>) -> Perhaps<Rect> {
TrackView {
chain: Some(&self),
direction: tek_core::Direction::Right,
focused: true,
entered: true,
//pub channels: u8,
//pub input_ports: Vec<Port<AudioIn>>,
//pub pre_gain_meter: f64,
//pub gain: f64,
//pub insert_ports: Vec<Port<AudioOut>>,
//pub return_ports: Vec<Port<AudioIn>>,
//pub post_gain_meter: f64,
//pub post_insert_meter: f64,
//pub level: f64,
//pub pan: f64,
//pub output_ports: Vec<Port<AudioOut>>,
//pub post_fader_meter: f64,
//pub route: String,
}.render(to)
}
}
pub struct TrackView<'a> {
pub chain: Option<&'a Track>,
pub direction: Direction,
pub focused: bool,
pub entered: bool,
}
impl<'a> Render for TrackView<'a> {
fn render (&self, buf: &mut Buffer, mut area: Rect) -> Usually<Rect> {
impl<'a> Render<TuiOutput<'a>, Rect> for TrackView<'a> {
fn render (&self, to: &mut TuiOutput<'a>) -> Perhaps<Rect> {
if let Some(chain) = self.chain {
match self.direction {
Direction::Down => area.width = area.width.min(40),