wip: tui cleanup

This commit is contained in:
🪞👃🪞 2024-09-05 13:28:05 +03:00
parent df3dac183e
commit 14d619a10a
17 changed files with 345 additions and 306 deletions

View file

@ -2,7 +2,7 @@
use crate::*;
/// Represents the tracks and scenes of the composition.
pub struct Arranger<T, U> {
pub struct Arranger<E: Engine> {
/// Name of arranger
pub name: Arc<RwLock<String>>,
/// Collection of tracks.
@ -14,11 +14,11 @@ pub struct Arranger<T, U> {
/// Display mode of arranger
pub mode: ArrangerViewMode,
/// Slot for modal dialog displayed on top of app.
pub modal: Option<Box<dyn ExitableComponent<T, U>>>,
pub modal: Option<Box<dyn ExitableComponent<E>>>,
/// Whether the arranger is currently focused
pub focused: bool
}
impl<T, U> Arranger<T, U> {
impl<E: Engine> Arranger<E> {
pub fn new (name: &str) -> Self {
Self {
name: Arc::new(RwLock::new(name.into())),
@ -100,7 +100,7 @@ impl ArrangerViewMode {
}
}
/// Render arranger to terminal
impl<'a> Render<TuiOutput<'a>, Rect> for Arranger<TuiOutput<'a>, Rect> {
impl Render<Tui> for Arranger<Tui> {
fn render (&'a self, to: &'a mut TuiOutput<'a>) -> Perhaps<Rect> {
let area = (|to|match self.mode {
ArrangerViewMode::Horizontal =>
@ -125,7 +125,7 @@ impl<'a> Render<TuiOutput<'a>, Rect> for Arranger<TuiOutput<'a>, Rect> {
}))
}
}
impl<'a> Focusable<TuiOutput<'a>, Rect> for Arranger<TuiOutput<'a>, Rect> {
impl Focusable<Tui> for Arranger<Tui> {
fn is_focused (&self) -> bool {
self.focused
}