From 8e0d53764b1832240305f4daa38040f3c22f02c9 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Thu, 7 Aug 2025 22:46:50 +0300 Subject: [PATCH] huh. --- crates/app/app.rs | 53 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/crates/app/app.rs b/crates/app/app.rs index 176514ec..f2c58c88 100644 --- a/crates/app/app.rs +++ b/crates/app/app.rs @@ -63,30 +63,6 @@ pub struct App { /// Base color. pub color: ItemTheme, } -/// Configuration -#[derive(Default, Debug)] -pub struct Config { - /// XDG basedirs - pub dirs: BaseDirectories, - /// Available view profiles - pub profiles: Arc, Profile>>>, - /// Available input bindings - pub bindings: Arc, Binding>>>, -} -/// Profile -#[derive(Default, Debug)] -pub struct Profile { - /// Path of configuration entrypoint - pub path: PathBuf, - /// Name of configuration - pub name: Option>, - /// Description of configuration - pub info: Option>, - /// View definition - pub view: Arc, - // Input keymap - pub keys: EventMap, -} macro_rules!dsl_expose(($Struct:ident { $($fn:ident: $ret:ty = |$self:ident|$body:expr);* $(;)? })=>{ #[tengri_proc::expose] impl $Struct { $(fn $fn (&$self) -> $ret { $body })* } }); @@ -134,8 +110,7 @@ dsl_expose!(App { select_track_prev: Selection = |self|self.selection().select_track_prev(); clip_selected: Option>> = |self|match self.selection() { Selection::TrackClip { track, scene } => self.scenes()[*scene].clips[*track].clone(), - _ => None - }; + _ => None }; device_kind: usize = |self|if let Some(Dialog::Device(index)) = self.dialog { index } else { 0 }; device_kind_next: usize = |self|if let Some(Dialog::Device(index)) = self.dialog { @@ -294,6 +269,20 @@ maybe_has!(Scene: |self: App| { MaybeHas::::get(&self.project) }; impl HasClipsSize for App { fn clips_size (&self) -> &Measure { &self.project.inner_size } } impl HasTrackScroll for App { fn track_scroll (&self) -> usize { self.project.track_scroll() } } impl HasSceneScroll for App { fn scene_scroll (&self) -> usize { self.project.scene_scroll() } } +/// Profile +#[derive(Default, Debug)] +pub struct Profile { + /// Path of configuration entrypoint + pub path: PathBuf, + /// Name of configuration + pub name: Option>, + /// Description of configuration + pub info: Option>, + /// View definition + pub view: Arc, + // Input keymap + pub keys: EventMap, +} impl Profile { fn from_dsl (dsl: impl Dsl) -> Usually { let mut profile = Self { ..Default::default() }; @@ -309,6 +298,16 @@ impl Profile { Ok(profile) } } +/// Configuration +#[derive(Default, Debug)] +pub struct Config { + /// XDG basedirs + pub dirs: BaseDirectories, + /// Available view profiles + pub profiles: Arc, Profile>>>, + /// Available input bindings + pub bindings: Arc, EventMap>>>, +} impl Config { const PROFILES: &'static str = "profiles.edn"; const BINDINGS: &'static str = "bindings.edn"; @@ -342,7 +341,7 @@ impl Config { if let Some(id) = head.sym()? { cfgs.bindings.write().unwrap().insert( id.into(), - Binding::from_dsl(tail.tail()?)? + EventMap::from_dsl(&mut tail.tail()?)? ); } } else {