From ec9352e0f8579bf0ae1d2a2b4401ce7541d238b0 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Fri, 18 Oct 2024 20:42:14 +0300 Subject: [PATCH] remove some old functions --- crates/tek_sequencer/src/sequencer_tui.rs | 39 +++++------------------ 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/crates/tek_sequencer/src/sequencer_tui.rs b/crates/tek_sequencer/src/sequencer_tui.rs index 818eba00..ad326bb0 100644 --- a/crates/tek_sequencer/src/sequencer_tui.rs +++ b/crates/tek_sequencer/src/sequencer_tui.rs @@ -62,6 +62,8 @@ impl Content for PhraseEditor { focused, entered, time_axis, note_axis, keys, phrase, buffer, note_len, .. } = self; let offset = Self::H_KEYS_OFFSET as u16; + let color = Color::Rgb(0,255,0); + let color = phrase.as_ref().map(|p|p.read().unwrap().color).unwrap_or(color); let keys = CustomWidget::new(|_|Ok(Some([32u16,4u16])), move|to: &mut TuiOutput|{ if to.area().h() >= 2 { to.buffer_update(to.area().set_w(5), &|cell, x, y|{ @@ -84,9 +86,11 @@ impl Content for PhraseEditor { for x in x2..x3 { let step = (time_0 + x2) * time_z; let next_step = (time_0 + x2 + 1) * time_z; - to.blit(&"-", x as u16, y, Some(PhraseEditor::::style_timer_step( - now, step as usize, next_step as usize - ))); + let mut style = Style::default(); + if step <= now && now < next_step { + style = style.yellow().bold().not_dim() + } + to.blit(&"-", x as u16, y, Some(style)); } } Ok(()) @@ -115,7 +119,7 @@ impl Content for PhraseEditor { let x = area.x() + Self::H_KEYS_OFFSET as u16 + time as u16; let y = area.y() + 1 + note as u16 / 2; let c = if note % 2 == 0 { "▀" } else { "▄" }; - to.blit(&c, x, y, self.style_focus()); + to.blit(&c, x, y, Some(Style::default().fg(color))); } } Ok(()) @@ -239,33 +243,6 @@ impl PhraseEditor { } } } - pub(crate) fn style_focus (&self) -> Option