FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust
egui-037: document UI and input integration contracts
skylar taylor-barrick1c69ff3c1a9a
diff --git a/apps/filmcraft-web/src/lib.rs b/apps/filmcraft-web/src/lib.rsindex 9a6227863..1110c64e4 100644--- a/apps/filmcraft-web/src/lib.rs+++ b/apps/filmcraft-web/src/lib.rs@@ -94,6 +94,7 @@ impl eframe::App for WebApp {self.app.raw_input_hook(ctx, raw_input);}+ /// Hidden logic pass: host actions, app logic, API replies, jobs, audio, autosave, then IME reset; it does not draw UI.fn logic(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {let actions = ACTIONS.with(|a| std::mem::take(&mut *a.borrow_mut()));for f in actions {diff --git a/apps/filmcraft-web/src/recovery.rs b/apps/filmcraft-web/src/recovery.rsindex 5c58e44b6..fc556013a 100644--- a/apps/filmcraft-web/src/recovery.rs+++ b/apps/filmcraft-web/src/recovery.rs@@ -36,6 +36,7 @@ pub struct Autosave {}impl Default for Autosave {+ /// Default policy with a monotonic host clock, so hidden-tab logic never uses a stale egui input time.fn default() -> Self {Self { policy: Policy::default(), outcomes: Rc::default(), clock: web_time::Instant::now() }}diff --git a/apps/filmcraft-web/src/webcodecs.rs b/apps/filmcraft-web/src/webcodecs.rsindex b16bf0db1..48b1d3bad 100644--- a/apps/filmcraft-web/src/webcodecs.rs+++ b/apps/filmcraft-web/src/webcodecs.rs@@ -74,6 +74,7 @@ thread_local! {static CLOCK: web_time::Instant = web_time::Instant::now();}+/// Milliseconds from a monotonic browser clock; codec idle and staleness accounting must never use wall time.fn now_ms() -> f64 {CLOCK.with(|clock| clock.elapsed().as_secs_f64() * 1000.0)}diff --git a/apps/filmcraft/src/audio.rs b/apps/filmcraft/src/audio.rsindex 26a5cf727..a29596f81 100644--- a/apps/filmcraft/src/audio.rs+++ b/apps/filmcraft/src/audio.rs@@ -51,6 +51,7 @@ enum Note {}impl Note {+ /// Localized status text for a fallback device (name interpolated through `fmt`) or for no output device.fn text(&self) -> String {use filmcraft_ui_egui::i18n::{fmt, t};match self {diff --git a/crates/ui-egui/src/automation.rs b/crates/ui-egui/src/automation.rsindex eb18aed37..b7e086130 100644--- a/crates/ui-egui/src/automation.rs+++ b/crates/ui-egui/src/automation.rs@@ -83,10 +83,12 @@ mod tests {use super::Registry;+ /// Test helper: a 10×10 rect at `x` for pass-order fixtures.fn rect(x: f32) -> Rect {Rect::from_min_size(pos2(x, 0.0), vec2(10.0, 10.0))}+ /// Lookups and prefix queries must resolve the pass just drawn, not stale geometry.#[test]fn lookups_prefer_the_current_accepted_pass() {let mut registry = Registry::default();@@ -98,6 +100,7 @@ mod tests {assert_eq!(registry.find_current("panel.project").map(|e| e.rect[0]), Some(200.0));}+ /// Once the current pass registers an element, a removed id must not resolve from the previous pass.#[test]fn removed_elements_do_not_resolve_from_a_populated_current_pass() {let mut registry = Registry::default();@@ -110,6 +113,7 @@ mod tests {assert!(registry.query("dialog.").is_empty());}+ /// The previous pass is usable only before the current pass draws; a discarded pass leaves exactly one entry.#[test]fn the_previous_pass_is_only_a_fallback_before_this_pass_draws() {let mut registry = Registry::default();diff --git a/crates/ui-egui/src/cjk.rs b/crates/ui-egui/src/cjk.rsindex a72222db0..5fc593d5b 100644--- a/crates/ui-egui/src/cjk.rs+++ b/crates/ui-egui/src/cjk.rs@@ -105,6 +105,7 @@ fn install_chinese(fonts: &mut FontDefinitions) {mod font_blob_tests {use super::*;+ /// `FontData::from_blob` retains the TTC face index when constructed from a shared blob.#[test]fn a_ttc_face_index_survives_font_data_construction() {let font = FontData::from_blob(Arc::new(vec![0u8; 4]), 7);diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rsindex 1bc44a081..e84f4adb3 100644--- a/crates/ui-egui/src/control.rs+++ b/crates/ui-egui/src/control.rs@@ -117,6 +117,8 @@ fn point(app: &FilmcraftApp, p: &Value) -> Result<egui::Pos2, String> {Ok(egui::pos2(x as f32, y as f32))}+/// Execute one control request. Synthetic input is capped by `MAX_SYNTHETIC_EVENTS` before queueing, screenshot crops stay symbolic until capture, and+/// `gfxEdit` layer identity is resolved from the document.pub fn handle(app: &mut FilmcraftApp, ctx: &egui::Context, req: &ControlRequest) -> Outcome {let p = &req.params;let s = |k: &str| p.get(k).and_then(Value::as_str);@@ -569,6 +571,7 @@ fn merge(v: &mut Value, patch: &Value) {}}+/// Read-only JSON snapshot; focus and element counts come from the current accepted registry pass.pub fn inspect(app: &FilmcraftApp, ctx: &egui::Context) -> Value {let size = ctx.content_rect().size();let keyboard_focus = ctx.memory(|memory| memory.focused()).map(|id| {@@ -854,6 +857,7 @@ mod base64_tests {}}+ /// Negative and overhanging panel origins clip to the visible image without shifting the requested region, at any scale.#[test]fn screenshot_crop_clips_negative_panel_origin() {// A panel starting two points left of / one point above the window: only the visible@@ -865,6 +869,7 @@ mod base64_tests {assert_eq!(super::crop_pixels([8, 8], Some([6.0, 5.0, 4.0, 4.0]), 1.0).unwrap(), (6, 5, 2, 3));}+ /// Crops with no overlap or a non-finite/non-positive size are refused, never rendered as a zero-sized image.#[test]fn screenshot_crop_outside_the_image_is_refused() {for crop in [[-8.0, -8.0, 4.0, 4.0], [8.0, 0.0, 4.0, 4.0], [0.0, 9.0, 4.0, 4.0]] {diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rsindex 867d24740..cd302674d 100644--- a/crates/ui-egui/src/dock.rs+++ b/crates/ui-egui/src/dock.rs@@ -525,6 +525,7 @@ pub fn layout_with_actions(layout_inner(ui, node, rect, t, path, &[], out, reg, actions);}+/// Recursively lay out tabs and splits with path-based automation ids, emitting gutter resize actions; groups are appended in traversal order.fn layout_inner(ui: &mut egui::Ui,node: &mut DockNode,@@ -593,6 +594,7 @@ pub struct Chrome {pub tabs: Vec<(PanelKind, Rect)>,}+/// Draw a group's frame and tab strip, register panel/tab automation ids and return its dock actions; a compact single panel gets an 8 pt grip header.pub fn draw_group_chrome_details(ui: &mut egui::Ui, g: &Group, seqs: &SeqTabs, t: &Tokens, reg: &mut crate::automation::Registry) -> Chrome {let mut actions = Vec::new();let mut tab_rects: Vec<(PanelKind, Rect)> = Vec::new();diff --git a/crates/ui-egui/src/dock_ui.rs b/crates/ui-egui/src/dock_ui.rsindex ef69ce477..3d5761a13 100644--- a/crates/ui-egui/src/dock_ui.rs+++ b/crates/ui-egui/src/dock_ui.rs@@ -17,6 +17,7 @@ fn floating_rect(group: &dock::Floating, screen: Rect) -> Rect {))}+/// The single stable id holding an in-flight docked-panel drag across frames.fn drag_id() -> egui::Id {egui::Id::unique("dock-panel-drag")}@@ -170,6 +171,7 @@ impl FilmcraftApp {true}+ /// Floating group indexes in layer z-order; groups without a layer sort last.fn floating_order(&self, ctx: &egui::Context) -> Vec<usize> {let layers = ctx.memory(|memory| memory.layer_ids().collect::<Vec<_>>());let mut order: Vec<_> = (0..self.ui.floating.len()).collect();@@ -187,6 +189,8 @@ impl FilmcraftApp {order}+ /// Lay out the dock area and floating groups; while a panel is maximized a temporary one-panel tree is drawn and the saved dock is left untouched, and a+ /// pending panel raise moves its floating layer to the top.pub(crate) fn dock_area(&mut self, ui: &mut egui::Ui, body: Rect) {let t = self.tokens;let ctx = ui.ctx().clone();@@ -292,6 +296,8 @@ impl FilmcraftApp {panels::panel_menu_popup(self, ui);}+ /// Draw one floating group on the middle layer, clamped on-screen with a minimum size; register its move/resize automation ids and submit `MoveFloating`+ /// for a drag or resize.fn floating_group(&mut self, ctx: &egui::Context, index: usize, seqs: &dock::SeqTabs, actions: &mut Vec<DockAction>) -> Option<DropTarget<PanelKind>> {let floating = self.ui.floating.get(index)?.clone();let panel = *floating.panels.first()?;@@ -348,6 +354,8 @@ impl FilmcraftApp {output}+ /// Continue a docked panel drag: cancel on Escape, focus loss or an absent press/release, discard stale panel ids, prefer workspace-edge drops, and treat+ /// Command as force-float.fn panel_drag(&mut self, ctx: &egui::Context, body: Rect, targets: &[DropTarget<PanelKind>]) {let Some(panel) = ctx.data(|data| data.get_temp::<PanelKind>(drag_id())) else { return };let canceled =diff --git a/crates/ui-egui/src/header.rs b/crates/ui-egui/src/header.rsindex 74e465d02..e1100c978 100644--- a/crates/ui-egui/src/header.rs+++ b/crates/ui-egui/src/header.rs@@ -10,6 +10,7 @@ use crate::icons::{self, Icon};use crate::state::Mode;use crate::theme::Tokens;+/// Draw the header bar; dragging starts a native window move and double-click toggles maximized.pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {let t = app.tokens;let p = ui.painter().clone();diff --git a/crates/ui-egui/src/i18n/mod.rs b/crates/ui-egui/src/i18n/mod.rsindex fb3314562..b84f93819 100644--- a/crates/ui-egui/src/i18n/mod.rs+++ b/crates/ui-egui/src/i18n/mod.rs@@ -1128,6 +1128,7 @@ mod tests {mod bcp47_tests {use super::Language;+ /// Protocol-facing BCP 47 tags use `pt-BR`/`zh-CN`; every tag is non-empty ASCII.#[test]fn accesskit_tags_use_protocol_spelling() {assert_eq!(Language::En.bcp47(), "en");diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 772999358..01c3d57a2 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -608,6 +608,8 @@ impl FilmcraftApp {}impl FilmcraftApp {+ /// Build the app around one shared `FrameServer`, falling back to the default language on an unparsable preference, loading workspaces from the prefs+ /// directory and seeding IME epoch/sequence identity.pub fn new(mut session: Session) -> Self {session.shortcuts.register_external(menus::external_commands());let recovery = !session.recovery_candidates().is_empty();@@ -1392,6 +1394,8 @@ impl FilmcraftApp {}}+ /// Advance the Program playhead only while playing; owns preroll completion, audio-clock anchoring, output retry and the fallback to wall time when audio+ /// is lost or stalls.fn advance_playback(&mut self, ctx: &egui::Context) {if !self.playback.playing {return;@@ -1824,6 +1828,8 @@ impl FilmcraftApp {.any(|e| e.response_id == Some(focused) && (e.id.starts_with("dock.gutter.") || (e.id.starts_with("panel.float.") && e.id.ends_with(".resize"))))}+ /// Per-pass shortcut handling: reset the pasted image, rebuild bindings only when the shortcut revision or workspace set changes, and leave unmodified keys+ /// to a focused text field except dock dividers.fn handle_shortcuts(&mut self, ctx: &egui::Context) {// A paste image payload belongs to the paste event in this pass only.self.pasted_image = None;@@ -1962,6 +1968,8 @@ impl FilmcraftApp {ctx.request_repaint();}+ /// Drain queued control requests without blocking: UI requests wait for a layout pass with a 3 s deadline (except screenshots), non-UI requests run now,+ /// and hidden windows are raised and repainted.fn drain_control(&mut self, ctx: &egui::Context) {let Some(rx) = self.control_rx.take() else { return };let now = self.now();@@ -2088,6 +2096,7 @@ impl FilmcraftApp {ctx.request_repaint_after(std::time::Duration::from_secs_f64(wait));}+ /// Top-level UI pass: set the language, honor the injected panic test hook, lay out header, body and status bar, and dispatch the active mode.fn frame(&mut self, ui: &mut egui::Ui) {i18n::set_current(self.ui.language);if std::mem::take(&mut self.panic_next_frame) {@@ -2792,6 +2801,7 @@ mod clipboard_key_tests {events.into_iter().filter_map(|e| if let Event::Key { key, modifiers, pressed: true, .. } = e { Some((key, modifiers)) } else { None }).collect()}+ /// Clipboard Copy/Cut/Paste events become C/X/V key presses so they match the shortcut bindings.#[test]fn ctrl_c_x_v_become_key_presses() {let c = Modifiers::COMMAND;@@ -3164,6 +3174,7 @@ mod audio_recovery_tests {app.stop();}+ /// A device that loses its playback clock resumes from the displayed frame and reports a status message.#[test]fn a_failed_device_clock_resumes_from_the_displayed_frame() {let mut session = Session::default();@@ -3208,6 +3219,7 @@ mod audio_recovery_tests {}}+ /// A recovered stream keeps the device clock and the sound keeps playing.#[test]fn a_restarted_stream_keeps_the_device_clock_and_the_sound() {let mut session = Session::default();@@ -3255,6 +3267,7 @@ mod audio_recovery_tests {}}+ /// A lost output is reopened on retry and the sound returns without pause/play.#[test]fn a_lost_output_is_reopened_and_the_sound_returns() {let mut session = Session::default();@@ -3283,6 +3296,7 @@ mod audio_recovery_tests {app.stop();}+ /// A device that becomes available mid-playback starts sounding on the next retry.#[test]fn a_device_that_appears_mid_playback_starts_sounding() {let mut session = Session::default();@@ -3364,6 +3378,7 @@ mod text_focus_shortcut_tests {mod voiceover_playback_tests {use super::*;+ /// A voice-over take into an empty timeline past the end keeps playing and recording.#[test]fn a_voice_over_take_records_into_the_empty_timeline_past_the_end() {let mut session = Session::default();diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rsindex e0b26c104..4582bc2f0 100644--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@ -1147,6 +1147,7 @@ mod tests {assert_eq!(decoded.get_pixel(0, 0).0, [255, 0, 0, 128]);}+ /// An image whose RGBA size exceeds the 128 MiB cap is rejected before any RGBA copy is allocated.#[test]fn oversized_clipboard_images_are_rejected_before_allocating_rgba() {let side = 100_000;diff --git a/crates/ui-egui/src/panels/effect_controls_selection.rs b/crates/ui-egui/src/panels/effect_controls_selection.rsindex 74069ada2..db539d5d5 100644--- a/crates/ui-egui/src/panels/effect_controls_selection.rs+++ b/crates/ui-egui/src/panels/effect_controls_selection.rs@@ -11,6 +11,7 @@ use crate::{state::KeyframeRef,};+/// Key for the keyframe-selection gesture state in egui's temp store; `begin` resets it when the clip changes.fn state_id() -> Id {Id::unique("effect-controls-keyframe-selection")}@@ -103,6 +104,8 @@ fn update(group: &mut Group, points: &[Point], pos: Pos2, shift: bool, playhead:}impl Interaction {+ /// Begin keyframe selection for `clip`: reset on a clip change, cancel a gesture on Escape, start a Shift marquee from the existing selection, and keep+ /// gestures as UI-only previews.pub(crate) fn begin(app: &mut FilmcraftApp, ui: &mut egui::Ui, area: Rect, clip: u64) -> Self {let mut state = ui.data(|d| d.get_temp::<State>(state_id())).unwrap_or_default();if state.clip != clip {diff --git a/crates/ui-egui/src/panels/graphics.rs b/crates/ui-egui/src/panels/graphics.rsindex 4e5ca21f5..aea15f0a0 100644--- a/crates/ui-egui/src/panels/graphics.rs+++ b/crates/ui-egui/src/panels/graphics.rs@@ -547,6 +547,8 @@ fn new_text_action(app: &FilmcraftApp, pic: Rect, frame: (u32, u32), at: Pos2, cpub(crate) const TEXT_EDIT_ID: &str = "gfx-text-edit";+/// End text editing: clear `gfx_edit`, invalidate any in-flight IME composition, surrender focus and forget the panel tag so a late commit cannot reach the+/// next editor.fn end_edit(app: &mut FilmcraftApp, ui: &egui::Ui) {app.ui.gfx_edit = None;// Any composition that was in flight belongs to the editor that just ended; a late commit@@ -1211,6 +1213,7 @@ fn finish_pen(app: &mut FilmcraftApp, pic: Rect, frame: (u32, u32), actions: &muactions.push(("graphics.newShape".into(), p));}+/// Start editing a text layer at screen point `p` (caret at the text hit, else the end), restart the IME target, record clip/layer/uid and select the layer.fn start_edit_at(app: &mut FilmcraftApp, ui: &egui::Ui, v: &LayerView, p: Pos2, actions: &mut Vec<(String, Value)>) {let Some(tp) = text_of(&v.spec) else { return };let l = text_layout(tp);@@ -2351,6 +2354,8 @@ impl Ctx<'_> {self.actions.push(("effects.toggleAnimation".into(), json!({"clip": self.clip.0, "effect": self.eidx, "param": id})));}}+ /// Draw a labeled hot number for this clip/layer/`id`, register it for automation and emit the changed value through `Ctx::set`; `range` bounds typed and+ /// dragged input.fn number(&mut self, ui: &mut egui::Ui, label: &str, id: &str, speed: f64, range: (f64, f64), dec: usize, unit: &str) {let v = pv(self.e, id, self.mt).as_f64().unwrap_or(0.0);let (r, mut vui) = self.row(ui, label);@@ -2384,6 +2389,7 @@ impl Ctx<'_> {self.set(id, json!(nv));}}+ /// Draw X and Y hot numbers for this clip/layer/`id` with independent ids and ±100,000 bounds, register both and emit both components when either changes.fn point(&mut self, ui: &mut egui::Ui, label: &str, id: &str) {let v = pv(self.e, id, self.mt).as_vec2().unwrap_or_default();let (r, mut vui) = self.row(ui, label);diff --git a/crates/ui-egui/src/panels/media_browser.rs b/crates/ui-egui/src/panels/media_browser.rsindex d3b62294d..65b0e4c9b 100644--- a/crates/ui-egui/src/panels/media_browser.rs+++ b/crates/ui-egui/src/panels/media_browser.rs@@ -53,6 +53,7 @@ const PREVIEW_BASE: u64 = 1 << 44;const CACHE_SECS: f64 = 3.0;const ROW_H: f32 = 22.0;+/// Temp-store key for the Media Browser cache: listings stay fresh for 3 s and preview texture ids start at `PREVIEW_BASE`.fn cache_id() -> egui::Id {egui::Id::unique("media-browser-cache")}diff --git a/crates/ui-egui/src/panels/mixer.rs b/crates/ui-egui/src/panels/mixer.rsindex 6cbc05170..178070ce6 100644--- a/crates/ui-egui/src/panels/mixer.rs+++ b/crates/ui-egui/src/panels/mixer.rs@@ -415,6 +415,7 @@ fn run_actions(app: &mut FilmcraftApp, ctx: &egui::Context, acts: Vec<(String, V}}+/// Draw one mixer strip. A missing track is a no-op; automation ids use `mixer.<label>`; the master strip has `MASTER_STRIP` handling.fn strip(app: &mut FilmcraftApp, ui: &mut egui::Ui, cx: &mut Ctx, id: TrackId, sr: Rect, meter: &[[f32; 2]]) {let t = cx.t;let seq = cx.seq;diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rsindex 20be2700d..ca9fb3c5d 100644--- a/crates/ui-egui/src/panels/mod.rs+++ b/crates/ui-egui/src/panels/mod.rs@@ -123,6 +123,7 @@ enum DragPayload {Template(String, String),}+/// Single egui temp slot holding the active drag payload: a project item or bin, a source, an effect or a graphics template.fn payload_id() -> egui::Id {egui::Id::unique("filmcraft-drag-payload")}@@ -205,6 +206,7 @@ pub fn clear_drag(ui: &egui::Ui) {ui.ctx().data_mut(|d| d.insert_temp::<Option<DragPayloadBox>>(payload_id(), None));}+/// Temp-store key marking a cancelled drag until the button is released, so it cannot restart immediately.fn cancelled_id() -> egui::Id {egui::Id::unique("filmcraft-drag-cancelled")}diff --git a/crates/ui-egui/src/panels/monitor.rs b/crates/ui-egui/src/panels/monitor.rsindex 06b80d639..018a2cd44 100644--- a/crates/ui-egui/src/panels/monitor.rs+++ b/crates/ui-egui/src/panels/monitor.rs@@ -944,6 +944,7 @@ fn set_transport_visible(hidden: &mut Vec<String>, command: &str, visible: bool)/// Width and height of a transport button.const TRANSPORT_BUTTON: f32 = 28.0;+/// Draw a monitor's Source or Program transport. Row buttons use `transport_button`; overflow-menu entries call `invoke_transport` directly.fn transport(app: &mut FilmcraftApp, ui: &mut egui::Ui, row: Rect, which: Which) {let t = app.tokens;let src = which == Which::Source;@@ -1086,6 +1087,7 @@ fn transport(app: &mut FilmcraftApp, ui: &mut egui::Ui, row: Rect, which: Which)}}+/// Draw one transport button with a unique id, automation registration, hover fill, proxy accent and a larger play icon; returns whether it was clicked.fn transport_button(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect, prefix: &str, icon: Icon, command: &str, label: &str) -> bool {let t = app.tokens;let response = ui.interact(rect, egui::Id::unique((prefix, command)), Sense::click()).on_hover_text(label);diff --git a/crates/ui-egui/src/panels/source_range.rs b/crates/ui-egui/src/panels/source_range.rsindex 8551bef9c..f5bd98237 100644--- a/crates/ui-egui/src/panels/source_range.rs+++ b/crates/ui-egui/src/panels/source_range.rs@@ -21,6 +21,7 @@ struct Drag {pointer_x: f32,revision: u64,}+/// Temp-store key for the in/out range drag, per monitor, so Source and Program drags never alias.fn key(which: Which) -> egui::Id {egui::Id::unique(("monitor-range-edit", which as u8))}diff --git a/crates/ui-egui/src/panels/timeline.rs b/crates/ui-egui/src/panels/timeline.rsindex 8839b54e5..4f3bfc302 100644--- a/crates/ui-egui/src/panels/timeline.rs+++ b/crates/ui-egui/src/panels/timeline.rs@@ -375,6 +375,8 @@ fn label_color(app: &FilmcraftApp, l: filmcraft_project::Label) -> Color32 {crate::panels::settings::label_color(app, l)}+/// Draw the Timeline and run its interaction. A missing or damaged active sequence shows the empty state; `stable_dt` is capped, and a project snapshot is kept+/// while commands mutate the session.pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {let t = app.tokens;let ctx = ui.ctx().clone();@@ -812,6 +814,7 @@ pub fn show(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {let _ = (visible, TICKS_PER_SECOND);}+/// Shown when no sequence is open: offers the demo project and accepts project or OS-file drops to create a sequence.fn empty_state(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect) {let t = app.tokens;ui.painter().text(rect.center() - vec2(0.0, 12.0), Align2::CENTER_CENTER, tl!("Drop media here to create sequence."), Tokens::ui(13.0), t.text_dim);@@ -1379,6 +1382,7 @@ fn patch_button(ui: &mut egui::Ui, r: Rect, clip: Rect, label: &str, on: bool, sresp}+/// Draw only the visible track headers, including colour label, targeting, lock and header controls clipped to each row.#[allow(clippy::too_many_arguments)]fn draw_headers(app: &mut FilmcraftApp, ui: &mut egui::Ui, seq: &Sequence, rows: &[Row], rect: Rect, vclip: Rect, aclip: Rect, t: &Tokens) {let hw = app.ui.timeline.header_w;@@ -1598,6 +1602,7 @@ pub fn ruler_steps(frame_px: f64, base: i64) -> (i64, i64) {(minor, label_step)}+/// Draw editable timecode, the timeline toolbar and ruler. Rejected timecode edits report a status message; toolbar command errors are ignored.fn draw_top(app: &mut FilmcraftApp, ui: &mut egui::Ui, rect: Rect, seq: &Sequence, layout: &Layout, t: &Tokens, seq_id: ItemId) {let p = ui.painter().clone();let rate = seq.settings.frame_rate;@@ -1823,6 +1828,8 @@ fn zoom_thumb(bar: Rect, seq_seconds: f64, scroll: f64, pps: f64) -> (f32, f32,(bar.min.x + at, w, if travel > 0.5 { range / travel as f64 } else { 0.0 })}+/// Draw the zoom scroll bar: the thumb reflects the visible range, a press beside it centres the thumb under the pointer, and the thumb and track are+/// registered for automation.fn zoom_scrollbar(app: &mut FilmcraftApp, ui: &mut egui::Ui, bar: Rect, seq_seconds: f64, t: &Tokens) {let p = ui.painter();p.rect_filled(bar, bar.height() / 2.0, t.separator);@@ -2416,6 +2423,8 @@ fn scrub_playhead(app: &mut FilmcraftApp, seq: &Sequence, layout: &Layout, p: Poapp.session.set_playhead(tt);}+/// Handle Timeline pointer input: remember the grab from the press frame, jump the playhead on a ruler press, select a marker on its press, and reset the+/// cancel flag once the button is released.fn interact(app: &mut FilmcraftApp, ui: &mut egui::Ui, seq: &Sequence, layout: &Layout, rect: Rect) {let ctx = ui.ctx().clone();let area = Rect::from_min_max(pos2(layout.content.min.x, layout.ruler.min.y), layout.content.max);diff --git a/crates/ui-egui/src/panels/timeline_automation.rs b/crates/ui-egui/src/panels/timeline_automation.rsindex 8b3766692..dc35df9d2 100644--- a/crates/ui-egui/src/panels/timeline_automation.rs+++ b/crates/ui-egui/src/panels/timeline_automation.rs@@ -137,6 +137,7 @@ struct KfDrag {grab: egui::Vec2,}+/// Single stable id for the in-flight track-automation keyframe drag.fn drag_id() -> egui::Id {egui::Id::unique("tl-lane-kf-drag")}diff --git a/crates/ui-egui/src/panels/timeline_captions.rs b/crates/ui-egui/src/panels/timeline_captions.rsindex 4643c0d33..6831bd72b 100644--- a/crates/ui-egui/src/panels/timeline_captions.rs+++ b/crates/ui-egui/src/panels/timeline_captions.rs@@ -36,6 +36,7 @@ enum Gesture {TrimOut,}+/// Single stable id for the live caption drag `(caption, gesture, delta ticks)`.fn drag_id() -> egui::Id {egui::Id::unique("caption-drag")}@@ -245,6 +246,8 @@ fn razor_block(}}+/// Handle one caption block: 5 px trim edges (capped at a quarter width), hover cursor, selection and double-click, and drag state; locked tracks are+/// read-only.fn interact_block(app: &mut FilmcraftApp,ui: &mut egui::Ui,diff --git a/crates/ui-egui/src/panels/timeline_volume.rs b/crates/ui-egui/src/panels/timeline_volume.rsindex e0b486ed7..217359e59 100644--- a/crates/ui-egui/src/panels/timeline_volume.rs+++ b/crates/ui-egui/src/panels/timeline_volume.rs@@ -205,6 +205,7 @@ struct KeyDrag {begun: bool,}+/// Single stable id for the in-flight audio keyframe drag; interaction runs above the clips.fn key_drag_id() -> egui::Id {egui::Id::unique("tl-volume-key-drag")}diff --git a/crates/ui-egui/src/rtl.rs b/crates/ui-egui/src/rtl.rsindex cf927f8e2..8b6eac690 100644--- a/crates/ui-egui/src/rtl.rs+++ b/crates/ui-egui/src/rtl.rs@@ -179,10 +179,12 @@ pub(crate) fn paint_line(painter: &Painter, rect: Rect, text: &str, font: FontIdmod tests {use super::*;+ /// Diagnostic helper: glyph characters in visual order, with control characters filtered out.fn drawn_chars(row: &egui::epaint::text::Row) -> Vec<char> {row.visual_order().map(|i| row.glyphs[i].chr).filter(|c| !c.is_control()).collect()}+ /// A right-to-left paragraph sets both RTL flags and draws the second logical word first.#[test]fn rtl_paragraph_is_flagged_and_visually_ordered() {let ctx = egui::Context::default();@@ -199,6 +201,7 @@ mod tests {ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear();}+ /// Paragraph direction follows the first strong character; an embedded RTL phrase must not flip the line.#[test]fn ltr_paragraph_with_an_rtl_phrase_keeps_its_direction() {let ctx = egui::Context::default();@@ -212,6 +215,7 @@ mod tests {ctx.run_ui(egui::RawInput::default(), |_| {}).textures_delta.clear();}+ /// Bidi classification remains total for Latin, punctuation and Arabic input.#[test]fn hostile_ranges_do_not_panic() {assert!(!has_rtl("Lesson 3: (draft)"));diff --git a/crates/ui-egui/src/source_playback.rs b/crates/ui-egui/src/source_playback.rsindex e8d20b986..ac8b69776 100644--- a/crates/ui-egui/src/source_playback.rs+++ b/crates/ui-egui/src/source_playback.rs@@ -198,6 +198,8 @@ impl FilmcraftApp {}}+ /// Advance Source audition playback while playing; stop on a missing or unavailable item or a failure, and re-anchor when the Source playhead is moved+ /// externally.pub(crate) fn advance_source_playback(&mut self, ctx: &egui::Context) {if !self.source_playback.clock.playing {return;diff --git a/crates/ui-egui/src/theme_favorites.rs b/crates/ui-egui/src/theme_favorites.rsindex 563e08f19..03abe1ab6 100644--- a/crates/ui-egui/src/theme_favorites.rs+++ b/crates/ui-egui/src/theme_favorites.rs@@ -1,4 +1,5 @@//! Original theme favorite star artwork, MIT OR Apache-2.0.+/// Draw the 22×22 favorite star button: visibility flag, favorite accent, accessible label and original vector artwork.pub(crate) fn star(ui: &mut egui::Ui, favorite: bool, visible: bool, accent: egui::Color32, label: &str) -> egui::Response {let (rect, response) = ui.allocate_exact_size(egui::vec2(22.0, 22.0), egui::Sense::click());response.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, label));diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rsindex c7df56159..215365285 100644--- a/crates/ui-egui/src/widgets.rs+++ b/crates/ui-egui/src/widgets.rs@@ -41,6 +41,7 @@ pub struct HotNumberOptions<'a> {}impl<'a> HotNumberOptions<'a> {+ /// Const constructor grouping speed, range, decimals, suffix and theme tokens; it performs no validation.pub const fn new(speed: f64, range: (f64, f64), decimals: usize, suffix: &'a str, tokens: &'a Tokens) -> Self {Self { speed, range, decimals, suffix, tokens }}@@ -126,6 +127,7 @@ fn hot_number_display(ui: &mut Ui, id: egui::Id, value: f64, options: HotNumberO(resp, out)}+/// Drag sensitivity: Shift ×10, Command ×0.1, otherwise ×1. Typed values are unaffected.fn hot_number_drag_multiplier(ui: &Ui) -> f64 {ui.input(|i| {if i.modifiers.shift {