Mark modified rundown rows

This commit is contained in:
Dandaedre 2026-11-03 16:36:14 +01:00
parent daf78d2618
commit b7dcb576c0
1 changed files with 29 additions and 1 deletions

View File

@ -447,6 +447,21 @@ fn ignored_row(row: usize, table: Option<&Table>, profile: &Profile) -> bool {
})
}
fn modified_row(row: &PreviewRow, profile: &Profile) -> bool {
if row.row > 0
&& (profile.row_kinds.contains_key(&row.row)
|| profile.titles.contains_key(&row.row)
|| profile.starts.contains_key(&row.row)
|| profile.ends.contains_key(&row.row)
|| profile.durations.contains_key(&row.row))
{
return true;
}
row.gap_key
.as_ref()
.is_some_and(|key| profile.gap_resolutions.contains_key(key))
}
fn show_row(row: &PreviewRow, filter: RowFilter, table: Option<&Table>, profile: &Profile) -> bool {
match filter {
RowFilter::All => true,
@ -1389,6 +1404,7 @@ impl App {
ui.colored_label(PREVIEW_RED, "Error");
ui.colored_label(PREVIEW_GAP, "Gap / allocated interval");
ui.colored_label(PREVIEW_INFERRED, "Inferred timing");
ui.weak("✎ modified");
ui.weak("Ignored");
ui.small("? unknown · edits require recheck");
});
@ -1496,6 +1512,7 @@ impl App {
} else {
ui.visuals().text_color()
};
let modified = modified_row(row, &profile);
// Size every cell to the actual content, then lay it out from the top.
// Keep blank spreadsheet lines out of the preview, preserving the source.
let title = row.title.lines().map(str::trim).filter(|line| !line.is_empty()).collect::<Vec<_>>().join("\n");
@ -1511,10 +1528,18 @@ impl App {
let response = ui.vertical(|ui| {
ui.set_min_height(row_height);
ui.add(
egui::Label::new(RichText::new(if row.row == 0 { "Gap".into() } else { row.row.to_string() }).color(color))
egui::Label::new(RichText::new(format!("{}{}",
if row.row == 0 { "Gap".into() } else { row.row.to_string() },
if modified { " ✎" } else { "" }
)).color(color))
.sense(egui::Sense::click()),
)
}).inner;
let response = if modified {
response.on_hover_text("Modified by a saved or pending row resolution")
} else {
response
};
if response.double_clicked() {
if row.row > 0 {
details = Some(row.row);
@ -1908,6 +1933,8 @@ mod tests {
profile.gap_resolutions.values().next().unwrap(),
"add_to_next"
);
let labels = render(&mut app, &ctx, [860.0, 900.0], vec![]);
assert!(labels.iter().any(|(text, _)| text == "Gap ✎"));
let a = pipeline::analyze(&app.tables[0], &profile, &AtomicBool::new(false), |_, _| {});
assert!(a.rundown.as_ref().unwrap().gaps.is_empty());
let rows = preview_rows(&a, Some(&app.tables[0]));
@ -2488,6 +2515,7 @@ mod tests {
assert_eq!(profile.durations[&2], "2 min");
assert!(app.dirty);
let labels = render(&mut app, &ctx, size, vec![]);
assert!(labels.iter().any(|(text, _)| text == "2 ✎"));
let close = labels
.iter()
.find(|(s, _)| s == "Close")