mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
separate render/content macros; add has_jack
This commit is contained in:
parent
08184f9906
commit
e62e36d558
19 changed files with 183 additions and 226 deletions
|
|
@ -1,17 +1,16 @@
|
|||
use crate::*;
|
||||
|
||||
pub struct ClipSelected {
|
||||
pub(crate) title: &'static str,
|
||||
pub(crate) name: Arc<str>,
|
||||
pub(crate) color: ItemPalette,
|
||||
pub(crate) time: Arc<str>,
|
||||
}
|
||||
|
||||
render!(TuiOut: (self: ClipSelected) =>
|
||||
FieldV(self.color, self.title, format!("{} {}", self.time, self.name)));
|
||||
|
||||
content!(TuiOut: |self: ClipSelected|FieldV(
|
||||
self.color,
|
||||
self.title,
|
||||
format!("{} {}", self.time, self.name)
|
||||
));
|
||||
impl ClipSelected {
|
||||
|
||||
/// Shows currently playing clip with beats elapsed
|
||||
pub fn play_clip <T: HasPlayClip + HasClock> (state: &T) -> Self {
|
||||
let (name, color) = if let Some((_, Some(clip))) = state.play_clip() {
|
||||
|
|
@ -31,7 +30,6 @@ impl ClipSelected {
|
|||
.unwrap_or_else(||String::from(" ")).into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows next clip with beats remaining until switchover
|
||||
pub fn next_clip <T: HasPlayClip> (state: &T) -> Self {
|
||||
let mut time: Arc<str> = String::from("--.-.--").into();
|
||||
|
|
@ -69,5 +67,4 @@ impl ClipSelected {
|
|||
};
|
||||
Self { title: "Next", time, name, color, }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue