mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: tui cleanup
This commit is contained in:
parent
df3dac183e
commit
14d619a10a
17 changed files with 345 additions and 306 deletions
|
|
@ -1,12 +1,12 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct Mixer<T, U> {
|
||||
pub struct Mixer<E> {
|
||||
pub name: String,
|
||||
pub tracks: Vec<Track<T, U>>,
|
||||
pub tracks: Vec<Track<E>>,
|
||||
pub selected_track: usize,
|
||||
pub selected_column: usize,
|
||||
}
|
||||
impl<T, U> Mixer<T, U> {
|
||||
impl<E> Mixer<E> {
|
||||
pub fn new (name: &str) -> Usually<Self> {
|
||||
let (client, _status) = Client::new(name, ClientOptions::NO_START_SERVER)?;
|
||||
Ok(Self {
|
||||
|
|
@ -21,12 +21,17 @@ impl<T, U> Mixer<T, U> {
|
|||
self.tracks.push(track);
|
||||
Ok(self)
|
||||
}
|
||||
pub fn track (&self) -> Option<&Track<T, U>> {
|
||||
pub fn track (&self) -> Option<&Track<E>> {
|
||||
self.tracks.get(self.selected_track)
|
||||
}
|
||||
}
|
||||
impl<'a> Render<TuiOutput<'a>, Rect> for Mixer<TuiOutput<'a>, Rect> {
|
||||
fn render (&self, to: &mut TuiOutput<'a>) -> Perhaps<Rect> {
|
||||
impl<E> Process for Mixer<E> {
|
||||
fn process (&mut self, _: &Client, _: &ProcessScope) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
impl Render<Tui> for Mixer<Tui> {
|
||||
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
|
||||
let mut tracks = Split::right();
|
||||
for channel in self.tracks.iter() {
|
||||
tracks = tracks.add_ref(channel)
|
||||
|
|
@ -34,8 +39,3 @@ impl<'a> Render<TuiOutput<'a>, Rect> for Mixer<TuiOutput<'a>, Rect> {
|
|||
tracks.render(to)
|
||||
}
|
||||
}
|
||||
impl<T, U> Process for Mixer<T, U> {
|
||||
fn process (&mut self, _: &Client, _: &ProcessScope) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue