mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
https://loglog.games/blog/leaving-rust-gamedev/#orphan-rule-should-be-optional is on point
67 lines
2.4 KiB
Rust
67 lines
2.4 KiB
Rust
use crate::*;
|
|
use tek_core::Direction;
|
|
|
|
impl Content for Track<Tui> {
|
|
type Engine = Tui;
|
|
fn content (&self) -> impl Widget<Engine = Tui> {
|
|
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,
|
|
}
|
|
}
|
|
}
|
|
pub struct TrackView<'a, E: Engine> {
|
|
pub chain: Option<&'a Track<E>>,
|
|
pub direction: Direction,
|
|
pub focused: bool,
|
|
pub entered: bool,
|
|
}
|
|
impl<'a> Widget for TrackView<'a, Tui> {
|
|
type Engine = Tui;
|
|
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
|
|
todo!()
|
|
}
|
|
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
|
|
todo!();
|
|
//let mut area = to.area();
|
|
//if let Some(chain) = self.chain {
|
|
//match self.direction {
|
|
//Direction::Down => area.width = area.width.min(40),
|
|
//Direction::Right => area.width = area.width.min(10),
|
|
//_ => { unimplemented!() },
|
|
//}
|
|
//to.fill_bg(to.area(), Nord::bg_lo(self.focused, self.entered));
|
|
//let mut split = Split::new(self.direction);
|
|
//for device in chain.devices.as_slice().iter() {
|
|
//split = split.add_ref(device);
|
|
//}
|
|
//let (area, areas) = split.render_areas(to)?;
|
|
//if self.focused && self.entered && areas.len() > 0 {
|
|
//Corners(Style::default().green().not_dim()).draw(to.with_rect(areas[0]))?;
|
|
//}
|
|
//Ok(Some(area))
|
|
//} else {
|
|
//let [x, y, width, height] = area;
|
|
//let label = "No chain selected";
|
|
//let x = x + (width - label.len() as u16) / 2;
|
|
//let y = y + height / 2;
|
|
//to.blit(&label, x, y, Some(Style::default().dim().bold()))?;
|
|
//Ok(Some(area))
|
|
//}
|
|
}
|
|
}
|