mirror of
https://codeberg.org/unspeaker/tek.git
synced 2026-07-17 07:46: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")))
|
||||
}
|
||||
|
||||
pub fn new_shared_run (
|
||||
exit: &Exit, jack: &Jack<'static>, project: Arrangement, config: Config, mode: impl AsRef<str>
|
||||
pub fn new_shared_run <W: std::io::Write + Send + Sync + 'static> (
|
||||
exit: &Exit,
|
||||
output: W,
|
||||
jack: &Jack<'static>,
|
||||
project: Arrangement,
|
||||
config: Config,
|
||||
mode: impl AsRef<str>
|
||||
) -> Usually<(Arc<RwLock<Self>>, Task, Task)> {
|
||||
let state = Self::new_shared(&jack, project, config, mode);
|
||||
let keyboard = tui_input(
|
||||
exit.as_ref(), &state, Duration::from_millis(100)
|
||||
)?;
|
||||
let terminal = tui_output(
|
||||
&mut std::io::stdout(), exit.as_ref(), &state, Duration::from_millis(10)
|
||||
)?;
|
||||
let keyboard = tui_input(exit.as_ref(), &state, Duration::from_millis(100))?;
|
||||
let terminal = tui_output(exit.as_ref(), &state, Duration::from_millis(10), output)?;
|
||||
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())
|
||||
}))).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() {
|
||||
BrowseTarget::SaveProject => "Save 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::ImportClip(_) => "Import 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") => {
|
||||
let selected = state.dialog.device_kind().unwrap();
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl Bind<TuiEvent, Arc<str>> {
|
|||
// TODO
|
||||
Ok(())
|
||||
} 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 {
|
||||
commands: [item.expr()?.tail()?.unwrap_or_default().into()].into(),
|
||||
condition: None,
|
||||
|
|
|
|||
17
src/tek.rs
17
src/tek.rs
|
|
@ -7,7 +7,7 @@
|
|||
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};
|
||||
|
|
@ -90,21 +90,16 @@ pub fn main () -> Usually<()> {
|
|||
Config::watch(|config|{
|
||||
Exit::run(|exit|{
|
||||
let state = Jack::new_run("tek", move|jack|{
|
||||
Ok(App::new(&jack, Arrangement::new(
|
||||
&jack,
|
||||
None,
|
||||
Clock::new(&jack, Some(51.))?,
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
vec![],
|
||||
), config, ":menu"))
|
||||
let clock = Clock::new(&jack, Some(51.))?;
|
||||
let project = Arrangement::new(&jack, None, clock, vec![], vec![], vec![], vec![]);
|
||||
let app = App::new(&jack, project, config, ":menu");
|
||||
Ok(app)
|
||||
})?;
|
||||
let keyboard = tui_input(
|
||||
exit.as_ref(), &state, Duration::from_millis(100)
|
||||
)?;
|
||||
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(())
|
||||
})
|
||||
|
|
|
|||
2
tengri
2
tengri
|
|
@ -1 +1 @@
|
|||
Subproject commit 7613c655000949180e6e838ce96c0f168b8d4cc7
|
||||
Subproject commit dd7091bda11504a16ba8de0c0b719359df37b5ef
|
||||
Loading…
Add table
Add a link
Reference in a new issue