EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Merge upstream/main into feat-gap25-a11y-audit
vangel76fad9f0414545
diff --cc crates/ui-egui/src/menus/shortcuts.rsindex 5c9a385c4,b9990786c..d867323b0--- a/crates/ui-egui/src/menus/shortcuts.rs+++ b/crates/ui-egui/src/menus/shortcuts.rs@@@ -283,22 -269,57 +269,62 @@@ fn collect_key_events(ctx: &egui::Conte}}out- });+ })+ }++ /// Numpad * (or `*` typed with Shift+8): Add Marker (#275). egui has no key for it, so it+ /// comes as text.+ fn numpad_star_marker(app: &mut EffectcraftApp, ctx: &egui::Context) {+ if !ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Text(t) if t == "*"))) {+ return;+ }+ let bound = app.session.shortcuts().bindings().into_iter().find(|(k, _)| *k == "Num*").map(|(_, b)| (b.command.clone(), b.params.clone()));+ // As in After Effects, it marks the selected layers; only with none selected does it add+ // a composition marker (#976).+ let bound =+ bound.map(+ |(id, params)| {+ if id == "comp.addMarker" && !app.session.state.selected_layers.is_empty() { ("layer.addMarker".to_owned(), params) } else { (id, params) }+ },+ );+ if let Some((id, params)) = bound+ && let Err(e) = invoke(app, ctx, &id, if params.is_null() { json!({}) } else { params })+ {+ app.ui.status = e;+ }+ }+++/// Panels that handle Enter themselves (rename, apply, open the row).++fn panel_owns_enter(kind: PanelKind) -> bool {++ matches!(kind, PanelKind::Project | PanelKind::EffectsPresets | PanelKind::RenderQueue)++}+++ fn handle_shortcuts_impl(app: &mut EffectcraftApp, ctx: &egui::Context, tab_only: bool) {+ let start = modifiers_at_start(ctx);+ if !tab_only && app.dialog.is_some() && ctx.input(|i| i.key_pressed(egui::Key::Escape)) {+ escape_dialog(app, ctx);+ return;+ }+ // A mouse button down while Spacebar is held belongs to the Hand tool: its release won't+ // preview.+ if ctx.input(|i| i.pointer.any_down()) || ctx.egui_wants_keyboard_input() {+ ctx.data_mut(|d| d.remove::<bool>(space_tap_id()));+ }+ // While a menu or popup list is open, keys go to it, not to the app (Space must not start a+ // preview behind the menu, #279).+ if ctx.egui_wants_keyboard_input() || crate::widgets::any_menu_open(ctx) {+ return;+ }+ // Text editing in the viewer takes the clipboard events itself.+ let clipboard = app.session.state.text_edit.is_none();+ let project = app.ui.focused == PanelKind::Project;+ // The paste event's text: Edit ▸ Paste pastes SVG markup as a shape layer.+ let pasted =+ if clipboard { ctx.input(|i| i.events.iter().rev().find_map(|e| if let egui::Event::Paste(t) = e { Some(t.clone()) } else { None })) } else { None };+ let mut events = collect_key_events(ctx, start, clipboard, project);events.retain(|(key, _, _, _)| (*key == egui::Key::Tab) == tab_only);- // Numpad * (or `*` typed with Shift+8): Add Marker (#275). egui has no key for it, so it- // comes as text.- if !tab_only && clipboard && app.dialog.is_none() && ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Text(t) if t == "*"))) {- let bound = app.session.shortcuts().bindings().into_iter().find(|(k, _)| *k == "Num*").map(|(_, b)| (b.command.clone(), b.params.clone()));- // As in After Effects, it marks the selected layers; only with none selected does it add- // a composition marker (#976).- let bound = bound.map(|(id, params)| {- if id == "comp.addMarker" && !app.session.state.selected_layers.is_empty() { ("layer.addMarker".to_owned(), params) } else { (id, params) }- });- if let Some((id, params)) = bound- && let Err(e) = invoke(app, ctx, &id, if params.is_null() { json!({}) } else { params })- {- app.ui.status = e;- }+ if !tab_only && clipboard && app.dialog.is_none() {+ numpad_star_marker(app, ctx);}if events.is_empty() {return;@@@ -343,9 -364,7 +369,9 @@@continue;}// Enter in the Project panel renames the selected item (handled by the panel).- if key == egui::Key::Enter && !mods.any() && app.ui.focused == PanelKind::Project {+ // In Effects & Presets and the Render Queue Enter applies or opens the row (handled by the+ // panel), not the layer rename.- if key == egui::Key::Enter && !mods.any() && matches!(app.ui.focused, PanelKind::Project | PanelKind::EffectsPresets | PanelKind::RenderQueue) {++ if key == egui::Key::Enter && !mods.any() && panel_owns_enter(app.ui.focused) {continue;}// The Project panel has its own selection; a previously selected Timeline layerdiff --cc crates/ui-egui/src/panels/effects_presets.rsindex 8be7d873b,380d1d869..1e9d2f56b--- a/crates/ui-egui/src/panels/effects_presets.rs+++ b/crates/ui-egui/src/panels/effects_presets.rs@@@ -532,9 -270,7 +511,9 @@@ fn contents_menu(app: &mut EffectcraftA// Contents menu.let mr = Rect::from_center_size(pos2(rect.max.x - 18.0, sr.center().y), vec2(22.0, 22.0));let mpop = egui::Id::unique("fx-contents-menu");- let menu_resp = widgets::icon_button(ui, mr, Icon::Hamburger, false, &t, egui::Id::unique("fx-menu")).on_hover_text(tr("Effects & Presets options"));- if widgets::icon_button(ui, mr, Icon::Hamburger, false, t, egui::Id::unique("fx-menu")).on_hover_text(tr("Effects & Presets options")).clicked() {++ let menu_resp = widgets::icon_button(ui, mr, Icon::Hamburger, false, t, egui::Id::unique("fx-menu")).on_hover_text(tr("Effects & Presets options"));+ a11y::menu_button(&menu_resp, tr("Effects & Presets options"), widgets::popup_is_open(ui, mpop));+ if menu_resp.clicked() {widgets::open_popup(ui, mpop);}app.auto.add("effects.menu", mr, "Effects & Presets options");@@@ -608,6 -335,32 +587,34 @@@_ => {}}}+ force_scan+ }++ /// The Effects & Presets panel: search, a contents menu (colour-depth and GPU filters, whether+ /// presets show, categories or one alphabetical list, refresh and clear of the recently used+ /// list), then Favourites, Recently Used, Animation Presets and the effects by category or+ /// alphabetically, filtered by the query. Picking an effect or preset applies it to the selection+ /// (`effect.apply` or the preset's own command); applying an effect also records it as recently+ /// used and opens Effect Controls. Without a selected layer it only reports that in+ /// `app.ui.status`.+ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {+ let t = app.tokens;+ let ctx = ui.ctx().clone();+ let p = ui.painter().clone();+ // Track the last applied effect (menus, drag and drop, the control channel) as recently used.+ if let Some(last) = app.session.state.last_effect.clone()+ && app.ui.effects_recent.first() != Some(&last)+ {+ push_recent(&mut app.ui.effects_recent, &last);+ }+ let sr = Rect::from_min_size(rect.min + vec2(8.0, 8.0), vec2(rect.width() - 44.0, 24.0));+ let mut q = app.ui.effects_search.clone();- widgets::search_field(ui, sr, &mut q, "Search effects and presets", &t);++ let search_hint = tr("Search effects and presets");++ let search = widgets::search_field(ui, sr, &mut q, search_hint, &t);++ a11y::text_input(&search, search_hint, &q);+ app.ui.effects_search = q.clone();+ app.auto.add("effects.search", sr, "Search");+ let force_scan = contents_menu(app, ui, &ctx, rect, sr, &t);let view = app.ui.effects_view.clone();let list = Rect::from_min_max(pos2(rect.min.x, sr.max.y + 6.0), rect.max);let lp = p.with_clip_rect(list);diff --cc crates/ui-egui/src/panels/render_queue.rsindex 1ec35c566,5e39a30c2..41db787b3--- a/crates/ui-egui/src/panels/render_queue.rs+++ b/crates/ui-egui/src/panels/render_queue.rs@@@ -523,9 -514,196 +524,308 @@@ fn current_render_strip(app: &mut Effec}}};- p.text(pos2(bar.min.x + 8.0, bar.center().y), Align2::LEFT_CENTER, bar_text, Tokens::ui(11.5), t.text);+ p.text(pos2(bar.min.x + 8.0, bar.center().y), Align2::LEFT_CENTER, &bar_text, Tokens::ui(11.5), t.text);app.auto.add("renderQueue.progress", bar, &format!("{:.0}%", frac * 100.0));+ a11y::progress(&ui.interact(bar, egui::Id::unique("rq-progress"), Sense::hover()), &bar_text, frac);+ }++ /// The footer: the message line and the totals.+ fn footer(p: &egui::Painter, rect: Rect, rq: &RqView, t: &Tokens) {+ let RqView { queue, progress, rendering, .. } = *rq;+ let foot = Rect::from_min_max(pos2(rect.min.x, rect.max.y - FOOT_H), rect.max);+ p.rect_filled(foot, 0.0, t.tl_ruler_bg);+ p.line_segment([foot.left_top(), foot.right_top()], Stroke::new(1.0, t.separator));+ let msg = match &progress {+ Some(pr) if rendering => format!("Message: Rendering {} of {}", (pr.items_done + 1).min(pr.items_total), pr.items_total),+ _ => {+ let done = queue.iter().filter(|i| i.status == RenderStatus::Done).count();+ format!("Message: {done} of {} done", queue.len())+ }+ };+ p.text(pos2(foot.min.x + 12.0, foot.center().y), Align2::LEFT_CENTER, msg, Tokens::ui(11.0), t.text_dim);+ let started = queue.iter().filter(|i| i.started.is_some()).count();+ let total: f64 = queue.iter().filter_map(|i| i.render_time).sum();+ p.text(+ pos2(foot.max.x - 12.0, foot.center().y),+ Align2::RIGHT_CENTER,+ format!("Renders Started: {started} Total Time Elapsed: {}", hms(progress.as_ref().filter(|_| rendering).map(|p| p.elapsed).unwrap_or(total))),+ Tokens::ui(11.0),+ t.text_dim,+ );+ }++ /// An item row's context menu: Duplicate, Remove and Move Up / Down (row `k` of `len`).+ fn row_menu(ui: &mut egui::Ui, actions: &mut Vec<Action>, item_id: u64, k: usize, len: usize) {+ if ui.button(tr("Duplicate")).clicked() {+ actions.push(("renderQueue.duplicate", json!({"item": item_id})));+ ui.close();+ }+ if ui.button(tr("Remove")).clicked() {+ actions.push(("renderQueue.remove", json!({"item": item_id})));+ ui.close();+ }+ if k > 0 && ui.button(tr("Move Up")).clicked() {+ actions.push(("renderQueue.move", json!({"item": item_id, "to": k})));+ ui.close();+ }+ if k + 1 < len && ui.button(tr("Move Down")).clicked() {+ actions.push(("renderQueue.move", json!({"item": item_id, "to": k + 2})));+ ui.close();+ }+ }++ /// Log: Errors Only / Plus Settings / Plus Per Frame Info.+ fn log_dropdown(app: &mut EffectcraftApp, ui: &mut egui::Ui, row: &ItemRow, it: &RenderQueueItem, actions: &mut Vec<Action>) {+ let ItemRow { lp, r, n, rendering, .. } = *row;+ let t = app.tokens;+ let aid = |s: &str| format!("renderQueue.item.{n}.{s}");+ let ld = Rect::from_min_size(pos2(r.max.x - 190.0, r.min.y + 3.0), vec2(150.0, ROW_H - 6.0));+ lp.text(pos2(ld.min.x - 6.0, r.center().y), Align2::RIGHT_CENTER, tr("Log:"), Tokens::ui(11.5), t.text_dim);+ let lid = egui::Id::unique(("rq-log", it.id));- if widgets::dropdown(ui, ld, it.log.label(), &t, lid).clicked() && !rendering {++ let log_resp = widgets::dropdown(ui, ld, it.log.label(), &t, lid);++ a11y::combo_box(&log_resp, tr("Log:").trim_end_matches(':'), it.log.label(), !rendering);++ if log_resp.clicked() && !rendering {+ widgets::open_popup(ui, lid);+ }+ let llabels: Vec<String> = RenderLog::ALL.iter().map(|l| mark(it.log == *l, l.label())).collect();+ if let Some(i) = widgets::popup_menu(ui, lid, ld.left_bottom(), &llabels, None) {++ if widgets::by_keyboard(ui) {++ log_resp.request_focus();++ }+ actions.push(("renderQueue.setLog", json!({"item": it.id, "log": RenderLog::ALL[i].label()})));+ }+ app.auto.add(&aid("log"), ld, it.log.label());+ }++ /// Where an item row's expanded line is drawn.+ #[derive(Clone, Copy)]+ struct ItemRow<'a> {+ lp: &'a egui::Painter,+ list: Rect,+ r: Rect,+ /// The item's 1-based position in the queue.+ n: usize,+ rendering: bool,+ }++ /// The expanded "Output To" line: the template menu, and the file name (click to choose it or+ /// edit the template in place).+ fn output_to(+ app: &mut EffectcraftApp,+ ui: &mut egui::Ui,+ row: &ItemRow,+ it: &RenderQueueItem,+ dd_right: f32,+ editing: &mut Option<(u64, String)>,+ actions: &mut Vec<Action>,+ ) {+ let ItemRow { lp, list, r, n, rendering } = *row;+ let t = app.tokens;+ let aid = |s: &str| format!("renderQueue.item.{n}.{s}");+ let ox = dd_right + 14.0;+ lp.text(pos2(ox, r.center().y), Align2::LEFT_CENTER, tr("Output To:"), Tokens::ui(11.5), t.text_dim);+ let odd = Rect::from_min_size(pos2(ox + 62.0, r.min.y + 3.0), vec2(22.0, ROW_H - 6.0));+ let oid = egui::Id::unique(("rq-out", it.id));- if widgets::dropdown(ui, odd, "", &t, oid).clicked() && !rendering {++ let out_resp = widgets::dropdown(ui, odd, "", &t, oid);++ a11y::combo_box(++ &out_resp,++ tr("Output To:").trim_end_matches(':'),++ &app.session.resolve_output(it).unwrap_or_else(|| "Not yet specified".into()),++ !rendering,++ );++ if out_resp.clicked() && !rendering {+ widgets::open_popup(ui, oid);+ }+ app.auto.add(&aid("outputTo"), odd, "Output To");+ let omenu = output_to_menu(it);+ let olabels: Vec<String> = omenu.iter().map(|(l, _)| l.clone()).collect();+ if let Some(i) = widgets::popup_menu(ui, oid, odd.left_bottom(), &olabels, None) {++ if widgets::by_keyboard(ui) {++ out_resp.request_focus();++ }+ if omenu[i].1.get("choose").is_some() {+ match pick_output(app, it) {+ Some(Some(path)) => actions.push(("renderQueue.setOutput", json!({"item": it.id, "path": path}))),+ Some(None) => {}+ None => *editing = Some((it.id, it.output.output.clone())),+ }+ } else {+ let mut params = omenu[i].1.clone();+ params["item"] = json!(it.id);+ actions.push(("renderQueue.setOutput", params));+ }+ }+ let path_rect = Rect::from_min_max(pos2(odd.max.x + 6.0, r.min.y + 2.0), pos2(r.max.x - 8.0, r.max.y - 2.0));+ if editing.as_ref().is_some_and(|(id, _)| *id == it.id) {+ let mut buf = editing.as_ref().map(|(_, b)| b.clone()).unwrap_or_default();+ let mut child = ui.new_child(egui::UiBuilder::new().max_rect(path_rect));+ let resp = child.add(egui::TextEdit::singleline(&mut buf).desired_width(path_rect.width()).font(Tokens::ui(11.5)));++ a11y::text_input(&resp, tr("Output file name template"), &buf);+ if resp.lost_focus() {+ if ui.input(|i| i.key_pressed(egui::Key::Enter)) && !buf.trim().is_empty() {+ actions.push(("renderQueue.setOutput", json!({"item": it.id, "path": buf.trim()})));+ }+ *editing = None;+ } else {+ widgets::keep_focus(ui.ctx(), &resp, &buf);+ *editing = Some((it.id, buf));+ }+ } else {+ let shown = app.session.resolve_output(it).unwrap_or_else(|| "Not yet specified".into());+ let resp = ui.interact(path_rect, egui::Id::unique(("rq-path", it.id)), Sense::click());++ a11y::button(&resp, &tr_args("Output file: {}", &[&shown]), !rendering);+ let col = if resp.hovered() { t.accent_hover } else { t.hot_text };+ lp.with_clip_rect(path_rect.intersect(list)).text(pos2(path_rect.min.x, r.center().y), Align2::LEFT_CENTER, &shown, Tokens::ui(11.5), col);+ // Clicking the file name opens the save dialog (Output Movie To); Alt-click, or a+ // host without one, edits the name template in place.+ let dialog = app.hooks.pick_save_file.is_some();+ if resp.clicked() && !rendering {+ let picked = if ui.input(|i| i.modifiers.alt) { None } else { pick_output(app, it) };+ match picked {+ Some(Some(path)) => actions.push(("renderQueue.setOutput", json!({"item": it.id, "path": path}))),+ Some(None) => {}+ None => *editing = Some((it.id, it.output.output.clone())),+ }+ }+ let how = if dialog { "Click to choose where to save; Alt-click to edit the template" } else { "Click to edit" };+ resp.on_hover_text(tr_args("Template: {}\n{}", &[&it.output.output, &how]));+ app.auto.add(&aid("outputPath"), path_rect, &shown);+ }+ }++ /// Delete removes the selected item when the panel has focus (`allowed`: not editing a path and+ /// not rendering).-fn delete_selected(app: &EffectcraftApp, ui: &egui::Ui, allowed: bool, selected: &mut Option<u64>, actions: &mut Vec<Action>) {++fn delete_selected(app: &EffectcraftApp, ui: &egui::Ui, allowed: bool, on_row: bool, selected: &mut Option<u64>, actions: &mut Vec<Action>) {+ if app.ui.focused == crate::dock::PanelKind::RenderQueue+ && allowed+ && let Some(id) = *selected+ && app.dialog.is_none()++ && !crate::widgets::any_menu_open(ui.ctx())+ && ui.input(|i| i.key_pressed(egui::Key::Delete) || i.key_pressed(egui::Key::Backspace))- && !ui.ctx().egui_wants_keyboard_input()++ // (A focused queue row is not typing; any other focused widget may be.)++ && (on_row || !ui.ctx().egui_wants_keyboard_input())+ {+ actions.push(("renderQueue.remove", json!({"item": id})));+ *selected = None;+ }+ }+++// Keyboard: Up / Down move between the queued items, Home / End go to the first / last, Right++// and Left open and close the item's settings, Enter and Space do the same (Space only with a++// row focused: otherwise it plays the preview). The focus follows the selection.++///++/// Returns whether a queue row has keyboard focus.++fn list_keys(++ app: &mut EffectcraftApp,++ ctx: &egui::Context,++ queue: &[RenderQueueItem],++ (open, selected): (&mut Vec<u64>, &mut Option<u64>),++ can_navigate: bool,++ tops: &[(u64, f32)],++ list_h: f32,++) -> bool {++ let focused = ctx.memory(|m| m.focused());++ let on_row = focused.is_some_and(|f| queue.iter().any(|i| row_id(i.id) == f));++ let by_mouse = focused.is_none() && app.ui.focused == crate::dock::PanelKind::RenderQueue;++ if (on_row || by_mouse) && can_navigate && app.dialog.is_none() && !widgets::any_menu_open(ctx) {++ let keys: Vec<egui::Key> = ctx.input(|i| {++ i.events++ .iter()++ .filter_map(|e| match e {++ egui::Event::Key { key, pressed: true, modifiers, .. } if !modifiers.any() => Some(*key),++ _ => None,++ })++ .collect()++ });++ let mut moved = None;++ for key in keys {++ use egui::Key;++ let at = (*selected).and_then(|s| queue.iter().position(|i| i.id == s));++ let Some(last) = queue.len().checked_sub(1) else { break };++ let to = match key {++ Key::ArrowDown => Some(at.map_or(0, |a| a.saturating_add(1).min(last))),++ Key::ArrowUp => Some(at.map_or(last, |a| a.saturating_sub(1))),++ Key::Home if on_row => Some(0),++ Key::End if on_row => Some(last),++ _ => None,++ };++ if let Some(item) = to.and_then(|to| queue.get(to)) {++ *selected = Some(item.id);++ moved = Some(item.id);++ continue;++ }++ let Some(item) = (*selected).filter(|s| queue.iter().any(|i| i.id == *s)) else { continue };++ match key {++ Key::ArrowRight if !open.contains(&item) => open.push(item),++ Key::ArrowLeft => open.retain(|i| *i != item),++ Key::Enter | Key::Space if on_row || key == Key::Enter => {++ if open.contains(&item) {++ open.retain(|i| *i != item);++ } else {++ open.push(item);++ }++ }++ _ => {}++ }++ }++ if let Some(item) = moved {++ if let Some((_, top)) = tops.iter().find(|(id, _)| *id == item) {++ widgets::PanelScroll::reveal(ctx, egui::Id::unique("rq-scroll"), *top, *top + ROW_H, list_h);++ }++ app.ui.focused = crate::dock::PanelKind::RenderQueue;++ if on_row {++ a11y::focus_next_pass(ctx, "rq", row_id(item));++ }++ ctx.request_repaint();++ }++ // The arrows are the queue's, not egui's spatial focus moves.++ if on_row {++ ctx.memory_mut(|m| m.move_focus(egui::FocusDirection::None));++ }++ }++ on_row++}++++/// An item's Status cell: its state, or the percentage while it is the one rendering.++fn status_text(it: &RenderQueueItem, progress: Option<&effectcraft_engine::render_queue::JobState>, rendering: bool) -> String {++ match progress.filter(|p| rendering && p.current == Some(it.id)) {++ Some(pr) => format!("Rendering {:.0}%", if pr.total > 0 { pr.done as f64 * 100.0 / pr.total as f64 } else { 0.0 }),++ None => it.status.label().to_string(),++ }++}++++/// An item's Render Time cell: the running time while it renders, else its last render time.++fn render_time_text(it: &RenderQueueItem, progress: Option<&effectcraft_engine::render_queue::JobState>, rendering: bool) -> String {++ match progress.filter(|p| rendering && p.current == Some(it.id)) {++ Some(p) => hms(p.item_elapsed),++ None => it.render_time.map(|s| if s < 60.0 { format!("{s:.1} s") } else { hms(s) }).unwrap_or_else(|| "-".into()),++ }++}+++ /// The Render Queue panel: the Current Render strip (elapsed and remaining time, Render/Stop and+ /// Notify, plus the progress bar), the column header, the queued items with their output template,+ /// status and timings, and the footer totals. Comps dragged from the Project are queued on+ /// release. The open items and the selected item are kept in egui temp data; output-template forms+ /// open through a small form, and every change runs a `renderQueue.*` command.+ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {+ let t = app.tokens;+ let p = ui.painter().with_clip_rect(rect);+ let queue: Vec<RenderQueueItem> = app.session.project.render_queue.clone();+ let progress = app.session.render_progress();+ let rendering = app.session.is_rendering();+ let available = app.session.exporter.as_ref().map(|e| e.formats()).unwrap_or_default();+ let mut actions: Vec<Action> = Vec::new();+ let rq = RqView { queue: &queue, progress: progress.as_ref(), rendering, available: &available };+ app.auto.add("renderQueue.drop", rect, "Drop compositions to queue");+ queue_drop(app, ui, rect, &p, rendering, &mut actions);+ let mut forms: Vec<(RenderQueueItem, String)> = Vec::new();+ let state_id = egui::Id::unique("rq-ui");+ let (mut open, mut selected): (Vec<u64>, Option<u64>) = ui.data(|d| d.get_temp(state_id).unwrap_or_default());++ // ---------------------------------------------------------- Current Render strip+ let top = Rect::from_min_size(rect.min, vec2(rect.width(), TOP_H));+ p.rect_filled(top, 0.0, t.tl_ruler_bg);+ current_render_strip(app, ui, &p, top, &rq, &mut actions);// ---------------------------------------------------------- column headerlet head = Rect::from_min_size(pos2(rect.min.x, top.max.y), vec2(rect.width(), HEAD_H));@@@ -593,30 -764,7 +893,12 @@@selected = Some(it.id);app.ui.focused = crate::dock::PanelKind::RenderQueue;}+ if row_resp.has_focus() {+ lp.rect_stroke(row.shrink(0.5), 0.0, Stroke::new(1.0, t.accent), StrokeKind::Inside);+ }+ let comp_item = app.session.project.item(it.comp);+ let name = comp_item.map(|i| i.name.clone()).unwrap_or_else(|| "(missing composition)".into());- let item_id = it.id;- crate::widgets::context_menu(&row_resp, |ui| {- if ui.button(tr("Duplicate")).clicked() {- actions.push(("renderQueue.duplicate", json!({"item": item_id})));- ui.close();- }- if ui.button(tr("Remove")).clicked() {- actions.push(("renderQueue.remove", json!({"item": item_id})));- ui.close();- }- if k > 0 && ui.button(tr("Move Up")).clicked() {- actions.push(("renderQueue.move", json!({"item": item_id, "to": n - 1})));- ui.close();- }- if n < queue.len() && ui.button(tr("Move Down")).clicked() {- actions.push(("renderQueue.move", json!({"item": item_id, "to": n + 1})));- ui.close();- }- });+ crate::widgets::context_menu(&row_resp, |ui| row_menu(ui, &mut actions, it.id, k, queue.len()));app.auto.add(&aid("row"), row, &format!("#{n}"));let is_open = open.contains(&it.id);let tw = Rect::from_center_size(pos2(cx_twirl + 8.0, row.center().y), vec2(14.0, 14.0));@@@ -640,29 -784,30 +922,18 @@@let label_col = comp_item.map(|i| t.label(i.label)).unwrap_or(t.text_faint);lp.rect_filled(Rect::from_center_size(pos2(cx_label + 6.0, row.center().y), vec2(10.0, 10.0)), 2.0, label_col);lp.text(pos2(cx_num + 2.0, row.center().y), Align2::LEFT_CENTER, n.to_string(), Tokens::ui(12.0), t.text_dim);- let name = comp_item.map(|i| i.name.clone()).unwrap_or_else(|| "(missing composition)".into());lp.text(pos2(cx_name + 2.0, row.center().y), Align2::LEFT_CENTER, &name, Tokens::ui(12.0), t.text);-- let status = if rendering && let Some(pr) = progress.as_ref().filter(|p| p.current == Some(it.id)) {-- format!("Rendering {:.0}%", if pr.total > 0 { pr.done as f64 * 100.0 / pr.total as f64 } else { 0.0 })-- } else {-- it.status.label().to_string()-- };++ let status = status_text(it, progress.as_ref(), rendering);let st_rect = Rect::from_min_size(pos2(cx_status, row.min.y), vec2(w_status, ROW_H));lp.text(pos2(cx_status + 2.0, row.center().y), Align2::LEFT_CENTER, &status, Tokens::ui(12.0), status_color(&t, &it.status));if let RenderStatus::Failed(e) = &it.status {ui.interact(st_rect, egui::Id::unique(("rq-st", it.id)), Sense::hover()).on_hover_text(e);}app.auto.add(&aid("status"), st_rect, &status);- if let Some(s) = it.started {- lp.text(pos2(cx_started + 2.0, row.center().y), Align2::LEFT_CENTER, utc_stamp(s), Tokens::ui(11.5), t.text_dim);- } else {- lp.text(pos2(cx_started + 2.0, row.center().y), Align2::LEFT_CENTER, "-", Tokens::ui(11.5), t.text_faint);- }- let rt = if progress.as_ref().and_then(|p| p.current) == Some(it.id) && rendering {- progress.as_ref().map(|p| hms(p.item_elapsed)).unwrap_or_default()- } else {- it.render_time.map(|s| if s < 60.0 { format!("{s:.1} s") } else { hms(s) }).unwrap_or_else(|| "-".into())- };+ a11y::tree_item(&row_resp, &format!("{n}. {name}, {status}"), is_sel, 1, Some(is_open));- if let Some(s) = it.started {- lp.text(pos2(cx_started + 2.0, row.center().y), Align2::LEFT_CENTER, utc_stamp(s), Tokens::ui(11.5), t.text_dim);- } else {- lp.text(pos2(cx_started + 2.0, row.center().y), Align2::LEFT_CENTER, "-", Tokens::ui(11.5), t.text_faint);- }- let rt = if progress.as_ref().and_then(|p| p.current) == Some(it.id) && rendering {- progress.as_ref().map(|p| hms(p.item_elapsed)).unwrap_or_default()- } else {- it.render_time.map(|s| if s < 60.0 { format!("{s:.1} s") } else { hms(s) }).unwrap_or_else(|| "-".into())- };++ let (started, started_col) = it.started.map_or(("-".to_string(), t.text_faint), |s| (utc_stamp(s), t.text_dim));++ lp.text(pos2(cx_started + 2.0, row.center().y), Align2::LEFT_CENTER, started, Tokens::ui(11.5), started_col);++ let rt = render_time_text(it, progress.as_ref(), rendering);lp.text(pos2(cx_time + 2.0, row.center().y), Align2::LEFT_CENTER, rt, Tokens::ui(11.5), t.text_dim);if !is_open {@@@ -818,105 -873,10 +1004,12 @@@None => d.remove::<(u64, String)>(editing_id),});- // Keyboard: Up / Down move between the queued items, Home / End go to the first / last, Right- // and Left open and close the item's settings, Enter and Space do the same (Space only with a- // row focused: otherwise it plays the preview). The focus follows the selection.- let focused = ctx.memory(|m| m.focused());- let on_row = focused.is_some_and(|f| queue.iter().any(|i| row_id(i.id) == f));- let by_mouse = focused.is_none() && app.ui.focused == crate::dock::PanelKind::RenderQueue;- if (on_row || by_mouse) && editing.is_none() && app.dialog.is_none() && !widgets::any_menu_open(&ctx) {- let keys: Vec<egui::Key> = ctx.input(|i| {- i.events- .iter()- .filter_map(|e| match e {- egui::Event::Key { key, pressed: true, modifiers, .. } if !modifiers.any() => Some(*key),- _ => None,- })- .collect()- });- let mut moved = None;- for key in keys {- use egui::Key;- let at = selected.and_then(|s| queue.iter().position(|i| i.id == s));- let Some(last) = queue.len().checked_sub(1) else { break };- let to = match key {- Key::ArrowDown => Some(at.map_or(0, |a| a.saturating_add(1).min(last))),- Key::ArrowUp => Some(at.map_or(last, |a| a.saturating_sub(1))),- Key::Home if on_row => Some(0),- Key::End if on_row => Some(last),- _ => None,- };- if let Some(item) = to.and_then(|to| queue.get(to)) {- selected = Some(item.id);- moved = Some(item.id);- continue;- }- let Some(item) = selected.filter(|s| queue.iter().any(|i| i.id == *s)) else { continue };- match key {- Key::ArrowRight if !open.contains(&item) => open.push(item),- Key::ArrowLeft => open.retain(|i| *i != item),- Key::Enter | Key::Space if on_row || key == Key::Enter => {- if open.contains(&item) {- open.retain(|i| *i != item);- } else {- open.push(item);- }- }- _ => {}- }- }- if let Some(item) = moved {- if let Some((_, top)) = tops.iter().find(|(id, _)| *id == item) {- widgets::PanelScroll::reveal(&ctx, egui::Id::unique("rq-scroll"), *top, *top + ROW_H, list.height());- }- app.ui.focused = crate::dock::PanelKind::RenderQueue;- if on_row {- a11y::focus_next_pass(&ctx, "rq", row_id(item));- }- ctx.request_repaint();- }- // The arrows are the queue's, not egui's spatial focus moves.- if on_row {- ctx.memory_mut(|m| m.move_focus(egui::FocusDirection::None));- }- }- delete_selected(app, ui, editing.is_none() && !rendering, &mut selected, &mut actions);++ let on_row = list_keys(app, &ctx, &queue, (&mut open, &mut selected), editing.is_none(), &tops, list.height());+- // Delete removes the selected item when the panel has focus.- if app.ui.focused == crate::dock::PanelKind::RenderQueue- && editing.is_none()- && !rendering- && let Some(id) = selected- && app.dialog.is_none()- && !crate::widgets::any_menu_open(ui.ctx())- && ui.input(|i| i.key_pressed(egui::Key::Delete) || i.key_pressed(egui::Key::Backspace))- // (A focused queue row is not typing; any other focused widget may be.)- && (on_row || !ui.ctx().egui_wants_keyboard_input())- {- actions.push(("renderQueue.remove", json!({"item": id})));- selected = None;- }++ delete_selected(app, ui, editing.is_none() && !rendering, on_row, &mut selected, &mut actions);// ---------------------------------------------------------- footer- let foot = Rect::from_min_max(pos2(rect.min.x, rect.max.y - FOOT_H), rect.max);- p.rect_filled(foot, 0.0, t.tl_ruler_bg);- p.line_segment([foot.left_top(), foot.right_top()], Stroke::new(1.0, t.separator));- let msg = match &progress {- Some(pr) if rendering => format!("Message: Rendering {} of {}", (pr.items_done + 1).min(pr.items_total), pr.items_total),- _ => {- let done = queue.iter().filter(|i| i.status == RenderStatus::Done).count();- format!("Message: {done} of {} done", queue.len())- }- };- p.text(pos2(foot.min.x + 12.0, foot.center().y), Align2::LEFT_CENTER, msg, Tokens::ui(11.0), t.text_dim);- let started = queue.iter().filter(|i| i.started.is_some()).count();- let total: f64 = queue.iter().filter_map(|i| i.render_time).sum();- p.text(- pos2(foot.max.x - 12.0, foot.center().y),- Align2::RIGHT_CENTER,- format!("Renders Started: {started} Total Time Elapsed: {}", hms(progress.as_ref().filter(|_| rendering).map(|p| p.elapsed).unwrap_or(total))),- Tokens::ui(11.0),- t.text_dim,- );+ footer(&p, rect, &rq, &t);open.retain(|id| queue.iter().any(|i| i.id == *id));ui.data_mut(|d| d.insert_temp(state_id, (open, selected)));