diff --git a/crates/tek_sequencer/src/sequencer_tui.rs b/crates/tek_sequencer/src/sequencer_tui.rs index 140211f6..33b55e0b 100644 --- a/crates/tek_sequencer/src/sequencer_tui.rs +++ b/crates/tek_sequencer/src/sequencer_tui.rs @@ -77,6 +77,7 @@ impl Content for PhraseEditor { buffer.get(src_x, buffer.height - src_y).map(|src|{ cell.set_symbol(src.symbol()); cell.set_fg(src.fg); + cell.set_bg(src.bg); }); } }); @@ -97,30 +98,34 @@ impl Content for PhraseEditor { }); let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0)); let playhead_active = playhead_inactive.yellow().bold().not_dim(); - let playhead = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{ - if let Some(_) = phrase { - let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length; - let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis; - for x in 0..10 { - let this_step = (first_beat + 0) * time_zoom; - let next_step = (first_beat + 1) * time_zoom; - let x = to.area().x() + x; - to.blit(&"-", x, to.area.y(), Some(if this_step <= now && now < next_step { - playhead_active - } else { - playhead_active - })); + let playhead = CustomWidget::new( + |to:[u16;2]|Ok(Some(to.clip_h(1))), + move|to: &mut TuiOutput|{ + if let Some(_) = phrase { + let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length; + let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis; + for x in 0..10 { + let this_step = (first_beat + 0) * time_zoom; + let next_step = (first_beat + 1) * time_zoom; + let x = to.area().x() + x; + to.blit(&"-", x, to.area.y(), Some(if this_step <= now && now < next_step { + playhead_active + } else { + playhead_active + })); + } } + Ok(()) } - Ok(()) - }).align_sw().fill_xy().push_xy(1, 1); - let border_color = if *focused{Color::Rgb(100, 110, 40)}else{Color::Rgb(70, 80, 50)}; + ).push_x(5).align_sw(); + let border_color = if *focused{Color::Rgb(100, 110, 40)}else{Color::Rgb(70, 80, 50)}; let title_color = if *focused{Color::Rgb(150, 160, 90)}else{Color::Rgb(120, 130, 100)}; let border = Lozenge(Style::default().bg(Color::Rgb(40, 50, 30)).fg(border_color)); - let note_area = lay!(notes, cursor, playhead).fill_x(); + let note_area = lay!(notes, cursor).fill_x(); let piano_roll = row!(keys, note_area).fill_x(); let content_bg = Color::Rgb(40, 50, 30); let content = piano_roll.bg(content_bg).border(border); + let content = lay!(content, playhead); let mut upper_left = String::from("Sequencer"); if let Some(phrase) = phrase { upper_left = format!("{upper_left}: {}", phrase.read().unwrap().name);