mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
add MessageCommand::Dismiss
This commit is contained in:
parent
0a090765d3
commit
ebd0f18c9c
5 changed files with 25 additions and 9 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
:arranger))))))
|
:arranger))))))
|
||||||
|
|
||||||
(keys
|
(keys
|
||||||
|
(layer-if :mode-message "./keys_message.edn")
|
||||||
(layer-if :mode-device-add "./keys_device_add.edn")
|
(layer-if :mode-device-add "./keys_device_add.edn")
|
||||||
(layer-if :mode-pool-import "./keys_pool_file.edn")
|
(layer-if :mode-pool-import "./keys_pool_file.edn")
|
||||||
(layer-if :mode-pool-export "./keys_pool_file.edn")
|
(layer-if :mode-pool-export "./keys_pool_file.edn")
|
||||||
|
|
|
||||||
2
config/keys_message.edn
Normal file
2
config/keys_message.edn
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
(@esc message dismiss)
|
||||||
|
(@enter message dismiss)
|
||||||
|
|
@ -20,6 +20,7 @@ handle!(TuiIn: |self: Tek, input|Ok(if let Some(command) = self.config.keys.comm
|
||||||
expose!([self: Tek]
|
expose!([self: Tek]
|
||||||
([bool]
|
([bool]
|
||||||
(":mode-editor" self.is_editing())
|
(":mode-editor" self.is_editing())
|
||||||
|
(":mode-message" matches!(self.modal, Some(Modal::Message(..))))
|
||||||
(":mode-device-add" matches!(self.modal, Some(Modal::Device(..))))
|
(":mode-device-add" matches!(self.modal, Some(Modal::Device(..))))
|
||||||
(":mode-clip" !self.is_editing() && self.selected.is_clip())
|
(":mode-clip" !self.is_editing() && self.selected.is_clip())
|
||||||
(":mode-track" !self.is_editing() && self.selected.is_track())
|
(":mode-track" !self.is_editing() && self.selected.is_track())
|
||||||
|
|
@ -130,13 +131,14 @@ impose!([app: Tek]
|
||||||
("enqueue" [c: Arc<RwLock<MidiClip>>] Some(Self::Enqueue(c)))
|
("enqueue" [c: Arc<RwLock<MidiClip>>] Some(Self::Enqueue(c)))
|
||||||
("launch" [] Some(Self::Launch))
|
("launch" [] Some(Self::Launch))
|
||||||
("select" [t: Selection] Some(t.map(Self::Select).expect("no selection")))
|
("select" [t: Selection] Some(t.map(Self::Select).expect("no selection")))
|
||||||
("clock" [,..a] ns!(ClockCommand, app.clock(), a, Self::Clock))
|
("clock" [,..a] ns!(ClockCommand, app.clock(), a, Self::Clock))
|
||||||
("scene" [,..a] ns!(SceneCommand, app, a, Self::Scene))
|
("scene" [,..a] ns!(SceneCommand, app, a, Self::Scene))
|
||||||
("track" [,..a] ns!(TrackCommand, app, a, Self::Track))
|
("track" [,..a] ns!(TrackCommand, app, a, Self::Track))
|
||||||
("input" [,..a] ns!(InputCommand, app, a, Self::Input))
|
("input" [,..a] ns!(InputCommand, app, a, Self::Input))
|
||||||
("output" [,..a] ns!(OutputCommand, app, a, Self::Output))
|
("output" [,..a] ns!(OutputCommand, app, a, Self::Output))
|
||||||
("clip" [,..a] ns!(ClipCommand, app, a, Self::Clip))
|
("clip" [,..a] ns!(ClipCommand, app, a, Self::Clip))
|
||||||
("device" [,..a] ns!(DeviceCommand, app, a, Self::Device))
|
("device" [,..a] ns!(DeviceCommand, app, a, Self::Device))
|
||||||
|
("message" [,..a] ns!(MessageCommand, app, a, Self::Message))
|
||||||
("pool" [,..a] app.pool.as_ref().map(|p|ns!(PoolCommand, p, a, Self::Pool)).flatten())
|
("pool" [,..a] app.pool.as_ref().map(|p|ns!(PoolCommand, p, a, Self::Pool)).flatten())
|
||||||
("editor" [,..a] app.editor().map(|e|ns!(MidiEditCommand, e, a, Self::Editor)).flatten())
|
("editor" [,..a] app.editor().map(|e|ns!(MidiEditCommand, e, a, Self::Editor)).flatten())
|
||||||
("sampler" [,..a] app.sampler().map(|s|ns!(SamplerCommand, s, a, Self::Sampler)).flatten())
|
("sampler" [,..a] app.sampler().map(|s|ns!(SamplerCommand, s, a, Self::Sampler)).flatten())
|
||||||
|
|
@ -166,6 +168,9 @@ impose!([app: Tek]
|
||||||
("pick" [index: usize] Some(Self::Pick(index.unwrap())))
|
("pick" [index: usize] Some(Self::Pick(index.unwrap())))
|
||||||
("add" [index: usize] Some(Self::Add(index.unwrap()))))
|
("add" [index: usize] Some(Self::Add(index.unwrap()))))
|
||||||
|
|
||||||
|
(MessageCommand:
|
||||||
|
("dismiss" [] Some(Self::Dismiss)))
|
||||||
|
|
||||||
(SceneCommand:
|
(SceneCommand:
|
||||||
("add" [] Some(Self::Add))
|
("add" [] Some(Self::Add))
|
||||||
("delete" [a: Option<usize>] Some(Self::Del(a.flatten().unwrap())))
|
("delete" [a: Option<usize>] Some(Self::Del(a.flatten().unwrap())))
|
||||||
|
|
@ -198,6 +203,7 @@ defcom!([self, app: Tek]
|
||||||
(Clip [cmd: ClipCommand] cmd.delegate(app, Self::Clip)?)
|
(Clip [cmd: ClipCommand] cmd.delegate(app, Self::Clip)?)
|
||||||
(Clock [cmd: ClockCommand] cmd.delegate(app, Self::Clock)?)
|
(Clock [cmd: ClockCommand] cmd.delegate(app, Self::Clock)?)
|
||||||
(Device [cmd: DeviceCommand] cmd.delegate(app, Self::Device)?)
|
(Device [cmd: DeviceCommand] cmd.delegate(app, Self::Device)?)
|
||||||
|
(Message [cmd: MessageCommand] cmd.delegate(app, Self::Message)?)
|
||||||
(Editor [cmd: MidiEditCommand] delegate_to_editor(app, cmd)?)
|
(Editor [cmd: MidiEditCommand] delegate_to_editor(app, cmd)?)
|
||||||
(Pool [cmd: PoolCommand] delegate_to_pool(app, cmd)?)
|
(Pool [cmd: PoolCommand] delegate_to_pool(app, cmd)?)
|
||||||
(ToggleHelp [] cmd!(app.toggle_modal(Some(Modal::Help))))
|
(ToggleHelp [] cmd!(app.toggle_modal(Some(Modal::Help))))
|
||||||
|
|
@ -222,6 +228,9 @@ defcom!([self, app: Tek]
|
||||||
(Pick [i: usize] cmd!(app.device_pick(i)))
|
(Pick [i: usize] cmd!(app.device_pick(i)))
|
||||||
(Add [i: usize] cmd!(app.device_add(i))))
|
(Add [i: usize] cmd!(app.device_add(i))))
|
||||||
|
|
||||||
|
(MessageCommand
|
||||||
|
(Dismiss [] cmd!(app.message_dismiss())))
|
||||||
|
|
||||||
(TrackCommand
|
(TrackCommand
|
||||||
(TogglePlay [] Some(Self::TogglePlay))
|
(TogglePlay [] Some(Self::TogglePlay))
|
||||||
(ToggleSolo [] Some(Self::ToggleSolo))
|
(ToggleSolo [] Some(Self::ToggleSolo))
|
||||||
|
|
|
||||||
|
|
@ -429,6 +429,10 @@ impl Tek {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn message_dismiss (&mut self) {
|
||||||
|
self.modal = None;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
has_size!(<TuiOut>|self: Tek|&self.size);
|
has_size!(<TuiOut>|self: Tek|&self.size);
|
||||||
|
|
@ -471,7 +475,7 @@ pub enum Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
content!(TuiOut: |self: Message| match self {
|
content!(TuiOut: |self: Message| match self {
|
||||||
Self::FailedToAddDevice => "Failed to add device"
|
Self::FailedToAddDevice => "Failed to add device."
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Represents the current user selection in the arranger
|
/// Represents the current user selection in the arranger
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ impl Tek {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn view_modal_message <'a> (&'a self, message: &'a Message) -> impl Content<TuiOut> + use<'a> {
|
fn view_modal_message <'a> (&'a self, message: &'a Message) -> impl Content<TuiOut> + use<'a> {
|
||||||
Bsp::s(message, "[ OK ]")
|
Bsp::s(message, Bsp::s("", "[ OK ]"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Spacing between tracks.
|
/// Spacing between tracks.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue