Skip to content

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

feat(text): the Text tab remade, with a colour picker worth the name

Jareer5329c781f934
diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.json
index eee381f7..53aaecbf 100644
--- a/src/crates/concat/locales/de.json
+++ b/src/crates/concat/locales/de.json
@@ -127,7 +127,6 @@
"Default title": "Standardtitel",
"Delay": "Verzögerung",
"Delete": "Löschen",
- "Max width": "Maximale Breite",
"Generate Captions": "Untertitel erzeugen",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "weiblich",
"Fetching the model… {0}%": "Modell wird geladen… {0}%",
"File": "Datei",
- "Fill": "Füllung",
"Film Grain": "Filmkorn",
"Filter": "Filter",
"filter": "Filter",
@@ -360,7 +358,6 @@
"Pixelate": "Verpixeln",
"Placement": "Platzierung",
"Plate": "Platte",
- "Plate colour": "Plattenfarbe",
"Play": "Wiedergabe",
"Portuguese": "Portugiesisch",
"Position": "Position",
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index e1e97cd0..99b38a52 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -242,7 +242,6 @@
"female": "female",
"Fetching the model… {0}%": "Fetching the model… {0}%",
"File": "File",
- "Fill": "Fill",
"Film": "Film",
"Film Grain": "Film Grain",
"Filter": "Filter",
@@ -261,6 +260,7 @@
"Flip vertical": "Flip vertical",
"Folder": "Folder",
"Font": "Font",
+ "Font Weight": "Font Weight",
"For mainland China": "For mainland China",
"Format": "Format",
"Frame": "Frame",
@@ -372,7 +372,6 @@
"Master": "Master",
"Matcha": "Matcha",
"Matte": "Matte",
- "Max width": "Max width",
"Media": "Media",
"Medium": "Medium",
"Midnight": "Midnight",
@@ -464,7 +463,7 @@
"Pixelate": "Pixelate",
"Placement": "Placement",
"Plate": "Plate",
- "Plate colour": "Plate colour",
+ "Plate color": "Plate color",
"Play": "Play",
"Playhead": "Playhead",
"Plays everywhere": "Plays everywhere",
@@ -612,6 +611,7 @@
"Stone and height: reflections that take a while to arrive.": "Stone and height: reflections that take a while to arrive.",
"Stop at the end of the content": "Stop at the end of the content",
"Strength": "Strength",
+ "Stroke": "Stroke",
"Stylised": "Stylised",
"Stylize": "Stylize",
"Subject": "Subject",
@@ -629,6 +629,7 @@
"Temperature": "Temperature",
"Templates": "Templates",
"Text": "Text",
+ "Text Align": "Text Align",
"Text to Speech": "Text to Speech",
"Text to speech": "Text to speech",
"Text to speech…": "Text to speech…",
@@ -676,6 +677,7 @@
"Treble": "Treble",
"Type the narration to read aloud…": "Type the narration to read aloud…",
"Type the words to put on screen…": "Type the words to put on screen…",
+ "Typography": "Typography",
"Umber": "Umber",
"Undo": "Undo",
"Unlock lane": "Unlock lane",
diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.json
index 872f55c8..f87ace7b 100644
--- a/src/crates/concat/locales/es.json
+++ b/src/crates/concat/locales/es.json
@@ -127,7 +127,6 @@
"Default title": "Título predeterminado",
"Delay": "Retardo",
"Delete": "Eliminar",
- "Max width": "Ancho máximo",
"Generate Captions": "Generar subtítulos",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "femenina",
"Fetching the model… {0}%": "Descargando el modelo… {0}%",
"File": "Archivo",
- "Fill": "Relleno",
"Film Grain": "Grano de película",
"Filter": "Filtro",
"filter": "filtro",
@@ -360,7 +358,6 @@
"Pixelate": "Pixelar",
"Placement": "Posición",
"Plate": "Placa",
- "Plate colour": "Color de la placa",
"Play": "Reproducir",
"Portuguese": "Portugués",
"Position": "Posición",
diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.json
index d049dc0e..d3006f15 100644
--- a/src/crates/concat/locales/fa.json
+++ b/src/crates/concat/locales/fa.json
@@ -241,7 +241,6 @@
"female": "زن",
"Fetching the model… {0}%": "در حال دریافت مدل… {0}%",
"File": "فایل",
- "Fill": "پر کردن",
"Film": "فیلم",
"Film Grain": "دانه‌بندی فیلم",
"Filter": "فیلتر",
@@ -368,7 +367,6 @@
"Master": "اصلی (Master)",
"Matcha": "ماچا",
"Matte": "مات (Matte)",
- "Max width": "حداکثر عرض",
"Media": "رسانه",
"Medium": "متوسط",
"Midnight": "نیمه‌شب",
@@ -459,7 +457,6 @@
"Pixelate": "پیکسلی کردن",
"Placement": "جای‌گذاری",
"Plate": "پس‌زمینه نواری",
- "Plate colour": "رنگ Plate",
"Play": "پخش",
"Playhead": "نشانگر پخش",
"Plays everywhere": "همه‌جا قابل پخش است",
diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.json
index 103fc6e9..723c7c95 100644
--- a/src/crates/concat/locales/fr.json
+++ b/src/crates/concat/locales/fr.json
@@ -127,7 +127,6 @@
"Default title": "Titre par défaut",
"Delay": "Délai",
"Delete": "Supprimer",
- "Max width": "Largeur maximale",
"Generate Captions": "Générer les sous-titres",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "féminine",
"Fetching the model… {0}%": "Téléchargement du modèle… {0}%",
"File": "Fichier",
- "Fill": "Remplissage",
"Film Grain": "Grain de film",
"Filter": "Filtre",
"filter": "filtre",
@@ -360,7 +358,6 @@
"Pixelate": "Pixeliser",
"Placement": "Position",
"Plate": "Cartouche",
- "Plate colour": "Couleur du cartouche",
"Play": "Lecture",
"Portuguese": "Portugais",
"Position": "Position",
diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.json
index 72a67500..ad5385ab 100644
--- a/src/crates/concat/locales/hr.json
+++ b/src/crates/concat/locales/hr.json
@@ -160,7 +160,6 @@
"Default title": "Zadani naslov",
"Delay": "Kašnjenje",
"Delete": "Obriši",
- "Max width": "Najveća širina",
"Generate Captions": "Generiraj titlove",
"Enable flip and reverse shortcuts": "Omogući prečake za okretanje i obrtanje",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H okrene odabrani klip vodoravno, J okomito, R obrne smjer. Isključeno, tipke ne rade.",
@@ -248,7 +247,6 @@
"female": "ženski",
"Fetching the model… {0}%": "Dohvaćanje modela… {0}%",
"File": "Datoteka",
- "Fill": "Ispuna",
"Film": "Film",
"Film Grain": "Filmsko zrno",
"Filter": "Filtar",
@@ -449,7 +447,6 @@
"Pixelate": "Pikseliziraj",
"Placement": "Smještaj",
"Plate": "Ploča",
- "Plate colour": "Boja ploče",
"Play": "Reprodukcija",
"Playhead": "Playhead",
"Polaroid": "Polaroid",
diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.json
index 02952dc6..a3d4a92f 100644
--- a/src/crates/concat/locales/it.json
+++ b/src/crates/concat/locales/it.json
@@ -127,7 +127,6 @@
"Default title": "Titolo predefinito",
"Delay": "Ritardo",
"Delete": "Elimina",
- "Max width": "Larghezza massima",
"Generate Captions": "Genera sottotitoli",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "femminile",
"Fetching the model… {0}%": "Scaricamento del modello… {0}%",
"File": "File",
- "Fill": "Riempimento",
"Film Grain": "Grana pellicola",
"Filter": "Filtro",
"filter": "filtro",
@@ -360,7 +358,6 @@
"Pixelate": "Pixel",
"Placement": "Posizione",
"Plate": "Targa",
- "Plate colour": "Colore della targa",
"Play": "Riproduci",
"Portuguese": "Portoghese",
"Position": "Posizione",
diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.json
index 3dbe4f3a..fef7a11f 100644
--- a/src/crates/concat/locales/ja.json
+++ b/src/crates/concat/locales/ja.json
@@ -127,7 +127,6 @@
"Default title": "デフォルトのタイトル",
"Delay": "ディレイ",
"Delete": "削除",
- "Max width": "最大幅",
"Generate Captions": "字幕を生成",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "女性",
"Fetching the model… {0}%": "モデルを取得中… {0}%",
"File": "ファイル",
- "Fill": "塗り",
"Film Grain": "フィルムグレイン",
"Filter": "フィルター",
"filter": "フィルター",
@@ -360,7 +358,6 @@
"Pixelate": "モザイク",
"Placement": "配置",
"Plate": "プレート",
- "Plate colour": "プレートの色",
"Play": "再生",
"Portuguese": "ポルトガル語",
"Position": "位置",
diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.json
index 0f23732a..f9a7851a 100644
--- a/src/crates/concat/locales/ko.json
+++ b/src/crates/concat/locales/ko.json
@@ -127,7 +127,6 @@
"Default title": "기본 자막",
"Delay": "지연",
"Delete": "삭제",
- "Max width": "최대 너비",
"Generate Captions": "자막 생성",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "여성",
"Fetching the model… {0}%": "모델 가져오는 중… {0}%",
"File": "파일",
- "Fill": "채우기",
"Film Grain": "필름 그레인",
"Filter": "필터",
"filter": "필터",
@@ -360,7 +358,6 @@
"Pixelate": "픽셀화",
"Placement": "배치",
"Plate": "판",
- "Plate colour": "판 색상",
"Play": "재생",
"Portuguese": "포르투갈어",
"Position": "위치",
diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.json
index f220a2c6..1c5e2abc 100644
--- a/src/crates/concat/locales/pt-BR.json
+++ b/src/crates/concat/locales/pt-BR.json
@@ -127,7 +127,6 @@
"Default title": "Título padrão",
"Delay": "Atraso",
"Delete": "Excluir",
- "Max width": "Largura máxima",
"Generate Captions": "Gerar legendas",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "feminina",
"Fetching the model… {0}%": "Baixando o modelo… {0}%",
"File": "Arquivo",
- "Fill": "Preenchimento",
"Film Grain": "Granulação de filme",
"Filter": "Filtro",
"filter": "filtro",
@@ -360,7 +358,6 @@
"Pixelate": "Pixelizar",
"Placement": "Posição",
"Plate": "Placa",
- "Plate colour": "Cor da placa",
"Play": "Reproduzir",
"Portuguese": "Português",
"Position": "Posição",
diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.json
index 2926ed53..1b6884ac 100644
--- a/src/crates/concat/locales/ru.json
+++ b/src/crates/concat/locales/ru.json
@@ -127,7 +127,6 @@
"Default title": "Титр по умолчанию",
"Delay": "Задержка",
"Delete": "Удалить",
- "Max width": "Максимальная ширина",
"Generate Captions": "Создать субтитры",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "женский",
"Fetching the model… {0}%": "Загрузка модели… {0}%",
"File": "Файл",
- "Fill": "Заливка",
"Film Grain": "Зерно плёнки",
"Filter": "Фильтр",
"filter": "фильтр",
@@ -360,7 +358,6 @@
"Pixelate": "Пикселизация",
"Placement": "Расположение",
"Plate": "Плашка",
- "Plate colour": "Цвет плашки",
"Play": "Воспроизвести",
"Portuguese": "Португальский",
"Position": "Положение",
diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.json
index 50013ca9..f5d97dde 100644
--- a/src/crates/concat/locales/tr.json
+++ b/src/crates/concat/locales/tr.json
@@ -127,7 +127,6 @@
"Default title": "Varsayılan yazı",
"Delay": "Gecikme",
"Delete": "Sil",
- "Max width": "En fazla genişlik",
"Generate Captions": "Altyazı oluştur",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "kadın",
"Fetching the model… {0}%": "Model indiriliyor… {0}%",
"File": "Dosya",
- "Fill": "Dolgu",
"Film Grain": "Film greni",
"Filter": "Filtre",
"filter": "filtre",
@@ -360,7 +358,6 @@
"Pixelate": "Pikselleştir",
"Placement": "Yerleşim",
"Plate": "Plaka",
- "Plate colour": "Plaka rengi",
"Play": "Oynat",
"Portuguese": "Portekizce",
"Position": "Konum",
diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.json
index ffe1a390..b94f9f70 100644
--- a/src/crates/concat/locales/zh-Hans.json
+++ b/src/crates/concat/locales/zh-Hans.json
@@ -127,7 +127,6 @@
"Default title": "默认字幕",
"Delay": "延迟",
"Delete": "删除",
- "Max width": "最大宽度",
"Generate Captions": "生成字幕",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -201,7 +200,6 @@
"female": "女声",
"Fetching the model… {0}%": "正在获取模型… {0}%",
"File": "文件",
- "Fill": "填充",
"Film Grain": "胶片颗粒",
"Filter": "滤镜",
"filter": "滤镜",
@@ -360,7 +358,6 @@
"Pixelate": "像素化",
"Placement": "位置",
"Plate": "底板",
- "Plate colour": "底板颜色",
"Play": "播放",
"Portuguese": "葡萄牙语",
"Position": "位置",
diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.json
index 0f3a9f53..bb796acf 100644
--- a/src/crates/concat/locales/zh-TW.json
+++ b/src/crates/concat/locales/zh-TW.json
@@ -160,7 +160,6 @@
"Default title": "預設標題",
"Delay": "延遲時間",
"Delete": "刪除",
- "Max width": "最大寬度",
"Generate Captions": "產生字幕",
"Enable flip and reverse shortcuts": "Enable flip and reverse shortcuts",
"H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.": "H flips the selected clip horizontally, J vertically, R reverses it. Off, the keys do nothing.",
@@ -248,7 +247,6 @@
"female": "女聲",
"Fetching the model… {0}%": "正在下載模型… {0}%",
"File": "檔案",
- "Fill": "填色",
"Film": "底片",
"Film Grain": "底片顆粒",
"Filter": "濾鏡",
@@ -449,7 +447,6 @@
"Pixelate": "像素化",
"Placement": "位置",
"Plate": "Plate",
- "Plate colour": "背景色彩",
"Play": "播放",
"Playhead": "播放頭",
"Polaroid": "拍立得",
diff --git a/src/crates/concat/src/format.rs b/src/crates/concat/src/format.rs
index 47be38a9..4711ad28 100644
--- a/src/crates/concat/src/format.rs
+++ b/src/crates/concat/src/format.rs
@@ -253,6 +253,40 @@ pub fn colour_of(hex: &str) -> slint::Color {
}
}
+/// What a person types into a colour field: `#rgb`, `#rgba`, `#rrggbb` or
+/// `#rrggbbaa`, the hash optional, case ignored. `None` for anything else,
+/// so the field can keep what it had rather than go black.
+pub fn parse_colour(text: &str) -> Option<slint::Color> {
+ let digits = text.trim().trim_start_matches('#');
+ if !digits.chars().all(|c| c.is_ascii_hexdigit()) {
+ return None;
+ }
+ let nibble = |at: usize| u8::from_str_radix(digits.get(at..at + 1)?, 16).ok();
+ let byte = |at: usize| u8::from_str_radix(digits.get(at..at + 2)?, 16).ok();
+ match digits.len() {
+ 3 | 4 => {
+ let wide = |at: usize| nibble(at).map(|n| n * 17);
+ let alpha = if digits.len() == 4 { wide(3)? } else { 255 };
+ Some(slint::Color::from_argb_u8(
+ alpha,
+ wide(0)?,
+ wide(1)?,
+ wide(2)?,
+ ))
+ }
+ 6 | 8 => {
+ let alpha = if digits.len() == 8 { byte(6)? } else { 255 };
+ Some(slint::Color::from_argb_u8(
+ alpha,
+ byte(0)?,
+ byte(2)?,
+ byte(4)?,
+ ))
+ }
+ _ => None,
+ }
+}
+
/// "#rrggbb" when opaque, else "#rrggbbaa" - at zero too. For a colour
/// whose alpha is a dial of its own, like a stroke's: an opacity turned
/// down to nothing must not take the colour with it, or turning it back
@@ -287,6 +321,37 @@ mod tests {
assert_eq!(hex_with_alpha(colour_of("#000000cc")), "#000000cc");
}
+ #[test]
+ fn a_typed_colour_is_read_in_every_length_and_refused_otherwise() {
+ let lime = slint::Color::from_rgb_u8(0xcb, 0xf5, 0x3f);
+ assert_eq!(parse_colour("#cbf53f"), Some(lime));
+ assert_eq!(parse_colour("CBF53F"), Some(lime));
+ assert_eq!(parse_colour(" #cbf53f "), Some(lime));
+ assert_eq!(
+ parse_colour("#fff"),
+ Some(slint::Color::from_rgb_u8(255, 255, 255))
+ );
+ assert_eq!(
+ parse_colour("#f008"),
+ Some(slint::Color::from_argb_u8(0x88, 255, 0, 0))
+ );
+ assert_eq!(
+ parse_colour("#00000000"),
+ Some(slint::Color::from_argb_u8(0, 0, 0, 0))
+ );
+ for junk in [
+ "", "#", "#12", "#12345", "#1234567", "#ggg", "red", "#cbf53f9",
+ ] {
+ assert_eq!(parse_colour(junk), None, "{junk:?}");
+ }
+ // A stroke at zero opacity keeps its colour spelled.
+ assert_eq!(
+ hex_rgba(slint::Color::from_argb_u8(0, 0xcb, 0xf5, 0x3f)),
+ "#cbf53f00"
+ );
+ assert_eq!(hex_rgba(lime), "#cbf53f");
+ }
+
#[test]
fn a_waveform_has_one_column_per_slot_and_follows_the_gain() {
let peaks = concat_media::Pyramid::of(concat_media::Peaks {
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index e4ea1454..13040cae 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -1222,6 +1222,15 @@ pub fn run() -> Result<(), slint::PlatformError> {
app.global::<Fmt>()
.on_parse_timecode(|text| format::parse_timecode(text.as_str()));
app.global::<Fmt>().on_tick_interval(format::tick_interval);
+ app.global::<Fmt>().on_hex_of(|value, with_alpha| {
+ if with_alpha {
+ format::hex_rgba(value).into()
+ } else {
+ format::hex_of(value).into()
+ }
+ });
+ app.global::<Fmt>()
+ .on_color_of(|text, fallback| format::parse_colour(text.as_str()).unwrap_or(fallback));
app.global::<Fmt>()
.on_parse_frames(|text, rate| format::parse_frames(text.as_str(), rate));
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 2848f8a1..932290ae 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -5342,6 +5342,8 @@ impl Studio {
});
SelectedClipData {
present: true,
+ frame_width: self.output_size().0 as i32,
+ frame_height: self.output_size().1 as i32,
id: clip.id.as_str().into(),
name: clip.name.as_str().into(),
kind: kind_of(clip),
diff --git a/src/crates/concat/ui/inspector/controls.slint b/src/crates/concat/ui/inspector/controls.slint
index 86dc0869..2a3c1034 100644
--- a/src/crates/concat/ui/inspector/controls.slint
+++ b/src/crates/concat/ui/inspector/controls.slint
@@ -6,6 +6,7 @@ import { Theme } from "../theme/theme.slint";
import { Fmt } from "../util.slint";
import { Glyph, Icon } from "../icons.slint";
import { NumberField } from "../primitives/number-field.slint";
+import { ColorPicker } from "../primitives/color-picker.slint";
import { ClipField, ClipKeyData, Keyframes } from "../timeline/model.slint";
// The clip inspector's controls: a horizontal fader, the Param row that
@@ -777,23 +778,20 @@ export component SearchField inherits Rectangle {
// A colour on a labelled row.
//
-// Rather than fake an eyedropper and a wheel, the swatch opens a shelf of the
-// colours a title actually gets set to: the neutrals it is legible on, and
-// the kind hues already in the theme. The hex is shown beside it so a value
-// from outside the shelf is still readable rather than invisible.
+// The swatch opens the picker - the square, the strips, the hex, the
+// channels and the shelf, see primitives/color-picker.slint. The hex is
+// shown beside the swatch too, so the row can be read without opening it.
export component ColourField inherits HorizontalLayout {
in property <string> label;
in property <color> value;
/// The value spelled out, formatted by whoever owns it — Slint cannot
/// print a colour.
in property <string> hex;
+ /// The colour carries an alpha of its own; see ColorPicker.
+ in property <bool> alpha: false;
callback changed(value: color);
- /// The colours a title can be. In the theme rather than here, so a fork
- /// that retones the window retones this with it — see `swatches`.
- property <[color]> shelf: Theme.swatches;
-
padding-left: Theme.pad;
padding-right: Theme.pad;
spacing: 8px;
@@ -823,12 +821,22 @@ export component ColourField inherits HorizontalLayout {
width: 34px;
height: 20px;
border-radius: Theme.r-xs;
- // The swatch sits on its own light-to-dark checker of one square,
- // so a colour near the panel's own still has an edge.
- background: Theme.fg-dim;
+ clip: true;
border-width: 1px;
border-color: touch.has-hover ? Theme.line-strong : Theme.line;
+ // A checker under a colour that can be see-through, so a faint
+ // plate looks faint rather than like the panel.
+ if root.alpha: Rectangle {
+ for cell in 15: Rectangle {
+ x: Math.floor(cell / 3) * 7px;
+ y: Math.mod(cell, 3) * 7px;
+ width: 7px;
+ height: 7px;
+ background: Math.mod(cell + Math.floor(cell / 3), 2) == 0 ? #c8c8c8 : #7a7a7a;
+ }
+ }
+ if !root.alpha: Rectangle { background: Theme.fg-dim; }
Rectangle {
x: 1px;
y: 1px;
@@ -840,14 +848,13 @@ export component ColourField inherits HorizontalLayout {
touch := TouchArea {
mouse-cursor: pointer;
- clicked => { shelf.show(); }
+ clicked => { popup.show(); }
}
- shelf := PopupWindow {
- x: -128px;
+ popup := PopupWindow {
+ x: swatch.width - 236px;
y: swatch.height + 4px;
- width: 160px;
- height: 92px;
+ width: 236px;
close-policy: close-on-click-outside;
Rectangle {
@@ -856,23 +863,10 @@ export component ColourField inherits HorizontalLayout {
border-color: Theme.line-strong;
border-radius: Theme.r;
- for entry[index] in root.shelf: Rectangle {
- x: 8px + Math.mod(index, 6) * 24px;
- y: 8px + Math.floor(index / 6) * 26px;
- width: 20px;
- height: 20px;
- border-radius: Theme.r-xs;
- background: entry;
- border-width: 1px;
- border-color: pick.has-hover ? Theme.fg : Theme.line;
-
- pick := TouchArea {
- mouse-cursor: pointer;
- clicked => {
- root.changed(entry);
- shelf.close();
- }
- }
+ ColorPicker {
+ value: root.value;
+ alpha: root.alpha;
+ changed(next) => { root.changed(next); }
}
}
}
diff --git a/src/crates/concat/ui/inspector/text-panel.slint b/src/crates/concat/ui/inspector/text-panel.slint
index 9be9652c..5231a4ef 100644
--- a/src/crates/concat/ui/inspector/text-panel.slint
+++ b/src/crates/concat/ui/inspector/text-panel.slint
@@ -3,11 +3,13 @@
import { I18n } from "../i18n.slint";
import { Theme } from "../theme/theme.slint";
+import { Glyph } from "../icons.slint";
import { Row, Section, SectionBody, SectionHeader } from "../primitives/panel.slint";
import { SegmentedControl } from "../primitives/segmented-control.slint";
import { Select } from "../primitives/select.slint";
+import { NumberField } from "../primitives/number-field.slint";
import {
- ColourField, HelpButton, InspectorFmt, Note, Param, ParamFormat, SwitchRow,
+ ColourField, HelpButton, InspectorFmt, Param, ParamFormat, SwitchRow,
} from "controls.slint";
import {
ClipField, ClipTextField, SelectedClipData, TextAlignment,
@@ -20,9 +22,15 @@ import {
// Offering those tabs would be offering panels that can only say "nothing
// here", which is why the tab strip drops them rather than disabling them.
//
-// Sizes and positions are fractions of the output frame, never points or
-// pixels: the frame can be any resolution, and a title dialled in at 1080p
-// should not move when the project is exported at 4K.
+// Five drawers, in the order a title is made: the words, their typography,
+// the stroke around them, the box they sit in, and where the box goes.
+//
+// The document keeps sizes as fractions of the output frame, never points
+// or pixels, so a title dialled in at 1080p does not move when the project
+// is exported at 4K. The box's width and height are the exception on
+// screen: they are shown and typed in pixels of the current frame, because
+// "400 wide" is a size a person can picture and "20.8%" is not - the
+// fraction is what is stored, still.
export component TextPanel inherits VerticalLayout {
in property <SelectedClipData> selected;
/// The faces this build bundles.
@@ -38,23 +46,31 @@ export component TextPanel inherits VerticalLayout {
property <float> size;
property <float> alpha;
property <float> stroke-width;
+ property <float> stroke-alpha;
property <float> line-height;
property <float> tracking;
- property <float> text-width;
+ property <float> box-w;
+ property <float> box-h;
property <float> offset-x;
property <float> offset-y;
property <int> weight-index;
property <int> family-index;
property <[float]> weights: [400, 500, 600, 700];
+ /// The label column of the rows whose label is two words.
+ property <length> label-w: 74px;
+ property <float> frame-w: Math.max(1, root.selected.frame-width);
+ property <float> frame-h: Math.max(1, root.selected.frame-height);
function seed() {
root.size = root.selected.font-size;
root.alpha = root.selected.text-opacity;
root.stroke-width = root.selected.stroke-width;
+ root.stroke-alpha = root.selected.stroke-opacity;
root.line-height = root.selected.line-height;
root.tracking = root.selected.tracking;
- root.text-width = root.selected.text-width;
+ root.box-w = root.selected.text-width * root.frame-w;
+ root.box-h = root.selected.text-height * root.frame-h;
root.offset-x = root.selected.offset-x;
root.offset-y = root.selected.offset-y;
root.weight-index = root.selected.font-weight >= 700 ? 3
@@ -68,6 +84,10 @@ export component TextPanel inherits VerticalLayout {
init => { root.seed(); }
changed selected => { root.seed(); }
+ /// A box side in pixels: "auto" at zero, else the whole number.
+ pure function px(v: float) -> string {
+ return v <= 0 ? I18n.t("auto") : "\{Math.round(v)}";
+ }
// ── content ──────────────────────────────────────────────────────────
Section {
@@ -140,17 +160,23 @@ export component TextPanel inherits VerticalLayout {
}
}
- // ── font ─────────────────────────────────────────────────────────────
+ // ── typography ───────────────────────────────────────────────────────
+ // The face, its weight and size, and its colour: one drawer, because
+ // they are one decision. A colour drawer apart from the font it colours
+ // was two places to look for how the words look.
Section {
- font := SectionHeader {
- title: I18n.t("Font");
+ typography := SectionHeader {
+ title: I18n.t("Typography");
collapsible: true;
summary: root.selected.font-family + " · "
- + InspectorFmt.format(ParamFormat.height, root.size);
+ + InspectorFmt.format(ParamFormat.height, root.size) + " · "
+ + root.selected.fill-hex;
}
- if font.open: SectionBody {
+ if typography.open: SectionBody {
Row {
+ label: I18n.t("Font");
+ label-width: root.label-w;
Select {
options: root.families;
current <=> root.family-index;
@@ -162,6 +188,8 @@ export component TextPanel inherits VerticalLayout {
}
Row {
+ label: I18n.t("Font Weight");
+ label-width: root.label-w;
Select {
options: [I18n.t("Regular"), I18n.t("Medium"), I18n.t("SemiBold"), I18n.t("Bold")];
current <=> root.weight-index;
@@ -190,23 +218,14 @@ export component TextPanel inherits VerticalLayout {
checked: root.selected.italic;
toggled(on) => { root.set(ClipField.italic, on ? 1 : 0); root.commit(); }
}
- }
- }
- // ── colour ───────────────────────────────────────────────────────────
- Section {
- colour := SectionHeader {
- title: I18n.t("Colour");
- collapsible: true;
- summary: root.selected.fill-hex + " · "
- + InspectorFmt.format(ParamFormat.fraction, root.alpha);
- }
-
- if colour.open: SectionBody {
+ // The fill has no alpha of its own: the title's Opacity below is
+ // the one dial for how solid the words are.
ColourField {
- label: I18n.t("Fill");
+ label: I18n.t("Color");
value: root.selected.fill;
hex: root.selected.fill-hex;
+ alpha: false;
changed(colour) => { root.set-colour(ClipTextField.color, colour); root.commit(); }
}
@@ -248,9 +267,10 @@ export component TextPanel inherits VerticalLayout {
}
if root.selected.plated: ColourField {
- label: I18n.t("Plate colour");
+ label: I18n.t("Plate color");
value: root.selected.plate;
hex: root.selected.plate-hex;
+ alpha: true;
changed(shade) => {
root.set-colour(ClipTextField.background, shade);
root.commit();
@@ -259,16 +279,16 @@ export component TextPanel inherits VerticalLayout {
}
}
- // ── outline ──────────────────────────────────────────────────────────
+ // ── stroke ───────────────────────────────────────────────────────────
Section {
- outline := SectionHeader {
- title: I18n.t("Outline");
+ stroke := SectionHeader {
+ title: I18n.t("Stroke");
collapsible: true;
open: false;
summary: InspectorFmt.format(ParamFormat.outline, root.stroke-width);
}
- if outline.open: SectionBody {
+ if stroke.open: SectionBody {
Param {
label: I18n.t("Width");
value <=> root.stroke-width;
@@ -282,40 +302,95 @@ export component TextPanel inherits VerticalLayout {
changed(v) => { root.set(ClipField.stroke-width, v); root.commit(); }
}
- // Only once there is an outline to colour: a swatch for a stroke of
- // zero width sets something nobody can see.
+ // Only once there is a stroke to colour: a swatch for a stroke of
+ // zero width sets something nobody can see. The stroke's opacity is
+ // its colour's alpha - the picker's strip and this dial are one
+ // number - kept apart from the title's own Opacity so an outline
+ // can fade while the words stay solid.
if root.selected.stroke-width > 0: ColourField {
- label: I18n.t("Colour");
+ label: I18n.t("Color");
value: root.selected.stroke;
hex: root.selected.stroke-hex;
+ alpha: true;
changed(shade) => {
root.set-colour(ClipTextField.stroke-color, shade);
root.commit();
}
}
+
+ if root.selected.stroke-width > 0: Param {
+ label: I18n.t("Opacity");
+ value <=> root.stroke-alpha;
+ minimum: 0;
+ maximum: 1;
+ step: 0.01;
+ default-value: 1;
+ fmt: ParamFormat.fraction;
+ unit: "%";
+ unit-scale: 100;
+ changed(v) => { root.set(ClipField.stroke-opacity, v); root.commit(); }
+ }
}
}
// ── layout ───────────────────────────────────────────────────────────
+ // How the words fill their box, and how big the box is.
Section {
layout := SectionHeader {
title: I18n.t("Layout");
collapsible: true;
summary: (root.selected.align == TextAlignment.right ? I18n.t("Right")
: root.selected.align == TextAlignment.center ? I18n.t("Center") : I18n.t("Left"))
- + " · " + InspectorFmt.format(ParamFormat.rate, root.line-height);
+ + " · " + root.px(root.box-w) + " × " + root.px(root.box-h);
}
if layout.open: SectionBody {
Row {
+ label: I18n.t("Text Align");
+ label-width: root.label-w;
SegmentedControl {
options: [I18n.t("Left"), I18n.t("Center"), I18n.t("Right")];
+ icons: [Glyph.align-left, Glyph.align-center-x, Glyph.align-right];
current: root.selected.align == TextAlignment.right ? 2
: root.selected.align == TextAlignment.center ? 1 : 0;
changed(index) => { root.set(ClipField.align, index); root.commit(); }
}
}
+ // The box, in pixels of the frame. Zero is "auto": that side is
+ // sized by the words. The stage's grips pull the same two numbers;
+ // here they can be typed exactly.
+ Row {
+ label: I18n.t("Width");
+ label-width: root.label-w;
+ NumberField {
+ prefix: "W";
+ unit: "px";
+ value <=> root.box-w;
+ minimum: 0;
+ maximum: root.frame-w * 2;
+ step: 1;
+ format(v) => { return root.px(v); }
+ parse(t) => { return t.is-float() ? Math.max(0, t.to-float()) : 0; }
+ changed(v) => { root.set(ClipField.text-width, v / root.frame-w); root.commit(); }
+ }
+ }
+ Row {
+ label: I18n.t("Height");
+ label-width: root.label-w;
+ NumberField {
+ prefix: "H";
+ unit: "px";
+ value <=> root.box-h;
+ minimum: 0;
+ maximum: root.frame-h * 2;
+ step: 1;
+ format(v) => { return root.px(v); }
+ parse(t) => { return t.is-float() ? Math.max(0, t.to-float()) : 0; }
+ changed(v) => { root.set(ClipField.text-height, v / root.frame-h); root.commit(); }
+ }
+ }
+
Param {
label: I18n.t("Line height");
value <=> root.line-height;
@@ -340,21 +415,6 @@ export component TextPanel inherits VerticalLayout {
unit-scale: 100;
changed(v) => { root.set(ClipField.tracking, v); root.commit(); }
}
-
- // Where the words wrap. Zero is no limit; the side grips on the
- // stage set it by pulling the box's edge.
- Param {
- label: I18n.t("Max width");
- value <=> root.text-width;
- minimum: 0;
- maximum: 1;
- step: 0.01;
- default-value: 0;
- fmt: ParamFormat.fraction;
- unit: "%";
- unit-scale: 100;
- changed(v) => { root.set(ClipField.text-width, v); root.commit(); }
- }
}
}
diff --git a/src/crates/concat/ui/primitives/color-picker.slint b/src/crates/concat/ui/primitives/color-picker.slint
new file mode 100644
index 00000000..91a4b34c
--- /dev/null
+++ b/src/crates/concat/ui/primitives/color-picker.slint
@@ -0,0 +1,335 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
+
+import { Theme } from "../theme/theme.slint";
+import { Fmt } from "../util.slint";
+import { NumberField } from "number-field.slint";
+
+// A colour picker of the kind a grading suite has, and nothing less: a
+// saturation-value square under a hue strip, an alpha strip when the colour
+// has one, the hex to read and to type, the channels as fields you can
+// scrub, and the theme's shelf of swatches under it all.
+//
+// Hue, saturation and value are held apart from the colour, not recomputed
+// from it: a grey has no hue and black has no saturation either, and a
+// picker that read them back off the colour would throw the hue cursor to
+// zero every time the square was dragged to its edge. The colour is
+// composed from the three when they move, and they are re-read from the
+// colour only when something other than this picker changed it.
+export component ColorPicker inherits VerticalLayout {
+ /// The colour. The owner binds it; the picker reports every change and
+ /// re-reads it when it changes from outside.
+ in-out property <color> value;
+ /// The colour has an alpha of its own: show the strip and the field.
+ /// Off for a colour whose opacity is a dial elsewhere, like a title's
+ /// fill under the title's own Opacity.
+ in property <bool> alpha: true;
+ /// The shelf under the fields; the theme's by default.
+ in property <[color]> swatches: Theme.swatches;
+
+ /// Every change, as it happens: a drag on the square is many.
+ callback changed(value: color);
+
+ property <float> hue;
+ property <float> sat;
+ property <float> val;
+ property <float> alpha-v: 1;
+ /// What this picker last reported, so its own echo is told apart from
+ /// a change from outside.
+ property <color> emitted;
+
+ function seed() {
+ root.hue = root.value.to-hsv().hue;
+ root.sat = root.value.to-hsv().saturation;
+ root.val = root.value.to-hsv().value;
+ root.alpha-v = root.alpha ? root.value.to-hsv().alpha : 1;
+ root.sync();
+ }
+
+ /// The fields hold their own numbers once typed in, so they are told
+ /// rather than bound.
+ function sync() {
+ red.value = root.value.red;
+ green.value = root.value.green;
+ blue.value = root.value.blue;
+ alpha-field.value = Math.round(root.alpha-v * 100);
+ if (!hex.has-focus) {
+ hex.text = Fmt.hex-of(root.value, root.alpha);
+ }
+ }
+
+ function emit(next: color) {
+ root.emitted = next;
+ root.value = next;
+ root.sync();
+ root.changed(next);
+ }
+
+ function compose() {
+ root.emit(hsv(root.hue, root.sat, root.val, root.alpha ? root.alpha-v : 1));
+ }
+
+ /// A colour picked whole - a swatch, a typed hex, a channel field -
+ /// re-reads the dials from it.
+ function adopt(next: color) {
+ root.emit(next);
+ root.hue = next.to-hsv().hue;
+ root.sat = next.to-hsv().saturation;
+ root.val = next.to-hsv().value;
+ root.alpha-v = root.alpha ? next.to-hsv().alpha : 1;
+ }
+
+ init => { root.seed(); }
+ changed value => {
+ if (root.value != root.emitted) {
+ root.seed();
+ }
+ }
+
+ property <color> pure-hue: hsv(root.hue, 1, 1);
+ property <color> opaque: hsv(root.hue, root.sat, root.val);
+
+ padding: 10px;
+ spacing: 8px;
+ width: 236px;
+
+ // ── the square ──
+ square := Rectangle {
+ height: 140px;
+ border-radius: Theme.r-sm;
+ clip: true;
+ background: @linear-gradient(90deg, #ffffff 0%, root.pure-hue 100%);
+
+ Rectangle {
+ background: @linear-gradient(180deg, #00000000 0%, #000000 100%);
+ }
+
+ // The cursor: a ring with a dark edge, so it is found on white and
+ // on the colour alike.
+ Rectangle {
+ x: root.sat * square.width - self.width / 2;
+ y: (1 - root.val) * square.height - self.height / 2;
+ width: 14px;
+ height: 14px;
+ border-radius: 7px;
+ border-width: 2px;
+ border-color: #ffffff;
+ background: root.opaque;
+
+ Rectangle {
+ x: -1px;
+ y: -1px;
+ width: parent.width + 2px;
+ height: parent.height + 2px;
+ border-radius: 8px;
+ border-width: 1px;
+ border-color: #00000080;
+ }
+ }
+
+ TouchArea {
+ mouse-cursor: crosshair;
+ pointer-event(event) => {
+ if (event.kind == PointerEventKind.down
+ || (event.kind == PointerEventKind.move && self.pressed)) {
+ root.sat = Fmt.clamp(self.mouse-x / self.width, 0, 1);
+ root.val = Fmt.clamp(1 - self.mouse-y / self.height, 0, 1);
+ root.compose();
+ }
+ }
+ }
+ }
+
+ // ── the hue strip ──
+ hue-strip := Rectangle {
+ height: 12px;
+ border-radius: 6px;
+ background: @linear-gradient(90deg,
+ #ff0000 0%, #ffff00 16.667%, #00ff00 33.333%, #00ffff 50%,
+ #0000ff 66.667%, #ff00ff 83.333%, #ff0000 100%);
+
+ Rectangle {
+ x: root.hue / 360 * hue-strip.width - self.width / 2;
+ y: -2px;
+ width: 8px;
+ height: 16px;
+ border-radius: 4px;
+ border-width: 2px;
+ border-color: #ffffff;
+ background: root.pure-hue;
+ }
+
+ TouchArea {
+ mouse-cursor: pointer;
+ pointer-event(event) => {
+ if (event.kind == PointerEventKind.down
+ || (event.kind == PointerEventKind.move && self.pressed)) {
+ root.hue = Fmt.clamp(self.mouse-x / self.width, 0, 0.99999) * 360;
+ root.compose();
+ }
+ }
+ }
+ }
+
+ // ── the alpha strip ──
+ if root.alpha: alpha-strip := Rectangle {
+ height: 12px;
+ border-radius: 6px;
+ clip: true;
+
+ // A checker under the ramp, so "clear" reads as clear rather than
+ // as the panel.
+ for cell in 58: Rectangle {
+ x: Math.floor(cell / 2) * 8px;
+ y: Math.mod(cell, 2) * 6px;
+ width: 8px;
+ height: 6px;
+ background: Math.mod(cell + Math.floor(cell / 2), 2) == 0 ? #c8c8c8 : #7a7a7a;
+ }
+ Rectangle {
+ background: @linear-gradient(90deg,
+ root.opaque.with-alpha(0) 0%, root.opaque 100%);
+ }
+
+ Rectangle {
+ x: root.alpha-v * parent.width - self.width / 2;
+ y: -2px;
+ width: 8px;
+ height: 16px;
+ border-radius: 4px;
+ border-width: 2px;
+ border-color: #ffffff;
+ background: root.opaque;
+ }
+
+ TouchArea {
+ mouse-cursor: pointer;
+ pointer-event(event) => {
+ if (event.kind == PointerEventKind.down
+ || (event.kind == PointerEventKind.move && self.pressed)) {
+ root.alpha-v = Fmt.clamp(self.mouse-x / self.width, 0, 1);
+ root.compose();
+ }
+ }
+ }
+ }
+
+ // ── the readout: a swatch of the colour and its hex, typed or read ──
+ HorizontalLayout {
+ spacing: 8px;
+
+ Rectangle {
+ width: 36px;
+ height: Theme.h;
+ border-radius: Theme.r-sm;
+ clip: true;
+ border-width: 1px;
+ border-color: Theme.line;
+
+ for cell in 20: Rectangle {
+ x: Math.floor(cell / 4) * 8px;
+ y: Math.mod(cell, 4) * 7px;
+ width: 8px;
+ height: 7px;
+ background: Math.mod(cell + Math.floor(cell / 4), 2) == 0 ? #c8c8c8 : #7a7a7a;
+ }
+ Rectangle { background: root.value; }
+ }
+
+ Rectangle {
+ height: Theme.h;
+ horizontal-stretch: 1;
+ border-radius: Theme.r;
+ background: hex.has-focus ? Theme.field-hover : Theme.field;
+ border-width: 1px;
+ border-color: hex.has-focus ? Theme.accent : Colors.transparent;
+
+ hex := TextInput {
+ x: 10px;
+ width: parent.width - 20px;
+ height: parent.height;
+ color: Theme.fg;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs;
+ vertical-alignment: center;
+ single-line: true;
+ selection-background-color: Theme.accent;
+ selection-foreground-color: Theme.on-accent;
+
+ accepted => { root.adopt(Fmt.color-of(self.text, root.value)); }
+ changed has-focus => {
+ if (!self.has-focus) {
+ root.adopt(Fmt.color-of(self.text, root.value));
+ }
+ }
+ }
+ }
+ }
+
+ // ── the channels ──
+ HorizontalLayout {
+ spacing: 4px;
+
+ red := NumberField {
+ prefix: "R";
+ minimum: 0;
+ maximum: 255;
+ step: 1;
+ changed(v) => { root.adopt(rgb(v, root.value.green, root.value.blue).with-alpha(root.alpha-v)); }
+ }
+ green := NumberField {
+ prefix: "G";
+ minimum: 0;
+ maximum: 255;
+ step: 1;
+ changed(v) => { root.adopt(rgb(root.value.red, v, root.value.blue).with-alpha(root.alpha-v)); }
+ }
+ blue := NumberField {
+ prefix: "B";
+ minimum: 0;
+ maximum: 255;
+ step: 1;
+ changed(v) => { root.adopt(rgb(root.value.red, root.value.green, v).with-alpha(root.alpha-v)); }
+ }
+ alpha-field := NumberField {
+ visible: root.alpha;
+ width: root.alpha ? 58px : 0px;
+ prefix: "A";
+ suffix: "%";
+ minimum: 0;
+ maximum: 100;
+ step: 1;
+ changed(v) => {
+ root.alpha-v = v / 100;
+ root.compose();
+ }
+ }
+ }
+
+ // ── the shelf ──
+ Rectangle {
+ height: 1px;
+ background: Theme.line;
+ }
+ Rectangle {
+ height: Math.ceil(root.swatches.length / 8) * 26px - 4px;
+
+ for entry[index] in root.swatches: Rectangle {
+ x: Math.mod(index, 8) * 27px;
+ y: Math.floor(index / 8) * 26px;
+ width: 22px;
+ height: 22px;
+ border-radius: Theme.r-xs;
+ background: entry;
+ border-width: 1px;
+ border-color: pick.has-hover ? Theme.fg : Theme.line;
+
+ pick := TouchArea {
+ mouse-cursor: pointer;
+ clicked => {
+ root.adopt(root.alpha ? entry.with-alpha(root.alpha-v) : entry);
+ }
+ }
+ }
+ }
+}
diff --git a/src/crates/concat/ui/primitives/panel.slint b/src/crates/concat/ui/primitives/panel.slint
index 79647898..8c8fc9d1 100644
--- a/src/crates/concat/ui/primitives/panel.slint
+++ b/src/crates/concat/ui/primitives/panel.slint
@@ -161,6 +161,10 @@ export component SectionBody inherits VerticalLayout {
// width evenly, which is what gives paired fields (X/Y, W/H) equal columns.
export component Row inherits HorizontalLayout {
in property <string> label;
+ /// The label's column. The default fits "Horizontal"; a row whose label
+ /// is two words - "Font Weight", "Text Align" - asks for more, and its
+ /// siblings in the section ask for the same so the controls line up.
+ in property <length> label-width: Theme.label-w;
padding-left: Theme.pad;
padding-right: Theme.pad;
@@ -168,7 +172,7 @@ export component Row inherits HorizontalLayout {
min-height: Theme.h;
if root.label != "": Text {
- width: Theme.label-w;
+ width: root.label-width;
text: root.label;
color: Theme.fg-muted;
font-size: Theme.fs;
diff --git a/src/crates/concat/ui/primitives/segmented-control.slint b/src/crates/concat/ui/primitives/segmented-control.slint
index 79878540..0f8bf5fd 100644
--- a/src/crates/concat/ui/primitives/segmented-control.slint
+++ b/src/crates/concat/ui/primitives/segmented-control.slint
@@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
import { Theme } from "../theme/theme.slint";
+import { Glyph, Icon } from "../icons.slint";
import { FocusRing } from "focus-ring.slint";
// Single-select tab row with a thumb that slides to the active segment.
@@ -10,6 +11,11 @@ import { FocusRing } from "focus-ring.slint";
// from the count rather than measured from the buttons.
export component SegmentedControl inherits Rectangle {
in property <[string]> options;
+ /// A glyph per option, in the same order. A segment with one wears it
+ /// in place of its word - three alignments are three marks, not three
+ /// words - and the word stays as its accessible name. Shorter than
+ /// `options` is fine; a segment past the end keeps its word.
+ in property <[Glyph]> icons;
in-out property <int> current;
in property <bool> enabled: true;
@@ -81,7 +87,7 @@ export component SegmentedControl inherits Rectangle {
// The segment's whole box, so the label can centre in it; see the
// note on IconButton's text in panel.slint for why a Text needs to
// be handed one.
- Text {
+ if index >= root.icons.length: Text {
x: 0;
y: 0;
width: parent.width;
@@ -95,6 +101,13 @@ export component SegmentedControl inherits Rectangle {
animate color { duration: 140ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
}
+ if index < root.icons.length: Icon {
+ x: (parent.width - self.width) / 2;
+ y: (parent.height - self.height) / 2;
+ glyph: root.icons[index];
+ size: 14px;
+ tint: (index == root.current || segment.has-hover) ? Theme.fg : Theme.fg-muted;
+ }
segment := TouchArea {
enabled: root.enabled;
diff --git a/src/crates/concat/ui/timeline/model.slint b/src/crates/concat/ui/timeline/model.slint
index 3a56aa7f..1a213edc 100644
--- a/src/crates/concat/ui/timeline/model.slint
+++ b/src/crates/concat/ui/timeline/model.slint
@@ -245,6 +245,9 @@ export enum ClipTextField {
export struct SelectedClipData {
present: bool,
id: string,
+ /// the output frame's size, so a fraction can be shown in pixels
+ frame-width: int,
+ frame-height: int,
name: string,
kind: ClipKind,
/// Seconds, and the ceiling on a fade: longer than half the clip and the
diff --git a/src/crates/concat/ui/util.slint b/src/crates/concat/ui/util.slint
index 4e4ead81..1204437a 100644
--- a/src/crates/concat/ui/util.slint
+++ b/src/crates/concat/ui/util.slint
@@ -12,6 +12,13 @@ export struct Bezier {
}
export global Fmt {
+ /// A colour spelled as "#rrggbb", or "#rrggbbaa" when `with-alpha` and
+ /// it is not opaque. Slint cannot print a colour; Rust does.
+ pure callback hex-of(value: color, with-alpha: bool) -> string;
+ /// The colour a person typed - "#fff", "#cbf53f", "#000000cc", hash
+ /// optional - or `fallback` when it is not one.
+ pure callback color-of(text: string, fallback: color) -> color;
+
public pure function clamp(v: float, lo: float, hi: float) -> float {
return Math.max(lo, Math.min(hi, v));
}