mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 15:56:57 +02:00
restruct: 9e
This commit is contained in:
parent
19ab138320
commit
a8febbe96f
4 changed files with 20 additions and 23 deletions
22
src/app.rs
22
src/app.rs
|
|
@ -86,16 +86,17 @@ impl App {
|
||||||
Arc::new(RwLock::new(App::new(jack, project, config, ":menu")))
|
Arc::new(RwLock::new(App::new(jack, project, config, ":menu")))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_shared_run (
|
pub fn new_shared_run <W: std::io::Write + Send + Sync + 'static> (
|
||||||
exit: &Exit, jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef<str>
|
exit: &Exit,
|
||||||
|
output: W,
|
||||||
|
jack: &Jack<'static>,
|
||||||
|
project: Arrangement,
|
||||||
|
config: Config,
|
||||||
|
mode: impl AsRef<str>
|
||||||
) -> Usually<(Arc<RwLock<Self>>, Task, Task)> {
|
) -> Usually<(Arc<RwLock<Self>>, Task, Task)> {
|
||||||
let state = Self::new_shared(&jack, project, config, mode);
|
let state = Self::new_shared(&jack, project, config, mode);
|
||||||
let keyboard = tui_input(
|
let keyboard = tui_input(exit.as_ref(), &state, Duration::from_millis(100))?;
|
||||||
exit.as_ref(), &state, Duration::from_millis(100)
|
let terminal = tui_output(exit.as_ref(), &state, Duration::from_millis(10), output)?;
|
||||||
)?;
|
|
||||||
let terminal = tui_output(
|
|
||||||
&mut std::io::stdout(), exit.as_ref(), &state, Duration::from_millis(10)
|
|
||||||
)?;
|
|
||||||
Ok((state, keyboard, terminal))
|
Ok((state, keyboard, terminal))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,7 +530,7 @@ fn app_interpret_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usua
|
||||||
Ok(to.area().into())
|
Ok(to.area().into())
|
||||||
}))).draw(to),
|
}))).draw(to),
|
||||||
|
|
||||||
Some(":browse/title") => w_full(origin_w(field_v(ItemColor::default(),
|
Some(":browse/title") => w_full(origin_w(field_v(ItemTheme::default(),
|
||||||
match state.dialog.browser_target().unwrap() {
|
match state.dialog.browser_target().unwrap() {
|
||||||
BrowseTarget::SaveProject => "Save project:",
|
BrowseTarget::SaveProject => "Save project:",
|
||||||
BrowseTarget::LoadProject => "Load project:",
|
BrowseTarget::LoadProject => "Load project:",
|
||||||
|
|
@ -537,7 +538,8 @@ fn app_interpret_word (state: &App, to: &mut Tui, dsl: &impl Expression) -> Usua
|
||||||
BrowseTarget::ExportSample(_) => "Export sample:",
|
BrowseTarget::ExportSample(_) => "Export sample:",
|
||||||
BrowseTarget::ImportClip(_) => "Import clip:",
|
BrowseTarget::ImportClip(_) => "Import clip:",
|
||||||
BrowseTarget::ExportClip(_) => "Export clip:",
|
BrowseTarget::ExportClip(_) => "Export clip:",
|
||||||
}, w_shrink(3, h_exact(1, fg(g(96), x_repeat("🭻"))))))).draw(to),
|
}, h_exact(1, fg(g(96), x_repeat("🭻")))
|
||||||
|
))).draw(to),
|
||||||
|
|
||||||
Some(":device") => {
|
Some(":device") => {
|
||||||
let selected = state.dialog.device_kind().unwrap();
|
let selected = state.dialog.device_kind().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ impl Bind<TuiEvent, Arc<str>> {
|
||||||
// TODO
|
// TODO
|
||||||
Ok(())
|
Ok(())
|
||||||
} else if let Ok(Some(_word)) = item.expr().head().word() {
|
} else if let Ok(Some(_word)) = item.expr().head().word() {
|
||||||
if let Some(key) = TuiEvent::named(item.expr()?.head()?)? {
|
if let Some(key) = TuiKey::from_dsl(item.expr()?.head()?)? {
|
||||||
map.add(key, Binding {
|
map.add(key, Binding {
|
||||||
commands: [item.expr()?.tail()?.unwrap_or_default().into()].into(),
|
commands: [item.expr()?.tail()?.unwrap_or_default().into()].into(),
|
||||||
condition: None,
|
condition: None,
|
||||||
|
|
|
||||||
17
src/tek.rs
17
src/tek.rs
|
|
@ -7,7 +7,7 @@
|
||||||
pub(crate) const HEADER: &'static str = r#"
|
pub(crate) const HEADER: &'static str = r#"
|
||||||
|
|
||||||
~ █▀█▀█ █▀▀█ █ █ ~~~ ~ ~ ~~ ~ ~ ~ ~~ ~ ~ ~ ~
|
~ █▀█▀█ █▀▀█ █ █ ~~~ ~ ~ ~~ ~ ~ ~ ~~ ~ ~ ~ ~
|
||||||
█ █▀ █▀▀▄ ~ v0.4.0, 2026 winter (or is it) ~
|
█ █▀ █▀▀▄ ~ v0.4.0, 2026 heatwave edition ~
|
||||||
~ ▀ █▀▀█ ▀ ▀ ~ ~~~ ~ ~ ~ ~ ~~~ ~~~ ~ ~~ "#;
|
~ ▀ █▀▀█ ▀ ▀ ~ ~~~ ~ ~ ~ ~ ~~~ ~~~ ~ ~~ "#;
|
||||||
|
|
||||||
#[cfg(feature = "cli")] use clap::{self, Parser, Subcommand};
|
#[cfg(feature = "cli")] use clap::{self, Parser, Subcommand};
|
||||||
|
|
@ -90,21 +90,16 @@ pub fn main () -> Usually<()> {
|
||||||
Config::watch(|config|{
|
Config::watch(|config|{
|
||||||
Exit::run(|exit|{
|
Exit::run(|exit|{
|
||||||
let state = Jack::new_run("tek", move|jack|{
|
let state = Jack::new_run("tek", move|jack|{
|
||||||
Ok(App::new(&jack, Arrangement::new(
|
let clock = Clock::new(&jack, Some(51.))?;
|
||||||
&jack,
|
let project = Arrangement::new(&jack, None, clock, vec![], vec![], vec![], vec![]);
|
||||||
None,
|
let app = App::new(&jack, project, config, ":menu");
|
||||||
Clock::new(&jack, Some(51.))?,
|
Ok(app)
|
||||||
vec![],
|
|
||||||
vec![],
|
|
||||||
vec![],
|
|
||||||
vec![],
|
|
||||||
), config, ":menu"))
|
|
||||||
})?;
|
})?;
|
||||||
let keyboard = tui_input(
|
let keyboard = tui_input(
|
||||||
exit.as_ref(), &state, Duration::from_millis(100)
|
exit.as_ref(), &state, Duration::from_millis(100)
|
||||||
)?;
|
)?;
|
||||||
let terminal = tui_output(
|
let terminal = tui_output(
|
||||||
&mut std::io::stdout(), exit.as_ref(), &state, Duration::from_millis(10)
|
exit.as_ref(), &state, Duration::from_millis(10), std::io::stdout(),
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
|
|
|
||||||
2
tengri
2
tengri
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7613c655000949180e6e838ce96c0f168b8d4cc7
|
Subproject commit dd7091bda11504a16ba8de0c0b719359df37b5ef
|
||||||
Loading…
Add table
Add a link
Reference in a new issue