fix widths of launcher columns

This commit is contained in:
🪞👃🪞 2024-06-25 15:13:55 +03:00
parent 143da7f1b8
commit 14b07c2b4f

View file

@ -123,6 +123,7 @@ pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) -> Usually<Rect>
let scenes = draw_scenes(state, buf, x, y);
separator.blit(buf, x, y + 2, Some(Style::default().dim()));
separator.blit(buf, x, y + 4, Some(Style::default().dim()));
separator.blit(buf, x, y + 21, Some(Style::default().dim()));
separator.blit(buf, x, y + 40, Some(Style::default().dim()));
let (w, mut highlight) = draw_tracks(state, buf, x, y);
if state.col() == 0 {
@ -134,12 +135,12 @@ pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) -> Usually<Rect>
crate::device::chain::draw_as_row(
&*state.chains[0].state(), buf, chain_area, style
)?;
draw_highlight(state, buf, &highlight);
match state.view {
LauncherView::Tracks => draw_box_styled(buf, track_area, style),
LauncherView::Sequencer => draw_box_styled(buf, seq_area, style),
LauncherView::Chains => draw_box_styled(buf, chain_area, style),
LauncherView::Chains => draw_box_styled(buf, Rect { height: 19, ..chain_area }, style),
};
draw_highlight(state, buf, &highlight);
draw_sequencer(state, buf, seq_area.x, seq_area.y + 1, seq_area.width, seq_area.height - 2)?;
if state.show_help {
let style = Some(Style::default().bold().white().not_dim().on_black().italic());
@ -218,12 +219,15 @@ fn draw_track (
} else {
Style::default()
};
for (scene_index, scene) in state.scenes.iter().enumerate() {
if let Some(Some(sequence_index)) = scene.clips.get(i as usize) {
if let Some(sequence) = track.sequences.get(*sequence_index) {
width = width.max(sequence.name.len() as u16 + 5);
}
}
}
for (scene_index, scene) in state.scenes.iter().enumerate() {
let y = y + 5 + scene_index as u16 * 2;
//let label = format!("▶ {}", &scene.name);
//width = width.max(label.len() as u16 + 2);
//label.blit(buf, x + 2, y, Some(green(scene_index as u16 + 2, 0)));
//height = height + 2;
let style = if scene_index + 2 == row as usize && i + 1 == col {
Style::default().green().bold()
} else {
@ -232,7 +236,6 @@ fn draw_track (
if let Some(Some(sequence_index)) = scene.clips.get(i as usize) {
if let Some(sequence) = track.sequences.get(*sequence_index) {
let label = format!("{}", &sequence.name);
width = width.max(label.len() as u16 + 1);
label.blit(buf, x, y, Some(style));
} else {
format!("{}", &"?".repeat(track.name.len()))