fbpr: reenable background

This commit is contained in:
🪞👃🪞 2024-12-06 00:15:53 +01:00
parent bf3c7630a4
commit 2561e5221d

View file

@ -22,11 +22,11 @@ impl<'a, T: HasEditor> From<&'a T> for PhraseView<'a> {
let height = editor.size.h();
let note_point = editor.note_point.load(Ordering::Relaxed);
let mut note_lo = editor.note_lo.load(Ordering::Relaxed);
let mut note_hi = 127.min(note_lo + height);
if note_point < note_lo {
note_lo = note_point;
editor.note_lo.store(note_lo, Ordering::Relaxed);
}
let mut note_hi = 127.min(note_lo + height);
if note_point > note_hi {
note_lo += note_point - note_hi;
note_hi = note_point;
@ -85,7 +85,7 @@ impl<'a> Content for PhraseView<'a> {
" {} ", size.format()
);
if *focused && *entered {
lower_right = format!(" Note: {} ({}) {} {lower_right}",
lower_right = format!("Note: {} ({}) {} {lower_right}",
note_point, to_note_name(*note_point), pulses_to_name(*note_len)
);
}
@ -95,7 +95,7 @@ impl<'a> Content for PhraseView<'a> {
if *entered {""} else {" "}
);
if let Some(phrase) = phrase {
upper_right = format!(" Time: {}/{} {} {upper_right}",
upper_right = format!("Time: {}/{} {} {upper_right}",
time_point, phrase.read().unwrap().length, pulses_to_name(view_mode.time_zoom()),
)
};
@ -132,11 +132,6 @@ impl<'a> Content for PhraseView<'a> {
)
.fill_x()
.bg(Color::Rgb(40, 50, 30)),
//.border(Lozenge(Style::default().bg(Color::Rgb(40, 50, 30)).fg(if *focused{
//Color::Rgb(100, 110, 40)
//} else {
//Color::Rgb(70, 80, 50)
//}))),
Widget::new(|to:[u16;2]|Ok(Some(to.clip_h(1))), move|to: &mut TuiOutput|{
//let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(40,50,30));
//let playhead_active = playhead_inactive.clone().yellow().bold().not_dim();
@ -351,11 +346,19 @@ impl PhraseViewMode {
//cell.set_fg(Color::Rgb(48, 64, 56));
let style = Style::default().fg(Color::Rgb(255, 255, 255));
let mut notes_on = [false;128];
for (y, _) in (127..0).enumerate() {
for (x, _) in (0..phrase.length).step_by(time_zoom).enumerate() {
for (y, note) in (0..127).rev().enumerate() {
for (x, time) in (0..target.width).map(|x|(x, x*time_zoom)) {
let cell = target.get_mut(x, y).unwrap();
cell.set_fg(Color::Rgb(28, 35, 25));
cell.set_char('·');
cell.set_fg(Color::Rgb(38, 45, 35));
cell.set_char(if time % 384 == 0 {
'│'
} else if time % 96 == 0 {
'╎'
} else if note % 12 == 0 {
'-'
} else {
'·'
});
}
}
for (x, time_start) in (0..phrase.length).step_by(time_zoom).enumerate() {