Skip to content

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

feat: apply caption style to all titles on its track

Konstantin Chuykova68641c3a9b2
diff --git a/src/crates/concat/locales/ar.json b/src/crates/concat/locales/ar.json
index 280382cd..8e634b8d 100644
--- a/src/crates/concat/locales/ar.json
+++ b/src/crates/concat/locales/ar.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "المعالج",
"sysinfo.renderer": "أداة التصيير",
"sysinfo.toolchain": "سلسلة الأدوات",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "الخلفية",
"textPanel.backgroundColor": "لون الخلفية",
"textPanel.backgroundOpacity": "عتامة الخلفية",
diff --git a/src/crates/concat/locales/bn.json b/src/crates/concat/locales/bn.json
index 04dfa05a..87073f5d 100644
--- a/src/crates/concat/locales/bn.json
+++ b/src/crates/concat/locales/bn.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "প্রসেসর",
"sysinfo.renderer": "রেন্ডারার",
"sysinfo.toolchain": "টুলচেইন",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "ব্যাকগ্রাউন্ড",
"textPanel.backgroundColor": "ব্যাকগ্রাউন্ডের রঙ",
"textPanel.backgroundOpacity": "ব্যাকগ্রাউন্ডের অস্বচ্ছতা",
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index cba8a259..14ec2d45 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Prozessor",
"sysinfo.renderer": "Renderer",
"sysinfo.toolchain": "Toolchain",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Hintergrund",
"textPanel.backgroundColor": "Hintergrundfarbe",
"textPanel.backgroundOpacity": "Hintergrund-Deckkraft",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 90e537d4..a68c5d3a 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Processor",
"sysinfo.renderer": "Renderer",
"sysinfo.toolchain": "Toolchain",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Background",
"textPanel.backgroundColor": "Background color",
"textPanel.backgroundOpacity": "Background opacity",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index 63767fcc..21ffa885 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Procesador",
"sysinfo.renderer": "Renderizador",
"sysinfo.toolchain": "Herramientas de compilación",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Fondo",
"textPanel.backgroundColor": "Color de fondo",
"textPanel.backgroundOpacity": "Opacidad del fondo",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index 68a7dbe5..43ab9a2d 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "پردازنده",
"sysinfo.renderer": "رندرر",
"sysinfo.toolchain": "زنجیره ابزار (Toolchain)",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "پس‌زمینه",
"textPanel.backgroundColor": "رنگ پس‌زمینه",
"textPanel.backgroundOpacity": "شفافیت پس‌زمینه",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 81e8b9b4..4dfaa437 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Processeur",
"sysinfo.renderer": "Moteur de rendu",
"sysinfo.toolchain": "Chaîne d'outils",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Arrière-plan",
"textPanel.backgroundColor": "Couleur d'arrière-plan",
"textPanel.backgroundOpacity": "Opacité de l'arrière-plan",
diff --git a/src/crates/concat/locales/he.json b/src/crates/concat/locales/he.json
index 4807cc5b..6efa0839 100644
--- a/src/crates/concat/locales/he.json
+++ b/src/crates/concat/locales/he.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "מעבד",
"sysinfo.renderer": "מרנדר",
"sysinfo.toolchain": "שרשרת כלים",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "רקע",
"textPanel.backgroundColor": "צבע רקע",
"textPanel.backgroundOpacity": "אטימות רקע",
diff --git a/src/crates/concat/locales/hi.json b/src/crates/concat/locales/hi.json
index ada8d920..39f57b2b 100644
--- a/src/crates/concat/locales/hi.json
+++ b/src/crates/concat/locales/hi.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "प्रोसेसर",
"sysinfo.renderer": "रेंडरर",
"sysinfo.toolchain": "टूलचेन",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "बैकग्राउंड",
"textPanel.backgroundColor": "बैकग्राउंड रंग",
"textPanel.backgroundOpacity": "बैकग्राउंड अपारदर्शिता",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index 9d7c7ad6..d1981c1f 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Procesor",
"sysinfo.renderer": "Renderer",
"sysinfo.toolchain": "Alatni lanac",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Pozadina",
"textPanel.backgroundColor": "Boja pozadine",
"textPanel.backgroundOpacity": "Neprozirnost pozadine",
diff --git a/src/crates/concat/locales/id.json b/src/crates/concat/locales/id.json
index 66e0d6b8..d5b0a110 100644
--- a/src/crates/concat/locales/id.json
+++ b/src/crates/concat/locales/id.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Prosesor",
"sysinfo.renderer": "Perender",
"sysinfo.toolchain": "Rantai alat",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Latar belakang",
"textPanel.backgroundColor": "Warna latar belakang",
"textPanel.backgroundOpacity": "Opasitas latar belakang",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index 505dc54d..c422a338 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Processore",
"sysinfo.renderer": "Renderer",
"sysinfo.toolchain": "Toolchain",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Sfondo",
"textPanel.backgroundColor": "Colore dello sfondo",
"textPanel.backgroundOpacity": "Opacità dello sfondo",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 143c2be5..f35b342d 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "プロセッサ",
"sysinfo.renderer": "レンダラー",
"sysinfo.toolchain": "ツールチェーン",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "背景",
"textPanel.backgroundColor": "背景色",
"textPanel.backgroundOpacity": "背景の不透明度",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index 5c837598..53db2f34 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "프로세서",
"sysinfo.renderer": "렌더러",
"sysinfo.toolchain": "툴체인",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "배경",
"textPanel.backgroundColor": "배경 색상",
"textPanel.backgroundOpacity": "배경 불투명도",
diff --git a/src/crates/concat/locales/nl.json b/src/crates/concat/locales/nl.json
index bc1a7f68..6c2627e6 100644
--- a/src/crates/concat/locales/nl.json
+++ b/src/crates/concat/locales/nl.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Processor",
"sysinfo.renderer": "Renderer",
"sysinfo.toolchain": "Toolchain",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Achtergrond",
"textPanel.backgroundColor": "Achtergrondkleur",
"textPanel.backgroundOpacity": "Achtergronddekking",
diff --git a/src/crates/concat/locales/pl.json b/src/crates/concat/locales/pl.json
index dde6b33c..824f6a70 100644
--- a/src/crates/concat/locales/pl.json
+++ b/src/crates/concat/locales/pl.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Procesor",
"sysinfo.renderer": "Moduł renderujący",
"sysinfo.toolchain": "Narzędzia kompilacji",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Tło",
"textPanel.backgroundColor": "Kolor tła",
"textPanel.backgroundOpacity": "Krycie tła",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index 4dde6bad..da16e740 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Processador",
"sysinfo.renderer": "Renderizador",
"sysinfo.toolchain": "Toolchain",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Fundo",
"textPanel.backgroundColor": "Cor do fundo",
"textPanel.backgroundOpacity": "Opacidade do fundo",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index ea772f1f..652e052a 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Процессор",
"sysinfo.renderer": "Рендерер",
"sysinfo.toolchain": "Инструментарий",
+ "textPanel.applyToAll": "Применить ко всем",
+ "textPanel.applyToAllHint": "Применить стиль и положение ко всем текстовым клипам этой дорожки.",
"textPanel.background": "Фон",
"textPanel.backgroundColor": "Цвет фона",
"textPanel.backgroundOpacity": "Непрозрачность фона",
diff --git a/src/crates/concat/locales/th.json b/src/crates/concat/locales/th.json
index e1548c41..8cdf3ecb 100644
--- a/src/crates/concat/locales/th.json
+++ b/src/crates/concat/locales/th.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "โปรเซสเซอร์",
"sysinfo.renderer": "ตัวเรนเดอร์",
"sysinfo.toolchain": "ทูลเชน",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "พื้นหลัง",
"textPanel.backgroundColor": "สีพื้นหลัง",
"textPanel.backgroundOpacity": "ความทึบพื้นหลัง",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index e25ba27e..505b430b 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "İşlemci",
"sysinfo.renderer": "İşleyici",
"sysinfo.toolchain": "Araç zinciri",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Arka plan",
"textPanel.backgroundColor": "Arka plan rengi",
"textPanel.backgroundOpacity": "Arka plan opaklığı",
diff --git a/src/crates/concat/locales/uk.json b/src/crates/concat/locales/uk.json
index 69d6ff12..e9527094 100644
--- a/src/crates/concat/locales/uk.json
+++ b/src/crates/concat/locales/uk.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Процесор",
"sysinfo.renderer": "Рендерер",
"sysinfo.toolchain": "Інструментарій",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Фон",
"textPanel.backgroundColor": "Колір фону",
"textPanel.backgroundOpacity": "Непрозорість фону",
diff --git a/src/crates/concat/locales/ur.json b/src/crates/concat/locales/ur.json
index 102267f9..e4805dc6 100644
--- a/src/crates/concat/locales/ur.json
+++ b/src/crates/concat/locales/ur.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "پروسیسر",
"sysinfo.renderer": "رینڈرر",
"sysinfo.toolchain": "ٹول چین",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "پس منظر",
"textPanel.backgroundColor": "پس منظر کا رنگ",
"textPanel.backgroundOpacity": "پس منظر کا دھندلاپن",
diff --git a/src/crates/concat/locales/vi.json b/src/crates/concat/locales/vi.json
index 266e6e96..5238b66f 100644
--- a/src/crates/concat/locales/vi.json
+++ b/src/crates/concat/locales/vi.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "Bộ xử lý",
"sysinfo.renderer": "Bộ kết xuất",
"sysinfo.toolchain": "Bộ công cụ biên dịch",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Nền",
"textPanel.backgroundColor": "Màu nền",
"textPanel.backgroundOpacity": "Độ mờ nền",
diff --git a/src/crates/concat/locales/vn.json b/src/crates/concat/locales/vn.json
index 2ea54e99..de335870 100644
--- a/src/crates/concat/locales/vn.json
+++ b/src/crates/concat/locales/vn.json
@@ -941,6 +941,8 @@
"sysinfo.processor": "Bộ xử lý",
"sysinfo.renderer": "Bộ kết xuất",
"sysinfo.toolchain": "Bộ công cụ biên dịch",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "Nền",
"textPanel.backgroundColor": "Màu nền",
"textPanel.backgroundOpacity": "Độ mờ nền",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index e1501c7c..2d4afd8b 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "处理器",
"sysinfo.renderer": "渲染器",
"sysinfo.toolchain": "工具链",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "背景",
"textPanel.backgroundColor": "背景颜色",
"textPanel.backgroundOpacity": "背景不透明度",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 50d081db..129de355 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -952,6 +952,8 @@
"sysinfo.processor": "處理器",
"sysinfo.renderer": "渲染器",
"sysinfo.toolchain": "工具鏈",
+ "textPanel.applyToAll": "Apply to all",
+ "textPanel.applyToAllHint": "Apply this style and position to every title on this track.",
"textPanel.background": "背景",
"textPanel.backgroundColor": "背景顏色",
"textPanel.backgroundOpacity": "背景不透明度",
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index b25914f5..3abe5cc5 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -752,6 +752,9 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::
});
// Font files, the way media files come in: the system's picker, and
// the answer later, on the window's thread.
+ editor.on_text_style_apply_all(on_window!(|state| {
+ state.apply_title_style_to_track();
+ }));
editor.on_text_style_default(on_window!(|state| {
state.use_title_style_for_new();
}));
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 70656cdb..48857a37 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -1342,6 +1342,47 @@ fn command_name(command: &Command) -> String {
.collect()
}
+/// The selected title's look on the other titles of its lane. Words and
+/// timing stay each title's own. Position is the value shown in the inspector;
+/// old position keys are removed so they cannot override the copied placement.
+fn title_style_commands(timeline: &Timeline, source_id: &str, playhead: f32) -> Vec<Command> {
+ let Some(source) = timeline
+ .clip(source_id)
+ .filter(|clip| clip.kind == model::ClipKind::Text)
+ else {
+ return Vec::new();
+ };
+ let Some(style) = &source.text else {
+ return Vec::new();
+ };
+ let at = place_in(source, playhead);
+ let mut commands = Vec::new();
+ for clip in &timeline.clips {
+ if clip.id == source.id
+ || clip.track_id != source.track_id
+ || clip.kind != model::ClipKind::Text
+ {
+ continue;
+ }
+ let mut after = clip.as_ref().clone();
+ let content = clip.text.clone().unwrap_or_default().content;
+ after.text = Some(TextStyle {
+ content,
+ ..style.clone()
+ });
+ after.offset_x = shown(source, model::KeyProperty::OffsetX, at);
+ after.offset_y = shown(source, model::KeyProperty::OffsetY, at);
+ after.keys.retain(|key| {
+ !matches!(
+ key.property,
+ model::KeyProperty::OffsetX | model::KeyProperty::OffsetY
+ )
+ });
+ commands.extend(clip_commands(&clip.id, clip, &after));
+ }
+ commands
+}
+
/// The commands that turn `before` into `after`, clip `id` as the echo
/// left it against the document's: a transform, a cutout, a speed, the
/// keys, and one patch for everything else that differs. Empty when
@@ -4952,6 +4993,29 @@ impl Studio {
self.notify(&t("textPanel.newTitlesUseThisStyle"), false);
}
+ /// Applies one title's current look to the other titles on its unlocked
+ /// lane, as one undoable edit. Land the last inspector gesture first so
+ /// a click straight after changing a control uses the latest look.
+ pub fn apply_title_style_to_track(&mut self) {
+ self.flush_commit();
+ // The content field writes the echo before requesting a commit on
+ // blur. A button click need not move focus, so land that edit too.
+ self.commit_now();
+ let Some(id) = self.sole_selection() else {
+ return;
+ };
+ let Some(clip) = self.clip(&id) else {
+ return;
+ };
+ if self.locked(&clip.track_id) {
+ return;
+ }
+ let commands = title_style_commands(self.timeline(), &id, self.playhead);
+ if !commands.is_empty() {
+ self.apply(Command::Batch { commands });
+ }
+ }
+
/// The inspector's gesture is over: what differs between the echo and
/// the session becomes commands, as one batch.
/// An inspector control changed something on the echo and wants it
@@ -10535,6 +10599,150 @@ mod tests {
wheel_partners, write_keyable,
};
+ /// Applying a caption's look changes only its lane's other titles,
+ /// preserves their words and timing, and undoes as one edit.
+ #[test]
+ fn a_title_style_applies_to_its_lane_and_undoes_together() {
+ use concat_project::Editor;
+ use concat_project::model::{TextAlign, TextStyle};
+ let mut editor = Editor::new();
+ let style = TextStyle {
+ content: "First caption".into(),
+ font_family: "Hanken Grotesk".into(),
+ font_size: 0.05,
+ font_weight: 600.0,
+ italic: true,
+ color: "#ffcc00".into(),
+ align: TextAlign::Left,
+ opacity: 0.8,
+ stroke_width: 0.003,
+ stroke_color: "#112233aa".into(),
+ shadow: false,
+ background: "#000000aa".into(),
+ background_radius: 0.01,
+ background_padding_x: 0.02,
+ background_padding_y: 0.01,
+ line_height: 1.4,
+ tracking: 0.002,
+ max_width: 0.8,
+ max_height: 0.2,
+ };
+ let mut add = |track: &str, start, style| {
+ editor
+ .apply(Command::AddTextClip {
+ track_id: Some(track.into()),
+ above: false,
+ start,
+ style: Some(style),
+ duration: Some(2.0),
+ offset_y: Some(0.3),
+ })
+ .unwrap()
+ .created_id
+ .unwrap()
+ };
+ let source = add("T2", 0.0, style.clone());
+ let target = add(
+ "T2",
+ 3.0,
+ TextStyle {
+ content: "Second caption".into(),
+ ..TextStyle::default()
+ },
+ );
+ let third = add(
+ "T2",
+ 6.0,
+ TextStyle {
+ content: "Third caption".into(),
+ ..TextStyle::default()
+ },
+ );
+ let other = add(
+ "T1",
+ 6.0,
+ TextStyle {
+ content: "Separate heading".into(),
+ ..TextStyle::default()
+ },
+ );
+ editor
+ .apply(Command::SetClipTransform {
+ clip_id: source.clone(),
+ scale: None,
+ offset_x: Some(0.1),
+ offset_y: Some(-0.25),
+ rotation: None,
+ stretch_x: None,
+ stretch_y: None,
+ })
+ .unwrap();
+ // Position keys on the recipient must not override the copied
+ // placement; unrelated animation stays the recipient's own.
+ for (property, value) in [
+ (super::model::KeyProperty::OffsetY, 0.4),
+ (super::model::KeyProperty::Opacity, 0.6),
+ ] {
+ editor
+ .apply(Command::SetClipKey {
+ clip_id: target.clone(),
+ property,
+ at: 0.0,
+ value,
+ ease: super::model::KeyEase::LINEAR,
+ })
+ .unwrap();
+ }
+ for (at, value) in [(0.0, 0.1), (1.0, 0.3)] {
+ editor
+ .apply(Command::SetClipKey {
+ clip_id: source.clone(),
+ property: super::model::KeyProperty::OffsetX,
+ at,
+ value,
+ ease: super::model::KeyEase::LINEAR,
+ })
+ .unwrap();
+ }
+ let before = editor.project().clone();
+ let commands = super::title_style_commands(before.active(), &source, 1.0);
+ assert!(!commands.is_empty());
+ editor.apply(Command::Batch { commands }).unwrap();
+ let after = editor.project().clone();
+ let caption = after.active().clip(&target).unwrap();
+ assert_eq!(
+ caption.text,
+ Some(TextStyle {
+ content: "Second caption".into(),
+ ..style.clone()
+ })
+ );
+ assert_eq!(
+ after.active().clip(&third).unwrap().text,
+ Some(TextStyle {
+ content: "Third caption".into(),
+ ..style
+ })
+ );
+ assert_eq!((caption.start, caption.duration), (3.0, 2.0));
+ assert!((caption.offset_x - 0.2).abs() < 1e-9);
+ assert_eq!(caption.offset_y, -0.25);
+ assert!(!caption.is_keyed(super::model::KeyProperty::OffsetY));
+ assert_eq!(
+ caption.value_at(super::model::KeyProperty::Opacity, 0.0),
+ 0.6
+ );
+
+ assert_eq!(after.active().clip(&source), before.active().clip(&source));
+ assert_eq!(after.active().clip(&other), before.active().clip(&other));
+ assert!(super::title_style_commands(after.active(), &source, 1.0).is_empty());
+ assert!(editor.undo());
+ assert_eq!(editor.project(), &before);
+ assert!(editor.redo());
+ assert_eq!(editor.project(), &after);
+ assert!(super::title_style_commands(after.active(), "missing", 0.0).is_empty());
+ }
+
/// A pasted group keeps its shape from `base` on, its rows shifted
/// and held inside the lanes it lands in, a locked row passed over
/// for the nearest open one; with no lane at all nothing lands.
diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slint
index 468fc6e9..7c1afdf5 100644
--- a/src/crates/concat/ui/editor.slint
+++ b/src/crates/concat/ui/editor.slint
@@ -158,6 +158,7 @@ export global Editor {
/// The Text tab's "Use for new titles": the selected title's look
/// becomes the one new titles and captions start from.
callback text-style-default();
+ callback text-style-apply-all();
// The effect catalogue's shelves, published once, and the selected
// clip's two chains with a row per parameter. See PresetStack.
diff --git a/src/crates/concat/ui/inspector/text-panel.slint b/src/crates/concat/ui/inspector/text-panel.slint
index fc431ed5..88f6d025 100644
--- a/src/crates/concat/ui/inspector/text-panel.slint
+++ b/src/crates/concat/ui/inspector/text-panel.slint
@@ -46,6 +46,8 @@ export component TextPanel inherits VerticalLayout {
callback import-font();
/// Keep this title's look for new titles and captions.
callback set-default();
+ /// Copy this title's look to all other titles on its lane.
+ callback apply-all();
/// Several titles selected together: every knob writes to all of them
/// and the words, each title's own, are not offered.
@@ -167,6 +169,24 @@ export component TextPanel inherits VerticalLayout {
}
}
+ if !root.batch: SectionBody {
+ padding-left: Theme.pad;
+ padding-right: Theme.pad;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ Button {
+ label: I18n.t("textPanel.applyToAll");
+ ghost: true;
+ clicked => { root.apply-all(); }
+ }
+ Text {
+ text: I18n.t("textPanel.applyToAllHint");
+ color: Theme.fg-muted;
+ font-size: Theme.fs;
+ wrap: word-wrap;
+ }
+ }
+
// ── content ──────────────────────────────────────────────────────────
if !root.batch: Section {
first: true;
diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slint
index d9f6098b..c3a82e23 100644
--- a/src/crates/concat/ui/phone/editor.slint
+++ b/src/crates/concat/ui/phone/editor.slint
@@ -1102,6 +1102,7 @@ export component PhoneEditor inherits Rectangle {
commit => { Editor.clip-commit(); }
import-font => { Editor.import-font(); }
set-default => { Editor.text-style-default(); }
+ apply-all => { Editor.text-style-apply-all(); }
}
if root.sheet == "clip-layer": FilterPanel {
diff --git a/src/crates/concat/ui/workspace/config-pane.slint b/src/crates/concat/ui/workspace/config-pane.slint
index 68123885..2e8b1e31 100644
--- a/src/crates/concat/ui/workspace/config-pane.slint
+++ b/src/crates/concat/ui/workspace/config-pane.slint
@@ -192,6 +192,7 @@ export component ConfigPane inherits Rectangle {
in property <[string]> font-families;
callback import-font();
callback text-style-default();
+ callback text-style-apply-all();
/// The cutout's brush and controls; see Editor.
in property <int> brush-tool;
@@ -674,6 +675,7 @@ export component ConfigPane inherits Rectangle {
commit => { root.clip-commit(); }
import-font => { root.import-font(); }
set-default => { root.text-style-default(); }
+ apply-all => { root.text-style-apply-all(); }
}
// Audio: the level and fades, then the voice and room chain
diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slint
index 3ef91fdf..778cb7ad 100644
--- a/src/crates/concat/ui/workspace/seat.slint
+++ b/src/crates/concat/ui/workspace/seat.slint
@@ -294,6 +294,7 @@ export component Seat inherits Rectangle {
font-families: Editor.font-families;
import-font => { Editor.import-font(); }
text-style-default => { Editor.text-style-default(); }
+ text-style-apply-all => { Editor.text-style-apply-all(); }
}
// Declared before the views, so anything inside one of them that takes