mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
position playhead; different note area bg
This commit is contained in:
parent
c56758b616
commit
478624711f
1 changed files with 22 additions and 17 deletions
|
|
@ -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,30 +98,34 @@ 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(
|
||||||
if let Some(_) = phrase {
|
|to:[u16;2]|Ok(Some(to.clip_h(1))),
|
||||||
let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length;
|
move|to: &mut TuiOutput|{
|
||||||
let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis;
|
if let Some(_) = phrase {
|
||||||
for x in 0..10 {
|
let now = 0; // TODO FIXME: self.now % phrase.read().unwrap().length;
|
||||||
let this_step = (first_beat + 0) * time_zoom;
|
let ScaledAxis { start: first_beat, scale: time_zoom, .. } = time_axis;
|
||||||
let next_step = (first_beat + 1) * time_zoom;
|
for x in 0..10 {
|
||||||
let x = to.area().x() + x;
|
let this_step = (first_beat + 0) * time_zoom;
|
||||||
to.blit(&"-", x, to.area.y(), Some(if this_step <= now && now < next_step {
|
let next_step = (first_beat + 1) * time_zoom;
|
||||||
playhead_active
|
let x = to.area().x() + x;
|
||||||
} else {
|
to.blit(&"-", x, to.area.y(), Some(if this_step <= now && now < next_step {
|
||||||
playhead_active
|
playhead_active
|
||||||
}));
|
} else {
|
||||||
|
playhead_active
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
Ok(())
|
).push_x(5).align_sw();
|
||||||
}).align_sw().fill_xy().push_xy(1, 1);
|
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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue