From 14b07c2b4f1fceb21b3430ec315d3af28fec3cd4 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 25 Jun 2024 15:13:55 +0300 Subject: [PATCH] fix widths of launcher columns --- src/device/launcher.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/device/launcher.rs b/src/device/launcher.rs index 47f54a56..6dfa709a 100644 --- a/src/device/launcher.rs +++ b/src/device/launcher.rs @@ -123,6 +123,7 @@ pub fn render (state: &Launcher, buf: &mut Buffer, area: Rect) -> Usually 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 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()))