fixed up some parsing and removed some edn mentions

This commit is contained in:
🪞👃🪞 2025-01-18 01:54:06 +01:00
parent 5e7b867aba
commit 452bdf9598
15 changed files with 290 additions and 292 deletions

View file

@ -184,7 +184,7 @@ impl MidiViewer for MidiEditor {
fn clip_mut (&mut self) -> &mut Option<Arc<RwLock<MidiClip>>> { self.mode.clip_mut() }
fn set_clip (&mut self, p: Option<&Arc<RwLock<MidiClip>>>) { self.mode.set_clip(p) }
}
edn_command!(MidiEditCommand: |state: MidiEditor| {
atom_command!(MidiEditCommand: |state: MidiEditor| {
("note/put" [_a: bool] Self::PutNote)
("note/del" [_a: bool] Self::PutNote)
("note/pos" [a: usize] Self::SetNoteCursor(a.expect("no note cursor")))
@ -208,14 +208,14 @@ edn_command!(MidiEditCommand: |state: MidiEditor| {
Show(Option<Arc<RwLock<MidiClip>>>),
}
impl MidiEditCommand {
fn from_tui_event (state: &MidiEditor, input: &impl EdnInput) -> Usually<Option<Self>> {
use EdnItem::*;
let edns = EdnItem::read_all(KEYS_EDIT)?;
for item in edns.iter() {
if let Exp(e) = item {
fn from_tui_event (state: &MidiEditor, input: &impl AtomInput) -> Usually<Option<Self>> {
use AtomItem::*;
let atoms = AtomItem::read_all(KEYS_EDIT)?;
for atom in atoms.iter() {
if let Exp(e) = atom {
match e.as_slice() {
[Sym(key), command, args @ ..] if input.matches_edn(key) => {
return Ok(MidiEditCommand::from_edn(state, command, args))
[Sym(key), command, args @ ..] if input.matches_atom(key) => {
return Ok(MidiEditCommand::from_atom(state, command, args))
}
_ => {}
}