position playhead; different note area bg

This commit is contained in:
🪞👃🪞 2024-10-22 21:48:47 +03:00
parent c56758b616
commit 478624711f

View file

@ -77,6 +77,7 @@ impl Content for PhraseEditor<Tui> {
buffer.get(src_x, buffer.height - src_y).map(|src|{ buffer.get(src_x, buffer.height - src_y).map(|src|{
cell.set_symbol(src.symbol()); cell.set_symbol(src.symbol());
cell.set_fg(src.fg); cell.set_fg(src.fg);
cell.set_bg(src.bg);
}); });
} }
}); });
@ -97,7 +98,9 @@ impl Content for PhraseEditor<Tui> {
}); });
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0)); 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_active = playhead_inactive.yellow().bold().not_dim();
let playhead = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{ let playhead = CustomWidget::new(
|to:[u16;2]|Ok(Some(to.clip_h(1))),
move|to: &mut TuiOutput|{
if let Some(_) = phrase { if let Some(_) = phrase {
let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length; let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length;
let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis; let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis;
@ -113,14 +116,16 @@ impl Content for PhraseEditor<Tui> {
} }
} }
Ok(()) Ok(())
}).align_sw().fill_xy().push_xy(1, 1); }
).push_x(5).align_sw();
let border_color = if *focused{Color::Rgb(100, 110, 40)}else{Color::Rgb(70, 80, 50)}; 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 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 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 piano_roll = row!(keys, note_area).fill_x();
let content_bg = Color::Rgb(40, 50, 30); let content_bg = Color::Rgb(40, 50, 30);
let content = piano_roll.bg(content_bg).border(border); let content = piano_roll.bg(content_bg).border(border);
let content = lay!(content, playhead);
let mut upper_left = String::from("Sequencer"); let mut upper_left = String::from("Sequencer");
if let Some(phrase) = phrase { if let Some(phrase) = phrase {
upper_left = format!("{upper_left}: {}", phrase.read().unwrap().name); upper_left = format!("{upper_left}: {}", phrase.read().unwrap().name);