vastly improved selection system

This commit is contained in:
2026-01-28 02:29:17 +01:00
parent 322885b908
commit c7a9f7bc5a
13 changed files with 1507 additions and 437 deletions

View File

@@ -119,6 +119,9 @@ fn render_tile(
let is_active = step.map(|s| s.active).unwrap_or(false);
let is_linked = step.map(|s| s.source.is_some()).unwrap_or(false);
let is_selected = step_idx == app.editor_ctx.step;
let in_selection = app.editor_ctx.selection_range()
.map(|r| r.contains(&step_idx))
.unwrap_or(false);
let is_playing = if app.playback.playing {
snapshot.get_step(app.editor_ctx.bank, app.editor_ctx.pattern) == Some(step_idx)
@@ -145,21 +148,23 @@ fn render_tile(
(BRIGHT[i], DIM[i])
});
let (bg, fg) = match (is_playing, is_active, is_selected, is_linked) {
(true, true, _, _) => (Color::Rgb(195, 85, 65), Color::White),
(true, false, _, _) => (Color::Rgb(180, 120, 45), Color::Black),
(false, true, true, true) => {
let (bg, fg) = match (is_playing, is_active, is_selected, is_linked, in_selection) {
(true, true, _, _, _) => (Color::Rgb(195, 85, 65), Color::White),
(true, false, _, _, _) => (Color::Rgb(180, 120, 45), Color::Black),
(false, true, true, true, _) => {
let (r, g, b) = link_color.unwrap().0;
(Color::Rgb(r, g, b), Color::Black)
}
(false, true, true, false) => (Color::Rgb(0, 220, 180), Color::Black),
(false, true, false, true) => {
(false, true, true, false, _) => (Color::Rgb(0, 220, 180), Color::Black),
(false, true, _, _, true) => (Color::Rgb(0, 170, 140), Color::Black),
(false, true, false, true, _) => {
let (r, g, b) = link_color.unwrap().1;
(Color::Rgb(r, g, b), Color::White)
}
(false, true, false, false) => (Color::Rgb(45, 106, 95), Color::White),
(false, false, true, _) => (Color::Rgb(80, 180, 255), Color::Black),
(false, false, false, _) => (Color::Rgb(45, 48, 55), Color::Rgb(120, 125, 135)),
(false, true, false, false, _) => (Color::Rgb(45, 106, 95), Color::White),
(false, false, true, _, _) => (Color::Rgb(80, 180, 255), Color::Black),
(false, false, _, _, true) => (Color::Rgb(60, 140, 200), Color::Black),
(false, false, false, _, _) => (Color::Rgb(45, 48, 55), Color::Rgb(120, 125, 135)),
};
let symbol = if is_playing {

View File

@@ -295,13 +295,20 @@ fn render_footer(frame: &mut Frame, app: &App, area: Rect) {
} else {
let bindings: Vec<(&str, &str)> = match app.page {
Page::Main => vec![
("←→↑↓", "Navigate"),
("←→↑↓", "Nav"),
("Shift+↑↓", "Select"),
("t", "Toggle"),
("Enter", "Edit"),
("p", "Preview"),
("Space", "Play"),
("<>", "Length"),
("[]", "Speed"),
("^C", "Copy"),
("^V", "Paste"),
("^B", "Link"),
("^D", "Dup"),
("^H", "Harden"),
("Del", "Delete"),
("<>", "Len"),
("[]", "Spd"),
("+-", "Tempo"),
],
Page::Patterns => vec![
("←→↑↓", "Navigate"),
@@ -382,6 +389,12 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
ConfirmModal::new("Confirm", &format!("Delete step {}?", step + 1), *selected)
.render_centered(frame, term);
}
Modal::ConfirmDeleteSteps { steps, selected, .. } => {
let nums: Vec<String> = steps.iter().map(|s| format!("{:02}", s + 1)).collect();
let label = format!("Delete steps {}?", nums.join(", "));
ConfirmModal::new("Confirm", &label, *selected)
.render_centered(frame, term);
}
Modal::ConfirmResetPattern {
pattern, selected, ..
} => {