Mixed bag of things
This commit is contained in:
@@ -41,7 +41,24 @@ pub fn render(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, area:
|
||||
}
|
||||
|
||||
render_sequencer(frame, app, snapshot, sequencer_area);
|
||||
render_vu_meter(frame, app, vu_area);
|
||||
|
||||
// Calculate actual grid height to align VU meter
|
||||
let pattern = app.current_edit_pattern();
|
||||
let page = app.editor_ctx.step / STEPS_PER_PAGE;
|
||||
let page_start = page * STEPS_PER_PAGE;
|
||||
let steps_on_page = (page_start + STEPS_PER_PAGE).min(pattern.length) - page_start;
|
||||
let num_rows = steps_on_page.div_ceil(8);
|
||||
let spacing = num_rows.saturating_sub(1) as u16;
|
||||
let row_height = sequencer_area.height.saturating_sub(spacing) / num_rows as u16;
|
||||
let actual_grid_height = row_height * num_rows as u16 + spacing;
|
||||
|
||||
let aligned_vu_area = Rect {
|
||||
y: sequencer_area.y,
|
||||
height: actual_grid_height,
|
||||
..vu_area
|
||||
};
|
||||
|
||||
render_vu_meter(frame, app, aligned_vu_area);
|
||||
}
|
||||
|
||||
const STEPS_PER_PAGE: usize = 32;
|
||||
|
||||
@@ -29,7 +29,7 @@ pub fn render(frame: &mut Frame, app: &App, link: &LinkState, area: Rect) {
|
||||
};
|
||||
|
||||
let [display_area, _, link_area, _, session_area] = Layout::vertical([
|
||||
Constraint::Length(7),
|
||||
Constraint::Length(8),
|
||||
Constraint::Length(1),
|
||||
Constraint::Length(5),
|
||||
Constraint::Length(1),
|
||||
@@ -63,6 +63,7 @@ fn render_display_section(frame: &mut Frame, app: &App, area: Rect) {
|
||||
);
|
||||
|
||||
let focus = app.options.focus;
|
||||
let flash_str = format!("{:.0}%", app.ui.flash_brightness * 100.0);
|
||||
let lines = vec![
|
||||
render_option_line(
|
||||
"Refresh rate",
|
||||
@@ -93,6 +94,11 @@ fn render_display_section(frame: &mut Frame, app: &App, area: Rect) {
|
||||
if app.ui.show_completion { "On" } else { "Off" },
|
||||
focus == OptionsFocus::ShowCompletion,
|
||||
),
|
||||
render_option_line(
|
||||
"Flash brightness",
|
||||
&flash_str,
|
||||
focus == OptionsFocus::FlashBrightness,
|
||||
),
|
||||
];
|
||||
|
||||
frame.render_widget(Paragraph::new(lines), content_area);
|
||||
|
||||
@@ -41,9 +41,20 @@ fn adjust_spans_for_line(
|
||||
|
||||
pub fn render(frame: &mut Frame, app: &App, link: &LinkState, snapshot: &SequencerSnapshot) {
|
||||
let term = frame.area();
|
||||
|
||||
let bg_color = if app.ui.event_flash > 0.0 {
|
||||
let i = (app.ui.event_flash * app.ui.flash_brightness * 60.0) as u8;
|
||||
Color::Rgb(i, i, i)
|
||||
} else {
|
||||
Color::Reset
|
||||
};
|
||||
|
||||
let blank = " ".repeat(term.width as usize);
|
||||
let lines: Vec<Line> = (0..term.height).map(|_| Line::raw(&blank)).collect();
|
||||
frame.render_widget(Paragraph::new(lines), term);
|
||||
frame.render_widget(
|
||||
Paragraph::new(lines).style(Style::default().bg(bg_color)),
|
||||
term,
|
||||
);
|
||||
|
||||
if app.ui.show_title {
|
||||
title_view::render(frame, term, &app.ui);
|
||||
|
||||
Reference in New Issue
Block a user