Skip to content

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

feat(project): eleven frame rates to pick from, on the launch sheet and the project sheet alike

Jareer8fb6a6267e17
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index d464f4a0..bc7e34aa 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -62,7 +62,7 @@ use panes::settings::SettingsMsg;
use panes::speech::SpeechMsg;
use panes::start::StartMsg;
use panes::timeline::TimelineMsg;
-use studio::{ASPECTS, Models, OUTPUTS, SIZES, START_RATES, Studio};
+use studio::{ASPECTS, Models, OUTPUTS, RATES, SIZES, Studio};
use ui::*;
/// Opens this run's log file and makes it where the app writes things down.
@@ -295,7 +295,7 @@ pub fn run() -> Result<(), slint::PlatformError> {
.collect::<Vec<_>>(),
))));
app.set_start_rates(ModelRc::from(Rc::new(VecModel::from(
- START_RATES
+ RATES
.iter()
.map(|(label, _, _)| ChipOption {
label: SharedString::from(*label),
diff --git a/src/crates/concat/src/panes/start.rs b/src/crates/concat/src/panes/start.rs
index 7056d225..da4b43df 100644
--- a/src/crates/concat/src/panes/start.rs
+++ b/src/crates/concat/src/panes/start.rs
@@ -10,7 +10,7 @@ use concat_host::projects;
use crate::i18n::{t, tf};
use crate::platform;
use crate::studio::{
- ASPECTS, SIZES, START_RATES, Studio, custom_frame, custom_rate, fps_of, frame_size, home_folder,
+ ASPECTS, RATES, SIZES, Studio, custom_frame, custom_rate, fps_of, frame_size, home_folder,
};
use crate::ui::StartData;
@@ -54,7 +54,7 @@ pub struct StartPane {
pub aspect: usize,
/// Index into [`SIZES`], or one past its end for a custom frame.
pub size: usize,
- /// Index into [`START_RATES`], or one past its end for a custom rate.
+ /// Index into [`RATES`], or one past its end for a custom rate.
pub rate: usize,
/// The custom frame, even on both sides; seeded from the preset that
/// was picked when Custom was, so the fields start from a real frame.
@@ -115,8 +115,8 @@ impl StartPane {
self.size = index;
}
StartMsg::RateChanged(index) => {
- let index = (index.max(0) as usize).min(START_RATES.len());
- if index == START_RATES.len() && !self.custom_rate_on() {
+ let index = (index.max(0) as usize).min(RATES.len());
+ if index == RATES.len() && !self.custom_rate_on() {
self.custom_rate = self.rate();
}
self.rate = index;
@@ -217,7 +217,7 @@ impl StartPane {
/// Whether the rate is typed rather than picked.
fn custom_rate_on(&self) -> bool {
- self.rate >= START_RATES.len()
+ self.rate >= RATES.len()
}
/// The frame the sheet describes: the typed one, or the shape at the
@@ -235,7 +235,7 @@ impl StartPane {
if self.custom_rate_on() {
self.custom_rate
} else {
- let (_, num, den) = START_RATES[self.rate];
+ let (_, num, den) = RATES[self.rate];
(num, den)
}
}
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index 983092fb..6376c1f8 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -216,26 +216,21 @@ fn even(value: u32) -> u32 {
value & !1
}
-/// The frame rates, as exact fractions. 29.97 is 30000/1001 and never
-/// anything else - a decimal is for reading, and export must never be handed
-/// one.
-pub const START_RATES: [(&str, i64, i64); 5] = [
- ("24", 24, 1),
- ("25", 25, 1),
- ("29.97", 30000, 1001),
- ("30", 30, 1),
- ("60", 60, 1),
-];
-
-/// The project sheet's rates: the launch sheet's five and the three a
-/// camera also records at, in order. A list, not chips, so it can carry
-/// them all; anything else is typed in as a custom rate.
-pub const RATES: [(&str, i64, i64); 8] = [
+/// The frame rates a project is offered, on the launch sheet and the
+/// project sheet alike, as exact fractions: 29.97 is 30000/1001 and never
+/// anything else - a decimal is for reading, and export must never be
+/// handed one. The rates cameras and screens run at, from a stop-motion
+/// ten to a game capture's sixty; anything else is typed in as a custom
+/// rate. https://github.com/jub0t/Concat/issues/199
+pub const RATES: [(&str, i64, i64); 11] = [
+ ("10", 10, 1),
+ ("20", 20, 1),
("23.976", 24000, 1001),
("24", 24, 1),
("25", 25, 1),
("29.97", 30000, 1001),
("30", 30, 1),
+ ("48", 48, 1),
("50", 50, 1),
("59.94", 60000, 1001),
("60", 60, 1),
diff --git a/src/crates/concat/ui/dialogs/project.slint b/src/crates/concat/ui/dialogs/project.slint
index 8a36ebac..120f8cdf 100644
--- a/src/crates/concat/ui/dialogs/project.slint
+++ b/src/crates/concat/ui/dialogs/project.slint
@@ -24,7 +24,7 @@ export struct ProjectSheetData {
timeline: string,
/// Row in the frame list; one past its six rows is Custom.
size: int,
- /// Row in the rate list; one past its eight rows is Custom.
+ /// Row in the rate list; one past its eleven rows is Custom.
rate: int,
/// The frame and rate as numbers, for the custom fields.
custom-width: float,
@@ -132,15 +132,18 @@ export component ProjectDialog inherits Modal {
label: I18n.t("common.frameRate");
Select {
current: root.data.rate;
- options: ["23.976 fps", "24 fps", "25 fps", "29.97 fps", "30 fps",
- "50 fps", "59.94 fps", "60 fps", I18n.t("common.custom")];
+ // The same ladder the launch sheet offers, in the same
+ // order: `RATES` in studio.rs.
+ options: ["10 fps", "20 fps", "23.976 fps", "24 fps", "25 fps",
+ "29.97 fps", "30 fps", "48 fps", "50 fps", "59.94 fps", "60 fps",
+ I18n.t("common.custom")];
changed(index) => { root.rate-changed(index); }
}
}
// From 1 to 240, kept as the exact fraction beside it: 23.976
// is 24000/1001, as a camera records it.
- if root.data.rate == 8: DialogRow {
+ if root.data.rate == 11: DialogRow {
HorizontalLayout {
spacing: 10px;
diff --git a/src/crates/concat/ui/start.slint b/src/crates/concat/ui/start.slint
index 356cf198..b3533cf8 100644
--- a/src/crates/concat/ui/start.slint
+++ b/src/crates/concat/ui/start.slint
@@ -355,15 +355,26 @@ component ChipRow inherits Rectangle {
in property <int> current;
in property <bool> enabled: true;
/// The chips share the width rather than take their own: the phone
- /// shape, where five rates have to fit across a thumb's screen.
+ /// shape, where a ladder has to fit across a thumb's screen.
in property <bool> block;
+ /// Chips a row, for a ladder too long for one - the rates, twelve
+ /// with Custom. Zero is one row of chips at their own widths; a count
+ /// lays them in rows of equal cells, so the ladder reads as a keypad
+ /// rather than as a line that runs off the sheet.
+ in property <int> per-row: 0;
callback changed(index: int);
property <bool> ring;
property <int> count: root.options.length + (root.extra != "" ? 1 : 0);
+ property <length> gap: 8px;
+ property <length> chip-h: 32px;
+ property <int> rows: root.per-row > 0 ? Math.ceil(root.count / root.per-row) : 1;
+ property <length> cell-w: root.per-row > 0
+ ? (root.width - (root.per-row - 1) * root.gap) / root.per-row
+ : 0px;
- height: 32px;
+ height: root.rows * root.chip-h + (root.rows - 1) * root.gap;
function select(index: int) {
if (index >= 0 && index < root.count) {
@@ -393,9 +404,9 @@ component ChipRow inherits Rectangle {
}
}
- HorizontalLayout {
+ if root.per-row == 0: HorizontalLayout {
alignment: root.block ? LayoutAlignment.stretch : LayoutAlignment.start;
- spacing: 8px;
+ spacing: root.gap;
for option[index] in root.options: Chip {
label: option.label;
@@ -422,6 +433,39 @@ component ChipRow inherits Rectangle {
}
}
}
+
+ // The rows: placed by arithmetic, the way the grids are, since a Slint
+ // layout has no wrap. Every cell the same width, the last row shorter.
+ if root.per-row > 0: Rectangle {
+ for option[index] in root.options: Chip {
+ x: Math.mod(index, root.per-row) * (root.cell-w + root.gap);
+ y: Math.floor(index / root.per-row) * (root.chip-h + root.gap);
+ width: root.cell-w;
+ label: option.label;
+ ratio: option.ratio;
+ selected: index == root.current;
+ enabled: root.enabled;
+ ring: root.ring && index == root.current;
+ clicked => {
+ fs.focus();
+ root.select(index);
+ }
+ }
+
+ if root.extra != "": Chip {
+ x: Math.mod(root.options.length, root.per-row) * (root.cell-w + root.gap);
+ y: Math.floor(root.options.length / root.per-row) * (root.chip-h + root.gap);
+ width: root.cell-w;
+ label: root.extra;
+ selected: root.current == root.options.length;
+ enabled: root.enabled;
+ ring: root.ring && root.current == root.options.length;
+ clicked => {
+ fs.focus();
+ root.select(root.options.length);
+ }
+ }
+ }
}
// A labelled row of the form, with a hairline under it. Beside the value
@@ -1159,7 +1203,7 @@ export component NewProjectDialog inherits Modal {
in property <StartData> data;
/// The three ladders. The numbers behind each index are Rust's, so
/// there is one place that knows what 4K is in pixels and that 29.97 is
- /// 30000 over 1001 — see `ASPECTS`, `SIZES` and `START_RATES` in the
+ /// 30000 over 1001 — see `ASPECTS`, `SIZES` and `RATES` in the
/// window.
in property <[ChipOption]> aspects;
in property <[ChipOption]> sizes;
@@ -1191,7 +1235,7 @@ export component NewProjectDialog inherits Modal {
// sheet dismissed out from under a create is a create nobody hears
// about.
dismissable: !root.data.busy;
- // Wide enough for five rates, Custom and their readout beside an 84px
+ // Wide enough for six rates a row, with their readout beside an 84px
// label, and no wider than the window less a margin, on a phone.
surface-width: Math.min(640px, root.width - 32px);
@@ -1382,13 +1426,16 @@ export component NewProjectDialog inherits Modal {
HorizontalLayout {
spacing: 16px;
+ // Eleven rates and Custom: two rows of six, or three
+ // of four across a phone, each cell wide enough for
+ // "23.976".
ChipRow {
horizontal-stretch: 1;
options: root.rates;
extra: I18n.t("common.custom");
current: root.data.rate;
enabled: !root.data.busy;
- block: root.narrow;
+ per-row: root.narrow ? 4 : 6;
changed(index) => { root.rate-changed(index); }
}