show debug values of note/time axis

This commit is contained in:
🪞👃🪞 2024-10-22 22:27:28 +03:00
parent d555ce1e9e
commit 932e3a5427

View file

@ -71,8 +71,8 @@ impl Content for PhraseEditor<Tui> {
let area = to.area(); let area = to.area();
to.buffer_update(area, &move |cell, x, y|{ to.buffer_update(area, &move |cell, x, y|{
cell.set_bg(notes_bg_null); cell.set_bg(notes_bg_null);
let src_x = ((x as usize + time_axis.start) * time_axis.scale) as usize; let src_x = (x as usize + time_axis.start) * time_axis.scale;
let src_y = (y as usize + note_axis.start) as usize; let src_y = y as usize + note_axis.start;
if src_x < buffer.width && src_y < buffer.height - 1 { if src_x < buffer.width && src_y < buffer.height - 1 {
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());
@ -117,7 +117,7 @@ impl Content for PhraseEditor<Tui> {
} }
Ok(()) Ok(())
} }
).push_x(5).align_sw(); ).push_x(6).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));
@ -130,9 +130,18 @@ impl Content for PhraseEditor<Tui> {
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);
} }
let mut upper_right = format!("Zoom: {}", ppq_to_name(time_axis.scale)); let mut upper_right = format!("Zoom: {} (+{}:{}*{})",
ppq_to_name(time_axis.scale),
time_axis.start,
time_axis.point.unwrap_or(0),
time_axis.scale,
);
if *focused && *entered { if *focused && *entered {
upper_right = format!("Note: {} {upper_right}", ppq_to_name(*note_len)); upper_right = format!("Note: {} (+{}:{}) {upper_right}",
ppq_to_name(*note_len),
note_axis.start,
note_axis.point.unwrap_or(0)
);
} }
lay!( lay!(
content, content,