wip: refactor pt.29: 12 errors

This commit is contained in:
🪞👃🪞 2024-11-14 20:56:23 +01:00
parent ceead4131c
commit ab85a86b6b
27 changed files with 1890 additions and 1865 deletions

View file

@ -10,73 +10,69 @@ pub(crate) use std::path::PathBuf;
pub(crate) use std::ffi::OsString;
pub(crate) use std::fs::read_dir;
use std::fmt::Debug;
submod! {
tui_arranger
tui_arranger_bar
tui_arranger_cmd
tui_arranger_foc
tui_arranger_hor
tui_arranger_ver
//tui_mixer // TODO
//tui_mixer_cmd
tui_phrase
tui_phrase_cmd
//tui_plugin // TODO
//tui_plugin_cmd
//tui_plugin_lv2
//tui_plugin_lv2_gui
//tui_plugin_vst2
//tui_plugin_vst3
tui_pool
tui_pool_cmd
tui_pool_length
tui_pool_rename
//tui_sampler // TODO
//tui_sampler_cmd
tui_sequencer
tui_sequencer_bar
tui_sequencer_cmd
tui_sequencer_foc
tui_status
tui_theme
tui_transport
tui_transport_bar
tui_transport_cmd
tui_transport_foc
}
pub struct AppView<E, A, C>
pub struct AppView<E, A, C, S>
where
E: Engine,
A: Widget<Engine = E> + Handle<E> + Audio,
C: Command<A>,
S: StatusBar,
{
pub app: A,
pub cursor: (usize, usize),
pub entered: bool,
pub menu_bar: Option<MenuBar<E, A, C>>,
pub status_bar: Option<Box<dyn StatusBar<E, Self>>>,
pub status_bar: Option<S>,
pub history: Vec<C>,
pub size: Measure<E>,
}
impl<E, A, C> AppView<E, A, C>
#[derive(Debug, Copy, Clone)]
pub enum AppViewCommand<T: Debug + Copy + Clone> {
Focus(FocusCommand),
Undo,
Redo,
App(T)
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum AppViewFocus<F: Debug + Copy + Clone + PartialEq> {
Menu,
Content(F),
}
impl<E, A, C, S> AppView<E, A, C, S>
where
E: Engine,
A: Widget<Engine = E> + Handle<E> + Audio,
C: Command<A>
C: Command<A>,
S: StatusBar
{
pub fn new (
app: A,
menu_bar: Option<MenuBar<E, A, C>>,
status_bar: Option<Box<dyn StatusBar<E, Self>>>,
status_bar: Option<S>,
) -> Self {
Self {
app,
@ -90,10 +86,11 @@ where
}
}
impl<A, C> Content for AppView<Tui, A, C>
impl<A, C, S> Content for AppView<Tui, A, C, S>
where
A: Widget<Engine = Tui> + Handle<Tui> + Audio,
C: Command<A>
C: Command<A>,
S: StatusBar,
{
type Engine = Tui;
fn content (&self) -> impl Widget<Engine = Tui> {
@ -106,25 +103,15 @@ where
row!(menu in menus.iter() => {
row!(" ", menu.title.as_str(), " ")
}),
Split::up(
if self.status_bar.is_some() { 1 } else { 0 },
widget(&self.status_bar),
Either(
self.status_bar.is_some(),
Split::up(
1,
widget(self.status_bar.as_ref().unwrap()),
widget(&self.app)
),
widget(&self.app)
)
)
}
}
#[derive(Debug, Copy, Clone)]
pub enum AppViewCommand<T: std::fmt::Debug + Copy + Clone> {
Focus(FocusCommand),
Undo,
Redo,
App(T)
}
#[derive(Debug, Copy, Clone, PartialEq)]
pub enum AppViewFocus<F: std::fmt::Debug + Copy + Clone + PartialEq> {
Menu,
Content(F),
}