Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

updates

Jareer9d92c5328b77
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 5b8ad3b0..e23a7591 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -504,6 +504,7 @@
"Recommended": "Recommended",
"Red and blue pulled apart, the colour fringing of a cheap lens.": "Red and blue pulled apart, the colour fringing of a cheap lens.",
"Redo": "Redo",
+ "Redo (⇧⌘Z)": "Redo (⇧⌘Z)",
"Reduce noise": "Reduce noise",
"Regular": "Regular",
"Relink All…": "Relink All…",
@@ -680,6 +681,7 @@
"Typography": "Typography",
"Umber": "Umber",
"Undo": "Undo",
+ "Undo (⌘Z)": "Undo (⌘Z)",
"Unlock lane": "Unlock lane",
"Unmute lane": "Unmute lane",
"Unpacking…": "Unpacking…",
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index 39be8c55..cbbf6f2e 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -638,6 +638,14 @@ pub fn run() -> Result<(), slint::PlatformError> {
editor.on_delete_selected(on_window!(|state| {
state.delete_selected();
}));
+ // The tray's buttons; the menu row and ⌘Z reach the same two methods
+ // through `app_menu_selected` below.
+ editor.on_undo(on_window!(|state| {
+ state.undo();
+ }));
+ editor.on_redo(on_window!(|state| {
+ state.redo();
+ }));
editor.on_split(on_window!(|state| {
let at = state.playhead;
state.split_at(at, true);
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 08d06237..3150224b 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -5142,6 +5142,14 @@ impl Studio {
editor.set_magnetic(self.prefs.magnetic);
editor.set_pan_mode(self.lanes.pan_mode);
editor.set_selected_count(self.selection.len() as i32);
+ // The tray's undo and redo buttons grey out on these; the Edit menu
+ // asks the session itself when it opens.
+ // https://github.com/jub0t/Concat/issues/154
+ let (can_undo, can_redo) = self.session.as_ref().map_or((false, false), |session| {
+ (session.can_undo(), session.can_redo())
+ });
+ editor.set_can_undo(can_undo);
+ editor.set_can_redo(can_redo);
let (sound_selected, title_selected) = self.sound_tools();
editor.set_sound_selected(sound_selected);
editor.set_title_selected(title_selected);
@@ -6081,8 +6089,8 @@ impl Studio {
},
],
1 => vec![
- row("undo", t("Undo"), Glyph::ChevronUp, "⌘Z", can_undo),
- row("redo", t("Redo"), Glyph::ChevronDown, "⇧⌘Z", can_redo),
+ row("undo", t("Undo"), Glyph::Undo, "⌘Z", can_undo),
+ row("redo", t("Redo"), Glyph::Redo, "⇧⌘Z", can_redo),
rule(),
row(
"split",
diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slint
index 10648cce..9a2d55bc 100644
--- a/src/crates/concat/ui/editor.slint
+++ b/src/crates/concat/ui/editor.slint
@@ -237,6 +237,11 @@ export global Editor {
/// Hand tool: wheel and drag pan time instead of scrolling the stack.
in-out property <bool> pan-mode: false;
in-out property <int> selected-count;
+ /// Whether the history has a step that way: what greys the tray's undo
+ /// and redo buttons. The Edit menu asks Rust the same question when it
+ /// opens; the tray cannot, so Rust publishes the answer.
+ in-out property <bool> can-undo;
+ in-out property <bool> can-redo;
in-out property <string> merge-blocked-because;
/// What the selection offers the tray's sound and word tools: one clip
/// with sound for Captions to start on, one title for Speak to read.
@@ -256,6 +261,11 @@ export global Editor {
callback snap-changed(snap: bool);
callback magnetic-changed(on: bool);
callback pan-changed(on: bool);
+ /// The tray's undo and redo buttons. The keyboard's ⌘Z goes through
+ /// the Edit menu instead (see App.app-menu-selected); both land on the
+ /// same two methods of the state.
+ callback undo();
+ callback redo();
callback split();
callback merge();
callback delete-selected();
diff --git a/src/crates/concat/ui/icons.slint b/src/crates/concat/ui/icons.slint
index e080adcc..92da6080 100644
--- a/src/crates/concat/ui/icons.slint
+++ b/src/crates/concat/ui/icons.slint
@@ -86,6 +86,8 @@ export enum Glyph {
clock,
tag,
// the timeline tray and its lane headers
+ undo,
+ redo,
pointer,
razor,
split,
@@ -468,6 +470,19 @@ export component Icon inherits Rectangle {
+ " 12h-2";
}
+ // lucide/undo-2 and lucide/redo-2: the curved arrows every editor means
+ // by "take it back" and "put it back", one the mirror of the other.
+ if root.glyph == Glyph.undo: Stroked {
+ size: root.size; tint: root.tint; weight: root.weight;
+ commands: "M9 14 4 9l5-5 M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5"
+ + " 5.5H11";
+ }
+ if root.glyph == Glyph.redo: Stroked {
+ size: root.size; tint: root.tint; weight: root.weight;
+ commands: "M15 14l5-5-5-5 M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5"
+ + " 20H13";
+ }
+
// lucide/square-split-horizontal
if root.glyph == Glyph.split: Stroked {
size: root.size; tint: root.tint; weight: root.weight;
diff --git a/src/crates/concat/ui/timeline/tray.slint b/src/crates/concat/ui/timeline/tray.slint
index 43140dc7..db7e89a5 100644
--- a/src/crates/concat/ui/timeline/tray.slint
+++ b/src/crates/concat/ui/timeline/tray.slint
@@ -9,8 +9,8 @@ import { TimelineTool } from "model.slint";
// The timeline's tool tray.
//
-// The tool set: add-track first, then the three edit actions, then
-// snapping, then the tools a clip's sound and words need
+// The tool set: add-track first, then undo and redo, then the three edit
+// actions, then snapping, then the tools a clip's sound and words need
// - captions, a spoken title, detaching the sound - and the view controls
// pushed to the far end behind the timecode readout. The metrics: 40px
// tall, 4px between buttons, an 18px hairline with 4px of air on each side
@@ -30,6 +30,11 @@ import { TimelineTool } from "model.slint";
// greys out without saying why leaves you guessing at the rule:
// `merge-blocked-because` is accepted and becomes the button's label, which
// is its accessible name and where a tooltip reads from.
+//
+// Undo and redo are on the bar for whoever edits with a mouse or a finger
+// and never learns ⌘Z: the shortcut is in the tip, and the button greys
+// out when the history has nothing that way, the same truth the Edit menu
+// tells. https://github.com/jub0t/Concat/issues/154
component Divider inherits Rectangle {
width: 9px;
@@ -49,6 +54,10 @@ export component TimelineTray inherits Rectangle {
in property <bool> magnetic: false;
in property <bool> pan-mode: false;
in property <int> selected-count;
+ /// Whether the history has a step that way. Rust's answer, read from
+ /// the editor after every change, so the buttons never guess.
+ in property <bool> can-undo;
+ in property <bool> can-redo;
/// Empty when the selection can be merged; otherwise why it cannot.
in property <string> merge-blocked-because;
/// What the selection offers the sound and word tools. Each is one
@@ -62,6 +71,8 @@ export component TimelineTray inherits Rectangle {
callback snap-changed(snap: bool);
callback magnetic-changed(on: bool);
callback pan-changed(on: bool);
+ callback undo();
+ callback redo();
callback split();
callback merge();
callback delete-selected();
@@ -98,6 +109,23 @@ export component TimelineTray inherits Rectangle {
Divider { }
+ IconButton {
+ glyph: Glyph.undo;
+ label: I18n.t("Undo (⌘Z)");
+ icon-size: 16px;
+ enabled: root.can-undo;
+ clicked => { root.undo(); }
+ }
+ IconButton {
+ glyph: Glyph.redo;
+ label: I18n.t("Redo (⇧⌘Z)");
+ icon-size: 16px;
+ enabled: root.can-redo;
+ clicked => { root.redo(); }
+ }
+
+ Divider { }
+
// One way to cut: at the playhead. The razor that cut where you
// clicked is gone - two tools for one edit, and the playhead is
// already where you were looking.
diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slint
index be365503..8f15ad75 100644
--- a/src/crates/concat/ui/workspace/seat.slint
+++ b/src/crates/concat/ui/workspace/seat.slint
@@ -300,8 +300,11 @@ export component Seat inherits Rectangle {
clips: Editor.clips;
tool: Editor.tool;
snap: Editor.snap;
+ magnetic: Editor.magnetic;
pan-mode: Editor.pan-mode;
selected-count: Editor.selected-count;
+ can-undo: Editor.can-undo;
+ can-redo: Editor.can-redo;
merge-blocked-because: Editor.merge-blocked-because;
sound-selected: Editor.sound-selected;
title-selected: Editor.title-selected;
@@ -319,6 +322,8 @@ export component Seat inherits Rectangle {
snap-changed(snap) => { Editor.snap-changed(snap); }
magnetic-changed(on) => { Editor.magnetic-changed(on); }
pan-changed(on) => { Editor.pan-changed(on); }
+ undo => { Editor.undo(); }
+ redo => { Editor.redo(); }
split => { Editor.split(); }
merge => { Editor.merge(); }
delete-selected => { Editor.delete-selected(); }
diff --git a/src/crates/concat/ui/workspace/timeline-pane.slint b/src/crates/concat/ui/workspace/timeline-pane.slint
index 113d6a4f..ddc12783 100644
--- a/src/crates/concat/ui/workspace/timeline-pane.slint
+++ b/src/crates/concat/ui/workspace/timeline-pane.slint
@@ -36,8 +36,11 @@ export component TimelinePane inherits Rectangle {
// ── the tray ─────────────────────────────────────────────────────────
in property <TimelineTool> tool: TimelineTool.select;
in property <bool> snap: true;
+ in property <bool> magnetic: false;
in property <bool> pan-mode: false;
in property <int> selected-count;
+ in property <bool> can-undo;
+ in property <bool> can-redo;
in property <string> merge-blocked-because;
in property <bool> sound-selected;
in property <bool> title-selected;
@@ -46,6 +49,8 @@ export component TimelinePane inherits Rectangle {
callback snap-changed(snap: bool);
callback magnetic-changed(on: bool);
callback pan-changed(on: bool);
+ callback undo();
+ callback redo();
callback split();
callback merge();
callback delete-selected();
@@ -180,8 +185,11 @@ export component TimelinePane inherits Rectangle {
TimelineTray {
tool: root.tool;
snap: root.snap;
+ magnetic: root.magnetic;
pan-mode: root.pan-mode;
selected-count: root.selected-count;
+ can-undo: root.can-undo;
+ can-redo: root.can-redo;
merge-blocked-because: root.merge-blocked-because;
sound-selected: root.sound-selected;
title-selected: root.title-selected;
@@ -191,6 +199,8 @@ export component TimelinePane inherits Rectangle {
snap-changed(snap) => { root.snap-changed(snap); }
magnetic-changed(on) => { root.magnetic-changed(on); }
pan-changed(on) => { root.pan-changed(on); }
+ undo => { root.undo(); }
+ redo => { root.redo(); }
split => { root.split(); }
merge => { root.merge(); }
delete-selected => { root.delete-selected(); }