mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
87 lines
3.8 KiB
Rust
87 lines
3.8 KiB
Rust
#![feature(let_chains)]
|
|
#![feature(trait_alias)]
|
|
#![feature(if_let_guard)]
|
|
#![feature(impl_trait_in_assoc_type)]
|
|
|
|
pub(crate) use std::cmp::Ord;
|
|
pub(crate) use std::fmt::{Debug, Formatter};
|
|
pub(crate) use std::thread::JoinHandle;
|
|
pub(crate) use std::sync::{Arc, RwLock};
|
|
pub(crate) use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::Relaxed};
|
|
pub(crate) use std::fs::File;
|
|
pub(crate) use std::path::PathBuf;
|
|
pub(crate) use std::error::Error;
|
|
pub(crate) use std::ffi::OsString;
|
|
|
|
pub(crate) use ::tengri::{from, has, maybe_has, Usually, Perhaps, Has, MaybeHas};
|
|
pub(crate) use ::tengri::{dsl::*, input::*, output::*, tui::{*, ratatui::prelude::*}};
|
|
pub(crate) use ::tek_engine::*;
|
|
pub(crate) use ::tek_engine::midi::{u7, LiveEvent, MidiMessage};
|
|
pub(crate) use ::tek_engine::jack::{Control, ProcessScope, RawMidi};
|
|
pub(crate) use ratatui::{prelude::Rect, widgets::{Widget, canvas::{Canvas, Line}}};
|
|
pub(crate) use Color::*;
|
|
|
|
mod device; pub use self::device::*;
|
|
|
|
/// Define a type alias for iterators of sized items (columns).
|
|
macro_rules! def_sizes_iter {
|
|
($Type:ident => $($Item:ty),+) => {
|
|
pub trait $Type<'a> =
|
|
Iterator<Item=(usize, $(&'a $Item,)+ usize, usize)> + Send + Sync + 'a;
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "arranger")] mod arranger; #[cfg(feature = "arranger")] pub use self::arranger::*;
|
|
#[cfg(feature = "browser")] mod browser; #[cfg(feature = "browser")] pub use self::browser::*;
|
|
#[cfg(feature = "clap")] mod clap; #[cfg(feature = "clap")] pub use self::clap::*;
|
|
#[cfg(feature = "clock")] mod clock; #[cfg(feature = "clock")] pub use self::clock::*;
|
|
#[cfg(feature = "editor")] mod editor; #[cfg(feature = "editor")] pub use self::editor::*;
|
|
#[cfg(feature = "lv2")] mod lv2; #[cfg(feature = "lv2")] pub use self::lv2::*;
|
|
#[cfg(feature = "meter")] mod meter; #[cfg(feature = "meter")] pub use self::meter::*;
|
|
#[cfg(feature = "mixer")] mod mixer; #[cfg(feature = "mixer")] pub use self::mixer::*;
|
|
#[cfg(feature = "pool")] mod pool; #[cfg(feature = "pool")] pub use self::pool::*;
|
|
#[cfg(feature = "port")] mod port; #[cfg(feature = "port")] pub use self::port::*;
|
|
#[cfg(feature = "sampler")] mod sampler; #[cfg(feature = "sampler")] pub use self::sampler::*;
|
|
#[cfg(feature = "sequencer")] mod sequencer; #[cfg(feature = "sequencer")] pub use self::sequencer::*;
|
|
#[cfg(feature = "sf2")] mod sf2; #[cfg(feature = "sf2")] pub use self::sf2::*;
|
|
#[cfg(feature = "vst2")] mod vst2; #[cfg(feature = "vst2")] pub use self::vst2::*;
|
|
#[cfg(feature = "vst3")] mod vst3; #[cfg(feature = "vst3")] pub use self::vst3::*;
|
|
|
|
pub fn button_2 <'a> (
|
|
key: impl Content<TuiOut> + 'a, label: impl Content<TuiOut> + 'a, editing: bool,
|
|
) -> impl Content<TuiOut> + 'a {
|
|
let key = Tui::fg_bg(Tui::orange(), Tui::g(0), Bsp::e(
|
|
Tui::fg(Tui::g(0), "▐"),
|
|
Bsp::e(key, Tui::fg(Tui::g(96), "▐"))
|
|
));
|
|
let label = When::new(!editing, Tui::fg_bg(Tui::g(255), Tui::g(96), label));
|
|
Tui::bold(true, Bsp::e(key, label))
|
|
}
|
|
|
|
pub fn button_3 <'a, K, L, V> (
|
|
key: K,
|
|
label: L,
|
|
value: V,
|
|
editing: bool,
|
|
) -> impl Content<TuiOut> + 'a where
|
|
K: Content<TuiOut> + 'a,
|
|
L: Content<TuiOut> + 'a,
|
|
V: Content<TuiOut> + 'a,
|
|
{
|
|
let key = Tui::fg_bg(Tui::orange(), Tui::g(0),
|
|
Bsp::e(Tui::fg(Tui::g(0), "▐"), Bsp::e(key, Tui::fg(if editing {
|
|
Tui::g(128)
|
|
} else {
|
|
Tui::g(96)
|
|
}, "▐"))));
|
|
let label = Bsp::e(
|
|
When::new(!editing, Bsp::e(
|
|
Tui::fg_bg(Tui::g(255), Tui::g(96), label),
|
|
Tui::fg_bg(Tui::g(128), Tui::g(96), "▐"),
|
|
)),
|
|
Bsp::e(
|
|
Tui::fg_bg(Tui::g(224), Tui::g(128), value),
|
|
Tui::fg_bg(Tui::g(128), Reset, "▌"),
|
|
));
|
|
Tui::bold(true, Bsp::e(key, label))
|
|
}
|