wip: inc/dec phrase length

This commit is contained in:
🪞👃🪞 2024-10-16 11:32:56 +03:00
parent 26d75340f6
commit ff342963a1
3 changed files with 56 additions and 13 deletions

View file

@ -16,17 +16,21 @@ impl Content for PhrasePool<Tui> {
fn content (&self) -> impl Widget<Engine = Tui> {
let content = col!(
(i, phrase) in self.phrases.iter().enumerate() => Layers::new(|add|{
let Phrase { ref name, color, length, .. } = *phrase.read().unwrap();
let ticks = length % PPQ;
let beats = length % (4 * PPQ);
let bars = length / (4 * PPQ);
let row1 = lay!(format!(" {i}").align_w().fill_x(),
if let Some(PhrasePoolMode::Length(phrase, length, focus)) = self.mode {
PhraseLength::new(length, Some(focus))
if self.focused && i == phrase {
PhraseLength::new(length, Some(focus))
} else {
PhraseLength::new(length, None)
}
} else {
PhraseLength::new(length, None)
}.align_e().fill_x()
).fill_x();
let row2 = if let Some(PhrasePoolMode::Rename(phrase, _)) = self.mode {
if self.focused && i == phrase {
format!(" {}", name)
@ -36,12 +40,15 @@ impl Content for PhrasePool<Tui> {
} else {
format!(" {}", name)
};
add(&col!(row1, row2).fill_x().bg(if i == self.phrase {
color //Color::Rgb(40, 50, 30)
} else {
color //Color::Rgb(28, 35, 25)
}))?;
if self.focused && i == self.phrase { add(&CORNERS)?; }
Ok(())
})
)