mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-10-08 18:56:42 +02:00
piano keys reappear
This commit is contained in:
parent
9db60c3429
commit
9a50ce6613
15 changed files with 856 additions and 782 deletions
173
src/tek.rs
173
src/tek.rs
|
|
@ -1,27 +1,5 @@
|
|||
#![allow(clippy::unit_arg)]
|
||||
|
||||
mod deps; pub use self::deps::*;
|
||||
|
||||
mod clock; pub use self::clock::*;
|
||||
|
||||
mod midi_octave; pub use self::midi_octave::*;
|
||||
mod midi_piano; pub use self::midi_piano::*;
|
||||
mod midi_point; pub use self::midi_point::*;
|
||||
mod midi_range; pub use self::midi_range::*;
|
||||
|
||||
mod smpl; pub use self::smpl::*;
|
||||
mod smpl_sample; pub use self::smpl_sample::*;
|
||||
mod smpl_add; pub use self::smpl_add::*;
|
||||
mod smpl_kit; pub use self::smpl_kit::*;
|
||||
mod smpl_voice; pub use self::smpl_voice::*;
|
||||
|
||||
mod midi_clip; pub use self::midi_clip::*;
|
||||
mod midi_edit; pub use self::midi_edit::*;
|
||||
mod midi_mon; pub use self::midi_mon::*;
|
||||
mod midi_play; pub use self::midi_play::*;
|
||||
mod midi_rec; pub use self::midi_rec::*;
|
||||
mod midi_seq; pub use self::midi_seq::*;
|
||||
|
||||
/// Define a type alias for iterators of sized items (columns).
|
||||
macro_rules! def_sizes_iter {
|
||||
($Type:ident => $($Item:ty),+) => {
|
||||
|
|
@ -30,26 +8,46 @@ macro_rules! def_sizes_iter {
|
|||
}
|
||||
}
|
||||
|
||||
mod proj; pub use self::proj::*;
|
||||
mod proj_device; pub use self::proj_device::*;
|
||||
mod proj_mixer; pub use self::proj_mixer::*;
|
||||
mod proj_port; pub use self::proj_port::*;
|
||||
mod proj_scene; pub use self::proj_scene::*;
|
||||
mod proj_select; pub use self::proj_select::*;
|
||||
mod proj_track; pub use self::proj_track::*;
|
||||
mod deps; pub use self::deps::*;
|
||||
mod clock; pub use self::clock::*;
|
||||
mod proj; pub use self::proj::*;
|
||||
mod device; pub use self::device::*;
|
||||
mod scene; pub use self::scene::*;
|
||||
mod track; pub use self::track::*;
|
||||
mod mixer; pub use self::mixer::*;
|
||||
|
||||
mod tek_bind; pub use self::tek_bind::*;
|
||||
mod tek_cli; pub use self::tek_cli::*;
|
||||
mod tek_conf; pub use self::tek_conf::*;
|
||||
mod tek_ctrl; pub use self::tek_ctrl::*;
|
||||
mod tek_has; pub use self::tek_has::*;
|
||||
mod tek_mode; pub use self::tek_mode::*;
|
||||
mod tek_pool; pub use self::tek_pool::*;
|
||||
mod tek_view; pub use self::tek_view::*;
|
||||
mod midi_clip; pub use self::midi_clip::*;
|
||||
mod midi_edit; pub use self::midi_edit::*;
|
||||
mod midi_mon; pub use self::midi_mon::*;
|
||||
mod midi_play; pub use self::midi_play::*;
|
||||
mod midi_point; pub use self::midi_point::*;
|
||||
mod midi_range; pub use self::midi_range::*;
|
||||
mod midi_rec; pub use self::midi_rec::*;
|
||||
mod midi_seq; pub use self::midi_seq::*;
|
||||
|
||||
#[cfg(feature = "lv2")] mod device_lv2; #[cfg(feature = "lv2")] pub use self::device_lv2::*;
|
||||
#[cfg(feature = "lv2_gui")] mod device_lv2_gui; #[cfg(feature = "lv2_gui")] pub use self::device_lv2_gui::*;
|
||||
#[cfg(feature = "vst2")] mod device_vst2; #[cfg(feature = "vst2")] pub use self::device_vst2::*;
|
||||
mod smpl; pub use self::smpl::*;
|
||||
mod smpl_add; pub use self::smpl_add::*;
|
||||
mod smpl_kit; pub use self::smpl_kit::*;
|
||||
mod smpl_sample; pub use self::smpl_sample::*;
|
||||
mod smpl_voice; pub use self::smpl_voice::*;
|
||||
|
||||
mod tek_bind; pub use self::tek_bind::*;
|
||||
mod tek_cli; pub use self::tek_cli::*;
|
||||
mod tek_conf; pub use self::tek_conf::*;
|
||||
mod tek_ctrl; pub use self::tek_ctrl::*;
|
||||
mod tek_has; pub use self::tek_has::*;
|
||||
mod tek_mode; pub use self::tek_mode::*;
|
||||
mod tek_pool; pub use self::tek_pool::*;
|
||||
mod tek_view; pub use self::tek_view::*;
|
||||
|
||||
#[cfg(feature = "lv2")] mod device_lv2;
|
||||
#[cfg(feature = "lv2")] pub use self::device_lv2::*;
|
||||
|
||||
#[cfg(feature = "lv2_gui")] mod device_lv2_gui;
|
||||
#[cfg(feature = "lv2_gui")] pub use self::device_lv2_gui::*;
|
||||
|
||||
#[cfg(feature = "vst2")] mod device_vst2;
|
||||
#[cfg(feature = "vst2")] pub use self::device_vst2::*;
|
||||
|
||||
/// Command-line entrypoint.
|
||||
#[allow(unused)]
|
||||
|
|
@ -370,12 +368,27 @@ impl_as_ref!(Option<Project>: |self: App|todo!());
|
|||
impl_as_mut!(Option<Project>: |self: App|todo!());
|
||||
impl_as_ref!(Option<MidiEditor>: |self: App|self.project.as_ref());
|
||||
impl_as_mut!(Option<MidiEditor>: |self: App|self.project.as_mut());
|
||||
|
||||
impl HasClip for App {
|
||||
fn clip_slot (&self) -> Option<Slot<MidiClip>> {
|
||||
self.project.clip_slot()
|
||||
}
|
||||
}
|
||||
impl HasClipsSize for App {
|
||||
fn clips_size (&self) -> &Sizer {
|
||||
&self.project.size_inner
|
||||
}
|
||||
}
|
||||
impl ScenesView for App {
|
||||
fn w_mid (&self) -> u16 {
|
||||
(self.size.w() as u16).saturating_sub(self.w_side())
|
||||
}
|
||||
fn w_side (&self) -> u16 {
|
||||
20
|
||||
}
|
||||
fn h_scenes (&self) -> u16 {
|
||||
(self.size.h() as u16).saturating_sub(20)
|
||||
}
|
||||
}
|
||||
|
||||
tui_keys!(self: App, input {
|
||||
#[cfg(feature = "prof2")] profiling::scope!("App::tui_keys!");
|
||||
|
|
@ -536,16 +549,10 @@ impl Dialog {
|
|||
]),
|
||||
|
||||
MenuItem::new(" Load session ", [
|
||||
AppCmd::Dialog {
|
||||
dialog: Dialog::Browse(
|
||||
BrowseTarget::LoadProject,
|
||||
Browse::new(None).unwrap().into()
|
||||
)
|
||||
//dialog: Dialog::Browse {
|
||||
//title: "Load session".into(),
|
||||
//filter: "\\.tek$",
|
||||
//}
|
||||
}
|
||||
AppCmd::Dialog { dialog: Dialog::Browse(
|
||||
BrowseTarget::LoadProject,
|
||||
Browse::new(None).unwrap().into()
|
||||
) }
|
||||
]),
|
||||
|
||||
MenuItem::new(" Exit ", [
|
||||
|
|
@ -642,21 +649,23 @@ pub const fn wrap_dec (index: usize, count: usize) -> usize {
|
|||
/// let item: tek::MenuItem = Default::default();
|
||||
/// ```
|
||||
#[derive(Clone)] pub struct MenuItem(pub Arc<str>, pub Arc<[AppCmd]>);
|
||||
|
||||
impl_debug!(MenuItem |self, w| { write!(w, "{}", &self.0) });
|
||||
|
||||
impl_default!(MenuItem: Self::new("", []));
|
||||
impl PartialEq for MenuItem { fn eq (&self, other: &Self) -> bool { self.0 == other.0 } }
|
||||
|
||||
impl PartialEq for MenuItem {
|
||||
fn eq (&self, other: &Self) -> bool {
|
||||
self.0 == other.0
|
||||
}
|
||||
}
|
||||
|
||||
impl MenuItem {
|
||||
pub fn new <const N: usize> (name: impl AsRef<str>, actions: [AppCmd; N]) -> Self {
|
||||
Self(name.as_ref().into(), Arc::new(actions))
|
||||
}
|
||||
}
|
||||
|
||||
//impl AsRef<Arc<[MenuItem]>> for MenuItems {
|
||||
//fn as_ref (&self) -> &Arc<[MenuItem]> {
|
||||
//&self.0
|
||||
//}
|
||||
//}
|
||||
|
||||
/// Browses for files to load/save.
|
||||
///
|
||||
/// ```
|
||||
|
|
@ -672,14 +681,6 @@ impl MenuItem {
|
|||
pub size: Sizer,
|
||||
}
|
||||
|
||||
//pub(crate) struct EntriesIterator<'a, S: Screen> {
|
||||
//pub browser: &'a Browse,
|
||||
//pub offset: usize,
|
||||
//pub length: usize,
|
||||
//pub index: usize,
|
||||
//_screen: std::marker::PhantomData<S>
|
||||
//}
|
||||
|
||||
#[derive(Clone, Debug)] pub enum BrowseTarget {
|
||||
SaveProject,
|
||||
LoadProject,
|
||||
|
|
@ -688,17 +689,6 @@ impl MenuItem {
|
|||
ImportClip(Arc<RwLock<Option<MidiClip>>>),
|
||||
ExportClip(Arc<RwLock<Option<MidiClip>>>),
|
||||
}
|
||||
|
||||
// Commands supported by [Browse]
|
||||
//#[derive(Debug, Clone, PartialEq)]
|
||||
//pub enum BrowseCommand {
|
||||
//Begin,
|
||||
//Cancel,
|
||||
//Confirm,
|
||||
//Select(usize),
|
||||
//Chdir(PathBuf),
|
||||
//Filter(Arc<str>),
|
||||
//}
|
||||
impl Browse {
|
||||
pub fn new (cwd: Option<PathBuf>) -> Usually<Self> {
|
||||
let cwd = if let Some(cwd) = cwd { cwd } else { std::env::current_dir()? };
|
||||
|
|
@ -794,5 +784,32 @@ impl HasTrackScroll for App {
|
|||
}
|
||||
|
||||
impl HasSceneScroll for App {
|
||||
fn scene_scroll (&self) -> usize { self.project.scene_scroll() }
|
||||
fn scene_scroll (&self) -> usize {
|
||||
self.project.scene_scroll()
|
||||
}
|
||||
}
|
||||
|
||||
//pub(crate) struct EntriesIterator<'a, S: Screen> {
|
||||
//pub browser: &'a Browse,
|
||||
//pub offset: usize,
|
||||
//pub length: usize,
|
||||
//pub index: usize,
|
||||
//_screen: std::marker::PhantomData<S>
|
||||
//}
|
||||
|
||||
// Commands supported by [Browse]
|
||||
//#[derive(Debug, Clone, PartialEq)]
|
||||
//pub enum BrowseCommand {
|
||||
//Begin,
|
||||
//Cancel,
|
||||
//Confirm,
|
||||
//Select(usize),
|
||||
//Chdir(PathBuf),
|
||||
//Filter(Arc<str>),
|
||||
//}
|
||||
|
||||
//impl AsRef<Arc<[MenuItem]>> for MenuItems {
|
||||
//fn as_ref (&self) -> &Arc<[MenuItem]> {
|
||||
//&self.0
|
||||
//}
|
||||
//}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue