Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge branch 'main' into worktree-agent-a6d2cbb6d6b3e5d7a

Brandon Thomasdc6e2714428c
diff --cc crates/ui-egui/src/panels/dialogs.rs
index 574476c74,4572b0768..2763cbdd7
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -131,83 -129,57 +135,138 @@@ fn audio_gain(app: &mut FilmcraftApp, c
keep
}
+/// Sequence ▸ Delete Tracks…: "Delete Video Tracks" / "Delete Audio Tracks" checkboxes, each with a
+/// track choice (All Empty Tracks or one track). Returns whether the dialog stays open.
+///
+/// Automation ids: `deleteTracks.video`, `deleteTracks.audio` (checkboxes),
+/// `deleteTracks.video.target`, `deleteTracks.audio.target` (track menus),
+/// `deleteTracks.<kind>.option.<empty|V1|A2…>` (menu entries while open), `deleteTracks.ok`,
+/// `deleteTracks.cancel`.
+fn delete_tracks(app: &mut FilmcraftApp, ctx: &egui::Context) -> bool {
+ let Some(seq) = app.session.active_sequence() else { return false };
+ let names = |n: usize, p: &str| (1..=n).map(|i| format!("{p}{i}")).collect::<Vec<_>>();
+ let vnames = names(seq.video_tracks.len(), "V");
+ let anames = names(seq.audio_tracks.len(), "A");
+ let mut draft = app.ui.delete_tracks.clone();
+ let mut keep = true;
+ let mut apply = false;
+ let mut elems: Vec<(String, egui::Rect, String)> = Vec::new();
+ egui::Window::new("Delete Tracks").collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0]).show(ctx, |ui| {
+ ui.set_min_width(300.0);
+ for (kind, title, on, target, list) in [
+ ("video", "Video Tracks", &mut draft.video, &mut draft.video_target, &vnames),
+ ("audio", "Audio Tracks", &mut draft.audio, &mut draft.audio_target, &anames),
+ ] {
+ ui.add_space(4.0);
+ ui.label(egui::RichText::new(title).strong());
+ let label = format!("Delete {title}");
+ let c = ui.checkbox(on, &label);
+ elems.push((format!("deleteTracks.{kind}"), c.rect, label));
+ ui.horizontal(|ui| {
+ ui.add_space(22.0);
+ let shown = if target == "empty" { "All Empty Tracks".to_string() } else { target.clone() };
+ ui.add_enabled_ui(*on, |ui| {
+ let r = egui::ComboBox::from_id_salt(("delete-tracks", kind)).selected_text(&shown).width(170.0).show_ui(ui, |ui| {
+ let e = ui.selectable_value(target, "empty".to_string(), "All Empty Tracks");
+ elems.push((format!("deleteTracks.{kind}.option.empty"), e.rect, "All Empty Tracks".into()));
+ for n in list {
+ let r = ui.selectable_value(target, n.clone(), n);
+ elems.push((format!("deleteTracks.{kind}.option.{n}"), r.rect, n.clone()));
+ }
+ });
+ elems.push((format!("deleteTracks.{kind}.target"), r.response.rect, shown));
+ });
+ });
+ }
+ ui.add_space(10.0);
+ ui.horizontal(|ui| {
+ let c = ui.button("Cancel");
+ elems.push(("deleteTracks.cancel".into(), c.rect, "Cancel".into()));
+ if c.clicked() {
+ keep = false;
+ }
+ let o =
+ ui.add_enabled(draft.video || draft.audio, egui::Button::new(egui::RichText::new("OK").color(egui::Color32::WHITE)).fill(app.tokens.accent));
+ elems.push(("deleteTracks.ok".into(), o.rect, "OK".into()));
+ if o.clicked() {
+ apply = true;
+ }
+ });
+ });
+ for (id, r, l) in elems {
+ app.auto.add(&id, r, &l);
+ }
+ if ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
+ keep = false;
+ }
+ if apply {
+ let mut p = serde_json::Map::new();
+ if draft.video {
+ p.insert("video".into(), serde_json::json!(draft.video_target));
+ }
+ if draft.audio {
+ p.insert("audio".into(), serde_json::json!(draft.audio_target));
+ }
+ if let Err(e) = app.session.execute("sequence.deleteTracks", serde_json::Value::Object(p)) {
+ app.ui.status = e.to_string();
+ }
+ keep = false;
+ }
+ app.ui.delete_tracks = draft;
+ keep
+}
++
+ /// Help ▸ About FilmCraft: version, credits and the ArtCraft community links. Joining the Discord
+ /// is the first, accented button.
+ ///
+ /// Automation ids: `about.discord`, `about.website`, `about.appPage`, `about.github`,
+ /// `about.reportIssue`.
+ fn about(app: &mut FilmcraftApp, ui: &mut egui::Ui) {
+ use crate::icons::{self, Icon};
+ use crate::links;
+ let t = app.tokens;
+ ui.set_width(380.0);
+ // ArtCraft wordmark (first-party trademark, docs/brand/).
+ let (r, _) = ui.allocate_exact_size(egui::vec2(ui.available_width(), 30.0), egui::Sense::hover());
+ crate::brand::paint_wordmark(ui, egui::pos2(r.min.x, r.center().y), 20.0, app.ui.dark);
+ ui.add_space(6.0);
+ ui.heading("FilmCraft");
+ ui.label(format!("Version {}", env!("CARGO_PKG_VERSION")));
+ ui.label("A clean-room, pure-Rust non-linear video editor. Part of the ArtCraft family.");
+ ui.add_space(10.0);
+ let mut link = |ui: &mut egui::Ui, id: &str, icon: Icon, label: &str, url: &str, primary: bool| {
+ let size = egui::vec2(ui.available_width(), if primary { 36.0 } else { 28.0 });
+ let (r, resp) = ui.allocate_exact_size(size, egui::Sense::click());
+ let resp = resp.on_hover_text(url);
+ app.auto.add(&format!("about.{id}"), r, label);
+ let bg = if primary {
+ if resp.hovered() { t.accent_hover } else { t.accent }
+ } else if resp.hovered() {
+ t.hover
+ } else {
+ egui::Color32::TRANSPARENT
+ };
+ ui.painter().rect_filled(r, 6.0, bg);
+ let fg = if primary { egui::Color32::WHITE } else { t.text };
+ let ir = egui::Rect::from_center_size(egui::pos2(r.min.x + 20.0, r.center().y), egui::vec2(18.0, 18.0));
+ icons::paint(ui.painter(), ir, icon, fg);
+ ui.painter().text(
+ egui::pos2(r.min.x + 40.0, r.center().y),
+ egui::Align2::LEFT_CENTER,
+ label,
+ crate::theme::Tokens::ui(if primary { 14.0 } else { 13.0 }),
+ fg,
+ );
+ if resp.clicked() {
+ links::open(ui.ctx(), url);
+ }
+ };
+ link(ui, "discord", Icon::Chat, "Join the ArtCraft Discord", links::DISCORD, true);
+ ui.add_space(6.0);
+ link(ui, "website", Icon::Globe, "getartcraft.com", links::WEBSITE, false);
+ link(ui, "appPage", Icon::Globe, "FilmCraft on getartcraft.com", links::APP_PAGE, false);
+ link(ui, "github", Icon::Code, "Source code on GitHub", links::GITHUB, false);
+ link(ui, "reportIssue", Icon::Code, "Report an issue", links::ISSUES, false);
+ ui.add_space(10.0);
+ ui.label(egui::RichText::new("MIT OR Apache-2.0. Fonts: Inter, Noto Serif and JetBrains Mono (SIL OFL 1.1).").small().color(t.text_dim));
+ }
diff --cc crates/ui-egui/src/panels/misc.rs
index 9727bf34b,dc3e347fc..cb8055a7e
--- a/crates/ui-egui/src/panels/misc.rs
+++ b/crates/ui-egui/src/panels/misc.rs
@@@ -118,18 -82,8 +117,18 @@@ pub fn markers(app: &mut FilmcraftApp,
}
if seq.markers.is_empty() {
ui.label(egui::RichText::new("No markers. Press M to add one.").color(t.text_faint));
+ } else if shown == 0 {
+ ui.label(egui::RichText::new("All markers are hidden by the colour filter.").color(t.text_faint));
}
});
+ for (id, r, l) in elems {
+ app.auto.add(&id, r, &l);
+ }
+ if let Some((l, visible)) = toggle
- && let Err(e) = app.session.execute("markers.filterColors", json!({"color": l.name(), "visible": visible}))
++ && let Err(e) = app.session.execute("markers.filterColors", serde_json::json!({"color": l.name(), "visible": visible}))
+ {
+ app.ui.status = e.to_string();
+ }
if let Some(g) = go {
app.session.set_playhead(g);
}