forge
Explore
Log in

Don't you dare go Hollow

🚚 edith moves to git.tahinli.com

Browse files at this commit

b02f499d2ae83c64acfb72cd9ca0dc3b5e252bc5Ahmet Kaan GümüşParent: 308fc77
The working tree as of 2026-10-23, as one commit on top of the last one
here. It carries the work up to that date plus the test-slimming work:
integration tests merged into one binary per crate, nextest config,
doctest = false, debug line tables only, perf tests behind --ignored,
and faster generators, reverse, undo, subtitle-export, hevc, stabilise
and hear tests.

300 changed files +80834 -16902

Showing the first 300 files; this commit changes more.

.config/nextest.tomladded+16 -0
@@ -0,0 +1,16 @@
1+# cargo-nextest: how the workspace's test suite runs.
2+
3+[profile.default]
4+# A test is flagged slow after 60s. Slow tests are flagged only and none are killed,
5+# because the heavy export tests take minutes.
6+slow-timeout = "60s"
7+# One failure must not hide the others.
8+fail-fast = false
9+
10+# Full decode, export and render runs are the heavy ones: at most two at once.
11+[test-groups.heavy]
12+max-threads = 2
13+
14+[[profile.default.overrides]]
15+filter = 'package(engine) and test(/export|decode|render/)'
16+test-group = "heavy"
.gitignoremodified+3 -1
@@ -1,4 +1,6 @@
1 /target1 /target
2-/assets2+/assets/*
3+!/assets/fonts/
4+!/assets/icons/
3 /real_library.toml5 /real_library.toml
4 /graphify-out6 /graphify-out
.mcp.jsonadded+7 -0
@@ -0,0 +1,7 @@
1+{
2+ "mcpServers": {
3+ "edith": {
4+ "command": "/home/tahinli/Documents/Code/Rust/edith/target/release/edith_mcp"
5+ }
6+ }
7+}
Cargo.lockmodified+460 -484
@@ -2,6 +2,22 @@
2 # It is not intended for manual editing.2 # It is not intended for manual editing.
3 version = 43 version = 4
4 4
5+[[package]]
6+name = "ab_glyph"
7+version = "0.2.32"
8+source = "registry+https://github.com/rust-lang/crates.io-index"
9+checksum = "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2"
10+dependencies = [
11+ "ab_glyph_rasterizer",
12+ "owned_ttf_parser",
13+]
14+
15+[[package]]
16+name = "ab_glyph_rasterizer"
17+version = "0.1.10"
18+source = "registry+https://github.com/rust-lang/crates.io-index"
19+checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
20+
5 [[package]]21 [[package]]
6 name = "adler2"22 name = "adler2"
7 version = "2.0.1"23 version = "2.0.1"
@@ -61,21 +77,14 @@ dependencies = [
61 ]77 ]
62 78
63 [[package]]79 [[package]]
64-name = "annotate-snippets"80+name = "android_system_properties"
65-version = "0.11.5"81+version = "0.1.6"
66 source = "registry+https://github.com/rust-lang/crates.io-index"82 source = "registry+https://github.com/rust-lang/crates.io-index"
67-checksum = "710e8eae58854cdc1790fcb56cca04d712a17be849eeb81da2a724bf4bae2bc4"83+checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc"
68 dependencies = [84 dependencies = [
69- "anstyle",85+ "libc",
70- "unicode-width",
71 ]86 ]
72 87
73-[[package]]
74-name = "anstyle"
75-version = "1.0.14"
76-source = "registry+https://github.com/rust-lang/crates.io-index"
77-checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
78-
79 [[package]]88 [[package]]
80 name = "anyhow"89 name = "anyhow"
81 version = "1.0.104"90 version = "1.0.104"
@@ -97,6 +106,28 @@ version = "1.4.2"
97 source = "registry+https://github.com/rust-lang/crates.io-index"106 source = "registry+https://github.com/rust-lang/crates.io-index"
98 checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"107 checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
99 108
109+[[package]]
110+name = "archmage"
111+version = "0.9.31-beta.1"
112+source = "registry+https://github.com/rust-lang/crates.io-index"
113+checksum = "8eb78f99f21cbafac07b21fdfc795c62479a4175c264d255e06728b77875f655"
114+dependencies = [
115+ "archmage-macros",
116+ "safe_unaligned_simd",
117+ "winarm-cpufeatures",
118+]
119+
120+[[package]]
121+name = "archmage-macros"
122+version = "0.9.31-beta.1"
123+source = "registry+https://github.com/rust-lang/crates.io-index"
124+checksum = "6548920cabd08932e44d64bae280e1639f4d632763431ddb723048032a3b246d"
125+dependencies = [
126+ "proc-macro2",
127+ "quote",
128+ "syn 3.0.9",
129+]
130+
100 [[package]]131 [[package]]
101 name = "arg_enum_proc_macro"132 name = "arg_enum_proc_macro"
102 version = "0.3.4"133 version = "0.3.4"
@@ -409,7 +440,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
409 dependencies = [440 dependencies = [
410 "proc-macro2",441 "proc-macro2",
411 "quote",442 "quote",
412- "syn 3.0.3",443+ "syn 3.0.9",
413 ]444 ]
414 445
415 [[package]]446 [[package]]
@@ -532,25 +563,6 @@ dependencies = [
532 "syn 2.0.119",563 "syn 2.0.119",
533 ]564 ]
534 565
535-[[package]]
536-name = "bindgen"
537-version = "0.72.1"
538-source = "registry+https://github.com/rust-lang/crates.io-index"
539-checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
540-dependencies = [
541- "annotate-snippets",
542- "bitflags 2.13.1",
543- "cexpr",
544- "clang-sys",
545- "itertools 0.13.0",
546- "proc-macro2",
547- "quote",
548- "regex",
549- "rustc-hash 2.1.3",
550- "shlex 1.3.0",
551- "syn 2.0.119",
552-]
553-
554 [[package]]566 [[package]]
555 name = "bit-set"567 name = "bit-set"
556 version = "0.8.0"568 version = "0.8.0"
@@ -716,12 +728,6 @@ dependencies = [
716 "serde_core",728 "serde_core",
717 ]729 ]
718 730
719-[[package]]
720-name = "built"
721-version = "0.7.7"
722-source = "registry+https://github.com/rust-lang/crates.io-index"
723-checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b"
724-
725 [[package]]731 [[package]]
726 name = "built"732 name = "built"
727 version = "0.8.1"733 version = "0.8.1"
@@ -751,7 +757,7 @@ checksum = "fc0e56a716f1e132ff6bf4bdac1c944a3fcdc1cae65f70a4a2a1ac3b401d2d1f"
751 dependencies = [757 dependencies = [
752 "proc-macro2",758 "proc-macro2",
753 "quote",759 "quote",
754- "syn 3.0.3",760+ "syn 3.0.9",
755 ]761 ]
756 762
757 [[package]]763 [[package]]
@@ -846,28 +852,12 @@ dependencies = [
846 "nom 7.1.3",852 "nom 7.1.3",
847 ]853 ]
848 854
849-[[package]]
850-name = "cfg-expr"
851-version = "0.20.8"
852-source = "registry+https://github.com/rust-lang/crates.io-index"
853-checksum = "fb693542bcafa528e198be0ebd9d3632ca5b7c93dbe7237460e199910835997c"
854-dependencies = [
855- "smallvec",
856- "target-lexicon",
857-]
858-
859 [[package]]855 [[package]]
860 name = "cfg-if"856 name = "cfg-if"
861 version = "1.0.4"857 version = "1.0.4"
862 source = "registry+https://github.com/rust-lang/crates.io-index"858 source = "registry+https://github.com/rust-lang/crates.io-index"
863 checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"859 checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
864 860
865-[[package]]
866-name = "cfg_aliases"
867-version = "0.1.1"
868-source = "registry+https://github.com/rust-lang/crates.io-index"
869-checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
870-
871 [[package]]861 [[package]]
872 name = "cfg_aliases"862 name = "cfg_aliases"
873 version = "0.2.2"863 version = "0.2.2"
@@ -894,6 +884,19 @@ dependencies = [
894 "rand_core 0.10.1",884 "rand_core 0.10.1",
895 ]885 ]
896 886
887+[[package]]
888+name = "chrono"
889+version = "0.4.45"
890+source = "registry+https://github.com/rust-lang/crates.io-index"
891+checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
892+dependencies = [
893+ "iana-time-zone",
894+ "js-sys",
895+ "num-traits",
896+ "wasm-bindgen",
897+ "windows-link 0.2.1",
898+]
899+
897 [[package]]900 [[package]]
898 name = "cipher"901 name = "cipher"
899 version = "0.4.4"902 version = "0.4.4"
@@ -1003,12 +1006,6 @@ dependencies = [
1003 "thiserror 2.0.20",1006 "thiserror 2.0.20",
1004 ]1007 ]
1005 1008
1006-[[package]]
1007-name = "compcol"
1008-version = "0.6.8"
1009-source = "registry+https://github.com/rust-lang/crates.io-index"
1010-checksum = "28b37ce533aa0fddc1e6820e331968ba72aa48b5c8bbb2bebdc03d48b6ed0f16"
1011-
1012 [[package]]1009 [[package]]
1013 name = "compression-codecs"1010 name = "compression-codecs"
1014 version = "0.4.38"1011 version = "0.4.38"
@@ -1068,12 +1065,6 @@ version = "0.4.0"
1068 source = "registry+https://github.com/rust-lang/crates.io-index"1065 source = "registry+https://github.com/rust-lang/crates.io-index"
1069 checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"1066 checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
1070 1067
1071-[[package]]
1072-name = "cookie-factory"
1073-version = "0.3.3"
1074-source = "registry+https://github.com/rust-lang/crates.io-index"
1075-checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2"
1076-
1077 [[package]]1068 [[package]]
1078 name = "core-foundation"1069 name = "core-foundation"
1079 version = "0.9.4"1070 version = "0.9.4"
@@ -1250,21 +1241,6 @@ dependencies = [
1250 "libc",1241 "libc",
1251 ]1242 ]
1252 1243
1253-[[package]]
1254-name = "crc"
1255-version = "3.4.0"
1256-source = "registry+https://github.com/rust-lang/crates.io-index"
1257-checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d"
1258-dependencies = [
1259- "crc-catalog",
1260-]
1261-
1262-[[package]]
1263-name = "crc-catalog"
1264-version = "2.5.0"
1265-source = "registry+https://github.com/rust-lang/crates.io-index"
1266-checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853"
1267-
1268 [[package]]1244 [[package]]
1269 name = "crc32fast"1245 name = "crc32fast"
1270 version = "1.5.0"1246 version = "1.5.0"
@@ -1274,27 +1250,10 @@ dependencies = [
1274 "cfg-if",1250 "cfg-if",
1275 ]1251 ]
1276 1252
1277-[[package]]
1278-name = "cros-codecs"
1279-version = "0.0.6"
1280-dependencies = [
1281- "anyhow",
1282- "byteorder",
1283- "crc32fast",
1284- "cros-libva",
1285- "drm",
1286- "drm-fourcc",
1287- "gbm",
1288- "gbm-sys",
1289- "log",
1290- "nix 0.28.0",
1291- "thiserror 1.0.69",
1292- "zerocopy",
1293-]
1294-
1295 [[package]]1253 [[package]]
1296 name = "cros-libva"1254 name = "cros-libva"
1297-version = "0.0.12"1255+version = "0.0.13"
1256+source = "git+https://github.com/chromeos/cros-libva?rev=59384456ac2ae78c0c3e5515f41ef1efd9b802cf#59384456ac2ae78c0c3e5515f41ef1efd9b802cf"
1298 dependencies = [1257 dependencies = [
1299 "bindgen 0.70.1",1258 "bindgen 0.70.1",
1300 "bitflags 2.13.1",1259 "bitflags 2.13.1",
@@ -1492,7 +1451,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
1492 dependencies = [1451 dependencies = [
1493 "proc-macro2",1452 "proc-macro2",
1494 "quote",1453 "quote",
1495- "syn 3.0.3",1454+ "syn 3.0.9",
1496 ]1455 ]
1497 1456
1498 [[package]]1457 [[package]]
@@ -1510,45 +1469,6 @@ version = "1.2.1"
1510 source = "registry+https://github.com/rust-lang/crates.io-index"1469 source = "registry+https://github.com/rust-lang/crates.io-index"
1511 checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"1470 checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
1512 1471
1513-[[package]]
1514-name = "drm"
1515-version = "0.12.0"
1516-source = "registry+https://github.com/rust-lang/crates.io-index"
1517-checksum = "98888c4bbd601524c11a7ed63f814b8825f420514f78e96f752c437ae9cbb5d1"
1518-dependencies = [
1519- "bitflags 2.13.1",
1520- "bytemuck",
1521- "drm-ffi",
1522- "drm-fourcc",
1523- "rustix 0.38.44",
1524-]
1525-
1526-[[package]]
1527-name = "drm-ffi"
1528-version = "0.8.0"
1529-source = "registry+https://github.com/rust-lang/crates.io-index"
1530-checksum = "97c98727e48b7ccb4f4aea8cfe881e5b07f702d17b7875991881b41af7278d53"
1531-dependencies = [
1532- "drm-sys",
1533- "rustix 0.38.44",
1534-]
1535-
1536-[[package]]
1537-name = "drm-fourcc"
1538-version = "2.2.0"
1539-source = "registry+https://github.com/rust-lang/crates.io-index"
1540-checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4"
1541-
1542-[[package]]
1543-name = "drm-sys"
1544-version = "0.7.0"
1545-source = "registry+https://github.com/rust-lang/crates.io-index"
1546-checksum = "fd39dde40b6e196c2e8763f23d119ddb1a8714534bf7d77fa97a65b0feda3986"
1547-dependencies = [
1548- "libc",
1549- "linux-raw-sys 0.6.5",
1550-]
1551-
1552 [[package]]1472 [[package]]
1553 name = "dtor"1473 name = "dtor"
1554 version = "0.0.6"1474 version = "0.0.6"
@@ -1604,12 +1524,36 @@ dependencies = [
1604 "ec-dsp",1524 "ec-dsp",
1605 ]1525 ]
1606 1526
1527+[[package]]
1528+name = "ec-alac"
1529+version = "0.1.0"
1530+dependencies = [
1531+ "ec-core",
1532+]
1533+
1534+[[package]]
1535+name = "ec-amr"
1536+version = "0.1.0"
1537+dependencies = [
1538+ "ec-core",
1539+]
1540+
1541+[[package]]
1542+name = "ec-ass"
1543+version = "0.1.0"
1544+dependencies = [
1545+ "ec-core",
1546+ "ec-subs",
1547+]
1548+
1607 [[package]]1549 [[package]]
1608 name = "ec-av1"1550 name = "ec-av1"
1609 version = "0.1.0"1551 version = "0.1.0"
1610 dependencies = [1552 dependencies = [
1553+ "bytemuck",
1611 "ec-av1-syntax",1554 "ec-av1-syntax",
1612 "ec-core",1555 "ec-core",
1556+ "multiversion",
1613 ]1557 ]
1614 1558
1615 [[package]]1559 [[package]]
@@ -1619,10 +1563,27 @@ dependencies = [
1619 "ec-core",1563 "ec-core",
1620 ]1564 ]
1621 1565
1566+[[package]]
1567+name = "ec-cc"
1568+version = "0.1.0"
1569+dependencies = [
1570+ "ec-core",
1571+ "ec-h264-syntax",
1572+ "ec-h265-syntax",
1573+ "ec-subs",
1574+]
1575+
1622 [[package]]1576 [[package]]
1623 name = "ec-core"1577 name = "ec-core"
1624 version = "0.1.0"1578 version = "0.1.0"
1625 1579
1580+[[package]]
1581+name = "ec-dnxhd"
1582+version = "0.1.0"
1583+dependencies = [
1584+ "ec-core",
1585+]
1586+
1626 [[package]]1587 [[package]]
1627 name = "ec-dsp"1588 name = "ec-dsp"
1628 version = "0.1.0"1589 version = "0.1.0"
@@ -1631,6 +1592,41 @@ dependencies = [
1631 "wide",1592 "wide",
1632 ]1593 ]
1633 1594
1595+[[package]]
1596+name = "ec-dts"
1597+version = "0.1.0"
1598+dependencies = [
1599+ "ec-core",
1600+]
1601+
1602+[[package]]
1603+name = "ec-dv"
1604+version = "0.1.0"
1605+dependencies = [
1606+ "ec-core",
1607+]
1608+
1609+[[package]]
1610+name = "ec-dvbsub"
1611+version = "0.1.0"
1612+dependencies = [
1613+ "ec-core",
1614+]
1615+
1616+[[package]]
1617+name = "ec-dvdsub"
1618+version = "0.1.0"
1619+dependencies = [
1620+ "ec-core",
1621+]
1622+
1623+[[package]]
1624+name = "ec-flac"
1625+version = "0.1.0"
1626+dependencies = [
1627+ "ec-core",
1628+]
1629+
1634 [[package]]1630 [[package]]
1635 name = "ec-h264"1631 name = "ec-h264"
1636 version = "0.1.0"1632 version = "0.1.0"
@@ -1651,8 +1647,11 @@ dependencies = [
1651 name = "ec-h265"1647 name = "ec-h265"
1652 version = "0.1.0"1648 version = "0.1.0"
1653 dependencies = [1649 dependencies = [
1650+ "archmage",
1651+ "bytemuck",
1654 "ec-core",1652 "ec-core",
1655 "ec-h265-syntax",1653 "ec-h265-syntax",
1654+ "multiversion",
1656 "wide",1655 "wide",
1657 ]1656 ]
1658 1657
@@ -1663,6 +1662,49 @@ dependencies = [
1663 "ec-core",1662 "ec-core",
1664 ]1663 ]
1665 1664
1665+[[package]]
1666+name = "ec-hw"
1667+version = "0.1.0"
1668+dependencies = [
1669+ "ec-av1-syntax",
1670+ "ec-core",
1671+ "ec-h264-syntax",
1672+ "ec-h265-syntax",
1673+ "ec-va",
1674+ "ec-vp9-syntax",
1675+]
1676+
1677+[[package]]
1678+name = "ec-image"
1679+version = "0.1.0"
1680+dependencies = [
1681+ "ec-core",
1682+ "ec-inflate",
1683+]
1684+
1685+[[package]]
1686+name = "ec-inflate"
1687+version = "0.1.0"
1688+dependencies = [
1689+ "ec-core",
1690+]
1691+
1692+[[package]]
1693+name = "ec-matroska"
1694+version = "0.1.0"
1695+dependencies = [
1696+ "ec-core",
1697+ "ec-inflate",
1698+]
1699+
1700+[[package]]
1701+name = "ec-mjpeg"
1702+version = "0.1.0"
1703+dependencies = [
1704+ "ec-core",
1705+ "ec-image",
1706+]
1707+
1666 [[package]]1708 [[package]]
1667 name = "ec-mp3"1709 name = "ec-mp3"
1668 version = "0.1.0"1710 version = "0.1.0"
@@ -1672,6 +1714,45 @@ dependencies = [
1672 "wide",1714 "wide",
1673 ]1715 ]
1674 1716
1717+[[package]]
1718+name = "ec-mp4"
1719+version = "0.1.0"
1720+dependencies = [
1721+ "ec-core",
1722+]
1723+
1724+[[package]]
1725+name = "ec-mpeg2"
1726+version = "0.1.0"
1727+dependencies = [
1728+ "ec-core",
1729+]
1730+
1731+[[package]]
1732+name = "ec-mpeg4"
1733+version = "0.1.0"
1734+dependencies = [
1735+ "ec-core",
1736+]
1737+
1738+[[package]]
1739+name = "ec-mpegts"
1740+version = "0.1.0"
1741+dependencies = [
1742+ "ec-core",
1743+ "ec-dvdsub",
1744+ "ec-h264-syntax",
1745+ "ec-h265-syntax",
1746+ "ec-truehd",
1747+]
1748+
1749+[[package]]
1750+name = "ec-ogg"
1751+version = "0.1.0"
1752+dependencies = [
1753+ "ec-core",
1754+]
1755+
1675 [[package]]1756 [[package]]
1676 name = "ec-opus"1757 name = "ec-opus"
1677 version = "0.1.0"1758 version = "0.1.0"
@@ -1682,6 +1763,80 @@ dependencies = [
1682 "wide",1763 "wide",
1683 ]1764 ]
1684 1765
1766+[[package]]
1767+name = "ec-pcm-ext"
1768+version = "0.1.0"
1769+dependencies = [
1770+ "ec-core",
1771+]
1772+
1773+[[package]]
1774+name = "ec-pgs"
1775+version = "0.1.0"
1776+dependencies = [
1777+ "ec-core",
1778+]
1779+
1780+[[package]]
1781+name = "ec-probe"
1782+version = "0.1.0"
1783+dependencies = [
1784+ "ec-aac",
1785+ "ec-ac3",
1786+ "ec-alac",
1787+ "ec-amr",
1788+ "ec-core",
1789+ "ec-flac",
1790+ "ec-matroska",
1791+ "ec-mp3",
1792+ "ec-mp4",
1793+ "ec-ogg",
1794+ "ec-opus",
1795+ "ec-pcm-ext",
1796+ "ec-riff",
1797+ "ec-truehd",
1798+ "ec-vorbis",
1799+]
1800+
1801+[[package]]
1802+name = "ec-prores"
1803+version = "0.1.0"
1804+dependencies = [
1805+ "archmage",
1806+ "bytemuck",
1807+ "ec-core",
1808+ "wide",
1809+]
1810+
1811+[[package]]
1812+name = "ec-riff"
1813+version = "0.1.0"
1814+dependencies = [
1815+ "ec-core",
1816+ "ec-dv",
1817+]
1818+
1819+[[package]]
1820+name = "ec-subs"
1821+version = "0.1.0"
1822+dependencies = [
1823+ "ec-core",
1824+]
1825+
1826+[[package]]
1827+name = "ec-truehd"
1828+version = "0.1.0"
1829+dependencies = [
1830+ "ec-core",
1831+]
1832+
1833+[[package]]
1834+name = "ec-va"
1835+version = "0.1.0"
1836+dependencies = [
1837+ "cros-libva",
1838+]
1839+
1685 [[package]]1840 [[package]]
1686 name = "ec-vorbis"1841 name = "ec-vorbis"
1687 version = "0.1.0"1842 version = "0.1.0"
@@ -1693,6 +1848,23 @@ dependencies = [
1693 [[package]]1848 [[package]]
1694 name = "ec-vp8"1849 name = "ec-vp8"
1695 version = "0.1.0"1850 version = "0.1.0"
1851+dependencies = [
1852+ "bytemuck",
1853+ "ec-core",
1854+ "multiversion",
1855+]
1856+
1857+[[package]]
1858+name = "ec-vp9"
1859+version = "0.1.0"
1860+dependencies = [
1861+ "ec-core",
1862+ "ec-vp9-syntax",
1863+]
1864+
1865+[[package]]
1866+name = "ec-vp9-syntax"
1867+version = "0.1.0"
1696 dependencies = [1868 dependencies = [
1697 "ec-core",1869 "ec-core",
1698 ]1870 ]
@@ -1701,11 +1873,25 @@ dependencies = [
1701 name = "edith"1873 name = "edith"
1702 version = "0.1.0"1874 version = "0.1.0"
1703 dependencies = [1875 dependencies = [
1876+ "chrono",
1877+ "ec-image",
1704 "engine",1878 "engine",
1705 "gpui",1879 "gpui",
1706 "image",1880 "image",
1707 ]1881 ]
1708 1882
1883+[[package]]
1884+name = "edith_mcp"
1885+version = "0.1.0"
1886+dependencies = [
1887+ "chrono",
1888+ "engine",
1889+ "libc",
1890+ "rustix 1.1.4",
1891+ "serde_json",
1892+ "signal-hook",
1893+]
1894+
1709 [[package]]1895 [[package]]
1710 name = "either"1896 name = "either"
1711 version = "1.17.0"1897 version = "1.17.0"
@@ -1745,51 +1931,65 @@ checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099"
1745 name = "engine"1931 name = "engine"
1746 version = "0.1.0"1932 version = "0.1.0"
1747 dependencies = [1933 dependencies = [
1934+ "ab_glyph",
1935+ "ab_glyph_rasterizer",
1748 "ec-aac",1936 "ec-aac",
1749 "ec-ac3",1937 "ec-ac3",
1938+ "ec-ass",
1750 "ec-av1",1939 "ec-av1",
1940+ "ec-cc",
1751 "ec-core",1941 "ec-core",
1942+ "ec-dnxhd",
1943+ "ec-dts",
1944+ "ec-dv",
1945+ "ec-dvbsub",
1946+ "ec-dvdsub",
1947+ "ec-flac",
1752 "ec-h264",1948 "ec-h264",
1949+ "ec-h264-syntax",
1753 "ec-h265",1950 "ec-h265",
1754 "ec-h265-syntax",1951 "ec-h265-syntax",
1952+ "ec-image",
1953+ "ec-inflate",
1954+ "ec-mjpeg",
1755 "ec-mp3",1955 "ec-mp3",
1956+ "ec-mp4",
1957+ "ec-mpeg2",
1958+ "ec-mpeg4",
1959+ "ec-mpegts",
1960+ "ec-ogg",
1756 "ec-opus",1961 "ec-opus",
1962+ "ec-pgs",
1963+ "ec-probe",
1964+ "ec-prores",
1965+ "ec-riff",
1966+ "ec-subs",
1967+ "ec-truehd",
1757 "ec-vorbis",1968 "ec-vorbis",
1758- "flacenc",1969+ "ec-vp8",
1759- "hound",1970+ "ec-vp9",
1760- "image",1971+ "fontdb 0.23.0",
1761 "libc",1972 "libc",
1762- "libloading",1973+ "nix 0.29.0",
1763- "miniz_oxide",
1764- "mp4",
1765- "oxideav-ass",
1766- "oxideav-core",
1767- "oxideav-ogg",
1768- "oxideav-sub-image",
1769- "oxideav-subtitle",
1770 "rav1e",1974 "rav1e",
1771- "symphonia",1975+ "rustfft",
1772- "symphonia-codec-aac",1976+ "rustix 1.1.4",
1773- "symphonia-core",1977+ "rustybuzz 0.20.1",
1774-]1978+ "serde_json",
1775-1979+ "symphonia",
1776-[[package]]1980+ "symphonia-core",
1777-name = "engine-audio"1981+ "ttf-parser 0.25.1",
1778-version = "0.1.0"1982+ "unicode-bidi",
1779-dependencies = [
1780- "engine",
1781- "libspa-sys",
1782- "pipewire",
1783 ]1983 ]
1784 1984
1785 [[package]]1985 [[package]]
1786 name = "engine-hw"1986 name = "engine-hw"
1787 version = "0.1.0"1987 version = "0.1.0"
1788 dependencies = [1988 dependencies = [
1789- "cros-codecs",1989+ "ec-hw",
1990+ "ec-va",
1790 "ec-vp8",1991 "ec-vp8",
1791 "engine",1992 "engine",
1792- "gbm",
1793 ]1993 ]
1794 1994
1795 [[package]]1995 [[package]]
@@ -1985,21 +2185,6 @@ version = "0.1.10"
1985 source = "registry+https://github.com/rust-lang/crates.io-index"2185 source = "registry+https://github.com/rust-lang/crates.io-index"
1986 checksum = "26b73573e6edcd2af0cdf47bd6cb58f0b3839491263c314eaad1ccf24430e1de"2186 checksum = "26b73573e6edcd2af0cdf47bd6cb58f0b3839491263c314eaad1ccf24430e1de"
1987 2187
1988-[[package]]
1989-name = "flacenc"
1990-version = "0.5.1"
1991-source = "registry+https://github.com/rust-lang/crates.io-index"
1992-checksum = "74c892c2b5fa08f967e8b5ad29121570b4762202f2402033ce08479ec65eccd0"
1993-dependencies = [
1994- "built 0.7.7",
1995- "crc",
1996- "heapless",
1997- "md-5",
1998- "num-traits",
1999- "rustversion",
2000- "seq-macro",
2001-]
2002-
2003 [[package]]2188 [[package]]
2004 name = "flate2"2189 name = "flate2"
2005 version = "1.1.9"2190 version = "1.1.9"
@@ -2116,7 +2301,7 @@ checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225"
2116 dependencies = [2301 dependencies = [
2117 "proc-macro2",2302 "proc-macro2",
2118 "quote",2303 "quote",
2119- "syn 3.0.3",2304+ "syn 3.0.9",
2120 ]2305 ]
2121 2306
2122 [[package]]2307 [[package]]
@@ -2271,28 +2456,6 @@ dependencies = [
2271 "slab",2456 "slab",
2272 ]2457 ]
2273 2458
2274-[[package]]
2275-name = "gbm"
2276-version = "0.15.0"
2277-source = "registry+https://github.com/rust-lang/crates.io-index"
2278-checksum = "45bf55ba6dd53ad0ac115046ff999c5324c283444ee6e0be82454c4e8eb2f36a"
2279-dependencies = [
2280- "bitflags 2.13.1",
2281- "drm",
2282- "drm-fourcc",
2283- "gbm-sys",
2284- "libc",
2285-]
2286-
2287-[[package]]
2288-name = "gbm-sys"
2289-version = "0.3.1"
2290-source = "registry+https://github.com/rust-lang/crates.io-index"
2291-checksum = "a9cc2f64de9fa707b5c6b2d2f10d7a7e49e845018a9f5685891eb40d3bab2538"
2292-dependencies = [
2293- "libc",
2294-]
2295-
2296 [[package]]2459 [[package]]
2297 name = "generic-array"2460 name = "generic-array"
2298 version = "0.14.7"2461 version = "0.14.7"
@@ -2438,8 +2601,6 @@ dependencies = [
2438 [[package]]2601 [[package]]
2439 name = "gpui"2602 name = "gpui"
2440 version = "0.2.2"2603 version = "0.2.2"
2441-source = "registry+https://github.com/rust-lang/crates.io-index"
2442-checksum = "979b45cfa6ec723b6f42330915a1b3769b930d02b2d505f9697f8ca602bee707"
2443 dependencies = [2604 dependencies = [
2444 "anyhow",2605 "anyhow",
2445 "as-raw-xcb-connection",2606 "as-raw-xcb-connection",
@@ -2731,15 +2892,6 @@ dependencies = [
2731 "zerocopy",2892 "zerocopy",
2732 ]2893 ]
2733 2894
2734-[[package]]
2735-name = "hash32"
2736-version = "0.3.1"
2737-source = "registry+https://github.com/rust-lang/crates.io-index"
2738-checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
2739-dependencies = [
2740- "byteorder",
2741-]
2742-
2743 [[package]]2895 [[package]]
2744 name = "hashbrown"2896 name = "hashbrown"
2745 version = "0.14.5"2897 version = "0.14.5"
@@ -2761,16 +2913,6 @@ version = "0.17.1"
2761 source = "registry+https://github.com/rust-lang/crates.io-index"2913 source = "registry+https://github.com/rust-lang/crates.io-index"
2762 checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"2914 checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
2763 2915
2764-[[package]]
2765-name = "heapless"
2766-version = "0.8.0"
2767-source = "registry+https://github.com/rust-lang/crates.io-index"
2768-checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
2769-dependencies = [
2770- "hash32",
2771- "stable_deref_trait",
2772-]
2773-
2774 [[package]]2916 [[package]]
2775 name = "heck"2917 name = "heck"
2776 version = "0.4.1"2918 version = "0.4.1"
@@ -2839,12 +2981,6 @@ dependencies = [
2839 "windows-sys 0.61.2",2981 "windows-sys 0.61.2",
2840 ]2982 ]
2841 2983
2842-[[package]]
2843-name = "hound"
2844-version = "3.5.1"
2845-source = "registry+https://github.com/rust-lang/crates.io-index"
2846-checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f"
2847-
2848 [[package]]2984 [[package]]
2849 name = "http"2985 name = "http"
2850 version = "1.5.0"2986 version = "1.5.0"
@@ -2950,6 +3086,30 @@ dependencies = [
2950 "tracing",3086 "tracing",
2951 ]3087 ]
2952 3088
3089+[[package]]
3090+name = "iana-time-zone"
3091+version = "0.1.65"
3092+source = "registry+https://github.com/rust-lang/crates.io-index"
3093+checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"
3094+dependencies = [
3095+ "android_system_properties",
3096+ "core-foundation-sys",
3097+ "iana-time-zone-haiku",
3098+ "js-sys",
3099+ "log",
3100+ "wasm-bindgen",
3101+ "windows-core 0.61.2",
3102+]
3103+
3104+[[package]]
3105+name = "iana-time-zone-haiku"
3106+version = "0.1.2"
3107+source = "registry+https://github.com/rust-lang/crates.io-index"
3108+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
3109+dependencies = [
3110+ "cc",
3111+]
3112+
2953 [[package]]3113 [[package]]
2954 name = "icu_collections"3114 name = "icu_collections"
2955 version = "2.2.0"3115 version = "2.2.0"
@@ -3333,45 +3493,12 @@ dependencies = [
3333 "libc",3493 "libc",
3334 ]3494 ]
3335 3495
3336-[[package]]
3337-name = "libspa"
3338-version = "0.10.0"
3339-source = "registry+https://github.com/rust-lang/crates.io-index"
3340-checksum = "2909f3be29d674e7f10604aff18d1bbe1bb03c4cd61c8a8ba19c0b1d162f7d4e"
3341-dependencies = [
3342- "bitflags 2.13.1",
3343- "cc",
3344- "cookie-factory",
3345- "libc",
3346- "libspa-sys",
3347- "nom 8.0.0",
3348- "rustix 1.1.4",
3349- "system-deps",
3350-]
3351-
3352-[[package]]
3353-name = "libspa-sys"
3354-version = "0.10.0"
3355-source = "registry+https://github.com/rust-lang/crates.io-index"
3356-checksum = "69ad52764fca54818486f3cf75afec844d1f1a1568c24dcee25d41b1ab007dda"
3357-dependencies = [
3358- "bindgen 0.72.1",
3359- "cc",
3360- "system-deps",
3361-]
3362-
3363 [[package]]3496 [[package]]
3364 name = "linux-raw-sys"3497 name = "linux-raw-sys"
3365 version = "0.4.15"3498 version = "0.4.15"
3366 source = "registry+https://github.com/rust-lang/crates.io-index"3499 source = "registry+https://github.com/rust-lang/crates.io-index"
3367 checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"3500 checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
3368 3501
3369-[[package]]
3370-name = "linux-raw-sys"
3371-version = "0.6.5"
3372-source = "registry+https://github.com/rust-lang/crates.io-index"
3373-checksum = "2a385b1be4e5c3e362ad2ffa73c392e53f031eaa5b7d648e64cd87f27f6063d7"
3374-
3375 [[package]]3502 [[package]]
3376 name = "linux-raw-sys"3503 name = "linux-raw-sys"
3377 version = "0.12.1"3504 version = "0.12.1"
@@ -3604,15 +3731,24 @@ dependencies = [
3604 ]3731 ]
3605 3732
3606 [[package]]3733 [[package]]
3607-name = "mp4"3734+name = "multiversion"
3608-version = "0.14.0"3735+version = "0.9.1"
3736+source = "registry+https://github.com/rust-lang/crates.io-index"
3737+checksum = "064516e3530f0916620d0ec77549b3cc9fb83be97af00271ea3396bc52bd931c"
3609 dependencies = [3738 dependencies = [
3610- "byteorder",3739+ "multiversion-macros",
3611- "bytes",3740+]
3612- "num-rational",3741+
3613- "serde",3742+[[package]]
3614- "serde_json",3743+name = "multiversion-macros"
3615- "thiserror 1.0.69",3744+version = "0.9.1"
3745+source = "registry+https://github.com/rust-lang/crates.io-index"
3746+checksum = "3e334db2f3bd47a7e247b0f5c7b911fc61321bdac337782fcf47015517f54e1c"
3747+dependencies = [
3748+ "proc-macro2",
3749+ "quote",
3750+ "rustversion",
3751+ "syn 3.0.9",
3616 ]3752 ]
3617 3753
3618 [[package]]3754 [[package]]
@@ -3624,7 +3760,7 @@ dependencies = [
3624 "arrayvec",3760 "arrayvec",
3625 "bit-set",3761 "bit-set",
3626 "bitflags 2.13.1",3762 "bitflags 2.13.1",
3627- "cfg_aliases 0.2.2",3763+ "cfg_aliases",
3628 "codespan-reporting",3764 "codespan-reporting",
3629 "half",3765 "half",
3630 "hashbrown 0.15.5",3766 "hashbrown 0.15.5",
@@ -3650,22 +3786,20 @@ dependencies = [
3650 ]3786 ]
3651 3787
3652 [[package]]3788 [[package]]
3653-name = "new_debug_unreachable"3789+name = "nasm-rs"
3654-version = "1.0.6"3790+version = "0.3.2"
3655 source = "registry+https://github.com/rust-lang/crates.io-index"3791 source = "registry+https://github.com/rust-lang/crates.io-index"
3656-checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"3792+checksum = "706bf8a5e8c8ddb99128c3291d31bd21f4bcde17f0f4c20ec678d85c74faa149"
3793+dependencies = [
3794+ "jobserver",
3795+ "log",
3796+]
3657 3797
3658 [[package]]3798 [[package]]
3659-name = "nix"3799+name = "new_debug_unreachable"
3660-version = "0.28.0"3800+version = "1.0.6"
3661 source = "registry+https://github.com/rust-lang/crates.io-index"3801 source = "registry+https://github.com/rust-lang/crates.io-index"
3662-checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4"3802+checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
3663-dependencies = [
3664- "bitflags 2.13.1",
3665- "cfg-if",
3666- "cfg_aliases 0.1.1",
3667- "libc",
3668-]
3669 3803
3670 [[package]]3804 [[package]]
3671 name = "nix"3805 name = "nix"
@@ -3675,8 +3809,9 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
3675 dependencies = [3809 dependencies = [
3676 "bitflags 2.13.1",3810 "bitflags 2.13.1",
3677 "cfg-if",3811 "cfg-if",
3678- "cfg_aliases 0.2.2",3812+ "cfg_aliases",
3679 "libc",3813 "libc",
3814+ "memoffset",
3680 ]3815 ]
3681 3816
3682 [[package]]3817 [[package]]
@@ -3687,7 +3822,7 @@ checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
3687 dependencies = [3822 dependencies = [
3688 "bitflags 2.13.1",3823 "bitflags 2.13.1",
3689 "cfg-if",3824 "cfg-if",
3690- "cfg_aliases 0.2.2",3825+ "cfg_aliases",
3691 "libc",3826 "libc",
3692 ]3827 ]
3693 3828
@@ -3824,7 +3959,6 @@ dependencies = [
3824 "num-bigint",3959 "num-bigint",
3825 "num-integer",3960 "num-integer",
3826 "num-traits",3961 "num-traits",
3827- "serde",
3828 ]3962 ]
3829 3963
3830 [[package]]3964 [[package]]
@@ -4057,113 +4191,12 @@ dependencies = [
4057 ]4191 ]
4058 4192
4059 [[package]]4193 [[package]]
4060-name = "oxideav-ass"4194+name = "owned_ttf_parser"
4061-version = "0.0.9"4195+version = "0.25.1"
4062-source = "registry+https://github.com/rust-lang/crates.io-index"
4063-checksum = "b9d5a10750f54eb6913bf3ca295d17899006c9a9c6c94970741a5a7c0c49e3fa"
4064-dependencies = [
4065- "oxideav-core",
4066- "oxideav-subtitle",
4067-]
4068-
4069-[[package]]
4070-name = "oxideav-core"
4071-version = "0.1.34"
4072-source = "registry+https://github.com/rust-lang/crates.io-index"
4073-checksum = "5a68d9a74d6d0a7373589eca0c0bb8ab380c46fd1d7fc807e696d716cdad078c"
4074-dependencies = [
4075- "bytemuck",
4076- "serde_json",
4077- "thiserror 2.0.20",
4078-]
4079-
4080-[[package]]
4081-name = "oxideav-ogg"
4082-version = "0.1.8"
4083-source = "registry+https://github.com/rust-lang/crates.io-index"
4084-checksum = "8a582af48d51a2a8d2d87958ca22a3a21f9029dcc828c1b4a5865fa00f952d3a"
4085-dependencies = [
4086- "oxideav-core",
4087-]
4088-
4089-[[package]]
4090-name = "oxideav-otf"
4091-version = "0.1.3"
4092-source = "registry+https://github.com/rust-lang/crates.io-index"
4093-checksum = "571c56414ce3138d3a4e7c833b402b3c69a96db707f54abd0f1ad85f3d5d1a0b"
4094-dependencies = [
4095- "oxideav-core",
4096-]
4097-
4098-[[package]]
4099-name = "oxideav-pixfmt"
4100-version = "0.1.7"
4101-source = "registry+https://github.com/rust-lang/crates.io-index"
4102-checksum = "868d5cd1d9cf3f4d527241b6ed85fcd628c65e303fe4efb2998e4d6104c7ce4b"
4103-dependencies = [
4104- "oxideav-core",
4105-]
4106-
4107-[[package]]
4108-name = "oxideav-png"
4109-version = "0.1.8"
4110-source = "registry+https://github.com/rust-lang/crates.io-index"
4111-checksum = "c78483db4263204f6f9e2e63354b45f0fe2f83e0e08282f68c8a9647d537fa1f"
4112-dependencies = [
4113- "compcol",
4114- "oxideav-core",
4115-]
4116-
4117-[[package]]
4118-name = "oxideav-raster"
4119-version = "0.1.2"
4120-source = "registry+https://github.com/rust-lang/crates.io-index"
4121-checksum = "41beead01c28b23e6e997e8b2d3a38bb1b53cd37b6e8a72a10befa2fb57a6e06"
4122-dependencies = [
4123- "oxideav-core",
4124- "oxideav-pixfmt",
4125-]
4126-
4127-[[package]]
4128-name = "oxideav-scribe"
4129-version = "0.1.9"
4130-source = "registry+https://github.com/rust-lang/crates.io-index"
4131-checksum = "a9aec36b356861de9e0e660a7990f14b428476638f7b2ba902c0cd7e1ffdac39"
4132-dependencies = [
4133- "oxideav-core",
4134- "oxideav-otf",
4135- "oxideav-png",
4136- "oxideav-ttf",
4137-]
4138-
4139-[[package]]
4140-name = "oxideav-sub-image"
4141-version = "0.0.7"
4142-source = "registry+https://github.com/rust-lang/crates.io-index"
4143-checksum = "cb5030e2dce8efa58c20f3e9ce4e53064b7697dc2dcc2585a678d313718582d6"
4144-dependencies = [
4145- "oxideav-core",
4146-]
4147-
4148-[[package]]
4149-name = "oxideav-subtitle"
4150-version = "0.1.2"
4151-source = "registry+https://github.com/rust-lang/crates.io-index"
4152-checksum = "88e41289024a95ea82051cd18af77885afd7be3c23a38255cb1edbe49872273a"
4153-dependencies = [
4154- "oxideav-core",
4155- "oxideav-pixfmt",
4156- "oxideav-raster",
4157- "oxideav-scribe",
4158-]
4159-
4160-[[package]]
4161-name = "oxideav-ttf"
4162-version = "0.1.7"
4163 source = "registry+https://github.com/rust-lang/crates.io-index"4196 source = "registry+https://github.com/rust-lang/crates.io-index"
4164-checksum = "c44d45518f6f4d749d2bf2c7cb3622fdb7ccc6147457545ed36aa8d241adea8e"4197+checksum = "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b"
4165 dependencies = [4198 dependencies = [
4166- "oxideav-core",4199+ "ttf-parser 0.25.1",
4167 ]4200 ]
4168 4201
4169 [[package]]4202 [[package]]
@@ -4291,31 +4324,6 @@ dependencies = [
4291 "futures-io",4324 "futures-io",
4292 ]4325 ]
4293 4326
4294-[[package]]
4295-name = "pipewire"
4296-version = "0.10.0"
4297-source = "registry+https://github.com/rust-lang/crates.io-index"
4298-checksum = "8585aba8a52ad74ccc633b8e293c1dc4277976bd5d510b925533f34fd6685f38"
4299-dependencies = [
4300- "bitflags 2.13.1",
4301- "libc",
4302- "libspa",
4303- "libspa-sys",
4304- "pipewire-sys",
4305- "rustix 1.1.4",
4306-]
4307-
4308-[[package]]
4309-name = "pipewire-sys"
4310-version = "0.10.0"
4311-source = "registry+https://github.com/rust-lang/crates.io-index"
4312-checksum = "f2089f245b548723e60325773c27f586b7a2372c79ea941b246cd0d654706adc"
4313-dependencies = [
4314- "bindgen 0.72.1",
4315- "libspa-sys",
4316- "system-deps",
4317-]
4318-
4319 [[package]]4327 [[package]]
4320 name = "pkg-config"4328 name = "pkg-config"
4321 version = "0.3.33"4329 version = "0.3.33"
@@ -4558,7 +4566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
4558 checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"4566 checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8"
4559 dependencies = [4567 dependencies = [
4560 "bytes",4568 "bytes",
4561- "cfg_aliases 0.2.2",4569+ "cfg_aliases",
4562 "pin-project-lite",4570 "pin-project-lite",
4563 "quinn-proto",4571 "quinn-proto",
4564 "quinn-udp",4572 "quinn-udp",
@@ -4599,7 +4607,7 @@ version = "0.5.15"
4599 source = "registry+https://github.com/rust-lang/crates.io-index"4607 source = "registry+https://github.com/rust-lang/crates.io-index"
4600 checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"4608 checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694"
4601 dependencies = [4609 dependencies = [
4602- "cfg_aliases 0.2.2",4610+ "cfg_aliases",
4603 "libc",4611 "libc",
4604 "once_cell",4612 "once_cell",
4605 "socket2",4613 "socket2",
@@ -4732,7 +4740,8 @@ dependencies = [
4732 "av-scenechange",4740 "av-scenechange",
4733 "av1-grain",4741 "av1-grain",
4734 "bitstream-io",4742 "bitstream-io",
4735- "built 0.8.1",4743+ "built",
4744+ "cc",
4736 "cfg-if",4745 "cfg-if",
4737 "interpolate_name",4746 "interpolate_name",
4738 "itertools 0.14.0",4747 "itertools 0.14.0",
@@ -4740,6 +4749,7 @@ dependencies = [
4740 "libfuzzer-sys",4749 "libfuzzer-sys",
4741 "log",4750 "log",
4742 "maybe-rayon",4751 "maybe-rayon",
4752+ "nasm-rs",
4743 "new_debug_unreachable",4753 "new_debug_unreachable",
4744 "noop_proc_macro",4754 "noop_proc_macro",
4745 "num-derive",4755 "num-derive",
@@ -4879,7 +4889,7 @@ checksum = "2c9283685feec7d69af75fb0e858d5e7378f33fe4fc699383b2916ab9273e03c"
4879 dependencies = [4889 dependencies = [
4880 "proc-macro2",4890 "proc-macro2",
4881 "quote",4891 "quote",
4882- "syn 3.0.3",4892+ "syn 3.0.9",
4883 ]4893 ]
4884 4894
4885 [[package]]4895 [[package]]
@@ -5169,6 +5179,12 @@ dependencies = [
5169 "bytemuck",5179 "bytemuck",
5170 ]5180 ]
5171 5181
5182+[[package]]
5183+name = "safe_unaligned_simd"
5184+version = "0.2.5"
5185+source = "registry+https://github.com/rust-lang/crates.io-index"
5186+checksum = "f9c874fb993656d484725d58fbfddb39dfcf98ebcadc1a1d09568aa6b39bafba"
5187+
5172 [[package]]5188 [[package]]
5173 name = "same-file"5189 name = "same-file"
5174 version = "1.0.6"5190 version = "1.0.6"
@@ -5210,7 +5226,7 @@ dependencies = [
5210 "proc-macro2",5226 "proc-macro2",
5211 "quote",5227 "quote",
5212 "serde_derive_internals",5228 "serde_derive_internals",
5213- "syn 3.0.3",5229+ "syn 3.0.9",
5214 ]5230 ]
5215 5231
5216 [[package]]5232 [[package]]
@@ -5289,12 +5305,6 @@ version = "1.0.28"
5289 source = "registry+https://github.com/rust-lang/crates.io-index"5305 source = "registry+https://github.com/rust-lang/crates.io-index"
5290 checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"5306 checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
5291 5307
5292-[[package]]
5293-name = "seq-macro"
5294-version = "0.3.6"
5295-source = "registry+https://github.com/rust-lang/crates.io-index"
5296-checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
5297-
5298 [[package]]5308 [[package]]
5299 name = "serde"5309 name = "serde"
5300 version = "1.0.229"5310 version = "1.0.229"
@@ -5322,7 +5332,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
5322 dependencies = [5332 dependencies = [
5323 "proc-macro2",5333 "proc-macro2",
5324 "quote",5334 "quote",
5325- "syn 3.0.3",5335+ "syn 3.0.9",
5326 ]5336 ]
5327 5337
5328 [[package]]5338 [[package]]
@@ -5333,7 +5343,7 @@ checksum = "f852137cce035d6a4df67ccce505ff6b3e9fd3a10e3e52b24dc71e650bb1a9bd"
5333 dependencies = [5343 dependencies = [
5334 "proc-macro2",5344 "proc-macro2",
5335 "quote",5345 "quote",
5336- "syn 3.0.3",5346+ "syn 3.0.9",
5337 ]5347 ]
5338 5348
5339 [[package]]5349 [[package]]
@@ -5380,7 +5390,7 @@ checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906"
5380 dependencies = [5390 dependencies = [
5381 "proc-macro2",5391 "proc-macro2",
5382 "quote",5392 "quote",
5383- "syn 3.0.3",5393+ "syn 3.0.9",
5384 ]5394 ]
5385 5395
5386 [[package]]5396 [[package]]
@@ -5453,6 +5463,16 @@ version = "2.0.1"
5453 source = "registry+https://github.com/rust-lang/crates.io-index"5463 source = "registry+https://github.com/rust-lang/crates.io-index"
5454 checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"5464 checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
5455 5465
5466+[[package]]
5467+name = "signal-hook"
5468+version = "0.3.18"
5469+source = "registry+https://github.com/rust-lang/crates.io-index"
5470+checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
5471+dependencies = [
5472+ "libc",
5473+ "signal-hook-registry",
5474+]
5475+
5456 [[package]]5476 [[package]]
5457 name = "signal-hook-registry"5477 name = "signal-hook-registry"
5458 version = "1.4.8"5478 version = "1.4.8"
@@ -5800,10 +5820,8 @@ dependencies = [
5800 "lazy_static",5820 "lazy_static",
5801 "symphonia-bundle-flac",5821 "symphonia-bundle-flac",
5802 "symphonia-bundle-mp3",5822 "symphonia-bundle-mp3",
5803- "symphonia-codec-aac",
5804 "symphonia-codec-alac",5823 "symphonia-codec-alac",
5805 "symphonia-codec-pcm",5824 "symphonia-codec-pcm",
5806- "symphonia-codec-vorbis",
5807 "symphonia-core",5825 "symphonia-core",
5808 "symphonia-format-isomp4",5826 "symphonia-format-isomp4",
5809 "symphonia-format-mkv",5827 "symphonia-format-mkv",
@@ -5835,18 +5853,6 @@ dependencies = [
5835 "symphonia-core",5853 "symphonia-core",
5836 ]5854 ]
5837 5855
5838-[[package]]
5839-name = "symphonia-codec-aac"
5840-version = "0.6.0"
5841-source = "registry+https://github.com/rust-lang/crates.io-index"
5842-checksum = "f1979c515a76371b186aad2feff5f23e21cbec775bf95de08bf1e3af92a2ad76"
5843-dependencies = [
5844- "lazy_static",
5845- "log",
5846- "symphonia-common",
5847- "symphonia-core",
5848-]
5849-
5850 [[package]]5856 [[package]]
5851 name = "symphonia-codec-alac"5857 name = "symphonia-codec-alac"
5852 version = "0.6.0"5858 version = "0.6.0"
@@ -5868,17 +5874,6 @@ dependencies = [
5868 "symphonia-core",5874 "symphonia-core",
5869 ]5875 ]
5870 5876
5871-[[package]]
5872-name = "symphonia-codec-vorbis"
5873-version = "0.6.0"
5874-source = "registry+https://github.com/rust-lang/crates.io-index"
5875-checksum = "45b07b4423cd8e0fc472575909a5554b12c2f58e3c190b38c24f042e732fd8de"
5876-dependencies = [
5877- "log",
5878- "symphonia-common",
5879- "symphonia-core",
5880-]
5881-
5882 [[package]]5877 [[package]]
5883 name = "symphonia-common"5878 name = "symphonia-common"
5884 version = "0.6.0"5879 version = "0.6.0"
@@ -5989,9 +5984,9 @@ dependencies = [
5989 5984
5990 [[package]]5985 [[package]]
5991 name = "syn"5986 name = "syn"
5992-version = "3.0.3"5987+version = "3.0.9"
5993 source = "registry+https://github.com/rust-lang/crates.io-index"5988 source = "registry+https://github.com/rust-lang/crates.io-index"
5994-checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3"5989+checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
5995 dependencies = [5990 dependencies = [
5996 "proc-macro2",5991 "proc-macro2",
5997 "quote",5992 "quote",
@@ -6062,19 +6057,6 @@ dependencies = [
6062 "libc",6057 "libc",
6063 ]6058 ]
6064 6059
6065-[[package]]
6066-name = "system-deps"
6067-version = "7.0.8"
6068-source = "registry+https://github.com/rust-lang/crates.io-index"
6069-checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7"
6070-dependencies = [
6071- "cfg-expr",
6072- "heck 0.5.0",
6073- "pkg-config",
6074- "toml 1.1.4+spec-1.1.0",
6075- "version-compare",
6076-]
6077-
6078 [[package]]6060 [[package]]
6079 name = "taffy"6061 name = "taffy"
6080 version = "0.9.0"6062 version = "0.9.0"
@@ -6105,12 +6087,6 @@ dependencies = [
6105 "objc",6087 "objc",
6106 ]6088 ]
6107 6089
6108-[[package]]
6109-name = "target-lexicon"
6110-version = "0.13.5"
6111-source = "registry+https://github.com/rust-lang/crates.io-index"
6112-checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
6113-
6114 [[package]]6090 [[package]]
6115 name = "tempfile"6091 name = "tempfile"
6116 version = "3.27.0"6092 version = "3.27.0"
@@ -6181,7 +6157,7 @@ checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"
6181 dependencies = [6157 dependencies = [
6182 "proc-macro2",6158 "proc-macro2",
6183 "quote",6159 "quote",
6184- "syn 3.0.3",6160+ "syn 3.0.9",
6185 ]6161 ]
6186 6162
6187 [[package]]6163 [[package]]
@@ -6714,12 +6690,6 @@ dependencies = [
6714 "sval_serde",6690 "sval_serde",
6715 ]6691 ]
6716 6692
6717-[[package]]
6718-name = "version-compare"
6719-version = "0.2.1"
6720-source = "registry+https://github.com/rust-lang/crates.io-index"
6721-checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e"
6722-
6723 [[package]]6693 [[package]]
6724 name = "version_check"6694 name = "version_check"
6725 version = "0.9.5"6695 version = "0.9.5"
@@ -7030,6 +7000,12 @@ version = "0.4.0"
7030 source = "registry+https://github.com/rust-lang/crates.io-index"7000 source = "registry+https://github.com/rust-lang/crates.io-index"
7031 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"7001 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
7032 7002
7003+[[package]]
7004+name = "winarm-cpufeatures"
7005+version = "0.1.2"
7006+source = "registry+https://github.com/rust-lang/crates.io-index"
7007+checksum = "d107c80dd656e1a2c254dfb1d57ece73b7f515b8a8684c270c23cab68f4a440d"
7008+
7033 [[package]]7009 [[package]]
7034 name = "windows"7010 name = "windows"
7035 version = "0.57.0"7011 version = "0.57.0"
Cargo.tomlmodified+20 -66
@@ -1,8 +1,14 @@
1 [workspace]1 [workspace]
2 resolver = "3"2 resolver = "3"
3-members = ["crates/engine", "crates/engine-hw", "crates/engine-audio", "crates/app"]3+members = ["crates/engine", "crates/engine-hw", "crates/app", "crates/mcp"]
4+# A plain `cargo build` / `cargo run` builds `engine-hw` too, so `hw-child` lands
5+# beside `target/<profile>/edith` and the hardware decode works. `-p edith` does
6+# not build it (artifact deps are nightly-only); `hwproc` warns once when a GPU is
7+# present and the child is missing.
8+default-members = ["crates/engine", "crates/engine-hw", "crates/app", "crates/mcp"]
4 # Vendored third-party (see [patch.crates-io]); not ours to build or test.9 # Vendored third-party (see [patch.crates-io]); not ours to build or test.
5 exclude = [10 exclude = [
11+ "tools/edith-stt",
6 "vendor/cros-libva",12 "vendor/cros-libva",
7 "vendor/cros-codecs",13 "vendor/cros-codecs",
8 14
@@ -13,73 +19,21 @@ exclude = [
13 version = "0.1.0"19 version = "0.1.0"
14 edition = "2024"20 edition = "2024"
15 21
16-# Three upstream crates vendored verbatim except for one clearly marked fix each,22+# Panics and backtraces keep file:line; full variable debug info is dropped, which
17-# all blockers on this machine and all still unfixed upstream as of23+# shrinks the target dir and the link time of every test binary. For a debugger
18-# 0.0.6/0.0.13/0.14:24+# session, build with CARGO_PROFILE_DEV_DEBUG=2. The test profile inherits this.
19-# cros-libva - fails to build against libva >= 1.23 headers25+[profile.dev]
20-# cros-codecs - probes VA-API with a 16x16 context that Mesa radeonsi refuses;26+debug = "line-tables-only"
21-# and creates every decode context as 8-bit 4:2:0, which no HEVC
22-# Main 10 stream can decode into (its own TODO, its own answer);
23-# and refuses an H.264 frame_num gap outright unless the stream
24-# declared one, which fails every seek into an open-GOP Blu-ray
25-# remux -- the gap is the *editor's*, made by restarting at a
26-# random access point, so the patch fills it with the §8.2.5.2
27-# non-existing frames the loop right below it already builds.
28-# It also has no HEVC *encoder* at all in 0.0.6: the seven
29-# commits behind cros-codecs' own `hevc-vaapi-encoder` branch
30-# (`codec/h265/{nalu_writer,synthesizer}`, the VPS/SPS/PPS
31-# builders in `codec/h265/parser.rs`, `encoder/stateless/h265`
32-# with its predictor and VA-API backend, and the H.264 NALU
33-# writer's emulation-prevention fix that shares that code) are
34-# applied here verbatim -- upstream work carried early, not a
35-# local invention, and the H.265 half of what makes edith's
36-# HEVC export run on the GPU.
37-# And `video_frame/generic_dma_video_frame.rs` unmapped a DMA
38-# buffer by issuing one `CLFLUSH` per *byte* -- 64 per cache
39-# line, 3.1 million per 1080p picture, 6.2 ms of the 8.4 ms a
40-# hardware export spent per frame (measured on radeonsi
41-# 2026-08-13; upstream's own TODO asks for exactly this and
42-# reports a race that the mfence pair, not the redundancy, was
43-# always ordering). The same `drop` wrote its `munmap` as an
44-# unconsumed `.map()`, so no mapping was ever released and an
45-# encode session leaked 3 MB of address space per frame
46-# (2.2 GB over a 719-frame export). Both are fixed in place
47-# and marked LOCAL PATCH
48 27
49-28+# Vendored third-party crate, patched for one clearly marked fix (see below).
50-# mp4 - reads the `mp4a` sample entry as ISO only: the 8 bytes
51-# QuickTime uses for version/revision/vendor are skipped as
52-# reserved, so a version-1 SoundDescription's 16-byte tail
53-# (version 2's 36-byte one) is taken for the first child box
54-# and the `wave`-wrapped `esds` behind it is never seen -- an
55-# AAC track "with no esds", every Resolve / Final Cut / `ffmpeg
56-# -f mov` file silent. The patch is `Mp4aBox::read_box` and a
57-# `WaveBox` fourcc; writing is untouched.
58-# A sixth, `rusty_h264-common`, left the tree on 2026-09-12 with the last
59-# `rusty_h264` seat: it was vendored only to declaw `rusty_alloc` -- its
60-# authors' allocator installed itself as the process `#[global_allocator]` and
61-# segfaulted the editor on a new thread's first allocation -- and once
62-# `ec-h264` carried both H.264 seats there was nothing left to patch.
63-# rusty_aac - a seventh vendor whose whole entry left with its last seat:
64-# `ec-aac`, the family's own, took the *encode* seat on
65-# 2026-09-13 after already carrying the decode one, and the
66-# vendored crate went with them. Its patch had routed the
67-# decoder's O(N^2) IMDCT through the encoder's N/4-point FFT
68-# (`dsp::dct4`, 40x the matrix version) so 5.1 was playable at
69-# all -- a fix for a crate the tree no longer carries.
70-# oxideav-h265 - an eighth: `ec-h265` took the HEVC encode seat on
71-# 2026-09-13, and the vendored tree (with its §7.4.3.2.1
72-# conformance-window patch) went with it -- ec-h265 pads and
73-# writes the crop itself.
74-# Drop `vendor/` entirely once released versions handle all three.
75 [patch.crates-io]29 [patch.crates-io]
76-cros-libva = { path = "vendor/cros-libva" }
77-cros-codecs = { path = "vendor/cros-codecs" }
78 # Drops the `pub use proc_macro;` re-export (E0365 future-incompat, rustc30 # Drops the `pub use proc_macro;` re-export (E0365 future-incompat, rustc
79 # warns on every workspace build); nothing in the crate or its users names it.31 # warns on every workspace build); nothing in the crate or its users names it.
80 proc-macro-error2 = { path = "vendor/proc-macro-error2" }32 proc-macro-error2 = { path = "vendor/proc-macro-error2" }
81-# Reads QuickTime version-1/2 sound sample descriptions (Resolve, Final Cut,33+# gpui 0.2.2 (Apache-2.0, LICENSE-APACHE kept in the copy) with one fix: its
82-# `ffmpeg -f mov`): the 16/36-byte block after samplerate and the `esds`34+# wl_keyboard Modifiers and Key handlers unwrap the keymap, which is None until
83-# inside the `wave` wrapper. Stock 0.14 walks past both and calls the AAC35+# the Keymap event arrives, so an early event panicked at startup. Those handlers
84-# track esds-less, so a `.mov` opens without sound.36+# now return early instead. A second fix: Wayland ignored `WindowOptions::display_id`,
85-mp4 = { path = "vendor/mp4" }37+# so a window that names a display goes fullscreen on that output (the video output
38+# window's "Output display"). Both are in third_party/gpui/src/platform/linux/wayland/client.rs.
39+gpui = { path = "third_party/gpui" }
DESIGN.mdmodified+432 -343
@@ -1,364 +1,453 @@
1-# edith — Design Language: The Darkroom1+# edith — Design
2 2
3-This document is the binding design contract for edith's UI. It was distilled from the approved3+This is the binding design contract for edith, a desktop video editor. It is written for the agents who implement it. Every rule is checkable. Where this document is silent, the reference artifact is the answer.
4-concept mock ("Darkroom", 2026-08-20) and it outlives that mock: every existing surface is being
5-rebuilt to this language, and **every future feature must be designed inside it**. When a change
6-cannot be expressed in this language, the language gets amended here first — in the same diff —
7-never silently violated.
8 4
9-Visual reference (playable mock, v16).5+**Reference artifact** (the approved visual reference). It has three tabs: "Main screen", "Panels" and "Keys".
6+
7+**Precedence:** where this document and the mock disagree, this document wins. Where this document is silent, the mock is the reference.
8+
9+Contents: 1 Thesis · 2 Tokens · 3 Identity elements · 4 Comfort rules · 5 Layout · 6 Regions · 7 Timeline behaviour · 8 Feedback · 9 Tool panels · 10 Keys · 11 Adding a feature · 12 Implementation plan
10 10
11 ---11 ---
12 12
13 ## 1. Thesis13 ## 1. Thesis
14 14
15-**The film paints the tool. The tool itself is achromatic.**15+edith is still the darkroom. Its chrome is colourless. The only colour comes from the footage, in the form of film inks. Pure white is the lamp: the playhead, its tab, and splice flashes.
16+
17+**What changed.** The previous design ("Darkroom", 2026-08, deleted 2026-10-15) was optimised for an expert who already knew every key. Round after round it removed visible controls. The result:
18+
19+- 48 of its 77 actions had no visible control.
20+- Text was dim 13px (3.4:1 and 2.0:1 contrast).
21+- Hit targets were 6–13px.
22+- The timeline was a cramped 200px.
23+- Feedback was invisible.
24+
25+The user found it "hard to use… not comfortable".
16 26
17-edith is a darkroom: a dim, stable, monochrome room whose only colors are extracted from the27+**New thesis: keep the room, light the tools.** Every command is visible somewhere, readable, and big enough to hit. Keys are accelerators. They are never the only door.
18-footage on the bench, and whose only pure white is the lamp — the playhead and the splices.
19-The editor sits in this room for eight to twelve hours; everything below exists to keep that
20-person in their groove.
21 28
22-Three laws derive everything else:29+**Three laws**
23 30
24-1. **Chrome is achromatic.** No panel, button, tab, slider, or scrollbar carries a hue. Loudness31+1. **Chrome is achromatic.** Film inks mark identity only: spines, waveforms, the overview strip, dots, meters and curves.
25- is luminance, never saturation.32+2. **Comfort rules (§4) are hard floors, not taste.**
26-2. **Film-extracted inks are the only color.** Each source contributes one ink, quantized from33+3. **Identity is kept, not calmed.** The user explicitly chose the first draft over a "calmer" one ("first draft feels more original"). Do not tone down the identity elements listed in §3.
27- its own frames (hue kept; saturation/lightness clamped into the WCAG-passing band). Inks mark34+
28- *identity* — spines, waveforms, traces, dots — never chrome.35+---
29-3. **White is the lamp.** `#FFFFFF` is reserved for the playhead, its flag, and splice marks.
30- Nothing else may be pure white.
31 36
32 ## 2. Tokens37 ## 2. Tokens
33 38
34-Surfaces (dark-only; no light theme, ever):39+### 2.1 Surfaces and inks (default palette)
40+
41+These are the mock's values.
35 42
36-| Token | Value | Role |43+| Token | Hex | Use |
37 |---|---|---|44 |---|---|---|
38-| `canvas` | `#050607` | app ground, bench background |45+| canvas | `#0B0C0E` | Window background, viewer surround |
39-| `panel` | `#0E1013` | dock, ledger, plates' parent surfaces |46+| panel | `#131518` | Dock, lane heads, status bar |
40-| `raised` | `#14171B` – `#17191D` | hover fill step, active verb fill |47+| raised | `#1B1E22` | Buttons, fields, the Play button |
41-| `hairline` | `#22262B` | 1px separations *within* a panel |48+| hover | `#24282D` | Hover fill |
42-| seam | `rgba(0,0,0,.7)` | 1px panel-to-panel boundary |49+| hairline | `#2A2E34` | Dividers only (decorative; need not reach 3:1) |
43-| plate | `#050607` on `panel` | readout/notice/menu/cue body |50+| edge | `#6E757D` | Boundary of a control that must read as a control (Export chip, fields, tracks). ≥3:1 on canvas, panel, raised and hover (WCAG 1.4.11) |
51+| seam | `#000000` | Gaps between regions |
52+| ink1 | `#E8EAED` | Primary text |
53+| ink2 | `#B4BAC1` | Secondary text |
54+| ink3 | `#8D959E` | Labels, keys, metadata. ≥4.5:1 on canvas and panel |
55+| ink4 | `#777F88` | Disabled controls **only**. Never for information. Spec: ≥3.6:1 on canvas, panel, raised and hover (3.7 on hover, 5.0 on canvas). Disabled is exempt from WCAG 1.4.3, and staying below ink3 (≥4.9) keeps disabled distinguishable from enabled |
56+| lamp | `#FFFFFF` | Playhead only |
57+| warn | `#D1B564` | Warnings |
58+| err | `#E07A7A` | Errors. ≥4.5:1 on every surface including hover (5.1) |
59+
60+### 2.2 Film inks
61+
62+- Extracted per source at import. The hue is kept. Saturation and lightness are clamped so each ink passes 3:1 on canvas.
63+- Reference inks: azure `#64B5D1`, magenta `#D164B5`, green `#64D19A`.
64+- The colour wheel caps at 12 hues.
65+
66+### 2.3 Palettes
67+
68+- Other palettes in Settings stay selectable.
69+- Every palette must pass the contrast numbers in §4. A palette that does not pass is a bug.
70+- The guard test `no_colour_is_written_outside_the_theme` stays. No colour literal may appear at a call site.
71+
72+### 2.4 Type
73+
74+- **Archivo** is the UI voice (weights 400, 500, 700).
75+- **Spline Sans Mono** is for data: timecode, keys, values and metadata.
76+
77+| Role | Size | Face |
78+|---|---|---|
79+| Transport timecode | 20px | Mono 500 |
80+| Panel titles | 15px | Archivo 700 |
81+| Body, labels, buttons | 14px | Archivo 500 |
82+| Keys and values | 13px | Mono |
83+| Section heads (uppercase, +0.08em, ink3) and ruler labels | 12px | — |
44 84
45-Ink (text) ladder — four levels, all WCAG ≥4.5:1 on their surfaces:85+- **12px is the floor.**
86+- Whole pixels only.
87+- Use tabular figures wherever digits align.
46 88
47-| Token | Value | Role |89+### 2.5 Radii and shadow
48-|---|---|---|90+
49-| `ink1` | `#E6E9EC` | primary: values, active labels, timecode digits |91+- 0px: clips, lanes, regions.
50-| `ink2` | `#9BA3AC` | secondary: labels, resting verbs, cue text |92+- 4px: buttons, chips, fields.
51-| `ink3` | `#5E656D` | tertiary: chords at rest, metadata, section heads |93+- 6px: menus, sheets, toasts.
52-| `ink4` | `#3C4249` | faintest: decaying notices, dimmed-room hints |94+- Shadow appears only on floating plates: menus, the command palette, sheets and toasts.
53-95+
54-Film inks: extracted per source at import (quantize dominant hues → clamp S/L into the contrast96+---
55-band). Reference extraction from the standing test frame: azure `#64B5D1`, magenta `#D164B5`,97+
56-green `#64D19A`, violet `#7F64D1`, teal `#64D1D1`. The wheel caps at **12 hues**; beyond 12,98+## 3. Identity elements
57-hues repeat and the name plate carries identity (the dot was always the secondary cue).99+
58-Selection uses the complement-leaning second ink (magenta against azure), not a chrome accent.100+Keep these exactly. Do not "clean them up".
59-101+
60-**Ink demotion rule:** extraction is ambient — it just happens. Re-inking a source is a102+- **Overview strip.** A 14px band above the ruler. Each clip is drawn in its film ink across its span. Audio appears as thin translucent slivers. A white playhead tick sits on it. A draggable 1px ink1 window box marks the visible area.
61-once-a-project act and lives behind right-click on the source's dot. Ink controls never occupy103+- **Words on the toolbar.** Every edit-toolbar button shows glyph, word and key, for example `✂ Split S`. Only zoom − and + are glyph-only.
62-the Sources tab, a toolbar, or any burst-use surface.104+- **Typographic lane glyphs.** ◉ hides (video and subtitle), ♪ mutes (audio), ▣ locks. They are ink3 at rest. When off, the glyph is struck through in ink1. These are not SVG icons. The user chose them.
63-105+- **Clip anatomy.**
64-**Safelight:** the empty room (no footage) is warm monochrome (`#0A0908` family) with amber106+ - A 3px film-ink spine on the left edge.
65-`#FF9D57` on exactly one glyph. When footage lands, a 900ms skippable film-leader fade hands the107+ - Film-tinted thumbnails for video, or a waveform in the clip's ink for audio.
66-room to the film's inks. The 12 legacy palettes survive only as safelight hue choices.108+ - View > Audio waveforms (saved with the project's view) off: audio clips are a flat bar in their colour with the name only.
67-109+ - A name plate top-left: mono 12px on a dim plate.
68-Guard: the existing `no_colour_is_written_outside_the_theme` test remains the enforcement110+ - 1px splice gaps between clips.
69-mechanism — every value above is a theme token, never a literal at a call site.111+- **One box per surface.** The bordered strong button is reserved for the commit action: Export, or Apply and Remove inside a tool. Small bordered `+ Add` buttons in the Media list are the one accepted secondary box. They are per-row, small and ink2.
70-112+- Glyphs are hand-drawn or typographic. No icon asset packs.
71-## 3. Type113+
72-114+---
73-Two faces, fixed roles (bundled, no runtime deps):115+
74-116+## 4. Comfort rules
75-- **Archivo** — the room's voice: labels, verbs, section heads. Weights 400/500/700.117+
76-- **Spline Sans Mono** — everything the film says: timecode, chords, readouts, metadata,118+These are hard floors. Each one is testable.
77- cue text, the ledger. Mono = data; if a string is *about the footage or a key*, it is mono.119+
78-120+1. **Contrast.** Any text that carries information is ≥4.5:1 against its surface. ink4 is used only for disabled controls.
79-Scale: 18px hero timecode (700, colons in `ink3`) · 15px labels/rows (500) · 13–14px chords121+ Non-text: a control's boundary is `edge` (≥3:1). The focus ring is 2px `ink1`, drawn outside the control (no layout shift) on every control that holds keyboard focus. The playhead is 2px at rest, 3px playing, with a 1px `seam` halo either side so it reads on every clip colour. The overview strip's window is a 2px `ink1` box with the film outside it dimmed by `seam`. The guard test `theme::tests::darkroom_token_pairs_meet_their_contrast_spec` fails if any pair drops below spec.
80-and metadata (500) · 12px section heads (Archivo 700, uppercase, +0.14em letter-spacing, `ink3`).122+2. **Size.** Nothing is below 12px. Body text and labels are 14px.
81-Room/column heads are 15px Archivo 700 `ink1`; in-list section heads stay 12px `ink3`123+3. **Targets.**
82-(2026-09-10 -- the settings columns read as body text and a person could not find them).124+ - Every pointer target is ≥24×24px. The hit area may exceed the drawn shape.
83-Settings itself is a tab strip since 2026-09-19 (one section shows at a time), so its heads are125+ - Clip trim zones: a 24px invisible hit zone centred on every clip edge (12px inside, 12px outside), with an `ew-resize` cursor. Where two clips meet, the clip on the pointer's side wins. On a clip narrower than 48px, the inside half shrinks so the middle third of the clip stays a move target.
84-gone: the tabs wear the dock's tab look instead -- 15px Archivo 500, the showing tab marked by a126+ - The selected clip also shows solid 12px trim handles.
85-1px `ink1` top rule and `ink1` text, the resting one `ink3`.127+ - Fade handles, grips and the playhead tab each have a ≥24px hit area.
86-Nothing below 10px. Every size is a whole pixel (no half-pixel sizes -- they put glyph baselines128+4. **Every action has a visible door.** It appears in the menu bar (§6) with its key. It can also be run from command search (Ctrl+K). The most frequent ~12 actions also sit on the edit toolbar or the transport. Right-click menus are a shortcut to the same verbs. They are never the only home.
87-off the pixel grid and blurred cosmic-text's AA). No italics. Tabular figures wherever digits129+5. **Keys are shown.** Every visible command shows its key, in mono ink3, wherever it appears: toolbar, menus, tooltips and panels.
88-align.130+6. **No hover-only controls.** Hover may brighten or fill. It never reveals a control that was not drawn.
89-131+7. **Tooltips** appear after 500ms (gpui 0.2.2's fixed delay) and show the name and key. For a disabled control, the tooltip gives the reason it cannot run. Example: Split shows "Put the playhead over a clip".
90-## 4. Ghost grammar — the control language132+8. **Refused actions grey out.** The control is drawn in ink4; its reason is written in ink3, so the reason stays readable. They never vanish. Actions a media kind can never use (EQ on a picture, for example) are hidden in that context. That is a class refusal, not a momentary one.
91-133+9. **Feedback for every action.** Each action produces a toast (§8). There are no silent no-ops.
92-- **Flow controls are ghosts:** borderless glyph + dim chord (`ink2` glyph, `ink3` chord).134+10. **Selection and focus.**
93- Hover = one fill step (`raised`) + ink brighten. Active = `ink1` + fill. No borders, no boxes,135+ - A selected clip has a 2px ink1 outline and visible trim handles.
94- no icon assets — glyphs are hand-drawn/typographic.136+ - Linked audio selects together with its picture.
95-- **Boxes are commitments:** the single bordered chip is reserved for commit-class actions137+ - A focused region has a 1px ink2 top rule.
96- (Export). If a second boxed control ever appears on one surface, one of them is wrong.138+11. **Words.** Use sentence case and plain language. No ALL-CAPS messages. Short hints of ≤6 words are allowed in empty states and empty lanes, for example "Drop a video here" or "Drag media here to layer it". Paragraphs of instruction are not allowed.
97-- **Readouts are plates:** dark (`canvas`-on-`panel`) rectangles carrying mono text. Notices,139+12. **Occlusion.** Nothing covers the picture except menus and dropdowns, the command palette, and the centred Settings sheet. All of these are transient and close on Esc or on a click away. Nothing ever covers the timeline. Export is a dock tab, not a sheet.
98- menus, chips, cues, and tooltips are all the same plate.140+
99-- **Every command wears its chord**, everywhere it appears — right-click menus, regional verbs,141+---
100- the ledger's room verbs, the KEYS tab. Nothing lives only in a menu; nothing lives only on a142+
101- key. (This kills the shortcut-sync defect class permanently: the UI *is* the shortcut sheet.)143+## 5. Layout
102-- **The most-read element anchors its region** — timecode leads the time band; the film leads144+
103- the room.145+The default reference size is 1440×860. Proportions scale with the window.
104-- Radii: 0 for lanes/clips/room chrome · 2px plates · 3px verbs/controls · 4–6px floating
105- (menus, sheets). No pills, no circles except source dots.
106-- Hover never adds hue. Selection ring = 1px `ink1` on the selected thing (lamp-adjacent, not colored); regions never draw a focus ring (user 2026-09-10).
107-
108-## 5. The stance — layout
109-
110-Fixed geography; nothing moves, nothing occludes the picture:
111 146
112 ```147 ```
113-┌─────────────────────────────────┬──────┐148++----------------------------------------------------------------------------+
114-│ SCREEN │ │149+| menu bar 32 (full width) |
115-│ (picture — top, never │ dock │150++-------------------------------------------------------+--------------------+
116-│ occluded) │ Src/ │151+| viewer (flex) | dock 320 |
117-│ │ Clip │152+| | Media | Clip tabs |
118-├─────────────────────────────────┤ KEYS │153++-------------------------------------------------------+ |
119-│ TIME BAND: timecode → |◂ ▶ ▸| │ tabs │154+| transport 44 | |
120-│ → cut 14/37 → contact strip │ │155++-------------------------------------------------------+ |
121-│ (with the in/out grips) │ │156+| edit toolbar 44 | |
122-│ → [Export] │ │157++-------------------------------------------------------+ |
123-├─────────────────────────────────┤ │158+| overview strip 14 | |
124-│ ruler · lanes • V1 • A1 • S1 │ │159++-------------------------------------------------------+ |
125-├─────────────────────────────────┤ │160+| ruler 26 | |
126-│ name · saved | last action | │ │161++-------------------------------------------------------+ |
127-│ room verbs · position │ │162+| lanes | |
128-└─────────────────────────────────┴──────┘163++-------------------------------------------------------+--------------------+
164+| status bar 30 (full width) |
165++----------------------------------------------------------------------------+
129 ```166 ```
130 167
131-- **Screen**: the picture. Never covered — not by drawers, notices, drags, or menus. Two-up168+- **Timeline block.** The block from the edit toolbar down to the lanes defaults to about 42% of window height. The seam between viewer and timeline is draggable, and its position is remembered.
132- OUT|IN judging renders *in* the screen at rest on a cut.169+- **Dock.** It sits on the right. The default width is 320px. It is resizable from 280px up to ⅓ of the window width, and the width is remembered.
133-- **Time band**: timecode leads; one transport (`|◂ ▶ ▸|` — frame back, play/pause, frame170+- **Lane heads** are 156px wide. Each shows a 16px source-patch box first (V on video lanes, A on audio lanes; shown only while the source viewer has an item loaded, the slot is reserved otherwise), then a film dot, the name (14px ink1) and the glyph toggles. A lit box sends F9/F10 source edits to that lane.
134- forward); the cut odometer (`14/37`, and the word `roll` only while roll is armed); the171+- **Lane heights.** Video 64px, audio 52px, subtitle 32px, empty layer 40px. Each is resizable from 28px to 120px by dragging its bottom edge. Double-click resets it.
135- **contact strip** (whole-film motion-trace minimap, viewport bracket with grip notches — click172+- **Scrolling.** Lanes beyond the visible area scroll under a pinned ruler and pinned lane heads.
136- jumps, drag scrubs, the bracket's notches pan; the export range's **in/out marks are two `ink1`173+- **Clip degradation by width.**
137- grips on the strip at their own film positions**, draggable to set the mark, drawn only once a174+ - Under 60px: drop the name plate.
138- mark exists and taking the pointer within ±6px); boxed **Export** at the end.175+ - Under 24px: drop thumbnails or waveform, leaving a solid ink fill and the spine.
139-176+ - Names ellipsize. They are never cut mid-glyph.
140-**Amendment (2026-09-10), "cleanse round 2"** (user: "seems cool, let's apply"): the band holds177+- **Continuity.** A project reopens exactly as it was left: playhead, selection, zoom, scroll, dock tab, lane heights and splits.
141-five things and nothing else. The shuttle pair (`◀◀ ▶▶`), home/end, the sync points, the loop178+
142-toggle, the monitoring cluster (mute, level slider, percent), the `I O ×` marks trio and `Save`179+---
143-all left it — each keeps its chord and its KEYS-tab row, the ruler menu keeps the verbs that act180+
144-on the ruler, the marks became the strip's grips, and the ledger already says `saved`/`unsaved ·181+## 6. Regions
145-^s`. The picture's `scale 0.59` corner readout is deleted with them: fit is `^0`, and the number182+
146-was a state nobody acts on.183+### 6.1 Menu bar
147-- **Bench**: the ruler row, then lanes. Clip anatomy = ink spine (3px left edge) + real184+
148- thumbnails/waveform in the source's ink + name plate + splice gaps in lamp white. A lane head185+- Left: the `edith` wordmark, then File · Edit · Clip · Timeline · View · Help.
149- is a source dot and the lane's name (`• V1`, 60px) and nothing else; the name plate carries186+- Right: the project name, then `Saved` or `Unsaved — Save Ctrl+S`. The latter is a button.
150- the file's name without its extension (`files::stem`), and only once per source — the audio187+- Menu rows are 28px tall: label on the left, key right-aligned. A disabled row shows its reason in place of the key. Toggles show checkmarks: Snap, Loop, Subtitles.
151- half of a linked insert has no plate, because the picture plate directly above it and the188+
152- shared dot already say whose it is.189+Menu contents, exactly as in the mock:
153-- **Ledger**: project identity (`name · saved`, extension dropped), last action, export190+
154- progress, and at the191+| Menu | Entries |
155- right end, before the position: the **room verbs** as ghosts (`CC t · settings ^, · keys ? ·192+|---|---|
156- full f11`) — the four commands that act on the room itself and so have no thing under the193+| File | New project · New from template ▸ (the built-ins and saved templates) · Open project… · Import media… Ctrl+I · Paste path · Import subtitles… Ctrl+Shift+I · Save · Save as template… · Export… E · Export captions… (a sheet: name and SRT or WebVTT, no picker) · Export timeline as ▸ (OpenTimelineIO… · Final Cut Pro XML… · EDL…; written to the export folder, the path in a toast) · Import OpenTimelineIO… (a new sequence) · Settings… Ctrl+, |
157- cursor to be right-clicked on. `ink3` + chord, hover raises to `ink2` with the room's own194+| Edit | Undo · Redo · Cut / Copy / Paste · Insert / Overwrite source F9 / F10 · Select all · Deselect |
158- plate, `CC` reads `ink1` + fill while subtitles are shown. State lives here, notices rise195+| Clip | Split S · Delete · Lift ; · Ripple start to playhead Q · Ripple end to playhead W · Trim start / end to playhead Alt+Q / Alt+W · Speed… · Colour… · Transform… · Equalizer… · Silence… · Fit policy… (Alt+1…) · Group · Detach audio |
159- from here. When the project is unsaved the state word is not a word but a door:196+| Timeline | Mark in / out · Clear marks · Record voice-over… (a sheet: input, lane, level meter, Record and Stop) · Zoom in / out / Fit · Snap · Add track / Remove track |
160- `unsaved ^s`, the same room-verb ghost, and clicking it saves — this is Save's home.197+| View | Play/Pause · J/K/L · Loop · Go to start / end · Subtitles · Audio scrubbing · Full screen |
161-- **Dock** (right, the only side panel): SOURCES tab and CLIP tab; the keys list is dock-body198+| Help | Command search Ctrl+K · Keyboard shortcuts ? |
162- state behind `?` / the ledger's `keys ?`, not a tab (user 2026-09-09).199+
163- **Cleanse round 2 (2026-09-10):** SOURCES is a filter and *one* list. The filter is the glass200+A template keeps the frame rate, size, lanes, lane names, caption style and export preset of a project; "Keep clips" (off by default) keeps the clips too. The welcome screen's From template opens the same list as a dropdown beside New project.
164- alone (`⌕`, no placeholder word); the list holds every source together — picture, sound and201+
165- subtitle tracks — in arrival order, with no `Media / Audio / Text` sub-tabs, no sort row, no202+### 6.2 Viewer
166- `MEDIA` or `IMPORT` head. A row is: dot · name **without its extension** (ellipsized, ≥60% of203+
167- the width) · one right-edge ghost `+↵`; under it one metadata line, `H.264 · 01:39:18 · V1 A1`204+- The picture is letterboxed and centred, with 12px padding.
168- — codec, length, the lanes that play it (no decoder seat, no use count), which is also where a205+- Compare grade (View menu, or the Compare row on the Colour card) shows the picture as shot beside the graded one. Split is a vertical wipe at the centre of the picture: as shot on the left, graded on the right, with a light divider the picture's height. Side by side fits each half in its own side of the viewer. Each view has a "Before" and an "After" caption inside the picture, at the bottom left of its half, and the picture shows no selection box or handles while it is on. Compare is for looking only and is never exported.
169- row says what kind it is. Preview is a double-click or the row menu's `Preview`; the stand-in206+- Nothing is drawn over the picture and nothing appears under it: no info chip, no OUT | IN strip, so selecting a clip never resizes or crops the picture. the timecode is the transport's, and the clip's name is the status bar's.
170- is that menu's `Proxy` plus Settings. The foot is one row, `Add ^o`, and it takes a `.srt`/207+
171- `.vtt` as readily as an `.mkv`; `Paste path ^l` and `Import subtitles ^i` keep their strokes,208+### 6.3 Transport
172- their KEYS rows and the dock's own right-click menu. Empty list: the one noun `none`.209+
173- CLIP tab: the per-clip verbs (Speed / Colour / Transform / EQ / Silence / Mix / Fit) as plain210+- Left: the big timecode. Its colons are ink3.
174- ghost rows — label + chord, no head styling — over the param rows they open.211+- Centre: Go to start · Back one frame · Play/Pause (raised button) · Forward one frame · Go to end.
175-212+- Right: Loop, and a volume slider.
176-**Amendment (2026-09-10), "cleanse round 2":** the `BENCH` and `LEDGER` section heads are213+- There is no viewer "Fit" control. It duplicated the timeline Fit.
177-deleted — the geography says what a region is, and a label above it is a second saying. The214+
178-ruler row is the bench's own top edge (the seam's grab band no longer reaches past it, since the215+### 6.4 Edit toolbar
179-ruler answers presses itself), and the ledger's first word is the project. `all ^a` leaves the216+
180-ruler's right edge for the ruler's own right-click menu; the lane head's `≋` mix and `×` remove217+Groups, left to right:
181-leave the head for the head's own right-click menu, where they still act on the lane that was218+
182-clicked. Every one of them keeps its chord and its KEYS row: nothing lost a door, each one moved219+- [✂ Split S · ⌫ Delete · ⇤ Lift ;]
183-to the thing it acts on, which is the "option C" rule below applied a second time. Save moves220+- [↶ Undo Ctrl+Z · ↷ Redo Ctrl+Y]
184-the same way: the time band's ghost — parked there only because the ledger was another221+- [⧉ Snap N (toggle) · [ Mark in I · ] Mark out O]
185-builder's file at the time — is deleted, and the ledger's own state word is its door.222+- then, pushed right: [− zoom slider + · Fit Ctrl+0]
186-223+- then [Export E], the commit box.
187-**Amendment (2026-09-09), user decision "option C":** there is no rail. The 56px spine — every224+
188-command as a ghost glyph + chord down the left edge — is deleted, and the picture, time band,225+### 6.5 Overview strip and ruler
189-bench and ledger take its width. Nothing on screen lists the room's commands, because **the226+
190-geography of a verb is the thing it acts on**: a verb reaches its target by right-click on that227+- The overview strip is described in §3.
191-target, by its key, and says its own name through the hover plate under the pointer. The one228+- The ruler uses adaptive ticks. Labels are at least 80px apart. Steps run from 1 frame to 1 minute. Labels are mono 12px ink3.
192-list left is the dock's **KEYS** tab (§9), and the one exception is the ledger's room verbs229+- The playhead's lamp tab on the ruler is grabbable, with a 24px hit area.
193-above — those four act on the room, which is not a thing the cursor can be over.230+- The playhead line is 1px at rest and 2px while playing.
194-231+- Render bar: a 3px strip along the ruler's top edge, laid over it so no height changes. Green where a render preview matches the timeline; amber where a clip with effects, colour, transform, speed, fades or transitions has none yet. Nothing is drawn elsewhere. Timeline menu: Render preview (in to out) (Enter), Render preview (whole timeline), Cancel render preview, Delete render files. While a render runs, its stretch fills green from the left as it goes, and Cancel render preview is enabled; the result comes back as a notice.
195-Session continuity: a room reopens exactly as left — playhead, subject cut, viewport, dock tab.232+
196-233+### 6.6 Lanes
197-## 6. Cut machinery — the interaction core234+
198-235+Described in §5 and §7.
199-The cut is the subject. Grammar (implement before any cosmetics):236+
200-237+### 6.7 Dock: Media tab
201-- `,` `.` — walk cuts (shift = stride 10). The cut readout is the odometer.238+
202-- `[` `]` — no-aim trim of the subject cut, frame detents, works at any zoom (even 4px clips).239+- A search field at the top.
203-- `ctrl+{` `ctrl+}` — trim-to-playhead (debt #42): snaps the subject cut's in/out edge straight to240+- Rows are 56px tall. Each row holds: a dot, the name without its extension, a mono meta line such as `H.264 · 00:09:15 · 1080p`, and a `+ Add` button.
204- the playhead, one press, one undo step -- the keyboard's own version of dragging the edge to a241+- Double-click adds the item at the playhead.
205- spot instead of nudging it a detent at a time. Needs a subject cut with the playhead resting on242+- Right-click opens the source menu: Add to timeline ↵ · Add at playhead · Preview Space · Make proxy · Reveal in files · Properties · — · Remove from library · Remove with its clips (shown in err on hover).
206- it, same as the pair above.243+- Footer: `+ Import media… Ctrl+I`.
207-- `/` — loop-trim: loop around the subject cut while trimming (the modernized Avid trim mode).244+- Empty state: "No media yet", followed by the import button.
208-- Two-up OUT|IN on the screen when resting on a cut.245+
209-- `j k l` — shuttle; `s` — split; `↵` context-dependent commit; `esc` always retreats.246+### 6.8 Dock: Clip tab
210-- Param rows: drag while playing; value ghosts on the frame; `r` resets; live row takes the ink.247+
211-- Colour verb: `v` holds previous shot beside current (matching is comparative).248+- Nothing selected: "Select a clip to adjust it", with "or press Tab" in ink3.
212-- Subtitle cues: cue edge is a cut — the same `,` `.` `[` `]` grammar applies; text edits on the249+- Selected: a header (name, then the mono span), then tool rows.
213- picture where subtitles live.250+ - Each tool row is 44px tall. The name is on the left and the current value on the right. The value is ink3 at default and ink1 when changed.
214-251+ - Rows expand in place. Several may be open at once. Open state is remembered.
215-## 7. Scale — the degradation ladder252+- Bottom: `Delete clip`.
216-253+- Cards (Speed, Colour, Transform, EQ, Silence, Mix, Markers, History, Tools): History lists the undo steps newest first, the current step marked with a dot; clicking a step jumps to it.
217-Clips degrade **by width, one layer per threshold**, never all at once:254+- Cards (Speed, Colour, Transform, EQ, Silence, Mix, Markers, Tools): the verb list is the tab's home. Opening a card replaces the list in the same place, always. One shared frame: a head row (`←` back to the list, the title with the clip name, `Reset all` where it applies, `✕` close), then the body at the same padding, 6px section gap, label column and type scale. No card floats over the viewer or the timeline; Esc and `←` return to the list. A tooltip is shown only where it adds something (a chord, a reason).
218-full anatomy (thumbnails, trace, plates, chips) → drop chips → drop labels (<48px; labels never255+- Effects card: the stack runs top to bottom, one row per effect with its on switch, move arrows and remove. A rect or ellipse mask's position and size rows (Centre across, Centre down, Width, Height) sit under a keyframe diamond: clicking it keys the mask at the playhead, and the diamond shows green while the playhead is on a key. Keyed masks show their keys as marks on the clip's ruler. A mask's last row is a Track row: "Track backward" and "Track forward" follow the picture under the mask from the playhead; while it runs the row reads "Tracking N%" with a Cancel, and the finished path lands as keys.
219-truncate into soup) → spine + trace only → sliver fill + splice gaps (film scale). Navigation256+
220-never depends on pixels: `,` `.` + contact strip work identically at 100 clips. Lanes compress257+### 6.9 Status bar
221-evenly to 5, then scroll behind the pinned ruler and track heads.258+
222-259+- Left: the selected clip or gap readout, such as `city_dusk · 00:00:00:00 → 00:00:09:15 · 9.5s`. During an export, `Exporting N%` shows on the left too.
223-## 8. Notices — how the room speaks260+- Right: `1920×1080 · 30 fps` · `Ctrl+K Commands` · `? Shortcuts`.
224-261+- The project name and Saved or Unsaved are in the menu bar (§6.1), not here.
225-No full-width bars, no covering the picture, ever. A notice is a plate rising above the ledger,262+
226-one at a time; severity is a **3px left spine**, not a color flood:263+---
227-264+
228-- grey `#5E656D` — *told you* (self-fades)265+## 7. Timeline behaviour
229-- amber `#D1B564` — *worth a look* (carries a jump action: `go to cut ,31`)266+
230-- red `#C85050` — *needs a decision* (the decision is on the plate: `relink ↵ / later esc`)267+- **Zoom.** A new project opens at 60 px/s. Fit (Ctrl+0 or the button) fits the whole edit with about a 2% margin. The zoom keys are = and -. Ctrl+wheel zooms about the pointer. A plain wheel scrolls horizontally. A thin 8px scrollbar sits under the lanes.
231-268+- **Imports.** The first import into an empty timeline lands on it and fits. Later imports go to Media.
232-Every failure names its remedy, and the wound stays visible where it lives (dark clips in the269+- **Insert.** Double-click, `+ Add` and ↵ insert at the playhead. Dragging and dropping onto a lane inserts at the drop point.
233-lane). **A refusal string is a claim:** shipping "cannot be decoded" requires a test proving the270+- **Trim.** Drag an edge. A plate shows the delta and the new length, for example `+00:12 · 9.5s → 10.0s`. Trimming stops at the source's media limit, with a 120ms warn flash.
234-capability is genuinely absent — otherwise it is a bug, not a message. A verb the current *state*271+- **Move.** While dragging, a translucent ghost shows the target and the original is dimmed. While snapping is active, a 1px ink1 guide runs through all lanes.
235-refuses (in menus) greys out with its reason on hover; it never disappears. A verb the selected272+- **Gaps.** Gaps are drawn hatched in ink4. Clicking a gap selects it (1px ink2 outline) and shows an inline `Close gap` button. Delete closes the gap.
236-clip's *media kind* can never use (a grade on sound, an equalizer on a picture) is hidden outright273+- **Right-click menus** exist for clips, gaps, lane heads, the ruler and Media rows. They use the same plate style, show keys, and place destructive verbs below a rule.
237-instead — a class refusal, not a moment's answer the next click could change (user 2026-08-27).274+- **Lanes.**
238-275+ - Hide, mute and lock use the glyphs in §3.
239-**Hide-until-hover for controls/verbs is rejected (user 2026-08-27: "simplify it not hide the276+ - Hidden and muted lanes dim to 40%.
240-things").** A control's visibility never gates on pointer position — hover may brighten or fill a277+ - Locked lanes refuse selection and edits. The refusal comes with a toast that offers Unlock.
241-control already on screen, but a verb group that needs thinning gets thinned by subtraction278+ - Tracks are added and removed from the lane-head menu or the Timeline menu.
242-(compact rows, plain always-visible group labels, smaller type) or dropped outright, never hidden279+- **Subtitle cues.** They use the same trim and move behaviour as clips. Double-click edits the text inline. Enter commits and Esc cancels.
243-behind a hover/expand/collapse.280+- **Undo.** Undo covers every timeline edit, one step per gesture.
244-281+- **Clip volume line.** On a selected audio clip the line is editable. Ctrl+click on the line adds a key where it is. Drag a key to move it in time and dB (a plate shows the dB while dragging). Drag the line between two keys to move both. Double-click a key, or pick it and press Delete, to remove it. Each gesture is one undo step. Keys are dots when the audio lane is tall. The cursor changes over the line and the keys.
245-**No instructional copy (rejected pattern, user 2026-08-27).** The room never explains itself in282+- **Audible scrub.** While the ruler is dragged and playback is paused, a short snippet plays at each new position. View > Audio scrubbing switches it, on by default, and the choice is saved with the view.
246-prose: no "pick a verb above", no "type to filter — name, codec, unused…", no "Import, or drop a283+
247-file on the window". Empty states are empty (or a single noun); placeholders are one word or284+---
248-absent; a control's use is taught by its chord and its geography (§4, §9), never by a sentence.285+
249-Telling the editor what to do is the keys overlay's job on request — not ambient text. Any new286+## 8. Feedback
250-string over ~4 words that instructs rather than reports state is a defect.287+
251-288+- **Toasts** rise above the status bar at the bottom-left of the timeline. They never cover the picture. At most 3 are stacked. Each has a 3px left stripe: ink3 for info, warn or err. The text is 14px ink1. An optional action may appear: Undo, Unlock, or Show in folder.
252-## 9. Menus and the keys overlay289+- **Auto-hide.** Info and warn toasts hide after 5s. Errors stay until dismissed. Errors always name the remedy.
253-290+- **Refusal strings are claims.** "cannot be decoded" may ship only together with a test that proves the capability is absent.
254-- **Right-click = verbs of the thing under the cursor** (clip menu: clip verbs; lane head: lane291+- **Long work shows progress where it happens.**
255- verbs; source dot: ink acts). Plate styling, chords on every row, destructive verbs below a292+ - Import: status bar, with cancel.
256- rule line. Never a junk drawer.293+ - Export: sheet or status bar, with ETA and cancel. Cancel asks for an inline confirmation.
257-294+ - Silence scan: the count updates live.
258- **Amendment (2026-09-09), R4:** the floor a menu is kept below is the picture's **painted295+ - Proxies: row meta reads "proxy 42%".
259- edge**, not the screen region's bottom. The region letterboxes — with a 3840x1608 film in a296+- **Dropped frames.** While playing, the status bar's right edge says `Dropped N frames · try Half quality` once the picture has skipped frames (at full quality only). The slot is fixed-width and the words stay for 3 s after a stop.
260- 2560x1440 window ~99px of the region's bottom is black bar, not picture, and §5's "nothing297+
261- occludes the picture" has nothing to say about black. A menu takes that room (and may open298+---
262- *above* its pointer to use it), never a pixel of the frame; still too tall for what is left, it299+
263- scrolls inside its own plate as before.300+## 9. Tool panels
264-301+
265-- **`?` held** dims the room one fill step and surfaces chords *in place* beside their controls;302+The Panels tab of the reference artifact is the reference.
266- release restores, and a click on the scrim also dismisses it. Hold-to-peek, not a latch;303+
267- learning stays geographic. The film keeps playing.304+### 9.1 Shared anatomy
268-305+
269- **Amendment (2026-08-20), explicit per this section's own rule:** the geographic reading above306+1. Header: clip name, plus `Reset all`.
270- is only partly built and edith currently ships the fallback instead — named here rather than307+2. A picture of what the tool does: preview, histogram, curve, waveform or meters.
271- silently violated.308+3. At most 3–4 main controls.
272-309+4. The rest folded under a `More …` section. It is closed by default, and its state is remembered.
273- Fifteen of the keymap's 71 actions already have a geographic home in the darkroom stance today,310+5. Commit actions: a box for the commit, a ghost button for the alternative.
274- and every one of those wears its chord **permanently**, not gated on `?` (spine glyphs, the311+
275- time band's transport and Export chip, the dock's four Clip verbs) — a stronger reading of "the312+**Slider row.** The label is on the left and the value on the right, in mono. The value is ink3 at default and ink1 when changed. The track is 4px. The thumb is 14px, with a 24px hit area. A `Reset` ghost button appears only when the value is changed. Double-clicking the value resets it. Arrow keys step the value.
276- UI *is* the shortcut sheet" (§4) than "surfaces on hold" asks for, so nothing further was owed313+
277- those fifteen. The other 56 actions (`,` `.` `[` `]` shuttle strides, marks, clipboard, delete,314+### 9.2 Per tool
278- lift/detach/group/regroup, fit/resolution/zoom, subtitle add/style, silence, project cards,315+
279- etc.) have **no widget anywhere in the room** — burst-use surfaces (screen, bench, time band)316+- **Colour.** Live preview and a luma histogram. Controls: Brightness, Contrast, Saturation, Tint. An Auto colour button reads a correction off the clip as shot (grey-world white balance and a luma stretch to 2 % and 98 %) and writes it as one undo step; saturation, tint, lift, gamma, curves and the LUT are left as they are. A Look dropdown lists the eight built-in looks (Warm, Cool, Teal & orange, Bleach bypass, Black & white, Faded film, High contrast, Vintage) and the user's saved looks; picking one replaces the clip's colour as one undo step. Save current as look… opens a name field under the dropdown with Save and Cancel; saved looks are kept as plain text files in the user's data folder. A Compare row (Off, Split, Side by side) sets the viewer's compare view, which is preview only and never exported.
280- are the checklist's most expensive land (§11.1), and giving each of the 56 a geographic317+- **Transform.** Position X and Y (px), Scale (%), Rotation (°) with −90, 0, +90 and 180 chips. A CROP section holds a live crop diagram and four sliders.
281- placement is that many individual placement decisions across the bench, time band and dock, not318+- **Speed.** Chips for 0.25× to 4×. A log slider from 0.25× to 4×, which is the engine's real range. A readout shows the resulting length. Speed keeps pitch: the engine time-stretches the audio (WSOLA, `stretch.rs`), so a faster or slower clip keeps the voice and the notes at their original pitch.
282- one fix. Until that lands, `?` held keeps opening `ui::stance::keys_overlay`: a single scrolling319+- **Silence.** A waveform with silences shaded and counted live. A draggable threshold line. Controls: Apply to (take, track or every track), Threshold, Minimum silence. A `More timing` section holds Keep around speech, Ignore kept bits under, Level unit and Speed-up rate. Buttons: `Remove silences ↵` (the box) and `Speed them up F`. An `Invert` switch.
283- plate (plate styling per §4, positioned over the bench+ledger footprint so it never reaches the320+- **EQ.** A log-frequency graph (20 Hz to 20 kHz, ±18 dB view) with a live spectrum and draggable numbered bands.
284- screen — §11.6's occlusion check holds) listing every action by [`keymap::Category`]. It is a321+ - Drag adjusts frequency and gain. Wheel adjusts Q. Double-click resets a band. Clicking empty space adds a band.
285- cheat-sheet, and it is modal for as long as the key is held; both are accepted here rather than322+ - A band strip has type chips (Bell, Low shelf, High shelf, Low cut, High cut) and Freq, Gain and Q steppers.
286- hidden.323+ - Buttons: Add A, Remove X, Flatten R, Spectrum S, Bypass B.
287-324+- **Mix.** Channel strips: one per audio lane, plus Master. Each has a vertical fader (double-click sets 0 dB) and a meter with peak hold (warn above −6 dBFS, err above −1 dBFS). Each has Mute and Solo. Mute is saved with the project and exported. Solo is for listening only: it is not saved, and export ignores it. Master also holds the limiter toggle and the ceiling.
288- Ceiling to close this amendment: walk the 56 down to zero by giving each a home next to the325+ - On a selected audio clip, the Mix card also has a **Pitch** row: a typed value in semitones (`+3 semitones`, `0 semitones`) and a centred slider from −12 to +12 with a notch at 0. Pitch keeps the clip's length.
289- control it already has no visual presence beside (marks and clipboard on the time band's cut326+- **Visualizer.** A live preview. Style chips: Fill, Ribbon, Ring, Waveform, and Fast. Colour and Strand swatches, each with an inline hue ring and a hex value. Strands and Glow sliders. Visualizer colours may be any hue, because they are footage content, not chrome.
290- readout row; lift/detach/group/regroup as bench lane-head ghosts; fit/resolution/zoom on the327+- **Subtitle style.** A live preview. A font list, where each name is shown in its own face. Size. Outline (None, Thin, Thick). Background box. Position (Bottom, Top). A note reads "Saved for all projects. The preview shows the look only. Export writes soft subtitles (tx3g in MP4, S_TEXT/UTF8 in MKV), and the viewer's player draws them, so the look may differ slightly."
291- screen's own corner; subtitle/silence/project verbs into the dock next to the tab they already328+- **Title animation.** On the Title card, two dropdowns below the presets: Entrance and Exit (None, Fade, Typewriter, Slide up, Slide left, Pop, Word by word), then Animation length in seconds (a typed or dragged number, greyed until an animation is picked). Picking one moves the playhead to the title's start so the animation shows in the viewer.
292- belong to) — at which point the list deletes and `?` becomes pure dim, no list.329+- **Export (dock tab).** The dock's third tab, Media | Clip | Export. Opened by the Export key (E), File › Export…, the toolbar Export button or the tab itself. Leaving it is picking another tab (or Esc). There is no centred sheet and no scrim: the panel is in flow in the dock, so nothing covers the viewer or the timeline.
293-330+ - Layout: a scrolling body (wheel, and Up/Down/PageUp/PageDown/Home/End) over a fixed footer holding one full-width `Export` button. Every control is reachable by scrolling; a short window only scrolls more.
294- **Amendment (2026-09-09), explicit per this section's own rule:** the plate is deleted. The331+ - Settings state, top to bottom:
295- user asked why the spine ended in `?` over `?` and said of the plate it opened "it's not good,332+ - Presets, as compact two-line rows grouped Web video, Phones and social, Sound only, Archive, then Custom. Each row shows the name, a one-line spec (`1080p · H.264 · 8 Mb/s`, `M4A · 128 kbps`) and a ✓ plus a raised fill on the chosen one. The rows come from the engine's preset table (`export_presets`); the GUI keeps no copy of it. Custom is chosen whenever the settings match no preset.
296- I mean probably location problem" — a surface that appears out of nowhere over the bench, holds333+ - Range: Whole film or In–Out, each with its duration. In–Out is greyed with the reason when there are no valid marks.
297- the keyboard, and covers work. The list is now the **dock's third tab, `KEYS`, beside SOURCES334+ - Save as: Name and Folder fields, typed in place; the extension follows the format. `Choose… d` opens the desktop save dialog.
298- and CLIP**: stable geography, occluding nothing, scrolling like its neighbours, with the same335+ - Summary in plain words (duration, size, time), for example `1920×1080 · 30 fps · H.264 · 256 kbps sound · about 180 MB · about 1 min 40 s to export`. Warnings follow: upscaling, a very low bitrate, a sound-only file that drops the picture, no sound, WebM without subtitles.
299- registry-driven rows (`keys_rows`, section head per `keymap::Category`, label left, mono chord336+ - `▸ More settings`, closed by default and remembered, disclosed inline. It holds every detailed setting as visible lists or segmented choices: format, picture size, picture bitrate, bit depth (AV1), sound quality, loudness, the encoder seat, and what travels with the file.
300- `ink3` right) and no heading prose, since the tab strip itself is the way back. An action the337+ - Picture formats (PNG still, numbered PNG pictures, GIF) have no sound and no video rows. The summary says `PNG · 1280×720`, `PNG · 1280×720 · one per frame` or `GIF · 480×270 · 15 fps · loops`, with `Audio None`. A GIF adds Width (320, 480, 640 or 720 px), Frame rate (10, 15, 20 or 30 fps) and Loop as segmented or list choices. A numbered run's Name is the folder name, with no extension.
301- room would refuse right now greys to `ink4` like any refused verb (§8) rather than vanishing.338+ - The footer `Export ↵` is the one primary button. A refused format greys it and says why.
302- `?` swings the dock to that tab and a second `?` (or `escape`, or a press on another tab)339+ - Honest estimates. The size is "about X", or a span where a quality-driven encoder decides (GPU AV1). The time comes from a measured pace (a one-second software-seat trial write when the tab opens, deleted afterwards); until then it reads "estimating export time…", never a made-up number.
303- swings it back — a toggle, not a hold and not a modal: nothing about the KEYS tab owns the340+ - Encoder seat: Software is the default and is listed first. Auto and Hardware are named "GPU encoder…" and are used only when picked.
304- keyboard, so the film keeps playing and every other stroke keeps meaning what the keymap says341+ - Overwrite state: when the file exists and this window did not write it, the footer becomes "name already exists in this folder" with `Cancel Esc`, `Keep both k` and `Replace ↵`, inline in the panel.
305- it means. The ledger's `keys ?` ghost is the tab's pointer door and wears no second `?`,342+ - Progress state, in the same panel: the file name, a bar, `N% · elapsed · about M left`, the encoders in use, and `Cancel export` with an inline confirmation. Switching tab leaves the export running; the status bar keeps `Exporting N%`.
306- because its chord *is* its own name — the rule the deleted rail's last glyph was given.343+ - Done state: the file, its folder, size and time taken, with `Open folder`, `Play` and `Done ↵`.
307-344+ - Failed state: the engine's reason, with `Retry`, `Back to settings` and `Close`.
308- **Amendment (2026-09-09), user decision "option C":** the rail the fifteen chord-wearing345+- **Settings (centred sheet).**
309- glyphs stood on is deleted (§5). The ceiling above is unchanged in *count* but changes in346+ - Left-hand tabs: Project, Editor, Export defaults, Keys.
310- *shape*: a homeless action's geographic home is now the right-click menu of the thing it acts347+ - Each section states where its values are saved: "Saved in this project" or "Saved on this computer".
311- on, its key, and the hover plate — not a widget parked on a rail. The KEYS tab is what every348+ - Any non-obvious setting has a one-line description beneath it.
312- action still reads from.349+ - The Keys tab lists shortcuts and lets the user rebind them.
313-350+- **Properties (plate).** FILE: name, path with a Copy button, size, container. STREAMS: codec, size, rate, bit depth and bitrate for each stream. For a timeline clip, also THIS CLIP: source range and speed.
314-## 10. The joy layer351+
315-352+---
316-Game-feel, not gamification. All specs ≤150ms, ease-out, tied to real actions, honor353+
317-`prefers-reduced-motion`; all sound behind one toggle, −30dB, and **always silent while the354+## 10. Keys
318-film's own audio plays**.355+
319-356+### 10.1 Principles
320-- Split: 80ms white splice flash + dry mechanical tick.357+
321-- Trim nudge: 60ms detent per frame (rotary-encoder feel); held key = ratchet.358+- Cross-editor conventions come first. Premiere, Resolve, Shotcut and FCP mostly agree.
322-- Cut jump: 2-frame snap flash on arrival.359+- Single letters are used only for frequent, non-destructive verbs.
323-- Drop: 80ms magnetic settle + 1-frame squash. Never a teleport.360+- Nothing destructive sits on a bare letter. Delete and Backspace delete. `x` no longer does.
324-- JKL: optional pitch cue per speed step; blade leans 1px at 4×.361+- No chord may mean something else on a Linux desktop. Ctrl+Q (quit), Ctrl+W (close), Ctrl+T, Ctrl+L, Ctrl+M and Ctrl+H stay free or keep their usual meaning.
325-- Export: breathing ribbon on the boxed chip; film-leader countdown on open.362+- No two actions share a chord.
326-363+- Keys are rebindable in Settings → Keys.
327-**Never-list:** no badges, streaks, confetti, or celebration copy; nothing moves during playback364+
328-except the blade; no sound over film audio; no animation as decoration (every motion reports a365+### 10.2 Key table
329-state change).366+
330-367+| Action | Key |
331-## 11. Adding a feature — the checklist368+|---|---|
332-369+| Play/Pause | Space |
333-Before any new surface merges, it answers:370+| Shuttle reverse / pause / forward | J / K / L |
334-371+| Frame back / forward | ← / → |
335-1. **Frequency row:** which editor task, done how many times per hour, justifies its pixels?372+| Previous / next cut | ↑ / ↓ (also `,` / `.`) |
336- Burst-use surfaces (screen, bench, time band) are the most expensive land.373+| Start / End | Home / End |
337-2. **Grammar fit:** flow → ghost; commitment → the box (is it really commit-class?);374+| Mark in / out | I / O (on a previewed library item: the source's marks) |
338- readout → plate; identity → ink; alarm → notice spine.375+| Insert / Overwrite the previewed source at the playhead | F9 / F10 |
339-3. **Chord:** it has one, wears it everywhere it appears, and joins the `?` overlay.376+| Clear marks | Ctrl+U |
340-4. **Scale:** define its degradation ladder step-by-width before merge.377+| Split | S |
341-5. **Achromatic check:** zero new hues in chrome; film inks only for identity; white only if it378+| Delete | Delete / Backspace |
342- is literally the lamp.379+| Lift | ; |
343-6. **Occlusion check:** the picture stays visible; nothing floats over the screen. Accepted380+| Trim start / end to playhead | Q / W |
344- exceptions are named where they live: the held-`?` cheat-sheet (amendment above), and the381+| Nudge trim | [ / ] |
345- settings page, a centred modal since 2026-09-19 (user: the below-picture sheet covered the382+| Undo | Ctrl+Z |
346- timeline) — it floats over the screen while open, and closes on a click away or `esc`.383+| Redo | Ctrl+Y (Ctrl+Shift+Z once Shift chords exist) |
347-7. **States:** empty (safelight-composed, never bare), refusing (reason named), failing384+| Snap | N |
348- (notice plate with remedy).385+| Zoom in / out | = / - (also Ctrl+= / Ctrl+-) |
349-8. **Feel:** one ≤150ms motion spec from §10's vocabulary, or a stated reason for none.386+| Fit | \ or Ctrl+0 |
350-9. **Continuity:** its state survives room close/reopen.387+| Copy / Paste | Ctrl+C / Ctrl+V |
351-388+| Select all | Ctrl+A |
352-If a feature fails the checklist, either the feature changes or this document does — explicitly.389+| Deselect | Esc |
353-390+| Speed / Colour / Transform / EQ / Silence / Visualizer / Fit policy (clip tools) | Alt+1 / Alt+2 / Alt+3 / Alt+4 / Alt+5 / Alt+6 / Alt+7 |
354-## 12. Implementation order391+| Mix | F |
355-392+| Mute | M |
356-1. Token substrate in `crates/app/src/ui/theme.rs` (extend the 34-role system; keep the393+| Volume down / up | PageDown / PageUp |
357- `no_colour_is_written_outside_the_theme` guard green).394+| Subtitles | T |
358-2. The stance behind a flag (screen / time band / bench / ledger / dock skeleton).395+| Subtitle style | Y |
359-3. Cut machinery (`,` `.` `[` `]` `/`, two-up, readout) — before cosmetics.396+| Import media | Ctrl+I |
360-4. Dock (Sources assembly + Clip verbs).397+| Import subtitles | Ctrl+Shift+I |
361-5. Ink extraction + grading pipeline; source dots; selection ink.398+| Save | Ctrl+S |
362-6. Traces + contact strip.399+| Export | E |
363-7. Notices, session continuity, safelight empty room, `?` overlay.400+| Command search | Ctrl+K |
364-8. Joy layer last — it polishes verbs that already work.401+| Shortcuts | ? / F1 |
402+| Settings | Ctrl+, |
403+| Full screen | F11 |
404+| Screenshot | F12 |
405+
406+Keys printed inside a tool panel (EQ's A/X/R/S/B, Silence's ↵ and F) act only while that panel has focus, and override the global key there.
407+
408+The full 80-row mapping (today's 77 actions plus the three new J/K/L shuttle actions), from today's keys to the proposed ones with reasons, is the Keys tab of the reference artifact. Implementation updates `crates/app/src/keymap.rs` from it.
409+
410+### 10.3 Engineering prerequisites
411+
412+1. `Chord` must support Shift with letters. Today gpui drops Shift, and the parser refuses uppercase. This must land before Ctrl+Shift+I or Ctrl+Shift+Z can work.
413+2. J/K/L shuttle is a new action.
414+ - L plays forward. Each further press speeds it up: 1×, 2×, 4×, 8×.
415+ - J plays in reverse at 1×. A second press makes it 2×.
416+ - K stops.
417+ - Sound is muted above 1× and in reverse.
418+ - While reversing, L slows the reverse down.
419+
420+---
421+
422+## 11. Adding a feature
423+
424+Before a new surface merges, it must answer each of these:
425+
426+1. Which task is it, and how often is it used? That decides where it lives. It goes on the toolbar only if it is used many times an hour.
427+2. Its menu-bar entry and key (§4.4 and §4.5).
428+3. Contrast, size and target floors (§4.1 to §4.3).
429+4. Achromatic chrome. Film ink only for identity.
430+5. Empty, refused and failed states, with words (§4.8 and §8).
431+6. Degradation by width, if it lives on the timeline (§5).
432+7. A feedback toast (§8).
433+8. Continuity across reopen (§5).
434+9. A screenshot from the headless display, placed next to the reference artifact in the PR or commit description.
435+
436+If a feature cannot pass, change the feature, or amend this document in the same diff. Either way, state the change explicitly and give the reason.
437+
438+---
439+
440+## 12. Implementation plan
441+
442+Phases run from cheapest and biggest-win first. Each phase ends with headless screenshots compared against the reference artifact.
443+
444+- **A — Comfort floors.** Tokens and contrast (§2, §4.1 and §4.2). Hit targets (§4.3). Toasts (§8). Selection and focus (§4.10). Import lands on the timeline. Double-click adds.
445+- **B — Doors.** Menu bar with every action. Edit toolbar. Command search (Ctrl+K). Tooltips with keys and reasons. Keymap update (§10), including Shift chords.
446+- **C — Timeline.** Lane heads with glyphs, and lock, mute and hide. Lane resize. Adaptive ruler. Playhead tab. Trim plate and media limit. Move ghost and snap guides. Gaps. Right-click menus. Inline cue edit. Overview strip window box. Layout proportions.
447+- **D — Panels.** The §9 redesigns, plus new capabilities: Mix mute and solo, EQ low-cut and high-cut bands, subtitle outline, box and position, and J/K/L shuttle.
448+
449+Code comments that cite the old DESIGN.md's section numbers (49 of them) are updated to this document's sections as each phase touches their files.
450+
451+## Video output window (View menu)
452+
453+View > Video output window opens a second window that shows only the program picture, full-bleed on black and letterboxed, with no chrome. It reuses the viewer's own frame (`Player::image`), so there is no second decode, and it repaints with the main window. Esc or a double-click closes it. The window is session state only and is not saved in the project. View > Output display (a ✓ list of screens, shown only when there are two or more) moves it to a screen. On Wayland, gpui now fullscreens a window that names a display on that output (third_party gpui patch).
MCP.mdadded+581 -0
@@ -0,0 +1,581 @@
1+# edith_mcp — edith, driven by an agent
2+
3+> Status: built, 2026-10-16. Phases 1–7 done, E7 (TTS) done, keyframed gain
4+> automation done. Details §8.
5+> Audience: the agent who edits (Claude), and the agents who maintain it.
6+> DESIGN.md governs the GUI. This file governs the agent door. Where they meet
7+> (§7, live follow), DESIGN.md wins on anything the user sees.
8+
9+## 1. What it is for
10+
11+The user will hand most video edits to an agent. The agent cannot see a window,
12+cannot hear, and pays for every byte it reads. So edith gets a second front
13+door: an MCP server that drives the same engine the GUI drives, writes the same
14+`.edith` file the GUI opens, and is shaped around what an agent is good and bad
15+at.
16+
17+| An agent… | so the server… |
18+|---|---|
19+| reasons in text, sees pictures only when asked | answers in compact text; `frame` and `contact_sheet` return PNG images on demand |
20+| cannot hear | gives `levels`, `silence`, `loudness`, and `transcript` / `find_words` / `auto_captions` (segment times; word times DTW-aligned, `approx` where not; §6 E4) |
21+| cannot speak | renders narration with a local Piper voice (`voiceover`, §4.6; §6 E7) |
22+| loses track of shifting indices | addresses clips by lane and start (`V1@450`), never by a bare index (§3.2) |
23+| makes many small edits per idea | takes a **batch** of ops, applies it atomically, as one undo step (§4.5) |
24+| wants to try before committing | `dry_run` on `edit` and `cut_silence`; reports, then rolls back |
25+| acts on stale state if not told | every edit reply lists the new addresses it touched |
26+| burns context on noise | bounded replies, `range` filters, `timeline detail: brief` by default |
27+| must not take over the user's screen | is headless; never opens a window unless asked (§7) |
28+| sends bad arguments | an unknown argument is refused and the reply lists the accepted ones |
29+
30+## 2. Shape
31+
32+```
33+ Claude Code ──stdio JSON-RPC──▶ edith_mcp (crates/mcp, bin `edith_mcp`)
34+ │ one thread owns the session
35+ │ VE_NO_AO=1 at start: never touches audio
36+ │ help.rs: cheat sheet, built from the live tool table
37+ ▼
38+ engine::PlaybackSession ◀── same seam the GUI uses
39+ ├─ edit wrappers (split, trim, move, delete, cut_regions,
40+ │ place, keep, duck, gain, subtitles, titles, freeze, …)
41+ ├─ save → edith::save_flagged → foo.edith
42+ ├─ export::start → ExportHandle (threads, poll)
43+ ├─ compose_at / compose_at_with → frame, contact_sheet, freeze
44+ ├─ scenes (scenes.rs) → shot cuts, fades to black
45+ └─ loudness (EBU R128), silence, waveform, probe, decode
46+ │
47+ ▼
48+ foo.edith ◀── the GUI opens, and follows (§7)
49+
50+ listen tools ──stdin/stdout──▶ edith-stt (tools/edith-stt, own workspace)
51+ candle Whisper; models in ~/.cache/edith/models
52+ results cached in ~/.cache/edith/transcripts
53+
54+ voiceover ──▶ piper (EDITH_PIPER, or ~/.local/share/piper-venv/bin/piper)
55+ voices: EDITH_PIPER_VOICES, or ~/.local/share/piper-voices
56+ renders cached in <project>/voiceover/.renders/ by (text, voice, speed, pause, model);
57+ the named WAV in <project>/voiceover/ is a copy of its render
58+
59+ frame ──▶ PNGs in ~/.cache/edith/frames/<project>/
60+ freeze ──▶ PNGs in <project>/freeze/
61+```
62+
63+Decisions:
64+
65+- **Crate `crates/mcp`, depends on `engine` only.** No gpui, so it builds and
66+ runs anywhere the engine does.
67+- **Hand-rolled JSON-RPC over stdio, no `rmcp`, no tokio.** Methods served:
68+ `initialize`, `tools/list`, `tools/call`, `resources/list`, `resources/read`.
69+ Tool errors come back as `isError` text, not as JSON-RPC errors.
70+- **Speech is a separate process.** `edith-stt` is built from `tools/edith-stt`
71+ (its own workspace, so the engine's dependency tree stays small). The server
72+ finds it via `EDITH_STT_BIN`, else `tools/edith-stt/target/release/edith-stt`
73+ above the running binary. It is called with a model name, a language, and an
74+ offset per audio stretch. Word times are DTW-aligned; a segment that could not
75+ be aligned is marked `approx` (§6 E4). Synthesis (`voiceover`) is Piper, a
76+ separate process the same way.
77+- **One session per server.** One open project at a time, like the GUI. Opening
78+ another one saves or refuses (`dirty` guard), never discards silently.
79+- **The `.edith` file is the hand-off.** No IPC with the GUI. The GUI reloads
80+ the file when it changes on disk (§7).
81+- **Autosave on exit.** At stdin EOF a project is written beside its file
82+ as `<stem>.autosave.edith` (or to `~/.cache/edith/autosave/` when untitled),
83+ but only when the session differs from the file as it was opened or saved,
84+ compared as the whole project (settings included, not only clips). Never over
85+ the project's own file. `project_open` says when a newer autosave exists and
86+ names what differs: clips, lanes, sources, and settings such as a lane's gain
87+ or a clip's colour. Every dated autosave beside the file is listed on open,
88+ newest first, with its local time and what it changes; `project_open
89+ {recover:"<file name or stamp>"}` loads one of them.
90+ `project_save` refuses while an unrecovered autosave holds edits the project
91+ lacks; `discard_autosave:true` sets that autosave aside as a dated copy.
92+ `project_open {discard_autosave:true}` does the same and says so: its edits are
93+ not loaded, and the copy is kept under its dated name, not deleted.
94+ A session that made no edit writes no autosave at exit. A load fix or a
95+ recovered autosave is not an edit; an edit (a source added, a relink, an engine snapshot
96+ pushed, the undo depth moved) is what makes the exit write one.
97+ An autosave is never overwritten: an older one this session did not recover
98+ is moved aside to `<stem>.autosave-<local stamp>.edith` first, and the reply says so.
99+ Stamps and listed times are local time.
100+ A recovered autosave is replaced in place. A write that fails (the engine
101+ refuses the project, or a folder cannot be made) is logged as `autosave FAILED`
102+ with its reason; a discard names it in its reply.
103+
104+## 3. Conventions every tool shares
105+
106+### 3.1 Time
107+
108+Every time argument accepts any of these:
109+`450f` (frames) · `15.0s` / `15` (seconds) · `00:00:15:00` (timecode at project
110+fps) · `02:14.300` (MM:SS.fff) · `end`.
111+
112+**Distances** (`by` of `roll`, `slip` and `slide`) are signed: the same forms
113+with a leading `-` or `+` (`-15f`, `+0.5s`, `-00:00:01:00`). A bare number is
114+seconds, and `end` is not a distance. `roll` also takes `to`, an absolute
115+timeline time like every other `to`. `slip`'s `by` is timeline time too: at a
116+speed other than 1 it is worth `by x speed` source frames, and the reply says so.
117+
118+Timeline times round to the nearest frame. A reply that rounded says so:
119+`(1.53s → 38f)`. Every time in a response is given as frames and seconds:
120+`450f (15.000s)`. Frames are the truth; seconds are for the reader.
121+
122+**Source times** (`in`, `out`, `keep` ranges, `cut_regions` against a source)
123+are seconds or `450f` in the **file's own fps**, not the project's. A 60 fps
124+clip in a 30 fps project keeps its own frame numbers.
125+
126+### 3.2 Addressing
127+
128+Clips live in a lane's sorted, disjoint vector, and indices shift on every edit.
129+So:
130+
131+- **Clip address = `<lane>@<start frame>`**, e.g. `V1@450`, `A2@0`, `S1@900`.
132+ Clips in a lane never overlap, so the start is unique. It survives edits
133+ elsewhere in the lane.
134+- `V1#0` (index, 0-based: `V1#0` is the first clip on V1) is accepted and resolved at once. Do not hold it across edits.
135+- Every edit reply lists the **new** addresses of what it touched.
136+- Sources are `src:<n>`, as `media_import` and `media_list` report them, e.g.
137+ `src:2 interview_a.mp4`. Indices are kept across save and reopen.
138+- Lanes are `V1..`, `A1..`, `S1..`, the names the GUI shows. `S` lanes hold captions.
139+
140+### 3.3 Groups and scope
141+
142+Clips that share a `link` (a take: V1 + A1) move, trim and delete together, as
143+in the GUI. Ops take `scope: "group" | "clip"` where it matters.
144+
145+| op | default scope | notes |
146+|---|---|---|
147+| `trim` | group | `ripple:true` closes (start edge) or moves what follows (end edge) so the hole the trim leaves closes, as Premiere's ripple trim; a linked partner moves with it. Plain trim is the default. `scope:"clip"` unlinks the take first; the members that stay linked must have matching bounds on a take of three or more (a 60 s picture with a 30 s bed cannot stay linked: the trim is refused, "its partners could not stay linked") |
148+| `split_edit` | clip | `split_edit {clip, side: audio\|video, edge: in\|out, to}`: the split edit (J or L cut). The `edge` of the `side` half of the take moves to `to`; the other half stays put. The pair is unlinked first, so `clip` may name either half. Refused when `to` would pass the other edge of that half, or a locked lane is in the take |
149+| `roll` | group | `roll {clip, by\|to, edge?}`: the cut at `clip`'s out edge (`edge:"in"`: its in edge) moves; the clip before it loses what the clip after it gains. A take rolls its members' cuts together; the length of the timeline does not change. Refused with no clip abutting at the cut |
150+| `slip` | group | `slip {clip, by}`: same slot, same length, the clip plays source `by` timeline frames later (negative: earlier). Clamped to the file; a still refuses |
151+| `slide` | group | `slide {clip, by}`: the clip moves along its lane with its content; the clip before it ends later or earlier, the clip after it starts later or earlier. Needs a clip on each side (the first and last of a lane refuse); the length of the timeline does not change |
152+| `move` | group | `to_lane` must be the same kind (V to V). A drop on empty frames lands exactly there, jumping over the clips between; a head that would land inside a clip stops short, and the reply says what was asked |
153+| `delete` | group | closes the gap; a ripple (below) |
154+| `speed` | group | |
155+| `speed_ramp` | group | `keys:[{at, speed}…]` (`[]` clears it); a ramp, not a constant rate |
156+| `reverse` | group | `on?` (absent toggles); picture and sound play backward, length and place unchanged |
157+| `sub_move` | group | captions |
158+| `group` / `ungroup` | — | `group {clips:[…]}`, `ungroup {clip}` |
159+| `lift`, `fade`, `dissolve`, `transition`, `crossfade`, `gain`, `color`, `transform`, `fit`, `eq`, `sub_trim`, `sub_delete`, `cue_text` | clip | act on the one clip named |
160+| `split` | all lanes (or `lanes`) | a cut, not a ripple: nothing moves. `lanes` limits which lanes are cut; a linked partner follows its clip |
161+| `close_gaps` | one lane | closes the gaps on that lane only |
162+| `delete`, `ripple_delete`, `cut_regions`, `insert_time`, `remove_time`, `speed` with `ripple:true`, `find_words` with `cut:true`, `cut_silence` | the ripple scope (below) | ripple ops: later items move |
163+| `freeze` | one lane | `lane` defaults to V1; `insert` defaults to true |
164+| `title_add`, `title_set`, `title_remove` | — | titles are not clips: no link, no scope. Named `T1..` in start order |
165+
166+**Ripple scope.** `delete`, `ripple_delete`, `speed` with `ripple:true`, `cut_regions`, `insert_time` and `remove_time`
167+move the items after the cut or length change. Titles move only when a picture lane is in scope. Each reply carries an `effects:` line for side effects (clips split, holes left, takes unlinked). The default scope is the edited lane, plus the lanes of clips linked or
168+grouped to it (a take moves whole), closed over what the ripple reaches. On a picture lane, captions and titles over the
169+moved picture move too. `lanes:[…]` replaces that default and must name the edited lane; `cut_regions`, `insert_time`
170+and `remove_time` default to every unlocked lane, so `lanes` narrows them. `find_words` with `cut` defaults
171+to the target's lane and its linked lanes (every lane for a mix or `src` target). Lanes outside the scope never move or split.
172+A locked caption lane in the default scope is skipped with a note; any other locked lane the ripple must move refuses
173+the op. Addresses in one batch refer to the timeline as the previous op left it.
174+
175+A group-wide op checks every lane of the take before it moves anything.
176+
177+### 3.4 Lock rule
178+
179+A locked lane is never changed. An op that would change it refuses, and the refusal
180+names the lane and the fix: `lane A2 is locked: unlock it first with lane_flags {lane:"A2", locked:false}`.
181+The one exception is a ripple: a locked caption lane in the default scope is skipped
182+with a note (the titles and captions a ripple carries past it stay put), and any other
183+locked lane a ripple must move refuses the op. Inside a batch a refusal rolls the whole
184+batch back (§4.5). A group-wide op that reaches a locked lane is refused the same way.
185+`lane_flags` changes the flag.
186+
187+### 3.5 Responses
188+
189+- Plain, terse text first. Errors are sentences that say what to do next, in
190+ the voice of `oracle.rs`, not `false`.
191+- Replies are bounded: `timeline` is `brief` unless `detail: "full"`; `captions`
192+ is capped at 4 KB of text; `transcript` at ~6 KB, with a `from` footer for the next page.
193+- Unknown arguments are refused, not ignored. The reply reads
194+ `unknown argument \`x\` for <tool>; accepted: …`.
195+
196+### 3.6 Safety
197+
198+- Never deletes or rewrites source media. Never writes outside the paths it is given.
199+- `export_start` takes `format: "png_sequence"` (a folder of numbered PNGs, `out` is the folder), `"still"` (the frame at the start of `range` as one PNG, the poster frame) and `"gif"` (animated GIF, with `gif_width`, `gif_fps` and `gif_loop`; at most 30 s and 720 px wide). None of these has sound. The `media_import` of one frame of a numbered PNG run (`shot_0001.png`, two or more frames, same stem and extension) imports the whole run as one clip of its frames, reported as `image sequence, N frames`.
200+
201+`export_start` refuses an existing output unless `overwrite: true`. It writes
202+ to a `.part` file and renames on success.
203+- `project_save` to a different path is "save as". It refuses to overwrite a
204+ file that changed since this project opened it, unless `force: true`. A file
205+ this session opened or saved (any of them, so a save back to the original after
206+ a save-as) is this project's own and needs no force.
207+- `checkpoint` writes a copy to `<project dir>/checkpoints/<stem>/` and leaves the open
208+ project file alone. Only a project with no path at all (`project_new` without one, never
209+ saved) gets the temp directory, which is lost on reboot. A project with a path, saved or not, does not refuse.
210+
211+## 4. Tools
212+
213+35 tools, plus `help` and three resources. Every editing verb goes through one `edit` tool
214+so the schema stays small and every change is batchable. Required arguments are
215+in **bold**; optional ones follow the name.
216+
217+### 4.1 Project
218+
219+| tool | args | does |
220+|---|---|---|
221+| `project_new` | **path**, template, fps=30, resolution=1920x1080, discard, overwrite | `template` starts from a saved or built-in template by name (`templates` lists them) and takes the canvas, rate, lanes and caption style from it, so `resolution` and `fps` are refused with it | empty project at a new path (its folder is created if missing), unsaved until `project_save` (which needs at least one source). A video import does not change the canvas or fps: the project keeps 1920x1080 @30 until `project_settings` changes them. Refused when an earlier session's autosave sits at the path, unless `overwrite` |
222+| `project_open` | **path**, discard, recover, discard_autosave, search | opens `.edith`, or a media file as a new project (`<stem>.edith` beside it, unsaved). Reports a newer autosave and lists dated ones; `recover` is true (newest) or a dated autosave's name or stamp, its edits going on the saved file as one undo step; `discard_autosave` sets the newer autosave aside as a dated copy (kept); `search` relinks offline sources, leaving the project unsaved |
223+| `project_save` | path, force, discard_autosave | save, or save-as when `path` differs; needs at least one source in the project (`media_import` first). Refuses over a file changed on disk (`force` overrides), and over an autosave this session did not load (`discard_autosave` sets that autosave aside as a dated copy) |
224+| `project_collect` | folder | copies every file the project plays into `folder` (default `<project stem>_media` beside the project file, made if missing) and points the project at the copies; one undo step, unsaved until `project_save`. Skips generated sources, names and skips missing files, leaves sources already in the folder, renames clashes to `name-2.ext`, reuses identical bytes already there. A failed copy changes nothing. The window's File > Collect media does the same, with progress and cancel |
225+| `project_export_timeline` | format, path? | writes the active sequence for another editor: `otio` (OpenTimelineIO: tracks, clips with absolute file paths, gaps, transitions, markers), `fcpxml` (Final Cut Pro XML 1.10, read by Final Cut Pro, Resolve and Premiere) or `edl` (CMX3600: V1 and audio on A1/A2, dissolves as `D`, `FROM CLIP NAME` comments). Default path: beside the project file. Subtitles are left out and the reply says so. Only the file is written; the project does not change. The window's File > Export timeline as does the same into the default export folder |
226+| `project_import_timeline` | path | reads an `.otio` file as a new sequence of the project and makes it the active one; each clip is relinked by its path, and a missing file becomes an offline clip. One undo step, unsaved until `project_save`. The window takes the same file from File > Import timeline (OTIO) or from the command line |
227+| `project_status` | — | path, saved or dirty, canvas size, fps, duration, lanes with clip counts, sources, undo and redo depth, running exports, settings (and the notes, when there are any); an `OFFLINE: src:N <path>` line per offline source, and the fixes an open made to load (dirty until saved) |
228+| `project_settings` | resolution, fps, tonemap, notes, still_secs, proxies, auto_proxies, encoder, limiter, captions | the `ProjectSettings` knobs. An fps change keeps clips, captions and titles at the same seconds; their frame numbers and addresses change. `notes` is free text (several lines; `""` clears it), saved with the project as format v52; `still_secs` is how long a still is placed for, 0.5 to 600 s, 5 s by default, and only stills placed after the change take it. Both are one undo step each |
229+| `templates` | (none) | lists the project templates: the built-ins (YouTube 1080p 30, Vertical 1080×1920 30, Square 1080 30) and the ones saved from the window with File > Save as template, each marked built-in or saved and whether it keeps clips |
230+| `checkpoint` | **name** | save the whole project under a name (letters, digits, `-`, `_`), as a copy in `<project dir>/checkpoints/<stem>/` (the project's path, from `project_new {path}` or `project_save`; with no path at all, the temp dir, lost on reboot) |
231+| `restore` | **name** | replace the open project with a checkpoint, from this run or an earlier one; first saves the open project as `before-restore-<name>` (a suffix when that name is taken), so the state before the restore stays on disk; the project is dirty afterwards and its undo and redo history is cleared |
232+| `checkpoints` | — | the checkpoints on disk in this project's checkpoint folder, by name, including those made by earlier server runs |
233+
234+### 4.2 Media
235+
236+| tool | args | does |
237+|---|---|---|
238+| `media_probe` | glob, paths | header only, no import: container, codec, size, fps, duration, bitrate, and the audio and subtitle streams (Matroska: codec, language, title; mp4 subtitles: track, language, title). A picture the decoder refuses shows its reason and its streams together (`refused: …` then `streams: video #0 V_AV1 · …`). A sound codec nothing decodes gets a `warning: audio: WavPack is not supported; this file's sound will be silent` line. Many files per call |
239+| `media_import` | **paths** | adds sources; returns `src:<n>` for each; does not place them. Importing a file twice registers it once. Refusals and warnings are listed in full however many paths there are; only the plain successes are folded (`…and N more imported`) past 20 |
240+| `media_list` | kind (`video`, `audio` or `image`; omitted: every source; offline sources are kept only with no kind) | bins (`bin:<n>`, path, source count) then sources: `src:<n>`, name, duration, video size, codec, fps, the bin each is filed in and `favourite` if starred (JSON: `bin`, `bin_path`, `favourite`, and a `bins` array) |
241+| `media_bin` | **action** (`create` \| `rename` \| `remove` \| `move` \| `favourite`), name, parent, bin, sources, on | the media library's bins (named folders, one level of nesting) and favourites. `create {name, parent?}`; `rename {bin, name}`; `remove {bin}` (its sources go up one level, bins inside it come out to the top, nothing is lost); `move {sources, bin?}` (no `bin` takes them out of every bin); `favourite {sources, on?=true}`. A bin is `bin:<n>` or its name (`Parent/Child` for a nested one); sources are `src:<n>`, a list, or `"all"`. Names are trimmed, 1..60 characters, unique among siblings (any case). One undo step each; unsaved until `project_save`. Format v51 (older formats still load): `bin <id> <parent> <name>`, `srcbin <source> <bin>` and `srcfav <source>` lines, written only when a project has a bin, a filed source or a starred one, so other projects keep their older version |
242+| `media_remove` | **source**, force | drops an unused source (`src:<n>`). Refused, naming the clips, while any clip plays from it. Removing the last source keeps the undo history; any other renumbers the sources after it, which clears undo, so that is refused unless `force`. The project is left unsaved until `project_save` |
243+| `media_relink` | **source**, **path** | points an offline source (`src:<n>`, its file moved or deleted) at the file that now holds it. The new file must be the same kind (picture, sound or still) and long enough for its clips; clips are unchanged. One undo step: undo puts the old file back, redo points it at the new one. Unsaved until `project_save` |
244+
245+Channel layouts: a mono file joins a stereo timeline (widened); a stereo file
246+joins a mono timeline (narrowed). A layout wider than stereo is folded to stereo
247+when decoded. A wider file onto a mono timeline is refused.
248+
249+### 4.3 Look (text)
250+
251+| tool | args | does |
252+|---|---|---|
253+| `timeline` | detail (brief\|full), lanes, range, page | the timeline as text (brief lists at most 40 clips per lane, within about 4 KB of text, and says how many more there are; `page` pages one lane 40 clips at a time), one line per clip with its address, span, source, source span (`src 3.0s–15.4s`, the part of the file it plays) and effect flags |
254+| `clip_info` | **clip** | everything about one clip: lane, span, source range, speed, fades, transition (kind and length), fit, visualizer, EQ bands, colour, transform, group members, and how far each edge can trim; with `at` (a time inside the clip) also match frame: the source (src:N, file) and source time shown there |
255+| `captions` | lane, range, page | cues on caption lanes, in timeline time, one line per cue, 40 to a page. `range` is `{from, to}`: from inclusive, to exclusive, seconds exact (a cue starting at `to` is not listed) |
256+
257+`timeline` example (illustrative; real output has the same shape):
258+
259+```
260+foo.edith · 1920x1080 @30 · 02:14.300 (4029f) · dirty · undo 12
261+V1 @0 0.000–12.400 src:0 interview_a.mp4 src 3.0s–15.4s link 1
262+ @372 12.400–31.000 src:0 interview_a.mp4 src 20.333s–38.933s link 2 dissolve 15f (a wipe shows as `wipe-left 15f`)
263+ @930 31.000–40.000 src:3 broll_city.mp4 src 0.0s–9.0s speed 1.5 color
264+A1 @0 0.000–12.400 src:0 interview_a.mp4 src 3.0s–15.4s link 1 eq fade_in 6f
265+ @372 12.400–31.000 src:0 interview_a.mp4 link 2 gain -3dB
266+A2 @0 0.000–40.000 src:4 music.flac gain -14dB duck under A1
267+S1 @0 0.000–40.000 track 0 interview_a.srt (38 cues)
268+T T1 0.000–3.000 "Episode 17" centre
269+gaps: V1 none · A2 none
270+```
271+
272+Source spans are source time, not timeline frames: `src 3.0s–15.4s` is the part of
273+the file the clip plays. The clip's in and out frames are stored at the timeline's
274+rate, so the seconds are `in / fps` and `out / fps`. `clip_info` gives the same span
275+with timecodes and the source's own frame count.
276+
277+### 4.4 See and hear
278+
279+| tool | args | does |
280+|---|---|---|
281+| `frame` | **at**, source, width=640, save, burn_captions | one frame of the composed timeline (or of a source) as an image block; `compose_at`, so the frame is exact, not "whatever arrived". The PNG is also kept in `~/.cache/edith/frames/<project>/` (200 files or 200 MB across projects, oldest removed first). A name carries a hash of the picture, so the same time in a different project state is a new file, not an overwrite; the reply prints the path. `save` writes a copy to a path. The lane list marks a hidden picture lane `(hidden: not in the picture)` and never takes it as the picture on top. The reply also lists the layers at that frame: a picture stacked over another is named (`V2@100 over V1@50`), and a dissolve in progress shows its two clips and B's share, e.g. `V1 dissolving V1@75→V1@90, 40%`, with `layers` and `dissolve` in the structured content |
282+| `contact_sheet` | range, count=12, cols=4, source, width=1280, burn_captions, save | one PNG grid of evenly spaced frames, each with its timecode in a band above it (not over the picture, so a lower-third title stays readable). `cuts:` lists the picture (V) lane cuts in range; audio cuts are counted (`(38 audio cuts not shown)`), not listed. A tile's timecode stamp is left off when it does not fit the tile (narrow widths); the text lists every time. The cheapest way to "watch" a minute. `save` writes the PNG to a path, as `frame` does |
283+| `scopes` | **at**, bands=4 (1..16) | the video scopes of one composed frame as numbers, read from the graded picture at 320 px wide (`engine::scopes`, the same counts the GUI's Scopes view draws): luma min/p5/median/p95/max and mean with the crushed (≤2 %) and clipped (≥98 %) shares; the waveform's p5/median/p95 per band left to right; the RGB parade per channel and which sits highest; the vectorscope's mean saturation and cast (how far off grey, toward which hue). Levels are display percent. A LUT a clip names that cannot be read is listed as not applied |
284+| `scenes` | **source**, range (`{from, to}`, or the array form `[from, to]`), threshold=0.35, min_shot=0.6, sheet | shot list in source frames as `{from, to}` pairs, ready for `keep`: hard cuts and fades to black. Each boundary is the first frame of the new shot, exact to the frame; a fade through black is placed at the first picture frame after the dark run. A range gives the same boundaries as the whole file inside it. A clip address (`V1@450`) scans that clip's source within its span and adds timeline times. A source with no picture is refused. Cached per file and settings; `sheet:true` adds one contact-sheet image, saved in `~/.cache/edith/frames/<project>/` and named in the reply |
285+| `levels` | **target**, range, per_sec=2 (a number: buckets per second, default 2, max 50) | RMS dBFS in 20 ms windows, grouped per second; text rows and a summary. Clip gain, its volume envelope and lane gain are included; fades and EQ are not |
286+| `silence` | target, threshold_db, min_silence, padding, min_keep | quiet stretches as timeline frames, the same shape `cut_regions` takes. Clip gain, its envelope and lane gain are applied before judging; fades and EQ are not |
287+| `cut_silence` | target, threshold_db, min_silence, padding, min_keep, keep=0.4, lanes, force, dry_run | runs `silence`, then shortens every silence to `keep` seconds of pause inside its padded edges (a natural beat survives). The padding at each end is never cut, so the pause left is max(`keep`, 2 × `padding`), and the reply measures it. A silence at or under `keep` is left alone; when none is longer the reply says nothing was cut. A listed silence is at least `min_silence` with its padding counted; `min_keep` defaults to 0. One undo step. `lanes` default: the target's lane and its linked lanes; a mix target cuts every lane. A cut that would remove more than half the target's sound is refused unless `force`. With no target and two or more audio `lanes`, it is a joint cut: the silence is where every listed lane is quiet at once, so their turns stay in step. `src:N` is refused |
288+| `loudness` | **target**, range | EBU R128: integrated LUFS, loudness range, true peak, max momentary and short-term. Clip and lane gain, clip speed, fades and EQ are included as played |
289+| `clean_voice` | lane=A1, strength=medium (light, medium, strong), noise_from | gate + spectral noise reduction + compressor + de-esser on one audio lane, as one undo step. The noise profile is learned from `noise_from` (`{from, to}`) or, by default, the quietest half second of the lane; if none is found noise reduction is left off and the reply says so. The timeline, `clip_info` and `project_status` list the processors that are on |
290+| `track` | clip, effect_index, from?, to?, direction?=forward\|backward, apply?=mask, cancel? | follows a rect or ellipse mask's box through a clip in the background (sub-pixel normalised cross-correlation, the template learned slowly); the mask's centre takes the feature's path, size and soft edge kept. from/to are clip-relative times, default the whole clip. Stops where the feature is lost (flat or line-only patch, or a rival match nearly as good) and says at which frame. Titles cannot be tracked (no keyable position). The path follows the clip's placement (position, scale, rotation, crop and transform keys). Not yet: a source stored turned (a phone's portrait video) or with non-square pixels is tracked as stored. `cancel:true` stops the clip's tracks |
291+| `track_status` | wait=false | where each running track stands (percent); a finished track's keys are written onto its mask and the reply says how far it got; `wait:true` blocks until they finish |
292+| `stabilize_status` | clip, wait=false | where each stabilised clip's shake measurement stands: ready (with the zoom it chose), running with its percent, failed with why, or not started; `wait:true` blocks until they finish |
293+| `sequence` | action=list (list, new, rename, duplicate, delete, switch), sequence (name or number), name, new_name | the project's sequences: `list` marks the active one with `*`; `new`/`duplicate` do not switch; `delete` refuses the last sequence and one a compound clip plays; `switch` is not an undo step, the others are one each. `timeline`, `clip_info`, `edit` and `export_start` take an optional `sequence` to act on another (reads go back to the active one after; `edit` leaves it active). `engine::project::sequence` |
294+| `multicam_create` | sources, sync=audio (audio, start), name, at=0, lane=V1 | makes a multicam clip from 2 to 9 imported cameras and places it (picture on the video lane, sound on the audio lane of the same number, linked, overwriting what is there): a compound clip of a multicam sequence with one video lane and one audio lane per camera. `sync:audio` lines each camera up with the first one that has sound by cross-correlating the loudness curves (`silence::levels`, 50 per second, one-second trend removed) of the first four minutes, within ±2 minutes, to 20 ms; a camera with no sound or a match below 0.2 starts with the others and the reply says so; `sync:start` starts all together. The reply lists each angle, its start, how it was synced and the match score. One undo step. `engine::multisync`, `engine::project::multicam` |
295+| `multicam_flatten` | clip | replaces a multicam clip, every other piece of the same multicam on the timeline and their linked sound with the plain camera clips they play (the render does not change); the multicam sequence stays. One undo step |
296+| `normalize` | **target**, lufs=-14, true_peak=-1, allow_limiter, dry_run, lanes, each | sets gain so the sound measures `lufs`; cut back if the peak would pass `true_peak`. The reply leads with whether the target was reached; it also reports `achieved_lufs`, `capped_by` (true_peak, limiter, clip_gain_limit, lane_gain_limit) and the limiter state. A boost past a lane's +12 dB lane gain goes on that lane's clips as clip gain (each up to +24 dB), in the same undo step, so a quiet speaker needs no manual `gain`. `capped_by: clip_gain_limit` means even that is not enough: raise the clip gain yourself (`gain`, `add_db`, which adds on top of the lane) and normalize again. `dry_run` only measures. With `lanes` and `each:true`, each listed lane alone is set to `lufs`, in one undo step |
297+
298+`target` for the hearing tools is a clip (`A1@0`, reads its own sound over its
299+in..out span), a lane (`A1`, its clips in timeline time, gaps as -120 dBFS),
300+`src:N` (the whole source; `range` is then in source time), or `mix` (the whole
301+timeline as an export renders it).
302+
303+`normalize` on `mix` moves every unmuted audio lane by the same dB. `allow_limiter`
304+(mix only) turns the master limiter on at the `true_peak` ceiling when the peak is
305+what holds the gain back, in the same undo step. The limiter stays on afterwards.
306+
307+### 4.5 Edit
308+
309+`edit {ops: [...], dry_run?: false, label?}`
310+
311+- Ops apply **in order**, each against the state the previous one left.
312+- **Atomic:** if op k fails, ops 0..k-1 roll back and the error names op k.
313+- **One undo step:** the batch is one entry in the undo ledger. `undo` pops the whole batch.
314+ `label` (≤60 chars) names it; `undo` and `redo` report it by that label. A batch with no `label` is named after its first op (e.g. `place V1`), not "edit".
315+- **`dry_run: true`** applies, reports, then rolls back. Undo and redo history are left as they were.
316+- The reply lists each op's result, the new addresses, and a timeline digest of
317+ the affected range.
318+
319+Ops (each `{op: "…", …}`). The `op` enum is the source of truth; `help {topic:"ops"}`
320+prints it live, and `help {topic:"<op>"}` gives one op's entry. The recipes and the help topics write every op as `edit {ops:[{op:"…", …}]}`; tools (`normalize`, `find_words`, `cut_silence`, …) keep their own names as calls.
321+
322+| group | ops |
323+|---|---|
324+| place | `place {source, at, lane?, in?, out?, length?, stretch?, audio?, audio_lane?, audio_track?, overwrite?}` (no lane: linked V1+A1; with lane: overwrites it; `at:"end"` is the timeline end, not the lane's, so it can leave a hole on a lane that ends sooner; a `length` past the source is refused ("runs past the source end") unless `stretch:true`; `audio_track:N` picks the sound track of a multi-audio file, 0-based as `media_probe` numbers them, and a track other than the source's own is placed as a source of its own, `src:N` with the same file name) · `append {source, in?, out?}` (to the end of its lane; not the timeline end) · `keep {source, ranges:[[in,out]…], lane?, at?}` (ranges back to back, the rough-cut workhorse) · `assemble {items:[{source,in?,out?}…], lane?, at?, gap?}` (keep across sources) |
325+| three-point | `insert {source, in?, out?, at, to?, length?, lanes?}` · `overwrite {source, in?, out?, at, to?, length?, lanes?}` (`src` also spells `source`; the source range `in..out`, else the whole file, goes at `at`; `to` is a timeline out mark and `length` a duration, either sets the length from `in` instead of `out`; the take lands on `lanes`, at most one V and one A, else the first unlocked V and A lanes the source has, linked as one take; a still takes a V lane and `length` (default 5 s), a song an A lane. `insert` cuts the clip `at` falls inside and ripples what follows on those lanes only; it never moves or splits a lane outside the take, and refuses by name when that would pull a linked take apart. `overwrite` replaces what is there, trimming or splitting it, and nothing moves. Captions and titles keep their time; a locked lane refuses; one undo step each) |
326+| cut | `split {at, lanes?}` · `trim {clip, edge: in\|out, to, scope?}` [group] · `roll {clip, by\|to, edge?}` [group] (move the cut between two clips) · `slip {clip, by}` [group] (shift the source in/out, same slot) · `slide {clip, by}` [group] (move the clip between its neighbours) · `move {clip, at, to_lane?, insert?, titles?, split_captions?}` [group] (`insert:true` is a ripple move) · `delete {clip}` [group] · `lift {clip}` · `ripple_delete {clip}` · `close_gaps {lane}` · `cut_regions {regions:[[from,to]…], lanes?}` (accepts `silence` output verbatim) · `insert_time {at, duration, lanes?}` (ripples empty time in; a clip `at` falls inside is cut first) · `remove_time {at, duration, lanes?}` (the `cut_regions` cut for one span; a title wholly inside the span is removed, and one straddling an edge is trimmed to the part outside; the reply names both) · `swap {a, b}` (two clips on one lane trade places; a clip in a linked take is refused until the take is ungrouped) |
327+| time | `speed {clip, x}` 0.25–4 [group] (x is the absolute rate, not a multiplier: re-sending 0.5 on a clip already at 0.5 changes nothing) · `reverse {clip, on?}` [group] (plays the clip backward, picture and sound, or forward again; `on` omitted toggles; composes with speed and ramps; a still refuses; `clip_info` and `timeline` say `reversed`) · `speed_ramp {clip, keys:[{at, speed}…], ripple?, lanes?}` [group] (up to 8 keys at clip-relative times, speed 0.25–4 linear between them and held outside them; `keys:[]` clears the ramp) · `fade {clip, in?, out?}` (int = frames, `"0.5s"` = time) · `dissolve {clip, frames}` (video transition into the next clip) · `transition {clip, kind?=dissolve, length?, direction?}` (the same overlap with a look: `dissolve`, `dip-black`, `dip-white`, `wipe`, `slide`, `push` or `zoom`; `wipe`/`slide`/`push` move `left` (default), `right`, `up` or `down`, the way things move, so `wipe-left` shows the next clip from the right edge; `length` or `frames` is the overlap, kept when omitted; `dissolve` accepts `kind` too; the picture changes with the kind, the sound is always the crossfade; `timeline` flags and `clip_info.transition_kind` show it) · `crossfade {clip, frames}` (audio) · `freeze {at, duration, lane?=V1, insert?=true}` (holds the composed frame at `at` as a still; needs a project path, saved or not; see below) |
328+| look | `color {clip, brightness?, contrast?, saturation?, tint?, reset?}` · `transform {clip, x?, y?, corner?, margin?, scale?, rotate?, crop?:[l,r,t,b], opacity?, reset?}` (`corner` is centre, top-left, top-right, bottom-left or bottom-right: the engine sets x and y from the picture's own size (after crop and quarter turn), the scale given and a `margin` in pixels (default 32) from the two edges it touches; giving x or y with corner is refused, and so is margin without corner; picture in picture is `corner:"bottom-right", scale:0.3`) · `transform_keys {clip, keys?:[{at, x?, y?, scale?, rotate?, opacity?, ease?}…], clear?}` (animates the transform over the clip's own time) · `opacity_keys {clip, keys?:[{at, opacity, ease?}…], clear?}` (opacity 0..1 over the clip's own time, fades multiply on top) · `color_keys {clip, keys?:[{at, brightness?, contrast?, saturation?, tint?, ease?}…], clear?}` (the grade over the clip's own time, interpolated per frame) · `look {clip, name}` (the whole grade becomes a look, one undo step: a built-in `Warm`, `Cool`, `Teal & orange`, `Bleach bypass`, `Black & white`, `Faded film`, `High contrast` or `Vintage`, or a saved one from the colour card's "Save current as look" (`$XDG_DATA_HOME/edith/looks/<name>.look`); an unknown name is refused with the list; `help {topic:"looks"}` lists them) · `auto_color {clip}` (reads the clip's middle frame as shot: grey-world white balance into the wheels' channel gains, then brightness and contrast so the 0.5 % and 99.5 % luma percentiles land near 0.02 and 0.98; saturation, tint, curves and LUT kept; the reply gives the values set; one undo step) · · `wheels {clip, lift?, gamma?, gain?, reset?}` (each `[master, red, green, blue]`, -1..1, or one number for the master) · `curves {clip, master?, red?, green?, blue?, reset?}` (each up to 16 `[input, output]` points in 0..1, monotone cubic; `[]` straightens one) · `lut {clip, path?, mix?, clear?}` / `lut {relink, path}` (a `.cube` file, 1D or 3D up to 65, tetrahedral, mix 0..1; a broken file is refused; relink moves every clip naming a file, one undo step). The grade runs wheels → curves → LUT → the four sliders, in Rec. 709 R'G'B' for the first three; colour keys animate the sliders and the look holds under them; saved as v43 `wheels`/`curve`/`lut` lines. Recipe: `edit {ops:[{op:"lut", clip:"V1@0", path:"~/luts/warm.cube", mix:0.8}]}`, then `scopes {at:"2s"}` to read the shift · `copy_look {from, to | to_lane, what?}` (copies colour, transform, fit, effects, EQ, gain or speed onto other clips, one undo step) · `replace {clip, source, in?}` (the replace edit: overwrite the clip and its linked half with another source, same place and length) · `nudge {clips, by}` [group] (move clips by a signed distance, all or nothing) · `fit {clip, policy: fit\|fill\|stretch\|center}` · `deinterlace {clip, mode: frame\|field\|off\|ivtc-auto\|ivtc}` (how a video clip's interlaced source is made progressive, frame by default; only matters for an interlaced source, which `media_probe` reports; field and off are stored, the render acts on frame for now; `ivtc` removes 3:2 pulldown from telecined 29.97i H.264 and MPEG-2, giving the 23.976p film frames (best cadence found in the first 60 pictures, one cadence for the whole file), `ivtc-auto` does so only when that cadence is clear and otherwise deinterlaces as frame; put the project on 23.976 (`set_frame_rate`) for one timeline frame per film frame; soft pulldown (MPEG-2 repeat_first_field, H.264 pic_struct) in a transport stream is always presented as 23.976p; saved as v46 `deint` lines) · `visualizer {clip, on?, style?, fast?}` (the clip becomes a sound picture: style fill\|ribbon\|ring\|wave, fill by default; `fast` paints from a 0.2 s window; `on:false` turns it off, from the waveform picture or from the sound clip). On a sound clip, `on:true` places a waveform picture on the next free top picture lane (V2 or V3), grouped with the sound and covering the picture under it where they overlap; place it with `transform` (x, y move its centre, -1 to 1; scale; opacity). A picture address (`V1@…`) is mapped to its linked sound clip, which gets the picture; a picture with no linked sound is refused · `reframe {clip, aspect?=fit, smoothness?=0.5}` (auto reframe: a cheap saliency per sampled frame -- what moved since the last sample, local contrast, a pull to the middle, no models -- gives the subject's path, which is smoothed (`0.25 + 1.75 × smoothness` s), held still inside a dead zone and thinned to the keys where it turns; the keys scale the clip to cover the canvas and pan the subject to the middle, clamped so no edge ever shows; sets `fit` to fit and replaces the clip's `transform_keys` in one undo step, so no format change; it analyses before it answers; `aspect` is a guard that the project canvas has that shape; `engine::reframe`) · `stabilize {clip, on?, strength?=0.5, crop?=zoom, off?, cancel?}` (takes the camera shake out of a video clip: corners tracked frame to frame by pyramidal Lucas-Kanade, a shift-turn-zoom fitted by RANSAC, the camera path smoothed by a Gaussian of strength × 2 s (a steady pan is kept), each frame moved to the smoothed path before the clip's transform; `crop` `zoom` enlarges just enough that no frame shows an edge (≤1.5×), `full` keeps the frame and shows black edges; the analysis runs in the background, is cached per source and file-frame range under `~/.cache/edith/stabilise`, follows the footage through trims, speed, ramps and reverse; an export measures a missing analysis itself, which `export_status` shows as its `Measuring shake` stage with its own percent, while `frame` and `contact_sheet` never wait: they start it, draw the clip unstabilised and say the analysis is pending; `engine::stabilise`, format v44) |
329+| generated | `generator_add {kind: solid\|gradient\|countdown\|bars\|rectangle\|ellipse\|line\|arrow, color?, color2?, angle?, from?, fill?, stroke?, width?, radius?, lane?=V1, at?, duration?=5s}` (shapes `rectangle`, `ellipse`, `line` and `arrow` draw on a transparent canvas and composite over the lanes below: `fill` and `stroke` are `"#rrggbb"` or `"none"`, `width` the stroke in pixels 0..400, `radius` rounds a rectangle 0..2000; a line and an arrow are all stroke, a line runs left to right and an arrow points right; a shape lands at 40% scale and its size and place are the clip's `transform`; a clip made from numbers instead of a file: `color` is `"#ff3366"`, `angle` 0..359 degrees with 0 left to right and 90 top to bottom, `from` the countdown's whole seconds 1..3600, which is also its default duration; `at` defaults to the end of the lane; the lane must exist; a param the kind does not take, an unknown kind or a bad colour is refused by name; it overwrites what it lands on like a still, and is an ordinary clip afterwards, so trim, move, split, `color`, `transform` and effects all work) · `generator_set {clip, color?, color2?, angle?, from?, fill?, stroke?, width?, radius?}` (params merged onto a generator clip, place and length kept; a clip that plays a file is refused) · `adjustment_add {lane?=V2, at?, duration?=5s}` (a clip with no picture whose grade and effects reach everything composed beneath it; with no lane, V2, added when there is only V1; a transform on it moves the whole composite below, so uncovered area goes black, while crop only limits where it reaches and cropped-away areas keep the untouched picture; adjacent layers hard-cut) · `label {clip \| clips, value}` (a name from the label palette in any case, 1..8, or `none`) · `enable {clip \| clips, on}` (`on:false` keeps the clip but skips its picture and sound; an off adjustment layer stops adjusting). One undo step each; `timeline` and `clip_info` show `generator solid #ff3366`, `adjustment layer`, `label Rose` and `disabled`, and `media_list` does not call a generator an offline file. A generator's source is a pseudo-path `/edith-gen/<spec>.gen` (`engine::generate`), so the library, trims and saves treat it as a still. Format v48 (older formats still load): written only when a project has a generator, a label or a switched-off clip, so other projects keep their older version |
330+| sequences | `nest {clips:[addr…], name?}` (folds the picked clips and their linked partners into a new sequence and leaves one compound clip, on the lowest picked video and sound lanes, linked; refuses when an unpicked clip sits between picked ones; one undo step) · `break_apart {clips}` (puts a compound clip's contents back, trimmed to the stretch it played, one undo step) · `place_sequence {sequence, at, lane?=V1}` (a sequence as a compound clip; a cycle is refused). A compound clip's source is `1<<30 + sequence id`; the render inlines it into the flat timeline, so a nested render equals the flat one; it has no speed, ramp or reverse (refused) and its own colour/effects/transform are not applied. Format v45 (`MAGIC_V44` still loads): the active sequence is the body as before, then `seqactive <id> <name>`, `seqorder <ids>` and one `seq <id> <name>` … `endseq` block per parked sequence holding a complete document; only written when there is more than one sequence or a compound clip, so other projects stay v44 or older. The frame rate is locked then |
331+| multicam | `angle {clip, at?, angle?, audio?}` (switches a multicam clip's angle from `at` on: the clip is cut there when `at` is inside it, and the right part shows `angle`, a number from 1 or a name; the sound follows the picture unless `audio` is `"follow"` or an angle, which keeps it there; `clip` may be the picture or its linked sound clip; one undo step; refused for a clip that is not multicam, an angle that does not exist, or no change). A multicam clip is a compound clip (`source = 1<<30 + id`) with an `Angle {video, audio?}` on the clip; the sequence it plays is flagged multicam and holds angle `n` as its `n`th video lane and `n`th audio lane, so the render inlines exactly that angle's lane (`expand`), `break_apart` and `multicam_flatten` do the same. `timeline` rows read `multicam "Name" angle 2 "cam_b"`. Format v47 (`MAGIC_V46` and older still load; the version lives in `edith.rs` `MAGIC`/`NEWEST_VERSION`): `mcam <sequence id> <angle name>` lines in angle order after `seqorder`, and `angle <video|audio> <ord> <index> <picture> <sound|->` per clip that is not on angle 1 (angles counted from 1); written only when a project has a multicam source or a switched clip, so other projects keep their older version |
332+| sound | `eq {clip, bands:[{f,db,q,kind}] (max 10), reset?}` (f 20–20000 Hz, db ±12, q 0.3–12 default 0.707; kind peak (default), low_shelf, high_shelf, low_cut, high_cut) · `gain {clip, db (-60..24) \| add_db}` (one audio clip's own volume, on top of its lane's; relative steps clamp to the range) · `gain_keys {clip, keys:[[time, db]…]}` (the clip's volume envelope, audio only: replaces all points, `[]` clears, max 256; times are timeline times inside the clip) · `gain_key {clip, at, db}` (one point; the same frame is replaced) · `gain_key_remove {clip, at}` (the point within a frame of `at`; a miss lists the points) · `gain_ramp {clip, from, to, to_db, from_db?}` (straight dB ramp; `from_db` defaults to the envelope's level at `from`) · `gain_dip {clip, from, to, db, ramp?="0.5s"}` (dips over `from..to` with ramps in and out, starting from the level there now and clamped to the clip). The ramp and dip ops replace the points inside their span. · `lane_gain {lane, db}` (-60..12) · `pan {clip, pan}` (-1 left .. 1 right, 0 the middle; an audio clip's balance, format v50 `clippan` line) · `pitch {clip, semitones}` (-12..12 whole semitones, 0 the original; an audio clip's pitch with its speed kept, format v52 `pitch` line) · `lane_pan {lane, pan}` (the same for an audio lane, on top of the clips' `lanepan` line) · `limiter {on?, ceiling_db?}` (ceiling -24..0 dB) · `duck {lane, under, depth_db?=-12, threshold_db?=-40, attack_ms?=80, release_ms?=400, off?}` (the lane dips while the key lane speaks) |· `dynamics {lane, gate?, nr?, compressor?, deesser?, reset?}` (an audio lane's voice processors, run gate, noise reduction, compressor, de-esser after the clips' own EQ and before the limiter; each is true, false (bypass) or an object of settings; `engine::voice`, format v41) |
333+| lanes | `lane_add {kind}` · `lane_remove {lane}` · `lane_move {lane, to}` · `lane_flags {lane, hidden?, muted?, locked?}` · `lane_name {lane, name}` (the lane's display label, like a track name, at most 40 characters, `""` clears it; the address V1/A2 is unchanged and still what every op takes; `timeline` shows the name on the lane header and as `name` in its structured lanes; one undo step; saved as v46 `lanename` lines) |
334+| group | `group {clips:[addr…]}` · `ungroup {clip}` |
335+| captions | edit ops, not tools: `subtitles_import {path}` (tracks, no lane yet) · `captions_place {track, lane?, at?}` · `sub_move {clip, at, to_lane?}` [group] · `sub_trim {clip, edge:in|out, to}` · `sub_delete {clip}` · `captions_remove {track, force?}` · `cue_add {track, at, to, text, overwrite?}` · `cue_text {track, index, text}` (`\n` = line break) · `cue_delete {track, index}` · `cue_time {track, index, at?, to?}` (timeline times: trim or move one cue inside its neighbours, 0.1 s minimum) · `cue_merge {track, index}` (with the next cue) · `cue_split {track, index, at}` · `cue_replace {track?, find, replace, case_sensitive?}` (every cue of one track, or all tracks; case-insensitive unless `case_sensitive`; reports occurrences and cues). Written as `edit {ops:[{op:"cue_text", …}]}`; `captions` (the tool) lists the cues as `track T cue C` |
336+| markers | `chapter_add {at, title}` · `chapter_set {chapter, title?, at?}` · `chapter_remove {chapter}` (a chapter is `C@<frame>` or `C#n`, its place in the list, 1 first; cuts and inserts move chapters with the picture; `timeline` prints them as a YouTube description, with warnings) |
337+| comment markers | `marker_add {at, name, note?, color?, length?}` · `marker_set {marker, name?, note?, color?, at?, length?}` · `marker_remove {marker}` · `beats {clip, every?=1}` (finds the tempo of a sound clip and marks each `every`th beat, 1, 2 or 4 for bars, as a yellow marker noted "Beat"; the reply gives the BPM, the count and the `M@` addresses; the clip's earlier beat markers are replaced in the same undo step; a clip with no sound, a silent one or one with no steady pulse is refused; `engine::beats`) (a marker is `M@<frame>`, the first on that frame, or `M#n`; color is red, orange, yellow, green, blue or purple, default blue; a `length` makes a range and `length: 0` turns it back into a point; several markers may share a frame; they move with the picture as chapters do, a range growing or shrinking with an insert or cut; `timeline` prints a `markers:` line and a `markers` list; `export_start chapters: "markers"` writes them as the file's chapters) |
338+| titles | `title_add {at, duration, text, preset?=lower_third\|centered\|caption_bar, size?=80, outline?, boxed?, place?=centre\|top\|bottom, hplace?=centre\|left\|right, color?=#ffffff, weight?=regular\|bold, align?=centre\|left\|right, box_color?, box_opacity?, fade_in?, fade_out?, in_anim?=none\|fade\|typewriter\|slide_up\|slide_left\|pop\|word_by_word, out_anim?=(same), anim_secs?=0.5}` · `title_set {title, …}` · `title_remove {title}`. The title and burned-caption text draws Latin, Greek, Cyrillic, Arabic, Hebrew, Devanagari and Thai from bundled Noto faces, shaped, right-to-left in order. Colour emoji and CJK come from the system's Noto Color Emoji and Noto Sans CJK when installed; otherwise emoji draw monochrome and CJK draws as empty boxes (soft subtitle tracks keep that text). Only a character no face has draws as a box. `title_remove` renumbers the titles after it (T2 becomes T1). `preset` is the app's one-click look (the same values as the Title menu's styles): the fields given with it win, and `title_set {preset}` applies it to an existing title keeping its words and timing. `hplace` is the side the block sits against (a lower third is `place:bottom, hplace:left`), `align` how its lines line up in it, `color` the letters (`#rrggbb`), `weight` Archivo Medium or Bold (Latin only), `box_color` `#rrggbb` (keeps the opacity) or `#rrggbbaa`, `box_opacity` 0..1. A title with any of these off the default saves as format v49 (`titlestyle` lines); older projects load with the defaults. `in_anim` and `out_anim` are the entrance and exit animations, each of the seven names above; an exit is the entrance played backwards, eased in on the way out and out on the way in. `anim_secs` is how long each takes (a bare number is seconds, unlike the frame fades), `title_set` takes all three too. Typewriter and word_by_word reveal the text over the animation. A title with an animation saves as format v54 (`titleanim` lines) |
339+
340+`freeze` writes the composed frame at `at` to `<project>/freeze/<stem>-<frame>-<hash8>.png`
341+and places it as a still on `lane`. The hash is of the pixels, so an identical
342+frame reuses its file. `insert: true` ripples first, as `insert_time`, with silence
343+under the audio. `insert: false` overwrites `lane` for `duration`; with no `lane`
344+the still goes on a new top video lane over the picture.
345+
346+Also: `undo {steps?=1}`, `redo {steps?=1}` (an edit clears redo history).
347+
348+`effect {op, clip, ...}` is a video clip's effects stack (blur, sharpen, vignette, glow, shake, chroma_key, blend, pixelate, rect_mask, ellipse_mask), at most 16 per clip, video lanes only. Every mutating op is one undo step (an entry in the `undo` ledger) and refuses on a locked lane.
349+
350+| op | args | does |
351+|---|---|---|
352+| `add` | **clip**, **kind**, at=end, params, color, mode, size | a new effect at stack position `at`, at its defaults unless `params` (`{name: number}`) say otherwise; `color:"#rrggbb"` sets a chroma_key's red/green/blue, `mode:"screen"` a blend's mode (normal, multiply, screen, overlay, add, darken, lighten), `size` a pixelate's block size in pixels (2..200 at 1080 lines; same as `params:{size}`) |
353+| `set` | **clip**, **index**, params, on, color, mode | changes the effect at `index`; unnamed values keep theirs; `on:false` switches it off and keeps its settings. Out-of-range numbers are clamped and the reply says so |
354+| `remove` | **clip**, **index** | takes the effect out |
355+| `move` | **clip**, **from**, **to** | moves an effect within the stack |
356+| `mask_keys` | **clip**, **effect**, **keys**, clear | sets the whole key list of a rect_mask or ellipse_mask at stack position `effect`. Each key is `{at, x?, y?, w?, h?, feather?, ease?}`: `at` a time, `x`/`y` the centre and `w`/`h` the size as fractions of the frame, `feather` the soft edge, `ease` the move into the next key (linear, ease_in, ease_out, ease_in_out, hold). Keys sort by time; a key that names no field holds the previous key's values, and the first key the mask's own. Between keys the mask moves smoothly; before the first and after the last it holds. Up to 256 keys. `clear:true` takes the keys off and the mask goes back to its static values. Refused on any other kind |
357+| `list` | clip | the stack with each effect's position, kind, on/off and named values, and `keys=N` for a keyed mask; with no `clip`, every kind with its parameters and ranges |
358+
359+Effects are static, one value for the whole clip, except a mask with `mask_keys`, which moves between its keys; Ken Burns stays in `transform_keys`. A pixelate is limited by the first rect_mask or ellipse_mask after it (that mask only shapes the pixelation and does not cut the clip), so an ellipse after a pixelate censors a region. Distances (blur radius, shake amount) are pixels at 1080 lines and scale with the frame height. The stack applies in order on the clip's placed picture in preview and export; chroma_key and the masks reveal the lanes below, `blend` picks how the clip lies over them. An empty or all-off stack changes nothing. Setting what is already there is no undo step. Errors are specific: an unknown kind lists the kinds, an unknown parameter lists the parameters, a bad position gives the valid range, an audio lane is refused, a 17th effect is refused.
360+
361+Recipes: *Vignette plus soft blur* -- `effect {op:"add", clip:"V1#0", kind:"vignette", params:{amount:0.6}}`, then `effect {op:"add", clip:"V1#0", kind:"blur", params:{radius:4}}`. *Green screen over a background lane* -- background on V1, the green-screen take on V2: `effect {op:"add", clip:"V2#0", kind:"chroma_key", color:"#00ff00", params:{tolerance:0.35, softness:0.1, spill:0.5}}`; the keyed-out part shows V1.
362+
363+### 4.6 Listen and speak
364+
365+Listening needs `edith-stt` built and the model installed. The model is downloaded
366+only when asked for (the first call that needs it says so and stops if it is absent).
367+
368+| tool | args | does |
369+|---|---|---|
370+| `transcript` | target, from, language, model=base\|tiny\|small, range, words, hint, fillers | what is said, as timeline frames; segment lines, or word times with `words:true`. Segment times are reliable; word times are DTW-aligned, and a segment whose words were only spread evenly is `approx:true` |
371+| `find_words` | **query**, target, language, model, hint, cut, keep (first\|last), which, pad, dry_run, lanes | a phrase, case-insensitive, punctuation ignored; returns the matching spans to cut or caption. `keep` with `cut` keeps one word of a repeat (`"I I"`). `cut` lanes default to the target's lane and its linked lanes (every lane for a mix or src target). Filler spellings (uh, um, and their variants) and hallucinated "Thank you"-type segments are handled. `cut:"lift"` removes the matches without ripple: a hole is left where each was and no other lane moves (use it on one speaker's lane, so the other speaker stays in step). With `cut`, each edge snaps to the quietest 10 ms within ±150 ms of Whisper's time (a pause, not a word's sound), never closer than 30 ms to the kept word on its side; `snap:false` cuts at Whisper's times. A match in an `approx:true` segment is a hint: pad it or check it with `frame` |
372+| `auto_captions` | target (default lane A1), lane (default S1), language, model, max_chars, max_secs, path, speakers, hint, replace | transcribes, cuts cues at pauses, sentence ends and the length limits, writes `<stem>.captions.srt` (`-2`, `-3` … when that name is taken; a temp file if the project is untitled), imports it as a subtitle track and places it on the caption lane at frame 0. One undo step. A re-run writes a new file and keeps the old one, so undo can bring the old track back. A lane that already holds captions takes the new run merged in, as one track in time order; a re-run on the same lane replaces the captions that lane made before. `replace:true` also removes overlapping captions that differ from what was heard now (hand edits included); undo brings them back. `speakers` (mix target) sets which audio lanes split the cues. `hint` also corrects near-miss spellings of its words after transcription, and the reply names each correction (`hint corrected: …`). An explicit `path` that a track already holds is refused |
373+| `voices` | language | lists the local Piper voices (name, language, quality, sample rate, speakers). The default is marked `*`: `en_US-ryan-high` when installed, else the first `en_US`, else the first one |
374+| `voiceover` | **text**, voice, speed=1, pause=0, name, place | speaks `text` into `<project>/voiceover/<name or slug>-<hash8>.wav` and imports it as a source (`src:N`), reporting its duration. Needs a project path (`project_new` or `project_open`): the WAV goes beside the `.edith` file even before `project_save`, and the reply says the source is unsaved until then. Renders are cached by (text, voice, speed, pause, model) in `voiceover/.renders/`: the same text with another `name` reuses the render and only copies it. Piper's duration noise is pinned off, so one text always renders to one length (the waveform keeps piper's usual small variation). `place {lane, at}` places it on a lane as one undo step; the lane must be an existing audio lane, and both are checked before anything is rendered. Text is capped at 5000 characters; `speed` 0.5–2; `pause` is seconds of silence after each sentence (max 10) |
375+| `record` | **action** (start\|stop\|status), lane, at=playhead, source | records a voice-over from the audio input into `<project stem>_media/voiceover-<n>.wav` beside the project (16-bit stereo WAV, 48 kHz; the folder `project_collect` uses). `start` begins a take at `at` (default the playhead) and needs a project path; `lane` is the audio lane it lands on, or a new one. `stop` ends the take, imports it as `src:N` and places it at the start point as one undo step. `status` reports the clock and the level in dBFS while recording, and the input list (`source` names, monitors marked) when idle. This is the microphone; `voiceover` is text-to-speech (Piper) and never records. Only one take runs at a time |
376+
377+`hint` names words as they should come out (`"Edith, LUFS"`). It is handed to
378+Whisper as its initial prompt, and steers spelling only; after transcription a
379+near-miss spelling of a hinted word is corrected to it. A wrong hint can mislead
380+the transcriber, so leave it out when unsure.
381+
382+Transcripts are cached in `~/.cache/edith/transcripts`. A second call on the same
383+target does not run the model again. The cache key carries a version
384+(`CACHE_VERSION`, now 5: segment-cropped DTW, band-energy onset, tail drop, the
385+`hint` prompt in the key), so results from before an edith-stt change are not reused.
386+
387+edith-stt drops segments that look like hallucinated silence (high `no_speech`
388+probability with low average logprob, or a span under -50 dBFS). Its `--keep-all`
389+flag turns that off; the server does not pass it.
390+
391+Voice needs piper (`EDITH_PIPER`, or `~/.local/share/piper-venv/bin/piper`).
392+Piper's stderr is reported on failure.
393+
394+### 4.7 Export
395+
396+| tool | args | does |
397+|---|---|---|
398+| `export_start` | **out**, preset (an `export_presets` id; explicit args override it), loudness (-30 to -5 LUFS, the integrated target; the true peak holds at the preset's ceiling or -1 dBTP, the gain is cut back and never a limiter), format (mp4, av1, av1-mp4, hevc, hevc-mp4, webm, wav, flac, mp3, ogg, m4a, opus, prores, png_sequence, still, gif), gif_width (320/480/640/720, default 480), gif_fps (1-60, default 15), gif_loop (default true), range, size, fit, bitrate_kbps, audio_kbps (128/192/256/320), bit_depth (8\|10; 10 is AV1 and HEVC only), prores_profile (proxy\|lt\|standard\|hq\|4444\|4444xq; format `prores`, a `.mov`), hdr (off\|pq\|hlg; HEVC only, implies 10-bit), hevc_speed (default\|fast\|faster; HEVC only: fast is about 1.2-1.6x quicker for 0-3% more bits, faster about 1.5-2x quicker for up to 27% more), audio_bit_depth (16\|24; ProRes sound), chapters (default true; `"markers"` writes the comment markers as the chapters), intra_only, seat (auto\|hardware\|software), subtitles, burn_captions, overwrite | starts an export; returns `job:<n>` at once. The reply counts the chapters written (`3 chapters`) and, for an AV1 or HEVC file, its depth (`output 10-bit, from the source`) · `queue` (true: line the export up behind the others -- it keeps its own copy of the timeline as it is now, so later edits do not change it, and starts when every earlier export has finished, one encode at a time, polled or not; `export_status` shows it as `waiting`; default false starts at once beside any others) |
399+| `export_presets` | – | lists the export presets (id, label, format, bitrate_kbps, audio_kbps, size, bit_depth, prores_profile, hdr, loudness): youtube_1080p/1080p60/1080p_hevc/4k/4k60/4k_hevc, shorts_reels, podcast, podcast_ogg and podcast_opus (-16 LUFS, -1 dBTP), archive (10-bit AV1 mkv), archive_prores (ProRes 422 HQ .mov), hdr10_hevc (10-bit HEVC mp4 tagged PQ), archive_flac, archive_wav |
400+| `export_captions` | format (`srt` or `vtt`, required), path, overwrite | writes the timeline's captions (every cue on the subtitle lanes, in start order) as SRT or WebVTT; picture and empty cues are left out. Without `path`: `<first source> edit.<format>` in the Videos folder. Refuses an existing file unless `overwrite` is true, and writes nothing when there are no captions |
401+| `export_status` | job, out | a queued job (`export_start {queue:true}`) reads `waiting` with the number of exports ahead of it; progress, elapsed, ETA, encoder, outcome of one job; while a stabilised clip is measured before it can encode, the line and `stage`/`stage_progress` name that stage (`Measuring shake`) with its own percent; `out` reports a file this session did not start; omitted, every export so far, with its size when done (decimal: 12,139,083 bytes is 12.1 MB) and the integrated loudness (LUFS) and true peak of the written file (`integrated_lufs`, `true_peak_dbtp`, measured once from the file with the `loudness` measurement), or its error when failed. When a job finishes, a peak over the format's ceiling gets a warning line: -1 dBTP for lossless (wav, flac), -2 dBTP for lossy (the rest, since encoding can overshoot the mix) |
402+| `export_cancel` | **job** | cancels a running job; a waiting (queued) job is removed from the queue and never starts |
403+| `render_preview` | range (`"all"`, the default, or `{from, to}`), cancel | pre-renders a stretch of the timeline at preview size into the render cache, so playback over it reads finished frames instead of compositing them (heavy sections: stacked effects, titles over video, colour, speed, multicam). One render at a time, in the background; `project_status` shows the progress and the cached ranges. A render is keyed by a hash of everything that changes its pixels (the clips overlapping it and their neighbours, their sources, titles, captions, tone, rate), so an edit inside a cached range drops it and playback composes live there again. `cancel: true` stops the running render and removes its partial file. The sound is not rendered; the live mix always plays |
404+
405+`format` is one of `mp4`, `av1`, `av1-mp4`, `hevc`, `hevc-mp4`, `webm`, `wav`,
406+`flac`, `mp3`, `ogg`, `m4a` (AAC in an mp4 box, audio only), `opus` (Opus in Ogg, audio only, 48 kHz). Without `format` the extension of `out` decides, `.m4a` included. An
407+unknown extension is refused, and the reply lists the ones that exist. An `.mp4` of a timeline with no picture is the sound alone (AAC, no picture track) and carries no captions: export `.m4a` for sound, or add a still on V1 for a captioned video.
408+
409+A relative `out` resolves against the project's folder, and the reply says so.
410+With no project open it is refused. An `out` inside a git working tree, outside
411+the project folder, is written with a warning that it will show in `git status`.
412+
413+Two ways to carry captions. `burn_captions` draws one track's text into the
414+picture (`{track, size, outline, boxed, place, family, animation, highlight, box, uppercase, words_per_line}`), so every player shows it. CJK draws as empty boxes in burned captions unless the system has Noto Sans CJK, so put CJK in `subtitles`.
415+`subtitles` adds soft tracks a player can switch off (WebM carries none): `true`
416+for every subtitle track, placed or not, or an array of 0-based track indices, in the order
417+given. A picked track that is not placed on a caption lane is written whole (all its cues).
418+In mp4, overlapping cues are merged into one line each; mkv keeps them as they are. It is opt-in: omitted or `[]` adds none. With `burn_captions` and no
419+`subtitles`, the file carries no soft track, so the captions are not shown twice.
420+A burn-only export reports `subtitles: burned into the picture (no soft track)`. An export
421+that is no longer polled still finishes in the background; `export_cancel {job}` stops it.
422+Burn-in settings are per export; they are not saved in the project.
423+
424+There are no progress notifications. Poll `export_status`.
425+
426+### 4.8 Help and resources
427+
428+- `help {topic?}`: the cheat sheet. Topics: `ops` (every edit op with its
429+ arguments), an edit op name (its manual entry), a tool name (its arguments),
430+ `times`, `recipes`, and these topics: `lanes` (lane names, lane_add, lane_flags,
431+ gaps), `ripple` (which lanes a ripple op moves, and `lanes:[…]`), `export`
432+ (export_start arguments, formats, range, seat, captions), `subtitles` (subtitle
433+ tracks, import, placed captions, cues), `captions` (the workflow: auto_captions,
434+ subtitles_import, burn_captions and export, plus the `captions` tool's
435+ arguments), `project` (new, open, save, autosave, undo, checkpoints),
436+ `burn_captions` (the picture-burn arguments), `visualizer` (the visualizer op and
437+ the clip flag `clip_info` shows), and the topics `first_video`, `podcast`, `overlays`, `vertical`, `stretch` and `unsupported`. An unknown topic lists the valid ones. No topic
438+ gives the whole sheet. Built from the live tool table, so it cannot drift.
439+- `edith://help`: the same sheet as a resource. Read it once.
440+- `edith://project`: the `project_status` text.
441+- `edith://timeline`: the `timeline` text.
442+
443+## 5. A session, as the agent would run it
444+
445+Illustrative; names and argument shapes are the real ones.
446+
447+```
448+media_probe {glob: "~/Videos/vlog-17/*.mp4"} → 6 files, 41 min total
449+project_new {path: "~/Videos/vlog-17/cut.edith"}
450+media_import {paths: [...]} → src:0..5
451+contact_sheet {source: "src:0", count: 16} → what was shot
452+scenes {source: "src:0", sheet: true} → shots in source frames, sheet
453+silence {target: "src:0"} → 212 quiet runs
454+cut_silence {target: "src:0", dry_run: true} → would cut 212 runs, 6.1 min
455+edit {ops:[{op:"keep", source:"src:0", ranges:[…]}], dry_run:true}
456+edit {ops:[{op:"keep", source:"src:0", ranges:[…]}], label:"Rough cut"} → V1/A1 rough cut, undo 1
457+transcript {target: "A1", hint: "Edith"} → segments, in frames
458+find_words {query: "um", target: "A1"} → 9 spans
459+edit {ops:[{op:"cut_regions", regions:[…the 9 spans…]}]} → one undo step
460+frame {at: "01:12.0"} → check a cut point
461+loudness {target: "mix"} → -17.9 LUFS, true peak -2.1
462+normalize {target: "mix", lufs: -14}
463+auto_captions {target: "A1"} → 38 cues on S1
464+edit {ops:[{op:"duck", lane:"A2", under:"A1"}]} → music dips under speech
465+voiceover {text: "Welcome back.", place: {lane:"A2", at:"0"}} → src:6, placed on A2
466+edit {ops:[{op:"title_add", at:"0", duration:3, text:"Episode 17", place:"centre"}]} → T1
467+project_save {}
468+export_start {out: "vlog-17.mp4", burn_captions: {track: 0}} → relative: the project folder
469+export_status {job: 1} → done
470+```
471+
472+## 6. Engine gaps (status)
473+
474+| id | gap | status | notes |
475+|---|---|---|---|
476+| E1 | No deterministic "render timeline frame N" | **done** | `compose_at` / `compose_at_with` (`export.rs`), shared with export's compositor; `frame`, `contact_sheet`, `freeze` use it |
477+| E2 | `MediaFacts` carried no duration | **done** | `duration_secs` on the probe facts; `media_probe` reports length |
478+| E3 | Loudness was RMS only | **done** | `loudness.rs`: EBU R128 integrated, LRA, true peak, momentary, short-term; `normalize` uses it |
479+| E4 | No speech-to-text | **done** | `edith-stt` (candle Whisper). DTW word alignment over cross-attention, segment-cropped, energy onset, tail drop, `approx:true` where alignment failed, hallucinated-silence filter, `hint` as initial prompt. Vendored `zip` (`tools/edith-stt/vendor`) |
480+| E5 | No SRT/VTT writer, no burn-in | **done** | `subtitle.rs`: `write_srt`, `write_vtt`, `save_cues`, `cues_from_words`; VTT entity decoding; burn-in via `ExportSettings::burn_subtitles`, drawn by `text.rs` (ab_glyph rasterizer) |
481+| E6 | No title cards or text overlays | **done** | `title_add` / `title_set` / `title_remove` (`edit_fx.rs`); format v26 `title` line; drawn in export, `compose_at` and the GUI preview. Past the last clip the timeline extends over black |
482+| E7 | No text-to-speech | **done** | `voices`, `voiceover` (`tools/speak.rs`), Piper as a separate process like E4. Renders are cached by hash; `place` lands the clip as one undo step |
483+| G1 | GUI never reloads a project changed on disk | **done** | §7 |
484+
485+Format is v27. `duck` is a line of its own (v25, `duck.rs`); titles are v26
486+`title` lines; per-clip gain is a v27 `clipgain <kind> <ord> <index> <db>` line,
487+written for each clip whose gain is not unity.
488+
489+### Known limits
490+
491+- **Envelopes are per clip, not per lane.** `gain_keys` and its ops shape one
492+ audio clip's volume over its span; `lane_gain` stays one static value per lane.
493+ Points are stored on source frames, so a move, trim or split keeps each point on
494+ the same audio. Points add to the clip's `gain` and run inside its fades.
495+- **Clip gain is audio only.** `gain` on a video clip is refused; set it on the
496+ audio clip split from the same take. It applies through the clip's fade
497+ envelope.
498+- **Keys animate transform, opacity, colour and gain.** `transform_keys`,
499+ `opacity_keys`, `color_keys` and the gain points take `ease` per key (`linear`,
500+ `ease_in`, `ease_out`, `ease_in_out`, `hold`; linear by default, and a file with no
501+ eases saves as before). Opacity keys replace the placement's opacity while they exist
502+ and the fades multiply on top; colour keys replace the single grade, and `color`
503+ refuses while they exist. Keys sit in source frames, so they follow trims, splits and
504+ ripple. Speed keys have no ease yet. A source plays its first sound
505+ track; `place {audio_track:N}` picks another sound track (§4.5).
506+- **Reversed clips.** `reverse` decodes at 8 bits, so a 10-bit source loses its low 2 bits on a 10-bit export (banding is possible on HDR). Hardware decode is off for reversed clips. The B side of a dissolve plays forward, and waveforms and thumbnails draw forward.
507+- **Chapters and bit depth.** Chapter markers are written into mp4, av1-mp4, hevc-mp4, m4a, webm, opus (as `CHAPTERxxx` comments) and Matroska (av1, hevc) files, timed from the start of the range; `chapters: false` leaves them out, and wav, flac, mp3 and ogg say they are not written. 10-bit export is AV1 and HEVC only (`format: av1`, `av1-mp4`, `hevc` or `hevc-mp4`; HEVC is written as Main 10): a 10-bit source writes a 10-bit file on its own, and `bit_depth: 10` asks for it (`bit_depth: 10` on H.264 or any other format is refused, naming the formats that can). Edits that are composed (grades, titles, captions, transitions, layers) still run at 8-bit precision and shift up.
508+- **Transitions** are the seven kinds above, one per join, on one lane's abutting clips (no transition between layered pictures, no eased or keyframed progress). Preview and export draw the same picture; project files that use a kind are format 37, older files load as dissolves.
509+- **Not supported yet:** HEVC sources in 4:4:4, 4:0:0 or 12-bit and AV1 sources in 4:4:0 (refused by the decoder; AV1 4:2:2, 4:4:4 and 12-bit, and HEVC 4:2:2, decode). `help {topic:"unsupported"}` lists them too.
510+- **Caption style is per export, except the animation.** `burn_captions` settings
511+ (track, size, outline, boxed, place) go with the export, not the project. The
512+ animation keys (`animation`: none, karaoke, pop, bounce, word; `highlight`; `box`;
513+ `uppercase`; `words_per_line`) default to the project's caption style, which
514+ `project_settings {captions: {...}}` sets (saved in the project from format v40,
515+ one undo step) and which a `burn_captions` key overrides for that call. `frame` and
516+ `export_start` draw the same pixels from the same function. A cue made by
517+ `auto_captions` keeps the transcript's real word times (saved in the project; a
518+ text edit drops them, move and trim shift and clip them). A cue without them
519+ (SRT, VTT, typed) spreads its words over the span by letter count. Clip speed and ramps
520+ are already in the cue times. Re-export to change the look.
521+- **`transcript`/`find_words` on `mix` is costly.** It renders the whole mix and
522+ runs the model over it. Transcribe a lane or a clip instead, and cache hits
523+ only help on the same target.
524+- **Export speed in debug builds is poor.** Use `cargo build --release` for real
525+ exports and for any timing.
526+- **Locked lanes refuse, they do not skip.** One refused op rolls the whole batch
527+ back. Unlock first, or leave that lane out of the batch. The one exception: a
528+ locked caption lane in a ripple's default scope is skipped with a note.
529+- **Approximate word times, only where marked.** Words in a segment with
530+ `approx:true` were spread evenly, not aligned. Check them with `frame` or
531+ `contact_sheet` before a cut.
532+- **Scene detection is heuristic.** `threshold` and `min_shot` tune it. A dissolve
533+ that never goes dark is not reported as a fade.
534+- **No progress notifications.** Poll `export_status`.
535+
536+## 7. Live follow (the user watching)
537+
538+Implemented in `crates/app/src/follow.rs`. The GUI watches the `.edith` file it
539+has open. It stores the file's write time and length when it last read it. A
540+poll compares those stamps, and asks whether the window has unsaved changes.
541+
542+- **Clean window, file changed on disk:** the GUI reloads the project in place.
543+ The playhead and view state stay (view state is per project, in
544+ `~/.config/edith/views/`).
545+- **Dirty window, file changed on disk:** one toast, "changed on disk — reload /
546+ keep mine". Nothing is lost silently.
547+- **Manual reload:** the `reload-project` action does the same
548+ reload on demand.
549+
550+The server never opens a window on its own. `edith_mcp` writes the file; the
551+window, if one is open, follows it. The decision is a pure function of the two
552+stamps and the dirty flag, so it is unit-tested without a window.
553+
554+## 8. Building it
555+
556+Phases, in agent time, run back to back:
557+
558+1. **Skeleton, look, edit core. Done.** JSON-RPC loop, §3 parsing, `project_*`,
559+ `media_*`, `timeline`, `clip_info`, `edit` with the cut and place ops, undo and
560+ redo, save, export. E2. Tests are JSON-RPC transcripts against
561+ `assets/test_av.mp4`.
562+2. **See and hear. Done.** E1, `frame`, `contact_sheet`, `levels`, `silence`,
563+ `cut_silence`, `loudness`, `normalize`, checkpoints and `restore`, `dry_run`,
564+ resources, `help`. Progress notifications were dropped; `export_status` polls.
565+3. **Register and dogfood. Done.** `claude mcp add edith <path>/target/release/edith_mcp`.
566+4. **Live follow (G1). Done.** §7.
567+5. **Hearing and delivery. Done.** E3 LUFS, E5 SRT, VTT and burn-in. E4:
568+ `transcript`, `find_words`, `auto_captions` with DTW word alignment, energy
569+ edge snapping and the silence filter. `scenes` (hard cuts and fades to black,
570+ optional contact sheet) done.
571+6. **Titles and voice. Done.** E6 titles (format v26), E7 `voices` and `voiceover`
572+ (Piper, cached, `place` as one undo step).
573+
574+7. **Keyframed gain. Done.** A clip's volume envelope (format v28 `gainkeys`
575+ line): `gain_keys`, `gain_key`, `gain_key_remove`, `gain_ramp` and `gain_dip`,
576+ with times in timeline time and points stored on source frames. `clip_info`
577+ lists the points, the timeline marks clips that have one with `env`, and
578+ `levels` and `silence` read the envelope per 20 ms window. `loudness` and
579+ `export` already hear it through the fade envelope.
580+
581+Remaining: per-project caption style is not scheduled.
assets/fonts/Archivo-Bold.ttfadded+0 -0

Binary file changed

assets/fonts/Archivo-Medium.ttfadded+0 -0

Binary file changed

assets/fonts/Archivo-Regular.ttfadded+0 -0

Binary file changed

assets/fonts/Archivo.ttfadded+0 -0

Binary file changed

assets/fonts/Inter-Medium.ttfadded+0 -0

Binary file changed

assets/fonts/Inter-Regular.ttfadded+0 -0

Binary file changed

assets/fonts/Inter-SemiBold.ttfadded+0 -0

Binary file changed

assets/fonts/NotoEmoji-Regular.ttfadded+0 -0

Binary file changed

assets/fonts/NotoSansArabic[wght].ttfadded+0 -0

Binary file changed

assets/fonts/NotoSansDevanagari[wght].ttfadded+0 -0

Binary file changed

assets/fonts/NotoSansHebrew[wght].ttfadded+0 -0

Binary file changed

assets/fonts/NotoSansThai[wght].ttfadded+0 -0

Binary file changed

assets/fonts/NotoSans[wght].ttfadded+0 -0

Binary file changed

assets/fonts/OFL-archivo.txtadded+93 -0
@@ -0,0 +1,93 @@
1+Copyright 2020 The Archivo Project Authors (https://github.com/Omnibus-Type/Archivo)
2+
3+This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+This license is copied below, and is also available with a FAQ at:
5+http://scripts.sil.org/OFL
6+
7+
8+-----------------------------------------------------------
9+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+-----------------------------------------------------------
11+
12+PREAMBLE
13+The goals of the Open Font License (OFL) are to stimulate worldwide
14+development of collaborative font projects, to support the font creation
15+efforts of academic and linguistic communities, and to provide a free and
16+open framework in which fonts may be shared and improved in partnership
17+with others.
18+
19+The OFL allows the licensed fonts to be used, studied, modified and
20+redistributed freely as long as they are not sold by themselves. The
21+fonts, including any derivative works, can be bundled, embedded,
22+redistributed and/or sold with any software provided that any reserved
23+names are not used by derivative works. The fonts and derivatives,
24+however, cannot be released under any other type of license. The
25+requirement for fonts to remain under this license does not apply
26+to any document created using the fonts or their derivatives.
27+
28+DEFINITIONS
29+"Font Software" refers to the set of files released by the Copyright
30+Holder(s) under this license and clearly marked as such. This may
31+include source files, build scripts and documentation.
32+
33+"Reserved Font Name" refers to any names specified as such after the
34+copyright statement(s).
35+
36+"Original Version" refers to the collection of Font Software components as
37+distributed by the Copyright Holder(s).
38+
39+"Modified Version" refers to any derivative made by adding to, deleting,
40+or substituting -- in part or in whole -- any of the components of the
41+Original Version, by changing formats or by porting the Font Software to a
42+new environment.
43+
44+"Author" refers to any designer, engineer, programmer, technical
45+writer or other person who contributed to the Font Software.
46+
47+PERMISSION & CONDITIONS
48+Permission is hereby granted, free of charge, to any person obtaining
49+a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+redistribute, and sell modified and unmodified copies of the Font
51+Software, subject to the following conditions:
52+
53+1) Neither the Font Software nor any of its individual components,
54+in Original or Modified Versions, may be sold by itself.
55+
56+2) Original or Modified Versions of the Font Software may be bundled,
57+redistributed and/or sold with any software, provided that each copy
58+contains the above copyright notice and this license. These can be
59+included either as stand-alone text files, human-readable headers or
60+in the appropriate machine-readable metadata fields within text or
61+binary files as long as those fields can be easily viewed by the user.
62+
63+3) No Modified Version of the Font Software may use the Reserved Font
64+Name(s) unless explicit written permission is granted by the corresponding
65+Copyright Holder. This restriction only applies to the primary font name as
66+presented to the users.
67+
68+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+Software shall not be used to promote, endorse or advertise any
70+Modified Version, except to acknowledge the contribution(s) of the
71+Copyright Holder(s) and the Author(s) or with their explicit written
72+permission.
73+
74+5) The Font Software, modified or unmodified, in part or in whole,
75+must be distributed entirely under this license, and must not be
76+distributed under any other license. The requirement for fonts to
77+remain under this license does not apply to any document created
78+using the Font Software.
79+
80+TERMINATION
81+This license becomes null and void if any of the above conditions are
82+not met.
83+
84+DISCLAIMER
85+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+OTHER DEALINGS IN THE FONT SOFTWARE.
assets/fonts/OFL-inter.txtadded+92 -0
@@ -0,0 +1,92 @@
1+Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
2+
3+This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+This license is copied below, and is also available with a FAQ at:
5+http://scripts.sil.org/OFL
6+
7+-----------------------------------------------------------
8+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9+-----------------------------------------------------------
10+
11+PREAMBLE
12+The goals of the Open Font License (OFL) are to stimulate worldwide
13+development of collaborative font projects, to support the font creation
14+efforts of academic and linguistic communities, and to provide a free and
15+open framework in which fonts may be shared and improved in partnership
16+with others.
17+
18+The OFL allows the licensed fonts to be used, studied, modified and
19+redistributed freely as long as they are not sold by themselves. The
20+fonts, including any derivative works, can be bundled, embedded,
21+redistributed and/or sold with any software provided that any reserved
22+names are not used by derivative works. The fonts and derivatives,
23+however, cannot be released under any other type of license. The
24+requirement for fonts to remain under this license does not apply
25+to any document created using the fonts or their derivatives.
26+
27+DEFINITIONS
28+"Font Software" refers to the set of files released by the Copyright
29+Holder(s) under this license and clearly marked as such. This may
30+include source files, build scripts and documentation.
31+
32+"Reserved Font Name" refers to any names specified as such after the
33+copyright statement(s).
34+
35+"Original Version" refers to the collection of Font Software components as
36+distributed by the Copyright Holder(s).
37+
38+"Modified Version" refers to any derivative made by adding to, deleting,
39+or substituting -- in part or in whole -- any of the components of the
40+Original Version, by changing formats or by porting the Font Software to a
41+new environment.
42+
43+"Author" refers to any designer, engineer, programmer, technical
44+writer or other person who contributed to the Font Software.
45+
46+PERMISSION AND CONDITIONS
47+Permission is hereby granted, free of charge, to any person obtaining
48+a copy of the Font Software, to use, study, copy, merge, embed, modify,
49+redistribute, and sell modified and unmodified copies of the Font
50+Software, subject to the following conditions:
51+
52+1) Neither the Font Software nor any of its individual components,
53+in Original or Modified Versions, may be sold by itself.
54+
55+2) Original or Modified Versions of the Font Software may be bundled,
56+redistributed and/or sold with any software, provided that each copy
57+contains the above copyright notice and this license. These can be
58+included either as stand-alone text files, human-readable headers or
59+in the appropriate machine-readable metadata fields within text or
60+binary files as long as those fields can be easily viewed by the user.
61+
62+3) No Modified Version of the Font Software may use the Reserved Font
63+Name(s) unless explicit written permission is granted by the corresponding
64+Copyright Holder. This restriction only applies to the primary font name as
65+presented to the users.
66+
67+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68+Software shall not be used to promote, endorse or advertise any
69+Modified Version, except to acknowledge the contribution(s) of the
70+Copyright Holder(s) and the Author(s) or with their explicit written
71+permission.
72+
73+5) The Font Software, modified or unmodified, in part or in whole,
74+must be distributed entirely under this license, and must not be
75+distributed under any other license. The requirement for fonts to
76+remain under this license does not apply to any document created
77+using the Font Software.
78+
79+TERMINATION
80+This license becomes null and void if any of the above conditions are
81+not met.
82+
83+DISCLAIMER
84+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92+OTHER DEALINGS IN THE FONT SOFTWARE.
assets/fonts/OFL-notoemoji.txtadded+93 -0
@@ -0,0 +1,93 @@
1+Copyright 2013 Google LLC
2+
3+This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+This license is copied below, and is also available with a FAQ at:
5+https://openfontlicense.org
6+
7+
8+-----------------------------------------------------------
9+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+-----------------------------------------------------------
11+
12+PREAMBLE
13+The goals of the Open Font License (OFL) are to stimulate worldwide
14+development of collaborative font projects, to support the font creation
15+efforts of academic and linguistic communities, and to provide a free and
16+open framework in which fonts may be shared and improved in partnership
17+with others.
18+
19+The OFL allows the licensed fonts to be used, studied, modified and
20+redistributed freely as long as they are not sold by themselves. The
21+fonts, including any derivative works, can be bundled, embedded,
22+redistributed and/or sold with any software provided that any reserved
23+names are not used by derivative works. The fonts and derivatives,
24+however, cannot be released under any other type of license. The
25+requirement for fonts to remain under this license does not apply
26+to any document created using the fonts or their derivatives.
27+
28+DEFINITIONS
29+"Font Software" refers to the set of files released by the Copyright
30+Holder(s) under this license and clearly marked as such. This may
31+include source files, build scripts and documentation.
32+
33+"Reserved Font Name" refers to any names specified as such after the
34+copyright statement(s).
35+
36+"Original Version" refers to the collection of Font Software components as
37+distributed by the Copyright Holder(s).
38+
39+"Modified Version" refers to any derivative made by adding to, deleting,
40+or substituting -- in part or in whole -- any of the components of the
41+Original Version, by changing formats or by porting the Font Software to a
42+new environment.
43+
44+"Author" refers to any designer, engineer, programmer, technical
45+writer or other person who contributed to the Font Software.
46+
47+PERMISSION & CONDITIONS
48+Permission is hereby granted, free of charge, to any person obtaining
49+a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+redistribute, and sell modified and unmodified copies of the Font
51+Software, subject to the following conditions:
52+
53+1) Neither the Font Software nor any of its individual components,
54+in Original or Modified Versions, may be sold by itself.
55+
56+2) Original or Modified Versions of the Font Software may be bundled,
57+redistributed and/or sold with any software, provided that each copy
58+contains the above copyright notice and this license. These can be
59+included either as stand-alone text files, human-readable headers or
60+in the appropriate machine-readable metadata fields within text or
61+binary files as long as those fields can be easily viewed by the user.
62+
63+3) No Modified Version of the Font Software may use the Reserved Font
64+Name(s) unless explicit written permission is granted by the corresponding
65+Copyright Holder. This restriction only applies to the primary font name as
66+presented to the users.
67+
68+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+Software shall not be used to promote, endorse or advertise any
70+Modified Version, except to acknowledge the contribution(s) of the
71+Copyright Holder(s) and the Author(s) or with their explicit written
72+permission.
73+
74+5) The Font Software, modified or unmodified, in part or in whole,
75+must be distributed entirely under this license, and must not be
76+distributed under any other license. The requirement for fonts to
77+remain under this license does not apply to any document created
78+using the Font Software.
79+
80+TERMINATION
81+This license becomes null and void if any of the above conditions are
82+not met.
83+
84+DISCLAIMER
85+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+OTHER DEALINGS IN THE FONT SOFTWARE.
assets/fonts/OFL-notosans.txtadded+101 -0
@@ -0,0 +1,101 @@
1+Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
2+Copyright 2022 The Noto Project Authors (https://github.com/notofonts/arabic)
3+Copyright 2024 The Noto Project Authors (https://github.com/notofonts/hebrew)
4+Copyright 2022 The Noto Project Authors (https://github.com/notofonts/devanagari)
5+Copyright 2022 The Noto Project Authors (https://github.com/notofonts/thai)
6+
7+The fonts NotoSans, NotoSansArabic, NotoSansHebrew, NotoSansDevanagari and
8+NotoSansThai (variable, wght axis) are licensed under the terms below.
9+
10+
11+This Font Software is licensed under the SIL Open Font License, Version 1.1.
12+This license is copied below, and is also available with a FAQ at:
13+https://openfontlicense.org
14+
15+
16+-----------------------------------------------------------
17+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
18+-----------------------------------------------------------
19+
20+PREAMBLE
21+The goals of the Open Font License (OFL) are to stimulate worldwide
22+development of collaborative font projects, to support the font creation
23+efforts of academic and linguistic communities, and to provide a free and
24+open framework in which fonts may be shared and improved in partnership
25+with others.
26+
27+The OFL allows the licensed fonts to be used, studied, modified and
28+redistributed freely as long as they are not sold by themselves. The
29+fonts, including any derivative works, can be bundled, embedded,
30+redistributed and/or sold with any software provided that any reserved
31+names are not used by derivative works. The fonts and derivatives,
32+however, cannot be released under any other type of license. The
33+requirement for fonts to remain under this license does not apply
34+to any document created using the fonts or their derivatives.
35+
36+DEFINITIONS
37+"Font Software" refers to the set of files released by the Copyright
38+Holder(s) under this license and clearly marked as such. This may
39+include source files, build scripts and documentation.
40+
41+"Reserved Font Name" refers to any names specified as such after the
42+copyright statement(s).
43+
44+"Original Version" refers to the collection of Font Software components as
45+distributed by the Copyright Holder(s).
46+
47+"Modified Version" refers to any derivative made by adding to, deleting,
48+or substituting -- in part or in whole -- any of the components of the
49+Original Version, by changing formats or by porting the Font Software to a
50+new environment.
51+
52+"Author" refers to any designer, engineer, programmer, technical
53+writer or other person who contributed to the Font Software.
54+
55+PERMISSION & CONDITIONS
56+Permission is hereby granted, free of charge, to any person obtaining
57+a copy of the Font Software, to use, study, copy, merge, embed, modify,
58+redistribute, and sell modified and unmodified copies of the Font
59+Software, subject to the following conditions:
60+
61+1) Neither the Font Software nor any of its individual components,
62+in Original or Modified Versions, may be sold by itself.
63+
64+2) Original or Modified Versions of the Font Software may be bundled,
65+redistributed and/or sold with any software, provided that each copy
66+contains the above copyright notice and this license. These can be
67+included either as stand-alone text files, human-readable headers or
68+in the appropriate machine-readable metadata fields within text or
69+binary files as long as those fields can be easily viewed by the user.
70+
71+3) No Modified Version of the Font Software may use the Reserved Font
72+Name(s) unless explicit written permission is granted by the corresponding
73+Copyright Holder. This restriction only applies to the primary font name as
74+presented to the users.
75+
76+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
77+Software shall not be used to promote, endorse or advertise any
78+Modified Version, except to acknowledge the contribution(s) of the
79+Copyright Holder(s) and the Author(s) or with their explicit written
80+permission.
81+
82+5) The Font Software, modified or unmodified, in part or in whole,
83+must be distributed entirely under this license, and must not be
84+distributed under any other license. The requirement for fonts to
85+remain under this license does not apply to any document created
86+using the Font Software.
87+
88+TERMINATION
89+This license becomes null and void if any of the above conditions are
90+not met.
91+
92+DISCLAIMER
93+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
101+OTHER DEALINGS IN THE FONT SOFTWARE.
assets/fonts/OFL-splinesansmono.txtadded+93 -0
@@ -0,0 +1,93 @@
1+Copyright 2022 The Spline Sans Mono Project Authors (https://github.com/SorkinType/SplineSansMono)
2+
3+This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+This license is copied below, and is also available with a FAQ at:
5+https://scripts.sil.org/OFL
6+
7+
8+-----------------------------------------------------------
9+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+-----------------------------------------------------------
11+
12+PREAMBLE
13+The goals of the Open Font License (OFL) are to stimulate worldwide
14+development of collaborative font projects, to support the font creation
15+efforts of academic and linguistic communities, and to provide a free and
16+open framework in which fonts may be shared and improved in partnership
17+with others.
18+
19+The OFL allows the licensed fonts to be used, studied, modified and
20+redistributed freely as long as they are not sold by themselves. The
21+fonts, including any derivative works, can be bundled, embedded,
22+redistributed and/or sold with any software provided that any reserved
23+names are not used by derivative works. The fonts and derivatives,
24+however, cannot be released under any other type of license. The
25+requirement for fonts to remain under this license does not apply
26+to any document created using the fonts or their derivatives.
27+
28+DEFINITIONS
29+"Font Software" refers to the set of files released by the Copyright
30+Holder(s) under this license and clearly marked as such. This may
31+include source files, build scripts and documentation.
32+
33+"Reserved Font Name" refers to any names specified as such after the
34+copyright statement(s).
35+
36+"Original Version" refers to the collection of Font Software components as
37+distributed by the Copyright Holder(s).
38+
39+"Modified Version" refers to any derivative made by adding to, deleting,
40+or substituting -- in part or in whole -- any of the components of the
41+Original Version, by changing formats or by porting the Font Software to a
42+new environment.
43+
44+"Author" refers to any designer, engineer, programmer, technical
45+writer or other person who contributed to the Font Software.
46+
47+PERMISSION & CONDITIONS
48+Permission is hereby granted, free of charge, to any person obtaining
49+a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+redistribute, and sell modified and unmodified copies of the Font
51+Software, subject to the following conditions:
52+
53+1) Neither the Font Software nor any of its individual components,
54+in Original or Modified Versions, may be sold by itself.
55+
56+2) Original or Modified Versions of the Font Software may be bundled,
57+redistributed and/or sold with any software, provided that each copy
58+contains the above copyright notice and this license. These can be
59+included either as stand-alone text files, human-readable headers or
60+in the appropriate machine-readable metadata fields within text or
61+binary files as long as those fields can be easily viewed by the user.
62+
63+3) No Modified Version of the Font Software may use the Reserved Font
64+Name(s) unless explicit written permission is granted by the corresponding
65+Copyright Holder. This restriction only applies to the primary font name as
66+presented to the users.
67+
68+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+Software shall not be used to promote, endorse or advertise any
70+Modified Version, except to acknowledge the contribution(s) of the
71+Copyright Holder(s) and the Author(s) or with their explicit written
72+permission.
73+
74+5) The Font Software, modified or unmodified, in part or in whole,
75+must be distributed entirely under this license, and must not be
76+distributed under any other license. The requirement for fonts to
77+remain under this license does not apply to any document created
78+using the Font Software.
79+
80+TERMINATION
81+This license becomes null and void if any of the above conditions are
82+not met.
83+
84+DISCLAIMER
85+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+OTHER DEALINGS IN THE FONT SOFTWARE.
assets/fonts/SplineSansMono-Bold.ttfadded+0 -0

Binary file changed

assets/fonts/SplineSansMono-Medium.ttfadded+0 -0

Binary file changed

assets/fonts/SplineSansMono.ttfadded+0 -0

Binary file changed

assets/icons/LICENSE-lucide.txtadded+15 -0
@@ -0,0 +1,15 @@
1+ISC License
2+
3+Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
4+
5+Permission to use, copy, modify, and/or distribute this software for any
6+purpose with or without fee is hereby granted, provided that the above
7+copyright notice and this permission notice appear in all copies.
8+
9+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
assets/icons/activity.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
11+</svg>
assets/icons/arrow-left-to-line.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M3 19V5" />
11+ <path d="m13 6-6 6 6 6" />
12+ <path d="M7 12h14" />
13+</svg>
assets/icons/arrow-right.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M5 12h14" />
11+ <path d="m12 5 7 7-7 7" />
12+</svg>
assets/icons/audio-waveform.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2" />
11+</svg>
assets/icons/brackets.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M16 3h3v18h-3" />
11+ <path d="M8 21H5V3h3" />
12+</svg>
assets/icons/captions.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="14" x="3" y="5" rx="2" ry="2" />
11+ <path d="M7 15h4M15 15h2M7 11h2M13 11h4" />
12+</svg>
\ No newline at end of file\ No newline at end of file
assets/icons/check.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M20 6 9 17l-5-5" />
11+</svg>
assets/icons/chevron-down.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m6 9 6 6 6-6" />
11+</svg>
assets/icons/chevron-left.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m15 18-6-6 6-6" />
11+</svg>
assets/icons/chevron-right.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m9 18 6-6-6-6" />
11+</svg>
assets/icons/chevron-up.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m18 15-6-6-6 6" />
11+</svg>
assets/icons/circle-check.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="10" />
11+ <path d="m9 12 2 2 4-4" />
12+</svg>
assets/icons/circle-help.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="10" />
11+ <path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" />
12+ <path d="M12 17h.01" />
13+</svg>
assets/icons/circle-x.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="10" />
11+ <path d="m15 9-6 6" />
12+ <path d="m9 9 6 6" />
13+</svg>
assets/icons/circle.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="10" />
11+</svg>
assets/icons/clapperboard.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z" />
11+ <path d="m6.2 5.3 3.1 3.9" />
12+ <path d="m12.4 3.4 3.1 4" />
13+ <path d="M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z" />
14+</svg>
assets/icons/clipboard.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="8" height="4" x="8" y="2" rx="1" ry="1" />
11+ <path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" />
12+</svg>
assets/icons/copy.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
11+ <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
12+</svg>
assets/icons/diamond.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z" />
11+</svg>
assets/icons/download.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
11+ <polyline points="7 10 12 15 17 10" />
12+ <line x1="12" x2="12" y1="15" y2="3" />
13+</svg>
assets/icons/ellipsis.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="1" />
11+ <circle cx="19" cy="12" r="1" />
12+ <circle cx="5" cy="12" r="1" />
13+</svg>
assets/icons/eraser.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21" />
11+ <path d="M22 21H7" />
12+ <path d="m5 11 9 9" />
13+</svg>
assets/icons/eye-off.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49" />
11+ <path d="M14.084 14.158a3 3 0 0 1-4.242-4.242" />
12+ <path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" />
13+ <path d="m2 2 20 20" />
14+</svg>
assets/icons/eye.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
11+ <circle cx="12" cy="12" r="3" />
12+</svg>
assets/icons/fast-forward.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polygon points="13 19 22 12 13 5 13 19" />
11+ <polygon points="2 19 11 12 2 5 2 19" />
12+</svg>
assets/icons/film.svgadded+18 -0
@@ -0,0 +1,18 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" />
11+ <path d="M7 3v18" />
12+ <path d="M3 7.5h4" />
13+ <path d="M3 12h18" />
14+ <path d="M3 16.5h4" />
15+ <path d="M17 3v18" />
16+ <path d="M17 7.5h4" />
17+ <path d="M17 16.5h4" />
18+</svg>
assets/icons/flag-triangle-right.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M7 22V2l10 5-10 5" />
11+</svg>
assets/icons/flag.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z" />
11+ <line x1="4" x2="4" y1="22" y2="15" />
12+</svg>
assets/icons/folder-open.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" />
11+</svg>
assets/icons/folder.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
11+</svg>
assets/icons/gauge.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m12 14 4-4" />
11+ <path d="M3.34 19a10 10 0 1 1 17.32 0" />
12+</svg>
assets/icons/grid-3x3.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" />
11+ <path d="M3 9h18" />
12+ <path d="M3 15h18" />
13+ <path d="M9 3v18" />
14+ <path d="M15 3v18" />
15+</svg>
assets/icons/grip-vertical.svgadded+16 -0
@@ -0,0 +1,16 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="9" cy="12" r="1" />
11+ <circle cx="9" cy="5" r="1" />
12+ <circle cx="9" cy="19" r="1" />
13+ <circle cx="15" cy="12" r="1" />
14+ <circle cx="15" cy="5" r="1" />
15+ <circle cx="15" cy="19" r="1" />
16+</svg>
assets/icons/image.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
11+ <circle cx="9" cy="9" r="2" />
12+ <path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
13+</svg>
assets/icons/info.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="12" cy="12" r="10" />
11+ <path d="M12 16v-4" />
12+ <path d="M12 8h.01" />
13+</svg>
assets/icons/key-round.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z" />
11+ <circle cx="16.5" cy="7.5" r=".5" fill="#ffffff" />
12+</svg>
assets/icons/keyboard.svgadded+19 -0
@@ -0,0 +1,19 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M10 8h.01" />
11+ <path d="M12 12h.01" />
12+ <path d="M14 8h.01" />
13+ <path d="M16 12h.01" />
14+ <path d="M18 8h.01" />
15+ <path d="M6 8h.01" />
16+ <path d="M7 16h10" />
17+ <path d="M8 12h.01" />
18+ <rect width="20" height="16" x="2" y="4" rx="2" />
19+</svg>
assets/icons/layers.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
11+ <path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" />
12+ <path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
13+</svg>
assets/icons/link.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
11+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
12+</svg>
assets/icons/loader-circle.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M21 12a9 9 0 1 1-6.219-8.56" />
11+</svg>
assets/icons/lock-open.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="11" x="3" y="11" rx="2" ry="2" />
11+ <path d="M7 11V7a5 5 0 0 1 9.9-1" />
12+</svg>
assets/icons/lock.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="11" x="3" y="11" rx="2" ry="2" />
11+ <path d="M7 11V7a5 5 0 0 1 10 0v4" />
12+</svg>
assets/icons/magnet.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15" />
11+ <path d="m5 8 4 4" />
12+ <path d="m12 15 4 4" />
13+</svg>
assets/icons/mic.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" />
11+ <path d="M19 10v2a7 7 0 0 1-14 0v-2" />
12+ <line x1="12" x2="12" y1="19" y2="22" />
13+</svg>
assets/icons/minus.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M5 12h14" />
11+</svg>
assets/icons/move.svgadded+16 -0
@@ -0,0 +1,16 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M12 2v20" />
11+ <path d="m15 19-3 3-3-3" />
12+ <path d="m19 9 3 3-3 3" />
13+ <path d="M2 12h20" />
14+ <path d="m5 9-3 3 3 3" />
15+ <path d="m9 5 3-3 3 3" />
16+</svg>
assets/icons/palette.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="13.5" cy="6.5" r=".5" fill="#ffffff" />
11+ <circle cx="17.5" cy="10.5" r=".5" fill="#ffffff" />
12+ <circle cx="8.5" cy="7.5" r=".5" fill="#ffffff" />
13+ <circle cx="6.5" cy="12.5" r=".5" fill="#ffffff" />
14+ <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z" />
15+</svg>
assets/icons/pause.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect x="14" y="4" width="4" height="16" rx="1" />
11+ <rect x="6" y="4" width="4" height="16" rx="1" />
12+</svg>
assets/icons/play.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polygon points="6 3 20 12 6 21 6 3" />
11+</svg>
assets/icons/plus.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M5 12h14" />
11+ <path d="M12 5v14" />
12+</svg>
assets/icons/redo-2.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m15 14 5-5-5-5" />
11+ <path d="M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13" />
12+</svg>
assets/icons/refresh-cw.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
11+ <path d="M21 3v5h-5" />
12+ <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
13+ <path d="M8 16H3v5" />
14+</svg>
assets/icons/repeat.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m17 2 4 4-4 4" />
11+ <path d="M3 11v-1a4 4 0 0 1 4-4h14" />
12+ <path d="m7 22-4-4 4-4" />
13+ <path d="M21 13v1a4 4 0 0 1-4 4H3" />
14+</svg>
assets/icons/rotate-ccw.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" />
11+ <path d="M3 3v5h5" />
12+</svg>
assets/icons/save.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" />
11+ <path d="M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" />
12+ <path d="M7 3v4a1 1 0 0 0 1 1h7" />
13+</svg>
assets/icons/scaling.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
11+ <path d="M14 15H9v-5" />
12+ <path d="M16 3h5v5" />
13+ <path d="M21 3 9 15" />
14+</svg>
assets/icons/scan.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M3 7V5a2 2 0 0 1 2-2h2" />
11+ <path d="M17 3h2a2 2 0 0 1 2 2v2" />
12+ <path d="M21 17v2a2 2 0 0 1-2 2h-2" />
13+ <path d="M7 21H5a2 2 0 0 1-2-2v-2" />
14+</svg>
assets/icons/scissors.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="6" cy="6" r="3" />
11+ <path d="M8.12 8.12 12 12" />
12+ <path d="M20 4 8.12 15.88" />
13+ <circle cx="6" cy="18" r="3" />
14+ <path d="M14.8 14.8 20 20" />
15+</svg>
assets/icons/search.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="11" cy="11" r="8" />
11+ <path d="m21 21-4.3-4.3" />
12+</svg>
assets/icons/settings.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
11+ <circle cx="12" cy="12" r="3" />
12+</svg>
assets/icons/signal.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M2 20h.01" />
11+ <path d="M7 20v-4" />
12+ <path d="M12 20v-8" />
13+ <path d="M17 20V8" />
14+ <path d="M22 4v16" />
15+</svg>
assets/icons/skip-back.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polygon points="19 20 9 12 19 4 19 20" />
11+ <line x1="5" x2="5" y1="19" y2="5" />
12+</svg>
assets/icons/skip-forward.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polygon points="5 4 15 12 5 20 5 4" />
11+ <line x1="19" x2="19" y1="5" y2="19" />
12+</svg>
assets/icons/sliders-horizontal.svgadded+19 -0
@@ -0,0 +1,19 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <line x1="21" x2="14" y1="4" y2="4" />
11+ <line x1="10" x2="3" y1="4" y2="4" />
12+ <line x1="21" x2="12" y1="12" y2="12" />
13+ <line x1="8" x2="3" y1="12" y2="12" />
14+ <line x1="21" x2="16" y1="20" y2="20" />
15+ <line x1="12" x2="3" y1="20" y2="20" />
16+ <line x1="14" x2="14" y1="2" y2="6" />
17+ <line x1="8" x2="8" y1="10" y2="14" />
18+ <line x1="16" x2="16" y1="18" y2="22" />
19+</svg>
assets/icons/sparkles.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" />
11+ <path d="M20 3v4" />
12+ <path d="M22 5h-4" />
13+ <path d="M4 17v2" />
14+ <path d="M5 18H3" />
15+</svg>
assets/icons/spline.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="19" cy="5" r="2" />
11+ <circle cx="5" cy="19" r="2" />
12+ <path d="M5 17A12 12 0 0 1 17 5" />
13+</svg>
assets/icons/square-arrow-down-left.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" />
11+ <path d="m16 8-8 8" />
12+ <path d="M16 16H8V8" />
13+</svg>
assets/icons/square-arrow-down-right.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" />
11+ <path d="m8 8 8 8" />
12+ <path d="M16 8v8H8" />
13+</svg>
assets/icons/square.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <rect width="18" height="18" x="3" y="3" rx="2" />
11+</svg>
assets/icons/star-filled.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="#ffffff"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z" />
11+</svg>
assets/icons/star.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z" />
11+</svg>
assets/icons/step-back.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <line x1="18" x2="18" y1="20" y2="4" />
11+ <polygon points="14,20 4,12 14,4" />
12+</svg>
assets/icons/step-forward.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <line x1="6" x2="6" y1="4" y2="20" />
11+ <polygon points="10,4 20,12 10,20" />
12+</svg>
assets/icons/timer.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <line x1="10" x2="14" y1="2" y2="2" />
11+ <line x1="12" x2="15" y1="14" y2="11" />
12+ <circle cx="12" cy="14" r="8" />
13+</svg>
assets/icons/trash-2.svgadded+15 -0
@@ -0,0 +1,15 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M3 6h18" />
11+ <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
12+ <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
13+ <line x1="10" x2="10" y1="11" y2="17" />
14+ <line x1="14" x2="14" y1="11" y2="17" />
15+</svg>
assets/icons/trending-down.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polyline points="22 17 13.5 8.5 8.5 13.5 2 7" />
11+ <polyline points="16 17 22 17 22 11" />
12+</svg>
assets/icons/trending-up.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polyline points="22 7 13.5 15.5 8.5 10.5 2 17" />
11+ <polyline points="16 7 22 7 22 13" />
12+</svg>
assets/icons/triangle-alert.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
11+ <path d="M12 9v4" />
12+ <path d="M12 17h.01" />
13+</svg>
assets/icons/type.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <polyline points="4 7 4 4 20 4 20 7" />
11+ <line x1="9" x2="15" y1="20" y2="20" />
12+ <line x1="12" x2="12" y1="4" y2="20" />
13+</svg>
assets/icons/undo-2.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M9 14 4 9l5-5" />
11+ <path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11" />
12+</svg>
assets/icons/unlink.svgadded+16 -0
@@ -0,0 +1,16 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71" />
11+ <path d="m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71" />
12+ <line x1="8" x2="8" y1="2" y2="5" />
13+ <line x1="2" x2="5" y1="8" y2="8" />
14+ <line x1="16" x2="16" y1="19" y2="22" />
15+ <line x1="19" x2="22" y1="16" y2="16" />
16+</svg>
assets/icons/upload.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
11+ <polyline points="17 8 12 3 7 8" />
12+ <line x1="12" x2="12" y1="3" y2="15" />
13+</svg>
assets/icons/volume-2.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
11+ <path d="M16 9a5 5 0 0 1 0 6" />
12+ <path d="M19.364 18.364a9 9 0 0 0 0-12.728" />
13+</svg>
assets/icons/volume-x.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z" />
11+ <line x1="22" x2="16" y1="9" y2="15" />
12+ <line x1="16" x2="22" y1="9" y2="15" />
13+</svg>
assets/icons/wand-sparkles.svgadded+18 -0
@@ -0,0 +1,18 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72" />
11+ <path d="m14 7 3 3" />
12+ <path d="M5 6v4" />
13+ <path d="M19 14v4" />
14+ <path d="M10 2v2" />
15+ <path d="M7 8H3" />
16+ <path d="M21 16h-4" />
17+ <path d="M11 3H9" />
18+</svg>
assets/icons/wrench.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" />
11+</svg>
assets/icons/x.svgadded+12 -0
@@ -0,0 +1,12 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M18 6 6 18" />
11+ <path d="m6 6 12 12" />
12+</svg>
assets/icons/zap.svgadded+11 -0
@@ -0,0 +1,11 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
11+</svg>
assets/icons/zoom-in.svgadded+14 -0
@@ -0,0 +1,14 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="11" cy="11" r="8" />
11+ <line x1="21" x2="16.65" y1="21" y2="16.65" />
12+ <line x1="11" x2="11" y1="8" y2="14" />
13+ <line x1="8" x2="14" y1="11" y2="11" />
14+</svg>
assets/icons/zoom-out.svgadded+13 -0
@@ -0,0 +1,13 @@
1+<svg
2+ xmlns="http://www.w3.org/2000/svg"
3+ viewBox="0 0 24 24"
4+ fill="none"
5+ stroke="#ffffff"
6+ stroke-width="1.75"
7+ stroke-linecap="round"
8+ stroke-linejoin="round"
9+>
10+ <circle cx="11" cy="11" r="8" />
11+ <line x1="21" x2="16.65" y1="21" y2="16.65" />
12+ <line x1="8" x2="14" y1="11" y2="11" />
13+</svg>
crates/app/Cargo.tomlmodified+3 -0
@@ -8,6 +8,9 @@ name = "edith"
8 path = "src/main.rs"8 path = "src/main.rs"
9 9
10 [dependencies]10 [dependencies]
11+# The local clock time an unsaved-edits autosave was written at, for the recovery question.
12+chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
11 engine = { path = "../engine" }13 engine = { path = "../engine" }
14+ec-image = { path = "../../../edith_codecs/crates/ec-image" }
12 gpui = "0.2.2"15 gpui = "0.2.2"
13 image = "0.25"16 image = "0.25"
crates/app/src/audio_cards.rsmodified+153 -6
@@ -29,6 +29,146 @@ pub(crate) fn speed_at(permille: i32) -> Speed {
29 Speed::from_permille(permille.clamp(0, i32::from(u16::MAX)) as u16)29 Speed::from_permille(permille.clamp(0, i32::from(u16::MAX)) as u16)
30 }30 }
31 31
32+/// How far a ramp key's speed moves per press of its stepper: a quarter of real
33+/// time, the same quarter the bar's lowest rate is.
34+pub(crate) const RAMP_KEY_STEP: i32 = 250;
35+
36+/// The ramp shapes the speed card and the palette offer, each laid across the clip's
37+/// own length on the timeline.
38+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
39+pub(crate) enum RampPreset {
40+ /// Real time easing up to double.
41+ Up,
42+ /// Double easing down to real time.
43+ Down,
44+ /// Slow, then fast through the middle, then slow: the classic speed ramp.
45+ SlowFastSlow,
46+ /// Fast, then slow through the middle, then fast: the hero shot.
47+ FastSlowFast,
48+}
49+
50+impl RampPreset {
51+ pub(crate) const ALL: [RampPreset; 4] = [
52+ RampPreset::Up,
53+ RampPreset::Down,
54+ RampPreset::SlowFastSlow,
55+ RampPreset::FastSlowFast,
56+ ];
57+
58+ /// The chip's face on the card.
59+ pub(crate) fn label(self) -> &'static str {
60+ match self {
61+ RampPreset::Up => "Speed up",
62+ RampPreset::Down => "Slow down",
63+ RampPreset::SlowFastSlow => "Fast in the middle",
64+ RampPreset::FastSlowFast => "Slow in the middle",
65+ }
66+ }
67+
68+ /// The keys of the shape over a clip `frames` timeline frames long. `None` when the
69+ /// clip is too short to hold the shape's keys one frame apart.
70+ pub(crate) fn keys(self, frames: u32) -> Option<Vec<engine::project::SpeedKey>> {
71+ let key = |at: u32, permille: u16| engine::project::SpeedKey {
72+ at,
73+ speed: Speed::from_permille(permille),
74+ };
75+ match self {
76+ RampPreset::Up => (frames >= 1).then(|| vec![key(0, 1000), key(frames, 2000)]),
77+ RampPreset::Down => (frames >= 1).then(|| vec![key(0, 2000), key(frames, 1000)]),
78+ RampPreset::SlowFastSlow => (frames >= 2)
79+ .then(|| vec![key(0, 500), key(frames / 2, 2000), key(frames, 500)]),
80+ RampPreset::FastSlowFast => (frames >= 2)
81+ .then(|| vec![key(0, 2000), key(frames / 2, 500), key(frames, 2000)]),
82+ }
83+ }
84+}
85+
86+/// `keys` with a key of `speed` at clip frame `at`: one already there is replaced,
87+/// else the new one is slotted in order. `None` when the ramp is full
88+/// ([`engine::project::MAX_SPEED_KEYS`]) and `at` is a new frame.
89+pub(crate) fn ramp_with_key(
90+ keys: &[engine::project::SpeedKey],
91+ at: u32,
92+ speed: Speed,
93+) -> Option<Vec<engine::project::SpeedKey>> {
94+ let mut out = keys.to_vec();
95+ match out.iter().position(|k| k.at >= at) {
96+ Some(i) if out[i].at == at => out[i].speed = speed,
97+ _ if out.len() >= engine::project::MAX_SPEED_KEYS => return None,
98+ Some(i) => out.insert(i, engine::project::SpeedKey { at, speed }),
99+ None => out.push(engine::project::SpeedKey { at, speed }),
100+ }
101+ Some(out)
102+}
103+
104+/// `keys` without the `i`th; the last key out leaves no ramp at all.
105+pub(crate) fn ramp_without_key(
106+ keys: &[engine::project::SpeedKey],
107+ i: usize,
108+) -> Vec<engine::project::SpeedKey> {
109+ let mut out = keys.to_vec();
110+ if i < out.len() {
111+ out.remove(i);
112+ }
113+ out
114+}
115+
116+/// `keys` with the `i`th key's speed moved by `steps` of [`RAMP_KEY_STEP`], clamped to
117+/// what a [`Speed`] holds.
118+pub(crate) fn ramp_key_stepped(
119+ keys: &[engine::project::SpeedKey],
120+ i: usize,
121+ steps: i32,
122+) -> Vec<engine::project::SpeedKey> {
123+ let mut out = keys.to_vec();
124+ if let Some(k) = out.get_mut(i) {
125+ k.speed = speed_at(i32::from(k.speed.permille()) + steps * RAMP_KEY_STEP);
126+ }
127+ out
128+}
129+
130+/// The speed curve of a ramp as the card draws it: `n + 1` points across the clip's
131+/// `frames`, x the fraction of the way along and y the speed's place on the speed bar
132+/// (log scale, real time mid-height), so the card's curve and its bar read alike. A
133+/// clip without a ramp draws its constant speed as a level line.
134+pub(crate) fn ramp_curve(
135+ keys: &[engine::project::SpeedKey],
136+ constant: Speed,
137+ frames: u32,
138+ n: usize,
139+) -> Vec<(f32, f32)> {
140+ let n = n.max(1);
141+ (0..=n)
142+ .map(|i| {
143+ let x = i as f32 / n as f32;
144+ let at = (x * frames as f32).round() as u32;
145+ let speed = match keys.is_empty() {
146+ true => constant,
147+ false => engine::project::ramp_speed_at(keys, at),
148+ };
149+ (x, crate::player::cards::speed_fraction(f32::from(speed.permille())))
150+ })
151+ .collect()
152+}
153+
154+/// A clip's speed as its box wears it: `2×` for a constant one, the ramp's keys joined
155+/// by arrows (`1×→2×→1×`) for a ramp, and only its two ends and a count once it has more
156+/// than three keys. `None` for a clip at real time with no ramp.
157+pub(crate) fn speed_chip_text(clip: &Clip) -> Option<String> {
158+ if clip.speed_keys.is_empty() {
159+ return (!clip.speed.is_normal()).then(|| crate::ui::cards::speed_text(clip.speed));
160+ }
161+ let at = |k: &engine::project::SpeedKey| crate::ui::cards::speed_text(k.speed);
162+ let keys = &clip.speed_keys;
163+ Some(match keys.as_slice() {
164+ [only] => at(only),
165+ [a, b] => format!("{}→{}", at(a), at(b)),
166+ [a, b, c] => format!("{}→{}→{}", at(a), at(b), at(c)),
167+ [first, .., last] => format!("{}→{} ({} keys)", at(first), at(last), keys.len()),
168+ [] => return None,
169+ })
170+}
171+
32 /// The silence card's rows, in the order it lists them: how wide the apply172 /// The silence card's rows, in the order it lists them: how wide the apply
33 /// reaches, the threshold and the unit it is read in, the three durations a173 /// reaches, the threshold and the unit it is read in, the three durations a
34 /// scan is told, and the rate the speed-up plays at. What `silence_field`174 /// scan is told, and the rate the speed-up plays at. What `silence_field`
@@ -67,9 +207,9 @@ impl Scope {
67 .collect::<Vec<_>>()207 .collect::<Vec<_>>()
68 .join("+");208 .join("+");
69 match self {209 match self {
70- Scope::Take => format!("this take ({named})"),210+ Scope::Take => format!("this clip ({named})"),
71 Scope::Track => format!("this track ({named})"),211 Scope::Track => format!("this track ({named})"),
72- Scope::Everything => "every track".to_string(),212+ Scope::Everything => "the whole timeline".to_string(),
73 }213 }
74 }214 }
75 }215 }
@@ -115,9 +255,11 @@ pub(crate) fn silence_rate(permille: i32) -> Speed {
115 pub(crate) const EQ_FREQ_LOW: f32 = 20.;255 pub(crate) const EQ_FREQ_LOW: f32 = 20.;
116 pub(crate) const EQ_FREQ_HIGH: f32 = 20_000.;256 pub(crate) const EQ_FREQ_HIGH: f32 = 20_000.;
117 257
118-/// The curve box. Tall enough that 1 dB is a visible move at the ±12 dB axis,258+/// The curve box, docked: a 140 px plot with the knob room above and below it
119-/// and short enough that the card still fits a 360 px window.259+/// (the strip for "Play to see sound" over the plot, the frequency labels under).
120-pub(crate) const EQ_GRAPH_H: f32 = 132.;260+/// Tall enough that 1 dB is a visible move at the ±12 dB axis, and the card scrolls
261+/// in a 360 px window.
262+pub(crate) const EQ_GRAPH_H: f32 = 182.;
121 263
122 /// The curve box maximized: 1 dB and a semitone-ish band of frequency both264 /// The curve box maximized: 1 dB and a semitone-ish band of frequency both
123 /// read as more pixels than the docked floor spends on them -- the same265 /// read as more pixels than the docked floor spends on them -- the same
@@ -176,6 +318,11 @@ pub(crate) const EQ_CURVE_STEPS: usize = 96;
176 /// graph (the nearest band along the frequency axis), so the target is the box.318 /// graph (the nearest band along the frequency axis), so the target is the box.
177 pub(crate) const EQ_HANDLE: f32 = 10.;319 pub(crate) const EQ_HANDLE: f32 = 10.;
178 320
321+/// A band's hit area on the curve: 24 px ([`crate::layout::HIT_MIN`], WCAG
322+/// 2.5.8) centred on the dot, so the point is found by aim alone. The dot is
323+/// drawn [`EQ_HANDLE`] wide inside it; the rest is a target, not a drawing.
324+pub(crate) const EQ_HIT: f32 = crate::layout::HIT_MIN;
325+
179 /// The frequencies the graph names, so the curve can be read as a curve *of326 /// The frequencies the graph names, so the curve can be read as a curve *of
180 /// something*. The two ends label themselves at the edges.327 /// something*. The two ends label themselves at the edges.
181 pub(crate) const EQ_TICKS: [(f32, &str); 5] = [328 pub(crate) const EQ_TICKS: [(f32, &str); 5] = [
@@ -234,7 +381,7 @@ mod eq_graph_maximize_tests {
234 EQ_GRAPH_H,381 EQ_GRAPH_H,
235 "docked height must be the floor maximized also uses"382 "docked height must be the floor maximized also uses"
236 );383 );
237- assert!(EQ_GRAPH_H <= EQ_GRAPH_MAX_H);384+ const { assert!(EQ_GRAPH_H <= EQ_GRAPH_MAX_H) };
238 }385 }
239 }386 }
240 387
crates/app/src/color_ui.rsmodified+570 -33
@@ -1,6 +1,8 @@
1 //! The colour card's numbers and its histogram.1 //! The colour card's numbers and its histogram.
2 2
3 use crate::*;3 use crate::*;
4+use crate::ui::type_scale::{self, Typeset};
5+use gpui::{Rgba, fill};
4 6
5 /// The colour card's four controls, in the order it lists them: what each is7 /// The colour card's four controls, in the order it lists them: what each is
6 /// called and the range it moves in. The order is `ColorParams`' own, which is8 /// called and the range it moves in. The order is `ColorParams`' own, which is
@@ -18,17 +20,16 @@ pub(crate) const COLOR_BANDS: [(&str, f32, f32); 4] = [
18 /// cannot reach two different sets of values.20 /// cannot reach two different sets of values.
19 pub(crate) const COLOR_STEP: f32 = 0.05;21 pub(crate) const COLOR_STEP: f32 = 0.05;
20 22
21-/// The card's width: a slider row is a label, the bar and the value, and the23+/// The card's width: the longest label has to fit on its line beside the value
22-/// longest label has to fit beside all three without truncating (measured24+/// without truncating (measured against "Tint (cool–warm)").
23-/// against "Tint (cool–warm)").
24 pub(crate) const COLOR_W: f32 = 460.;25 pub(crate) const COLOR_W: f32 = 460.;
25-/// How much of a slider row the bar itself gets -- what a drag is read against,26+/// A bar's width for the pointer tests to drive. The card's bars fill the row
26-/// so it takes the width the two nudge buttons used to.27+/// now, so nothing in the app reads this.
28+#[cfg(test)]
27 pub(crate) const COLOR_BAR_W: f32 = 240.;29 pub(crate) const COLOR_BAR_W: f32 = 240.;
28 30
29-/// The histogram's bins per channel. 64 is four codes of an 8-bit ramp per bin:31+/// The histogram's bins. 64 is four codes of an 8-bit ramp per bin: fine enough
30-/// fine enough to see a grade tilt, coarse enough that a subsampled count is32+/// to see a grade tilt, coarse enough that a subsampled count is not noise.
31-/// not noise.
32 pub(crate) const HIST_BINS: usize = 64;33 pub(crate) const HIST_BINS: usize = 64;
33 34
34 /// How many pixels of a frame the histogram reads. The stride is35 /// How many pixels of a frame the histogram reads. The stride is
@@ -36,7 +37,7 @@ pub(crate) const HIST_BINS: usize = 64;
36 /// thousandth of the frame and walks across columns rather than down one.37 /// thousandth of the frame and walks across columns rather than down one.
37 pub(crate) const HIST_SAMPLES: usize = 8_192;38 pub(crate) const HIST_SAMPLES: usize = 8_192;
38 39
39-/// The histogram box. Shorter than the equalizer's curve because four slider40+/// The histogram box. Shorter than the equalizer's curve because the slider
40 /// rows stand under it and the card still has to fit a 360 px window.41 /// rows stand under it and the card still has to fit a 360 px window.
41 pub(crate) const HIST_H: f32 = 96.;42 pub(crate) const HIST_H: f32 = 96.;
42 43
@@ -48,57 +49,593 @@ pub(crate) fn color_snap(value: f32) -> f32 {
48 }49 }
49 50
50 /// How the frame on screen is spread across the tone range: `HIST_BINS` counts51 /// How the frame on screen is spread across the tone range: `HIST_BINS` counts
51-/// per channel, read off the BGRA the decoder handed over -- which is the52+/// of its luma, read off the BGRA the decoder handed over -- which is the
52 /// *graded* picture, because the grade is folded into the conversion53 /// *graded* picture, because the grade is folded into the conversion
53 /// (`engine::convert::i420_to_bgra_with`). So what this counts is what the eye54 /// (`engine::convert::i420_to_bgra_with`). So what this counts is what the eye
54 /// is looking at, and moving a slider moves it.55 /// is looking at, and moving a slider moves it.
55 ///56 ///
56 /// Every [`HIST_SAMPLES`]th-of-a-frame pixel, not every pixel: a shape drawn57 /// Every [`HIST_SAMPLES`]th-of-a-frame pixel, not every pixel: a shape drawn
57 /// from eight thousand samples is the same shape, at a thousandth of the reads.58 /// from eight thousand samples is the same shape, at a thousandth of the reads.
58-pub(crate) fn histogram(bgra: &[u8]) -> [[u32; HIST_BINS]; 3] {59+pub(crate) fn histogram(bgra: &[u8]) -> [u32; HIST_BINS] {
59 let pixels = bgra.len() / 4;60 let pixels = bgra.len() / 4;
60 let stride = (pixels / HIST_SAMPLES).max(1);61 let stride = (pixels / HIST_SAMPLES).max(1);
61- let mut bins = [[0u32; HIST_BINS]; 3];62+ let mut bins = [0u32; HIST_BINS];
62 for p in (0..pixels).step_by(stride) {63 for p in (0..pixels).step_by(stride) {
63 let px = &bgra[p * 4..];64 let px = &bgra[p * 4..];
64- // BGRA on the wire, `[r, g, b]` in the bins: the graph names channels65+ // BGRA on the wire. Rec. 709 weights in 256ths (54 + 183 + 19 is 256),
65- // the way a person does.66+ // so the luma stays in 0..=255 with no division.
66- for (channel, value) in [px[2], px[1], px[0]].into_iter().enumerate() {67+ let luma = (54 * u32::from(px[2]) + 183 * u32::from(px[1]) + 19 * u32::from(px[0])) >> 8;
67- bins[channel][usize::from(value) * HIST_BINS / 256] += 1;68+ bins[luma as usize * HIST_BINS / 256] += 1;
68- }
69 }69 }
70 bins70 bins
71 }71 }
72 72
73-/// The three counts drawn as three lines across the box, tallest bin to the top.73+/// The luma counts drawn as one line across the box, tallest bin to the top.
74 ///74 ///
75 /// Square root, not linear: a shot with a big flat area (a night sky, a title75 /// Square root, not linear: a shot with a big flat area (a night sky, a title
76 /// card) puts one bin so far above the rest that a linear graph is a single76 /// card) puts one bin so far above the rest that a linear graph is a single
77 /// spike beside a flat line, and the tilt a grade puts in the rest is exactly77 /// spike beside a flat line, and the tilt a grade puts in the rest is exactly
78 /// what the card is for.78 /// what the card is for.
79-pub(crate) fn hist_curves(bins: [[u32; HIST_BINS]; 3]) -> impl IntoElement {79+pub(crate) fn hist_curves(bins: [u32; HIST_BINS]) -> impl IntoElement {
80 canvas(80 canvas(
81 |_, _, _| (),81 |_, _, _| (),
82 move |bounds, _, window, _| {82 move |bounds, _, window, _| {
83 let (o, s) = (bounds.origin, bounds.size);83 let (o, s) = (bounds.origin, bounds.size);
84- // Shared across the channels, so their relative weight is readable;84+ // Never zero, so an unpumped (all-zero) histogram is a flat line
85- // never zero, so an unpumped (all-zero) histogram is a flat line
86 // rather than a division by nothing.85 // rather than a division by nothing.
87- let top = bins.iter().flatten().copied().max().unwrap_or(0).max(1) as f32;86+ let top = bins.iter().copied().max().unwrap_or(0).max(1) as f32;
88- for (channel, counts) in bins.iter().enumerate() {87+ let mut path = PathBuilder::stroke(px(1.5));
89- let mut path = PathBuilder::stroke(px(1.5));88+ for (bin, &count) in bins.iter().enumerate() {
90- for (bin, &count) in counts.iter().enumerate() {89+ let at = point(
91- let at = point(90+ o.x + s.width * (bin as f32 / (HIST_BINS - 1) as f32),
92- o.x + s.width * (bin as f32 / (HIST_BINS - 1) as f32),91+ o.y + s.height * (1. - (count as f32 / top).sqrt()),
93- o.y + s.height * (1. - (count as f32 / top).sqrt()),92+ );
93+ match bin {
94+ 0 => path.move_to(at),
95+ _ => path.line_to(at),
96+ }
97+ }
98+ if let Ok(path) = path.build() {
99+ window.paint_path(path, rgb(HIST_INK()[1]));
100+ }
101+ },
102+ )
103+ .absolute()
104+ .size_full()
105+}
106+
107+// -- the look: wheels, curves and a LUT, and the scopes ------------------------
108+
109+/// The colour card's sections, one shown at a time so the card stays the height
110+/// it was: the four sliders, the wheels, the curves, the LUT. The order is the
111+/// order the grade runs in, bar the sliders, which are what a grade starts with.
112+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113+pub(crate) enum ColorSection {
114+ Basic,
115+ Wheels,
116+ Curves,
117+ Lut,
118+}
119+
120+pub(crate) const COLOR_SECTIONS: [(ColorSection, &str); 4] = [
121+ (ColorSection::Basic, "Basic"),
122+ (ColorSection::Wheels, "Wheels"),
123+ (ColorSection::Curves, "Curves"),
124+ (ColorSection::Lut, "Look file"),
125+];
126+
127+/// What the graph over the controls shows.
128+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
129+pub(crate) enum ScopeView {
130+ Histogram,
131+ Waveform,
132+ Vectorscope,
133+ Parade,
134+}
135+
136+pub(crate) const SCOPE_VIEWS: [(ScopeView, &str); 4] = [
137+ (ScopeView::Histogram, "Histogram"),
138+ (ScopeView::Waveform, "Waveform"),
139+ (ScopeView::Vectorscope, "Vectorscope"),
140+ (ScopeView::Parade, "RGB parade"),
141+];
142+
143+/// Columns the waveform and parade are counted into.
144+pub(crate) const SCOPE_COLS: usize = 48;
145+
146+/// The wheels the Wheels section picks between, in `engine::color::Wheels`' order.
147+pub(crate) const WHEEL_NAMES: [&str; 3] = ["Lift", "Gamma", "Gain"];
148+/// What each wheel does, for its tooltip.
149+pub(crate) const WHEEL_WHY: [&str; 3] = [
150+ "Raises or lowers the blacks; white stays where it is",
151+ "Bends the mid-tones; black and white stay",
152+ "Scales the whole channel from black: the highlights move most",
153+];
154+/// The channel rows of a wheel and the curves' channel picker, in
155+/// `engine::color::CHANNELS`' order.
156+pub(crate) const CHANNEL_NAMES: [&str; 4] = ["Master", "Red", "Green", "Blue"];
157+/// The five points of a curve the Curves section edits: their inputs and names.
158+pub(crate) const CURVE_GRID: [(f32, &str); 5] =
159+ [(0.0, "Blacks"), (0.25, "Shadows"), (0.5, "Mid-tones"), (0.75, "Highlights"), (1.0, "Whites")];
160+
161+/// Slider slots: the four basic bands, then a wheel's four channels, the five
162+/// curve points and the LUT's intensity. One recorded bar box each.
163+pub(crate) const WHEEL_BAND: usize = 4;
164+pub(crate) const CURVE_BAND: usize = WHEEL_BAND + 4;
165+pub(crate) const LUT_BAND: usize = CURVE_BAND + CURVE_GRID.len();
166+pub(crate) const COLOR_SLOTS: usize = LUT_BAND + 1;
167+
168+/// The bands a section's arrows walk.
169+pub(crate) fn section_bands(section: ColorSection) -> std::ops::Range<usize> {
170+ match section {
171+ ColorSection::Basic => 0..COLOR_BANDS.len(),
172+ ColorSection::Wheels => WHEEL_BAND..CURVE_BAND,
173+ ColorSection::Curves => CURVE_BAND..LUT_BAND,
174+ ColorSection::Lut => LUT_BAND..COLOR_SLOTS,
175+ }
176+}
177+
178+/// A band's name, range and keyboard step.
179+pub(crate) fn band_spec(band: usize) -> (&'static str, f32, f32, f32) {
180+ match band {
181+ 0..WHEEL_BAND => {
182+ let (name, lo, hi) = COLOR_BANDS[band];
183+ (name, lo, hi, COLOR_STEP)
184+ }
185+ WHEEL_BAND..CURVE_BAND => (CHANNEL_NAMES[band - WHEEL_BAND], -1., 1., 0.01),
186+ CURVE_BAND..LUT_BAND => (CURVE_GRID[band - CURVE_BAND].1, 0., 1., 0.01),
187+ _ => ("Intensity", 0., 1., COLOR_STEP),
188+ }
189+}
190+
191+/// The value of `band` in `params`, with `wheel` and `curve` the Wheels and
192+/// Curves sections' picks. A curve point reads the curve's output at that input,
193+/// whatever points the curve was made of.
194+pub(crate) fn band_value(params: &ColorParams, band: usize, wheel: usize, curve: usize) -> f32 {
195+ let look = &params.look;
196+ match band {
197+ 0..WHEEL_BAND => *band_mut(&mut params.clone(), band),
198+ WHEEL_BAND..CURVE_BAND => wheel_of(&look.wheels, wheel)[band - WHEEL_BAND],
199+ CURVE_BAND..LUT_BAND => curve_at(&look.curves[curve], CURVE_GRID[band - CURVE_BAND].0),
200+ _ => look.lut_mix,
201+ }
202+}
203+
204+/// [`band_value`]'s writer. Moving a curve point rebuilds that curve on the
205+/// five-point grid (each point at the output the curve had there), so an
206+/// all-diagonal grid is the straight curve again.
207+pub(crate) fn set_band(params: &mut ColorParams, band: usize, wheel: usize, curve: usize, value: f32) {
208+ let look = &mut params.look;
209+ match band {
210+ 0..WHEEL_BAND => *band_mut(params, band) = value,
211+ WHEEL_BAND..CURVE_BAND => {
212+ let w = &mut look.wheels;
213+ let slot = match wheel {
214+ 0 => &mut w.lift,
215+ 1 => &mut w.gamma,
216+ _ => &mut w.gain,
217+ };
218+ slot[band - WHEEL_BAND] = value;
219+ }
220+ CURVE_BAND..LUT_BAND => {
221+ let c = &look.curves[curve];
222+ let mut pts: Vec<[f32; 2]> = CURVE_GRID.iter().map(|&(x, _)| [x, curve_at(c, x)]).collect();
223+ pts[band - CURVE_BAND][1] = value;
224+ look.curves[curve] = if pts.iter().all(|p| (p[0] - p[1]).abs() < 1e-6) {
225+ engine::color::Curve::default()
226+ } else {
227+ engine::color::Curve::new(&pts).unwrap_or_default()
228+ };
229+ }
230+ _ => look.lut_mix = value,
231+ }
232+}
233+
234+/// A band's neutral value: what Reset puts back.
235+pub(crate) fn band_neutral(band: usize) -> f32 {
236+ match band {
237+ 0..WHEEL_BAND => *band_mut(&mut ColorParams::default(), band),
238+ WHEEL_BAND..CURVE_BAND => 0.,
239+ CURVE_BAND..LUT_BAND => CURVE_GRID[band - CURVE_BAND].0,
240+ _ => 1.,
241+ }
242+}
243+
244+fn wheel_of(w: &engine::color::Wheels, wheel: usize) -> [f32; 4] {
245+ match wheel {
246+ 0 => w.lift,
247+ 1 => w.gamma,
248+ _ => w.gain,
249+ }
250+}
251+
252+/// A curve's output at input `x`.
253+pub(crate) fn curve_at(c: &engine::color::Curve, x: f32) -> f32 {
254+ if c.points().is_empty() {
255+ return x;
256+ }
257+ let t = c.sampled(257);
258+ t[(x.clamp(0., 1.) * 256.).round() as usize]
259+}
260+
261+/// `color` at `alpha` (0..255) as a gpui colour.
262+fn ink(color: u32, alpha: u8) -> Rgba {
263+ rgba((color << 8) | u32::from(alpha))
264+}
265+
266+/// Count to alpha: square root, so a sparse trace still shows beside a dense one
267+/// (the histogram's own reason).
268+fn glow(count: u32, top: u32) -> u8 {
269+ if count == 0 {
270+ return 0;
271+ }
272+ (40. + 215. * (count as f32 / top.max(1) as f32).sqrt()).min(255.) as u8
273+}
274+
275+/// The scopes drawn in the graph box: the waveform, the vectorscope or the RGB
276+/// parade of the frame on screen, counted at low resolution
277+/// ([`engine::scopes::compute`]). Theme inks: the histogram's three. Each one
278+/// carries a faint graticule and its labels in the caption ink, so a reading
279+/// can be taken off it: 0 to 100 percent lines on the two level scopes, and a
280+/// centre cross, a ring and the six colour targets on the vectorscope.
281+pub(crate) fn scope_canvas(view: ScopeView, scopes: Option<engine::scopes::Scopes>) -> impl IntoElement {
282+ let (head, foot) = plot_inset(view);
283+ let gutter = plot_gutter(view);
284+ let plot = canvas(
285+ |_, _, _| (),
286+ move |bounds, _, window, _| {
287+ let (o, sz) = (bounds.origin, bounds.size);
288+ let levels = engine::scopes::LEVELS;
289+ let cell = |x0: f32, y0: f32, w: f32, h: f32| {
290+ Bounds::new(point(o.x + px(x0), o.y + px(y0)), size(px(w), px(h)))
291+ };
292+ let (w, h) = (f32::from(sz.width), f32::from(sz.height));
293+ let [red, green, blue] = HIST_INK();
294+ // The graticule goes down first, so the trace is drawn over it.
295+ let faint = ink(INK3(), GRATICULE_ALPHA);
296+ match view {
297+ ScopeView::Histogram => {}
298+ ScopeView::Waveform | ScopeView::Parade => {
299+ for f in GRATICULE_LEVELS {
300+ window.paint_quad(fill(cell(0., (h * (1. - f)).clamp(0., h - 1.), w, 1.), faint));
301+ }
302+ if view == ScopeView::Parade {
303+ for k in 1..3 {
304+ window.paint_quad(fill(cell(w * k as f32 / 3., 0., 1., h), faint));
305+ }
306+ }
307+ }
308+ ScopeView::Vectorscope => {
309+ let (cx, cy) = (w / 2., h / 2.);
310+ let rr = w.min(h) / 2. - VECTOR_RING_INSET;
311+ window.paint_quad(fill(cell(cx, 0., 1., h), faint));
312+ window.paint_quad(fill(cell(0., cy, w, 1.), faint));
313+ let mut ring = PathBuilder::stroke(px(1.));
314+ for i in 0..=72 {
315+ let a = i as f32 / 72. * std::f32::consts::TAU;
316+ let at = point(o.x + px(cx + rr * a.cos()), o.y + px(cy + rr * a.sin()));
317+ match i {
318+ 0 => ring.move_to(at),
319+ _ => ring.line_to(at),
320+ }
321+ }
322+ if let Ok(ring) = ring.build() {
323+ window.paint_path(ring, faint);
324+ }
325+ for (_, cb, cr) in VECTOR_TARGETS {
326+ let (dx, dy) = unit(cb, cr);
327+ window.paint_quad(fill(cell(cx + rr * dx - 1.5, cy - rr * dy - 1.5, 3., 3.), ink(INK3(), 0x90)));
328+ }
329+ }
330+ }
331+ let Some(s) = &scopes else {
332+ return;
333+ };
334+ match view {
335+ ScopeView::Histogram => {}
336+ ScopeView::Waveform => {
337+ let top = s.wave.iter().copied().max().unwrap_or(1);
338+ let (cw, ch) = (w / s.cols as f32, h / levels as f32);
339+ for lvl in 0..levels {
340+ for col in 0..s.cols {
341+ let a = glow(s.wave[lvl * s.cols + col], top);
342+ if a > 0 {
343+ let y = h - (lvl + 1) as f32 * ch;
344+ window.paint_quad(fill(cell(col as f32 * cw, y, cw, ch), ink(green, a)));
345+ }
346+ }
347+ }
348+ }
349+ ScopeView::Parade => {
350+ let third = w / 3.;
351+ let (cw, ch) = (third / s.cols as f32, h / levels as f32);
352+ for (k, color) in [red, green, blue].into_iter().enumerate() {
353+ let grid = &s.parade[k];
354+ let top = grid.iter().copied().max().unwrap_or(1);
355+ for lvl in 0..levels {
356+ for col in 0..s.cols {
357+ let a = glow(grid[lvl * s.cols + col], top);
358+ if a > 0 {
359+ let x = k as f32 * third + col as f32 * cw;
360+ let y = h - (lvl + 1) as f32 * ch;
361+ window.paint_quad(fill(cell(x, y, cw, ch), ink(color, a)));
362+ }
363+ }
364+ }
365+ }
366+ }
367+ ScopeView::Vectorscope => {
368+ let n = engine::scopes::VECTOR;
369+ let side = w.min(h);
370+ let (x0, y0, c) = ((w - side) / 2., (h - side) / 2., side / n as f32);
371+ let top = s.vector.iter().copied().max().unwrap_or(1);
372+ for row in 0..n {
373+ for col in 0..n {
374+ let a = glow(s.vector[row * n + col], top);
375+ if a > 0 {
376+ window.paint_quad(fill(cell(x0 + col as f32 * c, y0 + row as f32 * c, c, c), ink(green, a)));
377+ }
378+ }
379+ }
380+ }
381+ }
382+ },
383+ )
384+ .absolute()
385+ .left(px(gutter))
386+ .right_0()
387+ .top(px(head))
388+ .bottom(px(foot));
389+ div()
390+ .absolute()
391+ .size_full()
392+ .child(plot)
393+ .children(scope_labels(view))
394+}
395+
396+/// The strip above and below a parade's traces: the R/G/B names sit in the top one, and the
397+/// bottom one gives the 0% label room below its line. Other scopes use the whole box.
398+const PARADE_HEAD: f32 = 16.;
399+const PARADE_FOOT: f32 = 20.;
400+
401+/// The (top, bottom) inset of a scope's traces inside the graph box.
402+fn plot_inset(view: ScopeView) -> (f32, f32) {
403+ match view {
404+ ScopeView::Parade => (PARADE_HEAD, PARADE_FOOT),
405+ _ => (0., 0.),
406+ }
407+}
408+
409+/// The left strip that holds a level scope's percent labels, clear of its traces.
410+/// Other scopes have no labels down the side, so they keep the whole box.
411+/// Sized for the widest percent label, "100%", at the caption size with room to spare for the
412+/// glyphs' real width, so a label is never cut at the box's left edge.
413+fn axis_gutter() -> f32 {
414+ crate::ui::popup::text_w("100%", type_scale::CAPTION_PX, false) * 1.2 + 8.
415+}
416+
417+fn plot_gutter(view: ScopeView) -> f32 {
418+ match view {
419+ ScopeView::Waveform | ScopeView::Parade => axis_gutter(),
420+ _ => 0.,
421+ }
422+}
423+
424+/// The graticule's level lines, as fractions of the scope's height: 0 to 100 percent.
425+const GRATICULE_LEVELS: [f32; 5] = [0., 0.25, 0.5, 0.75, 1.];
426+
427+/// The graticule's line strength: the caption ink at a low alpha, so it reads as a guide.
428+const GRATICULE_ALPHA: u8 = 0x38;
429+
430+/// How far the vectorscope's ring sits in from the box's edge, so the target
431+/// letters have room outside it.
432+const VECTOR_RING_INSET: f32 = 14.;
433+
434+/// The six colour targets on a vectorscope, each as the Cb and Cr its full-scale
435+/// colour lands on in the engine's own units ([`engine::scopes::compute`]).
436+const VECTOR_TARGETS: [(&str, f32, f32); 6] = [
437+ ("R", -0.161, 0.445),
438+ ("Mg", 0.316, 0.373),
439+ ("B", 0.478, -0.072),
440+ ("Cy", 0.161, -0.445),
441+ ("G", -0.316, -0.373),
442+ ("Yl", -0.478, 0.072),
443+];
444+
445+/// A target's direction on the ring, unit length, with Cr up (screen y is down, so
446+/// the caller flips the sign for the screen).
447+fn unit(cb: f32, cr: f32) -> (f32, f32) {
448+ let len = cb.hypot(cr).max(f32::EPSILON);
449+ (cb / len, cr / len)
450+}
451+
452+/// The labels over a scope's graticule, in the caption ink. The canvas paints the
453+/// lines; the words are plain text laid over it.
454+fn scope_labels(view: ScopeView) -> Vec<Div> {
455+ let label = |text: &str| {
456+ div()
457+ .absolute()
458+ .type_style(type_scale::caption())
459+ .text_color(rgb(INK3()))
460+ .whitespace_nowrap()
461+ .child(text.to_string())
462+ };
463+ // The percent labels sit in the gutter, right-aligned to the box, centred on their line.
464+ let level = |text: &str, y: f32| {
465+ label(text)
466+ .left_0()
467+ .w(px(axis_gutter() - 4.))
468+ .flex()
469+ .justify_end()
470+ .top(px(y - 6.))
471+ };
472+ match view {
473+ ScopeView::Histogram => Vec::new(),
474+ ScopeView::Waveform | ScopeView::Parade => {
475+ let parade = view == ScopeView::Parade;
476+ let (head, foot) = plot_inset(view);
477+ let plot_h = HIST_H - head - foot;
478+ let mut out: Vec<Div> = GRATICULE_LEVELS
479+ .iter()
480+ .map(|&f| level(&format!("{:.0}%", f * 100.), head + plot_h * (1. - f)))
481+ .collect();
482+ if parade {
483+ for (k, name) in ["R", "G", "B"].into_iter().enumerate() {
484+ out.push(
485+ div()
486+ .absolute()
487+ .left(relative(k as f32 / 3.))
488+ .w(relative(1. / 3.))
489+ .top_0()
490+ .h(px(PARADE_HEAD))
491+ .flex()
492+ .items_center()
493+ .justify_center()
494+ .type_style(type_scale::caption())
495+ .text_color(rgb(INK3()))
496+ .child(name),
94 );497 );
95- match bin {498+ }
96- 0 => path.move_to(at),499+ }
97- _ => path.line_to(at),500+ out
501+ }
502+ ScopeView::Vectorscope => {
503+ // The ring is `VECTOR_RING_INSET` in from the scope's side, and the labels sit
504+ // just outside it, centred on the box.
505+ let lr = HIST_H / 2. - VECTOR_RING_INSET + 9.;
506+ VECTOR_TARGETS
507+ .iter()
508+ .map(|&(name, cb, cr)| {
509+ let (dx, dy) = unit(cb, cr);
510+ div()
511+ .absolute()
512+ .left(relative(0.5))
513+ .top(relative(0.5))
514+ .ml(px(lr * dx - 8.))
515+ .mt(px(-lr * dy - 7.))
516+ .w(px(16.))
517+ .h(px(14.))
518+ .flex()
519+ .items_center()
520+ .justify_center()
521+ .type_style(type_scale::caption())
522+ .text_color(rgb(INK3()))
523+ .child(name)
524+ })
525+ .collect()
526+ }
527+ }
528+}
529+
530+/// The picked curve drawn over the graph: the line, and the five grid points as
531+/// small squares, in the channel's ink (master in the light ink).
532+pub(crate) fn curve_overlay(curve: engine::color::Curve, channel: usize) -> impl IntoElement {
533+ canvas(
534+ |_, _, _| (),
535+ move |bounds, _, window, _| {
536+ let (o, s) = (bounds.origin, bounds.size);
537+ let inks = HIST_INK();
538+ let color = if channel == 0 { INK1() } else { inks[channel - 1] };
539+ let t = curve.sampled(65);
540+ let mut path = PathBuilder::stroke(px(1.5));
541+ for (i, &y) in t.iter().enumerate() {
542+ let at = point(o.x + s.width * (i as f32 / 64.), o.y + s.height * (1. - y));
543+ match i {
544+ 0 => path.move_to(at),
545+ _ => path.line_to(at),
546+ }
547+ }
548+ if let Ok(path) = path.build() {
549+ window.paint_path(path, rgb(color));
550+ }
551+ for &(x, _) in &CURVE_GRID {
552+ let y = curve_at(&curve, x);
553+ let c = point(o.x + s.width * x - px(3.), o.y + s.height * (1. - y) - px(3.));
554+ window.paint_quad(fill(Bounds::new(c, size(px(6.), px(6.))), rgb(color)));
555+ }
556+ },
557+ )
558+ .absolute()
559+ .size_full()
560+}
561+
562+// -- the colour wheels ----------------------------------------------------------
563+
564+/// How far a puck at the rim of a wheel pushes a channel: the wheel's R, G and B
565+/// offsets are `WHEEL_REACH` times the puck's position, so the rim is a strong
566+/// but usable tint and the sliders' -1..1 range stays far beyond it.
567+pub(crate) const WHEEL_REACH: f32 = 0.5;
568+
569+/// The R, G, B offsets a puck at `(x, y)` (right and up, the unit disc) stands
570+/// for: the hue is the angle (red at 3 o'clock, green at 7, blue at 11) and the
571+/// saturation the distance, so the three offsets always sum to zero and the
572+/// wheel tints without moving the master.
573+pub(crate) fn wheel_offsets(x: f32, y: f32) -> [f32; 3] {
574+ let len = x.hypot(y);
575+ let k = if len > 1. { 1. / len } else { 1. };
576+ let (x, y) = (x * k, y * k);
577+ let h = 3f32.sqrt() / 2.;
578+ [WHEEL_REACH * x, WHEEL_REACH * (-x / 2. + h * y), WHEEL_REACH * (-x / 2. - h * y)]
579+}
580+
581+/// [`wheel_offsets`]' inverse: where the puck sits for an RGB offset (any mean the
582+/// three share is the master's business, not the pad's, and is dropped).
583+pub(crate) fn wheel_puck(r: f32, g: f32, b: f32) -> (f32, f32) {
584+ let x = (2. * r - g - b) / 3. / WHEEL_REACH;
585+ let y = (g - b) / 3f32.sqrt() / WHEEL_REACH;
586+ let len = x.hypot(y);
587+ if len > 1. { (x / len, y / len) } else { (x, y) }
588+}
589+
590+/// A wheel's RGB offsets snapped to the hundredth the sliders land on.
591+pub(crate) fn wheel_snap(v: f32) -> f32 {
592+ ((v / 0.01).round() * 0.01).clamp(-1., 1.)
593+}
594+
595+/// A wheel's pad: the hue/saturation disc, a cross through the centre and the
596+/// puck at `(x, y)` (the unit disc, up positive).
597+pub(crate) fn wheel_disc(x: f32, y: f32) -> impl IntoElement {
598+ canvas(
599+ |_, _, _| (),
600+ move |bounds, _, window, _| {
601+ let (w, h) = (f32::from(bounds.size.width), f32::from(bounds.size.height));
602+ let (cx, cy) = (f32::from(bounds.origin.x) + w / 2., f32::from(bounds.origin.y) + h / 2.);
603+ let radius = w.min(h) / 2. - 1.;
604+ let (wedges, rings) = (48, 5);
605+ let at = |s: f32, a: f32| point(px(cx + radius * s * a.cos()), px(cy - radius * s * a.sin()));
606+ for ring in 0..rings {
607+ let (s0, s1) = (ring as f32 / rings as f32, (ring + 1) as f32 / rings as f32);
608+ for i in 0..wedges {
609+ let a0 = i as f32 / wedges as f32 * std::f32::consts::TAU;
610+ let a1 = (i + 1) as f32 / wedges as f32 * std::f32::consts::TAU;
611+ let (r, g, b) = engine::decode::viz_hsv_rgb(i as f32 / wedges as f32 * 360., (s0 + s1) / 2. * 0.8, 0.55);
612+ let mut path = PathBuilder::fill();
613+ path.add_polygon(&[at(s0, a0), at(s0, a1), at(s1, a1), at(s1, a0)], false);
614+ if let Ok(path) = path.build() {
615+ window.paint_path(path, rgb((u32::from(r) << 16) | (u32::from(g) << 8) | u32::from(b)));
98 }616 }
99 }617 }
100- if let Ok(path) = path.build() {618+ }
101- window.paint_path(path, rgb(HIST_INK()[channel]));619+ for (a0, a1) in [(std::f32::consts::PI, 0.), (-std::f32::consts::FRAC_PI_2, std::f32::consts::FRAC_PI_2)] {
620+ let mut line = PathBuilder::stroke(px(1.));
621+ line.move_to(at(1., a0));
622+ line.line_to(at(1., a1));
623+ if let Ok(line) = line.build() {
624+ window.paint_path(line, rgba(DARK_SEAM()));
625+ }
626+ }
627+ let (mx, my) = (cx + radius * x, cy - radius * y);
628+ for (r, color, wd) in [(6., 0x000000, 3.), (6., INK1(), 1.5)] {
629+ let mut ring = PathBuilder::stroke(px(wd));
630+ let pts: Vec<_> = (0..20)
631+ .map(|k| {
632+ let a = k as f32 / 20. * std::f32::consts::TAU;
633+ point(px(mx + r * a.cos()), px(my + r * a.sin()))
634+ })
635+ .collect();
636+ ring.add_polygon(&pts, true);
637+ if let Ok(ring) = ring.build() {
638+ window.paint_path(ring, rgb(color));
102 }639 }
103 }640 }
104 },641 },
crates/app/src/creator.rsadded+478 -0
@@ -0,0 +1,478 @@
1+//! The creator tools the MCP server had first and the window now shares: loudness
2+//! normalizing, ducking, captions from speech, filler removal and a voiceover from text.
3+//!
4+//! Everything here takes the session and says what happened; none of it touches the
5+//! window, so the same calls are what the tests drive. The work is the engine's
6+//! ([`engine::normalize`], [`engine::speech`], [`engine::tts`], [`engine::duck`]) -- the
7+//! MCP tools call those very functions, so a mix normalized from either door lands on the
8+//! same numbers.
9+
10+use std::path::{Path, PathBuf};
11+
12+use engine::PlaybackSession;
13+use engine::duck::{self, Duck};
14+use engine::normalize::{self, Report, Scope};
15+use engine::project::{Lane, LaneKind};
16+use engine::speech::{self, Filler, Hear, Spoken};
17+
18+/// The loudness targets the Normalize card offers, in LUFS: online video, streaming speech
19+/// and broadcast (EBU R128). The first is the default.
20+pub(crate) const LUFS_PRESETS: [(&str, f64); 3] = normalize::PRESETS;
21+
22+/// How far the target and the ceiling move per press, in LU and dB.
23+pub(crate) const LUFS_STEP: f64 = 1.0;
24+pub(crate) const PEAK_STEP: f64 = 0.5;
25+/// The target's and the ceiling's ranges, as the engine takes them.
26+pub(crate) const LUFS_RANGE: (f64, f64) = (-40.0, -5.0);
27+pub(crate) const PEAK_RANGE: (f64, f64) = (-9.0, 0.0);
28+
29+/// The languages the captions and fillers cards offer; `auto` lets Whisper decide.
30+pub(crate) const LANGUAGES: [(&str, &str); 12] = [
31+ ("auto", "Auto"),
32+ ("en", "English"),
33+ ("es", "Spanish"),
34+ ("fr", "French"),
35+ ("de", "German"),
36+ ("it", "Italian"),
37+ ("pt", "Portuguese"),
38+ ("nl", "Dutch"),
39+ ("tr", "Turkish"),
40+ ("ru", "Russian"),
41+ ("ja", "Japanese"),
42+ ("zh", "Chinese"),
43+];
44+
45+/// How the cards name a speech model: by what it is for. `tiny` is the quick one, `base` the
46+/// middle, `small` the careful one; a model with no such name keeps its own, capitalised.
47+pub(crate) fn model_label(model: &str) -> String {
48+ match model {
49+ "tiny" => "Fast".to_string(),
50+ "base" => "Balanced".to_string(),
51+ "small" => "Accurate".to_string(),
52+ other => {
53+ let mut c = other.chars();
54+ c.next().map_or_else(String::new, |f| f.to_uppercase().chain(c).collect())
55+ }
56+ }
57+}
58+
59+/// What a model's tooltip says: what it trades off, and its name on disk so the plain word is
60+/// never a mystery.
61+pub(crate) fn model_tip(model: &str) -> String {
62+ let what = match model {
63+ "tiny" => "quickest, least accurate",
64+ "base" => "a middle ground",
65+ "small" => "slowest, most accurate",
66+ _ => "a speech model",
67+ };
68+ format!("{}: {what} ({model} model)", model_label(model))
69+}
70+
71+// ---- normalize ----------------------------------------------------------------------
72+
73+/// A minus sign the way the cards print it: U+2212, never a hyphen.
74+pub(crate) fn minus(s: String) -> String {
75+ s.replace('-', "\u{2212}")
76+}
77+
78+/// A level for the card: one decimal, `silent` for no energy.
79+pub(crate) fn lufs_text(x: f64) -> String {
80+ if x.is_finite() {
81+ minus(format!("{x:.1}"))
82+ } else {
83+ "silent".to_string()
84+ }
85+}
86+
87+/// `m:ss` for a time in seconds, or `h:mm:ss` past an hour: the plain clock the cards show.
88+pub(crate) fn clock(secs: f64) -> String {
89+ let whole = secs.max(0.0).round() as u64;
90+ let (h, m, s) = (whole / 3600, whole / 60 % 60, whole % 60);
91+ match h {
92+ 0 => format!("{m}:{s:02}"),
93+ _ => format!("{h}:{m:02}:{s:02}"),
94+ }
95+}
96+
97+/// What a tool says on its card and in the toast: one plain sentence, and for an error that was
98+/// cut short the whole text (the card's tooltip). `offline` marks the sentence a Relink answers.
99+#[derive(Clone, Debug, Default)]
100+pub(crate) struct Said {
101+ pub(crate) line: String,
102+ pub(crate) detail: Option<String>,
103+ pub(crate) offline: bool,
104+}
105+
106+impl Said {
107+ pub(crate) fn plain(line: impl Into<String>) -> Self {
108+ Said { line: line.into(), ..Said::default() }
109+ }
110+}
111+
112+/// The number the engine gives when sources are offline: `7` in "... 7 source(s) offline ...".
113+fn offline_count(e: &str) -> Option<usize> {
114+ let at = e.find(" source(s) offline")?;
115+ e[..at].rsplit(|c: char| !c.is_ascii_digit()).next()?.parse().ok()
116+}
117+
118+/// An error in the cards' words. A refusal for offline sources becomes a count and a sentence the
119+/// Relink button answers; anything else keeps its first sentence, with the rest in the tooltip.
120+pub(crate) fn plain_error(e: &str) -> Said {
121+ if let Some(n) = offline_count(e) {
122+ let line = match n {
123+ 1 => "1 file is offline. Relink it in Media.".to_string(),
124+ n => format!("{n} files are offline. Relink them in Media."),
125+ };
126+ return Said { line, detail: Some(e.to_string()), offline: true };
127+ }
128+ let first = e.split(". ").next().unwrap_or(e).split(';').next().unwrap_or(e).trim();
129+ let first = match first.chars().next() {
130+ Some(c) => c.to_uppercase().chain(first.chars().skip(1)).collect::<String>(),
131+ None => String::new(),
132+ };
133+ let detail = (first.len() != e.trim().len()).then(|| e.to_string());
134+ Said { line: first, detail, offline: false }
135+}
136+
137+/// The audio tracks a normalize reaches: unmuted, with clips on them.
138+pub(crate) fn normalizable_lanes(session: &PlaybackSession) -> Vec<Lane> {
139+ normalize::mix_lanes(session)
140+}
141+
142+/// Normalizes the whole mix, or each track on its own, to `lufs` with the true peak held
143+/// under `true_peak` dBTP. One undo step.
144+pub(crate) fn normalize(
145+ session: &mut PlaybackSession,
146+ each: bool,
147+ lufs: f64,
148+ true_peak: f64,
149+) -> Result<Report, String> {
150+ let scope = match each {
151+ true => Scope::Each(normalizable_lanes(session)),
152+ false => Scope::Mix,
153+ };
154+ normalize::normalize(session, &scope, lufs, true_peak)
155+}
156+
157+/// Joins names as a sentence reads: `A1, A2 and A3`.
158+fn join_names(names: &[String]) -> String {
159+ match names {
160+ [] => String::new(),
161+ [one] => one.clone(),
162+ [init @ .., last] => format!("{} and {last}", init.join(", ")),
163+ }
164+}
165+
166+/// What a normalize says on the card and in the toast: where the level landed, and what held it
167+/// short of the target if something did.
168+pub(crate) fn normalize_line(report: &Report, each: bool) -> String {
169+ let names: Vec<String> = report.lanes.iter().map(|l| l.lane.label()).collect();
170+ let (subject, verb) = match (each, names.as_slice()) {
171+ (true, lanes) if lanes.len() > 1 => (join_names(lanes), "are each"),
172+ (true, [one]) => (one.clone(), "is"),
173+ // The whole mix says which tracks it moved, so a one-track mix still names the track.
174+ (_, []) => ("The whole mix".to_string(), "is"),
175+ (_, lanes) => (format!("The whole mix ({})", join_names(lanes)), "is"),
176+ };
177+ let (before, after) = (report.before.integrated_lufs, report.after.integrated_lufs);
178+ let target = minus(format!("{:.0}", report.lufs));
179+ let head = match (before - after).abs() < 0.05 && before.is_finite() {
180+ true => format!("Already at {} LUFS.", lufs_text(after)),
181+ false => format!("{subject} {verb} now {} LUFS.", lufs_text(after)),
182+ };
183+ let tail = match (report.reached, report.peak_held) {
184+ (true, _) => String::new(),
185+ (false, true) => format!(
186+ " The {} dB peak limit stops it from getting louder, so it can't reach {target} LUFS.",
187+ lufs_text(report.true_peak)
188+ ),
189+ (false, false) => format!(" It is short of the {target} LUFS target."),
190+ };
191+ format!("{head}{tail}")
192+}
193+
194+// ---- ducking ------------------------------------------------------------------------
195+
196+/// The depth a new duck starts at, in dB: the MCP tool's default.
197+pub(crate) const DUCK_DEPTH_DEFAULT: f32 = -12.0;
198+/// One press of a duck stepper: a dB of depth, ten ms of attack, fifty of release.
199+pub(crate) const DUCK_DEPTH_STEP: f32 = 1.0;
200+pub(crate) const DUCK_ATTACK_STEP: f32 = 10.0;
201+pub(crate) const DUCK_RELEASE_STEP: f32 = 50.0;
202+
203+/// Which of a duck's numbers a stepper moves.
204+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
205+pub(crate) enum DuckField {
206+ Depth,
207+ Attack,
208+ Release,
209+}
210+
211+/// Ducks `lane` under `key` (the voice), keeping the numbers a duck under that key already
212+/// has. A duck under a different key is added beside it, as the MCP `duck` op does.
213+pub(crate) fn duck_under(session: &mut PlaybackSession, lane: Lane, key: Lane) -> Result<(), String> {
214+ check_duck(session, lane, key)?;
215+ let duck = session
216+ .lane_duck_list(lane)
217+ .into_iter()
218+ .find(|d| d.under == key.ord)
219+ .unwrap_or_else(|| Duck::new(key.ord, DUCK_DEPTH_DEFAULT));
220+ set_duck(session, lane, duck)
221+}
222+
223+/// Moves one number of the duck `lane` has under `key` by `steps` presses.
224+pub(crate) fn duck_step(
225+ session: &mut PlaybackSession,
226+ lane: Lane,
227+ key: Lane,
228+ field: DuckField,
229+ steps: i32,
230+) -> Result<(), String> {
231+ let mut duck = session
232+ .lane_duck_list(lane)
233+ .into_iter()
234+ .find(|d| d.under == key.ord)
235+ .ok_or_else(|| format!("{} is not ducked under {}", lane.label(), key.label()))?;
236+ let by = steps as f32;
237+ match field {
238+ DuckField::Depth => {
239+ duck.depth_db = (duck.depth_db + by * DUCK_DEPTH_STEP).clamp(duck::MIN_DEPTH_DB, duck::MAX_DEPTH_DB)
240+ }
241+ DuckField::Attack => {
242+ duck.attack_ms = (duck.attack_ms + by * DUCK_ATTACK_STEP).clamp(duck::MIN_TIME_MS, duck::MAX_ATTACK_MS)
243+ }
244+ DuckField::Release => {
245+ duck.release_ms =
246+ (duck.release_ms + by * DUCK_RELEASE_STEP).clamp(duck::MIN_TIME_MS, duck::MAX_RELEASE_MS)
247+ }
248+ }
249+ set_duck(session, lane, duck)
250+}
251+
252+/// Takes the duck `lane` has under `key` off, keeping its others.
253+pub(crate) fn duck_off(session: &mut PlaybackSession, lane: Lane, key: Lane) -> Result<(), String> {
254+ if session.lane_locked(lane) {
255+ return Err(format!("{} is locked", lane.label()));
256+ }
257+ match session.clear_lane_duck(lane, key.ord) {
258+ true => Ok(()),
259+ false => Err(format!("{} is not ducked under {}", lane.label(), key.label())),
260+ }
261+}
262+
263+fn check_duck(session: &PlaybackSession, lane: Lane, key: Lane) -> Result<(), String> {
264+ if lane.kind != LaneKind::Audio || key.kind != LaneKind::Audio {
265+ return Err("only an audio track ducks, and only under another audio track".into());
266+ }
267+ if lane == key {
268+ return Err(format!("{} cannot duck under itself", lane.label()));
269+ }
270+ if session.lane_locked(lane) {
271+ return Err(format!("{} is locked", lane.label()));
272+ }
273+ Ok(())
274+}
275+
276+fn set_duck(session: &mut PlaybackSession, lane: Lane, duck: Duck) -> Result<(), String> {
277+ let duck = duck.clamped().ok_or("a duck takes finite numbers")?;
278+ // Already so: no second undo step for a press that changed nothing.
279+ if session.lane_duck_list(lane).contains(&duck) {
280+ return Ok(());
281+ }
282+ match session.set_lane_duck(lane, Some(duck)) {
283+ true => Ok(()),
284+ false => Err(format!("{} could not take that duck", lane.label())),
285+ }
286+}
287+
288+// ---- captions and fillers -----------------------------------------------------------
289+
290+/// What to listen to for captions and fillers: the whole mix, or one audio track.
291+pub(crate) fn hear_choices(session: &PlaybackSession) -> Vec<Hear> {
292+ std::iter::once(Hear::Mix)
293+ .chain(
294+ session
295+ .lanes()
296+ .into_iter()
297+ .filter(|l| l.kind == LaneKind::Audio && !session.lane_clips(*l).is_empty())
298+ .map(Hear::Lane),
299+ )
300+ .collect()
301+}
302+
303+/// How the card names a [`Hear`].
304+pub(crate) fn hear_label(hear: Hear) -> String {
305+ match hear {
306+ Hear::Mix => "Whole mix".to_string(),
307+ Hear::Lane(l) => l.label(),
308+ }
309+}
310+
311+/// The caption lane new captions go on: the first with nothing on it, else the next one
312+/// (made when they are placed).
313+pub(crate) fn caption_lane(session: &PlaybackSession) -> Lane {
314+ let lanes = session.subtitle_lanes();
315+ lanes
316+ .iter()
317+ .copied()
318+ .find(|l| session.sub_lane(*l).is_empty() && !session.lane_locked(*l))
319+ .unwrap_or_else(|| Lane::new(LaneKind::Subtitle, lanes.len()))
320+}
321+
322+/// Where the caption file of a generated track is kept: beside the project when it has a
323+/// path, else in the editor's cache; never over a file that is there.
324+pub(crate) fn caption_file(project: Option<&Path>) -> PathBuf {
325+ let (dir, stem) = match project {
326+ Some(p) => (
327+ p.parent().map(Path::to_path_buf).unwrap_or_default(),
328+ p.file_stem().map_or_else(|| "project".to_string(), |s| s.to_string_lossy().into_owned()),
329+ ),
330+ None => (speech::home().join(".cache/edith/captions"), format!("captions-{}", std::process::id())),
331+ };
332+ let mut path = dir.join(format!("{stem}.captions.srt"));
333+ let mut n = 2;
334+ while path.exists() {
335+ path = dir.join(format!("{stem}.captions-{n}.srt"));
336+ n += 1;
337+ }
338+ path
339+}
340+
341+/// Cuts `words` into caption cues and puts them on the next free caption lane, as one undo
342+/// step. Returns how many cues and the lane they are on.
343+/// Puts the transcript's captions on the caption lane, as one undo step. Captions made by an
344+/// earlier run are replaced in place (their lane is cleared first), so a second run never stacks
345+/// a second copy. Returns the cue count, the lane, and whether an earlier run was replaced.
346+pub(crate) fn place_captions(
347+ session: &mut PlaybackSession,
348+ words: &[Spoken],
349+ project: Option<&Path>,
350+) -> Result<(usize, Lane, bool), String> {
351+ let fps = session.meta().frame_rate;
352+ let cues = speech::captions(words, fps);
353+ if cues.is_empty() {
354+ return Err("no speech to caption: the transcript has no words".into());
355+ }
356+ let earlier = generated_caption_lane(session);
357+ if let Some(lane) = earlier
358+ && session.lane_locked(lane)
359+ {
360+ return Err(format!("{} is locked: unlock it to replace its captions", lane.label()));
361+ }
362+ let lane = earlier.unwrap_or_else(|| caption_lane(session));
363+ let pushed = session.history_pushes();
364+ // One batch: the clearing and the new track are a single undo step (the engine's own
365+ // batch nests inside this one).
366+ session.begin_batch();
367+ if earlier.is_some() {
368+ clear_generated_captions(session, lane);
369+ }
370+ let placed = speech::place_captions(session, &cues, lane, &caption_file(project));
371+ session.end_batch();
372+ if let Err(e) = placed {
373+ // A failed attempt leaves nothing behind: take back what it pushed.
374+ for _ in pushed..session.history_pushes() {
375+ if !session.undo() {
376+ break;
377+ }
378+ }
379+ session.clear_redo();
380+ return Err(e);
381+ }
382+ Ok((cues.len(), lane, earlier.is_some()))
383+}
384+
385+/// Whether a subtitle track is a caption track this editor generated (its file is named for
386+/// the project and `.captions`, see [`caption_file`]).
387+fn is_generated_caption(track: &engine::subtitle::SubtitleTrack) -> bool {
388+ track.path.file_name().is_some_and(|n| n.to_string_lossy().contains(".captions"))
389+}
390+
391+/// The first subtitle lane that holds generated captions, if any.
392+fn generated_caption_lane(session: &PlaybackSession) -> Option<Lane> {
393+ let tracks = session.subtitles();
394+ session
395+ .subtitle_lanes()
396+ .into_iter()
397+ .find(|&l| session.sub_lane(l).iter().any(|c| tracks.get(c.track).is_some_and(is_generated_caption)))
398+}
399+
400+/// Takes every caption off `lane` and drops the generated tracks they came from, when nothing
401+/// else places them. Inside the caller's batch.
402+fn clear_generated_captions(session: &mut PlaybackSession, lane: Lane) {
403+ let mut tracks: Vec<usize> = session.sub_lane(lane).iter().map(|c| c.track).collect();
404+ while !session.sub_lane(lane).is_empty() {
405+ if !session.delete_sub(lane, 0) {
406+ break;
407+ }
408+ }
409+ tracks.sort_unstable();
410+ tracks.dedup();
411+ // Highest first, so each removal leaves the lower indices where they are.
412+ for t in tracks.into_iter().rev() {
413+ if session.subtitles().get(t).is_some_and(is_generated_caption) {
414+ let _ = session.remove_subtitles(t);
415+ }
416+ }
417+}
418+
419+/// The fillers among `words`, with the padding a cut takes either side (a few frames, never
420+/// into the next word).
421+pub(crate) fn fillers_in(session: &PlaybackSession, words: &[Spoken]) -> Vec<Filler> {
422+ let fps = session.meta().frame_rate;
423+ let end = (session.timeline_duration() * fps).round() as u32;
424+ let pad = (0.06 * fps).round() as u32;
425+ speech::find_fillers(words, pad, end)
426+}
427+
428+/// Cuts the picked fillers out of every track, closing each hole, as one undo step.
429+pub(crate) fn cut_fillers(session: &mut PlaybackSession, fillers: &[Filler]) -> Result<usize, String> {
430+ cut_fillers_regions(session, fillers).map(|_| fillers.len())
431+}
432+
433+/// [`cut_fillers`], returning the regions cut (`(start, length)` frames) so a transcript can
434+/// follow the edit.
435+pub(crate) fn cut_fillers_regions(session: &mut PlaybackSession, fillers: &[Filler]) -> Result<Vec<(u32, u32)>, String> {
436+ let lanes = session.lanes();
437+ speech::cut_fillers(session, fillers, &lanes)
438+}
439+
440+// ---- voiceover ----------------------------------------------------------------------
441+
442+/// The folder a voiceover is written to: `voiceover/` beside the project, or the editor's
443+/// cache when the project has no path yet.
444+pub(crate) fn voiceover_dir(project: Option<&Path>) -> PathBuf {
445+ match project.and_then(Path::parent) {
446+ Some(dir) => dir.join("voiceover"),
447+ None => speech::home().join(".cache/edith/voiceover"),
448+ }
449+}
450+
451+/// Takes the voiceover `file` in as a source and puts it at `at_secs` on the first audio
452+/// track with room for it (a new track when none has), as one undo step. Returns the lane.
453+pub(crate) fn place_voiceover(session: &mut PlaybackSession, file: &Path, at_secs: f64) -> Result<Lane, String> {
454+ let secs = engine::probe_media(file).duration_secs.unwrap_or(0.0);
455+ let fps = session.meta().frame_rate;
456+ let (from, to) = ((at_secs * fps).round() as u32, ((at_secs + secs) * fps).ceil() as u32);
457+ let free = |l: &Lane| {
458+ l.kind == LaneKind::Audio
459+ && !session.lane_locked(*l)
460+ && session.lane_clips(*l).iter().all(|c| c.end() <= from || c.start >= to)
461+ };
462+ let found = session.lanes().into_iter().find(free);
463+ session.begin_batch();
464+ let placed = (|| {
465+ let lane = match found {
466+ Some(l) => l,
467+ None => session.add_lane(LaneKind::Audio),
468+ };
469+ session.import(file).map_err(|e| format!("{}: refused: {e}", file.display()))?;
470+ match session.place_stream_at(at_secs, file, 0, Some(lane)) {
471+ Ok(true) => Ok(lane),
472+ Ok(false) => Err(format!("the voiceover did not place at {at_secs:.2} s")),
473+ Err(e) => Err(e.to_string()),
474+ }
475+ })();
476+ session.end_batch();
477+ placed
478+}
crates/app/src/eq_ui.rsmodified+44 -0
@@ -54,6 +54,7 @@ pub(crate) fn eq_y(gain_db: f32) -> f32 {
54 /// zeroes trimmed, so "1 kHz" stays "1 kHz" and a band nudged off it reads as54 /// zeroes trimmed, so "1 kHz" stays "1 kHz" and a band nudged off it reads as
55 /// 1.12 kHz rather than as the same "1 kHz" it was before the keystroke -- a55 /// 1.12 kHz rather than as the same "1 kHz" it was before the keystroke -- a
56 /// number that does not move under an edit is worse than no number.56 /// number that does not move under an edit is worse than no number.
57+#[cfg_attr(not(test), allow(dead_code, reason = "see band_label"))]
57 pub(crate) fn eq_freq_label(freq_hz: f32) -> String {58 pub(crate) fn eq_freq_label(freq_hz: f32) -> String {
58 if freq_hz < 1000. {59 if freq_hz < 1000. {
59 return format!("{freq_hz:.0} Hz");60 return format!("{freq_hz:.0} Hz");
@@ -66,15 +67,58 @@ pub(crate) fn eq_freq_label(freq_hz: f32) -> String {
66 /// What a band row calls itself: the corner or centre frequency, and for a67 /// What a band row calls itself: the corner or centre frequency, and for a
67 /// shelf the fact that it tilts everything past it -- which is the difference68 /// shelf the fact that it tilts everything past it -- which is the difference
68 /// between "12 kHz" moving the last octave and moving one band inside it.69 /// between "12 kHz" moving the last octave and moving one band inside it.
70+#[cfg_attr(not(test), allow(dead_code, reason = "the band row now shows a number field; kept for the tests and the spoken name"))]
69 pub(crate) fn band_label(band: &Band) -> String {71 pub(crate) fn band_label(band: &Band) -> String {
70 let freq = eq_freq_label(band.freq_hz);72 let freq = eq_freq_label(band.freq_hz);
71 match band.kind {73 match band.kind {
72 BandKind::LowShelf => format!("{freq} low shelf"),74 BandKind::LowShelf => format!("{freq} low shelf"),
73 BandKind::HighShelf => format!("{freq} high shelf"),75 BandKind::HighShelf => format!("{freq} high shelf"),
76+ BandKind::LowCut => format!("{freq} low cut"),
77+ BandKind::HighCut => format!("{freq} high cut"),
74 BandKind::Peak => freq,78 BandKind::Peak => freq,
75 }79 }
76 }80 }
77 81
82+/// The five kinds a band can be, in the order their chips lay out: the cuts at
83+/// the ends and the shelves beside the bells. Each carries the sentence its
84+/// chip's tooltip says, so a name like "shelf" is explained where it is picked.
85+pub(crate) const EQ_KINDS: [(BandKind, &str, &str); 5] = [
86+ (BandKind::LowCut, "Low cut", "Removes what is below the corner"),
87+ (
88+ BandKind::LowShelf,
89+ "Low shelf",
90+ "Lifts or cuts everything below the frequency",
91+ ),
92+ (BandKind::Peak, "Peak", "A bell around the frequency"),
93+ (
94+ BandKind::HighShelf,
95+ "High shelf",
96+ "Lifts or cuts everything above the frequency",
97+ ),
98+ (BandKind::HighCut, "High cut", "Removes what is above the corner"),
99+];
100+
101+/// Whether a band's gain takes part in its response. A cut ignores it -- it has
102+/// a corner to put and no level to set -- so the card does not draw its field.
103+pub(crate) fn eq_takes_gain(kind: BandKind) -> bool {
104+ !matches!(kind, BandKind::LowCut | BandKind::HighCut)
105+}
106+
107+/// Which of a band's numbers have left the layout the clip opens on, as
108+/// (frequency, gain, Q): what makes a number read ink1 rather than ink3. A band
109+/// has no name but its place, so it is compared with the layout's band at the
110+/// same index; one past the layout's end has no default to have left, so its
111+/// frequency and Q count as moved. Every band's gain rests at flat.
112+#[cfg_attr(not(test), allow(dead_code, reason = "see band_label"))]
113+pub(crate) fn eq_band_changes(band: &Band, index: usize) -> (bool, bool, bool) {
114+ const SAME: f32 = 1e-4;
115+ let default = EqParams::default_layout().bands.get(index).copied();
116+ let freq = default.is_none_or(|d| (band.freq_hz / d.freq_hz - 1.).abs() > SAME);
117+ let gain = band.gain_db.abs() > SAME;
118+ let q = default.is_none_or(|d| (band.q - d.q).abs() > SAME);
119+ (freq, gain, q)
120+}
121+
78 /// In-place radix-2 FFT of `re`/`im`, whose length must be a power of two.122 /// In-place radix-2 FFT of `re`/`im`, whose length must be a power of two.
79 ///123 ///
80 /// Hand-written, and deliberately: a 1024-point transform once a frame is a124 /// Hand-written, and deliberately: a 1024-point transform once a frame is a
crates/app/src/export_queue.rsadded+365 -0
@@ -0,0 +1,365 @@
1+//! The export queue: exports set up now and run later, one after another.
2+//! Each job owns the timeline as it was when it was added, so editing on
3+//! afterwards never changes a queued file. This module is only the state
4+//! machine; the player starts the workers and polls them
5+//! (`Player::poll_queue`), which keeps every rule here testable without a
6+//! window.
7+
8+use engine::export::ExportSettings;
9+use engine::project::Project;
10+use engine::{ExportHandle, VideoMeta};
11+use std::path::{Path, PathBuf};
12+use std::time::Instant;
13+
14+/// Where a queued job stands.
15+#[derive(Debug, Clone, PartialEq)]
16+pub(crate) enum JobState {
17+ Waiting,
18+ Running,
19+ Done { bytes: u64, wall_secs: f64 },
20+ Failed(String),
21+ Cancelled,
22+}
23+
24+/// The timeline and settings a job writes from, taken when it was added.
25+pub(crate) struct Snapshot {
26+ pub project: Project,
27+ pub meta: VideoMeta,
28+ pub settings: ExportSettings,
29+ pub sample_rate: Option<u32>,
30+}
31+
32+pub(crate) struct QueueJob {
33+ pub id: u64,
34+ pub out: PathBuf,
35+ /// Format, preset and length in plain words, for the row.
36+ pub summary: String,
37+ pub state: JobState,
38+ /// Dropped once the worker has it (or the job is cancelled).
39+ pub snapshot: Option<Snapshot>,
40+ pub handle: Option<ExportHandle>,
41+ pub started: Option<Instant>,
42+ /// Cancel was asked while the worker was running: it settles as Cancelled.
43+ pub cancelling: bool,
44+}
45+
46+#[derive(Default)]
47+pub(crate) struct ExportQueue {
48+ pub jobs: Vec<QueueJob>,
49+ next_id: u64,
50+ /// "Start queue" was pressed: the next waiting job starts whenever nothing
51+ /// else is encoding. Cleared by "Pause after this job" and when the queue
52+ /// runs dry.
53+ go: bool,
54+}
55+
56+impl ExportQueue {
57+ pub(crate) fn add(&mut self, out: PathBuf, summary: String, snapshot: Snapshot) -> u64 {
58+ self.next_id += 1;
59+ self.jobs.push(QueueJob {
60+ id: self.next_id,
61+ out,
62+ summary,
63+ state: JobState::Waiting,
64+ snapshot: Some(snapshot),
65+ handle: None,
66+ started: None,
67+ cancelling: false,
68+ });
69+ self.next_id
70+ }
71+
72+ pub(crate) fn job(&self, id: u64) -> Option<&QueueJob> {
73+ self.jobs.iter().find(|j| j.id == id)
74+ }
75+
76+ fn job_mut(&mut self, id: u64) -> Option<&mut QueueJob> {
77+ self.jobs.iter_mut().find(|j| j.id == id)
78+ }
79+
80+ pub(crate) fn waiting(&self) -> usize {
81+ self.jobs.iter().filter(|j| j.state == JobState::Waiting).count()
82+ }
83+
84+ pub(crate) fn running_id(&self) -> Option<u64> {
85+ self.jobs.iter().find(|j| j.state == JobState::Running).map(|j| j.id)
86+ }
87+
88+ /// Jobs still to be written: waiting or running.
89+ pub(crate) fn unfinished(&self) -> usize {
90+ self.waiting() + usize::from(self.running_id().is_some())
91+ }
92+
93+ pub(crate) fn finished(&self) -> usize {
94+ self.jobs.len() - self.unfinished()
95+ }
96+
97+ /// Whether the queue is going: started and not yet dry. A direct Export
98+ /// then joins the end of the queue.
99+ pub(crate) fn is_going(&self) -> bool {
100+ self.go && self.unfinished() > 0
101+ }
102+
103+ pub(crate) fn start(&mut self) {
104+ self.go = true;
105+ }
106+
107+ /// The running job finishes; nothing after it starts.
108+ pub(crate) fn pause(&mut self) {
109+ self.go = false;
110+ }
111+
112+ /// The job to start now, if any: the queue is going, no worker of the
113+ /// queue is writing and nothing else (`blocked`) is encoding.
114+ pub(crate) fn next_ready(&self, blocked: bool) -> Option<u64> {
115+ if !self.go || blocked || self.running_id().is_some() {
116+ return None;
117+ }
118+ self.jobs.iter().find(|j| j.state == JobState::Waiting).map(|j| j.id)
119+ }
120+
121+ /// Takes the snapshot of a waiting job and marks it running.
122+ pub(crate) fn begin(&mut self, id: u64) -> Option<(Snapshot, PathBuf)> {
123+ let job = self.job_mut(id).filter(|j| j.state == JobState::Waiting)?;
124+ let snap = job.snapshot.take()?;
125+ job.state = JobState::Running;
126+ job.started = Some(Instant::now());
127+ Some((snap, job.out.clone()))
128+ }
129+
130+ pub(crate) fn attach(&mut self, id: u64, handle: ExportHandle) {
131+ if let Some(job) = self.job_mut(id) {
132+ job.handle = Some(handle);
133+ }
134+ }
135+
136+ /// The worker's verdict. A job cancelled while it ran settles as
137+ /// Cancelled whatever the worker said. Returns the final state.
138+ pub(crate) fn settle(&mut self, id: u64, result: Result<(), String>, bytes: u64) -> Option<JobState> {
139+ let job = self.job_mut(id).filter(|j| j.state == JobState::Running)?;
140+ let wall_secs = job.started.map_or(0., |t| t.elapsed().as_secs_f64());
141+ job.handle = None;
142+ job.state = match (job.cancelling, result) {
143+ (true, _) => JobState::Cancelled,
144+ (false, Ok(())) => JobState::Done { bytes, wall_secs },
145+ (false, Err(e)) => JobState::Failed(e),
146+ };
147+ let state = job.state.clone();
148+ if self.waiting() == 0 {
149+ self.go = false;
150+ }
151+ Some(state)
152+ }
153+
154+ /// Cancel one job: a waiting one never starts; a running one is asked to
155+ /// stop and settles as Cancelled once its worker has cleaned up.
156+ pub(crate) fn cancel(&mut self, id: u64) {
157+ let Some(job) = self.job_mut(id) else { return };
158+ match job.state {
159+ JobState::Waiting => {
160+ job.snapshot = None;
161+ job.state = JobState::Cancelled;
162+ }
163+ JobState::Running => {
164+ job.cancelling = true;
165+ if let Some(h) = &job.handle {
166+ h.cancel();
167+ }
168+ }
169+ _ => {}
170+ }
171+ if self.waiting() == 0 && self.running_id().is_none() {
172+ self.go = false;
173+ }
174+ }
175+
176+ /// Takes a job off the list. A running one cannot be removed, only cancelled.
177+ pub(crate) fn remove(&mut self, id: u64) -> bool {
178+ let before = self.jobs.len();
179+ self.jobs.retain(|j| j.id != id || j.state == JobState::Running);
180+ if self.unfinished() == 0 {
181+ self.go = false;
182+ }
183+ self.jobs.len() != before
184+ }
185+
186+ pub(crate) fn clear_finished(&mut self) {
187+ self.jobs.retain(|j| matches!(j.state, JobState::Waiting | JobState::Running));
188+ }
189+
190+ /// Cancels everything unfinished (the window is closing).
191+ pub(crate) fn cancel_all(&mut self) {
192+ let ids: Vec<u64> = self.jobs.iter().map(|j| j.id).collect();
193+ for id in ids {
194+ self.cancel(id);
195+ }
196+ }
197+
198+ /// Files the queue still means to write: a new job must not take the same name.
199+ pub(crate) fn claimed(&self, path: &Path) -> bool {
200+ self.jobs
201+ .iter()
202+ .any(|j| matches!(j.state, JobState::Waiting | JobState::Running) && j.out == path)
203+ }
204+}
205+
206+/// `out` if nothing is there and the queue has not claimed it; otherwise the
207+/// same name with " 2", " 3" ... before the extension. A queued job never
208+/// asks about overwriting (the question belongs to the moment of the click),
209+/// so it picks a free name instead of replacing anything.
210+pub(crate) fn free_name(out: &Path, taken: impl Fn(&Path) -> bool) -> PathBuf {
211+ if !taken(out) {
212+ return out.to_path_buf();
213+ }
214+ let stem = out.file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default();
215+ let ext = out.extension().map(|e| format!(".{}", e.to_string_lossy())).unwrap_or_default();
216+ (2..)
217+ .map(|n| out.with_file_name(format!("{stem} {n}{ext}")))
218+ .find(|p| !taken(p))
219+ .unwrap_or_else(|| out.to_path_buf())
220+}
221+
222+#[cfg(test)]
223+mod tests {
224+ use super::*;
225+ use engine::PlaybackSession;
226+
227+ fn session() -> PlaybackSession {
228+ let path = format!("{}/../../assets/test_av.mp4", env!("CARGO_MANIFEST_DIR"));
229+ PlaybackSession::open(path).expect("open the fixture")
230+ }
231+
232+ fn snap(s: &PlaybackSession) -> Snapshot {
233+ let (project, meta) = s.export_snapshot();
234+ Snapshot { project, meta, settings: ExportSettings::default(), sample_rate: s.sample_rate() }
235+ }
236+
237+ fn add(q: &mut ExportQueue, s: &PlaybackSession, name: &str) -> u64 {
238+ q.add(PathBuf::from(name), "MP4".into(), snap(s))
239+ }
240+
241+ #[test]
242+ fn nothing_starts_until_the_queue_is_started() {
243+ let s = session();
244+ let mut q = ExportQueue::default();
245+ let a = add(&mut q, &s, "a.mp4");
246+ assert_eq!(q.next_ready(false), None, "added jobs wait for Start queue");
247+ assert!(!q.is_going());
248+ q.start();
249+ assert_eq!(q.next_ready(false), Some(a));
250+ assert_eq!(q.next_ready(true), None, "a direct export encoding holds the queue off");
251+ }
252+
253+ #[test]
254+ fn jobs_run_one_at_a_time_in_order_and_settle() {
255+ let s = session();
256+ let mut q = ExportQueue::default();
257+ let (a, b) = (add(&mut q, &s, "a.mp4"), add(&mut q, &s, "b.mp4"));
258+ q.start();
259+ assert_eq!(q.next_ready(false), Some(a));
260+ assert!(q.begin(a).is_some());
261+ assert_eq!(q.running_id(), Some(a));
262+ assert_eq!(q.next_ready(false), None, "never two at once");
263+ assert!(matches!(q.settle(a, Ok(()), 10), Some(JobState::Done { bytes: 10, .. })));
264+ assert_eq!(q.next_ready(false), Some(b));
265+ assert!(q.begin(b).is_some());
266+ assert!(matches!(q.settle(b, Err("disk full".into()), 0), Some(JobState::Failed(e)) if e == "disk full"));
267+ assert!(!q.is_going(), "a dry queue stops going");
268+ assert_eq!(q.finished(), 2);
269+ }
270+
271+ #[test]
272+ fn a_failed_job_does_not_stop_the_next() {
273+ let s = session();
274+ let mut q = ExportQueue::default();
275+ let (a, b) = (add(&mut q, &s, "a.mp4"), add(&mut q, &s, "b.mp4"));
276+ q.start();
277+ q.begin(a);
278+ q.settle(a, Err("bad".into()), 0);
279+ assert!(q.is_going());
280+ assert_eq!(q.next_ready(false), Some(b));
281+ }
282+
283+ #[test]
284+ fn cancel_a_waiting_job_it_never_starts() {
285+ let s = session();
286+ let mut q = ExportQueue::default();
287+ let (a, b) = (add(&mut q, &s, "a.mp4"), add(&mut q, &s, "b.mp4"));
288+ q.start();
289+ q.cancel(a);
290+ assert_eq!(q.job(a).unwrap().state, JobState::Cancelled);
291+ assert!(q.job(a).unwrap().snapshot.is_none(), "the copy is let go");
292+ assert_eq!(q.next_ready(false), Some(b), "the queue moves past it");
293+ assert!(q.begin(a).is_none());
294+ }
295+
296+ #[test]
297+ fn cancel_a_running_job_settles_cancelled_whatever_the_worker_says() {
298+ let s = session();
299+ let mut q = ExportQueue::default();
300+ let a = add(&mut q, &s, "a.mp4");
301+ q.start();
302+ q.begin(a);
303+ q.cancel(a);
304+ assert_eq!(q.job(a).unwrap().state, JobState::Running, "until its worker has cleaned up");
305+ assert!(!q.remove(a), "a running job cannot be removed");
306+ assert_eq!(q.settle(a, Err("export cancelled".into()), 0), Some(JobState::Cancelled));
307+ }
308+
309+ #[test]
310+ fn pause_lets_the_running_job_finish_and_holds_the_rest() {
311+ let s = session();
312+ let mut q = ExportQueue::default();
313+ let (a, b) = (add(&mut q, &s, "a.mp4"), add(&mut q, &s, "b.mp4"));
314+ q.start();
315+ q.begin(a);
316+ q.pause();
317+ q.settle(a, Ok(()), 1);
318+ assert_eq!(q.next_ready(false), None, "paused after the job");
319+ q.start();
320+ assert_eq!(q.next_ready(false), Some(b));
321+ }
322+
323+ #[test]
324+ fn remove_and_clear_finished_keep_what_is_still_to_do() {
325+ let s = session();
326+ let mut q = ExportQueue::default();
327+ let (a, b, c) = (add(&mut q, &s, "a.mp4"), add(&mut q, &s, "b.mp4"), add(&mut q, &s, "c.mp4"));
328+ q.start();
329+ q.begin(a);
330+ q.settle(a, Ok(()), 1);
331+ assert!(q.remove(c));
332+ assert_eq!(q.jobs.len(), 2);
333+ q.clear_finished();
334+ assert_eq!(q.jobs.iter().map(|j| j.id).collect::<Vec<_>>(), vec![b]);
335+ }
336+
337+ #[test]
338+ fn a_job_keeps_the_timeline_it_was_added_with() {
339+ let mut s = session();
340+ let mut q = ExportQueue::default();
341+ let before = s.export_snapshot().0.media_frames();
342+ assert!(before > 4);
343+ let a = add(&mut q, &s, "a.mp4");
344+ // Edit the live timeline after queuing: delete every clip.
345+ for lane in s.lanes() {
346+ while !s.lane_clips(lane).is_empty() {
347+ assert!(s.delete_clip(lane, 0));
348+ }
349+ }
350+ let after = s.export_snapshot().0.media_frames();
351+ let queued = q.job(a).unwrap().snapshot.as_ref().unwrap().project.media_frames();
352+ assert_eq!(queued, before, "the queued copy is the timeline as added");
353+ assert_ne!(after, before, "the live timeline did change");
354+ }
355+
356+ #[test]
357+ fn a_queued_name_is_never_one_already_there_or_claimed() {
358+ let s = session();
359+ let mut q = ExportQueue::default();
360+ add(&mut q, &s, "/x/a.mp4");
361+ let taken = |p: &Path| q.claimed(p) || p == Path::new("/x/a 2.mp4");
362+ assert_eq!(free_name(Path::new("/x/a.mp4"), taken), PathBuf::from("/x/a 3.mp4"));
363+ assert_eq!(free_name(Path::new("/x/b.mp4"), taken), PathBuf::from("/x/b.mp4"));
364+ }
365+}
crates/app/src/export_ui.rsmodified+1415 -99
@@ -2,17 +2,42 @@
2 2
3 use crate::*;3 use crate::*;
4 4
5-/// The project resolutions [`Player::cycle_resolution`] offers, largest first.5+/// The project resolutions the project-resolution list offers, largest area
6-/// A short list of the sizes people name; the media's own is cycled in beside6+/// first. A short list of the sizes people name, landscape and the two
7-/// them, which is what makes the trip round come back to where it started.7+/// phone-and-square shapes ([`NEW_SIZES`] offers the same ones on a new
8-pub(crate) const RESOLUTIONS: [(u32, u32); 5] = [8+/// project); the media's own is cycled in beside them, which is what makes the
9+/// trip round come back to where it started.
10+pub(crate) const RESOLUTIONS: [(u32, u32); 7] = [
9 (3840, 2160),11 (3840, 2160),
10 (2560, 1440),12 (2560, 1440),
11 (1920, 1080),13 (1920, 1080),
14+ (1080, 1920),
15+ (1080, 1080),
12 (1280, 720),16 (1280, 720),
13 (854, 480),17 (854, 480),
14 ];18 ];
15 19
20+/// A size's name in the list, plain words: the height for a landscape frame
21+/// (`1080p`), the two numbers for a tall or square one (`1080×1920`), which a
22+/// `p` would misname.
23+pub(crate) fn size_name(w: u32, h: u32) -> String {
24+ match w > h {
25+ true => format!("{h}p"),
26+ false => format!("{w}\u{d7}{h}"),
27+ }
28+}
29+
30+/// A size's row label in the list: [`size_name`], with the shape said for a
31+/// tall or square frame -- `1080×1920 (vertical 9:16)`, `1080×1080 (square)`.
32+pub(crate) fn size_row_label(w: u32, h: u32) -> String {
33+ match (w > h, w == h, w * 16 == h * 9) {
34+ (true, _, _) => size_name(w, h),
35+ (_, true, _) => format!("{w}\u{d7}{h} (square)"),
36+ (_, _, true) => format!("{w}\u{d7}{h} (vertical 9:16)"),
37+ _ => format!("{w}\u{d7}{h} (vertical)"),
38+ }
39+}
40+
16 /// The project frame rates the list offers, slowest first: the rates footage is41 /// The project frame rates the list offers, slowest first: the rates footage is
17 /// actually shot and delivered at, the NTSC ones written as the ratios they are42 /// actually shot and delivered at, the NTSC ones written as the ratios they are
18 /// (`24000/1001`, not `23.976`) -- the engine conforms the timeline to the very43 /// (`24000/1001`, not `23.976`) -- the engine conforms the timeline to the very
@@ -46,7 +71,7 @@ pub(crate) const SAMPLE_RATES: [u32; 3] = [44_100, 48_000, 96_000];
46 pub(crate) fn sample_rate_choices(current: Option<u32>) -> Vec<ChoiceRow> {71 pub(crate) fn sample_rate_choices(current: Option<u32>) -> Vec<ChoiceRow> {
47 let mut rows = vec![(72 let mut rows = vec![(
48 Choice::SampleRate(None),73 Choice::SampleRate(None),
49- "Source".into(),74+ "Match source".into(),
50 // A state word, the resolution list's rule: the six-word phrase this75 // A state word, the resolution list's rule: the six-word phrase this
51 // row wore ran past `MENU_W` and was cut mid-word like the size76 // row wore ran past `MENU_W` and was cut mid-word like the size
52 // list's was. Nothing is resampled -- that is what the row means.77 // list's was. Nothing is resampled -- that is what the row means.
@@ -93,7 +118,7 @@ pub(crate) fn sample_rate_choices(current: Option<u32>) -> Vec<ChoiceRow> {
93 /// the file, not about the encode. So the container is asked *once*, in a row118 /// the file, not about the encode. So the container is asked *once*, in a row
94 /// of its own, and only where there is more than one to ask about -- five119 /// of its own, and only where there is more than one to ask about -- five
95 /// picture rows to read past were four of them saying the same codec twice.120 /// picture rows to read past were four of them saying the same codec twice.
96-pub(crate) const FORMATS: [(&[Format], &str, &str, &str); 9] = [121+pub(crate) const FORMATS: [(&[Format], &str, &str, &str); 12] = [
97 (122 (
98 &[Format::Mp4],123 &[Format::Mp4],
99 "m",124 "m",
@@ -110,7 +135,7 @@ pub(crate) const FORMATS: [(&[Format], &str, &str, &str); 9] = [
110 &[Format::Hevc, Format::HevcMp4],135 &[Format::Hevc, Format::HevcMp4],
111 "h",136 "h",
112 "HEVC",137 "HEVC",
113- "intra-only, every frame a cut point — large files",138+ "I+P GOPs in software — far smaller than intra-only",
114 ),139 ),
115 (&[Format::Wav], "w", "WAV", "16-bit PCM — audio only"),140 (&[Format::Wav], "w", "WAV", "16-bit PCM — audio only"),
116 (&[Format::Flac], "f", "FLAC", "lossless — audio only"),141 (&[Format::Flac], "f", "FLAC", "lossless — audio only"),
@@ -118,9 +143,17 @@ pub(crate) const FORMATS: [(&[Format], &str, &str, &str); 9] = [
118 (143 (
119 &[Format::Ogg],144 &[Format::Ogg],
120 "o",145 "o",
121- "OGG",146+ "Ogg",
122- "Vorbis (ec-vorbis) — quality-coded, stereo",147+ "Vorbis — variable quality, stereo",
148+ ),
149+ (
150+ &[Format::Opus],
151+ "u",
152+ "Opus",
153+ "Opus in an Ogg file — voice and podcasts, small",
123 ),154 ),
155+ (&[Format::Still, Format::PngSequence], "s", "PNG", "lossless pictures · no sound"),
156+ (&[Format::Gif], "i", "GIF", "animated · 256 colours · no sound"),
124 (&[], "", "VP9", "AV1 above replaces it"),157 (&[], "", "VP9", "AV1 above replaces it"),
125 (&[], "", "VP8", "AV1 above replaces it"),158 (&[], "", "VP8", "AV1 above replaces it"),
126 ];159 ];
@@ -279,12 +312,7 @@ pub(crate) fn band_mut(params: &mut ColorParams, band: usize) -> &mut f32 {
279 }312 }
280 }313 }
281 314
282-/// The line under the rows: what the picked format really writes, in the terms315+/// Every fit policy, in the order the list offers them.
283-/// a file is judged by afterwards.
284-/// The next policy round the cycle, in the order the action's label reads.
285-/// Every fit policy, in the order the list offers them -- which is the order
286-/// [`next_fit`] steps through them, pinned by the test below: a list and a
287-/// stroke that disagreed about what comes next would be two settings.
288 pub(crate) const FITS: [FitPolicy; 4] = [316 pub(crate) const FITS: [FitPolicy; 4] = [
289 FitPolicy::Fit,317 FitPolicy::Fit,
290 FitPolicy::Fill,318 FitPolicy::Fill,
@@ -292,12 +320,15 @@ pub(crate) const FITS: [FitPolicy; 4] = [
292 FitPolicy::Center,320 FitPolicy::Center,
293 ];321 ];
294 322
295-pub(crate) fn next_fit(fit: FitPolicy) -> FitPolicy {323+/// What the easing list calls one: the words an editor uses for the curve.
296- match fit {324+pub(crate) fn ease_label(ease: engine::transform::KeyEase) -> &'static str {
297- FitPolicy::Fit => FitPolicy::Fill,325+ use engine::transform::KeyEase;
298- FitPolicy::Fill => FitPolicy::Stretch,326+ match ease {
299- FitPolicy::Stretch => FitPolicy::Center,327+ KeyEase::Linear => "Linear",
300- FitPolicy::Center => FitPolicy::Fit,328+ KeyEase::EaseIn => "Ease in",
329+ KeyEase::EaseOut => "Ease out",
330+ KeyEase::Ease => "Ease in-out",
331+ KeyEase::Hold => "Hold",
301 }332 }
302 }333 }
303 334
@@ -340,14 +371,15 @@ pub(crate) fn resolution_choices(current: (u32, u32), native: (u32, u32)) -> Vec
340 .map(|(w, h)| {371 .map(|(w, h)| {
341 (372 (
342 Choice::Size(w, h),373 Choice::Size(w, h),
343- format!("{h}p").into(),374+ size_row_label(w, h).into(),
344- match (w, h) == native {375+ match (w > h, (w, h) == native) {
345- // A state word, not prose (DESIGN §8): "· the media's own"376+ // Plain words (DESIGN §8): a landscape row's size is its
346- // lost its last word to `MENU_W` on the row a user read377+ // detail, and the media's own size says what it matches. A
347- // ("word cut"). `source` is the word the sample-rate list378+ // tall or square row already names its shape in its label.
348- // already says the same fact in.379+ (true, true) => format!("{w}\u{d7}{h} (matches your media)"),
349- true => format!("{w}x{h} source"),380+ (true, false) => format!("{w}\u{d7}{h}"),
350- false => format!("{w}x{h}"),381+ (false, true) => "matches your media".to_string(),
382+ (false, false) => String::new(),
351 }383 }
352 .into(),384 .into(),
353 (w, h) == current,385 (w, h) == current,
@@ -366,8 +398,12 @@ pub(crate) fn pending_resolution_choices(pending: Option<(u32, u32)>) -> Vec<Cho
366 .map(|(w, h)| {398 .map(|(w, h)| {
367 (399 (
368 Choice::Size(w, h),400 Choice::Size(w, h),
369- format!("{h}p").into(),401+ size_row_label(w, h).into(),
370- format!("{w}x{h}").into(),402+ match w > h {
403+ true => format!("{w}x{h}"),
404+ false => String::new(),
405+ }
406+ .into(),
371 Some((w, h)) == pending,407 Some((w, h)) == pending,
372 )408 )
373 })409 })
@@ -381,12 +417,8 @@ pub(crate) fn pending_fps_choices(pending: Option<f64>) -> Vec<ChoiceRow> {
381 .map(|fps| {417 .map(|fps| {
382 (418 (
383 Choice::Fps(fps),419 Choice::Fps(fps),
384- format!("{} fps", fps_label(fps)).into(),420+ fps_row_label(fps).into(),
385- match (fps - fps.round()).abs() < 0.001 {421+ String::new().into(),
386- true => String::new(),
387- false => "NTSC".to_string(),
388- }
389- .into(),
390 Some(fps) == pending,422 Some(fps) == pending,
391 )423 )
392 })424 })
@@ -423,15 +455,10 @@ pub(crate) fn fps_choices(current: f64, native: f64) -> Vec<ChoiceRow> {
423 .map(|fps| {455 .map(|fps| {
424 (456 (
425 Choice::Fps(fps),457 Choice::Fps(fps),
426- format!("{} fps", fps_label(fps)).into(),458+ fps_row_label(fps).into(),
427 match fps == native {459 match fps == native {
428- true => "the media's own".to_string(),460+ true => "Match the media".to_string(),
429- // The rates that are a ratio are the ones nobody can tell461+ false => String::new(),
430- // from their neighbour by the label alone.
431- false => match (fps - fps.round()).abs() < 0.001 {
432- true => String::new(),
433- false => "NTSC".to_string(),
434- },
435 }462 }
436 .into(),463 .into(),
437 fps == current,464 fps == current,
@@ -474,7 +501,7 @@ pub(crate) fn audio_rate_choices(current: u32) -> Vec<ChoiceRow> {
474 .map(|(n, kbps)| {501 .map(|(n, kbps)| {
475 (502 (
476 Choice::AudioRate(kbps),503 Choice::AudioRate(kbps),
477- format!("{kbps} kbps").into(),504+ format!("{kbps} kb/s").into(),
478 match (kbps, n) {505 match (kbps, n) {
479 (DEFAULT_AUDIO_KBPS, _) => "the default",506 (DEFAULT_AUDIO_KBPS, _) => "the default",
480 (_, 0) => "smallest file",507 (_, 0) => "smallest file",
@@ -488,8 +515,14 @@ pub(crate) fn audio_rate_choices(current: u32) -> Vec<ChoiceRow> {
488 .collect()515 .collect()
489 }516 }
490 517
491-/// How a seat is named where a person reads it: the card row, the notice and518+/// The seats in the order every list and chip row shows them: Software first,
492-/// the list row all say the same word ([`engine::export::EncoderSeat`]).519+/// the GUI's default seat, then the two that may open the GPU encoder.
520+pub(crate) const ENCODER_SEATS: [EncoderSeat; 3] =
521+ [EncoderSeat::Software, EncoderSeat::Auto, EncoderSeat::Hardware];
522+
523+/// How a seat is named where a person reads it: the export sheet's rows,
524+/// Settings' chips and the notice all say the same word
525+/// ([`engine::export::EncoderSeat`]), and [`encoder_note`] says what it does.
493 pub(crate) fn encoder_label(seat: EncoderSeat) -> &'static str {526 pub(crate) fn encoder_label(seat: EncoderSeat) -> &'static str {
494 match seat {527 match seat {
495 EncoderSeat::Auto => "Auto",528 EncoderSeat::Auto => "Auto",
@@ -498,6 +531,16 @@ pub(crate) fn encoder_label(seat: EncoderSeat) -> &'static str {
498 }531 }
499 }532 }
500 533
534+/// What a seat does, in the fewest words: the same note beside the export
535+/// sheet's row and under Settings' chips.
536+pub(crate) fn encoder_note(seat: EncoderSeat) -> &'static str {
537+ match seat {
538+ EncoderSeat::Auto => "GPU encoder if any",
539+ EncoderSeat::Hardware => "GPU encoder or refuse",
540+ EncoderSeat::Software => "software encoder, always",
541+ }
542+}
543+
501 /// The encoder list's rows: all three seats, the one in force marked, and what544 /// The encoder list's rows: all three seats, the one in force marked, and what
502 /// each one *does* beside it -- in the fewest words that fit inside `MENU_W`,545 /// each one *does* beside it -- in the fewest words that fit inside `MENU_W`,
503 /// the truncation every list above already met. Always offered, whatever this546 /// the truncation every list above already met. Always offered, whatever this
@@ -511,12 +554,7 @@ pub(crate) fn encoder_choices(current: EncoderSeat) -> Vec<ChoiceRow> {
511 (554 (
512 Choice::Encoder(seat),555 Choice::Encoder(seat),
513 encoder_label(seat).into(),556 encoder_label(seat).into(),
514- match seat {557+ encoder_note(seat).into(),
515- EncoderSeat::Auto => "the GPU if there is one",
516- EncoderSeat::Hardware => "the GPU or a refusal",
517- EncoderSeat::Software => "the CPU, always",
518- }
519- .into(),
520 seat == current,558 seat == current,
521 )559 )
522 })560 })
@@ -541,9 +579,9 @@ pub(crate) fn av1_hw_warning(format: Format, seat: EncoderSeat) -> Option<&'stat
541 /// notice and the list row all say the same word ([`engine::tonemap::Preset`]).579 /// notice and the list row all say the same word ([`engine::tonemap::Preset`]).
542 pub(crate) fn tone_label(preset: Preset) -> &'static str {580 pub(crate) fn tone_label(preset: Preset) -> &'static str {
543 match preset {581 match preset {
544- Preset::Reference => "Reference",582+ Preset::Reference => "Faithful",
545- Preset::Standard => "Standard",583+ Preset::Standard => "Balanced",
546- Preset::Vivid => "Vivid",584+ Preset::Vivid => "Bright",
547 }585 }
548 }586 }
549 587
@@ -560,8 +598,8 @@ pub(crate) fn tone_choices(current: Preset) -> Vec<ChoiceRow> {
560 Choice::Tone(preset),598 Choice::Tone(preset),
561 tone_label(preset).into(),599 tone_label(preset).into(),
562 match preset {600 match preset {
563- Preset::Reference => "BT.2446-A, as published",601+ Preset::Reference => "true to the standard",
564- Preset::Standard => "brighter, player-like",602+ Preset::Standard => "like a normal player",
565 Preset::Vivid => "brightest, richer colour",603 Preset::Vivid => "brightest, richer colour",
566 }604 }
567 .into(),605 .into(),
@@ -571,20 +609,22 @@ pub(crate) fn tone_choices(current: Preset) -> Vec<ChoiceRow> {
571 .collect()609 .collect()
572 }610 }
573 611
574-/// The next project resolution after `current`, over [`RESOLUTIONS`] with the
575-/// media's own size cycled in at its place by size -- so the trip round always
576-/// comes back to the media, whatever odd shape it is, and a project already at a
577-/// listed size does not see it twice.
578-pub(crate) fn next_resolution(current: (u32, u32), native: (u32, u32)) -> (u32, u32) {
579- let sizes = resolution_ladder(native);
580- let at = sizes.iter().position(|&s| s == current);
581- // A project at a size nobody listed (a hand-edited file) joins the cycle at
582- // the top rather than being stuck.
583- sizes[at.map_or(0, |at| (at + 1) % sizes.len())]
584-}
585-
586 /// A frame rate as a person writes it: `30`, not `30.000`, and `23.976` for the612 /// A frame rate as a person writes it: `30`, not `30.000`, and `23.976` for the
587 /// rate that is a ratio.613 /// rate that is a ratio.
614+/// A rate's row label as a person names it: the number and "fps", and for the
615+/// NTSC ratios (23.976, 29.97, 59.94) what the rate is for -- "29.97 fps (NTSC
616+/// video)" -- so the ratio is never a bare number nobody can place.
617+pub(crate) fn fps_row_label(fps: f64) -> String {
618+ let base = format!("{} fps", fps_label(fps));
619+ match (fps - fps.round()).abs() < 0.001 {
620+ true => base,
621+ false => match fps < 25. {
622+ true => format!("{base} (NTSC film)"),
623+ false => format!("{base} (NTSC video)"),
624+ },
625+ }
626+}
627+
588 pub(crate) fn fps_label(fps: f64) -> String {628 pub(crate) fn fps_label(fps: f64) -> String {
589 match (fps - fps.round()).abs() < 0.001 {629 match (fps - fps.round()).abs() < 0.001 {
590 true => format!("{fps:.0}"),630 true => format!("{fps:.0}"),
@@ -595,26 +635,65 @@ pub(crate) fn fps_label(fps: f64) -> String {
595 }635 }
596 }636 }
597 637
598-/// About how big the budget makes the file: every bit that is written --638+/// The budget itself, in Mbps to one decimal: the number the lever reads.
599-/// the picture's rate and the sound's -- over the exported range, in bytes.639+pub(crate) fn rate_label(bps: u64) -> String {
600-/// The container's own overhead is not in it, which is why the row says "≈".640+ format!("{:.1}", bps as f64 / 1e6)
601-pub(crate) fn estimated_bytes(bps: u64, seconds: f64) -> u64 {641+}
602- ((bps as f64) * seconds.max(0.) / 8.).round() as u64642+
643+/// How fast this computer last wrote a file, in media seconds per wall second.
644+/// Kept in memory for this session only. Zero until one export has landed.
645+static MEASURED_PACE: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
646+
647+/// Remembers the pace of a finished export. A cancelled or failed one says
648+/// nothing about the machine, so the caller passes only the ones that landed.
649+pub(crate) fn note_pace(media_seconds: f64, wall_seconds: f64) {
650+ if media_seconds > 0. && wall_seconds > 0. {
651+ let pace = media_seconds / wall_seconds;
652+ MEASURED_PACE.store(pace.to_bits(), std::sync::atomic::Ordering::Relaxed);
653+ }
603 }654 }
604 655
605-/// A size as the budget row says it: gigabytes with two decimals once the656+/// The pace the last finished export measured, if one has: the time estimate
606-/// file is one, whole megabytes under that. Never a decimal megabyte -- the657+/// never invents one (a guess of "real time" was off by 5x either way).
607-/// estimate is an "≈" and a tenth of a megabyte is precision it does not have.658+pub(crate) fn measured_pace() -> Option<f64> {
608-pub(crate) fn size_label(bytes: u64) -> String {659+ match MEASURED_PACE.load(std::sync::atomic::Ordering::Relaxed) {
609- match bytes >= 1_000_000_000 {660+ 0 => None,
610- true => format!("{:.2} GB", bytes as f64 / 1e9),661+ bits => Some(f64::from_bits(bits)),
611- false => format!("{} MB", (bytes as f64 / 1e6).round() as u64),
612 }662 }
613 }663 }
614 664
615-/// The budget itself, in Mbps to one decimal: the number the lever reads.665+/// How long writing `media_seconds` of film is expected to take at a measured
616-pub(crate) fn rate_label(bps: u64) -> String {666+/// `pace`, in words a person plans around. Never "0 s": a job that rounds to
617- format!("{:.1}", bps as f64 / 1e6)667+/// nothing says "about 1 s". `None` pace is "estimating…", not a number.
668+pub(crate) fn time_words(media_seconds: f64, pace: Option<f64>) -> String {
669+ let Some(pace) = pace.filter(|p| *p > 0. && p.is_finite()) else {
670+ return "estimating\u{2026}".to_string();
671+ };
672+ let secs = (media_seconds.max(0.) / pace).round().max(1.) as u64;
673+ match secs {
674+ 0..90 => format!("about {secs} s"),
675+ 90..600 => {
676+ let r = secs.div_ceil(5) * 5;
677+ format!("about {} min {} s", r / 60, r % 60)
678+ }
679+ _ => format!("about {} min", (secs as f64 / 60.).round() as u64),
680+ }
681+}
682+
683+/// What a name that is a source of the project says, under the field and on the
684+/// Export button.
685+pub(crate) const SOURCE_NAME_TAKEN: &str = "A source file already has this name.";
686+
687+/// Whether `target` is one of the project's own source files, by name or by
688+/// what it resolves to on disk. Writing an export over a source would destroy
689+/// the footage the timeline plays from, so the sheet refuses that outright
690+/// rather than asking to replace it.
691+pub(crate) fn is_a_source(target: &std::path::Path, sources: &[&std::path::Path]) -> bool {
692+ let same_file = |a: &std::path::Path| match (std::fs::canonicalize(a), std::fs::canonicalize(target)) {
693+ (Ok(a), Ok(b)) => a == b,
694+ _ => a == target,
695+ };
696+ sources.iter().any(|&source| same_file(source))
618 }697 }
619 698
620 /// The row a format is picked by, which is what a refusal calls it: the codec,699 /// The row a format is picked by, which is what a refusal calls it: the codec,
@@ -624,7 +703,17 @@ pub(crate) fn format_label(format: Format) -> &'static str {
624 FORMATS703 FORMATS
625 .iter()704 .iter()
626 .find(|(row, ..)| row.contains(&format))705 .find(|(row, ..)| row.contains(&format))
627- .map_or("EXPORT", |(_, _, label, _)| *label)706+ .map_or("Export", |(_, _, label, _)| *label)
707+}
708+
709+/// The file name a typed stem lands as under a format: `stem.ext`, or the bare folder name for a
710+/// numbered run, which is written into a folder named as the stem.
711+pub(crate) fn typed_name(stem: &str, format: Format) -> String {
712+ if format == Format::PngSequence {
713+ stem.to_string()
714+ } else {
715+ format!("{stem}.{}", format.ext())
716+ }
628 }717 }
629 718
630 /// The destination under a format: `take.export.mp4` becomes `take.export.wav`.719 /// The destination under a format: `take.export.mp4` becomes `take.export.wav`.
@@ -632,6 +721,11 @@ pub(crate) fn format_label(format: Format) -> &'static str {
632 /// change of mind about the format -- only the extension is the format's to say.721 /// change of mind about the format -- only the extension is the format's to say.
633 pub(crate) fn retarget(path: &std::path::Path, format: Format) -> PathBuf {722 pub(crate) fn retarget(path: &std::path::Path, format: Format) -> PathBuf {
634 let mut path = path.to_path_buf();723 let mut path = path.to_path_buf();
724+ // A numbered run is written into a folder named as the destination, so it has no extension.
725+ if format == Format::PngSequence {
726+ path.set_extension("");
727+ return path;
728+ }
635 path.set_extension(format.ext());729 path.set_extension(format.ext());
636 path730 path
637 }731 }
@@ -654,7 +748,11 @@ pub(crate) fn export_settings(
654 ) -> ExportSettings {748 ) -> ExportSettings {
655 ExportSettings {749 ExportSettings {
656 format,750 format,
751+ // Filled by the session's export path from its chapter markers, which this
752+ // free function cannot see; an empty list means "use the project's chapters".
753+ chapters: Vec::new(),
657 audio_kbps: Some(audio_kbps),754 audio_kbps: Some(audio_kbps),
755+ audio_bit_depth: None,
658 bitrate: Some(bitrate),756 bitrate: Some(bitrate),
659 // The copy path (the old `Quality::Exact`) is off this surface: the757 // The copy path (the old `Quality::Exact`) is off this surface: the
660 // moment is one budget, and a copy is the absence of one.758 // moment is one budget, and a copy is the absence of one.
@@ -663,9 +761,18 @@ pub(crate) fn export_settings(
663 exact: false,761 exact: false,
664 seat,762 seat,
665 subtitles: Vec::new(),763 subtitles: Vec::new(),
764+ no_soft_subtitles: false,
666 intra_only: false,765 intra_only: false,
667 keep_source_colour: false,766 keep_source_colour: false,
668 range: None,767 range: None,
768+ burn_subtitles: None,
769+ size: None,
770+ video_bit_depth: None,
771+ loudness: None,
772+ prores_profile: ProResProfile::default(),
773+ hdr: HdrOutput::default(),
774+ hevc_speed: None,
775+ gif: GifSettings::default(),
669 }776 }
670 }777 }
671 778
@@ -722,7 +829,10 @@ pub(crate) fn auto_bps(width: u32, height: u32, fps: f64) -> u64 {
722 /// `None` is only ever "that is not a number".829 /// `None` is only ever "that is not a number".
723 pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option<u64> {830 pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option<u64> {
724 let text = text.trim().to_ascii_lowercase();831 let text = text.trim().to_ascii_lowercase();
725- let text = text.trim_end_matches("bps").trim_end_matches('b').trim_end();832+ let text = text
833+ .trim_end_matches("bps")
834+ .trim_end_matches('b')
835+ .trim_end();
726 let (digits, unit) = match text.chars().last()? {836 let (digits, unit) = match text.chars().last()? {
727 c @ ('k' | 'm' | 'g') => (&text[..text.len() - c.len_utf8()], c),837 c @ ('k' | 'm' | 'g') => (&text[..text.len() - c.len_utf8()], c),
728 _ => (text, 'm'),838 _ => (text, 'm'),
@@ -750,11 +860,39 @@ pub(crate) fn parse_budget(text: &str, seconds: f64, audio_bps: u64) -> Option<u
750 /// The span an export writes, in the words row 3 says it in: the marked860 /// The span an export writes, in the words row 3 says it in: the marked
751 /// range where there is one, the whole timeline otherwise -- and "sound only"861 /// range where there is one, the whole timeline otherwise -- and "sound only"
752 /// for a file that carries no picture at all.862 /// for a file that carries no picture at all.
753-pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String {863+/// How long a marked span is, said so a sliver cannot pass for a range: a
754- match (marks, has_video) {864+/// single frame is "1 frame", under a second is frames, then seconds, then
755- (Some(marks), _) => format!("marks {marks}"),865+/// minutes and seconds.
756- (None, true) => "whole film".to_string(),866+pub(crate) fn span_word(frames: u32, fps: f64) -> String {
757- (None, false) => "sound only".to_string(),867+ let secs = f64::from(frames) / fps;
868+ match frames {
869+ 1 => "1 frame".to_string(),
870+ _ if secs < 1. => format!("{frames} frames"),
871+ _ if secs < 60. => format!("{} s", secs.round() as u64),
872+ _ => format!("{} min {} s", (secs / 60.) as u64, (secs % 60.).round() as u64),
873+ }
874+}
875+
876+/// A point on the timeline in the same plain words as [`span_word`]: "2 s",
877+/// "1.5 s", "1 min 5 s" -- a timecode is for the transport, not a summary.
878+pub(crate) fn point_word(frame: u32, fps: f64) -> String {
879+ let secs = f64::from(frame) / fps;
880+ let tenths = (secs * 10.).round() / 10.;
881+ match secs {
882+ _ if secs < 60. && (tenths - tenths.round()).abs() < 1e-9 => format!("{} s", tenths as u64),
883+ _ if secs < 60. => format!("{tenths:.1} s"),
884+ _ => format!("{} min {} s", (secs / 60.) as u64, (secs % 60.).round() as u64),
885+ }
886+}
887+
888+/// The seat a window opens a project with. `Auto` can resolve to VA-API
889+/// encode, which has crashed this machine's GPU, so the GUI starts on
890+/// software -- also for a project saved with `Auto`, which is what every
891+/// project saved before this carries. `Hardware` is only ever a pick.
892+pub(crate) fn gui_default_seat(session: &mut engine::PlaybackSession) {
893+ if session.encoder_seat() == EncoderSeat::Auto {
894+ // A default the load applies, not a pick: it leaves no undo step behind.
895+ session.default_encoder_seat(EncoderSeat::Software);
758 }896 }
759 }897 }
760 898
@@ -762,10 +900,13 @@ pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String {
762 /// box rather than as NaN, which gpui would carry into layout.900 /// box rather than as NaN, which gpui would carry into layout.
763 /// Why this timeline cannot be written in `format`, if it cannot.901 /// Why this timeline cannot be written in `format`, if it cannot.
764 ///902 ///
765-/// An audio-only timeline is the one both picture formats refuse: every frame of903+/// An audio-only timeline is one the picture formats refuse: every frame of it
766-/// it is a gap, so the file would be a black picture over the sound. The engine904+/// is a gap, so a Matroska or WebM file would be a black picture over the sound.
767-/// refuses it too (`export::start`); this is what greys the row before a905+/// The engine refuses those too (`export::start`); this is what greys the row
768-/// destination has been picked.906+/// before a destination has been picked.
907+///
908+/// An mp4 of it is not refused: the engine writes it as the sound alone (AAC in
909+/// an mp4, `export::run_aac`), so the mp4 rows stay open.
769 ///910 ///
770 /// It is the *only* reason left. A second audio lane, a speeded clip, a source911 /// It is the *only* reason left. A second audio lane, a speeded clip, a source
771 /// no mp4 sample table holds: each of those used to grey the MP4 row, because912 /// no mp4 sample table holds: each of those used to grey the MP4 row, because
@@ -774,7 +915,8 @@ pub(crate) fn range_word(marks: Option<&str>, has_video: bool) -> String {
774 /// a refusal any more -- and every video format carries the sound, so there is915 /// a refusal any more -- and every video format carries the sound, so there is
775 /// nothing here that is one format's alone.916 /// nothing here that is one format's alone.
776 pub(crate) fn format_refusal(session: &PlaybackSession, format: Format) -> Option<String> {917 pub(crate) fn format_refusal(session: &PlaybackSession, format: Format) -> Option<String> {
777- if !format.has_video() {918+ // A picture file is refused on a timeline with no picture too, as a video file is.
919+ if (!format.has_video() && !is_picture_set(format)) || format.ext() == "mp4" {
778 return None;920 return None;
779 }921 }
780 let picture = session922 let picture = session
@@ -784,8 +926,1182 @@ pub(crate) fn format_refusal(session: &PlaybackSession, format: Format) -> Optio
784 match picture {926 match picture {
785 true => None,927 true => None,
786 false => Some(format!(928 false => Some(format!(
787- "no picture — {} would be black; export WAV, FLAC, MP3 or OGG",929+ "no picture — {} would be black; export an mp4, M4A, WAV, FLAC, MP3 or Ogg",
788 format.name()930 format.name()
789 )),931 )),
790 }932 }
791 }933 }
934+
935+// ---------------------------------------------------------------------------
936+// The export sheet (DESIGN §9): the model behind the centred sheet, kept as
937+// plain values and functions so every behaviour on it is a test and none of
938+// them needs a window.
939+// ---------------------------------------------------------------------------
940+
941+use engine::export::{GifSettings, LoudnessTarget};
942+use engine::export_presets as presets;
943+use std::collections::HashMap;
944+
945+/// The sheet's open/closed state for the "More settings" disclosure, in the
946+/// same `folds` file every other fold lives in.
947+pub(crate) const EXPORT_MORE_FOLD: &str = "export-more";
948+
949+/// Which of the two destination fields is being typed into.
950+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
951+pub(crate) enum SheetField {
952+ Name,
953+ Folder,
954+}
955+
956+/// What a finished export left behind, for the sheet's "done" face.
957+#[derive(Debug, Clone)]
958+pub(crate) struct ExportDone {
959+ pub path: PathBuf,
960+ pub bytes: u64,
961+ pub wall_secs: f64,
962+}
963+
964+/// A one-second trial write, run when the sheet opens so the time estimate is
965+/// a measurement of this machine and this format rather than a guess.
966+pub(crate) struct PaceBench {
967+ pub key: &'static str,
968+ pub handle: ExportHandle,
969+ pub started: std::time::Instant,
970+ pub media_secs: f64,
971+ pub out: PathBuf,
972+}
973+
974+/// Everything the sheet keeps beside the settings the player already holds
975+/// (`format`, `audio_kbps`, `custom_bps`, the encoder seat).
976+#[derive(Default)]
977+pub(crate) struct ExportSheet {
978+ /// The user picked "whole timeline" although there are marks.
979+ pub whole: bool,
980+ /// The file's canvas; `None` follows the project.
981+ pub size: Option<(u32, u32)>,
982+ /// AV1 sample depth; `None` follows the source.
983+ pub bit_depth: Option<u8>,
984+ /// Sound levelling target; `None` leaves the mix as it is.
985+ pub loudness: Option<LoudnessTarget>,
986+ /// The ProRes profile of a ProRes file.
987+ pub prores: ProResProfile,
988+ /// The HDR transfer of an HEVC file; SDR is none.
989+ pub hdr: HdrTransfer,
990+ /// The software HEVC encoder's speed preset.
991+ pub hevc_speed: HevcSpeed,
992+ /// Bits per sample of a ProRes file's sound: `Some(16)`, else 24.
993+ pub sound_bits: Option<u8>,
994+ /// Captions are left out of the file (`false` keeps the tracks).
995+ pub no_captions: bool,
996+ /// The GIF's width, frame rate and looping ([`Format::Gif`]).
997+ pub gif: GifSettings,
998+ /// A Details row was changed since the last preset was picked: the preset
999+ /// box says "Custom (from X)" even if the settings happen to equal another preset.
1000+ pub custom: bool,
1001+ /// The preset tile last picked: the tie-break when two presets would
1002+ /// describe the settings equally. Whether it still *applies* is derived
1003+ /// ([`matching_preset`]), which is what makes "Custom" automatic.
1004+ pub preset: Option<&'static str>,
1005+ /// The destination field being typed into, and its text.
1006+ pub field: Option<(SheetField, String)>,
1007+ /// The destination field's text is selected whole: the next letter replaces it (Ctrl+A, or
1008+ /// the field just opened on its name).
1009+ pub field_all: bool,
1010+ /// A plain sentence about the last field edit that was refused.
1011+ pub note: Option<String>,
1012+ pub done: Option<ExportDone>,
1013+ pub failed: Option<String>,
1014+ /// The export was cancelled and the cancel landed: the sheet says so.
1015+ pub cancelled: bool,
1016+ /// Measured pace per codec family; `None` is "tried and could not tell".
1017+ pub paces: HashMap<&'static str, Option<f64>>,
1018+ pub bench: Option<PaceBench>,
1019+}
1020+
1021+/// The settings a preset can change, as the player holds them.
1022+#[derive(Debug, Clone, Copy, PartialEq)]
1023+pub(crate) struct Picked {
1024+ pub format: Format,
1025+ /// The picture's budget; zero is "automatic".
1026+ pub bps: u64,
1027+ pub audio_kbps: u32,
1028+ pub size: Option<(u32, u32)>,
1029+ pub depth: Option<u8>,
1030+ pub loudness: Option<LoudnessTarget>,
1031+ pub prores: ProResProfile,
1032+ pub hdr: HdrTransfer,
1033+}
1034+
1035+impl Picked {
1036+ fn settings(&self) -> ExportSettings {
1037+ ExportSettings {
1038+ format: self.format,
1039+ bitrate: (self.bps > 0).then_some(self.bps),
1040+ audio_kbps: Some(self.audio_kbps),
1041+ size: self.size,
1042+ video_bit_depth: self.depth,
1043+ loudness: self.loudness,
1044+ prores_profile: self.prores,
1045+ hdr: HdrOutput { transfer: self.hdr, ..HdrOutput::default() },
1046+ ..ExportSettings::default()
1047+ }
1048+ }
1049+}
1050+
1051+/// `base` with a preset laid over it by the engine's own rule
1052+/// ([`presets::apply`]): the GUI holds no copy of the table.
1053+pub(crate) fn picked_with(base: Picked, preset: &presets::Preset) -> Picked {
1054+ let s = presets::apply(preset, base.settings());
1055+ Picked {
1056+ format: s.format,
1057+ bps: s.bitrate.unwrap_or(base.bps),
1058+ audio_kbps: clamp_audio_kbps(s.audio_kbps.unwrap_or(base.audio_kbps)),
1059+ size: s.size,
1060+ depth: s.video_bit_depth,
1061+ loudness: s.loudness,
1062+ prores: s.prores_profile,
1063+ hdr: s.hdr.transfer,
1064+ }
1065+}
1066+
1067+/// The sound rates the engine writes are [`AUDIO_KBPS`]; a preset that asks for
1068+/// more (AAC 384) gets the top of the list, which is what the engine clamps it to.
1069+pub(crate) fn clamp_audio_kbps(kbps: u32) -> u32 {
1070+ AUDIO_KBPS
1071+ .iter()
1072+ .copied()
1073+ .filter(|&k| k <= kbps)
1074+ .max()
1075+ .unwrap_or(AUDIO_KBPS[0])
1076+}
1077+
1078+/// Whether laying `preset` over `picked` would change nothing.
1079+pub(crate) fn preset_applies(picked: Picked, preset: &presets::Preset) -> bool {
1080+ picked_with(picked, preset) == picked
1081+}
1082+
1083+/// The preset the settings are exactly, preferring `prefer` -- or `None`,
1084+/// which the sheet calls Custom.
1085+pub(crate) fn matching_preset(
1086+ picked: Picked,
1087+ prefer: Option<&str>,
1088+) -> Option<&'static presets::Preset> {
1089+ let table = presets::presets();
1090+ prefer
1091+ .and_then(presets::by_id)
1092+ .filter(|p| preset_applies(picked, p))
1093+ .or_else(|| table.iter().find(|p| preset_applies(picked, p)))
1094+}
1095+
1096+/// The codec in the words a person uses, and the key a measured pace is kept
1097+/// under (every file of a codec is written at about the same pace).
1098+pub(crate) fn codec_word(format: Format) -> &'static str {
1099+ match format {
1100+ Format::Mp4 => "H.264",
1101+ Format::Av1 | Format::Av1Mp4 | Format::Webm => "AV1",
1102+ Format::Hevc | Format::HevcMp4 => "HEVC",
1103+ Format::Wav => "WAV",
1104+ Format::Flac => "FLAC",
1105+ Format::Mp3 => "MP3",
1106+ Format::Ogg => "Vorbis",
1107+ Format::Opus => "Opus",
1108+ Format::M4a => "AAC",
1109+ Format::ProRes => "ProRes",
1110+ Format::Still => "Still image",
1111+ Format::PngSequence => "Numbered pictures",
1112+ Format::Gif => "GIF",
1113+ }
1114+}
1115+
1116+/// Every file the sheet's format list offers: the format, its name and a
1117+/// plain-words reason to choose it. Video first, then sound alone.
1118+pub(crate) const SHEET_FORMATS: [(Format, &str, &str); 15] = [
1119+ (Format::Mp4, "MP4 \u{b7} H.264", "plays everywhere"),
1120+ (Format::Av1Mp4, "MP4 \u{b7} AV1", "smaller files, newer players"),
1121+ (Format::Av1, "MKV \u{b7} AV1", "smaller files, newer players"),
1122+ (Format::HevcMp4, "MP4 \u{b7} HEVC", "small files, phones and TVs"),
1123+ (Format::Hevc, "MKV \u{b7} HEVC", "small files, editing friendly"),
1124+ (Format::Webm, "WebM \u{b7} AV1", "for web pages"),
1125+ (Format::M4a, "M4A", "sound only, plays everywhere"),
1126+ (Format::Mp3, "MP3", "sound only, plays on anything"),
1127+ (Format::Ogg, "Ogg", "sound only, free format"),
1128+ (Format::Opus, "Opus", "sound only, small, for voice"),
1129+ (Format::Flac, "FLAC", "sound only, lossless"),
1130+ (Format::Wav, "WAV", "sound only, uncompressed"),
1131+ (Format::Still, "PNG \u{b7} still", "one picture, no sound"),
1132+ (Format::PngSequence, "PNG \u{b7} sequence", "one picture per frame, no sound"),
1133+ (Format::Gif, "GIF", "animated, no sound"),
1134+];
1135+
1136+/// A format's name as the sheet's list writes it.
1137+pub(crate) fn sheet_format_name(format: Format) -> &'static str {
1138+ SHEET_FORMATS
1139+ .iter()
1140+ .find(|(f, ..)| *f == format)
1141+ .map_or("File", |(_, name, _)| *name)
1142+}
1143+
1144+/// What a preset tile says it makes: the canvas and codec for a picture, the
1145+/// file and rate for sound. `project` is the size a preset with none keeps.
1146+pub(crate) fn preset_result(preset: &presets::Preset, project: Option<(u32, u32)>) -> String {
1147+ match preset.target.output {
1148+ presets::Output::AudioOnly => format!(
1149+ "{} \u{b7} {}",
1150+ sheet_format_name(preset.format),
1151+ match preset.format {
1152+ Format::Wav | Format::Flac => "lossless".to_string(),
1153+ _ => format!("{} kbps", preset.audio_kbps),
1154+ }
1155+ ),
1156+ presets::Output::Video => {
1157+ let size = match preset.target.size.or(project) {
1158+ Some((w, h)) => format!("{w}\u{d7}{h}"),
1159+ None => "project size".to_string(),
1160+ };
1161+ format!("{size} \u{b7} {}", codec_word(preset.format))
1162+ }
1163+ }
1164+}
1165+
1166+/// The two radio rows of the range: the whole timeline and the marks, each
1167+/// with its duration, and why the marks are off when they are.
1168+#[derive(Debug, Clone, PartialEq)]
1169+pub(crate) struct RangeOptions {
1170+ pub whole: String,
1171+ pub marks: Option<String>,
1172+ pub marks_off: Option<&'static str>,
1173+}
1174+
1175+/// `valid` is the marked span as the export would really use it
1176+/// ([`Player::export_range`]); `raw` is whether any marks are set at all, so
1177+/// a stale pair is told apart from none.
1178+pub(crate) fn range_options(
1179+ valid: Option<(u32, u32)>,
1180+ raw: bool,
1181+ timeline_frames: u32,
1182+ fps: f64,
1183+) -> RangeOptions {
1184+ RangeOptions {
1185+ // One decimal, so the whole timeline reads as a length beside the segments.
1186+ whole: format!("{:.1} s long", f64::from(timeline_frames) / fps.max(1.)),
1187+ marks: valid.map(|(start, end)| {
1188+ format!(
1189+ "{} \u{2013} {} \u{b7} {} long",
1190+ point_word(start, fps),
1191+ point_word(end, fps),
1192+ span_word(end - start, fps)
1193+ )
1194+ }),
1195+ marks_off: match (valid, raw) {
1196+ (Some(_), _) => None,
1197+ (None, true) => Some("marks are past the end"),
1198+ (None, false) => Some("Set In and Out on the timeline first"),
1199+ },
1200+ }
1201+}
1202+
1203+/// How big the file may come out, in bytes: a single figure where the bits are
1204+/// fixed by the settings, a span where a quality-driven encoder decides.
1205+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1206+pub(crate) struct SizeEstimate {
1207+ pub low: u64,
1208+ pub high: u64,
1209+}
1210+
1211+/// What a file of `seconds` is expected to weigh. `video_fixed` is false for
1212+/// an encoder that works to a quality and not to the budget (the GPU's AV1),
1213+/// which makes the picture's part a span. Sound formats follow their own maths:
1214+/// PCM is arithmetic, FLAC a typical 50-75 % of it, Vorbis is quality coded.
1215+pub(crate) fn size_estimate(
1216+ format: Format,
1217+ video_bps: u64,
1218+ audio_kbps: u32,
1219+ sound: bool,
1220+ seconds: f64,
1221+ sample_rate: u32,
1222+ video_fixed: bool,
1223+) -> SizeEstimate {
1224+ let secs = seconds.max(0.);
1225+ let bytes = |bps: f64| (bps * secs / 8.).round() as u64;
1226+ let audio = f64::from(audio_kbps) * 1_000.;
1227+ let pcm = f64::from(sample_rate) * 2. * 16.;
1228+ let (low, high) = match format {
1229+ Format::Wav => (pcm * 0.995, pcm * 1.005),
1230+ Format::Flac => (pcm * 0.5, pcm * 0.75),
1231+ Format::Ogg => (80_000., 160_000.),
1232+ Format::Mp3 | Format::M4a | Format::Opus => (audio * 0.98, audio * 1.04),
1233+ _ => {
1234+ let a = if sound { audio } else { 0. };
1235+ let v = video_bps as f64;
1236+ match video_fixed {
1237+ // A budget is an average the encoder lands near, plus the
1238+ // container's own bookkeeping.
1239+ true => ((v + a) * 0.97, (v + a) * 1.04),
1240+ false => (v * 0.35 + a, v * 1.1 + a),
1241+ }
1242+ }
1243+ };
1244+ let (low, high) = (bytes(low), bytes(high));
1245+ // A job with something to write is never "0 MB".
1246+ let floor = u64::from(secs > 0.) * 1_000;
1247+ SizeEstimate {
1248+ low: low.max(floor),
1249+ high: high.max(floor),
1250+ }
1251+}
1252+
1253+/// A byte count as a person reads it: KB under a megabyte, one decimal under
1254+/// ten, whole megabytes, then gigabytes with two decimals.
1255+pub(crate) fn bytes_words(bytes: u64) -> String {
1256+ let b = bytes as f64;
1257+ match bytes {
1258+ 0..1_000_000 => format!("{} KB", ((b / 1e3).round() as u64).max(1)),
1259+ 1_000_000..10_000_000 => format!("{:.1} MB", b / 1e6),
1260+ 10_000_000..1_000_000_000 => format!("{} MB", (b / 1e6).round() as u64),
1261+ _ => format!("{:.2} GB", b / 1e9),
1262+ }
1263+}
1264+
1265+/// The estimate as a sentence part: "about 38 MB" when it is tight, a span
1266+/// ("about 20 to 60 MB") when it cannot be known closer.
1267+pub(crate) fn size_words(est: SizeEstimate) -> String {
1268+ let (low, high) = (bytes_words(est.low), bytes_words(est.high));
1269+ match (est.high as f64) <= (est.low as f64) * 1.15 || low == high {
1270+ true => format!("about {}", bytes_words((est.low + est.high) / 2)),
1271+ false => {
1272+ // "20 to 60 MB": the unit once when both ends share it.
1273+ let (n_low, u_low) = low.split_once(' ').unwrap_or((&low, ""));
1274+ let (_, u_high) = high.split_once(' ').unwrap_or((&high, ""));
1275+ match u_low == u_high {
1276+ true => format!("about {n_low} to {high}"),
1277+ false => format!("about {low} to {high}"),
1278+ }
1279+ }
1280+ }
1281+}
1282+
1283+/// What the warnings look at.
1284+pub(crate) struct WarnCtx {
1285+ pub format: Format,
1286+ /// The canvas the file is drawn at.
1287+ pub target: (u32, u32),
1288+ /// The project's own canvas.
1289+ pub project: (u32, u32),
1290+ pub fps: f64,
1291+ pub video_bps: u64,
1292+ pub timeline_has_picture: bool,
1293+ pub timeline_has_sound: bool,
1294+ pub seconds: f64,
1295+}
1296+
1297+/// A picture rate below this many bits per pixel per frame looks blocky.
1298+const LOW_BITS_PER_PIXEL: f64 = 0.03;
1299+
1300+/// The things worth saying before the button is pressed, in plain words.
1301+pub(crate) fn warnings(ctx: &WarnCtx) -> Vec<String> {
1302+ let mut out = Vec::new();
1303+ if ctx.seconds <= 0. {
1304+ out.push("Range is empty: nothing to export".to_string());
1305+ return out;
1306+ }
1307+ let pixels = |(w, h): (u32, u32)| u64::from(w) * u64::from(h);
1308+ if ctx.format.has_video() {
1309+ if pixels(ctx.target) > pixels(ctx.project) {
1310+ out.push(format!(
1311+ "Stretched up from {}\u{d7}{} \u{2014} won't look sharper",
1312+ ctx.project.0, ctx.project.1
1313+ ));
1314+ }
1315+ let per_pixel = ctx.video_bps as f64 / (pixels(ctx.target) as f64 * ctx.fps).max(1.);
1316+ if per_pixel < LOW_BITS_PER_PIXEL {
1317+ out.push(format!(
1318+ "Low bitrate for {}\u{d7}{}: may look blocky",
1319+ ctx.target.0,
1320+ ctx.target.1
1321+ ));
1322+ }
1323+ if !ctx.timeline_has_sound {
1324+ out.push("No sound on the timeline: the file is silent".to_string());
1325+ }
1326+ } else if !is_picture_set(ctx.format) {
1327+ // A picture set writes no sound, so the sound warnings do not apply to it.
1328+ if ctx.timeline_has_picture {
1329+ out.push("Sound only: the picture is left out".to_string());
1330+ }
1331+ if !ctx.timeline_has_sound {
1332+ out.push("No sound on the timeline: nothing to write".to_string());
1333+ }
1334+ }
1335+ out
1336+}
1337+
1338+/// The container a format is written into, as a person names the file kind.
1339+pub(crate) fn container_word(format: Format) -> &'static str {
1340+ match format {
1341+ Format::Mp4 | Format::Av1Mp4 | Format::HevcMp4 => "MP4",
1342+ Format::Av1 | Format::Hevc => "MKV",
1343+ Format::Webm => "WebM",
1344+ Format::M4a => "M4A",
1345+ Format::Mp3 => "MP3",
1346+ Format::Ogg => "Ogg",
1347+ Format::Opus => "Opus",
1348+ Format::Flac => "FLAC",
1349+ Format::Wav => "WAV",
1350+ Format::ProRes => "MOV",
1351+ Format::Still | Format::PngSequence => "PNG",
1352+ Format::Gif => "GIF",
1353+ }
1354+}
1355+
1356+/// The sound codec a format writes beside (or instead of) its picture.
1357+pub(crate) fn sound_codec_word(format: Format) -> &'static str {
1358+ match format {
1359+ Format::Webm | Format::Opus => "Opus",
1360+ Format::Ogg => "Vorbis",
1361+ Format::Mp3 => "MP3",
1362+ Format::Flac => "FLAC",
1363+ Format::Wav | Format::ProRes => "PCM",
1364+ _ => "AAC",
1365+ }
1366+}
1367+
1368+/// Every (container, codec) pair the export writes, in the order the two
1369+/// Details lists show them. The format is the engine's one value for the pair.
1370+pub(crate) const COMBOS: [(&str, &str, Format); 16] = [
1371+ ("MP4", "H.264", Format::Mp4),
1372+ ("MP4", "HEVC", Format::HevcMp4),
1373+ ("MP4", "AV1", Format::Av1Mp4),
1374+ ("MKV", "HEVC", Format::Hevc),
1375+ ("MKV", "AV1", Format::Av1),
1376+ ("WebM", "AV1", Format::Webm),
1377+ ("M4A", "AAC", Format::M4a),
1378+ ("MP3", "MP3", Format::Mp3),
1379+ ("Ogg", "Vorbis", Format::Ogg),
1380+ ("Opus", "Opus", Format::Opus),
1381+ ("FLAC", "FLAC", Format::Flac),
1382+ ("WAV", "PCM", Format::Wav),
1383+ ("PNG", "Still image", Format::Still),
1384+ ("PNG", "Numbered pictures", Format::PngSequence),
1385+ ("GIF", "GIF", Format::Gif),
1386+ ("MOV", "ProRes", Format::ProRes),
1387+];
1388+
1389+/// The format for picking `container`, keeping the codec in force where that
1390+/// container has it (MP4 to MKV keeps AV1), else the container's first.
1391+pub(crate) fn format_in_container(container: &str, current: Format) -> Option<Format> {
1392+ let codec = codec_word(current);
1393+ COMBOS
1394+ .iter()
1395+ .find(|(c, k, _)| *c == container && (*k == codec || (*k == "PCM" && codec == "WAV")))
1396+ .or_else(|| COMBOS.iter().find(|(c, ..)| *c == container))
1397+ .map(|(.., f)| *f)
1398+}
1399+
1400+/// What a seat is, in a plain half line: the Details list's note.
1401+pub(crate) fn seat_plain(seat: EncoderSeat) -> &'static str {
1402+ match seat {
1403+ EncoderSeat::Software => "CPU; slower, works everywhere",
1404+ EncoderSeat::Hardware => "GPU; faster, needs support",
1405+ EncoderSeat::Auto => "Picks the best encoder on this computer",
1406+ }
1407+}
1408+
1409+/// What the summary reads off the settings.
1410+pub(crate) struct SummaryIn<'a> {
1411+ pub format: Format,
1412+ pub target: (u32, u32),
1413+ pub fps: f64,
1414+ pub bps: u64,
1415+ pub audio_kbps: u32,
1416+ pub sound: bool,
1417+ pub seat: EncoderSeat,
1418+ pub depth: Option<u8>,
1419+ pub prores: ProResProfile,
1420+ pub hdr: HdrTransfer,
1421+ pub hevc_speed: HevcSpeed,
1422+ pub sound_bits: Option<u8>,
1423+ pub size: &'a str,
1424+ /// What a GIF asks for ([`Format::Gif`]); the other formats ignore it.
1425+ pub gif: GifSettings,
1426+}
1427+
1428+/// The three summary lines, each with its fixed label, read off the current
1429+/// settings and short enough not to wrap in the dock:
1430+/// `Video H.264 . 1920x1080 . 25 fps . 12 Mb/s`,
1431+/// `Audio AAC stereo . 320 kb/s`,
1432+/// `File MP4 . Software . ~3.1 MB . ~1 s`.
1433+/// `time` is the export-time words ("" for none).
1434+pub(crate) fn summary_rows(i: &SummaryIn, time: &str) -> [(&'static str, String); 3] {
1435+ let dot = " \u{b7} ";
1436+ let (container, codec) = (container_word(i.format), codec_word(i.format));
1437+ let nb = |n: String, unit: &str| format!("{n}\u{a0}{unit}");
1438+ let (video, audio) = if is_picture_set(i.format) {
1439+ // Pictures and no sound: the file's own size, and its rate for a GIF.
1440+ let picture = match i.format {
1441+ Format::Gif => {
1442+ let w = i.gif.width.min(i.target.0.max(1));
1443+ let h = (f64::from(i.target.1) * f64::from(w) / f64::from(i.target.0.max(1))).round() as u32;
1444+ let loops = if i.gif.loop_forever { "loops" } else { "plays once" };
1445+ format!("GIF{dot}{w}\u{d7}{h}{dot}{}{dot}{loops}", nb(i.gif.fps.to_string(), "fps"))
1446+ }
1447+ Format::PngSequence => format!("PNG{dot}{}\u{d7}{}{dot}one per frame", i.target.0, i.target.1),
1448+ _ => format!("PNG{dot}{}\u{d7}{}", i.target.0, i.target.1),
1449+ };
1450+ (picture, "None".to_string())
1451+ } else if i.format.has_video() {
1452+ let prores = i.format == Format::ProRes;
1453+ let hdr = i.format.is_hevc() && i.hdr != HdrTransfer::Sdr;
1454+ let mut v = vec![match i.depth.filter(|_| matches!(i.format, Format::Av1 | Format::Av1Mp4 | Format::Webm) || (i.format.is_hevc() && !hdr)) {
1455+ _ if prores => i.prores.name().to_string(),
1456+ _ if hdr => hdr_word(i.hdr).to_string(),
1457+ Some(d) => format!("{codec} {d}-bit"),
1458+ None => codec.to_string(),
1459+ }];
1460+ v.push(format!("{}\u{d7}{}", i.target.0, i.target.1));
1461+ v.push(nb(fps_label(i.fps), "fps"));
1462+ // A ProRes profile is its own rate; no budget to quote.
1463+ if !prores {
1464+ v.push(nb(rate_label(i.bps).trim_end_matches(".0").to_string(), "Mb/s"));
1465+ }
1466+
1467+ let a = match (i.sound, prores) {
1468+ (true, true) => format!("PCM stereo{dot}{}-bit", i.sound_bits.unwrap_or(24)),
1469+ (true, false) => format!("{} stereo{dot}{}", sound_codec_word(i.format), nb(i.audio_kbps.to_string(), "kb/s")),
1470+ (false, _) => "None".to_string(),
1471+ };
1472+ (v.join(dot), a)
1473+ } else {
1474+ let spec = match i.format {
1475+ Format::Wav => "16-bit".to_string(),
1476+ Format::Flac => "lossless".to_string(),
1477+ Format::Ogg => "variable quality".to_string(),
1478+ _ => nb(i.audio_kbps.to_string(), "kb/s"),
1479+ };
1480+ let a = match i.sound {
1481+ true => format!("{} stereo{dot}{spec}", sound_codec_word(i.format)),
1482+ false => "None".to_string(),
1483+ };
1484+ ("Sound only".to_string(), a)
1485+ };
1486+ let size = i.size.replacen("about ", "~", 1);
1487+ let mut file = vec![container.to_string()];
1488+ if i.format.has_video() {
1489+ file.push(seat_short(i.seat).to_string());
1490+ // The default search says nothing; a quicker preset is named. Only the
1491+ // software encoder has one.
1492+ if i.format.is_hevc() && i.seat != EncoderSeat::Hardware && i.hevc_speed != HevcSpeed::Default {
1493+ file.push(hevc_speed_label(i.hevc_speed).to_string());
1494+ }
1495+ }
1496+ // A picture set's size is not the bitrate's estimate, and one still is not a length of time.
1497+ if !is_picture_set(i.format) {
1498+ file.push(size);
1499+ }
1500+ if !time.is_empty() && i.format != Format::Still {
1501+ file.push(time.to_string());
1502+ }
1503+ [("Video", video), ("Audio", audio), ("File", file.join(dot))]
1504+}
1505+
1506+/// The HDR choice as a person names it.
1507+pub(crate) fn hdr_word(hdr: HdrTransfer) -> &'static str {
1508+ match hdr {
1509+ HdrTransfer::Sdr => "Off",
1510+ HdrTransfer::Pq => "HDR10",
1511+ HdrTransfer::Hlg => "HLG",
1512+ }
1513+}
1514+
1515+/// The three encoding speeds as the Details row names them.
1516+pub(crate) const HEVC_SPEEDS: [HevcSpeed; 3] = [HevcSpeed::Default, HevcSpeed::Fast, HevcSpeed::Faster];
1517+
1518+pub(crate) fn hevc_speed_label(s: HevcSpeed) -> &'static str {
1519+ match s {
1520+ HevcSpeed::Default => "Best quality",
1521+ HevcSpeed::Fast => "Faster",
1522+ HevcSpeed::Faster => "Fastest",
1523+ }
1524+}
1525+
1526+/// What a speed costs, in plain words: the line under the row.
1527+pub(crate) fn hevc_speed_plain(s: HevcSpeed) -> &'static str {
1528+ match s {
1529+ HevcSpeed::Default => "Thorough search: the smallest file for the quality.",
1530+ HevcSpeed::Fast => "About 1.5\u{d7} quicker; the file is up to 3% bigger.",
1531+ HevcSpeed::Faster => "About 2\u{d7} quicker; the file can be a quarter bigger.",
1532+ }
1533+}
1534+
1535+fn hevc_speed_key(s: HevcSpeed) -> &'static str {
1536+ match s {
1537+ HevcSpeed::Default => "default",
1538+ HevcSpeed::Fast => "fast",
1539+ HevcSpeed::Faster => "faster",
1540+ }
1541+}
1542+
1543+/// The HDR row's value in full words.
1544+pub(crate) fn hdr_row_word(hdr: HdrTransfer) -> &'static str {
1545+ match hdr {
1546+ HdrTransfer::Sdr => "Off",
1547+ HdrTransfer::Pq => "HDR10 (PQ)",
1548+ HdrTransfer::Hlg => "HLG",
1549+ }
1550+}
1551+
1552+/// The ProRes profile in a half line: what it is for.
1553+pub(crate) fn profile_plain(profile: ProResProfile) -> &'static str {
1554+ match profile {
1555+ ProResProfile::Proxy => "smallest, for rough edits",
1556+ ProResProfile::Lt => "light, small files",
1557+ ProResProfile::Standard => "good for most work",
1558+ ProResProfile::Hq => "high-quality master",
1559+ ProResProfile::P4444 => "full colour, can carry alpha",
1560+ ProResProfile::P4444Xq => "highest quality, huge files",
1561+ }
1562+}
1563+
1564+/// The encoder seat in one short word for the summary's File line.
1565+pub(crate) fn seat_short(seat: EncoderSeat) -> &'static str {
1566+ match seat {
1567+ EncoderSeat::Software => "Software",
1568+ EncoderSeat::Hardware => "Hardware",
1569+ EncoderSeat::Auto => "Auto",
1570+ }
1571+}
1572+
1573+/// The export time in the few words the File line has room for.
1574+pub(crate) fn time_short(words: &str) -> String {
1575+ match words.strip_suffix(" to export") {
1576+ Some(t) => t.replacen("about ", "~", 1),
1577+ None if words.starts_with("estimating") => "estimating\u{2026}".to_string(),
1578+ None => String::new(),
1579+ }
1580+}
1581+
1582+/// The id of the UI's own first preset: H.264 MP4 at the project's size and rate.
1583+pub(crate) const MATCH_PROJECT: &str = "match_project";
1584+
1585+/// What a preset row says it makes, in one line: "1080p · H.264 · 8 Mb/s" for
1586+/// a picture (the project's size when the preset keeps it), the file and rate
1587+/// for sound.
1588+pub(crate) fn preset_spec(preset: &presets::Preset, project: Option<(u32, u32)>) -> String {
1589+ match preset.target.output {
1590+ presets::Output::AudioOnly => preset_result(preset, project),
1591+ presets::Output::Video => {
1592+ let size = match preset.target.size.or(project) {
1593+ Some((w, h)) => format!("{w}\u{d7}{h}"),
1594+ None => "project size".to_string(),
1595+ };
1596+ let rate = match preset.bitrate {
1597+ _ if preset.format == Format::ProRes => "10-bit".to_string(),
1598+ Some(bps) if preset.hdr != HdrTransfer::Sdr => format!("{} Mb/s HDR", rate_label(bps).trim_end_matches(".0")),
1599+ Some(bps) => format!("{} Mb/s", rate_label(bps).trim_end_matches(".0")),
1600+ None => "auto rate".to_string(),
1601+ };
1602+ format!("{size} \u{b7} {} \u{b7} {rate}", codec_word(preset.format))
1603+ }
1604+ }
1605+}
1606+
1607+/// Whether a scrolled body has content under its bottom edge: `offset_y` is
1608+/// gpui's (zero at the top, negative going down), `max_y` the furthest it
1609+/// goes. Half a pixel of slack so a body scrolled to its end reads as ended.
1610+pub(crate) fn more_below_shows(offset_y: f32, max_y: f32) -> bool {
1611+ max_y > 0.5 && -offset_y < max_y - 0.5
1612+}
1613+
1614+/// The path with a number in its name until nothing is there: "Keep both".
1615+pub(crate) fn unique_path(path: &Path, exists: impl Fn(&Path) -> bool) -> PathBuf {
1616+ if !exists(path) {
1617+ return path.to_path_buf();
1618+ }
1619+ let stem = path.file_stem().map_or_else(String::new, |s| s.to_string_lossy().into_owned());
1620+ let ext = path.extension().map(|e| e.to_string_lossy().into_owned());
1621+ (2..)
1622+ .map(|n| {
1623+ let name = match &ext {
1624+ Some(ext) => format!("{stem} ({n}).{ext}"),
1625+ None => format!("{stem} ({n})"),
1626+ };
1627+ path.with_file_name(name)
1628+ })
1629+ .find(|candidate| !exists(candidate))
1630+ .unwrap_or_else(|| path.to_path_buf())
1631+}
1632+
1633+/// The three answers to "that file already exists".
1634+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1635+pub(crate) enum Overwrite {
1636+ Replace,
1637+ KeepBoth,
1638+ Cancel,
1639+}
1640+
1641+/// The folder field's text as a directory: `~` is home, and it has to exist.
1642+pub(crate) fn parse_folder(text: &str, home: Option<&str>) -> Result<PathBuf, &'static str> {
1643+ let text = text.trim();
1644+ let path = match (text.strip_prefix('~'), home) {
1645+ (Some(rest), Some(home)) => PathBuf::from(format!("{home}{rest}")),
1646+ _ => PathBuf::from(text),
1647+ };
1648+ match (text.is_empty(), path.is_dir()) {
1649+ (true, _) => Err("Type a folder to save into."),
1650+ (_, false) => Err("That folder does not exist."),
1651+ _ => Ok(path),
1652+ }
1653+}
1654+
1655+/// The name field's text as a file name stem: no folders in it, not empty.
1656+pub(crate) fn parse_stem(text: &str) -> Result<String, &'static str> {
1657+ let stem = text.trim().trim_end_matches('.');
1658+ match (stem.is_empty(), stem.contains(['/', '\\', '\0'])) {
1659+ (true, _) => Err("Give the file a name."),
1660+ (_, true) => Err("A file name cannot contain a slash."),
1661+ _ => Ok(stem.to_string()),
1662+ }
1663+}
1664+
1665+/// Opens or closes a fold in the folds set, returning whether it is now open.
1666+pub(crate) fn toggle_fold(folds: &mut std::collections::BTreeSet<String>, id: &str) -> bool {
1667+ match folds.remove(id) {
1668+ true => false,
1669+ false => {
1670+ folds.insert(id.to_owned());
1671+ true
1672+ }
1673+ }
1674+}
1675+
1676+/// The loudness targets the sheet offers beside "Off": name, LUFS, ceiling.
1677+pub(crate) const LOUDNESS_CHOICES: [(&str, f64, f64); 3] = [
1678+ ("Podcast (\u{2212}16)", -16., -1.),
1679+ ("Streaming (\u{2212}14)", -14., -1.),
1680+ ("Broadcast (\u{2212}23)", -23., -1.),
1681+];
1682+
1683+/// What a loudness target is for, in a plain half line; the LUFS figure is the detail, not the name.
1684+pub(crate) fn loudness_plain(lufs: f64) -> &'static str {
1685+ match lufs {
1686+ -14. => "YouTube, Spotify \u{b7} LUFS",
1687+ -16. => "podcasts and voice \u{b7} LUFS",
1688+ _ => "TV and radio \u{b7} LUFS",
1689+ }
1690+}
1691+
1692+/// An audio-rate refusal from the engine, said as the sound row's plain caption.
1693+pub(crate) fn audio_rate_words(refusal: &str) -> String {
1694+ match refusal {
1695+ r if r.contains("copied") => "Sound is copied as it is, so its rate can't change",
1696+ r if r.contains("lossless") => "Lossless sound, so its rate can't change",
1697+ r if r.contains("quality-coded") => "Ogg sound is set by quality, not by a rate",
1698+ r if r.contains("no sound") => "There is no sound to write",
1699+ _ => "Sound has no rate to pick here",
1700+ }
1701+ .to_string()
1702+}
1703+
1704+/// A failed export in plain words, from the raw error and the folder it was
1705+/// writing to. The raw text stays for the tooltip; the sheet reads this.
1706+pub(crate) fn failure_words(raw: &str, folder: &str) -> String {
1707+ let low = raw.to_ascii_lowercase();
1708+ if low.contains("permission denied") || low.contains("os error 13") {
1709+ format!("edith can't write to {folder}. Pick another folder.")
1710+ } else if low.contains("no space left") || low.contains("os error 28") {
1711+ "The disk is full.".to_string()
1712+ } else if let Some((_, names)) = raw.split_once(" \u{2014} missing: ") {
1713+ format!("A file is missing: {names}.")
1714+ } else if low.contains("no such file") || low.contains("os error 2") {
1715+ format!("The folder {folder} no longer exists.")
1716+ } else {
1717+ "Something went wrong while writing the file.".to_string()
1718+ }
1719+}
1720+
1721+/// The folder field's text: the destination's directory, `~` for home.
1722+pub(crate) fn dest_dir_text(path: &Path) -> String {
1723+ let dir = path.parent().unwrap_or(path).to_string_lossy().to_string();
1724+ match std::env::var("HOME") {
1725+ Ok(home) if !home.is_empty() && dir.starts_with(&home) => format!("~{}", &dir[home.len()..]),
1726+ _ => dir,
1727+ }
1728+}
1729+
1730+/// The time part of the summary. A measured pace prices it ("about 1 min 40 s
1731+/// to export"); with none there is no time at all, rather than a guess or a
1732+/// word that waits on a measurement that may never come.
1733+pub(crate) fn export_time_words(media_seconds: f64, pace: Option<f64>, _pending: bool) -> String {
1734+ // No measured pace, no time: a trial write still running is not a number
1735+ // yet, and "estimating" waiting on it would stick when the trial fails.
1736+ match pace {
1737+ Some(_) => format!("{} to export", time_words(media_seconds, pace)),
1738+ None => String::new(),
1739+ }
1740+}
1741+
1742+/// The settings of the sheet's one-second trial write. Always the software
1743+/// seat, whatever the sheet's encoder says: a GPU encode once took this
1744+/// machine down, and a trial nobody asked for must never open one. The range
1745+/// is the first `frames` frames only.
1746+pub(crate) fn pace_bench_settings(
1747+ bps: u64,
1748+ format: Format,
1749+ audio_kbps: u32,
1750+ size: Option<(u32, u32)>,
1751+ depth: Option<u8>,
1752+ frames: u32,
1753+) -> ExportSettings {
1754+ ExportSettings {
1755+ range: Some((0, frames)),
1756+ size,
1757+ video_bit_depth: depth,
1758+ ..export_settings(bps, format, audio_kbps, EncoderSeat::Software)
1759+ }
1760+}
1761+
1762+/// Where the trial write goes: the system's temporary folder, never the
1763+/// user's export folder. Deleted as soon as it lands or is cancelled.
1764+pub(crate) fn pace_bench_path(format: Format) -> PathBuf {
1765+ std::env::temp_dir().join(format!("edith-pace-{}.{}", std::process::id(), format.ext()))
1766+}
1767+
1768+/// The Details rows that open a list ([`crate::Pick::Export`]).
1769+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
1770+pub(crate) enum ExportRow {
1771+ Preset,
1772+ Profile,
1773+ Hdr,
1774+ SoundDepth,
1775+ Container,
1776+ Codec,
1777+ Seat,
1778+ Bitrate,
1779+ Size,
1780+ Depth,
1781+ Kbps,
1782+ Loudness,
1783+ Captions,
1784+ GifWidth,
1785+ GifFps,
1786+ GifLoop,
1787+}
1788+
1789+/// One answer from those lists. A pair is picked as the engine's one [`Format`].
1790+#[derive(Clone, Copy, PartialEq, Debug)]
1791+pub(crate) enum ExportPick {
1792+ Preset(&'static str),
1793+ /// "Custom": opens Details, where the settings are.
1794+ Custom,
1795+ Format(Format),
1796+ Size(Option<(u32, u32)>),
1797+ /// `None` types a value in.
1798+ Bitrate(Option<u64>),
1799+ Depth(Option<u8>),
1800+ Profile(ProResProfile),
1801+ Hdr(HdrTransfer),
1802+ HevcSpeed(HevcSpeed),
1803+ /// `Some(16)`; `None` is the 24-bit default.
1804+ SoundBits(Option<u8>),
1805+ /// An index into [`LOUDNESS_CHOICES`]; `None` is off.
1806+ Loudness(Option<usize>),
1807+ /// `true` keeps the timeline's caption tracks in the file.
1808+ Captions(bool),
1809+ /// A GIF's width in pixels.
1810+ GifWidth(u32),
1811+ /// A GIF's frame rate.
1812+ GifFps(u32),
1813+ /// `true` loops the GIF forever.
1814+ GifLoop(bool),
1815+}
1816+
1817+/// The widths a GIF is offered at, in pixels.
1818+pub(crate) const GIF_WIDTHS: [u32; 4] = [320, 480, 640, 720];
1819+/// The frame rates a GIF is offered at.
1820+pub(crate) const GIF_FPS: [u32; 4] = [10, 15, 20, 30];
1821+
1822+/// The bitrates the Details list offers, in Mb/s.
1823+pub(crate) const BITRATE_STEPS: [u64; 11] = [1, 2, 4, 6, 8, 12, 16, 20, 30, 40, 50];
1824+
1825+/// The preset box's text: its name, or "Custom" once a detail moved.
1826+pub(crate) fn preset_box_text(current: Option<&str>, _last: Option<&str>) -> String {
1827+ let label = |id: &str| match id {
1828+ MATCH_PROJECT => Some("Match project"),
1829+ _ => presets::by_id(id).map(|p| p.label),
1830+ };
1831+ current.and_then(label).map_or_else(|| "Custom".to_string(), str::to_string)
1832+}
1833+
1834+// ---------------------------------------------------------------------------
1835+// What the Export tab remembers on this computer.
1836+// ---------------------------------------------------------------------------
1837+
1838+/// Every format the file can name. Kept beside [`format_key`], whose match is
1839+/// exhaustive, so a new format cannot be written without a name.
1840+const ALL_FORMATS: [Format; 16] = [
1841+ Format::Mp4,
1842+ Format::Av1Mp4,
1843+ Format::Av1,
1844+ Format::Hevc,
1845+ Format::HevcMp4,
1846+ Format::Webm,
1847+ Format::ProRes,
1848+ Format::Wav,
1849+ Format::Flac,
1850+ Format::Mp3,
1851+ Format::Ogg,
1852+ Format::M4a,
1853+ Format::Opus,
1854+ Format::Still,
1855+ Format::PngSequence,
1856+ Format::Gif,
1857+];
1858+
1859+/// The name a format is saved under. Stable words, not the labels the page
1860+/// shows -- a label may be reworded, and a saved file must keep reading.
1861+fn format_key(format: Format) -> &'static str {
1862+ match format {
1863+ Format::Mp4 => "mp4",
1864+ Format::Av1Mp4 => "av1-mp4",
1865+ Format::Av1 => "av1",
1866+ Format::Hevc => "hevc",
1867+ Format::HevcMp4 => "hevc-mp4",
1868+ Format::Webm => "webm",
1869+ Format::Wav => "wav",
1870+ Format::Flac => "flac",
1871+ Format::Mp3 => "mp3",
1872+ Format::Ogg => "ogg",
1873+ Format::M4a => "m4a",
1874+ Format::Opus => "opus",
1875+ Format::ProRes => "prores",
1876+ Format::Still => "still",
1877+ Format::PngSequence => "png-sequence",
1878+ Format::Gif => "gif",
1879+ }
1880+}
1881+
1882+/// Whether a format writes pictures and no sound, and no encoder runs: a PNG, a run of them, or a
1883+/// GIF. Asked wherever a video format and a sound-only one would be told apart.
1884+pub(crate) fn is_picture_set(format: Format) -> bool {
1885+ matches!(format, Format::Still | Format::PngSequence | Format::Gif)
1886+}
1887+
1888+fn prores_key(p: ProResProfile) -> &'static str {
1889+ match p {
1890+ ProResProfile::Proxy => "proxy",
1891+ ProResProfile::Lt => "lt",
1892+ ProResProfile::Standard => "standard",
1893+ ProResProfile::Hq => "hq",
1894+ ProResProfile::P4444 => "4444",
1895+ ProResProfile::P4444Xq => "4444xq",
1896+ }
1897+}
1898+
1899+fn hdr_key(h: HdrTransfer) -> &'static str {
1900+ match h {
1901+ HdrTransfer::Sdr => "sdr",
1902+ HdrTransfer::Pq => "pq",
1903+ HdrTransfer::Hlg => "hlg",
1904+ }
1905+}
1906+
1907+/// The export choices this computer keeps between launches. The encoder is
1908+/// not among them: it is the project's, saved in its `.edith`.
1909+#[derive(Debug, Clone, Copy, PartialEq)]
1910+pub(crate) struct ExportPrefs {
1911+ pub format: Format,
1912+ pub audio_kbps: u32,
1913+ /// The picture's budget; zero is automatic.
1914+ pub bps: u64,
1915+ pub size: Option<(u32, u32)>,
1916+ pub depth: Option<u8>,
1917+ pub prores: ProResProfile,
1918+ pub hdr: HdrTransfer,
1919+ pub hevc_speed: HevcSpeed,
1920+ pub sound_bits: Option<u8>,
1921+}
1922+
1923+impl Default for ExportPrefs {
1924+ fn default() -> Self {
1925+ ExportPrefs {
1926+ format: Format::default(),
1927+ audio_kbps: DEFAULT_AUDIO_KBPS,
1928+ bps: 0,
1929+ size: None,
1930+ depth: None,
1931+ prores: ProResProfile::default(),
1932+ hdr: HdrTransfer::Sdr,
1933+ hevc_speed: HevcSpeed::Default,
1934+ sound_bits: None,
1935+ }
1936+ }
1937+}
1938+
1939+/// Beside the keybindings, like the theme and the proxy switches.
1940+fn export_defaults_path() -> PathBuf {
1941+ crate::keymap::Keymap::config_path().with_file_name("export-defaults")
1942+}
1943+
1944+/// What the last session left, or the defaults: missing or garbled is not
1945+/// worth a message, since a preference file is not the user's work.
1946+pub(crate) fn load_export_prefs() -> ExportPrefs {
1947+ match std::fs::read_to_string(export_defaults_path()) {
1948+ Ok(text) => parse_export_prefs(&text),
1949+ Err(_) => ExportPrefs::default(),
1950+ }
1951+}
1952+
1953+/// Line one is the format's name, line two the audio kbps (the file's first
1954+/// shape, still read), then `key value` lines. Each line is read on its own:
1955+/// one that does not parse leaves that value at its default.
1956+pub(crate) fn parse_export_prefs(text: &str) -> ExportPrefs {
1957+ let mut prefs = ExportPrefs::default();
1958+ let mut lines = text.lines();
1959+ if let Some(f) = lines
1960+ .next()
1961+ .and_then(|line| ALL_FORMATS.into_iter().find(|&f| format_key(f) == line.trim()))
1962+ {
1963+ prefs.format = f;
1964+ }
1965+ if let Some(k) = lines
1966+ .next()
1967+ .and_then(|line| line.trim().parse::<u32>().ok())
1968+ .filter(|k| AUDIO_KBPS.contains(k))
1969+ {
1970+ prefs.audio_kbps = k;
1971+ }
1972+ for line in lines {
1973+ let Some((key, value)) = line.trim().split_once(' ') else { continue };
1974+ let value = value.trim();
1975+ match key {
1976+ "bitrate" => {
1977+ if let Ok(b) = value.parse::<u64>()
1978+ && (b == 0 || (BPS_MIN..=BPS_MAX).contains(&b))
1979+ {
1980+ prefs.bps = b;
1981+ }
1982+ }
1983+ "size" => {
1984+ if let Some((w, h)) = value.split_once('x')
1985+ && let (Ok(w), Ok(h)) = (w.parse::<u32>(), h.parse::<u32>())
1986+ && (16..=16_384).contains(&w)
1987+ && (16..=16_384).contains(&h)
1988+ {
1989+ prefs.size = Some((w, h));
1990+ }
1991+ }
1992+ "depth" => {
1993+ prefs.depth = match value {
1994+ "8" => Some(8),
1995+ "10" => Some(10),
1996+ _ => None,
1997+ }
1998+ }
1999+ "prores" => {
2000+ if let Some(p) = ProResProfile::ALL.into_iter().find(|&p| prores_key(p) == value) {
2001+ prefs.prores = p;
2002+ }
2003+ }
2004+ "hdr" => {
2005+ if let Some(h) = [HdrTransfer::Sdr, HdrTransfer::Pq, HdrTransfer::Hlg]
2006+ .into_iter()
2007+ .find(|&h| hdr_key(h) == value)
2008+ {
2009+ prefs.hdr = h;
2010+ }
2011+ }
2012+ "hevc-speed" => {
2013+ if let Some(s) = HEVC_SPEEDS.into_iter().find(|&s| hevc_speed_key(s) == value) {
2014+ prefs.hevc_speed = s;
2015+ }
2016+ }
2017+ "sound-bits" => {
2018+ prefs.sound_bits = match value {
2019+ "16" => Some(16),
2020+ _ => None,
2021+ }
2022+ }
2023+ _ => {}
2024+ }
2025+ }
2026+ // An HDR tag lives on an HEVC file only; the engine refuses it elsewhere.
2027+ if !prefs.format.is_hevc() {
2028+ prefs.hdr = HdrTransfer::Sdr;
2029+ }
2030+ prefs
2031+}
2032+
2033+pub(crate) fn render_export_prefs(p: &ExportPrefs) -> String {
2034+ let mut out = format!("{}\n{}\n", format_key(p.format), p.audio_kbps);
2035+ out.push_str(&format!("bitrate {}\n", p.bps));
2036+ if let Some((w, h)) = p.size {
2037+ out.push_str(&format!("size {w}x{h}\n"));
2038+ }
2039+ if let Some(d) = p.depth {
2040+ out.push_str(&format!("depth {d}\n"));
2041+ }
2042+ out.push_str(&format!("prores {}\nhdr {}\n", prores_key(p.prores), hdr_key(p.hdr)));
2043+ if p.hevc_speed != HevcSpeed::Default {
2044+ out.push_str(&format!("hevc-speed {}\n", hevc_speed_key(p.hevc_speed)));
2045+ }
2046+ if let Some(b) = p.sound_bits {
2047+ out.push_str(&format!("sound-bits {b}\n"));
2048+ }
2049+ out
2050+}
2051+
2052+/// Writes the choices whole, the way the proxy switches' files are.
2053+pub(crate) fn save_export_prefs(prefs: &ExportPrefs) -> std::io::Result<()> {
2054+ let path = export_defaults_path();
2055+ if let Some(dir) = path.parent() {
2056+ std::fs::create_dir_all(dir)?;
2057+ }
2058+ std::fs::write(path, render_export_prefs(prefs))
2059+}
2060+
2061+#[cfg(test)]
2062+mod prefs_tests {
2063+ use super::*;
2064+
2065+ #[test]
2066+ fn every_format_is_saved_under_a_name_that_reads_back_as_itself() {
2067+ let mut names = Vec::new();
2068+ for f in ALL_FORMATS {
2069+ let key = format_key(f);
2070+ assert!(!names.contains(&key), "{key} names two formats");
2071+ names.push(key);
2072+ let p = ExportPrefs { format: f, ..ExportPrefs::default() };
2073+ assert_eq!(parse_export_prefs(&render_export_prefs(&p)).format, f);
2074+ }
2075+ }
2076+
2077+ #[test]
2078+ fn all_the_choices_round_trip() {
2079+ let p = ExportPrefs {
2080+ format: Format::HevcMp4,
2081+ audio_kbps: 256,
2082+ bps: 8_000_000,
2083+ size: Some((1280, 720)),
2084+ depth: Some(10),
2085+ prores: ProResProfile::P4444,
2086+ hdr: HdrTransfer::Pq,
2087+ hevc_speed: HevcSpeed::Fast,
2088+ sound_bits: Some(16),
2089+ };
2090+ assert_eq!(parse_export_prefs(&render_export_prefs(&p)), p);
2091+ }
2092+
2093+ #[test]
2094+ fn old_and_garbled_files_read_as_defaults_line_by_line() {
2095+ // The first shape: two lines only.
2096+ let old = parse_export_prefs("av1-mp4\n128\n");
2097+ assert_eq!((old.format, old.audio_kbps), (Format::Av1Mp4, 128));
2098+ assert_eq!(old.bps, 0);
2099+ assert_eq!(parse_export_prefs(""), ExportPrefs::default());
2100+ // A rate the encoder does not offer is not a rate: the default stands.
2101+ assert_eq!(parse_export_prefs("wav\n999\n").audio_kbps, DEFAULT_AUDIO_KBPS);
2102+ assert_eq!(parse_export_prefs("wav\n999\n").format, Format::Wav);
2103+ assert_eq!(parse_export_prefs("no-such\n999\nbitrate x\nsize 1\nhdr what\n"), ExportPrefs::default());
2104+ // HDR on a non-HEVC file is dropped.
2105+ assert_eq!(parse_export_prefs("mp4\n192\nhdr pq\n").hdr, HdrTransfer::Sdr);
2106+ }
2107+}
crates/app/src/files.rsmodified+42 -19
@@ -4,7 +4,7 @@ use crate::*;
4 4
5 /// How a finished export announces itself. Written by `poll_export` and read5 /// How a finished export announces itself. Written by `poll_export` and read
6 /// by the notice bar, which is what makes that one line clickable.6 /// by the notice bar, which is what makes that one line clickable.
7-pub(crate) const EXPORT_DONE: &str = "EXPORT DONE → ";7+pub(crate) const EXPORT_DONE: &str = "Export done → ";
8 8
9 /// The path as a URI the bus will take: percent-encoded, because an export9 /// The path as a URI the bus will take: percent-encoded, because an export
10 /// lands wherever its source lives and those directories have spaces in them.10 /// lands wherever its source lives and those directories have spaces in them.
@@ -70,6 +70,13 @@ pub(crate) fn run_picker(pickers: [(&str, Vec<String>); 2]) -> Option<Option<Pat
70 let Ok(out) = std::process::Command::new(bin).args(args).output() else {70 let Ok(out) = std::process::Command::new(bin).args(args).output() else {
71 continue;71 continue;
72 };72 };
73+ // A chooser that could not open at all (no display to draw on, a broken toolkit) says
74+ // so on stderr and is not a cancel: the next one is tried, and with none left the
75+ // caller says no dialog could open.
76+ let cancelled = out.status.code() == Some(1) && out.stderr.iter().all(u8::is_ascii_whitespace);
77+ if !out.status.success() && !cancelled {
78+ continue;
79+ }
73 let path = String::from_utf8_lossy(&out.stdout).trim().to_string();80 let path = String::from_utf8_lossy(&out.stdout).trim().to_string();
74 return Some((!path.is_empty()).then(|| PathBuf::from(path)));81 return Some((!path.is_empty()).then(|| PathBuf::from(path)));
75 }82 }
@@ -91,9 +98,25 @@ pub(crate) fn pick_file(title: &str) -> Result<Option<PathBuf>, &'static str> {
91 ),98 ),
92 ("kdialog", vec!["--getopenfilename".into()]),99 ("kdialog", vec!["--getopenfilename".into()]),
93 ])100 ])
94- .ok_or(101+ .ok_or(NO_DIALOG)
95- "NO FILE CHOOSER — install zenity or kdialog",102+}
96- )103+
104+/// What is said when no file dialog could open (none installed, or none that can draw here). The callers
105+/// that can take a typed path open the path sheet instead of saying this.
106+pub(crate) const NO_DIALOG: &str = "No file chooser opened here.";
107+
108+/// A folder chooser, opened on `start`. `Err` is a machine with no chooser at all.
109+pub(crate) fn pick_folder(title: &str, start: &std::path::Path) -> Result<Option<PathBuf>, &'static str> {
110+ // A trailing slash makes the dialog open inside the folder, not on it.
111+ let start = format!("{}/", start.to_string_lossy().trim_end_matches('/'));
112+ run_picker([
113+ (
114+ "zenity",
115+ vec!["--file-selection".into(), "--directory".into(), format!("--title={title}"), format!("--filename={start}")],
116+ ),
117+ ("kdialog", vec!["--getexistingdirectory".into(), start]),
118+ ])
119+ .ok_or("No folder dialog could open here. Type the path instead.")
97 }120 }
98 121
99 /// The save-side dialog, opened on where the export would land anyway: with no122 /// The save-side dialog, opened on where the export would land anyway: with no
@@ -115,17 +138,7 @@ pub(crate) fn pick_save(default: &std::path::Path) -> Result<Option<PathBuf>, &'
115 ),138 ),
116 ("kdialog", vec!["--getsavefilename".into(), default]),139 ("kdialog", vec!["--getsavefilename".into(), default]),
117 ])140 ])
118- .ok_or(141+ .ok_or("No file chooser: exporting beside the source")
119- "NO FILE CHOOSER — exporting beside the source",
120- )
121-}
122-
123-/// Where an export goes: the source path with `.export.mp4` for an extension,
124-/// so it lands beside the original and can never be the original.
125-pub(crate) fn export_path(source: impl Into<PathBuf>) -> PathBuf {
126- let mut path = source.into();
127- path.set_extension("export.mp4");
128- path
129 }142 }
130 143
131 /// Where a save goes when the timeline did not come from a project file: the144 /// Where a save goes when the timeline did not come from a project file: the
@@ -150,15 +163,25 @@ pub(crate) fn is_project(path: &std::path::Path) -> bool {
150 /// name plates and the ledger's project identity). One place, so the two can163 /// name plates and the ledger's project identity). One place, so the two can
151 /// never come to disagree about the same file's name.164 /// never come to disagree about the same file's name.
152 pub(crate) fn stem(path: &std::path::Path) -> String {165 pub(crate) fn stem(path: &std::path::Path) -> String {
153- path.file_stem().map_or_else(166+ if let Some(title) = engine::generate::title(path) {
154- || file_name(path),167+ return title.into();
155- |n| n.to_string_lossy().into(),168+ }
156- )169+ if let Some(title) = engine::generate::tone_title(path) {
170+ return title;
171+ }
172+ path.file_stem()
173+ .map_or_else(|| file_name(path), |n| n.to_string_lossy().into())
157 }174 }
158 175
159 /// The tail of a path, for showing. A path that is all root has none, and reads176 /// The tail of a path, for showing. A path that is all root has none, and reads
160 /// as itself.177 /// as itself.
161 pub(crate) fn file_name(path: &std::path::Path) -> String {178 pub(crate) fn file_name(path: &std::path::Path) -> String {
179+ if let Some(title) = engine::generate::title(path) {
180+ return title.into();
181+ }
182+ if let Some(title) = engine::generate::tone_title(path) {
183+ return title;
184+ }
162 path.file_name().map_or_else(185 path.file_name().map_or_else(
163 || path.display().to_string(),186 || path.display().to_string(),
164 |n| n.to_string_lossy().into(),187 |n| n.to_string_lossy().into(),
crates/app/src/follow.rsadded+72 -0
@@ -0,0 +1,72 @@
1+//! Live follow: whether the `.edith` the window has open was written on disk by
2+//! someone else (the agent, through `edith_mcp`) since the window last looked.
3+//! The decision is a pure function of two stamps and one flag, so it reads and
4+//! tests without a window; [`crate::Player`] supplies the three inputs.
5+
6+use std::path::Path;
7+use std::time::SystemTime;
8+
9+/// A project file as the window last saw it: when it was written and how long
10+/// it is. Both must match for a file to count as unchanged.
11+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12+pub(crate) struct Stamp {
13+ pub(crate) mtime: SystemTime,
14+ pub(crate) len: u64,
15+}
16+
17+/// What the window does about one look at the project file.
18+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
19+pub(crate) enum Follow {
20+ /// Nothing settled to read (missing, empty, or mid-write). Change nothing
21+ /// and look again on the next tick.
22+ Wait,
23+ /// The file is the one the window already accounts for.
24+ Idle,
25+ /// The window had no stamp for this file yet. Take the current one as the
26+ /// known state, silently.
27+ Adopt,
28+ /// Changed on disk and the window holds no unsaved edits: reload in place.
29+ Reload,
30+ /// Changed on disk under unsaved edits: ask once, and keep the question
31+ /// away from the window until the file changes again.
32+ Ask,
33+}
34+
35+/// The whole rule. `known` is the stamp the window last accounted for (set on
36+/// open, on its own save, and when a change has been answered). `now` is the
37+/// file as it stands. `edited` says the window holds edits the file does not.
38+///
39+/// The window's own save needs no case here: [`crate::Player::save_project`]
40+/// records the stamp it just wrote as `known`, so its own write reads as `Idle`.
41+pub(crate) fn follow_decision(known: Option<Stamp>, now: Option<Stamp>, edited: bool) -> Follow {
42+ match (known, now) {
43+ (_, None) => Follow::Wait,
44+ (None, Some(_)) => Follow::Adopt,
45+ (Some(known), Some(now)) if known == now => Follow::Idle,
46+ (Some(_), Some(_)) if edited => Follow::Ask,
47+ (Some(_), Some(_)) => Follow::Reload,
48+ }
49+}
50+
51+/// The stamp of `path` as it stands, or `None` when there is nothing settled to
52+/// read: no path, no file, a zero-length file, or a `<path>.part` beside it. The
53+/// engine writes `<path>.part` and renames it over `path`, so the file is only
54+/// final once that sibling is gone.
55+pub(crate) fn stamp(path: &Path) -> Option<Stamp> {
56+ if path.as_os_str().is_empty() {
57+ return None;
58+ }
59+ let mut part = path.as_os_str().to_owned();
60+ part.push(".part");
61+ if Path::new(&part).exists() {
62+ return None;
63+ }
64+ let meta = std::fs::metadata(path).ok()?;
65+ if meta.len() == 0 {
66+ return None;
67+ }
68+ Some(Stamp {
69+ mtime: meta.modified().ok()?,
70+ len: meta.len(),
71+ })
72+}
crates/app/src/importing.rsmodified+10 -5
@@ -106,7 +106,7 @@ pub(crate) struct Import {
106 /// -- the header index and the subtitle pass, the twenty seconds of a cold106 /// -- the header index and the subtitle pass, the twenty seconds of a cold
107 /// 24 GB remux -- gives up at the next element.107 /// 24 GB remux -- gives up at the next element.
108 ///108 ///
109- /// corner-cut: an mp4's header is one read inside `mp4::Mp4Reader`, which109+ /// corner-cut: an mp4's header is one read inside `ec_mp4::Mp4Demuxer`, which
110 /// has no flag to poll, so a cancelled mp4 import still finishes its own110 /// has no flag to poll, so a cancelled mp4 import still finishes its own
111 /// header before the worker returns. Ceiling: the disk stays busy for that111 /// header before the worker returns. Ceiling: the disk stays busy for that
112 /// read, though nothing waits on it. Upgrade path is our own `moov` parse,112 /// read, though nothing waits on it. Upgrade path is our own `moov` parse,
@@ -239,6 +239,11 @@ pub(crate) enum Landing {
239 Import,239 Import,
240 }240 }
241 241
242+/// Whether `path` is an OpenTimelineIO file: a timeline to make a sequence of, never media.
243+pub(crate) fn is_timeline(path: &std::path::Path) -> bool {
244+ path.extension().is_some_and(|e| e.eq_ignore_ascii_case("otio"))
245+}
246+
242 /// Which of the three a queued file is (`landing` above is the drag's).247 /// Which of the three a queued file is (`landing` above is the drag's).
243 /// `opening` is the one path argv named and is cleared as it lands, so a second248 /// `opening` is the one path argv named and is cleared as it lands, so a second
244 /// arrival of the same *media* path -- a drop of the film that is already open249 /// arrival of the same *media* path -- a drop of the film that is already open
@@ -283,8 +288,8 @@ pub(crate) fn import_line(
283 };288 };
284 let what = stage.what();289 let what = stage.what();
285 let verb = match opening {290 let verb = match opening {
286- true => "OPENING",291+ true => "Opening",
287- false => "IMPORTING",292+ false => "Importing",
288 };293 };
289 match since >= IMPORT_STALL {294 match since >= IMPORT_STALL {
290 true => format!(295 true => format!(
@@ -395,11 +400,11 @@ pub(crate) fn silence_line(scanned: f32, total: f32, elapsed: f32, since: f32) -
395 };400 };
396 match since >= IMPORT_STALL {401 match since >= IMPORT_STALL {
397 true => format!(402 true => format!(
398- "SCANNING · still reading the sound — a big film is minutes of decoding, and the \403+ "Scanning · still reading the sound — a big video is minutes of decoding, and the \
399 window is not frozen · {far} · {} elapsed",404 window is not frozen · {far} · {} elapsed",
400 clock(elapsed)405 clock(elapsed)
401 ),406 ),
402- false => format!("SCANNING · {far} · {} elapsed", clock(elapsed)),407+ false => format!("Scanning · {far} · {} elapsed", clock(elapsed)),
403 }408 }
404 }409 }
405 410
crates/app/src/interact.rsmodified+284 -18
@@ -1,6 +1,7 @@
1 //! What a pointer is doing: the drags, the ghosts, the trims and the key repeat.1 //! What a pointer is doing: the drags, the ghosts, the trims and the key repeat.
2 2
3 use crate::*;3 use crate::*;
4+use engine::project::TrimWalls;
4 5
5 /// A library row being dragged: the file and which of its audio streams that6 /// A library row being dragged: the file and which of its audio streams that
6 /// row is, which is the whole of what a row names. Where it lands does not7 /// row is, which is the whole of what a row names. Where it lands does not
@@ -12,7 +13,7 @@ pub(crate) struct AssetDrag(pub(crate) PathBuf, pub(crate) usize);
12 /// nothing is inserted -- the same clip changes lane and keeps the frames it13 /// nothing is inserted -- the same clip changes lane and keeps the frames it
13 /// plays -- but where along the bed it is let go is exactly where it lands, less14 /// plays -- but where along the bed it is let go is exactly where it lands, less
14 /// the offset the hand grabbed it at ([`Player::grab`]).15 /// the offset the hand grabbed it at ([`Player::grab`]).
15-#[derive(Clone, Copy)]16+#[derive(Clone)]
16 pub(crate) struct ClipDrag {17 pub(crate) struct ClipDrag {
17 pub(crate) lane: Lane,18 pub(crate) lane: Lane,
18 pub(crate) idx: usize,19 pub(crate) idx: usize,
@@ -110,12 +111,134 @@ pub(crate) struct Trim {
110 pub(crate) link: Option<u32>,111 pub(crate) link: Option<u32>,
111 }112 }
112 113
113-/// How wide a clip's edge is as a *target*: the strip at each end where a press114+/// A box select in flight: pressed on empty bed at `from`, pulled to `to`
114-/// means "make this longer or shorter" instead of "move this to another lane".115+/// (window coordinates). Under [`MARQUEE_SLOP`] it is still a click.
115-/// Wide enough to hit, narrow enough that the middle of even a small box is116+#[derive(Clone, Copy)]
116-/// still the body.117+pub(crate) struct Marquee {
118+ pub(crate) from: Point<Pixels>,
119+ pub(crate) to: Point<Pixels>,
120+}
121+
122+/// How far the pointer must travel before a press on empty bed becomes a box.
123+pub(crate) const MARQUEE_SLOP: f32 = 4.;
124+
125+impl Marquee {
126+ /// Whether the pointer has travelled far enough for this to be a box.
127+ pub(crate) fn live(&self) -> bool {
128+ let (dx, dy) = (f32::from(self.to.x - self.from.x), f32::from(self.to.y - self.from.y));
129+ dx.abs() >= MARQUEE_SLOP || dy.abs() >= MARQUEE_SLOP
130+ }
131+
132+ /// Left, top, right, bottom of the box.
133+ pub(crate) fn edges(&self) -> (Pixels, Pixels, Pixels, Pixels) {
134+ (
135+ self.from.x.min(self.to.x),
136+ self.from.y.min(self.to.y),
137+ self.from.x.max(self.to.x),
138+ self.from.y.max(self.to.y),
139+ )
140+ }
141+}
142+
143+/// Which of the three pro trims a gesture or key makes (roll, slip, slide).
144+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
145+pub(crate) enum ProKind {
146+ /// The cut after `idx` moves; both clips at it change, the length does not.
147+ Roll,
148+ /// The clip shows another part of its file, in the same slot.
149+ Slip,
150+ /// The clip moves between its neighbours, which give and take the frames.
151+ Slide,
152+}
153+
154+/// A shift-drag in flight on a clip edge (roll) or body (slip, slide). Like
155+/// [`Trim`] it is tracked on the root and the engine hears about it once, at
156+/// the release -- one edit, one undo step.
157+#[derive(Clone, Copy)]
158+pub(crate) struct ProDrag {
159+ pub(crate) lane: Lane,
160+ /// The clip the engine call is made on: for a roll, the clip *before* the
161+ /// cut being dragged (the edge strip's own clip, or the one ahead of it).
162+ pub(crate) idx: usize,
163+ pub(crate) kind: ProKind,
164+ /// The timeline frame under the pointer at the press.
165+ pub(crate) from: u32,
166+ /// Timeline frames moved so far, already clamped to the room the engine
167+ /// answers (slip is clamped by the engine itself at the release).
168+ pub(crate) by: i64,
169+}
170+
171+/// How long a trim edge's handle flashes warn when the pointer runs past a
172+/// media wall (the source has no more frames that way).
173+pub(crate) const TRIM_FLASH: std::time::Duration = std::time::Duration::from_millis(120);
174+
175+/// The media-wall stop an edge is pinned against, live: the edge is kept at a
176+/// bound while it is pulled through it, and the warn flash is for that stop
177+/// alone. `since` is when it began, `wall` the frame it is pinned to, so a
178+/// pointer that stays past the same wall is one stop, not a flash per sample.
179+#[derive(Clone, Copy)]
180+pub(crate) struct TrimFlash {
181+ pub(crate) lane: Lane,
182+ pub(crate) idx: usize,
183+ pub(crate) edge: Edge,
184+ pub(crate) wall: u32,
185+ pub(crate) since: Instant,
186+}
187+
188+impl TrimFlash {
189+ /// Whether this edge's handle is still flashing.
190+ pub(crate) fn lit(&self, lane: Lane, idx: usize, edge: Edge) -> bool {
191+ (self.lane, self.idx, self.edge) == (lane, idx, edge) && self.since.elapsed() < TRIM_FLASH
192+ }
193+}
194+
195+/// The media wall a trim stopped against, if the pointer wanted past it: `at`
196+/// is where the pointer asked the edge to be, `to` where the engine let it
197+/// stand, `walls` the room the edge has. `None` when nothing was refused, or
198+/// when the bound that held is a neighbour or the timeline's own start, which
199+/// carry no flash -- only the source's end does.
200+pub(crate) fn media_wall_stop(at: u32, to: u32, walls: TrimWalls) -> Option<u32> {
201+ if at < walls.lo && to == walls.lo && walls.lo_media {
202+ return Some(walls.lo);
203+ }
204+ if at > walls.hi && to == walls.hi && walls.hi_media {
205+ return Some(walls.hi);
206+ }
207+ None
208+}
209+
210+/// The handle width [`trims`] is built on: a box below three of these has no
211+/// trim zones at all. The zones themselves are [`TRIM_REACH`] either side of
212+/// each edge, which is wider than this strip, so this is the floor, not the
213+/// hit size.
117 pub(crate) const EDGE_W: f32 = 6.;214 pub(crate) const EDGE_W: f32 = 6.;
118 215
216+/// How far a trim's hit zone reaches on *each* side of a clip edge: 24 px
217+/// centred on the edge, so the hand finds it by aim alone (WCAG 2.5.8,
218+/// [`HIT_MIN`]). The visible handle of a selected clip is [`TRIM_HANDLE`]
219+/// wide; the rest of the zone is a target, not a drawing.
220+pub(crate) const TRIM_REACH: f32 = HIT_MIN / 2.;
221+
222+/// The drawn trim handle a selected clip shows inside each edge.
223+#[cfg_attr(not(test), allow(dead_code))]
224+pub(crate) const TRIM_HANDLE: f32 = 12.;
225+
226+/// How far one edge's trim zone reaches, as `(inside, outside)` px from the
227+/// edge. `room` is the gap to the neighbour on that side (`f32::INFINITY`
228+/// where there is none): the outside reach stops at the middle of that gap, so
229+/// where two clips meet the clip under the pointer wins its own half of the
230+/// join.
231+///
232+/// The inside reach shrinks on a clip under 48 px to a quarter of its width,
233+/// which keeps the middle half of it a move target -- the middle third is
234+/// what the rule guarantees, and a quarter leaves it room to breathe.
235+pub(crate) fn trim_zone(width: f32, room: f32) -> (f32, f32) {
236+ (
237+ TRIM_REACH.min(width / 4.),
238+ TRIM_REACH.min(room.max(0.) / 2.),
239+ )
240+}
241+
119 /// A fade handle's own hit zone, at each *top* corner of an audio clip's box --242 /// A fade handle's own hit zone, at each *top* corner of an audio clip's box --
120 /// never the trim strip's height, which is [`EDGE_W`] wide down the whole box243 /// never the trim strip's height, which is [`EDGE_W`] wide down the whole box
121 /// ([`trims`]) and would swallow a fade press if the two overlapped. Sitting244 /// ([`trims`]) and would swallow a fade press if the two overlapped. Sitting
@@ -147,6 +270,40 @@ pub(crate) struct FadeDrag {
147 pub(crate) cap: u32,270 pub(crate) cap: u32,
148 }271 }
149 272
273+/// What a volume-envelope drag holds: one key, or the line between key `i` and key `i + 1`.
274+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
275+pub(crate) enum GainGrab {
276+ Key(usize),
277+ Segment(usize),
278+}
279+
280+/// A volume-envelope drag on one audio clip, tracked on the root like a fade is. A key moves in
281+/// time (between its neighbours and the clip's own source range) and in dB; a segment moves both
282+/// of its keys up or down by the same dB. `keys` is the envelope at the press, which the release
283+/// compares against; `shown` is what the drag is showing and what the release commits, in one
284+/// undo step. Positions are window pixels, and `origin` and `size` are the clip's own box.
285+#[derive(Clone, Debug)]
286+pub(crate) struct GainEdit {
287+ pub(crate) lane: Lane,
288+ pub(crate) idx: usize,
289+ pub(crate) grab: GainGrab,
290+ pub(crate) press: Point<Pixels>,
291+ pub(crate) origin: Point<Pixels>,
292+ pub(crate) size: Size<Pixels>,
293+ pub(crate) keys: Vec<engine::GainKey>,
294+ pub(crate) shown: Vec<engine::GainKey>,
295+ /// The clip's own gain, the source range a key may move in, its speed and the timeline's
296+ /// pixels per frame, read at the press.
297+ pub(crate) clip_gain: f32,
298+ pub(crate) in_frame: u32,
299+ pub(crate) out_frame: u32,
300+ pub(crate) speed: f64,
301+ pub(crate) px_per_frame: f32,
302+ /// For a key: the display dB the press was over, less the key's own. For a segment: the dB
303+ /// under the press. A move adds the pointer's change to it.
304+ pub(crate) grab_db: f32,
305+}
306+
150 /// Whether a clip box this wide gets its two trim strips at all. Below three307 /// Whether a clip box this wide gets its two trim strips at all. Below three
151 /// handles wide the pair would occlude the whole box: every press on it would308 /// handles wide the pair would occlude the whole box: every press on it would
152 /// trim, and the clip could not be selected, dragged to another lane or picked309 /// trim, and the clip could not be selected, dragged to another lane or picked
@@ -195,7 +352,8 @@ pub(crate) fn scrim() -> Div {
195 /// (DESIGN §2/§4); the legacy tree keeps its own raised sheet. One function,352 /// (DESIGN §2/§4); the legacy tree keeps its own raised sheet. One function,
196 /// so the next change reaches all three or none.353 /// so the next change reaches all three or none.
197 pub(crate) fn menu_plate(id: &'static str, x: f32, y: f32) -> Stateful<Div> {354 pub(crate) fn menu_plate(id: &'static str, x: f32, y: f32) -> Stateful<Div> {
198- div()355+ // The one popup look (REDESIGN §1.6): every menu starts from `kit::plate`.
356+ crate::ui::kit::plate(6.)
199 .id(id)357 .id(id)
200 .absolute()358 .absolute()
201 .left(px(x))359 .left(px(x))
@@ -204,10 +362,6 @@ pub(crate) fn menu_plate(id: &'static str, x: f32, y: f32) -> Stateful<Div> {
204 .flex()362 .flex()
205 .flex_col()363 .flex_col()
206 .p(px(crate::layout::MENU_PAD))364 .p(px(crate::layout::MENU_PAD))
207- .rounded(px(6.))
208- .bg(rgb(crate::ui::theme::DARK_PANEL()))
209- .border_1()
210- .border_color(rgba(crate::ui::theme::DARK_SEAM()))
211 }365 }
212 366
213 /// The sheet a card with a *slider* in it takes instead: the same scrim, with367 /// The sheet a card with a *slider* in it takes instead: the same scrim, with
@@ -223,7 +377,7 @@ pub(crate) fn menu_plate(id: &'static str, x: f32, y: f32) -> Stateful<Div> {
223 /// The scrim is the one surface above the occluder that covers the whole card,377 /// The scrim is the one surface above the occluder that covers the whole card,
224 /// so the same two listeners go here, and a drag that leaves the card is picked378 /// so the same two listeners go here, and a drag that leaves the card is picked
225 /// up by the root's copy of them without a seam.379 /// up by the root's copy of them without a seam.
226-pub(crate) fn drag_scrim(cx: &mut Context<Player>) -> Div {380+pub(crate) fn drag_scrim(cx: &Context<Player>) -> Div {
227 scrim()381 scrim()
228 .on_mouse_move(cx.listener(Player::drag_move))382 .on_mouse_move(cx.listener(Player::drag_move))
229 .on_mouse_up(MouseButton::Left, cx.listener(Player::drag_release))383 .on_mouse_up(MouseButton::Left, cx.listener(Player::drag_release))
@@ -314,7 +468,10 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div
314 this.splits.clear(split);468 this.splits.clear(split);
315 crate::layout::save_stance_splits(&this.splits);469 crate::layout::save_stance_splits(&this.splits);
316 }470 }
317- false => this.split_drag = Some(split),471+ false => {
472+ this.split_drag = Some(split);
473+ this.split_press = Some((event.position, false));
474+ }
318 }475 }
319 cx.notify();476 cx.notify();
320 cx.stop_propagation();477 cx.stop_propagation();
@@ -348,6 +505,63 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context<Player>) -> Div
348 )505 )
349 }506 }
350 507
508+/// The grab on a lane's bottom edge (DESIGN §5 "Lane heights"): 2px inside the
509+/// lane's edge and 12px past it -- the 2px [`ROW_GAP`] plus 10px of the lane
510+/// below. It starts at the head's right edge, so the bed carries it and a head
511+/// keeps its own bottom pixels for its reorder grab and switches. It stays out
512+/// of the lane's bottom 2px and so does not cover the key marks drawn on a
513+/// clip's foot (`ui/bench_stance/lane.rs`), which must take their own presses.
514+/// A press starts the drag (`Player::lane_resize`, read by `drag_move`); a
515+/// double-click puts the lane back to its kind's default.
516+pub(crate) fn lane_resize_band(
517+ lane: Lane,
518+ h: f32,
519+ left: f32,
520+ cx: &mut Context<Player>,
521+) -> impl IntoElement + use<> {
522+ const ABOVE_H: f32 = 2.;
523+ const BELOW_H: f32 = 12.;
524+ let key = crate::ui::bench_stance::lane_key(lane);
525+ // Named per lane: `group_hover` resolves by name through one global map.
526+ let group = format!("lane-resize-{key}");
527+ div()
528+ .id(SharedString::from(format!("bench-lane-resize-{key}")))
529+ .absolute()
530+ .group(group.clone())
531+ .left(px(left))
532+ .right_0()
533+ .top(px(h - ABOVE_H))
534+ .h(px(ABOVE_H + BELOW_H))
535+ .cursor_row_resize()
536+ .on_mouse_down(
537+ MouseButton::Left,
538+ cx.listener(move |this, event: &MouseDownEvent, _, cx| {
539+ match event.click_count >= 2 {
540+ true => this.reset_lane_h(lane, cx),
541+ // The grab is the pointer's y less the height the lane
542+ // has now, so a drag sets the height from the pointer
543+ // alone (`Player::drag_lane_resize`) and never jumps.
544+ false => {
545+ this.lane_resize = Some((lane, f32::from(event.position.y) - h));
546+ cx.notify();
547+ }
548+ }
549+ cx.stop_propagation();
550+ }),
551+ )
552+ // The hairline at the lane's edge, lit under the pointer -- the same
553+ // "this can be dragged" cue a seam gives (`divider`).
554+ .child(
555+ div()
556+ .absolute()
557+ .left_0()
558+ .right_0()
559+ .top(px(ABOVE_H - 1.))
560+ .h(px(1.))
561+ .group_hover(group, |s| s.bg(rgb(STROKE_DIVIDER()))),
562+ )
563+}
564+
351 /// A press that stops here. What every card's body hands its scrim: the scrim565 /// A press that stops here. What every card's body hands its scrim: the scrim
352 /// closes the card on a press, and the card is painted after it, so this listener566 /// closes the card on a press, and the card is painted after it, so this listener
353 /// runs first (gpui dispatches topmost-first, window.rs:3705) and a press meant567 /// runs first (gpui dispatches topmost-first, window.rs:3705) and a press meant
@@ -376,12 +590,17 @@ pub(crate) const DROP_SNAP_PX: f64 = 10.;
376 /// own seek strip, which is the idiom it sits under.590 /// own seek strip, which is the idiom it sits under.
377 pub(crate) const SCROLL_THUMB_MIN: f32 = 24.;591 pub(crate) const SCROLL_THUMB_MIN: f32 = 24.;
378 592
379-/// The thickness of a scrollbar strip's hit area, in the one dimension the593+/// The thickness of a scrollbar bar as drawn, in the one dimension the strip
380-/// strip spans: the height of the horizontal one under the lanes, the width594+/// spans: the height of the horizontal one under the lanes, the width of the
381-/// of the vertical one on the beds' right edge. The bar inside it looks 6 px,595+/// vertical one on the beds' right edge. This is what the layout spends.
382-/// and the strip that takes the press is thicker for the ruler strip's596+pub(crate) const SCROLL_BAR_H: f32 = 6.;
383-/// reason -- a hand must be able to find it without aiming (WCAG 2.5.8).597+
384-pub(crate) const SCROLL_HIT: f32 = 14.;598+/// The hit area of a scrollbar strip, in the same dimension: a hand must be
599+/// able to find it without aiming (WCAG 2.5.8, [`HIT_MIN`]). The strip's row
600+/// is [`SCROLL_ROW_H`] tall; the band reaches [`SCROLL_HIT_UP`] above it into
601+/// the bottom of the lanes and [`SCROLL_HIT_DOWN`] below it, so the band is
602+/// at least [`HIT_MIN`] and the lanes give up no more than 8px for it.
603+pub(crate) const SCROLL_HIT: f32 = HIT_MIN;
385 604
386 /// Where a held key would land, which is the whole of what auto-repeat has to605 /// Where a held key would land, which is the whole of what auto-repeat has to
387 /// know. [`Player::repeat_scope`] answers it from the same state the handler606 /// know. [`Player::repeat_scope`] answers it from the same state the handler
@@ -426,3 +645,50 @@ pub(crate) fn repeats(scope: Repeat, key: &str, action: Option<ActionId>) -> boo
426 Repeat::Nothing => false,645 Repeat::Nothing => false,
427 }646 }
428 }647 }
648+
649+#[cfg(test)]
650+mod tests {
651+ use super::*;
652+
653+ fn walls(lo_media: bool, hi_media: bool) -> TrimWalls {
654+ TrimWalls {
655+ lo: 1,
656+ hi: 9,
657+ lo_media,
658+ hi_media,
659+ }
660+ }
661+
662+ #[test]
663+ fn a_stop_flashes_only_at_a_media_wall_the_pointer_wanted_past() {
664+ // Past the source's end: flash. Past a neighbour, or inside the room:
665+ // nothing to say.
666+ assert_eq!(media_wall_stop(12, 9, walls(false, true)), Some(9));
667+ assert_eq!(media_wall_stop(12, 9, walls(false, false)), None);
668+ assert_eq!(media_wall_stop(0, 1, walls(true, false)), Some(1));
669+ assert_eq!(media_wall_stop(0, 1, walls(false, true)), None);
670+ assert_eq!(media_wall_stop(5, 5, walls(true, true)), None);
671+ // A clamp that did not clamp the pointer's ask is not a stop.
672+ assert_eq!(media_wall_stop(9, 9, walls(true, true)), None);
673+ }
674+
675+ #[test]
676+ fn a_flash_lights_its_own_edge_for_its_window_only() {
677+ let lane = Lane::V1;
678+ let fresh = TrimFlash {
679+ lane,
680+ idx: 2,
681+ edge: Edge::End,
682+ wall: 9,
683+ since: Instant::now(),
684+ };
685+ assert!(fresh.lit(lane, 2, Edge::End));
686+ assert!(!fresh.lit(lane, 2, Edge::Start));
687+ assert!(!fresh.lit(lane, 3, Edge::End));
688+ let spent = TrimFlash {
689+ since: Instant::now() - TRIM_FLASH - Duration::from_millis(1),
690+ ..fresh
691+ };
692+ assert!(!spent.lit(lane, 2, Edge::End));
693+ }
694+}
crates/app/src/keymap.rsmodified+2187 -586

Diff too large; view file

@@ -1,7 +1,7 @@
1 //! The keymap: which stroke means which action, and the file it survives in.1 //! The keymap: which stroke means which action, and the file it survives in.
2 //!2 //!
3 //! ```text3 //! ```text
4-//! edith-keys 14+//! edith-keys 2
5 //! play space5 //! play space
6 //! delete x6 //! delete x
7 //! delete delete7 //! delete delete
@@ -9,7 +9,8 @@
9 //! ```9 //! ```
10 //!10 //!
11 //! One line per binding, so an action bound to two strokes is two lines and the11 //! One line per binding, so an action bound to two strokes is two lines and the
12-//! format needs no list syntax. A chord is `key` or `ctrl+key`, where `key` is12+//! format needs no list syntax. A chord is `key` with any of `ctrl+`, `shift+` and
13+//! `alt+` in front of it, in any order, where `key` is
13 //! exactly what gpui reports for the stroke (`escape`, not `esc`) -- the lookup14 //! exactly what gpui reports for the stroke (`escape`, not `esc`) -- the lookup
14 //! compares against that string and nothing translates in between. What a15 //! compares against that string and nothing translates in between. What a
15 //! *person* reads is [`Keymap::display`]'s business, and only there.16 //! *person* reads is [`Keymap::display`]'s business, and only there.
@@ -34,7 +35,7 @@ use std::io::Write;
34 use std::path::{Path, PathBuf};35 use std::path::{Path, PathBuf};
35 36
36 /// First line, exactly. The version is part of it, as in the project file.37 /// First line, exactly. The version is part of it, as in the project file.
37-const MAGIC: &str = "edith-keys 1";38+const MAGIC: &str = "edith-keys 2";
38 39
39 /// The action list, written once: the enum and the display-order array come out40 /// The action list, written once: the enum and the display-order array come out
40 /// of the same names, so an action added here is in [`ActionId::ALL`] by41 /// of the same names, so an action added here is in [`ActionId::ALL`] by
@@ -51,6 +52,24 @@ macro_rules! actions {
51 }52 }
52 53
53 impl ActionId {54 impl ActionId {
55+ /// The angle a number key switches to (1 to 9).
56+ pub fn angle_number(self) -> Option<usize> {
57+ match self {
58+ ActionId::Angle1 => Some(1),
59+ ActionId::Angle2 => Some(2),
60+ ActionId::Angle3 => Some(3),
61+ ActionId::Angle4 => Some(4),
62+ ActionId::Angle5 => Some(5),
63+ ActionId::Angle6 => Some(6),
64+ ActionId::Angle7 => Some(7),
65+ ActionId::Angle8 => Some(8),
66+ ActionId::Angle9 => Some(9),
67+ _ => None,
68+ }
69+ }
70+}
71+
72+impl ActionId {
54 /// Display order everywhere -- the editor lists them in it and73 /// Display order everywhere -- the editor lists them in it and
55 /// [`Keymap::defaults`] binds them in it. Derived from the list74 /// [`Keymap::defaults`] binds them in it. Derived from the list
56 /// above, so there is no second place to forget.75 /// above, so there is no second place to forget.
@@ -67,12 +86,17 @@ actions! {
67 /// Live exactly where Play is: a transport with nothing under it has86 /// Live exactly where Play is: a transport with nothing under it has
68 /// nothing to loop either.87 /// nothing to loop either.
69 Loop,88 Loop,
89+ /// Plays from a short lead-in before the playhead to a short run-on after
90+ /// it, then puts the playhead back where it started (Premiere's Play Around).
91+ PlayAround,
70 StepBack,92 StepBack,
71 StepForward,93 StepForward,
72 JumpBack,94 JumpBack,
73 JumpForward,95 JumpForward,
74 GoStart,96 GoStart,
75 GoEnd,97 GoEnd,
98+ /// Types a time (`1:23`, `83.5`, `00:01:23:12`, `+2s`, `-10f`) and the playhead jumps there.
99+ GoToTime,
76 /// The two that put the playhead on a *source* sync point -- the frames a100 /// The two that put the playhead on a *source* sync point -- the frames a
77 /// cut may be placed on for an export to copy the film's own coded pictures101 /// cut may be placed on for an export to copy the film's own coded pictures
78 /// instead of decoding and coding every one of them again. Playback keys by102 /// instead of decoding and coding every one of them again. Playback keys by
@@ -95,6 +119,25 @@ actions! {
95 WalkCutNext10,119 WalkCutNext10,
96 /// The pair's other half (`<`, what shift+, actually types).120 /// The pair's other half (`<`, what shift+, actually types).
97 WalkCutPrev10,121 WalkCutPrev10,
122+ /// Drops a comment marker at the playhead (`engine::project::Marker`): a name, a
123+ /// note and a colour, listed on the markers card. Bare `m` is the mute, so it
124+ /// takes the alt rung of the same letter.
125+ AddMarker,
126+ /// Drops a comment marker at the frame the ruler menu was opened on.
127+ MarkerHere,
128+ /// Renames the marker the ruler menu was opened on: the markers card opens with its name
129+ /// being typed ([`Player::begin_marker_edit`]).
130+ RenameMarker,
131+ /// Takes the marker the ruler menu was opened on off the list.
132+ DeleteMarker,
133+ /// Moves the playhead to the frame the ruler (or empty-track) menu was opened on.
134+ PlayheadHere,
135+ /// Walks the playhead to the next comment marker, after the playhead.
136+ NextMarker,
137+ /// The pair's other half, the marker before the playhead.
138+ PrevMarker,
139+ /// Opens the markers card: every marker with its time, name, note and colour.
140+ Markers,
98 /// Marks the playhead as an export's in point. The out point wraps around141 /// Marks the playhead as an export's in point. The out point wraps around
99 /// it if the mark lands past the current out ([`ordered_range`]).142 /// it if the mark lands past the current out ([`ordered_range`]).
100 SetIn,143 SetIn,
@@ -103,10 +146,64 @@ actions! {
103 SetOut,146 SetOut,
104 /// Drops the mark: an export goes back to the whole timeline.147 /// Drops the mark: an export goes back to the whole timeline.
105 ClearRange,148 ClearRange,
149+ /// Pre-renders the In-Out range into the render cache, which plays back as finished frames.
150+ RenderInOut,
151+ /// Pre-renders the whole timeline into the render cache.
152+ RenderAll,
153+ /// Stops the render preview running now and removes its partial file.
154+ CancelRender,
155+ /// Deletes every render-cache file.
156+ DeleteRenderFiles,
157+ /// The J/K/L shuttle (DESIGN.md §10.2). J plays backward, and again steps
158+ /// the rate through 2x and 4x.
159+ ShuttleBack,
160+ /// K: pauses whatever is playing.
161+ ShuttleStop,
162+ /// L: plays forward, and again steps the rate through 2x and 4x.
163+ ShuttleForward,
106 Export,164 Export,
107 Save,165 Save,
166+ /// Reloads the open project from its file on disk, as the window follows it
167+ /// when another writer saves it ([`crate::Player::reload_request`]). Menu and
168+ /// palette only: no stroke, since a key that throws away edits is one that
169+ /// is pressed by accident.
170+ ReloadProject,
171+ /// File > New > Project…: a small dialog (name, folder, size, rate) that starts a project
172+ /// the first footage then fills. Menu, palette and the welcome screen's button.
173+ NewProject,
174+ /// File > Save version: a named full copy of the project beside it, kept to go back to
175+ /// ([`engine::versions`]). Menu and palette only.
176+ SaveVersion,
177+ /// File > Save as template…: the settings, and optionally the clips, as a reusable template.
178+ SaveTemplate,
179+ /// File > Export captions: the timeline's captions written as an SRT or WebVTT file beside
180+ /// the export folder's default name ([`engine::subtitle::write_srt`]). Menu and palette only.
181+ ExportCaptions,
182+ /// File > Versions: the saved versions, and Restore for one (a single undo step).
183+ Versions,
184+ /// File > Collect media: copies every used source into one folder and relinks the project
185+ /// to the copies ([`engine::collect`]).
186+ CollectMedia,
187+ /// File > Project notes: a free-text note kept in the project, several lines allowed.
188+ ProjectNotes,
189+ /// File > Export timeline as > OpenTimelineIO, Final Cut Pro XML or EDL: writes the active
190+ /// sequence to the default export folder, named after the project ([`engine::interchange`]).
191+ ExportTimelineOtio,
192+ ExportTimelineFcpxml,
193+ ExportTimelineEdl,
194+ /// File > Import timeline (OTIO): reads an OpenTimelineIO file as a new sequence of the project.
195+ ImportTimelineOtio,
108 Copy,196 Copy,
109 Paste,197 Paste,
198+ /// Three-point insert (DESIGN.md §10.2): the library item being previewed --
199+ /// its marked in..out, or the whole of it -- goes in at the playhead, cutting
200+ /// the clip there and rippling the later ones on the lanes it lands on. With
201+ /// timeline marks set, their length is the duration. F9, as in Resolve:
202+ /// `,` and `.` already walk the cuts.
203+ InsertSource,
204+ /// Three-point overwrite: the same source range laid over what is at the
205+ /// playhead for its length, trimming or splitting it. Nothing moves. F10.
206+ OverwriteSource,
110 Cut,207 Cut,
111 Regroup,208 Regroup,
112 Detach,209 Detach,
@@ -128,13 +225,48 @@ actions! {
128 /// ([`crate::transform_ui::TRANSFORM_BANDS`]) -- the geometry twin of225 /// ([`crate::transform_ui::TRANSFORM_BANDS`]) -- the geometry twin of
129 /// [`ActionId::Color`], filed right beside it.226 /// [`ActionId::Color`], filed right beside it.
130 Transform,227 Transform,
228+ /// Opens the effects card: the clip's stack of blurs, keys and masks.
229+ Effects,
230+ /// The stopwatch on the transform card's placement: a key on the playhead
231+ /// holding what the clip shows there, or the one that is there taken off.
232+ KeyPlacement,
233+ /// [`ActionId::KeyPlacement`] for the opacity.
234+ KeyOpacity,
235+ /// [`ActionId::KeyPlacement`] for the grade, on the colour card.
236+ KeyColor,
237+ /// Steps the easing of the key on the playhead: linear, ease in, ease out,
238+ /// ease in-out, hold.
239+ KeyEasing,
131 Fit,240 Fit,
132 Resolution,241 Resolution,
133 ZoomIn,242 ZoomIn,
134 ZoomOut,243 ZoomOut,
135 ZoomFit,244 ZoomFit,
245+ /// Fits the timeline view to the selected clips' span, with a small margin.
246+ ZoomToSelection,
247+ /// Every track to Small height (the Timeline menu's "All tracks" rows; a lane's own
248+ /// header menu sets one track, see `oracle::lane_items`).
249+ TrackSmall,
250+ /// Every track to Medium height, the height a track starts at.
251+ TrackMedium,
252+ /// Every track to Large height, for thumbnails and waveforms in full.
253+ TrackLarge,
254+ /// Every track one size shorter, from its own size.
255+ TracksSmaller,
256+ /// Every track one size taller, from its own size.
257+ TracksLarger,
258+ /// The viewer's zoom list: Fit, 25, 50, 100, 200%. View state, saved with the project's view.
259+ ViewZoom,
260+ /// The viewer's playback quality list: Full, Half, Quarter.
261+ PlaybackQuality,
262+ /// Safe-area rectangles and centre cross over the picture.
263+ GuideStyle,
264+ /// The aspect mask list: none, 9:16, 1:1, 4:5.
265+ GuideMask,
136 Undo,266 Undo,
137 Redo,267 Redo,
268+ /// Edit > History: the card that lists the undo steps and jumps to any of them.
269+ History,
138 AddVideoLane,270 AddVideoLane,
139 AddAudioLane,271 AddAudioLane,
140 RemoveVideoLane,272 RemoveVideoLane,
@@ -146,22 +278,100 @@ actions! {
146 /// track to that list places nothing -- the pair above it is what makes the278 /// track to that list places nothing -- the pair above it is what makes the
147 /// timeline row a caption can land on.279 /// timeline row a caption can land on.
148 ImportSubtitles,280 ImportSubtitles,
149- /// The dock's own `Add files` verb (MOCK-SPEC "Dock" IMPORT section):281+ /// The dock's own `Import media` verb (MOCK-SPEC "Dock" IMPORT section):
150 /// the file chooser, same door [`crate::Player::pick_and_import`] and a282 /// the file chooser, same door [`crate::Player::pick_and_import`] and a
151 /// drop on the window already use.283 /// drop on the window already use.
152 AddFiles,284 AddFiles,
153 /// The dock's `Paste path` verb: imports whatever file the OS clipboard285 /// The dock's `Paste path` verb: imports whatever file the OS clipboard
154 /// names ([`crate::Player::paste_file_path`]).286 /// names ([`crate::Player::paste_file_path`]).
155 PasteFilePath,287 PasteFilePath,
288+ /// File > Open project…: asks for a `.edith` project and opens it, with the
289+ /// same unsaved-changes question a recent project asks ([`crate::Player::pick_open_project`]).
290+ /// The welcome screen's Open project button is the same door.
291+ OpenProject,
156 ToggleMute,292 ToggleMute,
157 VolumeUp,293 VolumeUp,
158 VolumeDown,294 VolumeDown,
159 Equalizer,295 Equalizer,
160 Speed,296 Speed,
297+ /// The speed card's ramp shapes, laid across the clip the card would open on
298+ /// without opening it ([`crate::audio_cards::RampPreset`]): real time easing
299+ /// up to double...
300+ SpeedRampUp,
301+ /// ...double easing down to real time...
302+ SpeedRampDown,
303+ /// ...slow-fast-slow, the classic speed ramp...
304+ SpeedRampSlowFastSlow,
305+ /// ...and fast-slow-fast, the hero shot.
306+ SpeedRampFastSlowFast,
307+ /// Puts a key on the clip's speed ramp at the playhead, at the speed the ramp
308+ /// runs there.
309+ SpeedRampKey,
310+ /// Takes the clip's speed ramp off, back to its constant speed.
311+ SpeedRampClear,
161 Silence,312 Silence,
313+ /// The Tools card on Normalize: the mix (or each track) to a loudness target, the true peak
314+ /// held under a ceiling ([`engine::normalize`]).
315+ Normalize,
316+ /// The Tools card on Captions: listen to the sound, put the words on a caption track.
317+ Captions,
318+ /// The Tools card on Fillers: the ums and uhs found, checked, cut out as one step.
319+ Fillers,
320+ /// Cuts the words picked in the transcript out of every lane, closing the hole: one undo
321+ /// step. The transcript's own Cut button and the Delete key there do the same.
322+ CutSelectedWords,
323+ /// The Tools card on Voiceover: text spoken by piper and placed at the playhead.
324+ Voiceover,
325+ /// Timeline > Record voice-over: records from the audio input onto an audio lane at the
326+ /// playhead, as one undo step. Menu and palette only.
327+ RecordVoiceover,
162 /// Paints a sliding waveform of this audio clip onto a video lane, so the328 /// Paints a sliding waveform of this audio clip onto a video lane, so the
163 /// sound is a picture on the same timeline — preview and export both.329 /// sound is a picture on the same timeline — preview and export both.
164 Visualizer,330 Visualizer,
331+ /// Listens to a sound clip for its beat and marks the beats as comment markers.
332+ MarkBeats,
333+ Reframe,
334+ TrackMask,
335+ /// Folds the selected clips (and their linked partners) into a new sequence and leaves
336+ /// one compound clip where they were ([`engine::Project::nest`]).
337+ NestClips,
338+ /// Puts a compound clip's contents back on the timeline ([`engine::Project::break_apart`]).
339+ BreakApart,
340+ /// Opens the selected compound clip's sequence for editing.
341+ OpenCompound,
342+ /// Back to the sequence the compound clip was opened from.
343+ CloseCompound,
344+ /// A new empty sequence, opened.
345+ NewSequence,
346+ /// A copy of the sequence being edited, opened.
347+ DuplicateSequence,
348+ /// Retypes the open sequence's name on its tab.
349+ RenameSequence,
350+ /// Deletes the open sequence (never the last, never one a compound clip plays).
351+ DeleteSequence,
352+ /// Makes a multicam clip of the media selected in the library, synced by their sound
353+ /// ([`engine::PlaybackSession::make_multicam_at`]).
354+ CreateMulticam,
355+ /// Replaces the multicam clip with the plain camera clips it plays.
356+ FlattenMulticam,
357+ /// Shows or hides the angle monitor beside the picture: a grid of the multicam clip's angles
358+ /// at the playhead, each one a button that switches the picture to it.
359+ ToggleAngleMonitor,
360+ ToggleOutputWindow,
361+ OutputDisplay,
362+ /// Switches the multicam clip under the playhead to angle 1..9 from the playhead on (a razor
363+ /// cut and the new angle on the right half, one undo step). Live while the angle monitor is.
364+ Angle1,
365+ Angle2,
366+ Angle3,
367+ Angle4,
368+ Angle5,
369+ Angle6,
370+ Angle7,
371+ Angle8,
372+ Angle9,
373+ /// Retypes a track's name on its head (the track's right-click menu; double-click too).
374+ RenameLane,
165 /// Crossfades the selected audio clip into its neighbour ([`Project::crossfade`]):375 /// Crossfades the selected audio clip into its neighbour ([`Project::crossfade`]):
166 /// two adjacent clips picked on one lane, or a single pick faded into the376 /// two adjacent clips picked on one lane, or a single pick faded into the
167 /// clip right after it.377 /// clip right after it.
@@ -188,14 +398,115 @@ actions! {
188 TrimInToPlayhead,398 TrimInToPlayhead,
189 /// The pair's other half, the subject cut's out point, on `ctrl+}`.399 /// The pair's other half, the subject cut's out point, on `ctrl+}`.
190 TrimOutToPlayhead,400 TrimOutToPlayhead,
401+ /// The ripple version of [`ActionId::TrimInToPlayhead`], on `q`: the same edge moves to the
402+ /// playhead, and the hole it leaves closes so the clips after it move up (Premiere's ripple trim).
403+ RippleTrimInToPlayhead,
404+ /// The ripple version of [`ActionId::TrimOutToPlayhead`], on `w`: the out point moves to the
405+ /// playhead and what follows moves with it.
406+ RippleTrimOutToPlayhead,
407+ /// **Roll**: moves the cut after the subject clip one frame earlier,
408+ /// the clip's out point and its neighbour's in point together, so the
409+ /// timeline keeps its length ([`Project::roll`]). The pointer's version
410+ /// is shift-drag on a clip edge.
411+ RollBack,
412+ /// Roll's other direction: the cut one frame later.
413+ RollForward,
414+ /// **Slip**: the subject clip shows one frame earlier of its source,
415+ /// keeping its place and length ([`Project::slip`]). The pointer's
416+ /// version is shift-drag on the clip.
417+ SlipBack,
418+ /// Slip's other direction: one frame later of the source.
419+ SlipForward,
420+ /// **Slide**: the subject clip moves one frame earlier between its
421+ /// neighbours, which give and take the frame ([`Project::slide`]). The
422+ /// pointer's version is shift+alt-drag on the clip.
423+ SlideBack,
424+ /// Slide's other direction: one frame later.
425+ SlideForward,
191 /// Dissolves the selected video clip into its neighbour426 /// Dissolves the selected video clip into its neighbour
192 /// ([`Project::set_transition_out`]): two adjacent clips picked on one427 /// ([`Project::set_transition_out`]): two adjacent clips picked on one
193 /// lane, or a single pick dissolved into the clip right after it. A428 /// lane, or a single pick dissolved into the clip right after it. A
194 /// second press on a clip that already dissolves removes it instead.429 /// second press on a clip that already dissolves removes it instead.
195 Dissolve,430 Dissolve,
431+ /// The `Transition*` family sets how the selected video clip's join with
432+ /// its neighbour is drawn ([`engine::transitions::TransitionKind`]), making
433+ /// the join (one second) if the clip has none: the command palette's door
434+ /// to the picker the Clip tab shows. Unbound by default.
435+ TransitionDissolve,
436+ TransitionDipBlack,
437+ TransitionDipWhite,
438+ TransitionWipeLeft,
439+ TransitionWipeRight,
440+ TransitionWipeUp,
441+ TransitionWipeDown,
442+ TransitionSlideLeft,
443+ TransitionSlideRight,
444+ TransitionSlideUp,
445+ TransitionSlideDown,
446+ TransitionPushLeft,
447+ TransitionPushRight,
448+ TransitionPushUp,
449+ TransitionPushDown,
450+ TransitionZoom,
451+ /// Plays the selected clip (and its group) backward, or forward again
452+ /// ([`engine::PlaybackSession::set_reverse`]): picture and sound, composing
453+ /// with the clip's rate. Menu, palette and `ctrl+alt+r`.
454+ Reverse,
455+ /// Switches the selected clip on or off ([`engine::PlaybackSession::set_enabled`]): a
456+ /// switched-off clip stays on the timeline, drawn dimmed, and is skipped by picture and sound.
457+ ClipEnabled,
458+ /// Opens the colour label list for the selected clip ([`engine::project::LABELS`]).
459+ ClipLabel,
460+ /// Puts a solid colour, a gradient, a countdown, colour bars or an adjustment layer on the
461+ /// timeline at the playhead ([`engine::generate`]): a clip with no file behind it.
462+ NewSolid,
463+ NewGradient,
464+ NewCountdown,
465+ NewBars,
466+ /// A 1 kHz test tone on an audio lane (File > New > Tone).
467+ NewTone,
468+ /// Colour bars on V and a tone on A, linked (File > New > Bars and tone).
469+ NewBarsAndTone,
470+ NewAdjustment,
471+ NewRectangle,
472+ NewEllipse,
473+ NewLine,
474+ NewArrow,
475+ /// A title card at the playhead, opened for typing ([`Player::new_title`]).
476+ NewTitle,
477+ /// Makes a bin in the media library, named in place ([`Player::new_bin`]); the picked media go in it.
478+ NewBin,
479+ /// Makes a bin inside the bin picked in the media library (one level of nesting).
480+ NewBinInside,
481+ /// Retypes the name of the bin picked in the media library.
482+ RenameBin,
483+ /// Removes the bin picked in the media library; what it held stays, one level up.
484+ RemoveBin,
485+ /// Stars or unstars the picked media ([`Player::toggle_favourite`]).
486+ ToggleFavourite,
487+ /// Opens the list of bins to file the picked media in.
488+ MoveToBin,
489+ /// The media list shows only the starred sources.
490+ ShowFavourites,
491+ /// The media list shows every source.
492+ ShowAllMedia,
196 Mix,493 Mix,
494+ /// One-click voice cleanup of the audio track the selection (or the mix
495+ /// card) names: gate, noise reduction, compressor and de-esser at medium
496+ /// strength, one undo step ([`engine::voice`]).
497+ CleanVoice,
498+ /// The mix card with the picked track's dynamics section unfolded.
499+ VoiceDynamics,
197 ToggleSnap,500 ToggleSnap,
198 ToggleSubtitles,501 ToggleSubtitles,
502+ /// Draws the audio clips' waveforms, or leaves them as flat bars with their names.
503+ ToggleWaveforms,
504+ ToggleScrubAudio,
505+ CompareOff,
506+ CompareSplit,
507+ CompareSide,
508+ AutoColour,
509+ SaveLook,
199 /// Cut on the stand-ins or on the films themselves510 /// Cut on the stand-ins or on the films themselves
200 /// ([`engine::proxy`]): what the picture is decoded from, and nothing511 /// ([`engine::proxy`]): what the picture is decoded from, and nothing
201 /// else -- the sound and every export stay the film's whichever way it512 /// else -- the sound and every export stay the film's whichever way it
@@ -211,6 +522,9 @@ actions! {
211 /// toolbar's Theme button. It was a build feature once, which made it a522 /// toolbar's Theme button. It was a build feature once, which made it a
212 /// choice only whoever compiled the binary could make.523 /// choice only whoever compiled the binary could make.
213 Theme,524 Theme,
525+ /// The accent colour the window is painted with, as a list beside the Theme one: kept
526+ /// for every project like the theme, so it belongs to the person and not to the timeline.
527+ AccentColour,
214 /// The whole window, borderless over the screen: a player's own control,528 /// The whole window, borderless over the screen: a player's own control,
215 /// on the platform's own toggle ([`gpui::Window::toggle_fullscreen`]).529 /// on the platform's own toggle ([`gpui::Window::toggle_fullscreen`]).
216 Fullscreen,530 Fullscreen,
@@ -219,6 +533,12 @@ actions! {
219 /// its own, because a card reachable only by a button in the panel is one a533 /// its own, because a card reachable only by a button in the panel is one a
220 /// hand on the keyboard has to leave the keyboard for.534 /// hand on the keyboard has to leave the keyboard for.
221 ShowActions,535 ShowActions,
536+ /// The shortcuts sheet (DESIGN.md §10.2's `?` and F1): swings the dock to
537+ /// its KEYS tab, and a second press swings it back. Its own action, not
538+ /// [`ActionId::ShowActions`], which is the command search's door.
539+ ShowKeys,
540+ /// The About dialog: name, version and what edith is. Opens from Help.
541+ About,
222 /// Saves the frame on screen to a PNG: whatever is showing, the timeline's542 /// Saves the frame on screen to a PNG: whatever is showing, the timeline's
223 /// own picture or a library preview's, since both write through the one543 /// own picture or a library preview's, since both write through the one
224 /// `self.image` the atlas already holds.544 /// `self.image` the atlas already holds.
@@ -239,40 +559,131 @@ actions! {
239 /// (`ui::stance`'s Tab/Shift-Tab ring), which nothing else in the app559 /// (`ui::stance`'s Tab/Shift-Tab ring), which nothing else in the app
240 /// opens. Bare Tab stays [`ActionId::Select`] at the root the whole time560 /// opens. Bare Tab stays [`ActionId::Select`] at the root the whole time
241 /// -- this only starts the ring, it never steals the clip-selection key.561 /// -- this only starts the ring, it never steals the clip-selection key.
562+ /// Closes the gap under the playhead (or the picked one): everything after it on the track, and on its linked take, moves up. One undo step.
563+ CloseGap,
564+ /// Holds the frame under the playhead as a still of the default length, pushing the rest later.
565+ Freeze,
566+ /// Pastes the copied clip's colour, effects, transform, speed and sound onto the selected clips.
567+ PasteAttributes,
568+ /// The copied clip's grade onto the selected clips.
569+ PasteColor,
570+ /// The copied clip's effect stack onto the selected clips.
571+ PasteEffects,
572+ /// The copied clip's placement, size and fit onto the selected clips.
573+ PasteTransform,
574+ /// The copied clip's rate, ramp and direction onto the selected clips.
575+ PasteSpeed,
576+ /// The copied clip's gain and equalizer onto the selected clips.
577+ PasteAudio,
578+ /// Opens the source of the clip under the playhead in the library preview, parked on the frame the playhead shows.
579+ MatchFrame,
580+ /// Replaces the clip under the playhead with the selected library item, keeping its place and duration.
581+ ReplaceEdit,
582+ /// Selects every clip from the playhead onward on the selected clip's track.
583+ SelectForward,
584+ /// Selects every clip from the playhead onward on every track.
585+ SelectForwardAll,
586+ /// Split edit: moves the audio edge of the take to the playhead, the picture's staying put (an L-cut after the cut, a J-cut before).
587+ ExtendAudio,
588+ /// Split edit: moves the picture edge of the take to the playhead, the sound's staying put.
589+ ExtendVideo,
590+ /// Moves the selected clips one frame earlier.
591+ NudgeBack,
592+ /// Moves the selected clips one frame later.
593+ NudgeForward,
594+ /// Moves the selected clips ten frames earlier.
595+ NudgeBack10,
596+ /// Moves the selected clips ten frames later.
597+ NudgeForward10,
242 FocusPanels,598 FocusPanels,
243 }599 }
244 600
245 impl ActionId {601 impl ActionId {
602+ /// The transition kind a `Transition*` action sets.
603+ pub fn transition_kind(self) -> Option<engine::transitions::TransitionKind> {
604+ use engine::transitions::{Dir, TransitionKind};
605+ Some(match self {
606+ ActionId::TransitionDissolve => TransitionKind::Dissolve,
607+ ActionId::TransitionDipBlack => TransitionKind::DipBlack,
608+ ActionId::TransitionDipWhite => TransitionKind::DipWhite,
609+ ActionId::TransitionWipeLeft => TransitionKind::Wipe(Dir::Left),
610+ ActionId::TransitionWipeRight => TransitionKind::Wipe(Dir::Right),
611+ ActionId::TransitionWipeUp => TransitionKind::Wipe(Dir::Up),
612+ ActionId::TransitionWipeDown => TransitionKind::Wipe(Dir::Down),
613+ ActionId::TransitionSlideLeft => TransitionKind::Slide(Dir::Left),
614+ ActionId::TransitionSlideRight => TransitionKind::Slide(Dir::Right),
615+ ActionId::TransitionSlideUp => TransitionKind::Slide(Dir::Up),
616+ ActionId::TransitionSlideDown => TransitionKind::Slide(Dir::Down),
617+ ActionId::TransitionPushLeft => TransitionKind::Push(Dir::Left),
618+ ActionId::TransitionPushRight => TransitionKind::Push(Dir::Right),
619+ ActionId::TransitionPushUp => TransitionKind::Push(Dir::Up),
620+ ActionId::TransitionPushDown => TransitionKind::Push(Dir::Down),
621+ ActionId::TransitionZoom => TransitionKind::Zoom,
622+ _ => return None,
623+ })
624+ }
625+
246 /// What a person calls it.626 /// What a person calls it.
247 pub fn label(self) -> &'static str {627 pub fn label(self) -> &'static str {
248 match self {628 match self {
249 ActionId::Play => "Play / Pause",629 ActionId::Play => "Play / Pause",
250 ActionId::Loop => "Loop playback",630 ActionId::Loop => "Loop playback",
631+ ActionId::PlayAround => "Play around playhead",
251 ActionId::StepBack => "One frame back",632 ActionId::StepBack => "One frame back",
252 ActionId::StepForward => "One frame forward",633 ActionId::StepForward => "One frame forward",
253 ActionId::JumpBack => "One second back",634 ActionId::JumpBack => "One second back",
254 ActionId::JumpForward => "One second forward",635 ActionId::JumpForward => "One second forward",
255 ActionId::GoStart => "Go to start",636 ActionId::GoStart => "Go to start",
256 ActionId::GoEnd => "Go to end",637 ActionId::GoEnd => "Go to end",
638+ ActionId::GoToTime => "Go to time\u{2026}",
257 ActionId::PrevSyncPoint => "Previous sync point",639 ActionId::PrevSyncPoint => "Previous sync point",
258 ActionId::NextSyncPoint => "Next sync point",640 ActionId::NextSyncPoint => "Next sync point",
259 ActionId::WalkCutNext => "Next cut",641 ActionId::WalkCutNext => "Next cut",
260 ActionId::WalkCutPrev => "Previous cut",642 ActionId::WalkCutPrev => "Previous cut",
261- ActionId::WalkCutNext10 => "Forward ten cuts",643+ ActionId::WalkCutNext10 => "Jump 10 cuts forward",
262- ActionId::WalkCutPrev10 => "Back ten cuts",644+ ActionId::WalkCutPrev10 => "Jump 10 cuts back",
645+ ActionId::AddMarker => "Add marker",
646+ ActionId::MarkerHere => "Add marker here",
647+ ActionId::RenameMarker => "Rename marker\u{2026}",
648+ ActionId::DeleteMarker => "Delete marker",
649+ ActionId::PlayheadHere => "Move playhead here",
650+ ActionId::NextMarker => "Next marker",
651+ ActionId::PrevMarker => "Previous marker",
652+ ActionId::Markers => "Markers…",
263 ActionId::SetIn => "Mark in",653 ActionId::SetIn => "Mark in",
264 ActionId::SetOut => "Mark out",654 ActionId::SetOut => "Mark out",
265 ActionId::ClearRange => "Clear range",655 ActionId::ClearRange => "Clear range",
656+ ActionId::RenderInOut => "Render in to out",
657+ ActionId::RenderAll => "Render whole timeline",
658+ ActionId::CancelRender => "Cancel render",
659+ ActionId::DeleteRenderFiles => "Delete render files",
660+ ActionId::ShuttleBack => "Shuttle back",
661+ ActionId::ShuttleStop => "Pause shuttle",
662+ ActionId::ShuttleForward => "Shuttle forward",
266 ActionId::Export => "Export",663 ActionId::Export => "Export",
267 ActionId::Save => "Save",664 ActionId::Save => "Save",
665+ ActionId::ReloadProject => "Reload project from disk",
666+ ActionId::NewProject => "New project…",
667+ ActionId::SaveVersion => "Save version…",
668+ ActionId::SaveTemplate => "Save as template…",
669+ ActionId::ExportCaptions => "Export captions…",
670+ ActionId::Versions => "Versions…",
671+ ActionId::CollectMedia => "Collect media…",
672+ ActionId::ProjectNotes => "Project notes…",
673+ ActionId::ExportTimelineOtio => "OpenTimelineIO…",
674+ ActionId::ExportTimelineFcpxml => "Final Cut Pro XML…",
675+ ActionId::ExportTimelineEdl => "EDL…",
676+ ActionId::ImportTimelineOtio => "Import OpenTimelineIO…",
268 ActionId::Copy => "Copy",677 ActionId::Copy => "Copy",
269 ActionId::Paste => "Paste",678 ActionId::Paste => "Paste",
270- ActionId::Cut => "Cut",679+ ActionId::InsertSource => "Insert source at playhead",
271- ActionId::Regroup => "Regroup",680+ ActionId::OverwriteSource => "Overwrite source at playhead",
681+ ActionId::Cut => "Split",
682+ ActionId::Regroup => "Join clips back",
272 // Neither half's action: it takes the *pair* apart, and the menu683 // Neither half's action: it takes the *pair* apart, and the menu
273 // that offers it hangs on whichever half was right-clicked -- worded684 // that offers it hangs on whichever half was right-clicked -- worded
274 // from the picture's side it read as a video item on an audio clip.685 // from the picture's side it read as a video item on an audio clip.
275- ActionId::Detach => "Ungroup",686+ ActionId::Detach => "Unlink audio and video",
276 ActionId::Group => "Group",687 ActionId::Group => "Group",
277 ActionId::Select => "Select clip at playhead",688 ActionId::Select => "Select clip at playhead",
278 ActionId::SelectNext => "Select next clip",689 ActionId::SelectNext => "Select next clip",
@@ -283,13 +694,29 @@ impl ActionId {
283 ActionId::Lift => "Lift",694 ActionId::Lift => "Lift",
284 ActionId::Color => "Colour…",695 ActionId::Color => "Colour…",
285 ActionId::Transform => "Transform…",696 ActionId::Transform => "Transform…",
286- ActionId::Fit => "Fit policy",697+ ActionId::Effects => "Effects…",
287- ActionId::Resolution => "Project resolution",698+ ActionId::KeyPlacement => "Add position key here",
699+ ActionId::KeyOpacity => "Add opacity key here",
700+ ActionId::KeyColor => "Add colour key here",
701+ ActionId::KeyEasing => "Key easing…",
702+ ActionId::Fit => "Fit to frame…",
703+ ActionId::Resolution => "Project resolution…",
288 ActionId::ZoomIn => "Zoom in",704 ActionId::ZoomIn => "Zoom in",
289 ActionId::ZoomOut => "Zoom out",705 ActionId::ZoomOut => "Zoom out",
290 ActionId::ZoomFit => "Fit timeline",706 ActionId::ZoomFit => "Fit timeline",
707+ ActionId::ZoomToSelection => "Zoom to selection",
708+ ActionId::TrackSmall => "All tracks: Small",
709+ ActionId::TrackMedium => "All tracks: Medium",
710+ ActionId::TrackLarge => "All tracks: Large",
711+ ActionId::TracksSmaller => "Make tracks smaller",
712+ ActionId::TracksLarger => "Make tracks larger",
713+ ActionId::ViewZoom => "Viewer zoom…",
714+ ActionId::PlaybackQuality => "Playback quality…",
715+ ActionId::GuideStyle => "Guides…",
716+ ActionId::GuideMask => "Frame mask…",
291 ActionId::Undo => "Undo",717 ActionId::Undo => "Undo",
292 ActionId::Redo => "Redo",718 ActionId::Redo => "Redo",
719+ ActionId::History => "History…",
293 ActionId::AddVideoLane => "Add video track",720 ActionId::AddVideoLane => "Add video track",
294 ActionId::AddAudioLane => "Add audio track",721 ActionId::AddAudioLane => "Add audio track",
295 ActionId::RemoveVideoLane => "Remove video track",722 ActionId::RemoveVideoLane => "Remove video track",
@@ -297,35 +724,151 @@ impl ActionId {
297 ActionId::AddSubtitleLane => "Add subtitle track",724 ActionId::AddSubtitleLane => "Add subtitle track",
298 ActionId::RemoveSubtitleLane => "Remove subtitle track",725 ActionId::RemoveSubtitleLane => "Remove subtitle track",
299 ActionId::ImportSubtitles => "Add subtitles…",726 ActionId::ImportSubtitles => "Add subtitles…",
300- ActionId::AddFiles => "Add files…",727+ ActionId::AddFiles => "Import media…",
728+ ActionId::OpenProject => "Open project…",
301 ActionId::PasteFilePath => "Paste path",729 ActionId::PasteFilePath => "Paste path",
302 ActionId::ToggleMute => "Mute / Unmute",730 ActionId::ToggleMute => "Mute / Unmute",
303 ActionId::VolumeUp => "Volume up",731 ActionId::VolumeUp => "Volume up",
304 ActionId::VolumeDown => "Volume down",732 ActionId::VolumeDown => "Volume down",
305- ActionId::Equalizer => "Equalizer",733+ ActionId::Equalizer => "Equalizer…",
306 ActionId::Speed => "Speed…",734 ActionId::Speed => "Speed…",
735+ ActionId::SpeedRampUp => "Speed ramp up",
736+ ActionId::SpeedRampDown => "Speed ramp down",
737+ ActionId::SpeedRampSlowFastSlow => "Speed ramp slow-fast-slow",
738+ ActionId::SpeedRampFastSlowFast => "Speed ramp fast-slow-fast",
739+ ActionId::SpeedRampKey => "Add speed key here",
740+ ActionId::SpeedRampClear => "Clear speed ramp",
307 ActionId::Silence => "Silences…",741 ActionId::Silence => "Silences…",
742+ ActionId::MarkBeats => "Mark the beats…",
743+ ActionId::Normalize => "Normalize loudness…",
744+ ActionId::Captions => "Generate captions",
745+ ActionId::Fillers => "Remove fillers…",
746+ ActionId::CutSelectedWords => "Cut selected words",
747+ ActionId::Voiceover => "Voiceover from text…",
748+ ActionId::RecordVoiceover => "Record voice-over…",
308 ActionId::Visualizer => "Create visualizer",749 ActionId::Visualizer => "Create visualizer",
309- ActionId::Crossfade => "Crossfade to next",750+ ActionId::Reframe => "Auto reframe",
751+ ActionId::TrackMask => "Track mask",
752+ ActionId::NestClips => "Nest into compound clip",
753+ ActionId::BreakApart => "Break apart compound clip",
754+ ActionId::OpenCompound => "Open compound clip",
755+ ActionId::CloseCompound => "Back to parent sequence",
756+ ActionId::NewBin => "New bin",
757+ ActionId::NewBinInside => "New bin inside",
758+ ActionId::RenameBin => "Rename bin",
759+ ActionId::RemoveBin => "Remove bin",
760+ ActionId::ToggleFavourite => "Favourite media",
761+ ActionId::MoveToBin => "Move media to bin…",
762+ ActionId::ShowFavourites => "Show favourite media",
763+ ActionId::ShowAllMedia => "Show all media",
764+ ActionId::NewSequence => "New sequence",
765+ ActionId::DuplicateSequence => "Duplicate sequence",
766+ ActionId::RenameSequence => "Rename sequence",
767+ ActionId::DeleteSequence => "Delete sequence",
768+ ActionId::CreateMulticam => "Create multicam from media…",
769+ ActionId::FlattenMulticam => "Flatten multicam clip",
770+ ActionId::ToggleAngleMonitor => "Angle monitor",
771+ ActionId::ToggleOutputWindow => "Video output window",
772+ ActionId::OutputDisplay => "Output display…",
773+ ActionId::Angle1 => "Switch to angle 1–9",
774+ ActionId::Angle2 => "Switch to angle 2",
775+ ActionId::Angle3 => "Switch to angle 3",
776+ ActionId::Angle4 => "Switch to angle 4",
777+ ActionId::Angle5 => "Switch to angle 5",
778+ ActionId::Angle6 => "Switch to angle 6",
779+ ActionId::Angle7 => "Switch to angle 7",
780+ ActionId::Angle8 => "Switch to angle 8",
781+ ActionId::Angle9 => "Switch to angle 9",
782+ ActionId::RenameLane => "Rename track",
783+ ActionId::Crossfade => "Crossfade audio",
310 ActionId::TrimIn => "Trim in",784 ActionId::TrimIn => "Trim in",
311 ActionId::TrimOut => "Trim out",785 ActionId::TrimOut => "Trim out",
312- ActionId::LoopTrim => "Loop-trim",786+ ActionId::LoopTrim => "Loop while trimming",
313- ActionId::TrimInToPlayhead => "Trim in to playhead",787+ ActionId::TrimInToPlayhead => "Trim start to playhead",
314- ActionId::TrimOutToPlayhead => "Trim out to playhead",788+ ActionId::TrimOutToPlayhead => "Trim end to playhead",
315- ActionId::Dissolve => "Dissolve to next",789+ ActionId::RippleTrimInToPlayhead => "Ripple start to playhead",
790+ ActionId::RippleTrimOutToPlayhead => "Ripple end to playhead",
791+ ActionId::RollBack => "Move cut earlier",
792+ ActionId::RollForward => "Move cut later",
793+ ActionId::SlipBack => "Slip back",
794+ ActionId::SlipForward => "Slip forward",
795+ ActionId::SlideBack => "Slide back",
796+ ActionId::SlideForward => "Slide forward",
797+ ActionId::Dissolve => "Dissolve",
798+ ActionId::TransitionDissolve => "Dissolve at a cut",
799+ ActionId::TransitionDipBlack => "Dip to black",
800+ ActionId::TransitionDipWhite => "Dip to white",
801+ ActionId::TransitionWipeLeft => "Wipe left",
802+ ActionId::TransitionWipeRight => "Wipe right",
803+ ActionId::TransitionWipeUp => "Wipe up",
804+ ActionId::TransitionWipeDown => "Wipe down",
805+ ActionId::TransitionSlideLeft => "Slide left",
806+ ActionId::TransitionSlideRight => "Slide right",
807+ ActionId::TransitionSlideUp => "Slide up",
808+ ActionId::TransitionSlideDown => "Slide down",
809+ ActionId::TransitionPushLeft => "Push left",
810+ ActionId::TransitionPushRight => "Push right",
811+ ActionId::TransitionPushUp => "Push up",
812+ ActionId::TransitionPushDown => "Push down",
813+ ActionId::TransitionZoom => "Zoom",
814+ ActionId::Reverse => "Reverse clip",
815+ ActionId::ClipEnabled => "Enabled",
816+ ActionId::ClipLabel => "Label",
817+ ActionId::NewSolid => "Solid colour",
818+ ActionId::NewGradient => "Gradient",
819+ ActionId::NewCountdown => "Countdown",
820+ ActionId::NewBars => "Colour bars",
821+ ActionId::NewTone => "Tone",
822+ ActionId::NewBarsAndTone => "Bars and tone",
823+ ActionId::NewAdjustment => "Adjustment layer",
824+ ActionId::NewRectangle => "Rectangle shape",
825+ ActionId::NewEllipse => "Ellipse shape",
826+ ActionId::NewLine => "Line shape",
827+ ActionId::NewArrow => "Arrow shape",
828+ ActionId::NewTitle => "Add title",
316 ActionId::Mix => "Mix…",829 ActionId::Mix => "Mix…",
830+ ActionId::CleanVoice => "Clean voice",
831+ ActionId::VoiceDynamics => "Voice dynamics…",
317 ActionId::ToggleSnap => "Snap",832 ActionId::ToggleSnap => "Snap",
318 ActionId::ToggleSubtitles => "Subtitles",833 ActionId::ToggleSubtitles => "Subtitles",
319- ActionId::ToggleProxies => "Proxies",834+ ActionId::ToggleWaveforms => "Audio waveforms",
320- ActionId::ToggleAutoProxies => "Proxies on import",835+ ActionId::ToggleScrubAudio => "Audio scrubbing",
836+ ActionId::CompareOff => "Compare: off",
837+ ActionId::CompareSplit => "Compare: split",
838+ ActionId::CompareSide => "Compare: side by side",
839+ ActionId::AutoColour => "Auto colour",
840+ ActionId::SaveLook => "Save colour as look\u{2026}",
841+ ActionId::ToggleProxies => "Use editing copies",
842+ ActionId::ToggleAutoProxies => "Editing copies on import",
321 ActionId::Theme => "Theme…",843 ActionId::Theme => "Theme…",
844+ ActionId::AccentColour => "Accent colour…",
322 ActionId::Fullscreen => "Fullscreen",845 ActionId::Fullscreen => "Fullscreen",
323 ActionId::CancelExport => "Cancel export",846 ActionId::CancelExport => "Cancel export",
324- ActionId::ShowActions => "All actions…",847+ ActionId::ShowActions => "Search commands…",
848+ ActionId::ShowKeys => "Keyboard shortcuts",
849+ ActionId::About => "About edith…",
325 ActionId::Screenshot => "Save frame as PNG",850 ActionId::Screenshot => "Save frame as PNG",
326 ActionId::SubtitleStyle => "Subtitle style…",851 ActionId::SubtitleStyle => "Subtitle style…",
327 ActionId::Settings => "Settings…",852 ActionId::Settings => "Settings…",
328- ActionId::FocusPanels => "Focus panels",853+ ActionId::CloseGap => "Close gap",
854+ ActionId::Freeze => "Freeze frame",
855+ ActionId::PasteAttributes => "Paste all attributes",
856+ ActionId::PasteColor => "Paste colour",
857+ ActionId::PasteEffects => "Paste effects",
858+ ActionId::PasteTransform => "Paste transform",
859+ ActionId::PasteSpeed => "Paste speed",
860+ ActionId::PasteAudio => "Paste audio",
861+ ActionId::MatchFrame => "Match frame",
862+ ActionId::ReplaceEdit => "Replace edit",
863+ ActionId::SelectForward => "Select track forward",
864+ ActionId::SelectForwardAll => "Select all tracks forward",
865+ ActionId::ExtendAudio => "Extend audio to playhead",
866+ ActionId::ExtendVideo => "Extend video to playhead",
867+ ActionId::NudgeBack => "Nudge back",
868+ ActionId::NudgeForward => "Nudge forward",
869+ ActionId::NudgeBack10 => "Nudge back ten frames",
870+ ActionId::NudgeForward10 => "Nudge forward ten frames",
871+ ActionId::FocusPanels => "Next panel",
329 }872 }
330 }873 }
331 874
@@ -335,14 +878,24 @@ impl ActionId {
335 match self {878 match self {
336 ActionId::Play => "play",879 ActionId::Play => "play",
337 ActionId::Loop => "loop",880 ActionId::Loop => "loop",
881+ ActionId::PlayAround => "play-around",
338 ActionId::StepBack => "step-back",882 ActionId::StepBack => "step-back",
339 ActionId::StepForward => "step-forward",883 ActionId::StepForward => "step-forward",
340 ActionId::JumpBack => "jump-back",884 ActionId::JumpBack => "jump-back",
341 ActionId::JumpForward => "jump-forward",885 ActionId::JumpForward => "jump-forward",
342 ActionId::GoStart => "go-start",886 ActionId::GoStart => "go-start",
343 ActionId::GoEnd => "go-end",887 ActionId::GoEnd => "go-end",
888+ ActionId::GoToTime => "go-to-time",
344 ActionId::PrevSyncPoint => "prev-sync-point",889 ActionId::PrevSyncPoint => "prev-sync-point",
345 ActionId::NextSyncPoint => "next-sync-point",890 ActionId::NextSyncPoint => "next-sync-point",
891+ ActionId::AddMarker => "add-marker",
892+ ActionId::MarkerHere => "marker-here",
893+ ActionId::RenameMarker => "rename-marker",
894+ ActionId::DeleteMarker => "delete-marker",
895+ ActionId::PlayheadHere => "playhead-here",
896+ ActionId::NextMarker => "next-marker",
897+ ActionId::PrevMarker => "prev-marker",
898+ ActionId::Markers => "markers",
346 ActionId::WalkCutNext => "walk-cut-next",899 ActionId::WalkCutNext => "walk-cut-next",
347 ActionId::WalkCutPrev => "walk-cut-prev",900 ActionId::WalkCutPrev => "walk-cut-prev",
348 ActionId::WalkCutNext10 => "walk-cut-next-10",901 ActionId::WalkCutNext10 => "walk-cut-next-10",
@@ -350,10 +903,31 @@ impl ActionId {
350 ActionId::SetIn => "set-in",903 ActionId::SetIn => "set-in",
351 ActionId::SetOut => "set-out",904 ActionId::SetOut => "set-out",
352 ActionId::ClearRange => "clear-range",905 ActionId::ClearRange => "clear-range",
906+ ActionId::RenderInOut => "render-in-out",
907+ ActionId::RenderAll => "render-all",
908+ ActionId::CancelRender => "cancel-render",
909+ ActionId::DeleteRenderFiles => "delete-render-files",
910+ ActionId::ShuttleBack => "shuttle-back",
911+ ActionId::ShuttleStop => "shuttle-stop",
912+ ActionId::ShuttleForward => "shuttle-forward",
353 ActionId::Export => "export",913 ActionId::Export => "export",
354 ActionId::Save => "save",914 ActionId::Save => "save",
915+ ActionId::ReloadProject => "reload-project",
916+ ActionId::NewProject => "new-project",
917+ ActionId::SaveVersion => "save-version",
918+ ActionId::SaveTemplate => "save-template",
919+ ActionId::ExportCaptions => "export-captions",
920+ ActionId::Versions => "versions",
921+ ActionId::CollectMedia => "collect-media",
922+ ActionId::ProjectNotes => "project-notes",
923+ ActionId::ExportTimelineOtio => "export-timeline-otio",
924+ ActionId::ExportTimelineFcpxml => "export-timeline-fcpxml",
925+ ActionId::ExportTimelineEdl => "export-timeline-edl",
926+ ActionId::ImportTimelineOtio => "import-timeline-otio",
355 ActionId::Copy => "copy",927 ActionId::Copy => "copy",
356 ActionId::Paste => "paste",928 ActionId::Paste => "paste",
929+ ActionId::InsertSource => "insert-source",
930+ ActionId::OverwriteSource => "overwrite-source",
357 ActionId::Cut => "cut",931 ActionId::Cut => "cut",
358 ActionId::Regroup => "regroup",932 ActionId::Regroup => "regroup",
359 ActionId::Detach => "detach",933 ActionId::Detach => "detach",
@@ -367,13 +941,29 @@ impl ActionId {
367 ActionId::Lift => "lift",941 ActionId::Lift => "lift",
368 ActionId::Color => "color",942 ActionId::Color => "color",
369 ActionId::Transform => "transform",943 ActionId::Transform => "transform",
944+ ActionId::Effects => "effects",
945+ ActionId::KeyPlacement => "key-placement",
946+ ActionId::KeyOpacity => "key-opacity",
947+ ActionId::KeyColor => "key-color",
948+ ActionId::KeyEasing => "key-easing",
370 ActionId::Fit => "fit",949 ActionId::Fit => "fit",
371 ActionId::Resolution => "resolution",950 ActionId::Resolution => "resolution",
372 ActionId::ZoomIn => "zoom-in",951 ActionId::ZoomIn => "zoom-in",
373 ActionId::ZoomOut => "zoom-out",952 ActionId::ZoomOut => "zoom-out",
374 ActionId::ZoomFit => "zoom-fit",953 ActionId::ZoomFit => "zoom-fit",
954+ ActionId::ZoomToSelection => "zoom-to-selection",
955+ ActionId::TrackSmall => "track-small",
956+ ActionId::TrackMedium => "track-medium",
957+ ActionId::TrackLarge => "track-large",
958+ ActionId::TracksSmaller => "tracks-smaller",
959+ ActionId::TracksLarger => "tracks-larger",
960+ ActionId::ViewZoom => "view-zoom",
961+ ActionId::PlaybackQuality => "playback-quality",
962+ ActionId::GuideStyle => "guide-style",
963+ ActionId::GuideMask => "guide-mask",
375 ActionId::Undo => "undo",964 ActionId::Undo => "undo",
376 ActionId::Redo => "redo",965 ActionId::Redo => "redo",
966+ ActionId::History => "history",
377 ActionId::AddVideoLane => "add-video-lane",967 ActionId::AddVideoLane => "add-video-lane",
378 ActionId::AddAudioLane => "add-audio-lane",968 ActionId::AddAudioLane => "add-audio-lane",
379 ActionId::RemoveVideoLane => "remove-video-lane",969 ActionId::RemoveVideoLane => "remove-video-lane",
@@ -382,38 +972,156 @@ impl ActionId {
382 ActionId::RemoveSubtitleLane => "remove-subtitle-lane",972 ActionId::RemoveSubtitleLane => "remove-subtitle-lane",
383 ActionId::ImportSubtitles => "import-subtitles",973 ActionId::ImportSubtitles => "import-subtitles",
384 ActionId::AddFiles => "add-files",974 ActionId::AddFiles => "add-files",
975+ ActionId::OpenProject => "open-project",
385 ActionId::PasteFilePath => "paste-file-path",976 ActionId::PasteFilePath => "paste-file-path",
386 ActionId::ToggleMute => "toggle-mute",977 ActionId::ToggleMute => "toggle-mute",
387 ActionId::VolumeUp => "volume-up",978 ActionId::VolumeUp => "volume-up",
388 ActionId::VolumeDown => "volume-down",979 ActionId::VolumeDown => "volume-down",
389 ActionId::Equalizer => "equalizer",980 ActionId::Equalizer => "equalizer",
390 ActionId::Speed => "speed",981 ActionId::Speed => "speed",
982+ ActionId::SpeedRampUp => "speed-ramp-up",
983+ ActionId::SpeedRampDown => "speed-ramp-down",
984+ ActionId::SpeedRampSlowFastSlow => "speed-ramp-slow-fast-slow",
985+ ActionId::SpeedRampFastSlowFast => "speed-ramp-fast-slow-fast",
986+ ActionId::SpeedRampKey => "speed-ramp-key",
987+ ActionId::SpeedRampClear => "speed-ramp-clear",
391 ActionId::Silence => "silence",988 ActionId::Silence => "silence",
989+ ActionId::Normalize => "normalize",
990+ ActionId::Captions => "generate-captions",
991+ ActionId::Fillers => "remove-fillers",
992+ ActionId::CutSelectedWords => "cut-selected-words",
993+ ActionId::Voiceover => "voiceover",
994+ ActionId::RecordVoiceover => "record-voiceover",
392 ActionId::Visualizer => "visualizer",995 ActionId::Visualizer => "visualizer",
996+ ActionId::MarkBeats => "mark-beats",
997+ ActionId::Reframe => "reframe",
998+ ActionId::TrackMask => "track-mask",
999+ ActionId::NestClips => "nest-clips",
1000+ ActionId::BreakApart => "break-apart",
1001+ ActionId::OpenCompound => "open-compound",
1002+ ActionId::CloseCompound => "close-compound",
1003+ ActionId::NewBin => "new-bin",
1004+ ActionId::NewBinInside => "new-bin-inside",
1005+ ActionId::RenameBin => "rename-bin",
1006+ ActionId::RemoveBin => "remove-bin",
1007+ ActionId::ToggleFavourite => "toggle-favourite",
1008+ ActionId::MoveToBin => "move-to-bin",
1009+ ActionId::ShowFavourites => "show-favourites",
1010+ ActionId::ShowAllMedia => "show-all-media",
1011+ ActionId::NewSequence => "new-sequence",
1012+ ActionId::DuplicateSequence => "duplicate-sequence",
1013+ ActionId::RenameSequence => "rename-sequence",
1014+ ActionId::DeleteSequence => "delete-sequence",
1015+ ActionId::CreateMulticam => "create-multicam",
1016+ ActionId::FlattenMulticam => "flatten-multicam",
1017+ ActionId::ToggleAngleMonitor => "toggle-angle-monitor",
1018+ ActionId::ToggleOutputWindow => "toggle-output-window",
1019+ ActionId::OutputDisplay => "output-display",
1020+ ActionId::Angle1 => "angle-1",
1021+ ActionId::Angle2 => "angle-2",
1022+ ActionId::Angle3 => "angle-3",
1023+ ActionId::Angle4 => "angle-4",
1024+ ActionId::Angle5 => "angle-5",
1025+ ActionId::Angle6 => "angle-6",
1026+ ActionId::Angle7 => "angle-7",
1027+ ActionId::Angle8 => "angle-8",
1028+ ActionId::Angle9 => "angle-9",
1029+ ActionId::RenameLane => "rename-lane",
393 ActionId::Crossfade => "crossfade",1030 ActionId::Crossfade => "crossfade",
394 ActionId::TrimIn => "trim-in",1031 ActionId::TrimIn => "trim-in",
395 ActionId::TrimOut => "trim-out",1032 ActionId::TrimOut => "trim-out",
396 ActionId::LoopTrim => "loop-trim",1033 ActionId::LoopTrim => "loop-trim",
397 ActionId::TrimInToPlayhead => "trim-in-to-playhead",1034 ActionId::TrimInToPlayhead => "trim-in-to-playhead",
398 ActionId::TrimOutToPlayhead => "trim-out-to-playhead",1035 ActionId::TrimOutToPlayhead => "trim-out-to-playhead",
1036+ ActionId::RippleTrimInToPlayhead => "ripple-trim-in-to-playhead",
1037+ ActionId::RippleTrimOutToPlayhead => "ripple-trim-out-to-playhead",
1038+ ActionId::RollBack => "roll-back",
1039+ ActionId::RollForward => "roll-forward",
1040+ ActionId::SlipBack => "slip-back",
1041+ ActionId::SlipForward => "slip-forward",
1042+ ActionId::SlideBack => "slide-back",
1043+ ActionId::SlideForward => "slide-forward",
399 ActionId::Dissolve => "dissolve",1044 ActionId::Dissolve => "dissolve",
1045+ ActionId::TransitionDissolve => "transition-dissolve",
1046+ ActionId::TransitionDipBlack => "transition-dip-black",
1047+ ActionId::TransitionDipWhite => "transition-dip-white",
1048+ ActionId::TransitionWipeLeft => "transition-wipe-left",
1049+ ActionId::TransitionWipeRight => "transition-wipe-right",
1050+ ActionId::TransitionWipeUp => "transition-wipe-up",
1051+ ActionId::TransitionWipeDown => "transition-wipe-down",
1052+ ActionId::TransitionSlideLeft => "transition-slide-left",
1053+ ActionId::TransitionSlideRight => "transition-slide-right",
1054+ ActionId::TransitionSlideUp => "transition-slide-up",
1055+ ActionId::TransitionSlideDown => "transition-slide-down",
1056+ ActionId::TransitionPushLeft => "transition-push-left",
1057+ ActionId::TransitionPushRight => "transition-push-right",
1058+ ActionId::TransitionPushUp => "transition-push-up",
1059+ ActionId::TransitionPushDown => "transition-push-down",
1060+ ActionId::TransitionZoom => "transition-zoom",
1061+ ActionId::Reverse => "reverse",
1062+ ActionId::ClipEnabled => "clip-enabled",
1063+ ActionId::ClipLabel => "clip-label",
1064+ ActionId::NewSolid => "new-solid",
1065+ ActionId::NewGradient => "new-gradient",
1066+ ActionId::NewCountdown => "new-countdown",
1067+ ActionId::NewBars => "new-bars",
1068+ ActionId::NewTone => "new-tone",
1069+ ActionId::NewBarsAndTone => "new-bars-and-tone",
1070+ ActionId::NewAdjustment => "new-adjustment",
1071+ ActionId::NewRectangle => "new-rectangle",
1072+ ActionId::NewEllipse => "new-ellipse",
1073+ ActionId::NewLine => "new-line",
1074+ ActionId::NewArrow => "new-arrow",
1075+ ActionId::NewTitle => "new-title",
400 ActionId::Mix => "mix",1076 ActionId::Mix => "mix",
1077+ ActionId::CleanVoice => "clean-voice",
1078+ ActionId::VoiceDynamics => "voice-dynamics",
401 ActionId::ToggleSnap => "toggle-snap",1079 ActionId::ToggleSnap => "toggle-snap",
402 ActionId::ToggleSubtitles => "toggle-subtitles",1080 ActionId::ToggleSubtitles => "toggle-subtitles",
1081+ ActionId::ToggleWaveforms => "toggle-waveforms",
1082+ ActionId::ToggleScrubAudio => "toggle-scrub-audio",
1083+ ActionId::CompareOff => "compare-off",
1084+ ActionId::CompareSplit => "compare-split",
1085+ ActionId::CompareSide => "compare-side",
1086+ ActionId::AutoColour => "auto-colour",
1087+ ActionId::SaveLook => "save-look",
403 ActionId::ToggleProxies => "toggle-proxies",1088 ActionId::ToggleProxies => "toggle-proxies",
404 ActionId::ToggleAutoProxies => "toggle-auto-proxies",1089 ActionId::ToggleAutoProxies => "toggle-auto-proxies",
405 ActionId::Theme => "theme",1090 ActionId::Theme => "theme",
1091+ ActionId::AccentColour => "accent-colour",
406 ActionId::Fullscreen => "fullscreen",1092 ActionId::Fullscreen => "fullscreen",
407 ActionId::CancelExport => "cancel-export",1093 ActionId::CancelExport => "cancel-export",
408 ActionId::ShowActions => "show-actions",1094 ActionId::ShowActions => "show-actions",
1095+ ActionId::ShowKeys => "show-keys",
1096+ ActionId::About => "about",
409 ActionId::Screenshot => "screenshot",1097 ActionId::Screenshot => "screenshot",
410 ActionId::SubtitleStyle => "subtitle-style",1098 ActionId::SubtitleStyle => "subtitle-style",
411 ActionId::Settings => "settings",1099 ActionId::Settings => "settings",
1100+ ActionId::CloseGap => "close-gap",
1101+ ActionId::Freeze => "freeze",
1102+ ActionId::PasteAttributes => "paste-attributes",
1103+ ActionId::PasteColor => "paste-color",
1104+ ActionId::PasteEffects => "paste-effects",
1105+ ActionId::PasteTransform => "paste-transform",
1106+ ActionId::PasteSpeed => "paste-speed",
1107+ ActionId::PasteAudio => "paste-audio",
1108+ ActionId::MatchFrame => "match-frame",
1109+ ActionId::ReplaceEdit => "replace-edit",
1110+ ActionId::SelectForward => "select-forward",
1111+ ActionId::SelectForwardAll => "select-forward-all",
1112+ ActionId::ExtendAudio => "extend-audio",
1113+ ActionId::ExtendVideo => "extend-video",
1114+ ActionId::NudgeBack => "nudge-back",
1115+ ActionId::NudgeForward => "nudge-forward",
1116+ ActionId::NudgeBack10 => "nudge-back-10",
1117+ ActionId::NudgeForward10 => "nudge-forward-10",
412 ActionId::FocusPanels => "focus-panels",1118 ActionId::FocusPanels => "focus-panels",
413 }1119 }
414 }1120 }
415 1121
416 fn from_name(name: &str) -> Option<Self> {1122 fn from_name(name: &str) -> Option<Self> {
1123+ // "cycle-key-ease" is what a keys file written before the cycle became a choice calls it.
1124+ let name = if name == "cycle-key-ease" { "key-easing" } else { name };
417 Self::ALL.into_iter().find(|a| a.name() == name)1125 Self::ALL.into_iter().find(|a| a.name() == name)
418 }1126 }
419 1127
@@ -424,21 +1132,40 @@ impl ActionId {
424 match self {1132 match self {
425 ActionId::Play1133 ActionId::Play
426 | ActionId::Loop1134 | ActionId::Loop
1135+ | ActionId::PlayAround
427 | ActionId::StepBack1136 | ActionId::StepBack
428 | ActionId::StepForward1137 | ActionId::StepForward
429 | ActionId::JumpBack1138 | ActionId::JumpBack
430 | ActionId::JumpForward1139 | ActionId::JumpForward
431 | ActionId::GoStart1140 | ActionId::GoStart
432 | ActionId::GoEnd1141 | ActionId::GoEnd
1142+ | ActionId::GoToTime
433 | ActionId::PrevSyncPoint1143 | ActionId::PrevSyncPoint
434 | ActionId::NextSyncPoint1144 | ActionId::NextSyncPoint
435 | ActionId::WalkCutNext1145 | ActionId::WalkCutNext
436 | ActionId::WalkCutPrev1146 | ActionId::WalkCutPrev
437 | ActionId::WalkCutNext101147 | ActionId::WalkCutNext10
438 | ActionId::WalkCutPrev101148 | ActionId::WalkCutPrev10
439- | ActionId::SetIn1149+ | ActionId::ShuttleBack
1150+ | ActionId::ShuttleStop
1151+ | ActionId::PlayheadHere
1152+ | ActionId::ShuttleForward => Category::Playback,
1153+ // Marks and markers: the one place a range or a saved point is set and
1154+ // listed, so the palette and the menus find them together.
1155+ ActionId::SetIn
440 | ActionId::SetOut1156 | ActionId::SetOut
441- | ActionId::ClearRange => Category::Playback,1157+ | ActionId::ClearRange
1158+ | ActionId::RenderInOut
1159+ | ActionId::RenderAll
1160+ | ActionId::CancelRender
1161+ | ActionId::DeleteRenderFiles
1162+ | ActionId::AddMarker
1163+ | ActionId::MarkerHere
1164+ | ActionId::RenameMarker
1165+ | ActionId::DeleteMarker
1166+ | ActionId::Markers
1167+ | ActionId::NextMarker
1168+ | ActionId::PrevMarker => Category::Marking,
442 ActionId::Copy1169 ActionId::Copy
443 | ActionId::Paste1170 | ActionId::Paste
444 | ActionId::Select1171 | ActionId::Select
@@ -449,24 +1176,105 @@ impl ActionId {
449 | ActionId::Delete1176 | ActionId::Delete
450 | ActionId::Lift1177 | ActionId::Lift
451 | ActionId::Color1178 | ActionId::Color
1179+ | ActionId::AutoColour
1180+ | ActionId::SaveLook
452 | ActionId::Transform1181 | ActionId::Transform
1182+ | ActionId::Effects
1183+ | ActionId::KeyPlacement
1184+ | ActionId::KeyOpacity
1185+ | ActionId::KeyColor
1186+ | ActionId::KeyEasing
453 | ActionId::Fit1187 | ActionId::Fit
454 // A rate is the clip's, not the sound's: it re-times the picture1188 // A rate is the clip's, not the sound's: it re-times the picture
455 // and the sound together, and the card opens on whichever half was1189 // and the sound together, and the card opens on whichever half was
456 // clicked.1190 // clicked.
457 | ActionId::Speed1191 | ActionId::Speed
1192+ | ActionId::SpeedRampUp
1193+ | ActionId::SpeedRampDown
1194+ | ActionId::SpeedRampSlowFastSlow
1195+ | ActionId::SpeedRampFastSlowFast
1196+ | ActionId::SpeedRampKey
1197+ | ActionId::SpeedRampClear
458 // The scan reads a clip's sound, but what it does is edit the1198 // The scan reads a clip's sound, but what it does is edit the
459 // timeline the clip is on -- it is a clip card like the three1199 // timeline the clip is on -- it is a clip card like the three
460 // above it, opened on whichever half was picked.1200 // above it, opened on whichever half was picked.
461- | ActionId::Silence1201+ | ActionId::Reframe
462- | ActionId::Visualizer1202+ | ActionId::TrackMask
1203+ | ActionId::NestClips
1204+ | ActionId::BreakApart
1205+ | ActionId::CloseCompound
1206+ | ActionId::OpenCompound
1207+ | ActionId::CreateMulticam
1208+ | ActionId::FlattenMulticam
1209+ | ActionId::Angle1
1210+ | ActionId::Angle2
1211+ | ActionId::Angle3
1212+ | ActionId::Angle4
1213+ | ActionId::Angle5
1214+ | ActionId::Angle6
1215+ | ActionId::Angle7
1216+ | ActionId::Angle8
1217+ | ActionId::Angle9
463 | ActionId::Crossfade1218 | ActionId::Crossfade
464 | ActionId::TrimIn1219 | ActionId::TrimIn
465 | ActionId::TrimOut1220 | ActionId::TrimOut
466 | ActionId::LoopTrim1221 | ActionId::LoopTrim
467 | ActionId::TrimInToPlayhead1222 | ActionId::TrimInToPlayhead
468 | ActionId::TrimOutToPlayhead1223 | ActionId::TrimOutToPlayhead
469- | ActionId::Dissolve => Category::Clips,1224+ | ActionId::RippleTrimInToPlayhead
1225+ | ActionId::RippleTrimOutToPlayhead
1226+ | ActionId::RollBack
1227+ | ActionId::RollForward
1228+ | ActionId::SlipBack
1229+ | ActionId::SlipForward
1230+ | ActionId::SlideBack
1231+ | ActionId::SlideForward
1232+ | ActionId::Dissolve
1233+ | ActionId::TransitionDissolve
1234+ | ActionId::TransitionDipBlack
1235+ | ActionId::TransitionDipWhite
1236+ | ActionId::TransitionWipeLeft
1237+ | ActionId::TransitionWipeRight
1238+ | ActionId::TransitionWipeUp
1239+ | ActionId::TransitionWipeDown
1240+ | ActionId::TransitionSlideLeft
1241+ | ActionId::TransitionSlideRight
1242+ | ActionId::TransitionSlideUp
1243+ | ActionId::TransitionSlideDown
1244+ | ActionId::TransitionPushLeft
1245+ | ActionId::TransitionPushRight
1246+ | ActionId::TransitionPushUp
1247+ | ActionId::TransitionPushDown
1248+ | ActionId::TransitionZoom
1249+ | ActionId::PasteAttributes
1250+ | ActionId::PasteColor
1251+ | ActionId::PasteEffects
1252+ | ActionId::PasteTransform
1253+ | ActionId::PasteSpeed
1254+ | ActionId::PasteAudio
1255+ | ActionId::SelectForward
1256+ | ActionId::SelectForwardAll
1257+ | ActionId::ExtendAudio
1258+ | ActionId::ExtendVideo
1259+ | ActionId::NudgeBack
1260+ | ActionId::NudgeForward
1261+ | ActionId::NudgeBack10
1262+ | ActionId::NudgeForward10
1263+ | ActionId::Reverse
1264+ | ActionId::ClipEnabled
1265+ | ActionId::ClipLabel
1266+ | ActionId::NewSolid
1267+ | ActionId::NewGradient
1268+ | ActionId::NewCountdown
1269+ | ActionId::NewBars
1270+ | ActionId::NewTone
1271+ | ActionId::NewBarsAndTone
1272+ | ActionId::NewAdjustment
1273+ | ActionId::NewRectangle
1274+ | ActionId::NewEllipse
1275+ | ActionId::NewLine
1276+ | ActionId::NewArrow
1277+ | ActionId::NewTitle => Category::Clips,
470 // The project's own picture size is not a clip's business, and not1278 // The project's own picture size is not a clip's business, and not
471 // a file operation either: it is what the viewer is looking at.1279 // a file operation either: it is what the viewer is looking at.
472 // Neither is how much of the timeline the panel shows: a zoom edits1280 // Neither is how much of the timeline the panel shows: a zoom edits
@@ -477,7 +1285,30 @@ impl ActionId {
477 | ActionId::ZoomIn1285 | ActionId::ZoomIn
478 | ActionId::ZoomOut1286 | ActionId::ZoomOut
479 | ActionId::ZoomFit1287 | ActionId::ZoomFit
1288+ | ActionId::ZoomToSelection
1289+ // How tall the tracks are drawn: a view of the timeline, not an edit.
1290+ | ActionId::TrackSmall
1291+ | ActionId::TrackMedium
1292+ | ActionId::TrackLarge
1293+ | ActionId::TracksSmaller
1294+ | ActionId::TracksLarger
1295+ // The viewer's own look: how big, how sharp while playing, which guides.
1296+ | ActionId::ViewZoom
1297+ | ActionId::PlaybackQuality
1298+ | ActionId::GuideStyle
1299+ | ActionId::GuideMask
480 | ActionId::ToggleSubtitles1300 | ActionId::ToggleSubtitles
1301+ | ActionId::ToggleWaveforms
1302+ | ActionId::ToggleScrubAudio
1303+ | ActionId::CompareOff
1304+ | ActionId::CompareSplit
1305+ | ActionId::CompareSide
1306+ // ...and the angle monitor: a second way of looking at the footage.
1307+ | ActionId::ToggleAngleMonitor
1308+ // ...and the video output window and its display: a second window onto the same
1309+ // picture, which edits nothing and saves nothing.
1310+ | ActionId::ToggleOutputWindow
1311+ | ActionId::OutputDisplay
481 // ...and which file the picture is decoded from, which changes1312 // ...and which file the picture is decoded from, which changes
482 // nothing that is saved and nothing that is exported: a stand-in1313 // nothing that is saved and nothing that is exported: a stand-in
483 // is what one watches while cutting, not what one delivers.1314 // is what one watches while cutting, not what one delivers.
@@ -489,6 +1320,7 @@ impl ActionId {
489 // ...and what the whole window is painted in: it edits nothing at1320 // ...and what the whole window is painted in: it edits nothing at
490 // all, it is what one is looking *with*.1321 // all, it is what one is looking *with*.
491 | ActionId::Theme1322 | ActionId::Theme
1323+ | ActionId::AccentColour
492 // ...and what the cue plate is drawn in: a person's own reading1324 // ...and what the cue plate is drawn in: a person's own reading
493 // preference, same as the theme beside it.1325 // preference, same as the theme beside it.
494 | ActionId::SubtitleStyle1326 | ActionId::SubtitleStyle
@@ -501,19 +1333,32 @@ impl ActionId {
501 // Moves the ring, not a clip or a lane: the same "how one is1333 // Moves the ring, not a clip or a lane: the same "how one is
502 // looking/reaching, not what is being edited" shape as the rest1334 // looking/reaching, not what is being edited" shape as the rest
503 // of this heading.1335 // of this heading.
504- | ActionId::FocusPanels => Category::View,1336+ | ActionId::FocusPanels
505- ActionId::Cut1337+ | ActionId::About
1338+ | ActionId::ShowKeys => Category::View,
1339+ ActionId::InsertSource
1340+ | ActionId::OverwriteSource
1341+ | ActionId::CloseGap
1342+ | ActionId::Freeze
1343+ | ActionId::CutSelectedWords
1344+ | ActionId::MatchFrame
1345+ | ActionId::ReplaceEdit
1346+ | ActionId::Cut
506 | ActionId::Regroup1347 | ActionId::Regroup
507 | ActionId::Detach1348 | ActionId::Detach
508 | ActionId::Group1349 | ActionId::Group
509 | ActionId::Undo1350 | ActionId::Undo
510 | ActionId::Redo1351 | ActionId::Redo
1352+ | ActionId::History
511 | ActionId::AddVideoLane1353 | ActionId::AddVideoLane
512 | ActionId::AddAudioLane1354 | ActionId::AddAudioLane
513 | ActionId::RemoveVideoLane1355 | ActionId::RemoveVideoLane
514 // Not a view setting despite being a pointer aid: it decides where1356 // Not a view setting despite being a pointer aid: it decides where
515 // a drag actually lands, which is an edit and not a magnification.1357 // a drag actually lands, which is an edit and not a magnification.
516 | ActionId::ToggleSnap1358 | ActionId::ToggleSnap
1359+ // A marker is saved with the project and travels with the picture
1360+ // through every cut, the way a title does: an edit, and the card
1361+ // that lists them is the project's own list.
517 // The subtitle pair is a track pair like the lanes above it: what1362 // The subtitle pair is a track pair like the lanes above it: what
518 // they add is on the timeline and goes into the file an export1363 // they add is on the timeline and goes into the file an export
519 // writes, where the toggle two headings down only decides whether1364 // writes, where the toggle two headings down only decides whether
@@ -524,6 +1369,11 @@ impl ActionId {
524 // from: it edits no lane, but what it brings in is the project's1369 // from: it edits no lane, but what it brings in is the project's
525 // and is saved with it, which is not a view setting.1370 // and is saved with it, which is not a view setting.
526 | ActionId::ImportSubtitles1371 | ActionId::ImportSubtitles
1372+ | ActionId::NewSequence
1373+ | ActionId::DuplicateSequence
1374+ | ActionId::RenameSequence
1375+ | ActionId::DeleteSequence
1376+ | ActionId::RenameLane
527 | ActionId::RemoveAudioLane => Category::Editing,1377 | ActionId::RemoveAudioLane => Category::Editing,
528 ActionId::ToggleMute1378 ActionId::ToggleMute
529 | ActionId::VolumeUp1379 | ActionId::VolumeUp
@@ -533,10 +1383,33 @@ impl ActionId {
533 // what the whole of it is held under -- where the three above it1383 // what the whole of it is held under -- where the three above it
534 // are this machine's monitoring. Both are audio, and the card says1384 // are this machine's monitoring. Both are audio, and the card says
535 // which is which.1385 // which is which.
536- | ActionId::Mix => Category::Audio,1386+ | ActionId::Mix
1387+ | ActionId::CleanVoice
1388+ | ActionId::VoiceDynamics
1389+ // The creator tools: they listen to or write the project's sound (and the
1390+ // words said in it), and open one card each.
1391+ | ActionId::Normalize
1392+ | ActionId::Captions
1393+ | ActionId::Fillers
1394+ | ActionId::Silence
1395+ | ActionId::MarkBeats
1396+ | ActionId::Visualizer
1397+ | ActionId::Voiceover
1398+ | ActionId::RecordVoiceover => Category::Audio,
537 // Under the heading the panel button sits in, beside the save and1399 // Under the heading the panel button sits in, beside the save and
538 // the export it stands next to on screen.1400 // the export it stands next to on screen.
539 ActionId::Save1401 ActionId::Save
1402+ | ActionId::ReloadProject
1403+ | ActionId::NewProject
1404+ | ActionId::SaveVersion
1405+ | ActionId::SaveTemplate
1406+ | ActionId::ExportCaptions
1407+ | ActionId::Versions
1408+ | ActionId::CollectMedia
1409+ | ActionId::ProjectNotes
1410+ | ActionId::ExportTimelineOtio
1411+ | ActionId::ExportTimelineFcpxml
1412+ | ActionId::ExportTimelineEdl
540 | ActionId::Export1413 | ActionId::Export
541 | ActionId::CancelExport1414 | ActionId::CancelExport
542 | ActionId::ShowActions1415 | ActionId::ShowActions
@@ -547,7 +1420,19 @@ impl ActionId {
547 // The dock's import pair brings a file *in*, the same heading a1420 // The dock's import pair brings a file *in*, the same heading a
548 // file going *out* (Export, Save) already sits under.1421 // file going *out* (Export, Save) already sits under.
549 | ActionId::AddFiles1422 | ActionId::AddFiles
550- | ActionId::PasteFilePath => Category::File,1423+ | ActionId::ImportTimelineOtio
1424+ | ActionId::PasteFilePath
1425+ | ActionId::OpenProject
1426+ // ...and the library's own housekeeping sits beside them: how the media that came
1427+ // in is filed and found again.
1428+ | ActionId::NewBin
1429+ | ActionId::NewBinInside
1430+ | ActionId::RenameBin
1431+ | ActionId::RemoveBin
1432+ | ActionId::ToggleFavourite
1433+ | ActionId::MoveToBin
1434+ | ActionId::ShowFavourites
1435+ | ActionId::ShowAllMedia => Category::File,
551 }1436 }
552 }1437 }
553 }1438 }
@@ -556,6 +1441,7 @@ impl ActionId {
556 #[derive(Clone, Copy, PartialEq, Eq, Debug)]1441 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
557 pub enum Category {1442 pub enum Category {
558 Playback,1443 Playback,
1444+ Marking,
559 Editing,1445 Editing,
560 Clips,1446 Clips,
561 Audio,1447 Audio,
@@ -564,8 +1450,9 @@ pub enum Category {
564 }1450 }
565 1451
566 impl Category {1452 impl Category {
567- pub const ALL: [Category; 6] = [1453+ pub const ALL: [Category; 7] = [
568 Category::Playback,1454 Category::Playback,
1455+ Category::Marking,
569 Category::Editing,1456 Category::Editing,
570 Category::Clips,1457 Category::Clips,
571 Category::Audio,1458 Category::Audio,
@@ -576,6 +1463,7 @@ impl Category {
576 pub fn label(self) -> &'static str {1463 pub fn label(self) -> &'static str {
577 match self {1464 match self {
578 Category::Playback => "Playback",1465 Category::Playback => "Playback",
1466+ Category::Marking => "Marking",
579 Category::Editing => "Editing",1467 Category::Editing => "Editing",
580 Category::Clips => "Clips",1468 Category::Clips => "Clips",
581 Category::Audio => "Audio",1469 Category::Audio => "Audio",
@@ -619,20 +1507,45 @@ pub enum Reach {
619 Gesture,1507 Gesture,
620 }1508 }
621 1509
622-pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(|| {1510+/// The words a person types for a shown key, besides the glyph itself, so the
1511+/// keys menu's search finds `↵` by "enter" and `↑` by "up". Each token of a
1512+/// shown chord (`↑ ↓ ↵`, `← / →`) is looked up; a token with no alias adds
1513+/// nothing.
1514+pub(crate) fn search_aliases(shown: &str) -> String {
1515+ const ALIASES: [(&str, &str); 6] = [
1516+ ("↵", "enter return"),
1517+ ("↑", "up arrow"),
1518+ ("↓", "down arrow"),
1519+ ("←", "left arrow"),
1520+ ("→", "right arrow"),
1521+ ("Esc", "escape"),
1522+ ];
1523+ shown
1524+ .split(|c: char| c.is_whitespace() || c == '+' || c == '/')
1525+ .filter_map(|token| {
1526+ ALIASES
1527+ .iter()
1528+ .find(|(glyph, _)| *glyph == token)
1529+ .map(|(_, words)| *words)
1530+ })
1531+ .collect::<Vec<_>>()
1532+ .join(" ")
1533+}
1534+
1535+pub static FIXED:std::sync::LazyLock<[Fixed; 36]> = std::sync::LazyLock::new(|| {
623 [1536 [
624 // Not a chord at all but a way of pressing one, and the only place the1537 // Not a chord at all but a way of pressing one, and the only place the
625 // editor can say so: holding a key that moves a *value* runs it, and1538 // editor can say so: holding a key that moves a *value* runs it, and
626 // holding anything else still does what one press did.1539 // holding anything else still does what one press did.
627 Fixed {1540 Fixed {
628 chord: "hold ← → ↑ ↓".into(),1541 chord: "hold ← → ↑ ↓".into(),
629- label: "Run a card's slider, or the volume and zoom keys, while held",1542+ label: "Hold a key to adjust",
630 category: Category::View,1543 category: Category::View,
631 reach: Reach::Gesture,1544 reach: Reach::Gesture,
632 },1545 },
633 Fixed {1546 Fixed {
634- chord: "esc".into(),1547+ chord: "Esc".into(),
635- label: "Close this card or menu, or cancel a capture",1548+ label: "Close a menu or card, or cancel",
636 category: Category::View,1549 category: Category::View,
637 reach: Reach::Gesture,1550 reach: Reach::Gesture,
638 },1551 },
@@ -640,43 +1553,43 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
640 // list is the door to a setting, and a door only a pointer opens is one1553 // list is the door to a setting, and a door only a pointer opens is one
641 // half of this editor's users cannot use.1554 // half of this editor's users cannot use.
642 Fixed {1555 Fixed {
643- chord: "↑ ↓ enter".into(),1556+ chord: "↑ ↓ ↵".into(),
644 label: "Move through an open choice list, and take the row",1557 label: "Move through an open choice list, and take the row",
645 category: Category::View,1558 category: Category::View,
646 reach: Reach::Click("picker-row"),1559 reach: Reach::Click("picker-row"),
647 },1560 },
648 Fixed {1561 Fixed {
649- chord: "n".into(),1562+ chord: "N".into(),
650 label: "Say the export budget: 850k, 6.5M, 6.5 or 1.2G of file",1563 label: "Say the export budget: 850k, 6.5M, 6.5 or 1.2G of file",
651 category: Category::File,1564 category: Category::File,
652- reach: Reach::Click("budget"),1565+ reach: Reach::Click("export-c-bitrate"),
653 },1566 },
654 Fixed {1567 Fixed {
655 chord: "− / + / ← →".into(),1568 chord: "− / + / ← →".into(),
656 label: "Move the export budget — shift steps whole megabits",1569 label: "Move the export budget — shift steps whole megabits",
657 category: Category::File,1570 category: Category::File,
658- reach: Reach::Click("budget-track"),1571+ reach: Reach::Click("export-c-bitrate"),
659 },1572 },
660 Fixed {1573 Fixed {
661 chord: "0–9".into(),1574 chord: "0–9".into(),
662 label: "Type into an open field — the budget, or a clip's duration",1575 label: "Type into an open field — the budget, or a clip's duration",
663 category: Category::File,1576 category: Category::File,
664- reach: Reach::Click("budget"),1577+ reach: Reach::Click("export-c-bitrate"),
665 },1578 },
666 Fixed {1579 Fixed {
667- chord: "backspace".into(),1580+ chord: "Backspace".into(),
668 label: "Erase a character in the budget or duration field",1581 label: "Erase a character in the budget or duration field",
669 category: Category::File,1582 category: Category::File,
670- reach: Reach::Click("budget"),1583+ reach: Reach::Click("export-c-bitrate"),
671 },1584 },
672 Fixed {1585 Fixed {
673- chord: "d".into(),1586+ chord: "D".into(),
674 label: "Choose where the export is written",1587 label: "Choose where the export is written",
675 category: Category::File,1588 category: Category::File,
676- reach: Reach::Click("destination"),1589+ reach: Reach::Click("export-destination"),
677 },1590 },
678 Fixed {1591 Fixed {
679- chord: "enter".into(),1592+ chord: "↵".into(),
680 label: "Start the export — or take the budget being typed",1593 label: "Start the export — or take the budget being typed",
681 category: Category::File,1594 category: Category::File,
682 reach: Reach::Click("export-confirm"),1595 reach: Reach::Click("export-confirm"),
@@ -686,60 +1599,60 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
686 // this editor cannot move at all. Card-local, so none of them is bindable.1599 // this editor cannot move at all. Card-local, so none of them is bindable.
687 Fixed {1600 Fixed {
688 chord: "1–9, 0".into(),1601 chord: "1–9, 0".into(),
689- label: "Pick an equalizer band",1602+ label: "Select an equalizer band",
690 category: Category::Audio,1603 category: Category::Audio,
691 reach: Reach::Click("eq-graph"),1604 reach: Reach::Click("eq-graph"),
692 },1605 },
693 Fixed {1606 Fixed {
694- chord: "up".into(),1607+ chord: "↑".into(),
695- label: "Raise the picked band 1 dB",1608+ label: "Raise the selected band 1 dB",
696 category: Category::Audio,1609 category: Category::Audio,
697- reach: Reach::Click("eq-gain-up"),1610+ reach: Reach::Click("eq-gain-field"),
698 },1611 },
699 Fixed {1612 Fixed {
700- chord: "down".into(),1613+ chord: "↓".into(),
701- label: "Lower the picked band 1 dB",1614+ label: "Lower the selected band 1 dB",
702 category: Category::Audio,1615 category: Category::Audio,
703- reach: Reach::Click("eq-gain-down"),1616+ reach: Reach::Click("eq-gain-field"),
704 },1617 },
705 Fixed {1618 Fixed {
706 chord: "← / →".into(),1619 chord: "← / →".into(),
707- label: "Move the picked band down or up in frequency",1620+ label: "Move the selected band down or up in frequency",
708 category: Category::Audio,1621 category: Category::Audio,
709- reach: Reach::Click("eq-freq-up"),1622+ reach: Reach::Click("eq-freq-field"),
710 },1623 },
711 Fixed {1624 Fixed {
712- chord: "shift ← / →".into(),1625+ chord: "Shift+← / →".into(),
713- label: "Widen or narrow the picked band (its Q)",1626+ label: "Widen or narrow the selected band (its Q)",
714 category: Category::Audio,1627 category: Category::Audio,
715- reach: Reach::Click("eq-q-wider"),1628+ reach: Reach::Click("eq-q-field"),
716 },1629 },
717 Fixed {1630 Fixed {
718- chord: "a".into(),1631+ chord: "A".into(),
719- label: "Add an equalizer band beside the picked one",1632+ label: "Add an equalizer band beside the selected one",
720 category: Category::Audio,1633 category: Category::Audio,
721 reach: Reach::Click("eq-add"),1634 reach: Reach::Click("eq-add"),
722 },1635 },
723 Fixed {1636 Fixed {
724- chord: "x".into(),1637+ chord: "X".into(),
725- label: "Remove the picked equalizer band",1638+ label: "Remove the selected equalizer band",
726 category: Category::Audio,1639 category: Category::Audio,
727 reach: Reach::Click("eq-remove"),1640 reach: Reach::Click("eq-remove"),
728 },1641 },
729 Fixed {1642 Fixed {
730- chord: "f".into(),1643+ chord: "F".into(),
731- label: "Flatten the picked band (double-click does the same)",1644+ label: "Flatten the selected band (double-click does the same)",
732 category: Category::Audio,1645 category: Category::Audio,
733 reach: Reach::Click("eq-flat-band"),1646 reach: Reach::Click("eq-flat-band"),
734 },1647 },
735 Fixed {1648 Fixed {
736- chord: "r".into(),1649+ chord: "R".into(),
737 label: "Flatten every band",1650 label: "Flatten every band",
738 category: Category::Audio,1651 category: Category::Audio,
739 reach: Reach::Click("eq-reset"),1652 reach: Reach::Click("eq-reset"),
740 },1653 },
741 Fixed {1654 Fixed {
742- chord: "s".into(),1655+ chord: "S".into(),
743 label: "Show or hide the spectrum behind the curve",1656 label: "Show or hide the spectrum behind the curve",
744 category: Category::Audio,1657 category: Category::Audio,
745 reach: Reach::Click("eq-spectrum"),1658 reach: Reach::Click("eq-spectrum"),
@@ -748,18 +1661,18 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
748 // card-local input the export card's digits are.1661 // card-local input the export card's digits are.
749 Fixed {1662 Fixed {
750 chord: "↑ / ↓".into(),1663 chord: "↑ / ↓".into(),
751- label: "Pick a colour slider",1664+ label: "Select a colour slider",
752 category: Category::Clips,1665 category: Category::Clips,
753 reach: Reach::Click("color-row"),1666 reach: Reach::Click("color-row"),
754 },1667 },
755 Fixed {1668 Fixed {
756 chord: "← / →".into(),1669 chord: "← / →".into(),
757- label: "Move the picked colour slider",1670+ label: "Move the selected colour slider",
758 category: Category::Clips,1671 category: Category::Clips,
759 reach: Reach::Click("color-bar"),1672 reach: Reach::Click("color-bar"),
760 },1673 },
761 Fixed {1674 Fixed {
762- chord: "r".into(),1675+ chord: "R".into(),
763 label: "Take the colour grade off the clip",1676 label: "Take the colour grade off the clip",
764 category: Category::Clips,1677 category: Category::Clips,
765 reach: Reach::Click("color-reset"),1678 reach: Reach::Click("color-reset"),
@@ -769,18 +1682,18 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
769 // it, and `r` resets to identity.1682 // it, and `r` resets to identity.
770 Fixed {1683 Fixed {
771 chord: "↑ / ↓".into(),1684 chord: "↑ / ↓".into(),
772- label: "Pick a transform band",1685+ label: "Select a transform band",
773 category: Category::Clips,1686 category: Category::Clips,
774 reach: Reach::Click("transform-row"),1687 reach: Reach::Click("transform-row"),
775 },1688 },
776 Fixed {1689 Fixed {
777 chord: "← / →".into(),1690 chord: "← / →".into(),
778- label: "Move the picked transform band",1691+ label: "Move the selected transform band",
779 category: Category::Clips,1692 category: Category::Clips,
780 reach: Reach::Click("transform-bar"),1693 reach: Reach::Click("transform-bar"),
781 },1694 },
782 Fixed {1695 Fixed {
783- chord: "r".into(),1696+ chord: "R".into(),
784 label: "Take the transform off the clip",1697 label: "Take the transform off the clip",
785 category: Category::Clips,1698 category: Category::Clips,
786 reach: Reach::Click("transform-reset"),1699 reach: Reach::Click("transform-reset"),
@@ -790,95 +1703,178 @@ pub static FIXED: std::sync::LazyLock<[Fixed; 28]> = std::sync::LazyLock::new(||
790 // this editor where a key rewrites forty places at once, so both of them1703 // this editor where a key rewrites forty places at once, so both of them
791 // are listed rather than hidden in the card's own hint line.1704 // are listed rather than hidden in the card's own hint line.
792 Fixed {1705 Fixed {
793- chord: "enter".into(),1706+ chord: "↵".into(),
794 label: "Cut every silence the card found",1707 label: "Cut every silence the card found",
795 category: Category::Clips,1708 category: Category::Clips,
796 reach: Reach::Click("silence-apply"),1709 reach: Reach::Click("silence-apply"),
797 },1710 },
798 Fixed {1711 Fixed {
799- chord: "f".into(),1712+ chord: "F".into(),
800 label: "Speed the silences up instead of cutting them",1713 label: "Speed the silences up instead of cutting them",
801 category: Category::Clips,1714 category: Category::Clips,
802 reach: Reach::Click("silence-apply"),1715 reach: Reach::Click("silence-apply"),
803 },1716 },
804 Fixed {1717 Fixed {
805- chord: "k".into(),1718+ chord: "K".into(),
806 label: "Keep only the silences the card found",1719 label: "Keep only the silences the card found",
807 category: Category::Clips,1720 category: Category::Clips,
808 reach: Reach::Click("silence-keep-only"),1721 reach: Reach::Click("silence-keep-only"),
809 },1722 },
1723+ // The markers card's own three: up/down select a marker, `↵` renames it
1724+ // and shift+`↵` edits its note (`↵` then saves what was typed, esc gives it up).
1725+ Fixed {
1726+ chord: "↑ / ↓".into(),
1727+ label: "Select marker",
1728+ category: Category::Editing,
1729+ reach: Reach::Click("markers-row"),
1730+ },
1731+ Fixed {
1732+ chord: "↵".into(),
1733+ label: "Rename marker",
1734+ category: Category::Editing,
1735+ reach: Reach::Click("markers-name"),
1736+ },
1737+ Fixed {
1738+ chord: "Shift+↵".into(),
1739+ label: "Edit marker note",
1740+ category: Category::Editing,
1741+ reach: Reach::Click("markers-note"),
1742+ },
1743+ // The pointer's trims on the timeline, in plain words: nothing on
1744+ // screen says that shift turns an edge drag into a roll or a body drag
1745+ // into a slip, so the sheet does. The status bar says the same while
1746+ // the pointer rests on a clip (`ui/bench_stance/clip.rs`).
1747+ Fixed {
1748+ chord: "drag edge".into(),
1749+ label: "Trim: lengthen or shorten the clip from that edge",
1750+ category: Category::Editing,
1751+ reach: Reach::Gesture,
1752+ },
1753+ Fixed {
1754+ chord: "Shift+drag edge".into(),
1755+ label: "Roll the cut: both clips change, the timeline keeps its length",
1756+ category: Category::Editing,
1757+ reach: Reach::Gesture,
1758+ },
1759+ Fixed {
1760+ chord: "Shift+drag clip".into(),
1761+ label: "Slip: show other footage of the file in the same place",
1762+ category: Category::Editing,
1763+ reach: Reach::Gesture,
1764+ },
1765+ Fixed {
1766+ chord: "Shift+Alt+drag clip".into(),
1767+ label: "Slide: move the clip between its neighbours, which give and take",
1768+ category: Category::Editing,
1769+ reach: Reach::Gesture,
1770+ },
1771+ Fixed {
1772+ chord: "Alt+drag".into(),
1773+ label: "Move or trim with snapping off, for that drag only",
1774+ category: Category::Editing,
1775+ reach: Reach::Gesture,
1776+ },
810 ]1777 ]
811 });1778 });
812 1779
813-/// A stroke as the key handler sees it: gpui's key name plus the one1780+/// A stroke as the key handler sees it: gpui's key name plus the three
814-/// modifier this editor binds. Nothing else is a chord here -- alt is part1781+/// modifiers this editor binds, `ctrl`, `shift` and `alt`.
815-/// of the key name gpui reports, and a second modifier would need the file
816-/// format to grow before it could be spelled.
817 ///1782 ///
818-/// There is no `shift` field. gpui 0.2.2 (linux/platform.rs:909-917) clears1783+/// Shift is kept on letters: gpui 0.2.2 reports `ctrl+shift+i` as the key `i`
819-/// the shift modifier for any single-char key whose upper and lower case are1784+/// with both held, so it is a different stroke from `ctrl+i`. It is not kept on
820-/// the same -- every symbol key (`,` `.` `[` `]` `/` `=` ...) -- so a chord1785+/// symbols: gpui clears shift for any single-char key whose upper and lower
821-/// carrying `shift` could never be struck for any of them; the shifted1786+/// case are the same (linux/platform.rs:909-917), so a shifted symbol arrives
822-/// stroke arrives instead as the key it types (`shift+.` is the key `>`).1787+/// as the glyph it types -- shift+/ is `?`, shift+. is `>`. Those are bound on
823-/// The one place this editor wanted shift on a symbol (the odometer's1788+/// the literal key, with no shift, which is why `?` needs no modifier at all.
824-/// stride-ten, DESIGN.md §6) is bound on that literal key instead
825-/// (`keymap.rs`'s own `defaults`), and a non-symbol key that wants shift
826-/// (the EQ card's arrows) reads `event.keystroke.modifiers.shift` straight
827-/// off the keystroke, upstream of this struct entirely -- so the field had
828-/// zero production callers and is gone rather than kept dead.
829 #[derive(Clone, PartialEq, Eq, Debug)]1789 #[derive(Clone, PartialEq, Eq, Debug)]
830 pub struct Chord {1790 pub struct Chord {
831 pub key: String,1791 pub key: String,
832 pub ctrl: bool,1792 pub ctrl: bool,
1793+ pub shift: bool,
1794+ pub alt: bool,
833 }1795 }
834 1796
835 impl Chord {1797 impl Chord {
836- /// The file's spelling, and the only one [`parse`] accepts back.1798+ /// The file's spelling, and the only one [`parse`] accepts back: the
1799+ /// modifiers in one fixed order, then the key.
837 fn text(&self) -> String {1800 fn text(&self) -> String {
1801+ let mut out = String::new();
838 if self.ctrl {1802 if self.ctrl {
839- format!("ctrl+{}", self.key)1803+ out.push_str("ctrl+");
840- } else {1804+ }
841- self.key.clone()1805+ if self.shift {
1806+ out.push_str("shift+");
1807+ }
1808+ if self.alt {
1809+ out.push_str("alt+");
842 }1810 }
1811+ out.push_str(&self.key);
1812+ out
843 }1813 }
844 1814
845- /// The spelling a person reads. Identical to [`Chord::text`] but for the one1815+ /// The spelling a person reads, as DESIGN.md §10.2 writes it: `Ctrl+Shift+I`,
846- /// key whose usual name is shorter than gpui's. Public because a1816+ /// `Alt+1`, `Delete`, `F11`, `←`. Modifiers are capitalised, a letter is a
847- /// keybindings row shows one chord, where [`Keymap::display`] shows every1817+ /// capital, and named keys are title case ([`Chord::shown_key`]). Display
848- /// chord an action answers to.1818+ /// only: the file keeps gpui's lowercase names. Public because a keybindings
1819+ /// row shows one chord, where [`Keymap::display`] shows every chord an action
1820+ /// answers to.
849 pub fn pretty(&self) -> String {1821 pub fn pretty(&self) -> String {
850- let key = if self.key == "escape" {1822+ let mut out = String::new();
851- "esc"
852- } else {
853- &self.key
854- };
855 if self.ctrl {1823 if self.ctrl {
856- format!("ctrl+{key}")1824+ out.push_str("Ctrl+");
857- } else {
858- key.to_string()
859 }1825 }
1826+ if self.shift {
1827+ out.push_str("Shift+");
1828+ }
1829+ if self.alt {
1830+ out.push_str("Alt+");
1831+ }
1832+ out.push_str(&Self::shown_key(&self.key));
1833+ out
860 }1834 }
861 1835
862- /// The spelling a badge with room for one token reads (MOCK-SPEC.md1836+ /// One key as a person reads it. Named keys are title case (`Delete`,
863- /// "Spine": `del`, `z`, not `x or delete`, `ctrl+z`): `^` in place of1837+ /// `PageUp`, `Esc`), `enter` is `↵`, the arrows are glyphs, function keys
864- /// `ctrl+`, and the handful of key names whose everyday short form isn't1838+ /// are `F1`..`F12`, and a single letter is its capital. Symbols and anything
865- /// gpui's own (`delete` -> `del`, `escape` -> `esc`, `space` -> `spc`).1839+ /// else are left as gpui names them.
866- /// [`Chord::pretty`] stays the keys overlay's own spelling -- this is for1840+ fn shown_key(key: &str) -> String {
867- /// a glyph badge, not the full truth.1841+ if let Some(n) = key
868- pub fn compact(&self) -> String {1842+ .strip_prefix('f')
869- let key = match self.key.as_str() {1843+ .and_then(|n| n.parse::<u8>().ok())
870- "escape" => "esc",1844+ .filter(|n| (1..=12).contains(n))
871- "delete" => "del",1845+ {
872- "space" => "spc",1846+ return format!("F{n}");
873- other => other,1847+ }
874- };1848+ match key {
875- if self.ctrl {1849+ "escape" => "Esc".to_string(),
876- format!("^{key}")1850+ "enter" => "↵".to_string(),
877- } else {1851+ "left" => "←".to_string(),
878- key.to_string()1852+ "right" => "→".to_string(),
1853+ "up" => "↑".to_string(),
1854+ "down" => "↓".to_string(),
1855+ "backspace" => "Backspace".to_string(),
1856+ "delete" => "Delete".to_string(),
1857+ "space" => "Space".to_string(),
1858+ "home" => "Home".to_string(),
1859+ "end" => "End".to_string(),
1860+ "pageup" => "PageUp".to_string(),
1861+ "pagedown" => "PageDown".to_string(),
1862+ "tab" => "Tab".to_string(),
1863+ key if key.len() == 1 && key.as_bytes()[0].is_ascii_alphabetic() => {
1864+ key.to_ascii_uppercase()
1865+ }
1866+ key => key.to_string(),
879 }1867 }
880 }1868 }
881 1869
1870+ /// The spelling a badge reads. It is the same spelling as
1871+ /// [`Chord::pretty`], so a hint in the status bar, the transport and the
1872+ /// toolbar all say `Ctrl+K`, `Space`, `Delete`. The old short forms (`^K`,
1873+ /// `Spc`, `Del`) were dropped so one key never has two spellings on screen.
1874+ pub fn compact(&self) -> String {
1875+ self.pretty()
1876+ }
1877+
882 /// Whether the file can carry this stroke and read it back as itself. gpui1878 /// Whether the file can carry this stroke and read it back as itself. gpui
883 /// reports strokes this format cannot spell -- shift+= arrives as the key1879 /// reports strokes this format cannot spell -- shift+= arrives as the key
884 /// `"+"`, which is the chord grammar's own separator -- and binding one1880 /// `"+"`, which is the chord grammar's own separator -- and binding one
@@ -889,25 +1885,40 @@ impl Chord {
889 Chord::parse(&self.text(), 0).is_ok_and(|round_trip| round_trip == *self)1885 Chord::parse(&self.text(), 0).is_ok_and(|round_trip| round_trip == *self)
890 }1886 }
891 1887
892- /// Strict: exactly one optional `ctrl+`, then a key gpui could have1888+ /// Strict: each of `ctrl+`, `shift+` and `alt+` at most once, in any order,
893- /// reported. A spelling this cannot emit back unchanged is refused1889+ /// then a key gpui could have reported. A spelling this cannot emit back
894- /// rather than normalised, because the round-trip is what makes the file1890+ /// unchanged is refused rather than normalised, because the round-trip is
895- /// editable by hand at all.1891+ /// what makes the file editable by hand at all -- `shift+ctrl+i` is read as
1892+ /// `ctrl+shift+i` and written back that way, but `Ctrl+i` is refused.
896 fn parse(text: &str, n: usize) -> Result<Self, String> {1893 fn parse(text: &str, n: usize) -> Result<Self, String> {
897- let (ctrl, key) = match text.strip_prefix("ctrl+") {1894+ let (mut ctrl, mut shift, mut alt) = (false, false, false);
898- Some(rest) => (true, rest),1895+ let mut rest = text;
899- None => (false, text),1896+ loop {
900- };1897+ if !ctrl && let Some(r) = rest.strip_prefix("ctrl+") {
901- if key.is_empty()1898+ ctrl = true;
902- || key.contains(' ')1899+ rest = r;
903- || key.contains('+')1900+ } else if !shift && let Some(r) = rest.strip_prefix("shift+") {
904- || key.chars().any(|c| c.is_ascii_uppercase())1901+ shift = true;
1902+ rest = r;
1903+ } else if !alt && let Some(r) = rest.strip_prefix("alt+") {
1904+ alt = true;
1905+ rest = r;
1906+ } else {
1907+ break;
1908+ }
1909+ }
1910+ if rest.is_empty()
1911+ || rest.contains(' ')
1912+ || rest.contains('+')
1913+ || rest.chars().any(|c| c.is_ascii_uppercase())
905 {1914 {
906 return Err(format!("line {n}: {text:?} is not a chord"));1915 return Err(format!("line {n}: {text:?} is not a chord"));
907 }1916 }
908 Ok(Chord {1917 Ok(Chord {
909- key: key.to_string(),1918+ key: rest.to_string(),
910 ctrl,1919 ctrl,
1920+ shift,
1921+ alt,
911 })1922 })
912 }1923 }
913 }1924 }
@@ -928,317 +1939,201 @@ pub struct Keymap {
928 }1939 }
929 1940
930 impl Keymap {1941 impl Keymap {
931- /// The bindings the editor has always had, in the order the editor lists1942+ /// The bindings the editor ships with, in the order the editor lists them:
932- /// them. Delete and undo get two strokes each because both have always1943+ /// DESIGN.md §10.2's table, row for row. `defaults_are_the_proposed_keys`
933- /// answered to two.1944+ /// pins every row, so a change here is a change to that table first.
934 pub fn defaults() -> Self {1945 pub fn defaults() -> Self {
935- let b = |action, key: &str, ctrl| Binding {1946+ let b = |action, text: &str| Binding {
936 action,1947 action,
937- chord: Chord {1948+ chord: Chord::parse(text, 0).expect("a default chord is a chord"),
938- key: key.to_string(),
939- ctrl,
940- },
941 };1949 };
942 Keymap {1950 Keymap {
943 bindings: vec![1951 bindings: vec![
944- b(ActionId::Play, "space", false),
945- // "r" for repeat, free and bare: its ctrl chord is already the
946- // project resolution, and the two read as a pair the way the
947- // mute and its level do.
948- b(ActionId::Loop, "r", false),
949- // Seeking without a pointer, on the keys every player already
950- // seeks with (gpui names them "left"/"right"/"home"/"end",
951- // platform.rs:872-877). The colour card reads the same arrows
952- // for its sliders, and a card answers its own strokes before the
953- // keymap is consulted -- the arrows among them -- so these move
954- // the playhead only while no card is open. The document chords
955- // are the exception and are not these: `Undo`, `Redo`, `Save`,
956- // `Copy` and `Paste` reach the keymap whatever is up
957- // (`ui::stance::card_safe_action`).
958- b(ActionId::StepBack, "left", false),
959- b(ActionId::StepForward, "right", false),
960- b(ActionId::JumpBack, "left", true),
961- b(ActionId::JumpForward, "right", true),
962- b(ActionId::GoStart, "home", false),
963- b(ActionId::GoEnd, "end", false),
964- // The sync-point pair, on the brackets that already mean "the
965- // one before / the one after" here (they select the clip either
966- // side) -- with ctrl, which was free on both, because these
967- // step through the same timeline by the source's own grid.
968- b(ActionId::PrevSyncPoint, "[", true),
969- b(ActionId::NextSyncPoint, "]", true),
970- // The cut odometer (DESIGN.md §6): bare walks one cut, shift
971- // strides ten. gpui 0.2.2 (linux/platform.rs:909-917) clears
972- // the shift modifier for any single-char key whose upper and
973- // lower case are the same -- every one of these symbols --
974- // so `shift+.` never arrives; what arrives instead is the
975- // key the shifted stroke actually types, `>`/`<`. Bound
976- // directly, on the same physical chord, since that is what
977- // the platform hands the key handler.
978- b(ActionId::WalkCutNext, ".", false),
979- b(ActionId::WalkCutPrev, ",", false),
980- b(ActionId::WalkCutNext10, ">", false),
981- b(ActionId::WalkCutPrev10, "<", false),
982- // The mark pair, on the letters every editor already means them
983- // by: bare, since a mark is set as often as a step and nothing
984- // else in this table answers to either.
985- b(ActionId::SetIn, "i", false),
986- b(ActionId::SetOut, "o", false),
987- // The clear takes the ctrl chord: not a stroke to hit setting
988- // one mark and reaching for the other. Free -- "u" bare is the
989- // silence card, and nothing else in this table answers to
990- // ctrl+u.
991- b(ActionId::ClearRange, "u", true),
992- b(ActionId::Export, "e", false),
993- b(ActionId::Save, "s", true),
994- b(ActionId::Copy, "c", true),
995- b(ActionId::Paste, "v", true),
996- // Split, on the bare letter DESIGN.md §6 names for it: the
997- // burst-use command owns the cheap key (§11's frequency
998- // argument). Bare "c" moves to AddSubtitleLane below, which
999- // frees up cleanly since a subtitle track also opens on its
1000- // own initial: captions.
1001- b(ActionId::Cut, "s", false),
1002- // The two lane keys, on the letters they are named after: both
1003- // were free, and neither is next to a key that edits.
1004- b(ActionId::Regroup, "g", false),
1005- // The pair that takes a take apart and puts it back: "d" for
1006- // detach was free and is one press like the rest of the clip
1007- // keys, and grouping two clips is the "g" that rejoins a cut one
1008- // lane over -- the chord beside it, so the two read as one idea.
1009- b(ActionId::Detach, "d", false),
1010- b(ActionId::Group, "g", true),
1011- // Selection without a pointer. Tab is what a keyboard already
1012- // means by "move on to the next thing", and the two braces
1013- // are the pair either side of it in the lane -- shift+tab is
1014- // the obvious partner and is unspellable here, since a chord
1015- // carries only ctrl and `parse` refuses an uppercase key. Bare
1016- // brackets are DESIGN.md §6's own trim pair now, so selection
1017- // takes the braces the shifted brackets actually type: same
1018- // two keys, telling "walk the lane" apart from "trim the cut".
1019- b(ActionId::Select, "tab", false),
1020- // Same platform fact as the odometer above: shift+] never
1021- // arrives as shift+], it arrives as the key `}` (and shift+[
1022- // as `{`) -- bound on the literal the platform delivers.
1023- b(ActionId::SelectNext, "}", false),
1024- b(ActionId::SelectPrev, "{", false),
1025- // Select-all, on the chord every editor and every text field
1026- // already means it by -- which is why the audio-lane removal
1027- // below had to move off ctrl+a: a stroke that universal was
1028- // never really the removal's to keep.
1029- b(ActionId::SelectAll, "a", true),
1030- // Bare escape, last in the precedence chain behind every card,
1031- // search and fullscreen close (render.rs) -- just empties the
1032- // selection when nothing else claims the key.
1033- b(ActionId::Deselect, "escape", false),
1034- b(ActionId::Delete, "x", false),
1035- b(ActionId::Delete, "delete", false),
1036- b(ActionId::Lift, "l", false),
1037- // The c of colour is now AddSubtitleLane's (captions) and
1038- // ctrl+c is Copy, so the grade takes k: free, next to nothing
1039- // that edits, and one press like the
1040- // rest of the clip keys.
1041- b(ActionId::Color, "k", false),
1042- // The placement card takes the ctrl chord of the grade's own
1043- // key: the two sit beside each other on a clip and neither
1044- // steals a bare letter that already means something else.
1045- b(ActionId::Transform, "k", true),
1046- // The fit policy is a clip key like the grade beside it: "p" for
1047- // policy, free, and one press like the rest of them. The project
1048- // resolution is not a clip key and takes a ctrl chord, next to
1049- // nothing that edits and out of the way of a stray press --
1050- // it changes what every clip is composed onto.
1051- b(ActionId::Fit, "p", false),
1052- b(ActionId::Resolution, "r", true),
1053- // The zoom pair, on the chords every editor and every browser
1054- // magnifies with. The bare "=" and "-" are the volume keys, so
1055- // these take the ctrl versions of them -- and ctrl+0 is the
1056- // "back to 100%" of the same family, which here is the whole
1057- // timeline across the bed.
1058- b(ActionId::ZoomIn, "=", true),
1059- b(ActionId::ZoomOut, "-", true),
1060- b(ActionId::ZoomFit, "0", true),
1061- b(ActionId::Undo, "z", false),
1062- b(ActionId::Undo, "z", true),
1063- // Bare "y" is SubtitleStyle's, so redo takes only the ctrl
1064- // chord -- the conventional pairing with ctrl+z either way.
1065- b(ActionId::Redo, "y", true),
1066- // The unshifted initials of what they add. Both were free --
1067- // the copy and paste chords are the *ctrl* ones -- and a track
1068- // is added often enough to deserve a key that is one press.
1069- b(ActionId::AddVideoLane, "v", false),
1070- b(ActionId::AddAudioLane, "a", false),
1071- // ...and the pair that takes one back, on ctrl chords: removing
1072- // a track is not a stroke to hit by accident (the resolution key
1073- // is out of the way for the same reason). Ctrl+v would be the
1074- // matching initial and is the paste, so the video one takes the
1075- // key beside it.
1076- b(ActionId::RemoveVideoLane, "b", true),
1077- // Ctrl+a is the select-all above now, so the audio removal
1078- // takes the free key beside its own letter: "a" neighbours
1079- // "q" on the row, and ctrl+q was taken by nothing.
1080- b(ActionId::RemoveAudioLane, "q", true),
1081- // The subtitle pair reads the same way, on a different letter
1082- // now that bare "s" is split's (DESIGN.md §6): "c" is free
1083- // once split moves off it, and it is still an initial the
1084- // track answers to -- captions. The removal takes the other
1085- // letter subtitles already answer to here: "t" shows and
1086- // hides them, and ctrl+t takes one off the timeline.
1087- b(ActionId::AddSubtitleLane, "c", false),
1088- b(ActionId::RemoveSubtitleLane, "t", true),
1089- // Reading a file's tracks into the palette is not adding a
1090- // track to the timeline, so it is not the bare "s": ctrl+i, the
1091- // i of import, free and next to nothing that deletes.
1092- b(ActionId::ImportSubtitles, "i", true),
1093- // The dock's own import pair (MOCK-SPEC "Dock" IMPORT
1094- // section). Add files takes the chord the mock draws, ^o
1095- // (freed above): it is the burst-use command an editor
1096- // reaches for constantly, where the setting it displaces is
1097- // thrown once a project. Paste path stays off ^v -- that
crates/app/src/layout.rsmodified+169 -42
@@ -9,7 +9,12 @@ pub(crate) const GHOST_MIN: f32 = 2.;
9 9
10 /// Fixed so the video region takes every pixel the window gains and the controls10 /// Fixed so the video region takes every pixel the window gains and the controls
11 /// never clip at 640x360.11 /// never clip at 640x360.
12+#[cfg_attr(not(test), allow(dead_code))]
12 pub(crate) const HEADER_H: f32 = 32.;13 pub(crate) const HEADER_H: f32 = 32.;
14+
15+/// The menu bar across the top of the room, above the dock and the centre alike
16+/// (DESIGN §6.1). The room below it is the window less this.
17+pub(crate) const MENU_BAR_H: f32 = 28.;
13 // 28 button row + 24 scrub strip + two 48 lanes + the timecode line + the gaps18 // 28 button row + 24 scrub strip + two 48 lanes + the timecode line + the gaps
14 // between them, with a few px of slack so a taller text line cannot push a lane19 // between them, with a few px of slack so a taller text line cannot push a lane
15 // off the bottom. The window measures itself from [`timeline_h`] now, so this20 // off the bottom. The window measures itself from [`timeline_h`] now, so this
@@ -82,14 +87,6 @@ pub(crate) const KEYS_ROW_H: f32 = HIT_MIN;
82 /// the whole file. At `KEYS_W` every one of those wrapped to two lines, which is87 /// the whole file. At `KEYS_W` every one of those wrapped to two lines, which is
83 /// the card the user called unfriendly. Still inside the 640 px floor with the88 /// the card the user called unfriendly. Still inside the 640 px floor with the
84 /// scrim showing either side of it.89 /// scrim showing either side of it.
85-/// The export moment's height (the approved artboard's 200px): three rows,
86-/// never a scroll -- the card it replaced grew a capped, scrolling list.
87-/// Unchanged by the picture and sound readouts row 3 now carries (user
88-/// 2026-09-09: "resolution and audio bitrate should be seen in export menu
89-/// too"): measured at 1280 wide, the whole line still fits on one line, so
90-/// the row wraps only below this editor's own 640px floor.
91-pub(crate) const EXPORT_MOMENT_H: f32 = 200.;
92-
93 pub(crate) const EXPORT_W: f32 = 420.;90 pub(crate) const EXPORT_W: f32 = 420.;
94 91
95 /// The column a key is printed in, wide enough for `0-9` -- the width the92 /// The column a key is printed in, wide enough for `0-9` -- the width the
@@ -98,8 +95,8 @@ pub(crate) const EXPORT_KEY_W: f32 = 26.;
98 /// The menu a right-click on a clip opens: wide enough for the longest label95 /// The menu a right-click on a clip opens: wide enough for the longest label
99 /// beside the stroke that does the same thing, with the click targets `HIT_MIN`96 /// beside the stroke that does the same thing, with the click targets `HIT_MIN`
100 /// binds like every other list here.97 /// binds like every other list here.
101-pub(crate) const MENU_W: f32 = 260.;98+pub(crate) const MENU_W: f32 = 280.;
102-pub(crate) const MENU_ROW_H: f32 = HIT_MIN;99+pub(crate) const MENU_ROW_H: f32 = 28.;
103 pub(crate) const MENU_PAD: f32 = 6.;100 pub(crate) const MENU_PAD: f32 = 6.;
104 /// The breathing room a hanging menu keeps against every window edge. Without101 /// The breathing room a hanging menu keeps against every window edge. Without
105 /// it `menu_at`'s clamp let a menu sit flush on the bottom edge -- the last row102 /// it `menu_at`'s clamp let a menu sit flush on the bottom edge -- the last row
@@ -208,10 +205,37 @@ pub(crate) const TIMELINE_FIXED_H: f32 = 16. + 18. + 8. + RULER_HIT_H + 8. + 4.;
208 /// with it, out of every budget at once: a height still carrying the row would205 /// with it, out of every budget at once: a height still carrying the row would
209 /// hand it to the lane column as a bonus at exactly the zoom where the hand is206 /// hand it to the lane column as a bonus at exactly the zoom where the hand is
210 /// least expecting the bed to move.207 /// least expecting the bed to move.
208+// The strip's hit area is the one thing that must stay a target (WCAG 2.5.8),
209+// however thin its bar is drawn. Checked here because layout is where it is
210+// spent against the bar, and nothing else reads it at build time.
211+const _: () = assert!(SCROLL_HIT >= HIT_MIN && SCROLL_HIT > SCROLL_BAR_H);
212+
213+/// The scrollbar strip's whole row: 12px with the bar centred in it, so the
214+/// thumb's drawn bar and the layout's pixels are one number. Taller than the
215+/// bar needs so the hit band below can stand on the row and the bench's own
216+/// bottom padding, and never reach the ledger seam under the bench.
217+pub(crate) const SCROLL_ROW_H: f32 = 12.;
218+const _: () = assert!(SCROLL_ROW_H >= SCROLL_BAR_H);
219+
220+/// How far the strip's hit band reaches above the row, into the bottom of the
221+/// lanes. The most a scrollbar may take from them: 8px.
222+pub(crate) const SCROLL_HIT_UP: f32 = 8.;
223+/// How far it reaches below the row: the 4px bottom padding `ui::stance::bench`
224+/// gives the bench's content, which nothing else hits. The band never goes
225+/// past the bench's own bottom edge.
226+pub(crate) const SCROLL_HIT_DOWN: f32 = 4.;
227+// Together the band is a WCAG 2.5.8 target, and it takes no more than 8px
228+// from the lanes above the row.
229+const _: () = assert!(
230+ SCROLL_ROW_H + SCROLL_HIT_UP + SCROLL_HIT_DOWN >= HIT_MIN
231+ && SCROLL_HIT_UP <= 8.
232+ && SCROLL_HIT_DOWN <= 4.
233+);
234+
211 pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {235 pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {
212 TIMELINE_FIXED_H236 TIMELINE_FIXED_H
213 + match scroll {237 + match scroll {
214- true => 8. + SCROLL_HIT,238+ true => SCROLL_ROW_H,
215 false => 0.,239 false => 0.,
216 }240 }
217 }241 }
@@ -225,9 +249,24 @@ pub(crate) fn timeline_fixed_h(scroll: bool) -> f32 {
225 /// is left, which leaves the picture a region rather than a letterbox stripe.249 /// is left, which leaves the picture a region rather than a letterbox stripe.
226 pub(crate) const TIMELINE_SHARE: f32 = 171. / 360.;250 pub(crate) const TIMELINE_SHARE: f32 = 171. / 360.;
227 251
228-/// The edit toolbar directly above the timeline: one control's height in its252+/// One edit-toolbar button's height: a 32px target, above the 24px floor
229-/// own padding, fixed so nothing in it can push the timeline down.253+/// ([`HIT_MIN`]) with room for the word and its key (DESIGN §6.4).
230-pub(crate) const TOOLBAR_H: f32 = CONTROL_H + 16.;254+pub(crate) const TOOLBAR_BTN_H: f32 = 32.;
255+
256+/// The edit toolbar directly above the timeline: a button row and 6px of air
257+/// either side of it. Fixed, and spent once: `stance::bench()` takes it out of
258+/// the bench's own box, so the lanes get the rest and nothing is reserved twice.
259+pub(crate) const TOOLBAR_ROW_H: f32 = TOOLBAR_BTN_H + 8.;
260+
261+/// The strip of sequence tabs under the toolbar row (NLE-style): always there, so
262+/// opening a second sequence moves nothing. Part of [`TOOLBAR_H`].
263+pub(crate) const SEQ_BAR_H: f32 = 28.;
264+/// One sequence tab's height, inside the strip.
265+pub(crate) const SEQ_TAB_H: f32 = HIT_MIN;
266+
267+/// The whole region above the lanes: the button row and the sequence strip. Fixed, and spent
268+/// once: `stance::bench()` takes it out of the bench's own box, so the lanes get the rest.
269+pub(crate) const TOOLBAR_H: f32 = TOOLBAR_ROW_H + SEQ_BAR_H;
231 270
232 /// One press of a zoom key, or one notch of ctrl+wheel.271 /// One press of a zoom key, or one notch of ctrl+wheel.
233 pub(crate) const ZOOM_STEP: f32 = 1.25;272 pub(crate) const ZOOM_STEP: f32 = 1.25;
@@ -255,10 +294,10 @@ pub(crate) const PPS_MIN: f64 = 1.;
255 pub(crate) const ZOOM_OUT_MARGIN: f64 = 1.05;294 pub(crate) const ZOOM_OUT_MARGIN: f64 = 1.05;
256 295
257 /// How wide a second of timeline is drawn before anyone zooms: a five second296 /// How wide a second of timeline is drawn before anyone zooms: a five second
258-/// import is 200 px of a bed several times that, so a short clip reads as297+/// import is 300 px of a bed several times that, so a short clip reads as
259 /// short -- the thing a bed scaled to the content's own length cannot say.298 /// short -- the thing a bed scaled to the content's own length cannot say.
260 /// [`View::fit`] is the one way back to "the whole timeline across the bed".299 /// [`View::fit`] is the one way back to "the whole timeline across the bed".
261-pub(crate) const PPS_DEFAULT: f64 = 40.;300+pub(crate) const PPS_DEFAULT: f64 = 60.;
262 301
263 // -- the seams between the regions, and where a hand has dragged them ---------302 // -- the seams between the regions, and where a hand has dragged them ---------
264 303
@@ -310,23 +349,24 @@ pub(crate) const SPLIT_W: f32 = 6.;
310 349
311 /// How wide the same seam is *aimed at*. The strip above is what the layout350 /// How wide the same seam is *aimed at*. The strip above is what the layout
312 /// spends and the hairline is what the eye is given; this is the band the hand351 /// spends and the hairline is what the eye is given; this is the band the hand
313-/// gets, centred on the strip and overlaid on the two panels it parts, so352+/// gets, hung one row above the strip and overlaid on the two panels it parts,
314-/// growing it moves nothing. 6 px asked the hand for precision it does not353+/// so growing it moves nothing. 6 px asked the hand for precision it does not
315 /// have -- the lead's own press one row into the bench missed the seam by 5 px354 /// have -- the lead's own press one row into the bench missed the seam by 5 px
316 /// and focused the bench instead ("panes should be enlargable and shrinkable",355 /// and focused the bench instead ("panes should be enlargable and shrinkable",
317-/// of panes that already resized). 12 px is the ±6 px of aim every editor's356+/// of panes that already resized). 24 px is [`HIT_MIN`] (WCAG 2.5.8), the same
318-/// dividers allow, and it is hung one row above the strip rather than centred357+/// floor every pointer target holds (DESIGN §4.3). It is hung one row above the
319-/// on it: what a hand aims at is the line it can see (the panel's own edge at358+/// strip rather than centred on it: what a hand aims at is the line it can see
320-/// the strip's far side), not the six transparent pixels in front of it.359+/// (the panel's own edge at the strip's far side), not the transparent pixels
321-pub(crate) const GRAB_W: f32 = 14.;360+/// in front of it.
361+pub(crate) const GRAB_W: f32 = HIT_MIN;
322 362
323 /// The bench seam's own band. It used to be deeper than [`GRAB_W`] because363 /// The bench seam's own band. It used to be deeper than [`GRAB_W`] because
324 /// what lay under the seam was `ui::stance::bench`'s own section head -- 24 px364 /// what lay under the seam was `ui::stance::bench`'s own section head -- 24 px
325 /// with nothing in it to press, so the band reached down through it. That head365 /// with nothing in it to press, so the band reached down through it. That head
326 /// is gone (cleanse round 2): the ruler row is the bench's top edge now, and366 /// is gone (cleanse round 2): the ruler row is the bench's top edge now, and
327-/// the ruler *is* pressable (it scrubs), so a band reaching into it would take367+/// the ruler *is* pressable (it scrubs). Every seam now takes the same
328-/// presses meant for the film. Back to every other seam's reach: `-1 .. +13`368+/// [`GRAB_W`] band, so the bench reaches exactly as far as every other seam
329-/// of strip, `-7 .. +7` of the seam.369+/// does: `-1 .. +23` of strip, `-7 .. +17` of the seam.
330 pub(crate) const BENCH_GRAB_H: f32 = GRAB_W;370 pub(crate) const BENCH_GRAB_H: f32 = GRAB_W;
331 371
332 /// The most of the window one side column may be dragged to. A third each, so372 /// The most of the window one side column may be dragged to. A third each, so
@@ -335,6 +375,25 @@ pub(crate) const BENCH_GRAB_H: f32 = GRAB_W;
335 /// takes over.375 /// takes over.
336 pub(crate) const SIDE_MAX_FRAC: f32 = 1. / 3.;376 pub(crate) const SIDE_MAX_FRAC: f32 = 1. / 3.;
337 377
378+/// The least the dock may be dragged to (DESIGN §5: 280px). Its own floor,
379+/// not the legacy inspector's [`INSPECTOR_MIN_W`]: the two columns share a
380+/// ceiling but not a minimum.
381+pub(crate) const DOCK_MIN_W: f32 = 280.;
382+
383+/// The timeline block's untouched share of the window's height (DESIGN §5:
384+/// "about 42%"), from the edit toolbar down to the lanes. Clamped by
385+/// [`split_bounds`] like any other default, and a remembered hand still wins.
386+pub(crate) const BENCH_SHARE: f32 = redesign::TIMELINE_SHARE;
387+
388+/// The same, on a window shorter than 800 px (REDESIGN §2.2, §10): the picture keeps what the
389+/// 240 px floor leaves it and the timeline takes the rest, so four lanes show with the title row.
390+pub(crate) const BENCH_SHARE_SHORT: f32 = 0.55;
391+
392+/// The untouched timeline share for a window `h` px tall.
393+pub(crate) fn bench_share(h: f32) -> f32 {
394+ if h < 800. { BENCH_SHARE_SHORT } else { BENCH_SHARE }
395+}
396+
338 /// The most of the window the timeline may be dragged to. Past397 /// The most of the window the timeline may be dragged to. Past
339 /// [`TIMELINE_SHARE`], which is what it is *given*: a hand asking for a tall398 /// [`TIMELINE_SHARE`], which is what it is *given*: a hand asking for a tall
340 /// timeline is asking on purpose, and the picture still keeps most of a third.399 /// timeline is asking on purpose, and the picture still keeps most of a third.
@@ -371,20 +430,19 @@ const LEDGER_SEAM_CLEARANCE: f32 = 1.;
371 /// `bench-lanes` column asks for more height than `bench-content`'s flex_1430 /// `bench-lanes` column asks for more height than `bench-content`'s flex_1
372 /// gives it, and since that column scrolls rather than clips visibly, the431 /// gives it, and since that column scrolls rather than clips visibly, the
373 /// shortfall comes off the bottom row's own pixels unscrolled -- A1's432 /// shortfall comes off the bottom row's own pixels unscrolled -- A1's
374-/// clip-bar border and status dot, first. `LANE_MIN_H` itself is derived433+/// clip-bar border and status dot, first. Lanes are not even rows any more:
375-/// from what a lane head actually draws (its own doc comment), not a number434+/// each has its own height (`bench_stance::lane_height`), and a stack taller
376-/// copied from nowhere: an earlier floor of `82.` used a `LANE_MIN_H` of435+/// than the box just scrolls. The floor still gives the default two lanes
377-/// `18.` that fit only the lane label and let every lane's status dot436+/// their minimum, so V1 and A1 are whole at the least the bench may be.
378-/// overflow into the row beneath it, invisible everywhere but the last437+/// `LANE_MIN_H` is checked against what a lane head actually draws
379-/// lane, which has no next row to spill into and clipped straight into the438+/// (`a_lane_row_fits_what_its_own_head_draws`).
380-/// ledger instead.
381 ///439 ///
382 /// With the 18/15/14-13/12/10px type scale, the same derivation uses a 24px440 /// With the 18/15/14-13/12/10px type scale, the same derivation uses a 24px
383-/// chrome block and two 27px lane floors:441+/// chrome block and two 28px lane floors:
384-/// `24 + 22 + 2 + 54 + 2 + 1` = `105.`.442+/// `24 + 22 + 2 + 56 + 2 + 1` = `107.`.
385 pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H443 pub(crate) const BENCH_MIN_H: f32 = crate::ui::stance::BENCH_CHROME_H
386- + crate::ui::bench_stance::RULER_H444+ + TOOLBAR_H
387- + crate::ui::bench_stance::ROW_GAP445+ + crate::ui::bench_stance::overview::chrome_h(true)
388 + 2. * crate::ui::bench_stance::LANE_MIN_H446 + 2. * crate::ui::bench_stance::LANE_MIN_H
389 + crate::ui::bench_stance::ROW_GAP447 + crate::ui::bench_stance::ROW_GAP
390 + LEDGER_SEAM_CLEARANCE;448 + LEDGER_SEAM_CLEARANCE;
@@ -521,10 +579,9 @@ pub(crate) fn split_bounds(
521 match split {579 match split {
522 Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC),580 Split::Library => (LIBRARY_MIN_W, w * SIDE_MAX_FRAC),
523 Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC),581 Split::Inspector => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC),
524- // The dock is the darkroom's one side column -- same shape as the582+ // The dock is the darkroom's one side column: the same ceiling as the
525- // legacy inspector's, so it takes the legacy inspector's own floor583+ // legacy inspector, but its own floor ([`DOCK_MIN_W`]).
526- // and ceiling rather than a second pair that would only ever agree.584+ Split::Dock => (DOCK_MIN_W, w * SIDE_MAX_FRAC),
527- Split::Dock => (INSPECTOR_MIN_W, w * SIDE_MAX_FRAC),
528 // The bench is the darkroom's own timeline, but its ceiling is not585 // The bench is the darkroom's own timeline, but its ceiling is not
529 // [`Split::Timeline`]'s window-share one: a bench that swallows586 // [`Split::Timeline`]'s window-share one: a bench that swallows
530 // `TIMELINE_MAX_SHARE` of a 720p window leaves the screen and its587 // `TIMELINE_MAX_SHARE` of a 720p window leaves the screen and its
@@ -582,7 +639,7 @@ pub(crate) fn split_size(
582 Split::Inspector => inspector_w(w),639 Split::Inspector => inspector_w(w),
583 Split::Timeline => timeline_h(lanes, scroll).min(h * TIMELINE_SHARE),640 Split::Timeline => timeline_h(lanes, scroll).min(h * TIMELINE_SHARE),
584 Split::Dock => crate::ui::stance::DOCK_W,641 Split::Dock => crate::ui::stance::DOCK_W,
585- Split::Bench => crate::ui::stance::BENCH_H,642+ Split::Bench => h * bench_share(h),
586 };643 };
587 // The floor wins a window too small to honour both ends: a panel at its644 // The floor wins a window too small to honour both ends: a panel at its
588 // floor is still a panel, and `clamp` panics outright on a ceiling under645 // floor is still a panel, and `clamp` panics outright on a ceiling under
@@ -633,3 +690,73 @@ impl Player {
633 split_size(split, self.splits.get(split), lanes, window, scroll)690 split_size(split, self.splits.get(split), lanes, window, scroll)
634 }691 }
635 }692 }
693+
694+/// REDESIGN §1.2 / §2 geometry, the numbers later phases adopt region by region.
695+/// New names beside the old ones on purpose: P1 only defines them, P2 (timeline)
696+/// and P3 (chrome) switch their layouts over and then delete the legacy twins.
697+#[allow(dead_code, reason = "defined by P1, adopted by P2/P3")]
698+pub(crate) mod redesign {
699+ /// Grid and the spacers it allows.
700+ pub(crate) const GRID: f32 = 4.;
701+ pub(crate) const SPACERS: [f32; 7] = [2., 4., 8., 12., 16., 24., 32.];
702+ /// Control heights: field/scrub/chip/small button, default button/dropdown/tab,
703+ /// toolbar/primary button, hero button and the dock tab strip.
704+ pub(crate) const CONTROL_S: f32 = 24.;
705+ pub(crate) const CONTROL_M: f32 = 28.;
706+ pub(crate) const CONTROL_L: f32 = 32.;
707+ pub(crate) const CONTROL_XL: f32 = 36.;
708+ /// Radii: clips and thumbnails, buttons and fields, cards/menus/tooltips, sheets and palette.
709+ pub(crate) const R_CLIP: f32 = 3.;
710+ pub(crate) const R_CONTROL: f32 = 4.;
711+ pub(crate) const R_CARD: f32 = 6.;
712+ pub(crate) const R_SHEET: f32 = 8.;
713+ /// Shell regions, top to bottom (§2).
714+ pub(crate) const MENU_BAR_H: f32 = 28.;
715+ pub(crate) const VIEWER_HDR_H: f32 = 28.;
716+ /// Viewer header on a window shorter than 800 px.
717+ pub(crate) const VIEWER_HDR_H_SHORT: f32 = 24.;
718+ pub(crate) const TRANSPORT_H: f32 = 44.;
719+ pub(crate) const TRANSPORT_H_SHORT: f32 = 40.;
720+ pub(crate) const TOOLBAR_H: f32 = 40.;
721+ pub(crate) const SEQ_TABS_H: f32 = 28.;
722+ pub(crate) const OVERVIEW_H: f32 = 12.;
723+ pub(crate) const RULER_H: f32 = 24.;
724+ pub(crate) const STATUS_H: f32 = 24.;
725+ /// The timeline panel's own chrome: toolbar + sequence tabs + overview + ruler.
726+ pub(crate) const TIMELINE_CHROME_H: f32 = TOOLBAR_H + SEQ_TABS_H + OVERVIEW_H + RULER_H;
727+ /// Lane heights: video / audio, and on a window shorter than 800 px.
728+ pub(crate) const LANE_H_V: f32 = 52.;
729+ pub(crate) const LANE_H_A: f32 = 40.;
730+ pub(crate) const LANE_H_V_SHORT: f32 = 40.;
731+ pub(crate) const LANE_H_A_SHORT: f32 = 30.;
732+ /// Dock width (min 280), the default timeline share of the window and its clamps.
733+ pub(crate) const DOCK_W: f32 = 320.;
734+ pub(crate) const DOCK_MIN_W: f32 = 280.;
735+ pub(crate) const TIMELINE_SHARE: f32 = 0.46;
736+ pub(crate) const TIMELINE_MIN_H: f32 = 280.;
737+ pub(crate) const TIMELINE_MAX_SHARE: f32 = 0.70;
738+ pub(crate) const VIEWER_MIN_H: f32 = 240.;
739+ /// Popup rows: menus, command palette; menu width.
740+ pub(crate) const MENU_ROW_H: f32 = 28.;
741+ pub(crate) const PALETTE_ROW_H: f32 = 36.;
742+ pub(crate) const MENU_W: f32 = 280.;
743+
744+ #[cfg(test)]
745+ mod tests {
746+ use super::*;
747+
748+ /// §2: the timeline's own chrome is 104 px, every height sits on the 4 px grid,
749+ /// and the 1080p split leaves room for 3 video + 3 audio lanes.
750+ #[test]
751+ fn the_spec_heights_add_up() {
752+ assert_eq!(TIMELINE_CHROME_H, 104.);
753+ for h in [CONTROL_S, CONTROL_M, CONTROL_L, CONTROL_XL, MENU_BAR_H, VIEWER_HDR_H, TRANSPORT_H, TOOLBAR_H, SEQ_TABS_H, OVERVIEW_H, RULER_H, STATUS_H] {
754+ assert_eq!(h % GRID, 0., "{h} is off the grid");
755+ }
756+ let timeline = (1080. * TIMELINE_SHARE).round();
757+ let lanes = timeline - TIMELINE_CHROME_H - STATUS_H;
758+ assert!(lanes >= 3. * LANE_H_V + 3. * LANE_H_A - 80., "{lanes}");
759+ assert!((TIMELINE_MIN_H..=1080. * TIMELINE_MAX_SHARE).contains(&timeline));
760+ }
761+ }
762+}
crates/app/src/library_meta.rsmodified+177 -79
@@ -263,86 +263,169 @@ pub(crate) fn stream_detail(info: &StreamInfo) -> String {
263 parts.join(" ")263 parts.join(" ")
264 }264 }
265 265
266-/// What a file is coded at, for the properties cards: the rate of the whole266+/// How big a file is, for a person: the largest unit that keeps the figure to
267-/// file, then each track's own beside it. A component the container does not267+/// one decimal (`1.2 GB`, `840 MB`), bytes below a kilobyte.
268-/// state is left out for `stream_detail`'s reason -- a fabricated `0` would be268+pub(crate) fn size_human(bytes: u64) -> String {
269-/// saying something -- and a file that states none of the three says so rather269+ for (unit, per) in [("GB", 1e9), ("MB", 1e6), ("kB", 1e3)] {
270-/// than showing an empty row. `None` is the probe still running, which is a270+ if bytes as f64 >= per {
271-/// real wait: it walks a Matroska's clusters.271+ let n = bytes as f64 / per;
272-///272+ return match n >= 10. {
273-/// The whole file's rate is the one that carries the unit and no word: named273+ true => format!("{n:.0} {unit}"),
274-/// "total" as well, the line loses its last component to `MENU_W`'s truncation274+ false => format!("{n:.1} {unit}"),
275-/// on an ordinary 1080p file -- and a rate cut to "0.13 soun" is a number the275+ };
276-/// card did not give.276+ }
277-///277+ }
278-/// `tracks` is how many sound tracks the file has, from `probe_streams`. The278+ format!("{bytes} B")
279-/// rate is the one track this engine plays -- the first, neither their sum nor279+}
280-/// the biggest -- so a file with more says which of how many: a bare "0.16280+
281-/// sound" on a file whose name says AC3.5.1 names a track without saying it is281+/// A picture's height as a person names it: `1080p`, and `4K` for the 2160
282-/// one of two, and the card's Audio row above it may be describing the other.282+/// line, which is the one name people use for it.
283-///283+pub(crate) fn resolution_label(height: u32) -> String {
284-/// The marker costs the word "sound", the way the whole file's rate costs the284+ match height {
285-/// word "total" above, and for the same reason. Measured in Noto Sans 11 px285+ 2160 => "4K".to_string(),
286-/// against the 186 px this value has beside a "Bitrate" label: "0.16 sound 1/2"286+ h => format!("{h}p"),
287-/// wants 192 px on a 4.7 Mb/s film and 205 on the 39.8 Mb/s remux --287+ }
288-/// the marker is what gets cut, which is the one part of the line that is new.288+}
289-/// Nothing that keeps the word fits the wide files -- the shortest, "snd 1/2",289+
290-/// still wants 188 px on that remux -- so the word goes and the number keeps290+/// One stream's rate in the unit its size asks for: bits a second below a
291-/// the answer: "0.16 1 of 2" wants 172 px, and 185 on the widest line a291+/// kilobit, kilobits below a megabit, megabits above. One track's own rate, so
292-/// library can produce (the 10.9 Mb/s three-track film).292+/// there is no shared unit to keep across a line of them.
293-pub(crate) fn bitrate_detail(rate: Option<MediaBitrate>, tracks: usize) -> String {293+pub(crate) fn bits_label(bits: u64) -> String {
294- let Some(rate) = rate else {294+ match bits {
295- return "…".to_string();295+ 0..1_000 => format!("{bits} b/s"),
296- };296+ 1_000..1_000_000 => format!("{} kb/s", scaled(bits, 1_000.)),
297- let (per, unit) = rate_scale(rate);297+ _ => format!("{} Mb/s", scaled(bits, 1_000_000.)),
298+ }
299+}
300+
301+/// A picture track as the properties plate says it: codec, size, rate, depth
302+/// and its own bitrate, each left out where the file does not state it.
303+pub(crate) fn video_detail(video: &engine::VideoFacts, bitrate: Option<u64>) -> String {
304+ let mut parts = vec![video.codec.name().to_string()];
305+ if video.width > 0 && video.height > 0 {
306+ parts.push(format!("{}×{}", video.width, video.height));
307+ }
308+ if let Some(fps) = video.frame_rate {
309+ parts.push(format!("{} fps", crate::export_ui::fps_label(fps)));
310+ }
311+ if let Some(depth) = video.bit_depth {
312+ parts.push(format!("{depth}-bit"));
313+ }
314+ if let Some(bits) = bitrate {
315+ parts.push(bits_label(bits));
316+ }
317+ parts.join(" · ")
318+}
319+
320+/// A sound track as the properties plate says it: codec, rate, layout, depth
321+/// and its own bitrate. The codec is `"unknown"` only where the header will not
322+/// name it, which says nothing and is left out.
323+pub(crate) fn audio_detail(info: &StreamInfo) -> String {
298 let mut parts: Vec<String> = Vec::new();324 let mut parts: Vec<String> = Vec::new();
299- if let Some(total) = rate.total {325+ if !info.codec.is_empty() && info.codec != "unknown" {
300- // One unit for the three numbers, carried once, on the whole file's326+ parts.push(info.codec.clone());
301- // rate: the components are read against it.
302- parts.push(format!("{} {unit}", scaled(total, per)));
303- }
304- if let Some(video) = rate.video {
305- parts.push(format!("{} video", scaled(video, per)));
306- }
307- if let Some(audio) = rate.audio {
308- parts.push(match tracks > 1 {
309- true => format!("{} 1 of {tracks}", scaled(audio, per)),
310- false => format!("{} sound", scaled(audio, per)),
311- });
312 }327 }
313- match parts.is_empty() {328+ if info.sample_rate > 0 {
314- true => "not stated".to_string(),329+ parts.push(format!("{} kHz", f64::from(info.sample_rate) / 1000.));
315- false => parts.join(" · "),330+ }
331+ parts.extend(layout(info.channels));
332+ if let Some(depth) = info.bit_depth {
333+ parts.push(format!("{depth}-bit"));
334+ }
335+ if let Some(bits) = info.bitrate {
336+ parts.push(bits_label(bits));
316 }337 }
338+ parts.join(" · ")
317 }339 }
318 340
319-/// Below this a megabit's two decimals cannot state a rate, so the line is read341+/// What the properties plate says about a file, top to bottom: the file and its
320-/// in kilobits instead.342+/// path, its container and size, then one line per picture and sound track.
321-pub(crate) const MB_FLOOR: u64 = 10_000;343+/// Rows the probe has not answered for are simply not there -- the plate fills
344+/// in as the header reads, and never says "unknown".
345+pub(crate) fn file_properties(
346+ path: &Path,
347+ facts: Option<&engine::MediaFacts>,
348+ streams: &[StreamInfo],
349+ rate: Option<MediaBitrate>,
350+) -> Vec<(String, String)> {
351+ let mut out = vec![
352+ ("File".to_string(), file_name(path)),
353+ ("Path".to_string(), path.display().to_string()),
354+ ];
355+ if let Some(container) = facts.and_then(|f| f.container.clone()) {
356+ out.push(("Container".to_string(), container));
357+ }
358+ if let Some(bytes) = facts.and_then(|f| f.bytes) {
359+ out.push((
360+ "Size".to_string(),
361+ match rate.and_then(|r| r.total) {
362+ Some(total) => format!("{} · {}", size_human(bytes), bits_label(total)),
363+ None => size_human(bytes),
364+ },
365+ ));
366+ }
367+ if let Some(video) = facts.and_then(|f| f.video.as_ref()) {
368+ out.push((
369+ "Video".to_string(),
370+ video_detail(video, rate.and_then(|r| r.video)),
371+ ));
372+ }
373+ for info in streams {
374+ let label = match streams.len() > 1 {
375+ true => format!("Audio {} of {}", info.index + 1, streams.len()),
376+ false => "Audio".to_string(),
377+ };
378+ out.push((label, audio_detail(info)));
379+ }
380+ out
381+}
322 382
323-/// What the line counts in, and the name of it: the largest unit that can state383+/// The plate's Copy button: the full path on the clipboard, and a toast that
324-/// its *smallest* component, because that is the one a bigger unit rounds away.384+/// says so. Shared by both properties plates so the two cannot word it apart.
325-/// Megabits for everything a real file produces -- the smallest component over385+pub(crate) fn copy_path_button(path: &Path, cx: &mut Context<Player>) -> AnyElement {
326-/// an 18-file sweep of a library was 0.13 Mb/s -- kilobits for the sub-32x32386+ let text = path.display().to_string();
327-/// encodes below that.387+ control(
328-///388+ "properties-copy-path",
329-/// corner-cut: one unit for the whole line, so a file mixing a multi-megabit389+ 0.,
330-/// picture with a sub-10 kb/s sound track prints the picture as four or five390+ BG_RAISED(),
331-/// digits of kilobits and loses the line's tail to `MENU_W`. No such file391+ None,
332-/// exists in a library, and both units at once ("0.01 Mb/s · 1.2 kb/s video ·392+ "Copy",
333-/// 9.5 kb/s sound") wants 215 px of the 186 the row has. Upgrade path is a393+ "copies the full path of this file".to_string(),
334-/// suffix per component ("1.2k video"), which measures 177 px.394+ true,
335-pub(crate) fn rate_scale(rate: MediaBitrate) -> (f64, &'static str) {395+ cx.listener(move |this, _: &ClickEvent, _, cx| {
336- match [rate.total, rate.video, rate.audio]396+ cx.write_to_clipboard(gpui::ClipboardItem::new_string(text.clone()));
337- .into_iter()397+ this.notify_user("Path copied".into());
338- .flatten()398+ cx.notify();
339- .min()399+ }),
340- {400+ )
341- // A rate this small is a broken header rather than a track, but it is401+ .into_any_element()
342- // still a number the file stated, and bits state it.402+}
343- Some(bits) if bits < 10 => (1., "b/s"),403+
344- Some(bits) if bits < MB_FLOOR => (1_000., "kb/s"),404+impl Player {
345- _ => (1_000_000., "Mb/s"),405+ /// Read each source's header once for the properties plates: container,
406+ /// size, picture and track. Off the render thread like the bitrate probe
407+ /// beside it, and filled the same way -- presence means "asked", and the
408+ /// inner `None` is "asked, not answered yet".
409+ pub(crate) fn cache_facts(&mut self, cx: &mut Context<Self>) {
410+ let Some(session) = &self.session else {
411+ return;
412+ };
413+ for path in unseen_paths(session.sources(), &self.facts) {
414+ self.facts.insert(path.clone(), None);
415+ let probed = cx.background_executor().spawn({
416+ let path = path.clone();
417+ async move { engine::probe_media(&path) }
418+ });
419+ cx.spawn(async move |this, cx| {
420+ let probed = probed.await;
421+ this.update(cx, |this, cx| {
422+ this.facts.insert(path, Some(probed));
423+ cx.notify();
424+ })
425+ .ok();
426+ })
427+ .detach();
428+ }
346 }429 }
347 }430 }
348 431
@@ -350,11 +433,11 @@ pub(crate) fn rate_scale(rate: MediaBitrate) -> (f64, &'static str) {
350 /// two below -- a 128 kbps song rounded to one decimal is "0.1", which reads as433 /// two below -- a 128 kbps song rounded to one decimal is "0.1", which reads as
351 /// a guess where "0.13" reads as a measurement.434 /// a guess where "0.13" reads as a measurement.
352 ///435 ///
353-/// Never `0.00`: [`rate_scale`] picks the unit off the smallest component, so436+/// Never `0.00`: [`bits_label`] only asks for this in a unit where the number
354-/// two decimals always reach it. Every rate that gets here is one the container437+/// is at least 0.001 of it, so two decimals always reach it. Every rate that
355-/// really stated (the probe leaves out what it does not state, it never zeroes438+/// gets here is one the container really stated (the probe leaves out what it
356-/// it), and a "0.00 sound" would be this card saying a track that plays is439+/// does not state, it never zeroes it), and a "0.00 sound" would be this card
357-/// silent.440+/// saying a track that plays is silent.
358 pub(crate) fn scaled(bits: u64, per: f64) -> String {441 pub(crate) fn scaled(bits: u64, per: f64) -> String {
359 let n = bits as f64 / per;442 let n = bits as f64 / per;
360 match n >= 1. {443 match n >= 1. {
@@ -460,6 +543,21 @@ pub(crate) fn window_title(name: &str) -> String {
460 }543 }
461 }544 }
462 545
546+/// What the window is called once a project is in play: the same name the
547+/// header bar shows (`ui::menubar::bar`), so the title and the bar never
548+/// disagree. A project started or saved answers with its own name; an unsaved
549+/// one is "Untitled"; with no project at all the window keeps `name`, which is
550+/// the media's.
551+pub(crate) fn shown_title(name: &str, project: &Path, new_project: Option<&Path>, armed: bool) -> String {
552+ let project_name = match (project.as_os_str().is_empty(), new_project) {
553+ (_, Some(path)) => Some(crate::files::stem(path)),
554+ (true, None) => None,
555+ (false, None) if armed => Some(crate::files::stem(project)),
556+ (false, None) => Some("Untitled".to_string()),
557+ };
558+ window_title(&project_name.unwrap_or_else(|| name.to_string()))
559+}
560+
463 /// The tint a clip from source `n` wears. Cycled rather than extended: past the561 /// The tint a clip from source `n` wears. Cycled rather than extended: past the
464 /// palette two sources share a colour, which is a smaller lie than a fifth tint562 /// palette two sources share a colour, which is a smaller lie than a fifth tint
465 /// bright enough to leave the family.563 /// bright enough to leave the family.
crates/app/src/main.rsmodified+722 -54
@@ -1,24 +1,34 @@
1+#![forbid(unsafe_code)]
1 mod keymap;2 mod keymap;
2 mod player;3 mod player;
3 mod ui;4 mod ui;
4 5
6+mod creator;
5 mod audio_cards;7 mod audio_cards;
6 mod color_ui;8 mod color_ui;
7 mod eq_ui;9 mod eq_ui;
10+mod export_queue;
8 mod export_ui;11 mod export_ui;
9 mod files;12 mod files;
13+mod follow;
10 mod importing;14 mod importing;
11 mod interact;15 mod interact;
12 mod layout;16 mod layout;
13 mod library_meta;17 mod library_meta;
14 mod menus;18 mod menus;
19+mod recent;
20+mod open_hook;
15 mod notices;21 mod notices;
22+mod output_window;
16 mod oracle;23 mod oracle;
17 mod render;24 mod render;
18 mod subs;25 mod subs;
19 mod timeline_math;26 mod timeline_math;
27+mod titles;
20 mod transform_ui;28 mod transform_ui;
21 mod transport;29 mod transport;
30+mod view_state;
31+mod viewer_view;
22 mod viewport;32 mod viewport;
23 33
24 pub(crate) use audio_cards::*;34 pub(crate) use audio_cards::*;
@@ -48,7 +58,7 @@ use ui::widgets::*;
48 use keymap::{ActionId, Keymap};58 use keymap::{ActionId, Keymap};
49 59
50 use std::cell::Cell;60 use std::cell::Cell;
51-use std::collections::{HashMap, HashSet};61+use std::collections::{BTreeSet, HashMap, HashSet};
52 use std::path::{Path, PathBuf};62 use std::path::{Path, PathBuf};
53 use std::rc::Rc;63 use std::rc::Rc;
54 use std::sync::Arc;64 use std::sync::Arc;
@@ -59,7 +69,9 @@ use engine::audio::StreamInfo;
59 use engine::color::ColorParams;69 use engine::color::ColorParams;
60 use engine::decode::Backend;70 use engine::decode::Backend;
61 use engine::eq::{Band, BandKind, EqParams};71 use engine::eq::{Band, BandKind, EqParams};
62-use engine::export::{AUDIO_KBPS, DEFAULT_AUDIO_KBPS, EncoderSeat, ExportSettings, Format};72+use engine::export::{
73+ AUDIO_KBPS, DEFAULT_AUDIO_KBPS, EncoderSeat, ExportSettings, Format, HdrOutput, HdrTransfer, HevcSpeed, ProResProfile,
74+};
63 use engine::limiter::Limiter;75 use engine::limiter::Limiter;
64 use engine::project::{Edge, Lane, LaneKind, Source, Speed, SubClip};76 use engine::project::{Edge, Lane, LaneKind, Source, Speed, SubClip};
65 use engine::scale::FitPolicy;77 use engine::scale::FitPolicy;
@@ -71,17 +83,40 @@ use gpui::{
71 DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent, MouseExitEvent,83 DragMoveEvent, FocusHandle, KeyDownEvent, MouseButton, MouseDownEvent, MouseExitEvent,
72 MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta,84 MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, Point, RenderImage, ScrollDelta,
73 ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, TitlebarOptions,85 ScrollHandle, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, TitlebarOptions,
74- Window, WindowBounds, WindowOptions, canvas, div, point, prelude::*, px, relative, rgb, rgba,86+ DisplayId, Window, WindowBounds, WindowHandle, WindowOptions, canvas, div, point, prelude::*, px,
75- size,87+ relative, rgb, rgba, size,
76 };88 };
77 89
90+/// The export probe's answer: the settings, the canvas, the cuts, and the
91+/// picture's seat (if any) plus the sound's.
92+type ExportSeat = (
93+ ExportSettings,
94+ (u32, u32),
95+ Vec<Clip>,
96+ Option<(Option<&'static str>, &'static str)>,
97+);
98+
99+/// A gap picked on a lane: the empty stretch `start..start + frames` that
100+/// Delete closes (DESIGN §7). Held beside [`Player::selected`] and not in it,
101+/// since a gap owns no clip index. Checked against the timeline before every
102+/// use ([`Player::gap_pick`]): an edit or an undo that moves the hole drops it.
103+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
104+pub(crate) struct GapPick {
105+ pub(crate) lane: Lane,
106+ pub(crate) start: u32,
107+ pub(crate) frames: u32,
108+}
109+
110+/// The lane beds' boxes, in lane order.
111+type LaneBeds = Vec<(Lane, Bounds<Pixels>)>;
112+
78 struct Player {113 struct Player {
79 /// The timeline, once there is one. A run with no file opens without it and114 /// The timeline, once there is one. A run with no file opens without it and
80 /// waits: the first media import or project load is what fills it, and115 /// waits: the first media import or project load is what fills it, and
81 /// until then every action that needs a timeline says so instead of acting.116 /// until then every action that needs a timeline says so instead of acting.
82 session: Option<PlaybackSession>,117 session: Option<PlaybackSession>,
83 /// A resolution and/or frame rate picked before any file exists to derive118 /// A resolution and/or frame rate picked before any file exists to derive
84- /// them from -- what [`Player::cycle_resolution`] and its fps sibling edit119+ /// them from -- what the resolution and rate lists edit
85 /// instead of refusing, with nothing open yet. Applied as the explicit120 /// instead of refusing, with nothing open yet. Applied as the explicit
86 /// override [`engine::PlaybackSession::set_resolution`]/`set_frame_rate`121 /// override [`engine::PlaybackSession::set_resolution`]/`set_frame_rate`
87 /// already are for a `.edith`'s own saved values ([`Player::install_media`])122 /// already are for a `.edith`'s own saved values ([`Player::install_media`])
@@ -89,6 +124,11 @@ struct Player {
89 /// the way a project's own saved settings are read once at124 /// the way a project's own saved settings are read once at
90 /// [`engine::PlaybackSession::open_project`].125 /// [`engine::PlaybackSession::open_project`].
91 pending_settings: (Option<(u32, u32)>, Option<f64>, Option<u32>),126 pending_settings: (Option<(u32, u32)>, Option<f64>, Option<u32>),
127+ /// The template a project started by File > New from template takes its lanes, names, caption
128+ /// style and export preset from, when its first footage arrives.
129+ pending_template: Option<String>,
130+ /// The welcome screen's From template list is open.
131+ welcome_templates: bool,
92 /// A library row's own file, opened and playing in place of the132 /// A library row's own file, opened and playing in place of the
93 /// timeline's picture, and never written to `session` or its undo stack:133 /// timeline's picture, and never written to `session` or its undo stack:
94 /// a preview is watched, not edited. `Some` is what [`Player::pump`] and134 /// a preview is watched, not edited. `Some` is what [`Player::pump`] and
@@ -100,6 +140,24 @@ struct Player {
100 /// ([`Player::open_preview`] pauses it so the two sounds never overlap):140 /// ([`Player::open_preview`] pauses it so the two sounds never overlap):
101 /// what [`Player::close_preview`] resumes, and only then.141 /// what [`Player::close_preview`] resumes, and only then.
102 preview_playing: bool,142 preview_playing: bool,
143+ /// In/out marks on library items, in seconds of the file and keyed by the
144+ /// row's `(file, audio stream)`: what `I`/`O` set while a preview is up
145+ /// ([`Player::mark_source`]) and what the three-point edit reads
146+ /// ([`Player::source_edit`]). Not saved with the project.
147+ source_marks: HashMap<(PathBuf, usize), (Option<f64>, Option<f64>)>,
148+ /// The library item the source edits act on: the one being previewed, or
149+ /// the last one that was.
150+ source_target: Option<(PathBuf, usize)>,
151+ /// The Source pill was pressed with nothing opened yet: the viewer says how to open a clip.
152+ source_hint: bool,
153+ /// Which halves of the source monitor's item an insert or overwrite
154+ /// places: the picture, the sound. Both on whenever a source opens.
155+ source_video: bool,
156+ source_audio: bool,
157+ /// The source patch (Premiere's V and A boxes on the lane heads): the video and audio lanes
158+ /// the source monitor's picture and sound go to on Insert and Overwrite. V1 and A1 at start.
159+ patch_video: Lane,
160+ patch_audio: Lane,
103 /// The picture alone, filling the window -- what `Fullscreen` gives every161 /// The picture alone, filling the window -- what `Fullscreen` gives every
104 /// consumer video player, and not what gpui's own `toggle_fullscreen`162 /// consumer video player, and not what gpui's own `toggle_fullscreen`
105 /// gives on its own (the OS window, chrome and all). Kept apart from163 /// gives on its own (the OS window, chrome and all). Kept apart from
@@ -129,6 +187,17 @@ struct Player {
129 fps: f64,187 fps: f64,
130 name: SharedString,188 name: SharedString,
131 image: Option<Arc<RenderImage>>,189 image: Option<Arc<RenderImage>>,
190+ /// Frames the viewer has replaced and must drop from every window's sprite
191+ /// atlas. Dropped from `Player::render`, which is the one place that can
192+ /// reach every window: the output window shows the same picture.
193+ retired_images: Vec<Arc<RenderImage>>,
194+ /// The video output window, while it is open (View > Video output window).
195+ /// Session state only: never saved in a project.
196+ output: Option<WindowHandle<output_window::OutputView>>,
197+ /// The display the output window goes to; `None` is the primary one.
198+ output_display: Option<DisplayId>,
199+ /// The displays as the View menu lists them this frame, in order, with their names.
200+ output_displays: Vec<(DisplayId, SharedString)>,
132 /// The picture of the bitmap cue on screen, and which cue that is: the201 /// The picture of the bitmap cue on screen, and which cue that is: the
133 /// track it is a row of and where it starts on the timeline. A PGS display202 /// track it is a row of and where it starts on the timeline. A PGS display
134 /// set is run-length and has to be walked into a canvas-sized buffer to be203 /// set is run-length and has to be walked into a canvas-sized buffer to be
@@ -157,6 +226,11 @@ struct Player {
157 /// The ruler's own box, recorded at prepaint: a mouse listener is handed226 /// The ruler's own box, recorded at prepaint: a mouse listener is handed
158 /// the window position and nothing else.227 /// the window position and nothing else.
159 ruler: Rc<Cell<Bounds<Pixels>>>,228 ruler: Rc<Cell<Bounds<Pixels>>>,
229+ /// Each lane bed's box, recorded at prepaint like the ruler's: the box
230+ /// select reads which lanes a pointer rectangle crosses off it.
231+ lane_beds: Rc<std::cell::RefCell<LaneBeds>>,
232+ /// A box select in flight, pressed on empty bed ([`Marquee`]).
233+ marquee: Option<Marquee>,
160 /// The scrollbar track's laid-out box, recorded at prepaint like the234 /// The scrollbar track's laid-out box, recorded at prepaint like the
161 /// ruler's: a thumb drag is followed on the root (the pointer leaves the235 /// ruler's: a thumb drag is followed on the root (the pointer leaves the
162 /// strip at once), and the root has only window coordinates to work with.236 /// strip at once), and the root has only window coordinates to work with.
@@ -183,6 +257,34 @@ struct Player {
183 /// the head is on screen again, and by every transport ask (a seek, a257 /// the head is on screen again, and by every transport ask (a seek, a
184 /// play/pause) outright -- those are a person saying where to look.258 /// play/pause) outright -- those are a person saying where to look.
185 panned: bool,259 panned: bool,
260+ /// A fit asked for before the bed was measured ([`Player::zoom_fit`]): the
261+ /// bed is only known once the timeline has been painted, and a fit taken
262+ /// against no bed would fall back to the default scale. Consumed by
263+ /// [`Render`] on the first frame that has one.
264+ fit_pending: bool,
265+ /// The bed width the last fit was worked out for, while the view is still
266+ /// that fit: [`Render`] refits when the bed has a different width, and a
267+ /// hand's zoom or scroll sets it back to `None`, which keeps the view the
268+ /// hand chose through a resize. `None` for a view nobody fitted.
269+ fitted_bed: Option<f32>,
270+ /// Each lane's height by its key ("v1", "a2"), as a hand left it. Kept with
271+ /// the scale in [`view_state`] so a reopened project gets its lanes back.
272+ lane_h: Vec<(String, f32)>,
273+ /// The viewer's zoom, playback quality, guides and mask ([`viewer_view`]); view state, saved
274+ /// with the project's view and never part of the project or an export.
275+ viewer: viewer_view::Prefs,
276+ /// How far the zoomed picture is dragged from centred, in logical pixels.
277+ viewer_pan: (f32, f32),
278+ /// The pointer of a pan drag in progress, where it last was.
279+ viewer_drag: Option<Point<Pixels>>,
280+ /// A drag on the selected clip's picture or its corners, while one is held.
281+ viewer_handle: Option<viewer_view::ViewerHandle>,
282+ /// Where the viewer header's four controls paint, so their lists hang from them.
283+ viewer_btns: [Rc<Cell<Bounds<Pixels>>>; 4],
284+ /// The lane whose bottom edge is being dragged, with the grab that turns
285+ /// the pointer's y into its height (see `interact::lane_resize_band`).
286+ /// `None` when no edge is held.
287+ lane_resize: Option<(Lane, f32)>,
186 /// Which placements the edit keys act on: the lane each is in and its288 /// Which placements the edit keys act on: the lane each is in and its
187 /// index there, every ctrl-click in the order it was made. The *clicked*289 /// index there, every ctrl-click in the order it was made. The *clicked*
188 /// half and not the group -- a group is what gets marked on screen, but290 /// half and not the group -- a group is what gets marked on screen, but
@@ -190,10 +292,37 @@ struct Player {
190 /// [`anchor`](Selection::anchor) every single-thing action uses. Indices292 /// [`anchor`](Selection::anchor) every single-thing action uses. Indices
191 /// move under every edit, so this is cleared by all of them.293 /// move under every edit, so this is cleared by all of them.
192 selected: Selection,294 selected: Selection,
295+ /// The gap a click picked, if one is (DESIGN §7). Mutually exclusive with
296+ /// `selected`: a gap pick clears the clip marks, and a live clip mark hides
297+ /// the gap ([`Player::gap_pick`]).
298+ gap: Option<GapPick>,
193 /// The clip menu a right-click opened, if one is up. Holds an index like299 /// The clip menu a right-click opened, if one is up. Holds an index like
194 /// `selected` does, so it is closed by anything that can move indices --300 /// `selected` does, so it is closed by anything that can move indices --
195 /// every stroke, and every item of its own.301 /// every stroke, and every item of its own.
196 context_menu: Option<ContextMenu>,302 context_menu: Option<ContextMenu>,
303+ /// The menu-bar dropdown that is open, if one is (DESIGN §6.1). Closed by
304+ /// esc, a press below the bar, or running one of its rows.
305+ menu_open: Option<ui::menubar::Title>,
306+ /// The title a hover switched the open menu to: the click that follows on
307+ /// it keeps that menu open (a switch) instead of toggling it shut.
308+ menu_hopped: Option<ui::menubar::Title>,
309+ /// The flyout open beside the menu bar's plate: its title and the group's name.
310+ menu_sub: Option<(ui::menubar::Title, &'static str)>,
311+ /// A second flyout, beside the first: a list-row inside a group (Picture fit under Adjust).
312+ /// Drawn only while the first one is the group it hangs from.
313+ menu_sub2: Option<(ui::menubar::Title, &'static str)>,
314+ /// Where the status bar's size, rate and clip readout paint: what a shortcut-opened list hangs from.
315+ ledger_readout: Rc<Cell<Bounds<Pixels>>>,
316+ /// Where the status bar's toast text paints: its width is how much of the message fits.
317+ toast_text: Rc<Cell<Bounds<Pixels>>>,
318+ /// The clip menu's Adjust row has the pointer: the 150 ms timer opens the
319+ /// submenu only if it still does.
320+ adjust_hot: bool,
321+ /// Where the pointer came onto the Adjust row, and the submenu's near edge
322+ /// `(x, top, bottom)` (written while drawing): together the "safe triangle"
323+ /// a diagonal move toward the submenu may cross without closing it.
324+ adjust_aim: Option<Point<Pixels>>,
325+ adjust_sub: Cell<Option<(f32, f32, f32)>>,
197 /// The choice list a click on an enumerated setting opened, if one is up:326 /// The choice list a click on an enumerated setting opened, if one is up:
198 /// the project resolution or a clip's fit policy, every value on screen at327 /// the project resolution or a clip's fit policy, every value on screen at
199 /// once. Closed by anything that closes the menus, and for the same reason.328 /// once. Closed by anything that closes the menus, and for the same reason.
@@ -207,6 +336,12 @@ struct Player {
207 /// rebuilt. Its own selection and not the timeline's: Delete keeps acting336 /// rebuilt. Its own selection and not the timeline's: Delete keeps acting
208 /// on the clip that was clicked in a lane, whatever the library is showing.337 /// on the clip that was clicked in a lane, whatever the library is showing.
209 selected_asset: Option<(PathBuf, usize)>,338 selected_asset: Option<(PathBuf, usize)>,
339+ /// Library rows picked together (ctrl-click) for a multicam clip; empty means just `selected_asset`.
340+ asset_picks: Vec<(PathBuf, usize)>,
341+ /// The angle monitor is shown beside the program picture ([`Player::angle_monitor_view`]).
342+ angle_monitor: bool,
343+ /// The monitor's composed tiles.
344+ angle_shots: player::multicam::AngleShots,
210 /// Which category of the library is being looked at. A tab and not a345 /// Which category of the library is being looked at. A tab and not a
211 /// filter box: the categories are what the media *is*, and every editor346 /// filter box: the categories are what the media *is*, and every editor
212 /// this one is measured against splits its pool the same way.347 /// this one is measured against splits its pool the same way.
@@ -244,6 +379,108 @@ struct Player {
244 /// they are *played* is the session's own -- it is the project's and is379 /// they are *played* is the session's own -- it is the project's and is
245 /// saved with it, where this map is this window's view of the cache.380 /// saved with it, where this map is this window's view of the cache.
246 proxies: HashMap<PathBuf, Proxy>,381 proxies: HashMap<PathBuf, Proxy>,
382+ /// The render preview being made and the frames it covers ([`player::render_cache`]).
383+ render: Option<(engine::render_cache::Job, (u32, u32))>,
384+ /// The ruler's render bar, and the key ([`Player::refresh_render_bands`]) it was worked out at.
385+ render_bands: Vec<player::render_cache::RenderBand>,
386+ render_bands_stamp: Option<(u64, u32, usize)>,
387+ /// The render being made, as the frames it covers and how far it has got.
388+ render_progress: Option<((u32, u32), f32)>,
389+ /// The stabilisation analyses this window started and is waiting on, as
390+ /// (source, first file frame, end): polled each frame, and the picture is
391+ /// redrawn when one lands ([`engine::stabilise`]).
392+ stab_waiting: Vec<(PathBuf, u32, u32)>,
393+ /// The mask tracks running or waiting to be written onto their masks, polled each frame
394+ /// ([`Player::poll_tracks`]).
395+ track_jobs: Vec<engine::playback::TrackJob>,
396+ /// The auto reframe being measured, if one is ([`Player::start_reframe`]).
397+ reframe_run: Option<player::cards::ReframeRun>,
398+ /// The last auto reframe that landed: its lane, clip and how many keys it wrote, so the
399+ /// Transform card can say the exact count for that clip ([`Player::poll_reframe`]).
400+ reframed: Option<(Lane, usize, usize)>,
401+ /// Angles being synced for a multicam clip ([`Player::create_multicam_selected`]).
402+ mcam_run: Option<player::multicam::McamRun>,
403+ /// The sequences compound clips were opened from, outermost first: Back pops one
404+ /// ([`Player::close_compound`]). A tab click starts the trail over.
405+ seq_trail: Vec<u32>,
406+ /// The open sequence's name being retyped on its tab, which owns the keyboard while it
407+ /// is `Some` ([`Player::seq_edit_key`]).
408+ seq_edit: Option<player::text_field::TextField>,
409+ /// A track's name being retyped on its head, which owns the keyboard while it is `Some`
410+ /// ([`Player::lane_edit_key`]).
411+ lane_edit: Option<(Lane, player::text_field::TextField)>,
412+ /// The transport timecode retyped as a time (Go to time), which owns the keyboard while it is
413+ /// `Some` ([`Player::time_edit_key`]). A click elsewhere cancels it ([`Player::blur_text_fields`]).
414+ time_edit: Option<player::text_field::TextField>,
415+ /// The compare view (View > Compare grade); preview only, never exported.
416+ compare: viewer_view::Compare,
417+ /// The picture as shot at [`Player::before_at`], the other half of the compare view.
418+ before: Option<Arc<RenderImage>>,
419+ /// The timeline frame `before` shows; `None` when it has to be read again.
420+ before_at: Option<u32>,
421+ /// A read of the picture as shot is in flight.
422+ before_busy: bool,
423+ /// The frame the pump last drew: its timeline index and pixel size.
424+ shown_frame: Option<(u32, u32, u32)>,
425+ /// The colour card's Looks dropdown is open.
426+ look_open: bool,
427+ /// Saved look names, read when the dropdown opens and after a save.
428+ saved_looks: Vec<String>,
429+ /// The name typed for "Save current as look…", while it is being typed.
430+ look_name: Option<player::text_field::TextField>,
431+ /// The look last applied to a clip, for the Looks row's name.
432+ look_mark: Option<player::grading::LookMark>,
433+ /// The bins the media list shows folded ([`Player::toggle_bin_open`]); kept while the project is open.
434+ collapsed_bins: std::collections::HashSet<u32>,
435+ /// Which Clip-tab sections are open per clip kind ([`player::sections`]), as the view file keeps them.
436+ sections_mem: Vec<(String, Vec<String>)>,
437+ /// The clip the sections were last synced to; a different one re-opens the remembered sections.
438+ sections_anchor: Option<(Lane, usize)>,
439+ /// The bin picked in the media list, if one is (what Rename bin and Remove bin act on).
440+ selected_bin: Option<u32>,
441+ /// A bin's name being retyped on its row, which owns the keyboard while it is `Some`
442+ /// ([`Player::bin_edit_key`]).
443+ bin_edit: Option<(u32, player::text_field::TextField)>,
444+ /// The title selected for editing, as an index into the session's titles; it shows in the
445+ /// Clip tab while no clip is selected ([`Player::title_target`]).
446+ title_sel: Option<usize>,
447+ /// The words of that title while its text field has the keyboard, which it owns while it is
448+ /// `Some` ([`Player::title_key`]). Written to the project when the field is left.
449+ title_draft: Option<player::text_field::TextField>,
450+ /// A colour of the selected title being typed as hex (the letters' or the box's), which owns
451+ /// the keyboard while it is `Some`; written to the project when the field is left.
452+ title_hex: Option<(player::titling::HexTarget, player::text_field::TextField)>,
453+ /// The hex of a shape's fill or stroke being typed in the Generator card.
454+ gen_hex: Option<(player::generators::GenPaint, player::text_field::TextField)>,
455+ /// A number of the Generator card being scrubbed: shown live, written on release.
456+ gen_scrub: Option<player::generators::GenScrub>,
457+ /// The Transform card's Deinterlace list is open.
458+ deinterlace_open: bool,
459+ /// The Transform card's Place list is open.
460+ place_open: bool,
461+ /// The Title card's Entrance and Exit lists are open.
462+ title_in_open: bool,
463+ title_out_open: bool,
464+ /// The index of the effect whose Blend mode list is open on the Effects card.
465+ effects_mode_open: Option<usize>,
466+ /// The EQ card's band Shape list is open.
467+ eq_shape_open: bool,
468+ /// The Clip tab's Transition Kind list is open.
469+ transition_kind_open: bool,
470+ /// The Clip tab's Transition section is folded open.
471+ transition_section_open: bool,
472+ /// The Custom accent's hex being typed in Settings, which owns the keyboard while it is `Some`;
473+ /// each valid edit is in force at once and the file is written when the field is left.
474+ accent_hex: Option<player::text_field::TextField>,
475+ /// The Vivid or hue slider under the hand, and the two tracks' boxes ([`frac_along`]).
476+ accent_drag: Option<player::accent::AccentSlider>,
477+ accent_vivid_bar: Rc<Cell<Bounds<Pixels>>>,
478+ accent_hue_bar: Rc<Cell<Bounds<Pixels>>>,
479+ /// A scrub of one of the selected title's numbers, or a move of its block on the timeline,
480+ /// in flight: shown live, written as one undo step on release.
481+ title_scrub: Option<player::titling::TitleScrub>,
482+ /// A pan field of the Mix section being scrubbed: shown live, written on release.
483+ pan_scrub: Option<player::pan::PanScrub>,
247 /// Which audio streams each imported file has, as its header describes484 /// Which audio streams each imported file has, as its header describes
248 /// them: one library row per entry. Keyed and filled like `waves` --485 /// them: one library row per entry. Keyed and filled like `waves` --
249 /// presence means "asked" -- and an empty list is a silent file, which is486 /// presence means "asked" -- and an empty list is a silent file, which is
@@ -255,6 +492,11 @@ struct Player {
255 /// yet", which the card draws as an ellipsis: the probe walks a Matroska's492 /// yet", which the card draws as an ellipsis: the probe walks a Matroska's
256 /// clusters, so a big film answers in seconds rather than at once.493 /// clusters, so a big film answers in seconds rather than at once.
257 bitrates: HashMap<PathBuf, Option<MediaBitrate>>,494 bitrates: HashMap<PathBuf, Option<MediaBitrate>>,
495+ /// What each source's header says about its container, size and picture
496+ /// ([`engine::probe_media`]), probed once and kept for the properties
497+ /// plates. Filled like `bitrates`: presence means "asked", and the inner
498+ /// `None` is "asked, not answered yet".
499+ facts: HashMap<PathBuf, Option<engine::MediaFacts>>,
258 /// How big each still source's picture is, read from its header once and500 /// How big each still source's picture is, read from its header once and
259 /// kept -- what a library row and its card say about a file that has no501 /// kept -- what a library row and its card say about a file that has no
260 /// streams to describe. Filled like `streams`: presence means "asked", and502 /// streams to describe. Filled like `streams`: presence means "asked", and
@@ -293,12 +535,7 @@ struct Player {
293 /// opens a real VA-API encoder (~100 ms) and reads every source's header,535 /// opens a real VA-API encoder (~100 ms) and reads every source's header,
294 /// so it runs off the render thread and only while the export card is up.536 /// so it runs off the render thread and only while the export card is up.
295 /// The inner `None` is "asked, not answered yet".537 /// The inner `None` is "asked, not answered yet".
296- export_seat: Option<(538+ export_seat: Option<ExportSeat>,
297- ExportSettings,
298- (u32, u32),
299- Vec<Clip>,
300- Option<(Option<&'static str>, &'static str)>,
301- )>,
302 /// What this machine's GPU decodes and encodes, as the plugin answered it:539 /// What this machine's GPU decodes and encodes, as the plugin answered it:
303 /// asked once, off the render thread like `export_seat` and for the same540 /// asked once, off the render thread like `export_seat` and for the same
304 /// reason (a VA-API init), and kept for the life of the process because the541 /// reason (a VA-API init), and kept for the life of the process because the
@@ -311,6 +548,8 @@ struct Player {
311 /// way [`Player::paste`] drops the set at the playhead keeping the gaps548 /// way [`Player::paste`] drops the set at the playhead keeping the gaps
312 /// and lanes between its members intact.549 /// and lanes between its members intact.
313 clipboard: Vec<(Lane, Clip)>,550 clipboard: Vec<(Lane, Clip)>,
551+ /// What the last copy remembers of the clip's look, for Paste attributes.
552+ copied_look: Option<crate::player::editkeys::CopiedLook>,
314 /// A drag that started on the ruler. Moves anywhere in the window scrub553 /// A drag that started on the ruler. Moves anywhere in the window scrub
315 /// while it is set; the release commits the exact position.554 /// while it is set; the release commits the exact position.
316 scrubbing: bool,555 scrubbing: bool,
@@ -322,14 +561,40 @@ struct Player {
322 /// A drag that started on a divider, tracked on the root for `scrubbing`'s561 /// A drag that started on a divider, tracked on the root for `scrubbing`'s
323 /// reason -- the strip is 6 px and the pointer leaves it at once.562 /// reason -- the strip is 6 px and the pointer leaves it at once.
324 split_drag: Option<Split>,563 split_drag: Option<Split>,
564+ /// Where the seam was pressed and whether the pointer has since gone far enough
565+ /// to call it a drag: a click that never moves changes and saves nothing.
566+ split_press: Option<(Point<Pixels>, bool)>,
325 /// A drag that started on a clip's edge, tracked on the root for567 /// A drag that started on a clip's edge, tracked on the root for
326 /// `scrubbing`'s reason: a 6 px strip is not where the pointer stays. See568 /// `scrubbing`'s reason: a 6 px strip is not where the pointer stays. See
327 /// [`Trim`].569 /// [`Trim`].
328 trim: Option<Trim>,570 trim: Option<Trim>,
571+ /// A shift-drag roll, slip or slide in flight, tracked on the root for
572+ /// `trim`'s reason. See [`ProDrag`].
573+ pro_drag: Option<ProDrag>,
574+ /// The clip under the pointer and the modifiers held over it, for the
575+ /// status bar's line on what a drag there would do
576+ /// ([`crate::ui::bench_stance::clip::drag_status`]). `None` off every clip.
577+ hover_hint: Option<crate::ui::bench_stance::clip::DragHover>,
578+ /// The media-wall stop the dragged edge is pinned against, while it is
579+ /// pinned: the handle flashes warn for [`TRIM_FLASH`] at the first sample
580+ /// that holds there, and no later one re-arms it. `None` once the pointer
581+ /// comes back inside the room, and between trims.
582+ trim_flash: Option<TrimFlash>,
583+ /// The clip a move is carrying, by the lane and index its press named it
584+ /// under: drawn dimmed in place until the drop or the release lets it go.
585+ /// `None` between drags.
586+ drag_src: Option<(Lane, usize)>,
329 /// A drag that started on a fade handle, tracked on the root for the same587 /// A drag that started on a fade handle, tracked on the root for the same
330 /// reason a trim is: a 10 px square is not where the pointer stays. See588 /// reason a trim is: a 10 px square is not where the pointer stays. See
331 /// [`FadeDrag`].589 /// [`FadeDrag`].
332 fade_drag: Option<FadeDrag>,590 fade_drag: Option<FadeDrag>,
591+ /// A drag on a clip's volume envelope: a key or the line between two keys. See [`GainEdit`].
592+ gain_edit: Option<crate::interact::GainEdit>,
593+ /// The envelope key the pointer is over, as `(lane, clip, key)`, which is what the cursor and
594+ /// the line's own hover read.
595+ gain_hover: Option<(Lane, usize, crate::ui::bench_stance::clip_envelope::EnvHit)>,
596+ /// The envelope key last pressed, as `(lane, clip, source frame)`: Delete takes it out.
597+ gain_pick: Option<(Lane, usize, u32)>,
333 /// How far into the clip the last press on a box landed, in timeline598 /// How far into the clip the last press on a box landed, in timeline
334 /// frames: what a drag lets go of is the *point that was grabbed*, so the599 /// frames: what a drag lets go of is the *point that was grabbed*, so the
335 /// head lands that much in front of the pointer and the clip does not jump600 /// head lands that much in front of the pointer and the clip does not jump
@@ -350,6 +615,13 @@ struct Player {
350 /// the trim's, and stale between gestures, which costs nothing: every615 /// the trim's, and stale between gestures, which costs nothing: every
351 /// gesture writes it before it asks.616 /// gesture writes it before it asks.
352 drag_alt: bool,617 drag_alt: bool,
618+ /// Whether Ctrl is held during a library drag: the drop inserts and pushes the rest along,
619+ /// and the status bar says so ([`ui::bench_stance::clip::asset_drop_status`]).
620+ drag_ctrl: bool,
621+ /// Whether a library drag hovers the empty bench below the last lane, where the drop makes
622+ /// a new track ([`ui::bench_stance::clip::asset_drop_status`]). Set by the bench's own move
623+ /// sample, cleared by a drop and by a row the pointer enters.
624+ drag_below: bool,
353 /// Whether the subtitle lanes draw at all -- the mute over the shown lane625 /// Whether the subtitle lanes draw at all -- the mute over the shown lane
354 /// ([`Player::sub_lane`]), not a lane of its own. On by default and off by626 /// ([`Player::sub_lane`]), not a lane of its own. On by default and off by
355 /// one stroke627 /// one stroke
@@ -357,6 +629,15 @@ struct Player {
357 /// anyone watching the picture rather than reading it. The player's, not the629 /// anyone watching the picture rather than reading it. The player's, not the
358 /// project's: it changes nothing that is saved and nothing that is exported.630 /// project's: it changes nothing that is saved and nothing that is exported.
359 subs_on: bool,631 subs_on: bool,
632+ /// Whether audio clips draw their waveform ([`ActionId::ToggleWaveforms`]). Kept
633+ /// with the project's view ([`view_state`]), so it reopens as it was left.
634+ waveforms: bool,
635+ /// Whether a ruler scrub while paused plays sound ([`ActionId::ToggleScrubAudio`]). Kept with
636+ /// the project's view, like the waveforms.
637+ scrub_audio: bool,
638+ /// The Play Around run in flight, if any: where the playhead came from, and
639+ /// where the run stops. See [`PlayAround`].
640+ play_around: Option<PlayAround>,
360 /// Which palette row is *selected*: an index into641 /// Which palette row is *selected*: an index into
361 /// [`PlaybackSession::subtitles`], which is what the × takes off642 /// [`PlaybackSession::subtitles`], which is what the × takes off
362 /// ([`ActionId::RemoveSubtitleTrack`](keymap::ActionId::RemoveSubtitleTrack))643 /// ([`ActionId::RemoveSubtitleTrack`](keymap::ActionId::RemoveSubtitleTrack))
@@ -399,6 +680,9 @@ struct Player {
399 /// happens rather than discovered after the release. Stale between gestures,680 /// happens rather than discovered after the release. Stale between gestures,
400 /// which costs nothing -- it is drawn only while one is live.681 /// which costs nothing -- it is drawn only while one is live.
401 snap_cue: Option<u32>,682 snap_cue: Option<u32>,
683+ /// The frame a ruler or empty-track menu was opened on: what "Add marker here" and
684+ /// "Move playhead here" act on. Stale once the menu is gone, read only by those two rows.
685+ menu_frame: Option<u32>,
402 /// The box the same gesture is about to fill, or `None` while the pointer is686 /// The box the same gesture is about to fill, or `None` while the pointer is
403 /// over no lane: the shadow every proper editor draws under a drag. Set by687 /// over no lane: the shadow every proper editor draws under a drag. Set by
404 /// the lane the pointer is actually over -- that is the one question the688 /// the lane the pointer is actually over -- that is the one question the
@@ -445,6 +729,9 @@ struct Player {
445 /// rolling-window estimate the progress line reads; see [`note_progress`].729 /// rolling-window estimate the progress line reads; see [`note_progress`].
446 export_started: Option<Instant>,730 export_started: Option<Instant>,
447 export_marks: Vec<(f32, f32)>,731 export_marks: Vec<(f32, f32)>,
732+ /// Exports set up to run later, one after another, each from the timeline
733+ /// as it was when added ([`export_queue`]). Lives for the session.
734+ queue: export_queue::ExportQueue,
448 /// The file an import worker is reading right now, and the files waiting735 /// The file an import worker is reading right now, and the files waiting
449 /// behind it in arrival order. Unlike an export, an import owns nothing:736 /// behind it in arrival order. Unlike an export, an import owns nothing:
450 /// the editor stays live, the timeline keeps playing, and the only thing737 /// the editor stays live, the timeline keeps playing, and the only thing
@@ -479,21 +766,24 @@ struct Player {
479 /// [`Player::autosave_tick`] has written it out. `project_path` itself is766 /// [`Player::autosave_tick`] has written it out. `project_path` itself is
480 /// never touched here: only [`Player::save_project`] writes the real file.767 /// never touched here: only [`Player::save_project`] writes the real file.
481 autosave_dirty: bool,768 autosave_dirty: bool,
482- /// When the dirty flag above was last set, so a tick can debounce: a769+ /// Edits landed since the autosave last caught up. Reaching
483- /// sidecar write waits until the hand has been off the timeline for a770+ /// [`AUTOSAVE_EDITS`] makes the next tick write without waiting for the timer.
484- /// few seconds, rather than chasing every pointer sample of a drag.771+ autosave_edits: u32,
485- autosave_last_edit: Option<Instant>,772+ /// When the autosave was last actually written. A dirty session goes at
486- /// When the sidecar was last actually written, so a long unbroken run of773+ /// most [`AUTOSAVE_PERIOD`] without one.
487- /// edits still gets caught by the periodic safety net rather than being
488- /// debounced forever.
489 autosave_last_run: Option<Instant>,774 autosave_last_run: Option<Instant>,
490- /// A sidecar found newer than the project it sits beside, offered on the775+ /// A structural edit landed ([`Player::mark_structural`]): the next autosave goes out as
491- /// notice bar the moment that project opens ([`Player::install_project`]).776+ /// soon as [`AUTOSAVE_THROTTLE`] allows, rather than at the next 20 edits.
492- /// The path is the sidecar's own, so accepting it needs nowhere else to777+ autosave_urgent: bool,
493- /// look; declining or answering any other key just drops it here --778+ /// An autosave found newer than the project it sits beside, offered as a
494- /// `project_path` is never touched by either path, only a manual save779+ /// notice with Recover and Discard buttons the moment that project opens
495- /// writes the real file.780+ /// ([`Player::install_project`]). The path is the autosave's own, so
781+ /// recovering needs nowhere else to look. Nothing is discarded unless the
782+ /// person says so -- `project_path` is never touched by either answer.
496 recovery_sidecar: Option<PathBuf>,783 recovery_sidecar: Option<PathBuf>,
784+ /// Why the last Recover could not bring the unsaved edits back, in plain words,
785+ /// while its dialog is up. The window is as it was and the autosave is kept.
786+ recovery_failure: Option<String>,
497 /// Whether the unsaved-work question is on screen: raised by the window's787 /// Whether the unsaved-work question is on screen: raised by the window's
498 /// own close request when [`Player::close_needs_answer`] says the timeline788 /// own close request when [`Player::close_needs_answer`] says the timeline
499 /// holds work the project file does not (user 2026-09-10, "if timeline is789 /// holds work the project file does not (user 2026-09-10, "if timeline is
@@ -511,6 +801,14 @@ struct Player {
511 /// -- the save then arms `autosave_armed`, so later saves on this801 /// -- the save then arms `autosave_armed`, so later saves on this
512 /// file are silent.802 /// file are silent.
513 save_ask: bool,803 save_ask: bool,
804+ /// The File menu's project dialogs -- Save version, Versions, Collect media -- while one
805+ /// is up; it owns the keyboard ([`Player::project_dialog_key`]).
806+ proj_dialog: Option<player::project_dialogs::Dialog>,
807+ /// A project started from File > New > Project…: where it will be saved, and the name it
808+ /// goes by, until its first footage arrives and the file can exist (a project names at
809+ /// least one source). `new_project_fresh` says that arrival still owes the first save.
810+ new_project: Option<PathBuf>,
811+ new_project_fresh: bool,
514 /// Whether the export's overwrite question is on screen: raised inside812 /// Whether the export's overwrite question is on screen: raised inside
515 /// [`Player::start_export`] -- after its refusals, so an export that813 /// [`Player::start_export`] -- after its refusals, so an export that
516 /// cannot run never asks -- when `export_path` exists on disk and814 /// cannot run never asks -- when `export_path` exists on disk and
@@ -518,6 +816,10 @@ struct Player {
518 /// `save_ask` above: while it is up it owns the keyboard, and answering816 /// `save_ask` above: while it is up it owns the keyboard, and answering
519 /// `enter` marks the target known and starts the export.817 /// `enter` marks the target known and starts the export.
520 export_ask: bool,818 export_ask: bool,
819+ /// The export sheet's own state beside the settings above: the range
820+ /// radio, the preset last picked, the destination fields, the measured
821+ /// pace and the finished face ([`export_ui::ExportSheet`]).
822+ export_sheet: export_ui::ExportSheet,
521 /// Whether `project_path` names a file this window itself put there --823 /// Whether `project_path` names a file this window itself put there --
522 /// loaded from a `.edith` ([`Player::install_project`]) or written by a824 /// loaded from a `.edith` ([`Player::install_project`]) or written by a
523 /// manual save ([`Player::save_project`]) -- rather than one merely825 /// manual save ([`Player::save_project`]) -- rather than one merely
@@ -529,6 +831,19 @@ struct Player {
529 /// one. `mark_dirty` does not touch this -- an edit earns nothing an open831 /// one. `mark_dirty` does not touch this -- an edit earns nothing an open
530 /// or save has not already granted.832 /// or save has not already granted.
531 autosave_armed: bool,833 autosave_armed: bool,
834+ /// The project file's stamp as the window last accounted for it: set on
835+ /// open, on its own save, and when a change on disk has been answered.
836+ /// [`Player::follow_tick`] compares the file against it.
837+ disk_known: Option<follow::Stamp>,
838+ /// Whether the window holds edits the project file does not. Unlike
839+ /// `autosave_dirty` this is not cleared by the sidecar write, so it
840+ /// still says the file is behind after an autosave.
841+ edited_since_save: bool,
842+ /// The engine's revision ([`engine::PlaybackSession::revision`]) of the
843+ /// timeline at the last save, open or discard. Undo and redo compare the
844+ /// revision they land on with it, so undoing back to the saved timeline
845+ /// clears `edited_since_save`. `None` when there is no saved timeline yet.
846+ saved_revision: Option<u64>,
532 /// Which stroke means what, and what every shortcut on screen is called.847 /// Which stroke means what, and what every shortcut on screen is called.
533 /// The one place either question is answered.848 /// The one place either question is answered.
534 keymap: Keymap,849 keymap: Keymap,
@@ -566,10 +881,14 @@ struct Player {
566 /// the ones a fresh session comes up at.881 /// the ones a fresh session comes up at.
567 proxies_on: bool,882 proxies_on: bool,
568 auto_proxies_on: bool,883 auto_proxies_on: bool,
884+ /// The autosave period in seconds, `None` for Off ([`player::library::AUTOSAVE_CHOICES`]).
885+ autosave_secs: Option<u64>,
569 /// The keybindings overlay is up. While it is, it owns the keyboard and the886 /// The keybindings overlay is up. While it is, it owns the keyboard and the
570 /// pointer: a stroke or a click meant for a row must not also cut the887 /// pointer: a stroke or a click meant for a row must not also cut the
571 /// timeline.888 /// timeline.
572 keys_open: bool,889 keys_open: bool,
890+ /// The About dialog is up (Help → About edith…).
891+ about_open: bool,
573 /// The settings page is up (`?` overlay's sibling, but a latch rather892 /// The settings page is up (`?` overlay's sibling, but a latch rather
574 /// than a hold -- it carries clickable rows, not a glance-and-release893 /// than a hold -- it carries clickable rows, not a glance-and-release
575 /// list). Cleared by [`Player::close_card`], the one reset list every894 /// list). Cleared by [`Player::close_card`], the one reset list every
@@ -584,11 +903,33 @@ struct Player {
584 /// picking a tab writes no project value, so the pick never arms903 /// picking a tab writes no project value, so the pick never arms
585 /// autosave.904 /// autosave.
586 settings_tab: ui::settings_stance::SettingsTab,905 settings_tab: ui::settings_stance::SettingsTab,
906+ /// What the KEYS tab is waiting on (a filter, a capture, a swap question),
907+ /// and the filter's text. Display state only: nothing here reaches a
908+ /// project, and the keymap itself is saved once a stroke is taken.
909+ settings_key_edit: Option<ui::settings_stance::KeyEdit>,
910+ settings_keys_filter: String,
911+ /// Which of the showing tab's choice rows the keyboard is on
912+ /// ([`ui::settings_stance::settings_arrow`]): `↑`/`↓` move it, `←`/`→`
913+ /// step that row's value. Display state only, cleared with a tab switch.
914+ settings_focus: Option<usize>,
587 /// Where the actions list is scrolled to. Held here rather than left to915 /// Where the actions list is scrolled to. Held here rather than left to
588 /// the wheel alone: forty actions are four times what a 360 px window916 /// the wheel alone: forty actions are four times what a 360 px window
589 /// shows, and the rows past the fold have to be reachable from the917 /// shows, and the rows past the fold have to be reachable from the
590 /// keyboard.918 /// keyboard.
591 keys_scroll: ScrollHandle,919 keys_scroll: ScrollHandle,
920+ /// The export panel body's scroll (wheel, and up/down/page keys).
921+ export_scroll: ScrollHandle,
922+ /// The Ctrl+K command palette is up (DESIGN §4.4). While it is, it owns the
923+ /// keyboard: its field takes the typed letters and the arrows move the
924+ /// highlight. Opened and closed through `Player::show_actions` and the
925+ /// palette's own keys in `ui::stance`.
926+ pub(crate) palette_open: bool,
927+ /// What the palette's field holds, matched against every action's label.
928+ pub(crate) palette_query: String,
929+ /// The highlighted row, an index into `Player::palette_list`.
930+ pub(crate) palette_sel: usize,
931+ /// The palette's row list. Scrolled to keep the highlight in view.
932+ pub(crate) palette_scroll: ScrollHandle,
592 /// Where the lane column and the inspector's rows have been taken to. Read933 /// Where the lane column and the inspector's rows have been taken to. Read
593 /// back at render, not only written by the wheel: the line each of them934 /// back at render, not only written by the wheel: the line each of them
594 /// carries about what is below the fold is a count of what is *still* below935 /// carries about what is below the fold is a count of what is *still* below
@@ -600,11 +941,19 @@ struct Player {
600 /// buttons under it -- and at the 360 px floor its title and its buttons941 /// buttons under it -- and at the 360 px floor its title and its buttons
601 /// were off both ends of the column with no way to reach them.942 /// were off both ends of the column with no way to reach them.
602 eq_scroll: ScrollHandle,943 eq_scroll: ScrollHandle,
944+ /// The export sheet's scrolled body: read at paint time so its "more
945+ /// below" fade shows only while there is more below.
946+ pub(crate) export_body_scroll: ScrollHandle,
947+ /// The Settings rows' scroll, for the same fade.
948+ pub(crate) settings_rows_scroll: ScrollHandle,
603 /// The export options card is up: what the export action opens now, so949 /// The export options card is up: what the export action opens now, so
604 /// nothing is written until the card's own button says so. One card at a950 /// nothing is written until the card's own button says so. One card at a
605 /// time -- opening either closes the other, since both are the whole window951 /// time -- opening either closes the other, since both are the whole window
606 /// and two stacked scrims say nothing about which one is listening.952 /// and two stacked scrims say nothing about which one is listening.
607 export_open: bool,953 export_open: bool,
954+ /// The dock's Transcript tab is showing, and its words.
955+ transcript_open: bool,
956+ transcript: player::transcript::Transcript,
608 /// The export budget, in bits per second -- the moment's one number, and957 /// The export budget, in bits per second -- the moment's one number, and
609 /// the only thing the encoder actually takes. Zero means nobody has958 /// the only thing the encoder actually takes. Zero means nobody has
610 /// chosen: the lever then reads the engine's own automatic figure for959 /// chosen: the lever then reads the engine's own automatic figure for
@@ -617,16 +966,12 @@ struct Player {
617 /// takes gpui focus (the root keeps the keyboard), so the field is a966 /// takes gpui focus (the root keeps the keyboard), so the field is a
618 /// modal state on the player and the root's handler types into it.967 /// modal state on the player and the root's handler types into it.
619 budget_edit: Option<String>,968 budget_edit: Option<String>,
620- /// The budget track's box, recorded at prepaint -- [`Self::color_bars`]'
621- /// own reason: a mouse listener is handed the window position only, and
622- /// [`frac_along`] is what turns it into a rate.
623- budget_bar: Rc<Cell<Bounds<Pixels>>>,
624 /// The Clip tab's transition duration row, the same way (DEBT #111):969 /// The Clip tab's transition duration row, the same way (DEBT #111):
625 /// the anchor clip's frame count while it is being typed, `None` when970 /// the anchor clip's frame count while it is being typed, `None` when
626 /// nobody is. Opened on the row's own click, closed on the same field's971 /// nobody is. Opened on the row's own click, closed on the same field's
627 /// enter/esc the export card's field already answers to972 /// enter/esc the export card's field already answers to
628 /// ([`Player::param_card_key`]).973 /// ([`Player::param_card_key`]).
629- transition_edit: Option<NumberEdit>,974+ transition_edit: Option<ui::kit::NumberEdit>,
630 /// What the *sound* is coded at, in kbps, for every format that encodes it975 /// What the *sound* is coded at, in kbps, for every format that encodes it
631 /// -- the AAC inside a video export as much as an MP3. Kept across closes976 /// -- the AAC inside a video export as much as an MP3. Kept across closes
632 /// like the picture's quality, and starts at the figure this program wrote977 /// like the picture's quality, and starts at the figure this program wrote
@@ -688,14 +1033,56 @@ struct Player {
688 /// ([`Player::flush_drag`]). What the bar draws while it stands, so the1033 /// ([`Player::flush_drag`]). What the bar draws while it stands, so the
689 /// handle stays under the hand even though the picture has not caught up.1034 /// handle stays under the hand even though the picture has not caught up.
690 pending_speed: Option<Speed>,1035 pending_speed: Option<Speed>,
1036+ /// The speed card is in its ramp mode: the bar sets the speed of the key the next
1037+ /// "Add key" puts at the playhead, not the clip's constant rate. On when the card
1038+ /// opens on a clip that already has a ramp, and by the card's Ramp tab.
1039+ speed_ramp_mode: bool,
1040+ /// The speed the ramp mode's bar holds for the next key; `None` follows the
1041+ /// ramp's own speed at the playhead.
1042+ ramp_key_speed: Option<Speed>,
691 /// The mix card is up: every audio track's own volume and the master1043 /// The mix card is up: every audio track's own volume and the master
692 /// limiter, which are project settings and not any clip's -- so unlike the1044 /// limiter, which are project settings and not any clip's -- so unlike the
693 /// four clip cards there is no handle to hold, only whether it is open.1045 /// four clip cards there is no handle to hold, only whether it is open.
694 mix_open: bool,1046 mix_open: bool,
1047+ /// The markers card is up ([`Player::open_markers`]): the project's comment markers
1048+ /// as rows, one card at a time like the rest.
1049+ markers_open: bool,
1050+ /// The undo history card (Edit > History), in the Clip tab beside the others.
1051+ history_open: bool,
1052+ /// The creator tools card is up ([`Player::open_tools`]): Normalize, Captions, Fillers and
1053+ /// Voiceover on four tabs, one card at a time like the rest.
1054+ tools: Option<player::tools::Tools>,
1055+ /// Which run of a tool's background job is current, so a late result is dropped.
1056+ tools_runs: u64,
1057+ /// The effects card is up on this clip -- the lane it is on and its index
1058+ /// ([`Player::open_effects`]).
1059+ effects_open: Option<(Lane, usize)>,
1060+ /// The stack a held bar is showing, written as one undo step on release.
1061+ effects_draft: Option<Vec<engine::effects::Effect>>,
1062+ /// The bar held: the effect's place in the stack and the parameter's in the effect.
1063+ effects_drag: Option<(usize, usize)>,
1064+ /// The kinds are listed under the card's Add effect button.
1065+ effects_adding: bool,
1066+ /// Each bar's box, recorded at prepaint, at `effect * MAX_PARAMS + param`.
1067+ effects_bars: std::cell::RefCell<Vec<Rc<Cell<Bounds<Pixels>>>>>,
1068+ /// The row the markers card has picked, an index into the session's markers.
1069+ marker_sel: usize,
1070+ /// The name or note being retyped on the card, which owns the keyboard while it is
1071+ /// `Some` ([`Player::marker_edit_key`]).
1072+ marker_edit: Option<MarkerEdit>,
695 /// Which of its rows the arrow keys move -- a fader, the limiter's ceiling1073 /// Which of its rows the arrow keys move -- a fader, the limiter's ceiling
696 /// or its switch. The card's own focus, since nothing in it takes gpui's1074 /// or its switch. The card's own focus, since nothing in it takes gpui's
697 /// (ledger:182).1075 /// (ledger:182).
698 mix_field: usize,1076 mix_field: usize,
1077+ /// The lanes soloed for listening. Not saved and not an undo step: the
1078+ /// session is handed the set ([`PlaybackSession::set_solo`]), and an export
1079+ /// never reads it.
1080+ mix_solo: Vec<Lane>,
1081+ /// The mix card's meters and slider bars, drawn from `&self`, so behind a
1082+ /// `RefCell` ([`player::cards::MixPanel`]).
1083+ mix_panel: std::cell::RefCell<player::cards::MixPanel>,
1084+ /// The mix slider a drag is moving, if one is.
1085+ mix_drag: Option<player::cards::MixDrag>,
699 /// The cue plate's own size, in force this session and kept in1086 /// The cue plate's own size, in force this session and kept in
700 /// `~/.config/edith/subtitle-style` beside the keybindings -- an1087 /// `~/.config/edith/subtitle-style` beside the keybindings -- an
701 /// app-global preference like the theme, since export never burns1088 /// app-global preference like the theme, since export never burns
@@ -707,12 +1094,28 @@ struct Player {
707 /// nothing picked -- `None` calls no [`gpui::Styled::font_family`] at1094 /// nothing picked -- `None` calls no [`gpui::Styled::font_family`] at
708 /// all, which is what leaves the window's own choice in force.1095 /// all, which is what leaves the window's own choice in force.
709 sub_family: Option<String>,1096 sub_family: Option<String>,
1097+ /// The outline, the background box and the place of the cue plate: the
1098+ /// rest of the look, kept in the same file as the size and the family.
1099+ sub_outline: SubOutline,
1100+ sub_boxed: bool,
1101+ sub_place: SubPlace,
1102+ /// The size slider is held: a move sets the size, the release keeps it.
1103+ sub_dragging: bool,
1104+ /// The caption style card's font dropdown is open.
1105+ sub_font_open: bool,
1106+ /// The words typed into the open font dropdown's search line (empty when it is closed).
1107+ sub_font_query: String,
710 /// The subtitle style card is up.1108 /// The subtitle style card is up.
711 subtitle_style_open: bool,1109 subtitle_style_open: bool,
712 /// Which of its rows the arrow keys move: 0 is the size stepper, every1110 /// Which of its rows the arrow keys move: 0 is the size stepper, every
713 /// row after it a family in [`Self::subtitle_fonts`]. The card's own1111 /// row after it a family in [`Self::subtitle_fonts`]. The card's own
714 /// focus, since nothing in it takes gpui's (ledger:182).1112 /// focus, since nothing in it takes gpui's (ledger:182).
715 subtitle_style_field: usize,1113 subtitle_style_field: usize,
1114+ /// The Animation dropdown of the style card is open (its list hangs from the field).
1115+ sub_anim_open: bool,
1116+ /// The arrow keys have moved a row of the style card, so its pick wears the row
1117+ /// wash; a mouse press on the card clears it again, so a mouse-only user sees no wash.
1118+ sub_keys_used: bool,
716 /// Every family the platform can draw, asked for once when the card1119 /// Every family the platform can draw, asked for once when the card
717 /// opens and kept for as long as it is up: [`gpui::TextSystem::all_font_names`]1120 /// opens and kept for as long as it is up: [`gpui::TextSystem::all_font_names`]
718 /// walks the whole font registry, which is not a repaint's business.1121 /// walks the whole font registry, which is not a repaint's business.
@@ -720,6 +1123,14 @@ struct Player {
720 /// The silence card is up on this clip -- the lane it is on and its index1123 /// The silence card is up on this clip -- the lane it is on and its index
721 /// there, exactly as the speed card's handle is.1124 /// there, exactly as the speed card's handle is.
722 silence_open: Option<(Lane, usize)>,1125 silence_open: Option<(Lane, usize)>,
1126+ /// The mark-the-beats card is up on this clip, the same handle as `silence_open`.
1127+ beats_open: Option<(Lane, usize)>,
1128+ /// Which beat the card marks: 0 every beat, 1 every second, 2 every fourth.
1129+ beats_every: usize,
1130+ /// When the listening started, while the analysis runs; `None` when idle.
1131+ beats_scan: Option<Instant>,
1132+ /// What the last run said, shown under the section's controls.
1133+ beats_last: Option<String>,
723 /// What a scan is told to look for, and how fast the speed-up button plays1134 /// What a scan is told to look for, and how fast the speed-up button plays
724 /// what it found. Kept across closes like the export card's quality: a1135 /// what it found. Kept across closes like the export card's quality: a
725 /// second run offers what the first one settled on.1136 /// second run offers what the first one settled on.
@@ -821,6 +1232,22 @@ struct Player {
821 /// into ([`Player::edit_viz_hex`]). `None` is the row showing the colour1232 /// into ([`Player::edit_viz_hex`]). `None` is the row showing the colour
822 /// itself; `Some` is the buffer, its refusal, and the caret on screen.1233 /// itself; `Some` is the buffer, its refusal, and the caret on screen.
823 viz_hex_edit: Option<ColorEdit>,1234 viz_hex_edit: Option<ColorEdit>,
1235+ /// The subtitle cue being retyped on its block, while one is open
1236+ /// ([`Player::open_cue_edit`]). `None` is every block showing its words.
1237+ cue_edit: Option<CueEdit>,
1238+ /// The caption cue picked on a subtitle lane (`Lane`, track, cue): the one block a click
1239+ /// selected, which the caption menu and the Delete key act on ([`player::caption_cues`]).
1240+ sel_cue: Option<(Lane, usize, usize)>,
1241+ /// A number of the caption panel being typed (start, end or length) and its buffer.
1242+ cue_num: Option<(player::caption_cues::CueNum, ui::kit::NumberEdit)>,
1243+ /// A caption panel number being dragged sideways ([`player::caption_cues::CueNumScrub`]).
1244+ cue_num_scrub: Option<player::caption_cues::CueNumScrub>,
1245+ /// The settings page's still image length, while it is typed in seconds.
1246+ still_num: Option<ui::kit::NumberEdit>,
1247+ /// A caption's edge or body being dragged, until the release writes it as one edit.
1248+ cue_drag: Option<player::caption_cues::CueDrag>,
1249+ /// The caption menu, while a right-click on a cue block has it open.
1250+ cue_menu: Option<player::caption_cues::CueMenu>,
824 /// The ink the hand is on, held back because the worker still owes a frame1251 /// The ink the hand is on, held back because the worker still owes a frame
825 /// ([`Self::pending_color`]'s own reason, and a wheel sample is heavier1252 /// ([`Self::pending_color`]'s own reason, and a wheel sample is heavier
826 /// than a grade's: it is not a table entry but the painter's own input, so1253 /// than a grade's: it is not a table entry but the painter's own input, so
@@ -832,7 +1259,25 @@ struct Player {
832 /// window position only, so this is what a press and a drag are read against1259 /// window position only, so this is what a press and a drag are read against
833 /// ([`frac_along`]). One per band, because the press picks the row it landed1260 /// ([`frac_along`]). One per band, because the press picks the row it landed
834 /// on and the drag then belongs to that row's range.1261 /// on and the drag then belongs to that row's range.
835- color_bars: [Rc<Cell<Bounds<Pixels>>>; COLOR_BANDS.len()],1262+ color_bars: [Rc<Cell<Bounds<Pixels>>>; COLOR_SLOTS],
1263+ /// The colour card's section on show ([`ColorSection`]): one at a time, so
1264+ /// the card keeps its height whichever the hand is in.
1265+ color_section: ColorSection,
1266+ /// The Wheels section's wheel (lift, gamma, gain) and the Curves section's
1267+ /// channel (master, red, green, blue).
1268+ color_wheel: usize,
1269+ /// A wheel's puck (`false`) or master bar (`true`) is being dragged, on that
1270+ /// wheel: the root follows the pointer, as for `color_dragging`.
1271+ color_wheel_drag: Option<(usize, bool)>,
1272+ /// Each wheel's pad box and master bar box, recorded at prepaint.
1273+ color_pads: [Rc<Cell<Bounds<Pixels>>>; 3],
1274+ color_masters: [Rc<Cell<Bounds<Pixels>>>; 3],
1275+ color_curve: usize,
1276+ /// What the graph over the colour controls shows, and the scopes counted
1277+ /// off the frame on screen while it shows one (`None` for the histogram,
1278+ /// which counts nothing extra).
1279+ scope_view: ScopeView,
1280+ scopes: Option<engine::scopes::Scopes>,
836 /// The grade the hand is on, held back because the worker still owes a1281 /// The grade the hand is on, held back because the worker still owes a
837 /// frame ([`Player::flush_drag`]): a live write into a busy worker only1282 /// frame ([`Player::flush_drag`]): a live write into a busy worker only
838 /// cancels the open the picture is already waiting for, so a bar-wide sweep1283 /// cancels the open the picture is already waiting for, so a bar-wide sweep
@@ -851,6 +1296,10 @@ struct Player {
851 /// for the same reason: a 4 px bar is left by the pointer on the first1296 /// for the same reason: a 4 px bar is left by the pointer on the first
852 /// move and its own listeners then stop firing.1297 /// move and its own listeners then stop firing.
853 transform_dragging: bool,1298 transform_dragging: bool,
1299+ /// The opacity row's bar is being dragged: its samples go to the opacity, not a band.
1300+ opacity_drag: bool,
1301+ /// The opacity row's bar, recorded at prepaint like the transform bars.
1302+ opacity_bar: Rc<Cell<Bounds<Pixels>>>,
854 /// Each slider's box, recorded at prepaint -- [`Self::color_bars`]' own1303 /// Each slider's box, recorded at prepaint -- [`Self::color_bars`]' own
855 /// reason, one per band.1304 /// reason, one per band.
856 transform_bars: [Rc<Cell<Bounds<Pixels>>>; TRANSFORM_BANDS.len()],1305 transform_bars: [Rc<Cell<Bounds<Pixels>>>; TRANSFORM_BANDS.len()],
@@ -862,7 +1311,10 @@ struct Player {
862 /// what arrives here is already through it. Refilled by every pumped frame,1311 /// what arrives here is already through it. Refilled by every pumped frame,
863 /// which is what makes the colour card's graph move as a slider is dragged:1312 /// which is what makes the colour card's graph move as a slider is dragged:
864 /// each live write reseeks, and the reseek's frame is the next count.1313 /// each live write reseeks, and the reseek's frame is the next count.
865- histogram: [[u32; HIST_BINS]; 3],1314+ histogram: [u32; HIST_BINS],
1315+ /// The open `More …` folds, by panel id, kept in the panel-folds file
1316+ /// ([`load_folds`] / [`save_folds`]) so a fold stays as the user left it.
1317+ folds: BTreeSet<String>,
866 /// What the file actions have had to say, oldest first. A *queue* and not a1318 /// What the file actions have had to say, oldest first. A *queue* and not a
867 /// slot: two imports that fail back to back used to be one message, because1319 /// slot: two imports that fail back to back used to be one message, because
868 /// the second overwrote the first before a frame had drawn it -- the failure1320 /// the second overwrote the first before a frame had drawn it -- the failure
@@ -870,7 +1322,7 @@ struct Player {
870 /// failure. The front holds its own bar above the panel until it is answered1322 /// failure. The front holds its own bar above the panel until it is answered
871 /// -- any key retires it, so does a click on it -- the bar says how many are1323 /// -- any key retires it, so does a click on it -- the bar says how many are
872 /// behind it, and answering it brings the next one up.1324 /// behind it, and answering it brings the next one up.
873- notices: std::collections::VecDeque<SharedString>,1325+ notices: std::collections::VecDeque<crate::notices::Toast>,
874 /// How tall the transient bars hanging off the bottom of the picture (the1326 /// How tall the transient bars hanging off the bottom of the picture (the
875 /// import line, the seek line, the notice) came out at prepaint, so the cue1327 /// import line, the seek line, the notice) came out at prepaint, so the cue
876 /// plate can sit clear of them ([`sub_bottom`]). Measured and not counted:1328 /// plate can sit clear of them ([`sub_bottom`]). Measured and not counted:
@@ -885,7 +1337,13 @@ struct Player {
885 /// pushed only when it is not this any more.1337 /// pushed only when it is not this any more.
886 titled: String,1338 titled: String,
887 displayed: u32,1339 displayed: u32,
1340+ /// Frames the picture skipped in the current run, because it was behind the clock
1341+ /// ([`Player::dropped_words`]); restarts at each play.
888 dropped: u32,1342 dropped: u32,
1343+ /// Whether the transport was playing at the last pump, and when it last stopped, so the
1344+ /// dropped-frames words stay up for a few seconds after a stop.
1345+ playing_last: bool,
1346+ drop_stop: Option<Instant>,
889 /// When the picture was last restarted at the clock for falling behind it1347 /// When the picture was last restarted at the clock for falling behind it
890 /// ([`should_resync`]). The cool-down's only state.1348 /// ([`should_resync`]). The cool-down's only state.
891 resynced: Option<Instant>,1349 resynced: Option<Instant>,
@@ -898,6 +1356,15 @@ struct Player {
898 focus_dock: FocusHandle,1356 focus_dock: FocusHandle,
899 focus_bench: FocusHandle,1357 focus_bench: FocusHandle,
900 focus_inspector: FocusHandle,1358 focus_inspector: FocusHandle,
1359+ /// The settings page's KEYS list. Takes the keyboard while the page is
1360+ /// capturing or filtering, so its own key listener sees the strokes first.
1361+ focus_settings: FocusHandle,
1362+ /// Tab stops handed to a dialog's controls as it is built ([`ui::kit::tab_scope`]).
1363+ dlg_pool: Vec<FocusHandle>,
1364+ /// Whether a dialog was up at the last frame, to give the root the keyboard when one opens.
1365+ dlg_was_up: bool,
1366+ /// A [`Player::guard_focus`] check is already waiting for its frame.
1367+ focus_guard_pending: bool,
901 }1368 }
902 1369
903 #[cfg(test)]1370 #[cfg(test)]
@@ -917,17 +1384,15 @@ fn main() {
917 eprintln!("{text}");1384 eprintln!("{text}");
918 }1385 }
919 // The palette the last session picked, before the first paint: a window that1386 // The palette the last session picked, before the first paint: a window that
920- // opened cool and turned warm a frame later would be the theme announcing1387+ // opened in the default and turned warm a frame later would be the theme
921- // itself. Silent on a missing or unreadable file -- the default is a whole1388+ // announcing itself. Silent on a missing or unreadable file -- the default
922- // answer, and nothing of the user's is lost by it.1389+ // (`PaletteId::DEFAULT`, darkroom) is a whole answer, and nothing of the
1390+ // user's is lost by it.
923 ui::theme::load();1391 ui::theme::load();
924- // DESIGN.md §1: "the room is the film's" -- darkroom mode owns the1392+ ui::theme::load_accent();
925- // palette outright, so the saved pick above is overridden the moment the
926- // flag is read, once, before the first paint.
927- ui::theme::set(ui::theme::PaletteId::Darkroom);
928 // The subtitle style the last session picked, same silence on a missing1393 // The subtitle style the last session picked, same silence on a missing
929 // or unreadable file.1394 // or unreadable file.
930- let (sub_family, sub_text) = load_subtitle_style();1395+ let sub_style = load_subtitle_style();
931 // The auto-proxies default the last session left the switch at, before1396 // The auto-proxies default the last session left the switch at, before
932 // any project's own line ([`engine::edith::Document::auto_proxy`])1397 // any project's own line ([`engine::edith::Document::auto_proxy`])
933 // overrides it the moment one opens.1398 // overrides it the moment one opens.
@@ -935,6 +1400,11 @@ fn main() {
935 // The Proxies default the last session left the switch at, same1400 // The Proxies default the last session left the switch at, same
936 // before-any-project-line precedence as the auto-proxies default above.1401 // before-any-project-line precedence as the auto-proxies default above.
937 let proxies_on = player::library::load_proxies_pref();1402 let proxies_on = player::library::load_proxies_pref();
1403+ // The autosave period the last session left the Settings row at.
1404+ let autosave_secs = player::library::load_autosave_pref();
1405+ // The picture and sound this computer last exported with, same silence on
1406+ // a missing or unreadable file as the switches above.
1407+ let export_prefs = export_ui::load_export_prefs();
938 // Nothing named on the command line is read here. The first file makes the1408 // Nothing named on the command line is read here. The first file makes the
939 // timeline -- a `.edith` restores a whole one, anything else *is* one --1409 // timeline -- a `.edith` restores a whole one, anything else *is* one --
940 // and the rest are imports like any other: rows in the library, dragged1410 // and the rest are imports like any other: rows in the library, dragged
@@ -956,7 +1426,7 @@ fn main() {
956 .as_deref()1426 .as_deref()
957 .map_or_else(|| NO_FILE.into(), |arg| file_name(arg).into());1427 .map_or_else(|| NO_FILE.into(), |arg| file_name(arg).into());
958 1428
959- Application::new().run(move |cx: &mut App| {1429+ Application::new().with_assets(ui::icons::Assets).run(move |cx: &mut App| {
960 // Bundled Archivo / Spline Sans Mono, before the first paint --1430 // Bundled Archivo / Spline Sans Mono, before the first paint --
961 // DESIGN §3's two faces, embedded so no build depends on the host1431 // DESIGN §3's two faces, embedded so no build depends on the host
962 // having them installed (see `ui::type_scale`'s doc comment).1432 // having them installed (see `ui::type_scale`'s doc comment).
@@ -992,8 +1462,17 @@ fn main() {
992 resynced: None,1462 resynced: None,
993 session: None,1463 session: None,
994 pending_settings: (None, None, None),1464 pending_settings: (None, None, None),
1465+ pending_template: None,
1466+ welcome_templates: false,
995 preview_session: None,1467 preview_session: None,
996 preview_playing: false,1468 preview_playing: false,
1469+ source_marks: HashMap::new(),
1470+ source_target: None,
1471+ source_hint: false,
1472+ source_video: true,
1473+ source_audio: true,
1474+ patch_video: Lane::V1,
1475+ patch_audio: Lane::A1,
997 player_fullscreen: false,1476 player_fullscreen: false,
998 loop_on: false,1477 loop_on: false,
999 range: None,1478 range: None,
@@ -1009,10 +1488,13 @@ fn main() {
1009 // pushed the values it already holds.1488 // pushed the values it already holds.
1010 proxies_on,1489 proxies_on,
1011 auto_proxies_on,1490 auto_proxies_on,
1491+ autosave_secs,
1012 // Only ever used with a timeline; 30 keeps the empty1492 // Only ever used with a timeline; 30 keeps the empty
1013 // timecode reading in frames rather than in NaN.1493 // timecode reading in frames rather than in NaN.
1014 fps: 30.,1494 fps: 30.,
1015 ruler: Rc::default(),1495 ruler: Rc::default(),
1496+ lane_beds: Rc::default(),
1497+ marquee: None,
1016 scroll_track: Rc::default(),1498 scroll_track: Rc::default(),
1017 scroll_drag: None,1499 scroll_drag: None,
1018 lanes_drag: None,1500 lanes_drag: None,
@@ -1020,6 +1502,10 @@ fn main() {
1020 // header is still being read.1502 // header is still being read.
1021 name: name.clone(),1503 name: name.clone(),
1022 image: None,1504 image: None,
1505+ retired_images: Vec::new(),
1506+ output: None,
1507+ output_display: None,
1508+ output_displays: Vec::new(),
1023 sub_image: None,1509 sub_image: None,
1024 held: None,1510 held: None,
1025 notice_h: Rc::default(),1511 notice_h: Rc::default(),
@@ -1030,11 +1516,33 @@ fn main() {
1030 // Nobody has scrolled anything yet, so the follow has the1516 // Nobody has scrolled anything yet, so the follow has the
1031 // view: the first frame is drawn where the head is.1517 // view: the first frame is drawn where the head is.
1032 panned: false,1518 panned: false,
1519+ fit_pending: false,
1520+ fitted_bed: None,
1521+ lane_h: Vec::new(),
1522+ viewer: viewer_view::Prefs::default(),
1523+ viewer_pan: (0., 0.),
1524+ viewer_drag: None,
1525+ viewer_handle: None,
1526+ viewer_btns: Default::default(),
1527+ lane_resize: None,
1033 selected: Selection::new(),1528 selected: Selection::new(),
1529+ gap: None,
1034 context_menu: None,1530 context_menu: None,
1531+ menu_open: None,
1532+ menu_hopped: None,
1533+ menu_sub: None,
1534+ menu_sub2: None,
1535+ ledger_readout: Rc::default(),
1536+ toast_text: Rc::default(),
1537+ adjust_hot: false,
1538+ adjust_aim: None,
1539+ adjust_sub: Cell::new(None),
1035 picker: None,1540 picker: None,
1036 library_menu: None,1541 library_menu: None,
1037 selected_asset: None,1542 selected_asset: None,
1543+ asset_picks: Vec::new(),
1544+ angle_monitor: false,
1545+ angle_shots: Default::default(),
1038 dock_src_active: ui::dock_stance::load(),1546 dock_src_active: ui::dock_stance::load(),
1039 dock_filter: String::new(),1547 dock_filter: String::new(),
1040 dock_filter_edit: false,1548 dock_filter_edit: false,
@@ -1042,28 +1550,90 @@ fn main() {
1042 waves: HashMap::new(),1550 waves: HashMap::new(),
1043 thumbs: HashMap::new(),1551 thumbs: HashMap::new(),
1044 proxies: HashMap::new(),1552 proxies: HashMap::new(),
1553+ render: None,
1554+ render_bands: Vec::new(),
1555+ render_bands_stamp: None,
1556+ render_progress: None,
1557+ stab_waiting: Vec::new(),
1558+ track_jobs: Vec::new(),
1559+ reframe_run: None,
1560+ reframed: None,
1561+ mcam_run: None,
1562+ seq_trail: Vec::new(),
1563+ seq_edit: None,
1564+ lane_edit: None,
1565+ time_edit: None,
1566+ compare: viewer_view::Compare::Off,
1567+ before: None,
1568+ before_at: None,
1569+ before_busy: false,
1570+ shown_frame: None,
1571+ look_open: false,
1572+ saved_looks: Vec::new(),
1573+ look_name: None,
1574+ look_mark: None,
1575+ collapsed_bins: Default::default(),
1576+ sections_mem: Vec::new(),
1577+ sections_anchor: None,
1578+ selected_bin: None,
1579+ bin_edit: None,
1580+ title_sel: None,
1581+ title_draft: None,
1582+ title_hex: None,
1583+ gen_hex: None,
1584+ gen_scrub: None,
1585+ deinterlace_open: false,
1586+ place_open: false,
1587+ title_in_open: false,
1588+ title_out_open: false,
1589+ effects_mode_open: None,
1590+ eq_shape_open: false,
1591+ transition_kind_open: false,
1592+ transition_section_open: false,
1593+ accent_hex: None,
1594+ accent_drag: None,
1595+ accent_vivid_bar: Rc::default(),
1596+ accent_hue_bar: Rc::default(),
1597+ title_scrub: None,
1598+ pan_scrub: None,
1045 streams: HashMap::new(),1599 streams: HashMap::new(),
1046 has_video: HashMap::new(),1600 has_video: HashMap::new(),
1047 bitrates: HashMap::new(),1601 bitrates: HashMap::new(),
1602+ facts: HashMap::new(),
1048 sizes: HashMap::new(),1603 sizes: HashMap::new(),
1049 syncs: HashMap::new(),1604 syncs: HashMap::new(),
1050 decoders: HashMap::new(),1605 decoders: HashMap::new(),
1051 export_seat: None,1606 export_seat: None,
1052 hw_caps: None,1607 hw_caps: None,
1053 clipboard: Vec::new(),1608 clipboard: Vec::new(),
1609+ copied_look: None,
1054 scrubbing: false,1610 scrubbing: false,
1055 splits: load_stance_splits(bounds.size),1611 splits: load_stance_splits(bounds.size),
1056 split_drag: None,1612 split_drag: None,
1613+ split_press: None,
1057 trim: None,1614 trim: None,
1615+ pro_drag: None,
1616+ hover_hint: None,
1617+ trim_flash: None,
1618+ drag_src: None,
1058 fade_drag: None,1619 fade_drag: None,
1620+ gain_edit: None,
1621+ gain_hover: None,
1622+ gain_pick: None,
1059 grab: 0,1623 grab: 0,
1060 snap: true,1624 snap: true,
1061 drag_alt: false,1625 drag_alt: false,
1626+ drag_ctrl: false,
1627+ drag_below: false,
1062 subs_on: true,1628 subs_on: true,
1629+ waveforms: true,
1630+ scrub_audio: true,
1631+ play_around: None,
1063 sub_track: 0,1632 sub_track: 0,
1064 sub_folded: HashSet::new(),1633 sub_folded: HashSet::new(),
1065 sub_lane: None,1634 sub_lane: None,
1066 snap_cue: None,1635 snap_cue: None,
1636+ menu_frame: None,
1067 ghost: Vec::new(),1637 ghost: Vec::new(),
1068 drag_x: None,1638 drag_x: None,
1069 drag_lane: None,1639 drag_lane: None,
@@ -1075,6 +1645,7 @@ fn main() {
1075 cancel_armed: false,1645 cancel_armed: false,
1076 export_started: None,1646 export_started: None,
1077 export_marks: Vec::new(),1647 export_marks: Vec::new(),
1648+ queue: export_queue::ExportQueue::default(),
1078 // Both derived from the file when it lands, by the same1649 // Both derived from the file when it lands, by the same
1079 // `open_media`/`load_project` a drop goes through: an1650 // `open_media`/`load_project` a drop goes through: an
1080 // export beside the picture, a save beside it too.1651 // export beside the picture, a save beside it too.
@@ -1082,23 +1653,53 @@ fn main() {
1082 export_known: None,1653 export_known: None,
1083 project_path: PathBuf::new(),1654 project_path: PathBuf::new(),
1084 autosave_dirty: false,1655 autosave_dirty: false,
1085- autosave_last_edit: None,1656+ autosave_edits: 0,
1086 autosave_last_run: None,1657 autosave_last_run: None,
1658+ autosave_urgent: false,
1087 recovery_sidecar: None,1659 recovery_sidecar: None,
1660+ recovery_failure: None,
1088 quit_ask: false,1661 quit_ask: false,
1089 save_ask: false,1662 save_ask: false,
1663+ proj_dialog: None,
1664+ new_project: None,
1665+ new_project_fresh: false,
1090 export_ask: false,1666 export_ask: false,
1667+ export_sheet: export_ui::ExportSheet {
1668+ size: export_prefs.size,
1669+ bit_depth: export_prefs.depth,
1670+ prores: export_prefs.prores,
1671+ hdr: export_prefs.hdr,
1672+ hevc_speed: export_prefs.hevc_speed,
1673+ sound_bits: export_prefs.sound_bits,
1674+ ..Default::default()
1675+ },
1091 autosave_armed: false,1676 autosave_armed: false,
1677+ disk_known: None,
1678+ edited_since_save: false,
1679+ saved_revision: None,
1092 keymap: keymap.clone(),1680 keymap: keymap.clone(),
1093 keys_open: false,1681 keys_open: false,
1682+ about_open: false,
1094 settings_open: false,1683 settings_open: false,
1095 settings_tab: ui::settings_stance::SettingsTab::Project,1684 settings_tab: ui::settings_stance::SettingsTab::Project,
1685+ settings_key_edit: None,
1686+ settings_keys_filter: String::new(),
1687+ settings_focus: None,
1096 keys_scroll: ScrollHandle::new(),1688 keys_scroll: ScrollHandle::new(),
1689+ export_scroll: ScrollHandle::new(),
1690+ palette_open: false,
1691+ palette_query: String::new(),
1692+ palette_sel: 0,
1693+ palette_scroll: ScrollHandle::new(),
1097 lanes_scroll: ScrollHandle::new(),1694 lanes_scroll: ScrollHandle::new(),
1098 eq_scroll: ScrollHandle::new(),1695 eq_scroll: ScrollHandle::new(),
1696+ export_body_scroll: ScrollHandle::new(),
1697+ settings_rows_scroll: ScrollHandle::new(),
1099 export_open: false,1698 export_open: false,
1699+ transcript_open: false,
1700+ transcript: player::transcript::Transcript::new(),
1100 eq_open: None,1701 eq_open: None,
1101- card_maximized: ui::dock_stance::load_maximized(),1702+ card_maximized: false,
1102 // Replaced by the clip's own curve the moment the card1703 // Replaced by the clip's own curve the moment the card
1103 // opens; nothing reads it before that.1704 // opens; nothing reads it before that.
1104 eq_params: EqParams::default(),1705 eq_params: EqParams::default(),
@@ -1110,14 +1711,42 @@ fn main() {
1110 speed_bar: Rc::default(),1711 speed_bar: Rc::default(),
1111 speed_dragging: false,1712 speed_dragging: false,
1112 pending_speed: None,1713 pending_speed: None,
1714+ speed_ramp_mode: false,
1715+ ramp_key_speed: None,
1113 mix_open: false,1716 mix_open: false,
1717+ markers_open: false,
1718+ history_open: false,
1719+ tools: None,
1720+ tools_runs: 0,
1721+ effects_open: None,
1722+ effects_draft: None,
1723+ effects_drag: None,
1724+ effects_adding: false,
1725+ effects_bars: Default::default(),
1726+ marker_sel: 0,
1727+ marker_edit: None,
1114 mix_field: 0,1728 mix_field: 0,
1115- sub_text,1729+ mix_solo: Vec::new(),
1116- sub_family,1730+ mix_panel: Default::default(),
1731+ mix_drag: None,
1732+ sub_text: sub_style.size,
1733+ sub_family: sub_style.family,
1734+ sub_outline: sub_style.outline,
1735+ sub_boxed: sub_style.boxed,
1736+ sub_place: sub_style.place,
1737+ sub_dragging: false,
1738+ sub_font_open: false,
1739+ sub_font_query: String::new(),
1117 subtitle_style_open: false,1740 subtitle_style_open: false,
1118 subtitle_style_field: 0,1741 subtitle_style_field: 0,
1742+ sub_anim_open: false,
1743+ sub_keys_used: false,
1119 subtitle_fonts: Vec::new(),1744 subtitle_fonts: Vec::new(),
1120 silence_open: None,1745 silence_open: None,
1746+ beats_open: None,
1747+ beats_every: 0,
1748+ beats_scan: None,
1749+ beats_last: None,
1121 // The conservative defaults the engine documents: a first1750 // The conservative defaults the engine documents: a first
1122 // scan that leaves a little too much is one nobody undoes.1751 // scan that leaves a little too much is one nobody undoes.
1123 silence: engine::silence::Settings::default(),1752 silence: engine::silence::Settings::default(),
@@ -1150,30 +1779,51 @@ fn main() {
1150 decode_watch_gen: 0,1779 decode_watch_gen: 0,
1151 viz_slot: VizSlot::Main,1780 viz_slot: VizSlot::Main,
1152 viz_hex_edit: None,1781 viz_hex_edit: None,
1782+ cue_edit: None,
1783+ sel_cue: None,
1784+ cue_num: None,
1785+ cue_num_scrub: None,
1786+ still_num: None,
1787+ cue_drag: None,
1788+ cue_menu: None,
1153 pending_viz: None,1789 pending_viz: None,
1154 color_bars: std::array::from_fn(|_| Rc::default()),1790 color_bars: std::array::from_fn(|_| Rc::default()),
1791+ color_section: ColorSection::Basic,
1792+ color_wheel: 0,
1793+ color_wheel_drag: None,
1794+ color_pads: std::array::from_fn(|_| Rc::default()),
1795+ color_masters: std::array::from_fn(|_| Rc::default()),
1796+ color_curve: 0,
1797+ scope_view: ScopeView::Histogram,
1798+ scopes: None,
1155 pending_color: None,1799 pending_color: None,
1156 transform_open: None,1800 transform_open: None,
1157 transform_band: 0,1801 transform_band: 0,
1158 transform_dragging: false,1802 transform_dragging: false,
1803+ opacity_drag: false,
1804+ opacity_bar: Rc::default(),
1159 transform_bars: std::array::from_fn(|_| Rc::default()),1805 transform_bars: std::array::from_fn(|_| Rc::default()),
1160 pending_transform: None,1806 pending_transform: None,
1161 // Empty until the first frame is pumped, which draws as a1807 // Empty until the first frame is pumped, which draws as a
1162 // flat line rather than as a shape nothing measured.1808 // flat line rather than as a shape nothing measured.
1163- histogram: [[0; HIST_BINS]; 3],1809+ histogram: [0; HIST_BINS],
1810+ folds: load_folds(),
1164 // Nobody has chosen a budget yet, which is not the same1811 // Nobody has chosen a budget yet, which is not the same
1165 // as a budget of nothing: the lever opens on the engine's1812 // as a budget of nothing: the lever opens on the engine's
1166 // own automatic figure for the picture that is open.1813 // own automatic figure for the picture that is open.
1167- custom_bps: 0,1814+ custom_bps: export_prefs.bps,
1168 budget_edit: None,1815 budget_edit: None,
1169- budget_bar: Rc::default(),
1170 transition_edit: None,1816 transition_edit: None,
1171 // ...and the rate the sound has always been written at.1817 // ...and the rate the sound has always been written at.
1172- audio_kbps: DEFAULT_AUDIO_KBPS,1818+ audio_kbps: export_prefs.audio_kbps,
1173- // Picture and sound, which is what an export was before1819+ // The picture and sound this computer last used, or the
1174- // there was anything to pick.1820+ // ones an export always was before there was anything to pick.
1175- format: Format::default(),1821+ format: export_prefs.format,
1176- notices: notice.clone().map(SharedString::from).into_iter().collect(),1822+ notices: notice
1823+ .clone()
1824+ .map(|text| Toast::new(text.into()))
1825+ .into_iter()
1826+ .collect(),
1177 exported: None,1827 exported: None,
1178 // The whole of argv, waiting for the first repaint to start1828 // The whole of argv, waiting for the first repaint to start
1179 // it: the window is up before a byte of it is read.1829 // it: the window is up before a byte of it is read.
@@ -1185,11 +1835,17 @@ fn main() {
1185 titled: String::new(),1835 titled: String::new(),
1186 displayed: 0,1836 displayed: 0,
1187 dropped: 0,1837 dropped: 0,
1838+ playing_last: false,
1839+ drop_stop: None,
1188 started: None,1840 started: None,
1189 focus: cx.focus_handle(),1841 focus: cx.focus_handle(),
1190 focus_dock: cx.focus_handle(),1842 focus_dock: cx.focus_handle(),
1191 focus_bench: cx.focus_handle(),1843 focus_bench: cx.focus_handle(),
1192 focus_inspector: cx.focus_handle(),1844 focus_inspector: cx.focus_handle(),
1845+ focus_settings: cx.focus_handle(),
1846+ dlg_pool: (0..64).map(|_| cx.focus_handle().tab_stop(true)).collect(),
1847+ dlg_was_up: false,
1848+ focus_guard_pending: false,
1193 });1849 });
1194 // Nothing else takes focus, and without it the key listener1850 // Nothing else takes focus, and without it the key listener
1195 // above is never reached.1851 // above is never reached.
@@ -1201,17 +1857,29 @@ fn main() {
1201 // window up, which is what turns "closing" into a question1857 // window up, which is what turns "closing" into a question
1202 // when the timeline holds work no file has.1858 // when the timeline holds work no file has.
1203 let asking = player.clone();1859 let asking = player.clone();
1204- window.on_window_should_close(cx, move |_, cx| {1860+ window.on_window_should_close(cx, move |window, cx| {
1205 asking.update(cx, |player, cx| {1861 asking.update(cx, |player, cx| {
1206 if !player.close_needs_answer() {1862 if !player.close_needs_answer() {
1863+ // The one door out with nothing to ask: the view is
1864+ // kept for the next open, best effort.
1865+ player.save_view_state();
1207 return true;1866 return true;
1208 }1867 }
1209 player.quit_ask = true;1868 player.quit_ask = true;
1869+ // The question owns the keyboard, so the root must hold the focus
1870+ // whatever had it when the request came in.
1871+ window.focus(&player.focus);
1210 cx.notify();1872 cx.notify();
1211 false1873 false
1212 })1874 })
1213 });1875 });
1214 player.update(cx, |player, cx| player.start_autosave(cx));1876 player.update(cx, |player, cx| player.start_autosave(cx));
1877+ player.update(cx, |player, cx| player.start_follow(cx));
1878+ // `EDITH_OPEN`: screenshot runs reach panels; unset, nothing.
1879+ if let Ok(spec) = std::env::var("EDITH_OPEN") {
1880+ let wanted = open_hook::parse(&spec);
1881+ player.update(cx, |player, cx| player.start_open_hook(wanted, cx));
1882+ }
1215 player1883 player
1216 },1884 },
1217 )1885 )
crates/app/src/menus.rsmodified+747 -26
@@ -19,6 +19,9 @@ pub(crate) enum MenuOn {
19 /// the undo pair ([`BENCH_ITEMS`]). The lane field means nothing here and19 /// the undo pair ([`BENCH_ITEMS`]). The lane field means nothing here and
20 /// no row reads it.20 /// no row reads it.
21 Bench,21 Bench,
22+ /// An empty stretch of a lane's bed with no gap to close: Paste and the two track adds
23+ /// ([`empty_items`]). The lane names the track the stretch is on.
24+ Empty,
22 /// A lane head: the verbs of the track itself, on the lane the menu25 /// A lane head: the verbs of the track itself, on the lane the menu
23 /// already names ([`oracle::lane_items`]).26 /// already names ([`oracle::lane_items`]).
24 Head,27 Head,
@@ -28,6 +31,18 @@ pub(crate) enum MenuOn {
28 /// empty library included, which is exactly when a pasted path is worth31 /// empty library included, which is exactly when a pasted path is worth
29 /// most. The lane field means nothing here and no row reads it.32 /// most. The lane field means nothing here and no row reads it.
30 Dock,33 Dock,
34+ /// The viewer's picture: what the picture can be told ([`VIEWER_ITEMS`]).
35+ /// The lane field means nothing here and no row reads it.
36+ Viewer,
37+ /// A sequence tab: the verbs of the sequence ([`SEQ_TAB_ITEMS`]); the tab was opened first,
38+ /// so they act on the open sequence.
39+ SeqTab,
40+ /// A bin row in the media list: the verbs of the bin ([`BIN_ITEMS`]); the bin was picked
41+ /// first, so they act on it.
42+ Bin,
43+ /// A comment marker on the ruler: its verbs ([`MARKER_ITEMS`]); the marker was selected
44+ /// first, so they act on it.
45+ Marker,
31 }46 }
32 47
33 /// An open clip menu: what it was opened on, where it hangs, and whether it48 /// An open clip menu: what it was opened on, where it hangs, and whether it
@@ -41,6 +56,11 @@ pub(crate) struct ContextMenu {
41 pub(crate) on: MenuOn,56 pub(crate) on: MenuOn,
42 pub(crate) at: Point<Pixels>,57 pub(crate) at: Point<Pixels>,
43 pub(crate) details: bool,58 pub(crate) details: bool,
59+ /// A submenu is out beside the plate: "Adjust" (the card openers), or "Compound" when
60+ /// [`ContextMenu::compound`] says so. One at a time.
61+ pub(crate) adjust: bool,
62+ /// The submenu that is out is "Compound" (nest, break apart, open), not "Adjust".
63+ pub(crate) compound: bool,
44 }64 }
45 65
46 /// An open library menu: which row it was opened on -- the file and the stream,66 /// An open library menu: which row it was opened on -- the file and the stream,
@@ -69,6 +89,12 @@ pub(crate) struct Picker {
69 /// only door is a pointer is a setting half this editor's users cannot89 /// only door is a pointer is a setting half this editor's users cannot
70 /// reach, which is the rule `FIXED` already writes down for every card.90 /// reach, which is the rule `FIXED` already writes down for every card.
71 pub(crate) sel: usize,91 pub(crate) sel: usize,
92+ /// Whether the list keeps off the picture and timeline (a list opened from the menu bar's
93+ /// own corner or the status bar) or hangs from the foot of the dock button that opened it.
94+ pub(crate) floored: bool,
95+ /// For a list hung from a recorded control ([`crate::ui::anchor`]): the control's top edge,
96+ /// where the plate's bottom goes when there is no room below.
97+ pub(crate) above: Option<f32>,
72 }98 }
73 99
74 /// Which setting an open list is offering. The fit policy names the clip it is100 /// Which setting an open list is offering. The fit policy names the clip it is
@@ -83,6 +109,18 @@ pub(crate) enum Pick {
83 /// beside the resolution and rate it shares a row style with.109 /// beside the resolution and rate it shares a row style with.
84 SampleRate,110 SampleRate,
85 Fit(Lane, usize),111 Fit(Lane, usize),
112+ /// The colour label of the clip at (lane, index) ([`engine::project::LABELS`]).
113+ Label(Lane, usize),
114+ /// The easing of the key on the playhead, for one kind of key.
115+ KeyEase(engine::project::KeyKind),
116+ /// The viewer's zoom, playback quality and aspect mask: lists on the viewer header.
117+ ViewZoom,
118+ OutputDisplay,
119+ ViewQuality,
120+ ViewMask,
121+ ViewGuides,
122+ /// The colour of marker `n`, from the markers card's swatch.
123+ MarkerColor(usize),
86 /// What the export's *sound* is coded at. Opened from the card's Sound row,124 /// What the export's *sound* is coded at. Opened from the card's Sound row,
87 /// which is the only place it means anything.125 /// which is the only place it means anything.
88 #[allow(dead_code)] // opened from Settings now126 #[allow(dead_code)] // opened from Settings now
@@ -90,16 +128,29 @@ pub(crate) enum Pick {
90 /// Which HDR-to-SDR rendition the project is watched and exported in128 /// Which HDR-to-SDR rendition the project is watched and exported in
91 /// ([`engine::tonemap::Preset`]). Opened from the panel, beside the two129 /// ([`engine::tonemap::Preset`]). Opened from the panel, beside the two
92 /// other settings that are the project's rather than the media's.130 /// other settings that are the project's rather than the media's.
131+ #[allow(dead_code)] // three chips on the settings page now
93 Tone,132 Tone,
94 /// Which palette the window is painted in ([`ui::theme`]). The one setting133 /// Which palette the window is painted in ([`ui::theme`]). The one setting
95 /// here that is nobody's project: it is the person's, so it outlives the134 /// here that is nobody's project: it is the person's, so it outlives the
96 /// timeline and every file opened in it.135 /// timeline and every file opened in it.
97 Theme,136 Theme,
137+ /// Which accent colour the window wears ([`ui::theme::AccentId`]); the person's, like [`Pick::Theme`].
138+ Accent,
98 /// Which encoder an export writes the picture with139 /// Which encoder an export writes the picture with
99 /// ([`engine::export::EncoderSeat`]). Opened from the card's Encoder row,140 /// ([`engine::export::EncoderSeat`]). Opened from the card's Encoder row,
100 /// which is the only place it means anything.141 /// which is the only place it means anything.
101 #[allow(dead_code)] // opened from Settings now142 #[allow(dead_code)] // opened from Settings now
102 Encoder,143 Encoder,
144+ /// Which file an export is written as -- the codec and its box in one
145+ /// list ([`ui::settings_stance::picture_choices`]). Opened from the
146+ /// settings page's Picture row: nine answers are too many for chips.
147+ Picture,
148+ /// A Details row of the Export tab (preset, container, codec, ...).
149+ Export(crate::export_ui::ExportRow),
150+ /// The bin the picked media are filed in; the list offers every bin and "No bin".
151+ Bin,
152+ /// How often the session is autosaved beside its file, from Settings ([`player::library::AUTOSAVE_CHOICES`]).
153+ Autosave,
103 }154 }
104 155
105 /// One value a list offers, carrying everything picking it needs -- so a click156 /// One value a list offers, carrying everything picking it needs -- so a click
@@ -112,14 +163,40 @@ pub(crate) enum Pick {
112 pub(crate) enum Choice {163 pub(crate) enum Choice {
113 Size(u32, u32),164 Size(u32, u32),
114 Fps(f64),165 Fps(f64),
115- /// `None` is "source" -- the rate derived from the first audio source,166+ /// `None` is "source" -- the rate derived from the sources (the highest
167+ /// among them, 48 kHz when all are below 44.1 kHz),
116 /// [`engine::PlaybackSession::set_sample_rate`]'s own default.168 /// [`engine::PlaybackSession::set_sample_rate`]'s own default.
117 SampleRate(Option<u32>),169 SampleRate(Option<u32>),
118 Fit(Lane, usize, FitPolicy),170 Fit(Lane, usize, FitPolicy),
171+ /// A label number for the clip: 0 none, else 1..=[`engine::project::LABEL_COUNT`].
172+ Label(Lane, usize, u8),
173+ KeyEase(engine::project::KeyKind, engine::transform::KeyEase),
174+ ViewZoom(crate::viewer_view::Zoom),
175+ /// An index into [`Player::output_displays`].
176+ OutputDisplay(usize),
177+ ViewQuality(crate::viewer_view::Quality),
178+ ViewMask(crate::viewer_view::Mask),
179+ ViewGuides(crate::viewer_view::Guide),
180+ MarkerColor(usize, engine::project::MarkerColor),
119 AudioRate(u32),181 AudioRate(u32),
120 Tone(Preset),182 Tone(Preset),
121 Theme(ui::theme::PaletteId),183 Theme(ui::theme::PaletteId),
184+ Accent(ui::theme::AccentId),
122 Encoder(EncoderSeat),185 Encoder(EncoderSeat),
186+ Picture(Format),
187+ /// A Details row of the Export tab ([`Pick::Export`]).
188+ Export(crate::export_ui::ExportPick),
189+ /// File the picked media in bin `n` (`0`: out of every bin) ([`Pick::Bin`]).
190+ Bin(u32),
191+ /// The autosave period in seconds, `None` for Off ([`Pick::Autosave`]).
192+ Autosave(Option<u64>),
193+}
194+
195+/// A status-bar item a shortcut-opened list hangs above.
196+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
197+pub(crate) enum LedgerItem {
198+ Size,
199+ Clip,
123 }200 }
124 201
125 /// One row of an open list: the value, its name, the small print beside it, and202 /// One row of an open list: the value, its name, the small print beside it, and
@@ -132,43 +209,88 @@ pub(crate) type ChoiceRow = (Choice, SharedString, SharedString, bool);
132 /// the label and the chord are written here rather than read off the keymap.209 /// the label and the chord are written here rather than read off the keymap.
133 #[derive(Clone, Copy, PartialEq)]210 #[derive(Clone, Copy, PartialEq)]
134 pub(crate) enum RowItem {211 pub(crate) enum RowItem {
212+ /// Point a missing file at its new place ([`Player::relink_pick`]). Listed
213+ /// only on a row whose file is gone.
214+ Relink,
215+ /// Put the source on the end of the timeline, after the last clip on any lane
216+ /// ([`Player::append_source`]). The default: the first row, and what Enter does.
135 Add,217 Add,
218+ /// Insert the source at the playhead, pushing the clips after it right
219+ /// ([`Player::insert_source`] with no lane and no position).
220+ Insert,
136 /// Play the source outside the timeline ([`Player::open_preview`]). The221 /// Play the source outside the timeline ([`Player::open_preview`]). The
137 /// row's `▷` ghost until cleanse round 2 (2026-09-10); a double-click on222 /// row's `▷` ghost until cleanse round 2 (2026-09-10); a double-click on
138 /// the row is the other door.223 /// the row is the other door.
139 Preview,224 Preview,
140- /// Make or delete the source's stand-in ([`Player::toggle_proxy`]) -- the225+ /// Make or stop the source's stand-in ([`Player::toggle_proxy`]) -- the
141 /// row's `○` ghost until the same cleanse. Settings carries the policy;226 /// row's `○` ghost until the same cleanse. Settings carries the policy;
142- /// this is the one file.227+ /// this is the one file. Reads "Stop editing copy" while one is being made.
143 Proxy,228 Proxy,
229+ /// Makes a multicam clip from the picked rows ([`Player::create_multicam_selected`]).
230+ /// Refused until two or more are picked, saying how.
231+ CreateMulticam,
232+ /// Take the source out of the library. Refused while any clip plays it
233+ /// (the engine's own rule), and destructive, so it sits below the rule.
144 Remove,234 Remove,
145- /// Remove that first deletes every clip playing the row. The plain235+ /// Remove that first deletes every clip playing the row. It is listed
146- /// [`RowItem::Remove`] is refused while any clip plays a source (the236+ /// always and refused with a reason while nothing plays the file, so the
147- /// engine's own rule), which used to leave a placed source with no way237+ /// pointer can see the way out exists; destructive, so it sits below the
148- /// out of the library at all -- this is that way out, and it is238+ /// rule and says how many clips it takes with it.
149- /// destructive, so it is listed only when it is the one that applies and
150- /// it says how many clips it takes with it.
151 RemoveWithClips,239 RemoveWithClips,
152 Reveal,240 Reveal,
153 Properties,241 Properties,
242+ /// Stars the source, or takes the star off ([`Player::toggle_favourite`]).
243+ Favourite,
244+ /// Opens the list of bins to file the source in ([`Pick::Bin`]).
245+ MoveToBin,
246+ /// Makes a bin holding this source, named in place ([`Player::new_bin`]).
247+ NewBin,
154 }248 }
155 249
156-pub(crate) const ROW_ITEMS: [RowItem; 7] = [250+/// Menu rows in the order the Media row menu lists them (DESIGN §6.7). The two
251+/// destructive rows are last, under the rule line ([`RowItem::destructive`]).
252+pub(crate) const ROW_ITEMS: [RowItem; 13] = [
253+ RowItem::Relink,
157 RowItem::Add,254 RowItem::Add,
255+ RowItem::Insert,
158 RowItem::Preview,256 RowItem::Preview,
159 RowItem::Proxy,257 RowItem::Proxy,
160- RowItem::Remove,258+ RowItem::CreateMulticam,
161- RowItem::RemoveWithClips,259+ RowItem::Favourite,
260+ RowItem::MoveToBin,
261+ RowItem::NewBin,
162 RowItem::Reveal,262 RowItem::Reveal,
163 RowItem::Properties,263 RowItem::Properties,
264+ RowItem::Remove,
265+ RowItem::RemoveWithClips,
164 ];266 ];
165 267
166 impl RowItem {268 impl RowItem {
269+ /// The icon the row wears in the media menu's icon column.
270+ pub(crate) fn icon(self) -> crate::ui::icons::Icon {
271+ use crate::ui::icons::Icon as I;
272+ match self {
273+ Self::Relink => I::Link,
274+ Self::Add | Self::Insert => I::Plus,
275+ Self::Preview => I::Play,
276+ Self::Proxy => I::Gauge,
277+ Self::Remove | Self::RemoveWithClips => I::Trash2,
278+ Self::Reveal => I::FolderOpen,
279+ Self::Properties => I::Info,
280+ Self::Favourite => I::Star,
281+ Self::MoveToBin | Self::NewBin => I::Folder,
282+ Self::CreateMulticam => I::Layers,
283+ }
284+ }
285+
167 pub(crate) fn label(self) -> &'static str {286 pub(crate) fn label(self) -> &'static str {
168 match self {287 match self {
169- Self::Add => "Add at playhead",288+ Self::Relink => "Relink…",
170- Self::Preview => "Preview",289+ Self::Add => "Append to timeline end",
171- Self::Proxy => "Proxy",290+ Self::Insert => "Insert at playhead",
291+ Self::CreateMulticam => "Create multicam…",
292+ Self::Preview => "Open in source viewer",
293+ Self::Proxy => "Make editing copy",
172 Self::Remove => "Remove from library",294 Self::Remove => "Remove from library",
173 // The consequence is in the label now rather than in the hint295 // The consequence is in the label now rather than in the hint
174 // column beside a label identical to the plain remove's: that296 // column beside a label identical to the plain remove's: that
@@ -179,9 +301,28 @@ impl RowItem {
179 Self::RemoveWithClips => "Remove with its clips",301 Self::RemoveWithClips => "Remove with its clips",
180 Self::Reveal => "Reveal in files",302 Self::Reveal => "Reveal in files",
181 Self::Properties => "Properties",303 Self::Properties => "Properties",
304+ Self::Favourite => "Favourite",
305+ Self::MoveToBin => "Move to bin…",
306+ Self::NewBin => "New bin",
307+ }
308+ }
309+
310+ /// The label this row wears in `ctx`: the one state-dependent label, the
311+ /// proxy row's, reads "Stop editing copy" while a stand-in is being made.
312+ pub(crate) fn label_in(self, ctx: RowCtx) -> &'static str {
313+ match self {
314+ Self::Proxy if ctx.proxy_stops => "Stop editing copy",
315+ Self::Favourite if ctx.starred => "Remove from favourites",
316+ _ => self.label(),
182 }317 }
183 }318 }
184 319
320+ /// Whether the row takes something away -- the rows below the rule line
321+ /// ([`destructive`] is the same answer for the clip menu).
322+ pub(crate) fn destructive(self) -> bool {
323+ matches!(self, Self::Remove | Self::RemoveWithClips)
324+ }
325+
185 /// The dim right-hand column: the *stroke* that does the same thing, the326 /// The dim right-hand column: the *stroke* that does the same thing, the
186 /// one thing DESIGN §4 puts there ("every command wears its chord"), and327 /// one thing DESIGN §4 puts there ("every command wears its chord"), and
187 /// nothing at all where no stroke reaches the verb.328 /// nothing at all where no stroke reaches the verb.
@@ -189,20 +330,22 @@ impl RowItem {
189 /// It used to carry a prose gloss on every row -- a phrase about the whole330 /// It used to carry a prose gloss on every row -- a phrase about the whole
190 /// file, one about the desktop's file browser, one about clips -- which is331 /// file, one about the desktop's file browser, one about clips -- which is
191 /// §8's instructional copy sitting in the column the sibling clip menu332 /// §8's instructional copy sitting in the column the sibling clip menu
192- /// spends on chords, and which the user read as the crowding it is. The333+ /// spends on chords, and which the user read as the crowding it is. A
193- /// only row a stroke reaches is the add (`ui/stance.rs`'s `enter` branch,334+ /// refusal still prints here in place of the chord (`oracle::row_enable`)
194- /// live while a dock row is picked); its own row in the dock already wears335+ /// -- that is state, not instruction.
195- /// the same `↵`. A refusal still prints here in place of the chord
196- /// (`oracle::row_enable`) -- that is state, not instruction.
197 pub(crate) fn hint(self) -> &'static str {336 pub(crate) fn hint(self) -> &'static str {
198 match self {337 match self {
199- Self::Add => "↵",338+ Self::Add | Self::Insert | Self::CreateMulticam => "",
200- Self::Preview339+ Self::Preview => "↵",
340+ Self::Relink
201 | Self::Proxy341 | Self::Proxy
202 | Self::Remove342 | Self::Remove
203 | Self::RemoveWithClips343 | Self::RemoveWithClips
204 | Self::Reveal344 | Self::Reveal
205- | Self::Properties => "",345+ | Self::Properties
346+ | Self::Favourite
347+ | Self::MoveToBin
348+ | Self::NewBin => "",
206 }349 }
207 }350 }
208 }351 }
@@ -211,7 +354,7 @@ impl RowItem {
211 /// action a stroke already reaches -- the menu is a second way *to* the actions354 /// action a stroke already reaches -- the menu is a second way *to* the actions
212 /// and never a second version of them -- so both the label and the hint come355 /// and never a second version of them -- so both the label and the hint come
213 /// out of the keymap registry and the two can never disagree.356 /// out of the keymap registry and the two can never disagree.
214-pub(crate) const MENU_ITEMS: [ActionId; 20] = [357+pub(crate) const MENU_ITEMS: [ActionId; 31] = [
215 ActionId::Cut,358 ActionId::Cut,
216 // The cut machinery (DESIGN.md §6) on the very clip it is about: the359 // The cut machinery (DESIGN.md §6) on the very clip it is about: the
217 // trims and the loop-trim were strokes the spine rail listed and nothing360 // trims and the loop-trim were strokes the spine rail listed and nothing
@@ -228,6 +371,9 @@ pub(crate) const MENU_ITEMS: [ActionId; 20] = [
228 // the menu names, and paste is the timeline's rather than this clip's.371 // the menu names, and paste is the timeline's rather than this clip's.
229 ActionId::Copy,372 ActionId::Copy,
230 ActionId::Paste,373 ActionId::Paste,
374+ // The clip's colour label and its on/off switch (Premiere's Label and Enable).
375+ ActionId::ClipLabel,
376+ ActionId::ClipEnabled,
231 // The two joins, one per kind, each hidden over the other kind377 // The two joins, one per kind, each hidden over the other kind
232 // (`oracle::enable`, DESIGN §8's class refusal): sound crossfades, picture378 // (`oracle::enable`, DESIGN §8's class refusal): sound crossfades, picture
233 // dissolves, and neither is ever offered over the wrong waveform.379 // dissolves, and neither is ever offered over the wrong waveform.
@@ -236,12 +382,22 @@ pub(crate) const MENU_ITEMS: [ActionId; 20] = [
236 // The picture cards...382 // The picture cards...
237 ActionId::Color,383 ActionId::Color,
238 ActionId::Transform,384 ActionId::Transform,
385+ ActionId::Effects,
239 // ...and the sound ones, the same class refusal the other way round.386 // ...and the sound ones, the same class refusal the other way round.
240 ActionId::Equalizer,387 ActionId::Equalizer,
241 ActionId::Silence,388 ActionId::Silence,
389+ ActionId::MarkBeats,
242 ActionId::Visualizer,390 ActionId::Visualizer,
391+ ActionId::Reframe,
392+ ActionId::TrackMask,
243 ActionId::Speed,393 ActionId::Speed,
394+ ActionId::Reverse,
244 ActionId::Fit,395 ActionId::Fit,
396+ // The compound clip's three verbs, folded into one "Compound" submenu like the cards.
397+ ActionId::NestClips,
398+ ActionId::BreakApart,
399+ ActionId::OpenCompound,
400+ ActionId::FlattenMulticam,
245 // The group trio used to live only on chords + ctrl-click. A right-click401 // The group trio used to live only on chords + ctrl-click. A right-click
246 // that cannot group is a missing pointer door (the same class Fit and402 // that cannot group is a missing pointer door (the same class Fit and
247 // Redo shipped as). Dimmed in place when the selection cannot.403 // Redo shipped as). Dimmed in place when the selection cannot.
@@ -263,15 +419,35 @@ pub(crate) const MENU_ITEMS: [ActionId; 20] = [
263 /// undo pair, which is the one thing every editor expects on empty canvas.419 /// undo pair, which is the one thing every editor expects on empty canvas.
264 /// Not a junk drawer (§9): nothing here acts on a clip, and everything here420 /// Not a junk drawer (§9): nothing here acts on a clip, and everything here
265 /// acts on the thing the pointer is over.421 /// acts on the thing the pointer is over.
266-pub(crate) const BENCH_ITEMS: [ActionId; 11] = [422+pub(crate) const BENCH_ITEMS: [ActionId; 22] = [
423+ // The two that act on the frame the pointer named, first and in this order: a marker
424+ // there, then the playhead there (the ruler's own verbs, not the playhead's).
425+ ActionId::MarkerHere,
426+ ActionId::PlayheadHere,
427+ // Where the playhead goes, then the range it marks: the ruler is the
428+ // strip a person clicks to seek, so its menu leads with the seek pair and
429+ // the in/out pair that frames a range on it. Nothing here is destructive
430+ // (`ClearRange` only lets go of the marks), so the list still ends on the
431+ // undo pair and the rule-free tail.
432+ ActionId::GoStart,
433+ ActionId::GoEnd,
434+ ActionId::SetIn,
435+ ActionId::SetOut,
436+ ActionId::ClearRange,
267 // The `all` control left the ruler's right edge (cleanse round 2): this437 // The `all` control left the ruler's right edge (cleanse round 2): this
268 // row is where the pointer reaches "select everything" now, and `^a`438 // row is where the pointer reaches "select everything" now, and `^a`
269 // still fires it.439 // still fires it.
270 ActionId::SelectAll,440 ActionId::SelectAll,
441+ ActionId::Paste,
271 ActionId::WalkCutPrev,442 ActionId::WalkCutPrev,
272 ActionId::WalkCutNext,443 ActionId::WalkCutNext,
273 ActionId::WalkCutPrev10,444 ActionId::WalkCutPrev10,
274 ActionId::WalkCutNext10,445 ActionId::WalkCutNext10,
446+ // The comment markers: drop one at the playhead, walk to its neighbours, or open the
447+ // list -- the ruler is where they are drawn, so its menu is where they are reached.
448+ ActionId::PrevMarker,
449+ ActionId::NextMarker,
450+ ActionId::Markers,
275 ActionId::ZoomOut,451 ActionId::ZoomOut,
276 ActionId::ZoomIn,452 ActionId::ZoomIn,
277 ActionId::ZoomFit,453 ActionId::ZoomFit,
@@ -280,19 +456,60 @@ pub(crate) const BENCH_ITEMS: [ActionId; 11] = [
280 ActionId::Redo,456 ActionId::Redo,
281 ];457 ];
282 458
459+/// What a right-click on the viewer offers: the things the picture itself
460+/// answers to -- play it, loop it, keep the frame, go full screen -- and the
461+/// way to Settings. Every one is an [`ActionId`] the keyboard already reaches.
462+pub(crate) const VIEWER_ITEMS: [ActionId; 5] = [
463+ ActionId::Play,
464+ ActionId::Loop,
465+ ActionId::Screenshot,
466+ ActionId::Fullscreen,
467+ ActionId::Settings,
468+];
469+
470+/// What a right-click on a sequence tab offers.
471+pub(crate) const SEQ_TAB_ITEMS: [ActionId; 3] =
472+ [ActionId::RenameSequence, ActionId::DuplicateSequence, ActionId::DeleteSequence];
473+
474+/// What a right-click on a comment marker on the ruler offers: the marker was selected first,
475+/// so these act on it ([`Player::rename_marker_at_pick`], [`Player::delete_marker_at_pick`]).
476+pub(crate) const MARKER_ITEMS: [ActionId; 2] = [ActionId::RenameMarker, ActionId::DeleteMarker];
477+
478+/// What a right-click on a bin row offers.
479+/// The media row's own doors for `ActionId::ToggleFavourite` (Favourite) and
480+/// `ActionId::MoveToBin`; the dock's All / Favourites control is the door for
481+/// `ActionId::ShowFavourites` and `ActionId::ShowAllMedia`.
482+pub(crate) const BIN_ITEMS: [ActionId; 3] = [ActionId::RenameBin, ActionId::NewBinInside, ActionId::RemoveBin];
483+
283 /// What a right-click on the dock's Sources body offers: the three ways a484 /// What a right-click on the dock's Sources body offers: the three ways a
284 /// file gets in. Every one is an [`ActionId`] the keyboard already reaches,485 /// file gets in. Every one is an [`ActionId`] the keyboard already reaches,
285 /// so the row's label and its chord come out of the registry -- the dock486 /// so the row's label and its chord come out of the registry -- the dock
286 /// itself only draws one of them (`Add`) as a row of its own now.487 /// itself only draws one of them (`Add`) as a row of its own now.
287-pub(crate) const DOCK_ITEMS: [ActionId; 3] = [488+pub(crate) const DOCK_ITEMS: [ActionId; 13] = [
288 ActionId::AddFiles,489 ActionId::AddFiles,
289 ActionId::PasteFilePath,490 ActionId::PasteFilePath,
290 ActionId::ImportSubtitles,491 ActionId::ImportSubtitles,
492+ ActionId::NewBin,
493+ ActionId::CreateMulticam,
494+ ActionId::NewSolid,
495+ ActionId::NewGradient,
496+ ActionId::NewCountdown,
497+ ActionId::NewBars,
498+ ActionId::NewTone,
499+ ActionId::NewBarsAndTone,
500+ ActionId::NewAdjustment,
501+ ActionId::NewTitle,
291 ];502 ];
292 503
293 /// The tracks a lane head's menu can add, in the order it lists them. Its504 /// The tracks a lane head's menu can add, in the order it lists them. Its
294 /// remove is the one of the clicked lane's own kind and comes from505 /// remove is the one of the clicked lane's own kind and comes from
295 /// [`oracle::lane_items`], which is what puts it under the rule line.506 /// [`oracle::lane_items`], which is what puts it under the rule line.
507+/// What an empty stretch of a bed offers with no gap to close: the clipboard's paste and the
508+/// two track adds, whichever track it is on.
509+pub(crate) fn empty_items(_lane: Lane) -> Vec<ActionId> {
510+ vec![ActionId::Paste, ActionId::AddVideoLane, ActionId::AddAudioLane]
511+}
512+
296 pub(crate) const HEAD_ADDS: [ActionId; 3] = [513 pub(crate) const HEAD_ADDS: [ActionId; 3] = [
297 ActionId::AddVideoLane,514 ActionId::AddVideoLane,
298 ActionId::AddAudioLane,515 ActionId::AddAudioLane,
@@ -303,6 +520,33 @@ pub(crate) const HEAD_ADDS: [ActionId; 3] = [
303 /// line, wherever the row is listed. One answer, so the clip menu and the lane520 /// line, wherever the row is listed. One answer, so the clip menu and the lane
304 /// head's menu cannot come to disagree about which of their rows is the521 /// head's menu cannot come to disagree about which of their rows is the
305 /// dangerous one.522 /// dangerous one.
523+/// The card openers a clip's menu folds into its one "Adjust" submenu, so the
524+/// top level keeps the high-frequency rows and always fits the window.
525+pub(crate) fn adjust_item(action: ActionId) -> bool {
526+ matches!(
527+ action,
528+ ActionId::Color
529+ | ActionId::Transform
530+ | ActionId::Effects
531+ | ActionId::Equalizer
532+ | ActionId::Silence
533+ | ActionId::MarkBeats
534+ | ActionId::Visualizer
535+ | ActionId::Reframe
536+ | ActionId::TrackMask
537+ | ActionId::Speed
538+ | ActionId::Fit
539+ )
540+}
541+
542+/// The compound-clip verbs a clip's menu folds into its one "Compound" submenu.
543+pub(crate) fn compound_item(action: ActionId) -> bool {
544+ matches!(
545+ action,
546+ ActionId::NestClips | ActionId::BreakApart | ActionId::OpenCompound | ActionId::FlattenMulticam
547+ )
548+}
549+
306 pub(crate) fn destructive(action: ActionId) -> bool {550 pub(crate) fn destructive(action: ActionId) -> bool {
307 matches!(551 matches!(
308 action,552 action,
@@ -311,6 +555,8 @@ pub(crate) fn destructive(action: ActionId) -> bool {
311 | ActionId::RemoveVideoLane555 | ActionId::RemoveVideoLane
312 | ActionId::RemoveAudioLane556 | ActionId::RemoveAudioLane
313 | ActionId::RemoveSubtitleLane557 | ActionId::RemoveSubtitleLane
558+ | ActionId::DeleteSequence
559+ | ActionId::RemoveBin
314 )560 )
315 }561 }
316 562
@@ -339,10 +585,14 @@ pub(crate) fn keys_rows() -> Vec<KeyRow> {
339 let mut rows = Vec::new();585 let mut rows = Vec::new();
340 for category in keymap::Category::ALL {586 for category in keymap::Category::ALL {
341 rows.push(KeyRow::Head(category));587 rows.push(KeyRow::Head(category));
588+ // The nine angle keys are one row: Angle1 is labelled "angle 1–9" and
589+ // the other eight are reached by the same number keys, so they stay in
590+ // the registry (and keep their keys) but get no row of their own.
342 rows.extend(591 rows.extend(
343 ActionId::ALL592 ActionId::ALL
344 .into_iter()593 .into_iter()
345 .filter(|a| a.category() == category)594 .filter(|a| a.category() == category)
595+ .filter(|a| a.angle_number().is_none_or(|n| n == 1))
346 .map(KeyRow::Act),596 .map(KeyRow::Act),
347 );597 );
348 rows.extend(598 rows.extend(
@@ -394,11 +644,17 @@ fn key_row_hits(row: &KeyRow, q: &str, keymap: &keymap::Keymap) -> bool {
394 KeyRow::Act(a) => {644 KeyRow::Act(a) => {
395 a.label().to_ascii_lowercase().contains(q)645 a.label().to_ascii_lowercase().contains(q)
396 || keymap.display(a).to_ascii_lowercase().contains(q)646 || keymap.display(a).to_ascii_lowercase().contains(q)
647+ || keymap::search_aliases(&keymap.display(a))
648+ .to_ascii_lowercase()
649+ .contains(q)
397 }650 }
398 KeyRow::Fixed(i) => {651 KeyRow::Fixed(i) => {
399 let f = &keymap::FIXED[i];652 let f = &keymap::FIXED[i];
400 f.label.to_ascii_lowercase().contains(q)653 f.label.to_ascii_lowercase().contains(q)
401 || f.chord.to_ascii_lowercase().contains(q)654 || f.chord.to_ascii_lowercase().contains(q)
655+ || keymap::search_aliases(&f.chord)
656+ .to_ascii_lowercase()
657+ .contains(q)
402 }658 }
403 }659 }
404 }660 }
@@ -416,3 +672,468 @@ pub(crate) fn typed(key: &str) -> Option<char> {
416 .filter(|c| c.is_ascii_graphic() && key.chars().count() == 1),672 .filter(|c| c.is_ascii_graphic() && key.chars().count() == 1),
417 }673 }
418 }674 }
675+
676+/// One row of the command palette (DESIGN §4.4, Ctrl+K): an action, and the
677+/// reason the editor refuses it right now, if it does. A hidden action never
678+/// becomes a row ([`palette_rows`]).
679+#[derive(Clone, Copy, Debug, PartialEq)]
680+pub(crate) struct PaletteRow {
681+ pub(crate) action: ActionId,
682+ /// `Some(reason)` when the row is listed but cannot run. It stays on the
683+ /// list in ink4, with the reason where the key would be (DESIGN §4.8).
684+ pub(crate) refused: Option<&'static str>,
685+}
686+
687+/// The palette's rows for `query`, in the order they list.
688+///
689+/// An empty query lists every action under its category, in the registry's
690+/// order. A query keeps the actions it matches on their label or category --
691+/// case-insensitive, each word a prefix or a substring -- and lists the best
692+/// matches first: a label that starts with the word beats a word inside it,
693+/// which beats a substring, which beats a match on the category alone. Ties
694+/// keep the registry's order. `enable` is the oracle's answer per action; its
695+/// `Hidden` answers are dropped, its `No` answers stay as refused rows.
696+pub(crate) fn palette_rows(
697+ query: &str,
698+ enable: impl Fn(ActionId) -> crate::oracle::Enable,
699+) -> Vec<PaletteRow> {
700+ let tokens: Vec<String> = query
701+ .split_whitespace()
702+ .map(str::to_lowercase)
703+ .collect();
704+ // (score, registry index, row): the index keeps every sort stable.
705+ let mut hits: Vec<(u32, usize, PaletteRow)> = Vec::new();
706+ for (i, action) in ActionId::ALL.into_iter().enumerate() {
707+ let refused = match enable(action) {
708+ crate::oracle::Enable::Hidden(_) => continue,
709+ crate::oracle::Enable::Yes => None,
710+ crate::oracle::Enable::No(why) => Some(why),
711+ };
712+ let Some(score) = palette_score(action, &tokens) else {
713+ continue;
714+ };
715+ hits.push((score, i, PaletteRow { action, refused }));
716+ }
717+ if tokens.is_empty() {
718+ hits.sort_by_key(|(_, i, row)| (category_rank(row.action.category()), *i));
719+ } else {
720+ hits.sort_by_key(|(score, i, _)| (*score, *i));
721+ }
722+ hits.into_iter().map(|(_, _, row)| row).collect()
723+}
724+
725+/// How well `action` answers every word of the query, lower is better, or
726+/// `None` when one word matches nothing. A word scores 0 for a label prefix, 1
727+/// for a label word prefix, 2 for a label substring and 3 for a category match.
728+fn palette_score(action: ActionId, tokens: &[String]) -> Option<u32> {
729+ let label = action.label().to_lowercase();
730+ let category = action.category().label().to_lowercase();
731+ let mut total = 0;
732+ for token in tokens {
733+ let word_starts = |text: &str| {
734+ text.split(|c: char| !c.is_alphanumeric())
735+ .any(|w| w.starts_with(token.as_str()))
736+ };
737+ total += if label.starts_with(token.as_str()) {
738+ 0
739+ } else if word_starts(&label) {
740+ 1
741+ } else if label.contains(token.as_str()) {
742+ 2
743+ } else if word_starts(&category) || category.contains(token.as_str()) {
744+ 3
745+ } else {
746+ return None;
747+ };
748+ }
749+ Some(total)
750+}
751+
752+/// Where a category sits in the registry's own order, for grouping an empty
753+/// query.
754+fn category_rank(category: keymap::Category) -> usize {
755+ keymap::Category::ALL
756+ .iter()
757+ .position(|c| *c == category)
758+ .unwrap_or(usize::MAX)
759+}
760+
761+/// The list index of row `sel` as a child of the palette's list, which holds a
762+/// heading before each new category when the query is empty. The scroll handle
763+/// wants a child index, not a row index.
764+pub(crate) fn palette_child_index(rows: &[PaletteRow], sel: usize, grouped: bool) -> usize {
765+ if !grouped {
766+ return sel;
767+ }
768+ // Every heading at or above the row: one before each category's first row.
769+ let headings = (0..rows.len().min(sel + 1))
770+ .filter(|&i| i == 0 || rows[i - 1].action.category() != rows[i].action.category())
771+ .count();
772+ sel + headings
773+}
774+
775+/// What Enter does on a palette row: a runnable row runs and the palette
776+/// closes; a refused row says why (`Player::act`'s toast) and stays open.
777+pub(crate) fn palette_closes_on_run(row: PaletteRow) -> bool {
778+ row.refused.is_none()
779+}
780+
781+#[cfg(test)]
782+mod palette_tests {
783+ use super::*;
784+ use crate::oracle::Enable;
785+
786+ fn all_yes(_: ActionId) -> Enable {
787+ Enable::Yes
788+ }
789+
790+ #[test]
791+ fn empty_query_lists_every_action_grouped_by_category() {
792+ let rows = palette_rows("", all_yes);
793+ assert_eq!(rows.len(), ActionId::ALL.len());
794+ let cats: Vec<usize> = rows
795+ .iter()
796+ .map(|r| category_rank(r.action.category()))
797+ .collect();
798+ assert!(cats.windows(2).all(|w| w[0] <= w[1]), "not grouped: {cats:?}");
799+ }
800+
801+ #[test]
802+ fn a_label_prefix_ranks_above_a_word_inside_a_label() {
803+ let rows = palette_rows("play", all_yes);
804+ let first = rows[0].action.label().to_lowercase();
805+ assert!(first.starts_with("play"), "best match was {first:?}");
806+ assert!(
807+ rows.iter().all(|r| {
808+ let l = r.action.label().to_lowercase();
809+ l.contains("play") || r.action.category().label().to_lowercase().contains("play")
810+ }),
811+ "a row matches neither label nor category"
812+ );
813+ }
814+
815+ #[test]
816+ fn matching_is_case_insensitive() {
817+ assert_eq!(palette_rows("PLAY", all_yes), palette_rows("play", all_yes));
818+ }
819+
820+ #[test]
821+ fn a_category_word_lists_its_actions() {
822+ let rows = palette_rows("clips", all_yes);
823+ assert!(!rows.is_empty());
824+ assert!(rows.iter().all(|r| r.action.category() == keymap::Category::Clips
825+ || r.action.label().to_lowercase().contains("clip")));
826+ }
827+
828+ #[test]
829+ fn every_word_of_the_query_must_match() {
830+ assert!(palette_rows("play xyzzy", all_yes).is_empty());
831+ assert!(palette_rows("xyzzy-no-such", all_yes).is_empty());
832+ }
833+
834+ #[test]
835+ fn hidden_actions_are_omitted_and_refused_ones_stay_listed() {
836+ let rows = palette_rows("", |a| match a {
837+ ActionId::Cut => Enable::Hidden("no clip"),
838+ ActionId::Copy => Enable::No("nothing selected"),
839+ _ => Enable::Yes,
840+ });
841+ assert!(!rows.iter().any(|r| r.action == ActionId::Cut));
842+ let copy = rows.iter().find(|r| r.action == ActionId::Copy).unwrap();
843+ assert_eq!(copy.refused, Some("nothing selected"));
844+ let play = rows.iter().find(|r| r.action == ActionId::Play).unwrap();
845+ assert_eq!(play.refused, None);
846+ }
847+
848+ #[test]
849+ fn only_a_runnable_row_closes_the_palette() {
850+ let yes = PaletteRow { action: ActionId::Play, refused: None };
851+ let no = PaletteRow { action: ActionId::Copy, refused: Some("nothing selected") };
852+ assert!(palette_closes_on_run(yes));
853+ assert!(!palette_closes_on_run(no));
854+ }
855+
856+ #[test]
857+ fn child_index_counts_the_category_headings_above_the_row() {
858+ let rows = palette_rows("", all_yes);
859+ assert_eq!(palette_child_index(&rows, 0, true), 1);
860+ let last = rows.len() - 1;
861+ let blocks = keymap::Category::ALL
862+ .iter()
863+ .filter(|c| rows.iter().any(|r| r.action.category() == **c))
864+ .count();
865+ assert_eq!(palette_child_index(&rows, last, true), last + blocks);
866+ assert_eq!(palette_child_index(&rows, 3, false), 3);
867+ }
868+}
869+
870+#[cfg(test)]
871+mod keys_search_tests {
872+ use super::*;
873+
874+ /// The KEYS search finds a fixed row by the word a person says for its
875+ /// glyph, and by the glyph's own name for `Esc`.
876+ #[test]
877+ fn a_glyph_row_is_found_by_its_spoken_name() {
878+ let keymap = keymap::Keymap::defaults();
879+ let finds = |q: &str, chord: &str| {
880+ keys_rows_matching(q, &keymap).iter().any(|row| match row {
881+ KeyRow::Fixed(i) => keymap::FIXED[*i].chord == chord,
882+ _ => false,
883+ })
884+ };
885+ assert!(finds("enter", "↵"));
886+ assert!(finds("return", "↵"));
887+ assert!(finds("up", "↑"));
888+ assert!(finds("left arrow", "← / →"));
889+ assert!(finds("escape", "Esc"));
890+ assert!(finds("esc", "Esc"));
891+ }
892+}
893+
894+/// The 16px icon a menu row wears beside its label (REDESIGN §3.1), where the
895+/// verb has an obvious picture; `None` leaves the icon column blank so labels
896+/// still line up. Pure decoration -- the label and the key stay the contract.
897+pub(crate) fn icon(action: ActionId) -> Option<crate::ui::icons::Icon> {
898+ use crate::ui::icons::Icon as I;
899+ Some(match action {
900+ ActionId::AddFiles => I::Plus,
901+ ActionId::OpenProject => I::FolderOpen,
902+ ActionId::NewProject => I::Clapperboard,
903+ ActionId::ImportSubtitles => I::Captions,
904+ ActionId::Save => I::Save,
905+ ActionId::ReloadProject => I::RefreshCw,
906+ ActionId::Export => I::Upload,
907+ ActionId::Screenshot => I::Image,
908+ ActionId::Settings => I::Settings,
909+ ActionId::Undo => I::Undo2,
910+ ActionId::Redo => I::Redo2,
911+ ActionId::History => I::Undo2,
912+ ActionId::Copy => I::Copy,
913+ ActionId::Paste | ActionId::PasteFilePath => I::Clipboard,
914+ ActionId::SelectAll => I::Layers,
915+ ActionId::Cut => I::Scissors,
916+ ActionId::Delete => I::Trash2,
917+ ActionId::Lift => I::Eraser,
918+ ActionId::Color => I::Palette,
919+ ActionId::Transform => I::Move,
920+ ActionId::Effects => I::Sparkles,
921+ ActionId::Equalizer | ActionId::Mix => I::SlidersHorizontal,
922+ ActionId::Speed => I::FastForward,
923+ ActionId::Group | ActionId::NestClips => I::Layers,
924+ ActionId::Detach => I::Unlink,
925+ ActionId::ToggleMute => I::VolumeX,
926+ ActionId::SetIn => I::SquareArrowDownRight,
927+ ActionId::SetOut => I::SquareArrowDownLeft,
928+ ActionId::ZoomIn => I::ZoomIn,
929+ ActionId::ZoomOut => I::ZoomOut,
930+ ActionId::ZoomFit | ActionId::ZoomToSelection => I::Scan,
931+ ActionId::ViewZoom => I::ZoomIn,
932+ ActionId::PlaybackQuality => I::Signal,
933+ ActionId::GuideStyle => I::Grid3x3,
934+ ActionId::GuideMask => I::Image,
935+ ActionId::ToggleOutputWindow | ActionId::OutputDisplay => I::Scan,
936+ ActionId::ToggleSnap => I::Magnet,
937+ // A track's height: the one resize glyph the set has, for the three sizes and the two steps.
938+ ActionId::TrackSmall | ActionId::TrackMedium | ActionId::TrackLarge | ActionId::TracksSmaller | ActionId::TracksLarger => I::Scaling,
939+ ActionId::AddMarker | ActionId::MarkerHere => I::Flag,
940+ ActionId::RenameMarker => I::Type,
941+ ActionId::DeleteMarker => I::Trash2,
942+ ActionId::PlayheadHere => I::SkipBack,
943+ ActionId::Captions => I::Captions,
944+ ActionId::Voiceover | ActionId::RecordVoiceover => I::Mic,
945+ ActionId::Play => I::Play,
946+ ActionId::StepBack => I::StepBack,
947+ ActionId::StepForward => I::StepForward,
948+ ActionId::GoStart => I::SkipBack,
949+ ActionId::GoEnd => I::SkipForward,
950+ ActionId::GoToTime => I::Timer,
951+ ActionId::Loop => I::Repeat,
952+ ActionId::PlayAround => I::Play,
953+ ActionId::ToggleWaveforms => I::AudioWaveform,
954+ ActionId::ToggleScrubAudio => I::Volume2,
955+ ActionId::CompareOff | ActionId::CompareSplit | ActionId::CompareSide => I::Layers,
956+ ActionId::AutoColour => I::WandSparkles,
957+ ActionId::SaveLook => I::Save,
958+ ActionId::ToggleSubtitles => I::Captions,
959+ ActionId::ShowActions => I::Search,
960+ ActionId::ShowKeys => I::Keyboard,
961+ ActionId::About => I::Info,
962+ ActionId::Normalize | ActionId::CleanVoice => I::AudioWaveform,
963+ ActionId::SubtitleStyle => I::Type,
964+ ActionId::Reframe => I::Scaling,
965+ ActionId::TrackMask => I::Scan,
966+ ActionId::TrimIn => I::ArrowLeftToLine,
967+ ActionId::TrimOut => I::ArrowRightToLine,
968+ ActionId::Regroup => I::Link,
969+ ActionId::LoopTrim => I::Repeat,
970+ ActionId::Reverse => I::RotateCcw,
971+ ActionId::Dissolve | ActionId::Crossfade | ActionId::TransitionDissolve => I::Sparkles,
972+ ActionId::TransitionDipBlack => I::Square,
973+ ActionId::TransitionDipWhite => I::Circle,
974+ ActionId::TransitionZoom => I::ZoomIn,
975+ ActionId::TransitionWipeLeft => I::SquareArrowDownLeft,
976+ ActionId::TransitionWipeRight => I::SquareArrowDownRight,
977+ ActionId::TransitionWipeUp => I::ArrowUp,
978+ ActionId::TransitionWipeDown => I::ArrowDown,
979+ ActionId::TransitionSlideLeft => I::ChevronLeft,
980+ ActionId::TransitionSlideRight => I::ChevronRight,
981+ ActionId::TransitionSlideUp => I::ChevronUp,
982+ ActionId::TransitionSlideDown => I::ChevronDown,
983+ ActionId::TransitionPushLeft | ActionId::TransitionPushRight | ActionId::TransitionPushUp | ActionId::TransitionPushDown => I::Layers,
984+ ActionId::ClipLabel => I::Flag,
985+ ActionId::AddVideoLane | ActionId::AddAudioLane | ActionId::AddSubtitleLane | ActionId::NewSequence => I::Plus,
986+ ActionId::RemoveVideoLane | ActionId::RemoveAudioLane | ActionId::RemoveSubtitleLane => I::Minus,
987+ ActionId::RenameLane | ActionId::RenameSequence | ActionId::RenameBin | ActionId::NewTitle => I::Type,
988+ ActionId::DeleteSequence | ActionId::RemoveBin => I::Trash2,
989+ ActionId::DuplicateSequence => I::Copy,
990+ ActionId::NewBin | ActionId::NewBinInside => I::Folder,
991+ ActionId::NewSolid => I::Square,
992+ ActionId::NewGradient => I::Palette,
993+ ActionId::NewCountdown => I::Timer,
994+ ActionId::NewBars => I::Grid3x3,
995+ ActionId::NewTone => I::Volume2,
996+ ActionId::NewBarsAndTone => I::AudioWaveform,
997+ ActionId::NewAdjustment => I::SlidersHorizontal,
998+ ActionId::NewRectangle => I::Square,
999+ ActionId::NewEllipse => I::Circle,
1000+ ActionId::NewLine => I::Minus,
1001+ ActionId::NewArrow => I::ArrowRight,
1002+ ActionId::BreakApart => I::Unlink,
1003+ ActionId::CancelExport | ActionId::Deselect => I::CircleX,
1004+ ActionId::ClearRange => I::Eraser,
1005+ ActionId::RenderInOut => I::SquareArrowDownRight,
1006+ ActionId::RenderAll => I::Film,
1007+ ActionId::CancelRender => I::CircleX,
1008+ ActionId::DeleteRenderFiles => I::Trash2,
1009+ ActionId::ClipEnabled | ActionId::ToggleAngleMonitor | ActionId::KeyOpacity => I::Eye,
1010+ ActionId::CloseCompound | ActionId::OpenCompound | ActionId::CreateMulticam | ActionId::FlattenMulticam | ActionId::Angle1 => {
1011+ I::Layers
1012+ }
1013+ ActionId::CloseGap | ActionId::TrimInToPlayhead | ActionId::RippleTrimInToPlayhead => I::ArrowLeftToLine,
1014+ ActionId::ExtendAudio | ActionId::ExtendVideo | ActionId::TrimOutToPlayhead | ActionId::RippleTrimOutToPlayhead => {
1015+ I::ArrowRightToLine
1016+ }
1017+ ActionId::CollectMedia | ActionId::InsertSource | ActionId::OverwriteSource => I::Download,
1018+ ActionId::ExportTimelineOtio | ActionId::ExportTimelineFcpxml | ActionId::ExportTimelineEdl => I::Upload,
1019+ ActionId::ImportTimelineOtio => I::Plus,
1020+ ActionId::Fillers | ActionId::Silence | ActionId::Visualizer => I::AudioWaveform,
1021+ ActionId::CutSelectedWords => I::Trash2,
1022+ ActionId::MarkBeats => I::Timer,
1023+ ActionId::Fit | ActionId::Resolution => I::Scaling,
1024+ ActionId::Fullscreen => I::Scan,
1025+ ActionId::FocusPanels => I::Layers,
1026+ ActionId::Freeze | ActionId::ShuttleStop => I::Pause,
1027+ ActionId::JumpBack | ActionId::PrevSyncPoint => I::SkipBack,
1028+ ActionId::JumpForward | ActionId::NextSyncPoint => I::SkipForward,
1029+ ActionId::KeyColor | ActionId::Theme | ActionId::AccentColour => I::Palette,
1030+ ActionId::KeyEasing => I::Spline,
1031+ ActionId::SpeedRampClear => I::Eraser,
1032+ ActionId::SpeedRampDown => I::TrendingDown,
1033+ ActionId::SpeedRampUp => I::TrendingUp,
1034+ ActionId::SpeedRampSlowFastSlow => I::Activity,
1035+ ActionId::SpeedRampFastSlowFast => I::Zap,
1036+ ActionId::SpeedRampKey => I::Diamond,
1037+ ActionId::ToggleProxies | ActionId::ToggleAutoProxies => I::Gauge,
1038+ ActionId::KeyPlacement => I::Move,
1039+ ActionId::Markers | ActionId::NextMarker | ActionId::PrevMarker => I::FlagTriangleRight,
1040+ ActionId::MatchFrame | ActionId::ReplaceEdit => I::Film,
1041+ ActionId::NudgeBack | ActionId::NudgeBack10 | ActionId::RollBack | ActionId::SlipBack | ActionId::SlideBack | ActionId::ShuttleBack => I::StepBack,
1042+ ActionId::NudgeForward | ActionId::NudgeForward10 | ActionId::RollForward | ActionId::SlipForward | ActionId::SlideForward | ActionId::ShuttleForward => I::StepForward,
1043+ ActionId::PasteAttributes | ActionId::PasteAudio | ActionId::PasteColor | ActionId::PasteEffects | ActionId::PasteSpeed | ActionId::PasteTransform => I::Clipboard,
1044+ ActionId::SaveVersion | ActionId::SaveTemplate | ActionId::ExportCaptions => I::Save,
1045+ ActionId::Versions => I::RotateCcw,
1046+ ActionId::ProjectNotes => I::Clipboard,
1047+ ActionId::Select | ActionId::SelectForward | ActionId::SelectForwardAll => I::Brackets,
1048+ ActionId::SelectNext | ActionId::WalkCutNext | ActionId::WalkCutNext10 => I::ChevronRight,
1049+ ActionId::SelectPrev | ActionId::WalkCutPrev | ActionId::WalkCutPrev10 => I::ChevronLeft,
1050+ ActionId::VoiceDynamics => I::Mic,
1051+ ActionId::VolumeDown | ActionId::VolumeUp => I::Volume2,
1052+ _ => return None,
1053+ })
1054+}
1055+
1056+/// The one-line plain description a menu row carries on hover, for the two
1057+/// trims whose names alone do not say what they do.
1058+pub(crate) fn note(action: ActionId) -> Option<&'static str> {
1059+ Some(match action {
1060+ ActionId::SlipBack | ActionId::SlipForward => "Slip: change which part of the footage shows, keeping the clip in place",
1061+ ActionId::SlideBack | ActionId::SlideForward => "Slide: move the clip between its neighbours, keeping its footage",
1062+ ActionId::Detach => "Unlink: the picture and the sound of a grouped clip edit separately",
1063+ _ => return None,
1064+ })
1065+}
1066+
1067+/// The icon beside a submenu row of the bar menus (REDESIGN §3.1).
1068+pub(crate) fn icon_sub(name: &str) -> Option<crate::ui::icons::Icon> {
1069+ use crate::ui::icons::Icon as I;
1070+ Some(match name {
1071+ "Paste attributes" => I::Clipboard,
1072+ "Export timeline as" => I::Upload,
1073+ "New from template" => I::Layers,
1074+ "Compare grade" => I::Layers,
1075+ "Trim" => I::Scissors,
1076+ "Speed" => I::FastForward,
1077+ "Adjust" => I::SlidersHorizontal,
1078+ "Transitions" => I::Sparkles,
1079+ "Compound" => I::Layers,
1080+ "Markers" => I::Flag,
1081+ "Select" => I::Brackets,
1082+ "Captions" => I::Captions,
1083+ "Audio" => I::AudioWaveform,
1084+ "Tracks" => I::Film,
1085+ "Keyframes" => I::KeyRound,
1086+ "Go to" => I::SkipForward,
1087+ "Sequence" => I::Film,
1088+ "Render preview" => I::Zap,
1089+ "New" => I::Plus,
1090+ "Multicam" => I::Layers,
1091+ "Nudge" => I::StepForward,
1092+ "Open recent" => I::RotateCcw,
1093+ _ => return None,
1094+ })
1095+}
1096+
1097+#[cfg(test)]
1098+mod icon_tests {
1099+ use super::*;
1100+ use crate::ui::menubar::Title;
1101+
1102+ /// Every verb any menu lists wears an icon, so the icon column is never half empty: the
1103+ /// bar's menus and flyouts, the clip, track, bench, viewer, tab, bin and dock menus.
1104+ #[test]
1105+ fn every_menu_row_has_an_icon() {
1106+ let mut actions: Vec<ActionId> = Vec::new();
1107+ for title in Title::ALL {
1108+ actions.extend(title.entries().into_iter().filter_map(|e| e.action()));
1109+ }
1110+ for list in [
1111+ &MENU_ITEMS[..], &BENCH_ITEMS[..], &VIEWER_ITEMS[..], &SEQ_TAB_ITEMS[..], &MARKER_ITEMS[..], &BIN_ITEMS[..], &DOCK_ITEMS[..], &HEAD_ADDS[..],
1112+ ] {
1113+ actions.extend_from_slice(list);
1114+ }
1115+ for kind in [LaneKind::Video, LaneKind::Audio, LaneKind::Subtitle] {
1116+ actions.extend(crate::oracle::lane_items(Lane { kind, ord: 0 }));
1117+ }
1118+ let mut missing: Vec<String> = actions.into_iter().filter(|a| icon(*a).is_none()).map(|a| format!("{a:?}")).collect();
1119+ missing.sort();
1120+ missing.dedup();
1121+ assert!(missing.is_empty(), "menu rows without an icon: {missing:?}");
1122+ let mut subs: Vec<&str> = Vec::new();
1123+ for title in Title::ALL {
1124+ fn walk<'a>(list: &'a [crate::ui::menubar::Entry], out: &mut Vec<&'a str>) {
1125+ for e in list {
1126+ if let crate::ui::menubar::Entry::Sub(name, inner) = e {
1127+ out.push(name);
1128+ walk(inner, out);
1129+ }
1130+ }
1131+ }
1132+ walk(title.layout(), &mut subs);
1133+ }
1134+ let bare: Vec<&&str> = subs.iter().filter(|n| icon_sub(n).is_none()).collect();
1135+ assert!(bare.is_empty(), "flyout rows without an icon: {bare:?}");
1136+ // The media row menu has its own verbs: all of them wear one too.
1137+ let _ = ROW_ITEMS.map(RowItem::icon);
1138+ }
1139+}
crates/app/src/notices.rsmodified+500 -63
@@ -1,45 +1,248 @@
1-//! The notice bar's queue.1+//! The notice queue, and the toasts it draws (DESIGN §8).
2 2
3 use crate::*;3 use crate::*;
4+use std::cell::Cell;
5+use std::collections::VecDeque;
6+use std::ops::Deref;
7+use std::path::PathBuf;
4 8
5-/// How many messages wait behind the one on the bar before the oldest is9+/// `n` of a thing in words: "1 silence", "2 silences". One door, so no
6-/// dropped. A queue with no ceiling is a way for a stuck loop to eat the heap;10+/// message ships a "(s)" or a "1 silences".
7-/// eight is more than a user will ever answer in a row.11+pub(crate) fn count_noun(n: usize, one: &str, many: &str) -> String {
12+ format!("{n} {}", if n == 1 { one } else { many })
13+}
14+
15+/// How many messages wait in the queue before the oldest is dropped. A queue
16+/// with no ceiling is a way for a stuck loop to eat the heap; eight is more than
17+/// a user will ever answer in a row. Only the newest is drawn, in the status bar,
18+/// and a new message replaces it, so in practice the queue holds one line plus
19+/// any questions still waiting for an answer.
8 pub(crate) const NOTICES_MAX: usize = 8;20 pub(crate) const NOTICES_MAX: usize = 8;
9 21
22+/// How long an info or warn toast stays before it hides itself (DESIGN §8).
23+/// Errors have no such timer: they name a remedy and wait for a ✕.
24+pub(crate) const TOAST_HIDE: Duration = Duration::from_secs(5);
25+
26+/// How many buttons one toast can carry. Two is what an export's outcome needs
27+/// (Play, and Show in folder); a third would crowd the message off the bar.
28+pub(crate) const TOAST_ACTIONS_MAX: usize = 2;
29+
30+/// How loud a toast is. The tone picks the stripe colour and whether the toast
31+/// times out at all.
32+#[derive(Clone, Copy, PartialEq, Eq, Debug)]
33+pub(crate) enum Tone {
34+ Info,
35+ Warn,
36+ Err,
37+}
38+
39+impl Tone {
40+ /// The tone is read off the words a message already opens with: a refusal or
41+ /// a failure is an error, a no-op or an empty result is a warning, and
42+ /// everything else -- a save, a snap -- is information.
43+ pub(crate) fn of(message: &str) -> Tone {
44+ // The keywords are matched as whole words in capitals whatever the case
45+ // of the message, so a sentence-case line reads the same as the old
46+ // ALL-CAPS one, and "piano" does not read as "NO".
47+ let words: Vec<String> = message
48+ .split(|c: char| !c.is_alphanumeric())
49+ .filter(|w| !w.is_empty())
50+ .map(str::to_uppercase)
51+ .collect();
52+ let has = |word: &str| words.iter().any(|w| w == word);
53+ let has_pair =
54+ |first: &str, second: &str| words.windows(2).any(|p| p[0] == first && p[1] == second);
55+ if has("FAILED")
56+ || has("ERROR")
57+ || has("REFUSED")
58+ || has("CANNOT")
59+ || has_pair("COULD", "NOT")
60+ {
61+ Tone::Err
62+ } else if has("NOTHING") || has("NO") || has("EMPTY") {
63+ Tone::Warn
64+ } else {
65+ Tone::Info
66+ }
67+ }
68+
69+ /// Whether a toast of this tone hides on its own. Errors do not: a failure
70+ /// that vanished before it was read is the failure nobody learns about.
71+ pub(crate) fn auto_hides(self) -> bool {
72+ self != Tone::Err
73+ }
74+}
75+
76+/// What a toast's button does. The action is the toast's own: the button acts on
77+/// the thing the message is about, and the toast goes with the click.
78+#[derive(Clone, Debug, PartialEq)]
79+pub(crate) enum ToastAction {
80+ /// Takes back the last timeline edit, as `ctrl+z` does. The delete and lift
81+ /// toasts in `timeline_edit.rs` offer it.
82+ Undo,
83+ /// Reveals a written file in the file manager.
84+ ShowInFolder(PathBuf),
85+ /// Opens a written file in the system's default player.
86+ Play(PathBuf),
87+ /// Unlocks the lane an edit was refused on (DESIGN §7). The refusal names
88+ /// the lane, so the button can name it too.
89+ Unlock(Lane),
90+ /// Reloads the open project from disk, dropping the edits the window
91+ /// holds. Offered when the project file changed under unsaved edits.
92+ Reload,
93+ /// Dismisses the question and keeps the window's edits. The file stays as
94+ /// the other side wrote it until the next save.
95+ KeepMine,
96+ /// Takes an autosave's unsaved edits over the saved project, as one undo
97+ /// step. Offered when a project opens with a newer autosave beside it.
98+ Recover,
99+ /// Deletes the autosave that was offered for recovery.
100+ Discard,
101+ /// Saves the open project, then opens the one that was asked for.
102+ SaveThenOpen(PathBuf),
103+ /// Opens the one that was asked for and lets this project's unsaved edits go.
104+ OpenDiscarding(PathBuf),
105+}
106+
107+/// One notice on screen or waiting behind the ones on screen. `Deref`s to its
108+/// text, so a reader that only wants the words reads them as it always did.
109+#[derive(Clone, Debug, PartialEq)]
110+pub(crate) struct Toast {
111+ /// Unique for the life of the process. A hide timer names the toast it was
112+ /// started for, so a timer that fires late finds nothing with that id and
113+ /// cannot hide a newer toast that happens to say the same thing.
114+ pub(crate) id: u64,
115+ pub(crate) text: SharedString,
116+ pub(crate) tone: Tone,
117+ /// The buttons, in the order they are drawn. At most [`TOAST_ACTIONS_MAX`].
118+ pub(crate) actions: Vec<ToastAction>,
119+ /// Whether this toast's hide timer has been started. Set the first frame
120+ /// the toast is drawn, which is where the timer can be spawned from.
121+ pub(crate) timer_armed: Cell<bool>,
122+ /// Stays until its button is pressed, whatever its tone. A question the
123+ /// person must answer (the recovery offer) is this: a 5 s hide is a question
124+ /// that disappears unanswered, and the edits it guards go with it.
125+ pub(crate) sticky: bool,
126+}
127+
128+impl Toast {
129+ /// A toast whose tone is read off its words and that has no action.
130+ pub(crate) fn new(text: SharedString) -> Toast {
131+ let tone = Tone::of(&text);
132+ Toast::with(text, tone, Vec::new(), false)
133+ }
134+
135+ fn with(text: SharedString, tone: Tone, mut actions: Vec<ToastAction>, sticky: bool) -> Toast {
136+ // A process-wide counter, not a per-queue one: a timer must be able to
137+ // tell its own toast from one that was pushed later, whatever queue
138+ // either lives in.
139+ static NEXT_ID: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1);
140+ actions.truncate(TOAST_ACTIONS_MAX);
141+ Toast {
142+ id: NEXT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed),
143+ text,
144+ tone,
145+ actions,
146+ timer_armed: Cell::new(false),
147+ sticky,
148+ }
149+ }
150+
151+ /// Whether this toast's hide timer runs at all: an info or warn toast that
152+ /// is not sticky. Errors and sticky toasts wait for a button or the ✕.
153+ pub(crate) fn hides(&self) -> bool {
154+ self.tone.auto_hides() && !self.sticky
155+ }
156+}
157+
158+impl Deref for Toast {
159+ type Target = SharedString;
160+
161+ fn deref(&self) -> &SharedString {
162+ &self.text
163+ }
164+}
165+
10 /// The whole of the queue's policy, where it can be read at once and tested166 /// The whole of the queue's policy, where it can be read at once and tested
11-/// without a window: dedupe against the back, a ceiling, oldest out first --167+/// without a window: dedupe against the back, a ceiling, oldest out first.
12-/// except an export's own outcome, which jumps to the front. [`Player::notify_user`]168+/// [`Player::notify_user`] is the door every message comes through; this is
13-/// is the door every message comes through; this is what the door does.169+/// what the door does for a message with no action.
14-pub(crate) fn push_notice(170+pub(crate) fn push_notice(notices: &mut VecDeque<Toast>, message: SharedString) {
15- notices: &mut std::collections::VecDeque<SharedString>,171+ let tone = Tone::of(&message);
172+ push_toast(notices, message, tone, Vec::new());
173+}
174+
175+/// [`push_notice`] with its buttons attached, for the door that takes them.
176+pub(crate) fn push_toast(
177+ notices: &mut VecDeque<Toast>,
178+ message: SharedString,
179+ tone: Tone,
180+ actions: Vec<ToastAction>,
181+) {
182+ push_toast_with(notices, message, tone, actions, false);
183+}
184+
185+/// [`push_toast`] for a question that stays on screen until it is answered
186+/// ([`Toast::sticky`]).
187+pub(crate) fn push_sticky_toast(
188+ notices: &mut VecDeque<Toast>,
189+ message: SharedString,
190+ tone: Tone,
191+ actions: Vec<ToastAction>,
192+) {
193+ push_toast_with(notices, message, tone, actions, true);
194+}
195+
196+fn push_toast_with(
197+ notices: &mut VecDeque<Toast>,
16 message: SharedString,198 message: SharedString,
199+ tone: Tone,
200+ actions: Vec<ToastAction>,
201+ sticky: bool,
17 ) {202 ) {
18 // A repeat of what is already at the back is dropped -- holding a key that203 // A repeat of what is already at the back is dropped -- holding a key that
19- // refuses would otherwise fill the queue with one sentence, and the count on204+ // refuses would otherwise fill the queue with one sentence, and the toasts
20- // the bar would be a count of how long the key was held.205+ // would be a count of how long the key was held.
21- if notices.back() == Some(&message) {206+ if notices.back().is_some_and(|toast| toast.text == message) {
22 return;207 return;
23 }208 }
209+ // One slot: the newest message replaces the one on screen, so an old failure
210+ // never lingers under a newer line, and a success replaces the failure it
211+ // follows. A question that waits for its answer is kept beside it.
212+ notices.retain(|toast| toast.sticky);
24 if notices.len() >= NOTICES_MAX {213 if notices.len() >= NOTICES_MAX {
25- notices.pop_front();214+ // The oldest goes, but never an unanswered question while anything else
26- }215+ // could go instead.
27- // Minutes of an export land here the moment it ends, and behind two or216+ match notices.iter().position(|toast| !toast.sticky) {
28- // three progress lines (a proxy, a caption) queued while it ran, its own217+ Some(at) => {
29- // result would sit unseen several dismissals deep. It is the one thing a218+ notices.remove(at);
30- // person started the export to read, so it goes to the front -- the219+ }
31- // notice showing now -- rather than the back of the line.220+ None => {
32- match is_completion(&message) {221+ notices.pop_front();
33- true => notices.push_front(message),222+ }
34- false => notices.push_back(message),223+ }
35 }224 }
225+ notices.push_back(Toast::with(message, tone, actions, sticky));
226+}
227+
228+/// The toast the status bar draws: the newest sticky one (a question still
229+/// waiting for its answer), else the newest notice of all.
230+pub(crate) fn current_toast(notices: &VecDeque<Toast>) -> Option<&Toast> {
231+ notices
232+ .iter()
233+ .rev()
234+ .find(|toast| toast.sticky)
235+ .or_else(|| notices.back())
36 }236 }
37 237
38-/// An export's own outcome: the one class of notice that outranks whatever238+/// Takes one toast out of the queue by id. `true` when there was one to take.
39-/// is already queued ([`push_notice`]). Named by the same prefixes239+/// Every way a toast leaves -- its timer, its ✕, its action -- comes through
40-/// [`crate::player::export`] writes them with.240+/// here, and matching on the id is what keeps a late timer from taking a newer
41-fn is_completion(message: &str) -> bool {241+/// toast with the same words.
42- message.starts_with(EXPORT_DONE) || message.starts_with("EXPORT FAILED")242+pub(crate) fn remove_toast(notices: &mut VecDeque<Toast>, id: u64) -> bool {
243+ let before = notices.len();
244+ notices.retain(|toast| toast.id != id);
245+ notices.len() != before
43 }246 }
44 247
45 /// The tail an open/load notice grows when the file has sound the engine cannot248 /// The tail an open/load notice grows when the file has sound the engine cannot
@@ -53,7 +256,7 @@ pub(crate) fn audio_notice(session: &PlaybackSession) -> Option<String> {
53 /// engine's word is spelled into a line, so the open path and the mid-session256 /// engine's word is spelled into a line, so the open path and the mid-session
54 /// one cannot drift apart.257 /// one cannot drift apart.
55 pub(crate) fn audio_tail(reason: &str) -> String {258 pub(crate) fn audio_tail(reason: &str) -> String {
56- format!(" — NO AUDIO: {reason}")259+ format!(" — no audio: {reason}")
57 }260 }
58 261
59 /// The same fact said on its own, for a device that dies *after* a file was262 /// The same fact said on its own, for a device that dies *after* a file was
@@ -61,7 +264,7 @@ pub(crate) fn audio_tail(reason: &str) -> String {
61 /// mid-session has no line to hang off -- so it leads with the state word the264 /// mid-session has no line to hang off -- so it leads with the state word the
62 /// strip reads first, and the tail is the same one.265 /// strip reads first, and the tail is the same one.
63 pub(crate) fn audio_lost_line(reason: &str) -> String {266 pub(crate) fn audio_lost_line(reason: &str) -> String {
64- format!("AUDIO LOST{}", audio_tail(reason))267+ format!("Audio lost{}", audio_tail(reason))
65 }268 }
66 269
67 /// A decode failure that arrives *after* a file was opened, said on its own270 /// A decode failure that arrives *after* a file was opened, said on its own
@@ -76,7 +279,7 @@ pub(crate) fn audio_lost_line(reason: &str) -> String {
76 /// picture and the transport said ENDED. The reason is the engine's own words,279 /// picture and the transport said ENDED. The reason is the engine's own words,
77 /// verbatim -- the app spells none of them.280 /// verbatim -- the app spells none of them.
78 pub(crate) fn decode_failed_line(reason: &str) -> String {281 pub(crate) fn decode_failed_line(reason: &str) -> String {
79- format!("DECODE FAILED — {reason}")282+ format!("Decode failed — {reason}")
80 }283 }
81 284
82 /// What a frame of a reason watch decides, as a pure value: the cache's own285 /// What a frame of a reason watch decides, as a pure value: the cache's own
@@ -141,20 +344,27 @@ pub(crate) fn reason_step(
141 /// tree while this lane drives the same step through the seam below -- on this344 /// tree while this lane drives the same step through the seam below -- on this
142 /// lane's base engine no path flips the reason at all.345 /// lane's base engine no path flips the reason at all.
143 pub(crate) fn audio_change_notice(346 pub(crate) fn audio_change_notice(
144- notices: &mut std::collections::VecDeque<SharedString>,347+ notices: &mut VecDeque<Toast>,
145 was: Option<&str>,348 was: Option<&str>,
146 now: Option<&str>,349 now: Option<&str>,
147 ) {350 ) {
148 match (was, now) {351 match (was, now) {
149 (_, Some(reason)) if was != Some(reason) => {352 (_, Some(reason)) if was != Some(reason) => {
150- push_notice(notices, audio_lost_line(reason).into());353+ // A lost device is an error: the film plays in silence until it is
354+ // fixed, and the toast stays until someone has read it.
355+ push_toast(
356+ notices,
357+ audio_lost_line(reason).into(),
358+ Tone::Err,
359+ Vec::new(),
360+ );
151 }361 }
152 // The sound is back: the line goes with it, or the strip keeps saying NO362 // The sound is back: the line goes with it, or the strip keeps saying NO
153 // AUDIO over a film that plays. Only that line -- whatever else is363 // AUDIO over a film that plays. Only that line -- whatever else is
154 // queued is none of this step's business.364 // queued is none of this step's business.
155 (Some(was), None) => {365 (Some(was), None) => {
156 let line = audio_lost_line(was);366 let line = audio_lost_line(was);
157- notices.retain(|notice| notice.as_ref() != line.as_str());367+ notices.retain(|notice| notice.text.as_ref() != line.as_str());
158 }368 }
159 _ => {}369 _ => {}
160 }370 }
@@ -170,29 +380,33 @@ pub(crate) fn audio_change_notice(
170 /// is seeked away from and succeeds has to take its line back, or the strip380 /// is seeked away from and succeeds has to take its line back, or the strip
171 /// keeps saying DECODE FAILED over a film that plays.381 /// keeps saying DECODE FAILED over a film that plays.
172 pub(crate) fn decode_change_notice(382 pub(crate) fn decode_change_notice(
173- notices: &mut std::collections::VecDeque<SharedString>,383+ notices: &mut VecDeque<Toast>,
174 was: Option<&str>,384 was: Option<&str>,
175 now: Option<&str>,385 now: Option<&str>,
176 ) {386 ) {
177 match (was, now) {387 match (was, now) {
178 (_, Some(reason)) if was != Some(reason) => {388 (_, Some(reason)) if was != Some(reason) => {
179- push_notice(notices, decode_failed_line(reason).into());389+ push_toast(
390+ notices,
391+ decode_failed_line(reason).into(),
392+ Tone::Err,
393+ Vec::new(),
394+ );
180 }395 }
181 (Some(was), None) => {396 (Some(was), None) => {
182 let line = decode_failed_line(was);397 let line = decode_failed_line(was);
183- notices.retain(|notice| notice.as_ref() != line.as_str());398+ notices.retain(|notice| notice.text.as_ref() != line.as_str());
184 }399 }
185 _ => {}400 _ => {}
186 }401 }
187 }402 }
188 403
189-/// The strip's own width is finite and its message is one line: what a404+/// A toast's line is one line: what a too-long line must never do is lose its
190-/// too-long line must never do is lose its *state* word, which sits at the405+/// *state* word, which sits at the front, or stop mid-word with nothing saying
191-/// front, or stop mid-word with nothing saying it stopped (user report,406+/// it stopped (user report, `OPENED he_is_not_the_only_one.mp4 — 1 subtitle
192-/// `OPENED he_is_not_the_only_one.mp4 — 1 subtitle track(s) in `). Every407+/// track(s) in `). Every message is a handful of words plus a file name, so the
193-/// message is a handful of words plus a file name now (DESIGN §8), so the one408+/// one part long enough to overflow alone is the name -- elided through its
194-/// part long enough to overflow the strip alone is the name -- elided through409+/// middle here, head and tail kept, before gpui's own end ellipsis
195-/// its middle here, head and tail kept, before gpui's own end ellipsis
196 /// ([`crate::ui::stance`]) ever has to cut a word.410 /// ([`crate::ui::stance`]) ever has to cut a word.
197 pub(crate) const LEDGER_WORD_MAX: usize = 28;411 pub(crate) const LEDGER_WORD_MAX: usize = 28;
198 412
@@ -221,33 +435,189 @@ pub(crate) fn ledger_line(message: &str) -> String {
221 mod tests {435 mod tests {
222 use super::*;436 use super::*;
223 437
438+ fn texts(notices: &VecDeque<Toast>) -> Vec<&str> {
439+ notices.iter().map(|toast| toast.text.as_ref()).collect()
440+ }
441+
224 /// The class this guards: a notice queued behind an earlier one is never442 /// The class this guards: a notice queued behind an earlier one is never
225- /// *lost* -- `push_notice` still appends it to the back -- but a reader443+ /// *lost* -- `push_notice` still appends it to the back -- and the toast
226- /// of `front()` alone would never see it, since nothing dismisses the444+ /// status bar draws the newest, so the newest message is the
227- /// queue any more (the floating plate and its keystroke-dismiss went445+ /// one a reader of `back()` always reaches.
228- /// with it, user 2026-08-27). `back()` is the read that survives that:
229- /// it always names the newest message, which is why the ledger's "last
230- /// action" -- the one notice channel left -- reads it.
231 ///446 ///
232 /// This is a value-level check on the queue only -- this binary has no447 /// This is a value-level check on the queue only -- this binary has no
233- /// `TestAppContext`, so it cannot measure what actually painted, and this448+ /// `TestAppContext`, so it cannot measure what actually painted.
234- /// test does not claim to.
235 #[test]449 #[test]
236 fn a_notice_queued_behind_an_unread_one_is_still_reachable_at_the_back() {450 fn a_notice_queued_behind_an_unread_one_is_still_reachable_at_the_back() {
237- let mut notices = std::collections::VecDeque::new();451+ let mut notices = VecDeque::new();
238 push_notice(&mut notices, "SAVED test_h264.edith".into());452 push_notice(&mut notices, "SAVED test_h264.edith".into());
239- let refusal = "the V1 clip at frame 0 is one take with the A1 clip at frame 0: \453+ let refusal = "Can't close this gap: it would put A1 out of sync.";
240- closing this gap alone would pull the take out of sync — close A1's \
241- gap there too, or detach them first";
242 push_notice(&mut notices, refusal.into());454 push_notice(&mut notices, refusal.into());
243- // Nobody dismissed the SAVED notice (no keystroke happened) -- it is455+ // One slot: the refusal replaces the SAVED toast on screen, and it is
244- // still sitting at the front, exactly the scenario that froze the456+ // reachable whole -- not truncated, because `push_notice` never
245- // plate on stale text.457+ // touches a message's text.
246- assert_eq!(notices.front().unwrap().as_ref(), "SAVED test_h264.edith");458+ assert_eq!(notices.len(), 1);
247- // The refusal, remedy clause and all, is reachable at the back --459+ assert_eq!(notices.back().unwrap().text.as_ref(), refusal);
248- // whole, not truncated, because `push_notice` never touches a460+ }
249- // message's text.461+
250- assert_eq!(notices.back().unwrap().as_ref(), refusal);462+ /// A repeat of what is already on screen adds nothing, so holding a key
463+ /// that refuses cannot keep re-announcing one sentence. A repeat after a
464+ /// different message is a new toast, and it replaces that one.
465+ #[test]
466+ fn a_repeat_of_the_back_is_dropped_and_a_repeat_after_another_is_not() {
467+ let mut notices = VecDeque::new();
468+ push_notice(&mut notices, "SNAP ON".into());
469+ push_notice(&mut notices, "SNAP ON".into());
470+ assert_eq!(texts(&notices), vec!["SNAP ON"]);
471+ push_notice(&mut notices, "SNAP OFF".into());
472+ assert_eq!(texts(&notices), vec!["SNAP OFF"]);
473+ push_notice(&mut notices, "SNAP ON".into());
474+ assert_eq!(texts(&notices), vec!["SNAP ON"]);
475+ }
476+
477+ /// The queue has a ceiling, and the oldest message is the one that goes.
478+ #[test]
479+ fn a_sticky_question_never_hides_and_is_drawn_over_newer_notices() {
480+ let mut notices = VecDeque::new();
481+ push_sticky_toast(
482+ &mut notices,
483+ "Unsaved edits from 3 minutes ago were found".into(),
484+ Tone::Info,
485+ vec![ToastAction::Recover, ToastAction::Discard],
486+ );
487+ assert!(!notices.back().unwrap().hides(), "a question waits for its answer");
488+ push_notice(&mut notices, "Snapped to 1.0s".into());
489+ assert!(notices.back().unwrap().hides(), "an ordinary notice still hides");
490+ assert_eq!(
491+ current_toast(&notices).map(|t| t.text.as_ref()),
492+ Some("Unsaved edits from 3 minutes ago were found"),
493+ "the question stays on the bar over a notice pushed after it"
494+ );
495+ }
496+
497+ /// The question is kept beside the one ordinary slot: no notice pushed
498+ /// after it can drop it.
499+ #[test]
500+ fn a_sticky_question_survives_newer_notices() {
501+ let mut notices = VecDeque::new();
502+ push_sticky_toast(&mut notices, "Unsaved edits were found".into(), Tone::Info, Vec::new());
503+ for n in 0..NOTICES_MAX + 3 {
504+ push_notice(&mut notices, format!("NOTE {n}").into());
505+ }
506+ assert_eq!(notices.len(), 2);
507+ assert!(notices.iter().any(|t| t.sticky), "the question is the one never dropped");
508+ assert_eq!(notices.back().unwrap().text.as_ref(), format!("NOTE {}", NOTICES_MAX + 2));
509+ }
510+
511+ #[test]
512+ fn with_no_question_the_bar_shows_the_newest_notice() {
513+ let mut notices = VecDeque::new();
514+ push_notice(&mut notices, "A".into());
515+ push_notice(&mut notices, "B".into());
516+ assert_eq!(current_toast(&notices).map(|t| t.text.as_ref()), Some("B"));
517+ assert!(current_toast(&VecDeque::new()).is_none());
518+ }
519+
520+ /// One slot: however many notices arrive, only the newest is kept.
521+ #[test]
522+ fn the_newest_notice_replaces_the_one_before_it() {
523+ let mut notices = VecDeque::new();
524+ for n in 0..NOTICES_MAX + 2 {
525+ push_notice(&mut notices, format!("NOTE {n}").into());
526+ }
527+ assert_eq!(notices.len(), 1);
528+ assert_eq!(
529+ notices.back().unwrap().text.as_ref(),
530+ format!("NOTE {}", NOTICES_MAX + 1)
531+ );
532+ }
533+
534+ /// Every toast has its own id, so a timer started for one cannot hide
535+ /// another -- including one that says exactly the same thing.
536+ #[test]
537+ fn a_stale_timer_cannot_hide_a_newer_toast_with_the_same_words() {
538+ let mut notices = VecDeque::new();
539+ push_notice(&mut notices, "SNAP ON".into());
540+ let first = notices.back().unwrap().id;
541+ assert!(remove_toast(&mut notices, first));
542+ push_notice(&mut notices, "SNAP ON".into());
543+ let second = notices.back().unwrap().id;
544+ assert_ne!(first, second);
545+ assert!(
546+ !remove_toast(&mut notices, first),
547+ "the old timer found something"
548+ );
549+ assert_eq!(notices.len(), 1);
550+ assert!(remove_toast(&mut notices, second));
551+ assert!(notices.is_empty());
552+ }
553+
554+ /// The tone is read off the words the way the colour always was: a failure
555+ /// or refusal is an error, a no-op is a warning, and the rest is information.
556+ #[test]
557+ fn the_tone_is_read_off_the_words() {
558+ assert_eq!(Tone::of("SCAN FAILED: no audio"), Tone::Err);
559+ assert_eq!(Tone::of("the clip REFUSED to move"), Tone::Err);
560+ assert_eq!(Tone::of("Nothing detached — not grouped"), Tone::Warn);
561+ assert_eq!(Tone::of("SNAP ON"), Tone::Info);
562+ assert_eq!(
563+ Tone::of(&format!("{}out.mp4", crate::EXPORT_DONE)),
564+ Tone::Info
565+ );
566+ }
567+
568+ /// The same words in sentence case read the same tone: the sweep to sentence
569+ /// case must not move a warning or an error to information.
570+ #[test]
571+ fn the_tone_is_read_off_the_words_in_any_case() {
572+ assert_eq!(Tone::of("Scan failed: no audio"), Tone::Err);
573+ assert_eq!(Tone::of("The clip refused to move"), Tone::Err);
574+ assert_eq!(Tone::of("Cannot move the clip"), Tone::Err);
575+ assert_eq!(Tone::of("Nothing detached: not grouped"), Tone::Warn);
576+ assert_eq!(
577+ Tone::of("Nothing added: this file has no playable stream"),
578+ Tone::Warn
579+ );
580+ assert_eq!(Tone::of("Snap on"), Tone::Info);
581+ assert_eq!(Tone::of("Clip deleted"), Tone::Info);
582+ }
583+
584+ /// A keyword counts only as a whole word: "piano" is not "NO", and
585+ /// "nothing" inside a longer word is not the warning.
586+ #[test]
587+ fn the_tone_keywords_match_whole_words_only() {
588+ assert_eq!(Tone::of("Playing the piano track"), Tone::Info);
589+ assert_eq!(Tone::of("Piano sample saved"), Tone::Info);
590+ assert_eq!(Tone::of("Renamed the piano clip"), Tone::Info);
591+ assert_eq!(Tone::of("No audio on this clip"), Tone::Warn);
592+ assert_eq!(Tone::of("Could not open the file"), Tone::Err);
593+ }
594+
595+ /// Info and warn time out; errors stay until they are dismissed. This is
596+ /// the rule the stack's timer is built on, so it is pinned where a change
597+ /// to the tone would have to show up.
598+ #[test]
599+ fn only_errors_stay_on_screen_until_dismissed() {
600+ assert!(Tone::Info.auto_hides());
601+ assert!(Tone::Warn.auto_hides());
602+ assert!(!Tone::Err.auto_hides());
603+ assert_eq!(Toast::new("SNAP ON".into()).tone, Tone::Info);
604+ assert!(!Toast::new("Decode failed — x".into()).tone.auto_hides());
605+ }
606+
607+ /// The engine losing the sound is an error, and getting it back takes the
608+ /// same line away again -- and nothing else in the queue.
609+ #[test]
610+ fn a_lost_sound_is_an_error_and_its_return_retracts_only_its_line() {
611+ // A question stays on screen whatever else arrives, so it is the
612+ // line that must survive the retraction.
613+ let mut notices = VecDeque::new();
614+ push_sticky_toast(&mut notices, "Unsaved edits were found".into(), Tone::Info, Vec::new());
615+ audio_change_notice(&mut notices, None, Some("device gone"));
616+ let lost = audio_lost_line("device gone");
617+ assert_eq!(notices.back().unwrap().text.as_ref(), lost);
618+ assert_eq!(notices.back().unwrap().tone, Tone::Err);
619+ audio_change_notice(&mut notices, Some("device gone"), None);
620+ assert_eq!(texts(&notices), vec!["Unsaved edits were found"]);
251 }621 }
252 622
253 /// The line the strip paints keeps its state word and never stops623 /// The line the strip paints keeps its state word and never stops
@@ -267,4 +637,71 @@ mod tests {
267 "{long}"637 "{long}"
268 );638 );
269 }639 }
640+
641+ /// The delete and lift toasts carry Undo as their action, read as
642+ /// information (so they hide on their own, DESIGN §8), and are removed by
643+ /// id the way the button removes them before it acts.
644+ #[test]
645+ fn a_delete_toast_carries_undo_and_goes_by_its_id() {
646+ let mut notices = VecDeque::new();
647+ push_toast(
648+ &mut notices,
649+ "Clip deleted".into(),
650+ Tone::of("Clip deleted"),
651+ vec![ToastAction::Undo],
652+ );
653+ let toast = notices.back().unwrap();
654+ assert_eq!(toast.actions, [ToastAction::Undo]);
655+ assert_eq!(toast.tone, Tone::Info);
656+ assert!(toast.tone.auto_hides());
657+ let id = toast.id;
658+ assert!(remove_toast(&mut notices, id));
659+ assert!(notices.is_empty());
660+ }
661+
662+ /// An export's outcome offers Play and Show in folder, in that order, and
663+ /// a toast keeps at most two buttons however many it is handed.
664+ #[test]
665+ fn a_toast_keeps_up_to_two_buttons_in_the_order_given() {
666+ let path = PathBuf::from("/tmp/out.mp4");
667+ let mut notices = VecDeque::new();
668+ push_toast(
669+ &mut notices,
670+ "Export done → out.mp4".into(),
671+ Tone::Info,
672+ vec![
673+ ToastAction::Play(path.clone()),
674+ ToastAction::ShowInFolder(path.clone()),
675+ ],
676+ );
677+ assert_eq!(
678+ notices.back().unwrap().actions,
679+ [
680+ ToastAction::Play(path.clone()),
681+ ToastAction::ShowInFolder(path.clone()),
682+ ]
683+ );
684+ push_toast(
685+ &mut notices,
686+ "three buttons".into(),
687+ Tone::Info,
688+ vec![
689+ ToastAction::Undo,
690+ ToastAction::Unlock(Lane::V1),
691+ ToastAction::ShowInFolder(path),
692+ ],
693+ );
694+ assert_eq!(notices.back().unwrap().actions.len(), TOAST_ACTIONS_MAX);
695+ }
696+
697+ /// A message with no button carries none, and the export's own toast is
698+ /// still a toast that hides on its own rather than waiting for a ✕.
699+ #[test]
700+ fn a_plain_notice_has_no_buttons() {
701+ let mut notices = VecDeque::new();
702+ push_notice(&mut notices, "Clip moved".into());
703+ let toast = notices.back().unwrap();
704+ assert!(toast.actions.is_empty());
705+ assert!(toast.tone.auto_hides());
706+ }
270 }707 }
crates/app/src/open_hook.rsadded+190 -0
@@ -0,0 +1,190 @@
1+//! `EDITH_OPEN`: a start-up hook that opens panels, so a headless screenshot
2+//! run can reach every one of them without synthesising clicks. Unset, it does
3+//! nothing at all. Comma-separated: `export`, `settings`, `palette`, `keys`,
4+//! `markers`, `menu:<file|edit|clip|timeline|view|help>` and `clip:<card>`
5+//! (`color`, `transform`, `speed`, `eq`, `mix`, `silence`), the last of which
6+//! first selects the first timeline clip the card can act on.
7+
8+use crate::ui::menubar::Title;
9+use engine::project::LaneKind;
10+use gpui::{Context, Timer};
11+use std::time::Duration;
12+
13+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14+pub(crate) enum Card {
15+ Color,
16+ Transform,
17+ Speed,
18+ Eq,
19+ Mix,
20+ Silence,
21+}
22+
23+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
24+pub(crate) enum Open {
25+ Export,
26+ Settings,
27+ Palette,
28+ Keys,
29+ Markers,
30+ Menu(Title),
31+ Clip(Card),
32+}
33+
34+/// The values `EDITH_OPEN` names; anything unknown is skipped (and said so).
35+pub(crate) fn parse(spec: &str) -> Vec<Open> {
36+ spec.split(',')
37+ .map(str::trim)
38+ .filter(|v| !v.is_empty())
39+ .filter_map(|v| {
40+ let found = match v.split_once(':') {
41+ None => match v {
42+ "export" => Some(Open::Export),
43+ "settings" => Some(Open::Settings),
44+ "palette" => Some(Open::Palette),
45+ "keys" => Some(Open::Keys),
46+ "markers" => Some(Open::Markers),
47+ _ => None,
48+ },
49+ Some(("menu", name)) => match name {
50+ "file" => Some(Title::File),
51+ "edit" => Some(Title::Edit),
52+ "clip" => Some(Title::Clip),
53+ "timeline" => Some(Title::Timeline),
54+ "playback" => Some(Title::Playback),
55+ "view" => Some(Title::View),
56+ "help" => Some(Title::Help),
57+ _ => None,
58+ }
59+ .map(Open::Menu),
60+ Some(("clip", card)) => match card {
61+ "color" => Some(Card::Color),
62+ "transform" => Some(Card::Transform),
63+ "speed" => Some(Card::Speed),
64+ "eq" => Some(Card::Eq),
65+ "mix" => Some(Card::Mix),
66+ "silence" => Some(Card::Silence),
67+ _ => None,
68+ }
69+ .map(Open::Clip),
70+ _ => None,
71+ };
72+ if found.is_none() {
73+ eprintln!("EDITH_OPEN: unknown value {v:?}, skipped");
74+ }
75+ found
76+ })
77+ .collect()
78+}
79+
80+impl crate::Player {
81+ /// Waits for the argv file to land (a launch with none lands at once), then
82+ /// applies `wanted` once. Gives up waiting after a minute.
83+ pub(crate) fn start_open_hook(&mut self, wanted: Vec<Open>, cx: &mut Context<Self>) {
84+ if wanted.is_empty() {
85+ return;
86+ }
87+ cx.spawn(async move |this, cx| {
88+ for _ in 0..300 {
89+ Timer::after(Duration::from_millis(200)).await;
90+ let ready = this
91+ .update(cx, |p, _| {
92+ p.importing.is_none() && p.opening.is_none() && p.imports.is_empty()
93+ })
94+ .unwrap_or(true);
95+ if ready {
96+ break;
97+ }
98+ }
99+ // One more beat for the fit and the first frame.
100+ Timer::after(Duration::from_millis(400)).await;
101+ this.update(cx, |p, cx| p.apply_open(&wanted, cx)).ok();
102+ })
103+ .detach();
104+ }
105+
106+ fn apply_open(&mut self, wanted: &[Open], cx: &mut Context<Self>) {
107+ for open in wanted {
108+ match *open {
109+ Open::Export => self.open_export(cx),
110+ Open::Settings => self.open_settings(cx),
111+ Open::Palette => self.show_actions(cx),
112+ Open::Keys => self.show_keys(cx),
113+ Open::Markers => self.open_markers(cx),
114+ Open::Menu(title) => {
115+ self.menu_open = Some(title);
116+ cx.notify();
117+ }
118+ Open::Clip(card) => {
119+ let wants_sound = matches!(card, Card::Eq | Card::Mix | Card::Silence);
120+ let pick = self.session.as_ref().and_then(|s| {
121+ let lanes = s.lanes();
122+ let by_kind = |kind| {
123+ lanes
124+ .iter()
125+ .copied()
126+ .find(|l| l.kind == kind && !s.lane_clips(*l).is_empty())
127+ };
128+ let (first, second) = match wants_sound {
129+ true => (LaneKind::Audio, LaneKind::Video),
130+ false => (LaneKind::Video, LaneKind::Audio),
131+ };
132+ by_kind(first).or_else(|| by_kind(second))
133+ });
134+ if let Some(lane) = pick {
135+ self.select((lane, 0), cx);
136+ }
137+ // The cards mount in the dock's Clip tab; a fresh profile
138+ // starts on Media, where the card would stay out of shot.
139+ self.dock_src_active = false;
140+ match card {
141+ Card::Color => self.open_color(cx),
142+ Card::Transform => self.open_transform(cx),
143+ Card::Speed => self.open_speed(cx),
144+ Card::Eq => self.open_eq(cx),
145+ Card::Mix => self.open_mix(pick, cx),
146+ Card::Silence => self.open_silence(cx),
147+ }
148+ }
149+ }
150+ }
151+ }
152+}
153+
154+#[cfg(test)]
155+mod tests {
156+ use super::*;
157+
158+ #[test]
159+ fn parses_plain_menu_and_clip_values() {
160+ assert_eq!(
161+ parse("export, settings,palette,keys,markers"),
162+ [Open::Export, Open::Settings, Open::Palette, Open::Keys, Open::Markers]
163+ );
164+ assert_eq!(parse("menu:clip"), [Open::Menu(Title::Clip)]);
165+ assert_eq!(
166+ parse("clip:color,clip:eq"),
167+ [Open::Clip(Card::Color), Open::Clip(Card::Eq)]
168+ );
169+ }
170+
171+ #[test]
172+ fn unknown_and_empty_values_are_skipped() {
173+ assert!(parse("").is_empty());
174+ assert!(parse(",,").is_empty());
175+ assert_eq!(parse("bogus,menu:nope,clip:,palette"), [Open::Palette]);
176+ }
177+
178+ /// A clip card mounts in the dock's Clip tab, so `clip:<card>` must leave
179+ /// the Media tab or the shot shows no card at all.
180+ #[test]
181+ fn clip_cards_switch_the_dock_to_the_clip_tab() {
182+ let src = include_str!("open_hook.rs");
183+ let branch = src
184+ .split("Open::Clip(card) => {")
185+ .nth(1)
186+ .expect("the Clip branch");
187+ let before_card = branch.split("match card {").next().unwrap();
188+ assert!(before_card.contains("self.dock_src_active = false;"));
189+ }
190+}
crates/app/src/oracle.rsmodified+449 -31
@@ -44,13 +44,26 @@ impl Enable {
44 /// is one, and the little of the editor's state the answers need. Handed in44 /// is one, and the little of the editor's state the answers need. Handed in
45 /// rather than read off the player, so [`enable`] is a pure function a test can45 /// rather than read off the player, so [`enable`] is a pure function a test can
46 /// ask about a clip without building a window.46 /// ask about a clip without building a window.
47-#[derive(Clone, Copy, Default)]47+#[derive(Clone, Default)]
48 pub(crate) struct Ctx {48 pub(crate) struct Ctx {
49 /// The clip the question is about -- the one a menu was opened on, or the49 /// The clip the question is about -- the one a menu was opened on, or the
50 /// marked one. `None` means the question is about the editor as a whole,50 /// marked one. `None` means the question is about the editor as a whole,
51 /// and the clip-relative answers stand aside: those actions find their own51 /// and the clip-relative answers stand aside: those actions find their own
52 /// clip under the playhead and word their own refusal.52 /// clip under the playhead and word their own refusal.
53 pub(crate) clip: Option<(Clip, Lane)>,53 pub(crate) clip: Option<(Clip, Lane)>,
54+ /// A gap is picked ([`Player::gap_pick`]): Delete closes it, whether or
55+ /// not any clip is marked.
56+ pub(crate) gap: bool,
57+ /// A gap is picked or the playhead stands in one ([`Player::gap_here`]).
58+ pub(crate) gap_here: bool,
59+ /// Some clip is under the playhead.
60+ pub(crate) clip_here: bool,
61+ /// Transcript words are picked and the transcript is up to date, so the words can be cut.
62+ pub(crate) words: bool,
63+ /// A render preview is being made ([`Player::render_preview`]), so there is one to stop.
64+ pub(crate) rendering: bool,
65+ /// A library item is selected (or was last previewed) to edit from.
66+ pub(crate) asset: bool,
54 /// What was clicked is a placed caption and not a clip: a subtitle lane67 /// What was clicked is a placed caption and not a clip: a subtitle lane
55 /// holds no `Clip` at all, so [`Ctx::clip`] is `None` there and the68 /// holds no `Clip` at all, so [`Ctx::clip`] is `None` there and the
56 /// clip-relative answers would read it as "nothing marked". Its own flag,69 /// clip-relative answers would read it as "nothing marked". Its own flag,
@@ -88,6 +101,128 @@ pub(crate) struct Ctx {
88 /// The group id of the marked caption, when what is marked is one: the101 /// The group id of the marked caption, when what is marked is one: the
89 /// detach question, asked over a box the clip index space cannot name.102 /// detach question, asked over a box the clip index space cannot name.
90 pub(crate) caption_link: Option<u32>,103 pub(crate) caption_link: Option<u32>,
104+ /// What the question is about sits on a locked lane: the clip the menu was
105+ /// opened on or the marked one, or the caption. The edits that would change
106+ /// it are refused with [`LOCKED_REASON`] (DESIGN §7); the answers that only
107+ /// read it are not.
108+ pub(crate) locked: bool,
109+ /// The edit history is empty on that side: nothing for undo to take back,
110+ /// nothing for redo to walk forward. Negative on purpose, so a default
111+ /// `Ctx` keeps both live and only a real reading dims them.
112+ pub(crate) nothing_to_undo: bool,
113+ pub(crate) nothing_to_redo: bool,
114+ /// The clip's group holds no other placement (its link names only itself),
115+ /// so there is nothing for Ungroup to take it out of. Negative like the
116+ /// two above.
117+ pub(crate) alone: bool,
118+ /// No lane has two halves of one take meeting at the playhead, so Regroup
119+ /// would find no cut to close. Negative like the above.
120+ pub(crate) no_join: bool,
121+ /// No clip on another track covers exactly this clip's frames, so a lone
122+ /// Group has no partner to take it to. Negative like the above.
123+ pub(crate) no_partner: bool,
124+ /// The clip the question is about plays another sequence (a compound clip).
125+ pub(crate) compound: bool,
126+ /// The clip plays a multicam source ([`engine::project::Project::multicam_of`]).
127+ pub(crate) multicam: bool,
128+ /// How many library rows are picked, and whether the angle monitor is on.
129+ pub(crate) media_picks: usize,
130+ pub(crate) monitor: bool,
131+ /// The angle count of the multicam clip under the playhead; 0 with none there.
132+ pub(crate) angles_here: usize,
133+ /// How many sequences the project holds, and whether the open one is played
134+ /// by a compound clip somewhere (so cannot be deleted).
135+ pub(crate) sequences: usize,
136+ pub(crate) sequence_used: bool,
137+ /// The open sequence was entered from a compound clip: there is a parent to go back to.
138+ pub(crate) parent: bool,
139+}
140+
141+/// The refusal every edit to a locked lane's item carries, in the words the
142+/// toast and the dimmed row both say.
143+pub(crate) const LOCKED_REASON: &str = "The track is locked";
144+
145+/// Whether `action` changes the clip or caption it is asked about: the ones a
146+/// lock refuses. Selection, playback, the playhead and the editor's own
147+/// switches are not in it -- a locked lane still plays and still reads.
148+fn edits_placement(action: ActionId) -> bool {
149+ matches!(
150+ action,
151+ ActionId::Cut
152+ | ActionId::Regroup
153+ | ActionId::Detach
154+ | ActionId::Group
155+ | ActionId::Delete
156+ | ActionId::Lift
157+ | ActionId::Paste
158+ | ActionId::PasteAttributes
159+ | ActionId::PasteColor
160+ | ActionId::PasteEffects
161+ | ActionId::PasteTransform
162+ | ActionId::PasteSpeed
163+ | ActionId::PasteAudio
164+ | ActionId::NudgeBack
165+ | ActionId::NudgeForward
166+ | ActionId::NudgeBack10
167+ | ActionId::NudgeForward10
168+ | ActionId::ExtendAudio
169+ | ActionId::ExtendVideo
170+ | ActionId::Crossfade
171+ | ActionId::Dissolve
172+ | ActionId::TransitionDissolve
173+ | ActionId::TransitionDipBlack
174+ | ActionId::TransitionDipWhite
175+ | ActionId::TransitionWipeLeft
176+ | ActionId::TransitionWipeRight
177+ | ActionId::TransitionWipeUp
178+ | ActionId::TransitionWipeDown
179+ | ActionId::TransitionSlideLeft
180+ | ActionId::TransitionSlideRight
181+ | ActionId::TransitionSlideUp
182+ | ActionId::TransitionSlideDown
183+ | ActionId::TransitionPushLeft
184+ | ActionId::TransitionPushRight
185+ | ActionId::TransitionPushUp
186+ | ActionId::TransitionPushDown
187+ | ActionId::TransitionZoom
188+ | ActionId::Color
189+ | ActionId::Fit
190+ | ActionId::Reframe
191+ | ActionId::TrackMask
192+ | ActionId::NestClips
193+ | ActionId::BreakApart
194+ | ActionId::Transform
195+ | ActionId::Effects
196+ | ActionId::KeyPlacement
197+ | ActionId::KeyOpacity
198+ | ActionId::KeyColor
199+ | ActionId::KeyEasing
200+ | ActionId::Equalizer
201+ | ActionId::Silence
202+ | ActionId::Reverse
203+ | ActionId::SpeedRampUp
204+ | ActionId::SpeedRampDown
205+ | ActionId::SpeedRampSlowFastSlow
206+ | ActionId::SpeedRampFastSlowFast
207+ | ActionId::SpeedRampKey
208+ | ActionId::SpeedRampClear
209+ | ActionId::Mix
210+ | ActionId::CleanVoice
211+ | ActionId::VoiceDynamics
212+ | ActionId::TrimIn
213+ | ActionId::TrimOut
214+ | ActionId::TrimInToPlayhead
215+ | ActionId::TrimOutToPlayhead
216+ | ActionId::RippleTrimInToPlayhead
217+ | ActionId::RippleTrimOutToPlayhead
218+ | ActionId::RollBack
219+ | ActionId::RollForward
220+ | ActionId::SlipBack
221+ | ActionId::SlipForward
222+ | ActionId::SlideBack
223+ | ActionId::SlideForward
224+ | ActionId::LoopTrim
225+ )
91 }226 }
92 227
93 /// Whether `action` can be asked for, on `ctx`. One arm per action and nothing228 /// Whether `action` can be asked for, on `ctx`. One arm per action and nothing
@@ -96,6 +231,12 @@ pub(crate) struct Ctx {
96 /// disagree about what an action needs -- exactly the reason [`Player::act`] is231 /// disagree about what an action needs -- exactly the reason [`Player::act`] is
97 /// one table too.232 /// one table too.
98 pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {233 pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
234+ if action == ActionId::CancelRender && !ctx.rendering {
235+ return Enable::No("nothing is rendering");
236+ }
237+ if action == ActionId::CutSelectedWords && !ctx.words {
238+ return Enable::No("no transcript words picked");
239+ }
99 // The one action that is about the editor rather than about the timeline:240 // The one action that is about the editor rather than about the timeline:
100 // the list of what everything does, and where a key is changed. An empty241 // the list of what everything does, and where a key is changed. An empty
101 // window has no clips and still has keys -- so this answers ahead of the242 // window has no clips and still has keys -- so this answers ahead of the
@@ -114,12 +255,25 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
114 // so a permission this oracle granted here would be a permission nobody255 // so a permission this oracle granted here would be a permission nobody
115 // could ever observe. It is refused below, with every other card.256 // could ever observe. It is refused below, with every other card.
116 if action == ActionId::Theme257 if action == ActionId::Theme
258+ || action == ActionId::AccentColour
117 || action == ActionId::Fullscreen259 || action == ActionId::Fullscreen
118 || action == ActionId::SubtitleStyle260 || action == ActionId::SubtitleStyle
119 // Moving the keyboard ring is the same kind of always-there,261 // Moving the keyboard ring is the same kind of always-there,
120 // touches-no-timeline action as the three above: there is always a262 // touches-no-timeline action as the three above: there is always a
121 // dock/bench/inspector to land the ring on, export or no.263 // dock/bench/inspector to land the ring on, export or no.
122 || action == ActionId::FocusPanels264 || action == ActionId::FocusPanels
265+ // The shortcuts sheet is the same kind of door: it opens and closes
266+ // a tab and touches no timeline, so it is live through an export too.
267+ || action == ActionId::ShowKeys
268+ || action == ActionId::About
269+ // The viewer's own look (zoom, playback quality, guides, mask): view state, no timeline.
270+ || action == ActionId::ViewZoom
271+ || action == ActionId::PlaybackQuality
272+ || action == ActionId::GuideStyle
273+ || action == ActionId::GuideMask
274+ // The video output window and its display: a second window onto the picture, no timeline.
275+ || action == ActionId::ToggleOutputWindow
276+ || action == ActionId::OutputDisplay
123 {277 {
124 return Enable::Yes;278 return Enable::Yes;
125 }279 }
@@ -161,12 +315,21 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
161 // stand-in switches above.315 // stand-in switches above.
162 | ActionId::AddFiles316 | ActionId::AddFiles
163 | ActionId::PasteFilePath317 | ActionId::PasteFilePath
318+ // The way into a project from nothing: live exactly when there is none.
319+ | ActionId::NewProject
320+ // Opening a project file replaces whatever is open, so it is live with or without one.
321+ | ActionId::OpenProject
164 ) {322 ) {
165 return match ctx.exporting {323 return match ctx.exporting {
166 true => Enable::No("an export is running"),324 true => Enable::No("an export is running"),
167 false => Enable::Yes,325 false => Enable::Yes,
168 };326 };
169 }327 }
328+ // Export writes what is on the timeline, so an empty one has nothing to write. The
329+ // export that is already running answers for itself below (its progress button stays live).
330+ if action == ActionId::Export && !ctx.exporting && !ctx.playable {
331+ return Enable::No("the timeline is empty");
332+ }
170 if !ctx.timeline {333 if !ctx.timeline {
171 return Enable::No("no timeline open");334 return Enable::No("no timeline open");
172 }335 }
@@ -178,6 +341,12 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
178 _ => Enable::No("an export is running"),341 _ => Enable::No("an export is running"),
179 };342 };
180 }343 }
344+ // A lock is the one refusal about the item itself rather than the editor:
345+ // the item is there and can be looked at, only the edits that would change
346+ // it are turned away, and say why in the toast's own words.
347+ if ctx.locked && edits_placement(action) {
348+ return Enable::No(LOCKED_REASON);
349+ }
181 // A caption is not a clip: the actions that act on *the marked clip and350 // A caption is not a clip: the actions that act on *the marked clip and
182 // nothing else* have nothing to act on over a placed subtitle, so they are351 // nothing else* have nothing to act on over a placed subtitle, so they are
183 // refusals of kind -- not rows at all, rather than rows saying "click a clip352 // refusals of kind -- not rows at all, rather than rows saying "click a clip
@@ -198,7 +367,13 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
198 if ctx.caption367 if ctx.caption
199 && matches!(368 && matches!(
200 action,369 action,
201- ActionId::Copy | ActionId::Delete | ActionId::Lift | ActionId::Equalizer370+ ActionId::Copy
371+ | ActionId::Delete
372+ | ActionId::Lift
373+ | ActionId::Equalizer
374+ | ActionId::NestClips
375+ | ActionId::BreakApart
376+ | ActionId::OpenCompound
202 )377 )
203 {378 {
204 return match action {379 return match action {
@@ -206,6 +381,47 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
206 _ => Enable::Hidden("this is a caption"),381 _ => Enable::Hidden("this is a caption"),
207 };382 };
208 }383 }
384+ // A compound clip plays another sequence: its own rate, grade, placement and the scans of a
385+ // file are not applied to it (grade the clips inside), so those rows are not offered.
386+ if ctx.compound
387+ && ctx.clip.is_some()
388+ && matches!(
389+ action,
390+ ActionId::Speed
391+ | ActionId::SpeedRampUp
392+ | ActionId::SpeedRampDown
393+ | ActionId::SpeedRampSlowFastSlow
394+ | ActionId::SpeedRampFastSlowFast
395+ | ActionId::SpeedRampKey
396+ | ActionId::SpeedRampClear
397+ | ActionId::Reverse
398+ | ActionId::Color
399+ | ActionId::AutoColour
400+ | ActionId::SaveLook
401+ | ActionId::Transform
402+ | ActionId::Effects
403+ | ActionId::KeyPlacement
404+ | ActionId::KeyOpacity
405+ | ActionId::KeyColor
406+ | ActionId::KeyEasing
407+ | ActionId::Fit
408+ | ActionId::Equalizer
409+ | ActionId::Silence
410+ | ActionId::Visualizer
411+ | ActionId::Reframe
412+ | ActionId::TrackMask
413+ | ActionId::Mix
414+ | ActionId::CleanVoice
415+ | ActionId::VoiceDynamics
416+ )
417+ {
418+ return Enable::Hidden("a compound clip plays a sequence");
419+ }
420+ match action {
421+ ActionId::Undo if ctx.nothing_to_undo => return Enable::No("nothing to undo"),
422+ ActionId::Redo if ctx.nothing_to_redo => return Enable::No("nothing to redo"),
423+ _ => {}
424+ }
209 match action {425 match action {
210 // -- class: what kind of thing the action is about. The equalizer426 // -- class: what kind of thing the action is about. The equalizer
211 // filters samples, and a video clip has none of its own here: the sound427 // filters samples, and a video clip has none of its own here: the sound
@@ -222,7 +438,19 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
222 // policy is a picture setting for the same reason.438 // policy is a picture setting for the same reason.
223 // The dissolve is the picture join and the crossfade's mirror: two439 // The dissolve is the picture join and the crossfade's mirror: two
224 // pictures cross, and there is no picture on a waveform to cross.440 // pictures cross, and there is no picture on a waveform to cross.
225- ActionId::Color | ActionId::Fit | ActionId::Transform | ActionId::Dissolve => {441+ a if matches!(
442+ a,
443+ ActionId::Color
444+ | ActionId::Fit
445+ | ActionId::Transform
446+ | ActionId::Effects
447+ | ActionId::KeyPlacement
448+ | ActionId::KeyOpacity
449+ | ActionId::KeyColor
450+ | ActionId::KeyEasing
451+ | ActionId::Dissolve
452+ ) || a.transition_kind().is_some() =>
453+ {
226 match ctx.clip {454 match ctx.clip {
227 Some((_, lane)) if lane.kind != LaneKind::Video => {455 Some((_, lane)) if lane.kind != LaneKind::Video => {
228 Enable::Hidden("this clip is sound")456 Enable::Hidden("this clip is sound")
@@ -236,14 +464,89 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
236 // there is no row left to click. The mixer's track volumes are the464 // there is no row left to click. The mixer's track volumes are the
237 // same class refusal over the same clip: nothing to mix for a picture465 // same class refusal over the same clip: nothing to mix for a picture
238 // with no sound at all.466 // with no sound at all.
239- ActionId::Silence | ActionId::Mix if ctx.image => Enable::Hidden("this clip is a still"),467+ // Beats need a sound to listen to: a picture-only clip is refused by name, dimmed.
468+ ActionId::MarkBeats if ctx.image || ctx.no_sound => Enable::No("Pick a clip with sound"),
469+ ActionId::Silence | ActionId::Mix | ActionId::CleanVoice | ActionId::VoiceDynamics
470+ if ctx.image => Enable::Hidden("this clip is a still"),
471+ // A still has no footage to run the other way.
472+ ActionId::Reverse if ctx.image => Enable::Hidden("this clip is a still"),
473+ // Sequences: always there with a timeline, bar the cap and the rules
474+ // the engine would refuse them by.
475+ ActionId::NewSequence | ActionId::DuplicateSequence if ctx.sequences >= engine::project::MAX_SEQUENCES => {
476+ Enable::No("the project holds as many sequences as it can")
477+ }
478+ ActionId::NewSequence | ActionId::DuplicateSequence | ActionId::RenameSequence => Enable::Yes,
479+ ActionId::DeleteSequence if ctx.sequences <= 1 => Enable::No("this is the only sequence"),
480+ ActionId::DeleteSequence if ctx.sequence_used => Enable::No("a compound clip plays this sequence"),
481+ ActionId::DeleteSequence => Enable::Yes,
482+ ActionId::CloseCompound if !ctx.parent => Enable::No("this sequence was not opened from a compound clip"),
483+ ActionId::CloseCompound => Enable::Yes,
484+ ActionId::ZoomToSelection if ctx.picks == 0 => Enable::No("Select a clip first"),
485+ ActionId::NestClips if ctx.picks == 0 && ctx.clip.is_none() => Enable::No("select the clips to nest"),
486+ ActionId::NestClips => Enable::Yes,
487+ ActionId::CreateMulticam if ctx.media_picks < 2 => Enable::No("Needs two or more picked clips"),
488+ ActionId::CreateMulticam => Enable::Yes,
489+ ActionId::FlattenMulticam if ctx.multicam => Enable::Yes,
490+ ActionId::FlattenMulticam => match ctx.clip {
491+ None => Enable::No("select a multicam clip"),
492+ Some(_) => Enable::Hidden("not a multicam clip"),
493+ },
494+ ActionId::ToggleAngleMonitor | ActionId::ToggleWaveforms | ActionId::ToggleScrubAudio | ActionId::CompareOff | ActionId::CompareSplit | ActionId::CompareSide => Enable::Yes,
495+ // The number keys are the monitor's: silent anywhere else, so a digit is never eaten.
496+ ActionId::Angle1
497+ | ActionId::Angle2
498+ | ActionId::Angle3
499+ | ActionId::Angle4
500+ | ActionId::Angle5
501+ | ActionId::Angle6
502+ | ActionId::Angle7
503+ | ActionId::Angle8
504+ | ActionId::Angle9
505+ if !ctx.monitor || ctx.angles_here == 0 =>
506+ {
507+ Enable::Hidden("the angle monitor is off or no multicam clip is under the playhead")
508+ }
509+ ActionId::Angle1
510+ | ActionId::Angle2
511+ | ActionId::Angle3
512+ | ActionId::Angle4
513+ | ActionId::Angle5
514+ | ActionId::Angle6
515+ | ActionId::Angle7
516+ | ActionId::Angle8
517+ | ActionId::Angle9 => {
518+ let n = action.angle_number().unwrap_or(0);
519+ if n > ctx.angles_here { Enable::No("this multicam clip has fewer angles") } else { Enable::Yes }
520+ }
521+ ActionId::BreakApart | ActionId::OpenCompound => match ctx.clip {
522+ None => Enable::No("select a compound clip"),
523+ Some(_) if !ctx.compound => Enable::Hidden("not a compound clip"),
524+ Some(_) => Enable::Yes,
525+ },
526+ // Tracking follows a mask's box through footage, so it needs a picture clip with a mask on it.
527+ ActionId::TrackMask => match &ctx.clip {
528+ Some((_, lane)) if lane.kind != LaneKind::Video => Enable::Hidden("this clip is sound"),
529+ Some((c, _)) if !c.effects.iter().any(|e| matches!(e.kind, engine::effects::EffectKind::RectMask | engine::effects::EffectKind::EllipseMask)) => {
530+ Enable::No("no rect or ellipse mask")
531+ }
532+ Some(_) => Enable::Yes,
533+ None => Enable::No("select a video clip"),
534+ },
535+ // Reframing follows a subject through footage: a still has none to follow.
536+ ActionId::Reframe => match ctx.clip {
537+ Some((_, lane)) if lane.kind != LaneKind::Video => Enable::Hidden("this clip is sound"),
538+ Some(_) if ctx.image => Enable::Hidden("this clip is a still"),
539+ Some(_) => Enable::Yes,
540+ None => Enable::No("select a video clip"),
541+ },
240 ActionId::Visualizer if ctx.image => Enable::Hidden("this clip is a still"),542 ActionId::Visualizer if ctx.image => Enable::Hidden("this clip is a still"),
241 ActionId::Visualizer if ctx.no_sound => Enable::Hidden("this clip has no sound"),543 ActionId::Visualizer if ctx.no_sound => Enable::Hidden("this clip has no sound"),
242 ActionId::Visualizer => match ctx.clip {544 ActionId::Visualizer => match ctx.clip {
243 Some(_) => Enable::Yes,545 Some(_) => Enable::Yes,
244 None => Enable::No("select a clip with sound"),546 None => Enable::No("select a clip with sound"),
245 },547 },
246- ActionId::Silence | ActionId::Mix if ctx.no_sound => {548+ ActionId::Silence | ActionId::Mix | ActionId::CleanVoice | ActionId::VoiceDynamics
549+ if ctx.no_sound => {
247 Enable::Hidden("this clip has no sound")550 Enable::Hidden("this clip has no sound")
248 }551 }
249 // -- state: true of this clip now, and the next playhead click or the552 // -- state: true of this clip now, and the next playhead click or the
@@ -261,14 +564,10 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
261 // between two showings of one frame would leave halves whose lengths564 // between two showings of one frame would leave halves whose lengths
262 // no longer add up, so it is refused -- and it says *that* rather565 // no longer add up, so it is refused -- and it says *that* rather
263 // than repeating "inside a clip" at a playhead that plainly is.566 // than repeating "inside a clip" at a playhead that plainly is.
264- Some((clip, _))567+ Some((clip, _)) if !clip.splits_at(ctx.playhead) => Enable::No(match clip.speed_keys.is_empty() {
265- if clip568+ true => "this speed holds one frame here",
266- .speed569+ false => "this speed ramp cannot be cut at this frame",
267- .split_at(clip.len(), ctx.playhead - clip.start)570+ }),
268- .is_none() =>
269- {
270- Enable::No("this speed holds one frame here")
271- }
272 _ => Enable::Yes,571 _ => Enable::Yes,
273 },572 },
274 // Rejoins whatever meets at the playhead, so it can mean something only573 // Rejoins whatever meets at the playhead, so it can mean something only
@@ -278,6 +577,7 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
278 Some((clip, _)) if ctx.playhead != clip.start && ctx.playhead != clip.end() => {577 Some((clip, _)) if ctx.playhead != clip.start && ctx.playhead != clip.end() => {
279 Enable::No("only where two clips meet")578 Enable::No("only where two clips meet")
280 }579 }
580+ Some(_) if ctx.no_join => Enable::No("no cut under the playhead to close"),
281 _ => Enable::Yes,581 _ => Enable::Yes,
282 },582 },
283 // Nothing to take apart in a placement that names no group at all --583 // Nothing to take apart in a placement that names no group at all --
@@ -285,7 +585,9 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
285 // Whether the group it names still has another half is the engine's585 // Whether the group it names still has another half is the engine's
286 // question, like the regroup above.586 // question, like the regroup above.
287 ActionId::Detach => match (ctx.clip, ctx.caption) {587 ActionId::Detach => match (ctx.clip, ctx.caption) {
288- (Some((clip, _)), _) if clip.link.is_none() => Enable::No("this clip is not grouped"),588+ (Some((clip, _)), _) if clip.link.is_none() || ctx.alone => {
589+ Enable::No("this clip is not grouped")
590+ }
289 (None, true) if ctx.caption_link.is_none() => Enable::No("this caption is not grouped"),591 (None, true) if ctx.caption_link.is_none() => Enable::No("this caption is not grouped"),
290 _ => Enable::Yes,592 _ => Enable::Yes,
291 },593 },
@@ -297,11 +599,17 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
297 ActionId::Group => match ctx.picks {599 ActionId::Group => match ctx.picks {
298 2.. if ctx.pick_lanes == ctx.picks => Enable::Yes,600 2.. if ctx.pick_lanes == ctx.picks => Enable::Yes,
299 2.. => Enable::No("a lane is picked twice"),601 2.. => Enable::No("a lane is picked twice"),
602+ _ if ctx.clip.is_some() && ctx.no_partner => {
603+ Enable::No("needs a clip on another track at the same time")
604+ }
300 _ => Enable::Yes,605 _ => Enable::Yes,
301 },606 },
302 // The three that act on the marked clip and on nothing else: with none607 // The three that act on the marked clip and on nothing else: with none
303 // marked they would silently do nothing, which is what the Delete608 // marked they would silently do nothing, which is what the Delete
304 // button's own dimming has always said.609 // button's own dimming has always said.
610+ // Delete over a picked gap closes the gap, so it is live with nothing
611+ // marked (DESIGN §7); the clip-only rows beside it stay refused.
612+ ActionId::Delete if ctx.gap => Enable::Yes,
305 ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => {613 ActionId::Copy | ActionId::Delete | ActionId::Lift if ctx.clip.is_none() => {
306 Enable::No("nothing selected")614 Enable::No("nothing selected")
307 }615 }
@@ -318,21 +626,82 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
318 | ActionId::LoopTrim626 | ActionId::LoopTrim
319 if ctx.clip.is_none() =>627 if ctx.clip.is_none() =>
320 {628 {
321- Enable::No("no subject cut")629+ Enable::No("no clip is selected")
630+ }
631+ // Slip shifts which part of the file a clip shows, and a still has no
632+ // more of a file to show -- a class refusal like the scan's.
633+ ActionId::SlipBack | ActionId::SlipForward if ctx.image => {
634+ Enable::Hidden("this clip is a still")
635+ }
636+ // The pro trims (roll, slip, slide) act on the subject clip and its
637+ // neighbours; whether a neighbour is there is the engine's question,
638+ // and it words that refusal itself.
639+ ActionId::RollBack
640+ | ActionId::RollForward
641+ | ActionId::SlipBack
642+ | ActionId::SlipForward
643+ | ActionId::SlideBack
644+ | ActionId::SlideForward
645+ if ctx.clip.is_none() =>
646+ {
647+ Enable::No("no clip is selected")
322 }648 }
323 // Trim-to-playhead (debt #42): the keyboard's own version of the649 // Trim-to-playhead (debt #42): the keyboard's own version of the
324 // pointer's drag-the-edge-to-a-spot trim, so it needs the two things650 // pointer's drag-the-edge-to-a-spot trim, so it needs the two things
325 // that gesture needs -- a subject cut, and the playhead actually651 // that gesture needs -- a subject cut, and the playhead actually
326 // resting somewhere on it, or the "spot" the edge would snap to is652 // resting somewhere on it, or the "spot" the edge would snap to is
327 // not on the clip at all.653 // not on the clip at all.
328- ActionId::TrimInToPlayhead | ActionId::TrimOutToPlayhead => match ctx.clip {654+ ActionId::TrimInToPlayhead
329- None => Enable::No("no subject cut"),655+ | ActionId::TrimOutToPlayhead
656+ | ActionId::RippleTrimInToPlayhead
657+ | ActionId::RippleTrimOutToPlayhead => match ctx.clip {
658+ None => Enable::No("no clip is selected"),
330 Some((clip, _)) if ctx.playhead < clip.start || ctx.playhead > clip.end() => {659 Some((clip, _)) if ctx.playhead < clip.start || ctx.playhead > clip.end() => {
331- Enable::No("the playhead is off this cut")660+ Enable::No("the playhead is off this clip")
332 }661 }
333 _ => Enable::Yes,662 _ => Enable::Yes,
334 },663 },
335 ActionId::Paste if !ctx.clipboard => Enable::No("nothing copied yet"),664 ActionId::Paste if !ctx.clipboard => Enable::No("nothing copied yet"),
665+ ActionId::CloseGap if !ctx.gap_here => Enable::No("no gap under the playhead"),
666+ ActionId::Freeze | ActionId::MatchFrame if !ctx.clip_here => Enable::No("nothing under the playhead"),
667+ ActionId::ReplaceEdit if !ctx.clip_here => Enable::No("nothing under the playhead"),
668+ ActionId::ReplaceEdit if !ctx.asset => Enable::No("no library item selected"),
669+ ActionId::PasteAttributes
670+ | ActionId::PasteColor
671+ | ActionId::PasteEffects
672+ | ActionId::PasteTransform
673+ | ActionId::PasteSpeed
674+ | ActionId::PasteAudio
675+ if !ctx.clipboard =>
676+ {
677+ Enable::No("nothing copied yet")
678+ }
679+ ActionId::PasteAttributes
680+ | ActionId::PasteColor
681+ | ActionId::PasteEffects
682+ | ActionId::PasteTransform
683+ | ActionId::PasteSpeed
684+ | ActionId::PasteAudio
685+ | ActionId::NudgeBack
686+ | ActionId::NudgeForward
687+ | ActionId::NudgeBack10
688+ | ActionId::NudgeForward10
689+ if ctx.picks == 0 && ctx.clip.is_none() =>
690+ {
691+ Enable::No("no clips selected")
692+ }
693+ ActionId::ExtendAudio | ActionId::ExtendVideo => {
694+ let want = if action == ActionId::ExtendAudio { LaneKind::Audio } else { LaneKind::Video };
695+ match ctx.clip {
696+ None => Enable::No("no clip selected"),
697+ Some((_, lane)) if lane.kind == want => Enable::Yes,
698+ Some((clip, _)) if clip.link.is_none() || ctx.alone => Enable::No(match want {
699+ LaneKind::Audio => "select the sound clip, or group it with the picture",
700+ _ => "select the picture clip, or group it with the sound",
701+ }),
702+ Some(_) => Enable::Yes,
703+ }
704+ }
336 // Nothing to draw over the picture, so nothing to switch off: the705 // Nothing to draw over the picture, so nothing to switch off: the
337 // library says how subtitles arrive, and this row would flip a state706 // library says how subtitles arrive, and this row would flip a state
338 // with no visible half either way.707 // with no visible half either way.
@@ -348,7 +717,15 @@ pub(crate) fn enable(action: ActionId, ctx: Ctx) -> Enable {
348 // A clock started against an empty timeline is a clock counting717 // A clock started against an empty timeline is a clock counting
349 // nothing: the transport says so by being dim, which is what its own718 // nothing: the transport says so by being dim, which is what its own
350 // ad-hoc boolean used to say before the oracle knew the question.719 // ad-hoc boolean used to say before the oracle knew the question.
351- ActionId::Play | ActionId::Loop if !ctx.playable => Enable::No("the timeline is empty"),720+ // Play is refused while an export runs (`toggle_or_restart`), and so
721+ // are the shuttle's forward and pause: the same clock, the same reason.
722+ ActionId::ShuttleStop | ActionId::ShuttleBack | ActionId::ShuttleForward if ctx.exporting => {
723+ Enable::No("an export is running")
724+ }
725+ ActionId::Play | ActionId::Loop | ActionId::PlayAround | ActionId::ShuttleBack | ActionId::ShuttleForward
726+ if !ctx.playable => {
727+ Enable::No("the timeline is empty")
728+ }
352 // A rate applies to a clip of either kind and to its whole group, so729 // A rate applies to a clip of either kind and to its whole group, so
353 // there is no lane it means nothing on, and the engine words the one730 // there is no lane it means nothing on, and the engine words the one
354 // refusal there is (no room). Everything else is the editor's own and731 // refusal there is (no room). Everything else is the editor's own and
@@ -366,6 +743,8 @@ pub(crate) fn enable_lane(action: ActionId, lane: Lane, ctx: Ctx) -> Enable {
366 (ActionId::Mix, LaneKind::Audio)743 (ActionId::Mix, LaneKind::Audio)
367 | (ActionId::RemoveVideoLane, LaneKind::Video)744 | (ActionId::RemoveVideoLane, LaneKind::Video)
368 | (ActionId::RemoveAudioLane, LaneKind::Audio) => enable(action, ctx),745 | (ActionId::RemoveAudioLane, LaneKind::Audio) => enable(action, ctx),
746+ (ActionId::RenameLane, _) => Enable::Yes,
747+ (ActionId::TrackSmall | ActionId::TrackMedium | ActionId::TrackLarge, _) => Enable::Yes,
369 _ => Enable::Hidden("this verb does not apply to this lane"),748 _ => Enable::Hidden("this verb does not apply to this lane"),
370 }749 }
371 }750 }
@@ -387,6 +766,10 @@ pub(crate) fn lane_items(lane: Lane) -> Vec<ActionId> {
387 if lane.kind == LaneKind::Audio {766 if lane.kind == LaneKind::Audio {
388 items.push(ActionId::Mix);767 items.push(ActionId::Mix);
389 }768 }
769+ items.push(ActionId::RenameLane);
770+ // This track's own height, three radio rows: the same three sizes the
771+ // Timeline menu sets for every track at once (`overlays` words them for one).
772+ items.extend([ActionId::TrackSmall, ActionId::TrackMedium, ActionId::TrackLarge]);
390 items.push(match lane.kind {773 items.push(match lane.kind {
391 LaneKind::Video => ActionId::RemoveVideoLane,774 LaneKind::Video => ActionId::RemoveVideoLane,
392 LaneKind::Audio => ActionId::RemoveAudioLane,775 LaneKind::Audio => ActionId::RemoveAudioLane,
@@ -416,7 +799,7 @@ pub(crate) fn lane_items(lane: Lane) -> Vec<ActionId> {
416 pub(crate) fn menu_items(ctx: Ctx) -> Vec<ActionId> {799 pub(crate) fn menu_items(ctx: Ctx) -> Vec<ActionId> {
417 MENU_ITEMS800 MENU_ITEMS
418 .into_iter()801 .into_iter()
419- .filter(|&action| enable(action, ctx).listed())802+ .filter(|&action| enable(action, ctx.clone()).listed())
420 .filter(|&action| {803 .filter(|&action| {
421 !ctx.caption804 !ctx.caption
422 || matches!(805 || matches!(
@@ -445,34 +828,58 @@ pub(crate) struct RowCtx {
445 /// How many clips play this exact row -- a source with any is one the828 /// How many clips play this exact row -- a source with any is one the
446 /// engine will not take out of the list.829 /// engine will not take out of the list.
447 pub(crate) placed: usize,830 pub(crate) placed: usize,
831+ /// A stand-in is being made or wound down, so the proxy row reads "Stop
832+ /// proxy" and its click stops it ([`RowItem::label_in`]).
833+ pub(crate) proxy_stops: bool,
834+ /// The source is starred, so the favourite row reads "Remove from favourites".
835+ pub(crate) starred: bool,
836+ /// The file is gone from disk: it can only be relinked, not played or added.
837+ pub(crate) offline: bool,
838+ /// The library rows picked for a multicam clip ([`Player::picked_sources`]).
839+ pub(crate) media_picks: usize,
448 }840 }
449 841
450 /// Whether a library row's item can be asked for. The library's half of842 /// Whether a library row's item can be asked for. The library's half of
451 /// [`enable`], and the same rule: one table, no second policy in the render.843 /// [`enable`], and the same rule: one table, no second policy in the render.
452 pub(crate) fn row_enable(item: RowItem, ctx: RowCtx) -> Enable {844 pub(crate) fn row_enable(item: RowItem, ctx: RowCtx) -> Enable {
453 match item {845 match item {
846+ RowItem::Relink if !ctx.offline => Enable::Hidden("the file is not missing"),
847+ RowItem::Relink if ctx.exporting => Enable::No("an export is running"),
848+ RowItem::Relink => Enable::Yes,
849+ RowItem::CreateMulticam if ctx.media_picks < 2 => Enable::No("Needs two or more picked clips"),
850+ RowItem::CreateMulticam => Enable::Yes,
851+ // A file that is not on disk has nothing to play, add or copy.
852+ RowItem::Add | RowItem::Insert | RowItem::Preview | RowItem::Proxy if ctx.offline => {
853+ Enable::No("the file is missing")
854+ }
454 // The two that change the timeline, so an export reading it stops them855 // The two that change the timeline, so an export reading it stops them
455 // both -- the key handler's rule, applied to a menu.856 // both -- the key handler's rule, applied to a menu.
456- RowItem::Add | RowItem::Remove | RowItem::RemoveWithClips if ctx.exporting => {857+ RowItem::Favourite | RowItem::MoveToBin | RowItem::NewBin if ctx.exporting => {
457 Enable::No("an export is running")858 Enable::No("an export is running")
458 }859 }
459- RowItem::Add | RowItem::Remove | RowItem::RemoveWithClips if !ctx.timeline => {860+ RowItem::Favourite | RowItem::MoveToBin | RowItem::NewBin if !ctx.timeline => {
861+ Enable::No("no timeline open")
862+ }
863+ RowItem::Add | RowItem::Insert | RowItem::Remove | RowItem::RemoveWithClips if ctx.exporting => {
864+ Enable::No("an export is running")
865+ }
866+ RowItem::Add | RowItem::Insert | RowItem::Remove | RowItem::RemoveWithClips if !ctx.timeline => {
460 Enable::No("no timeline open")867 Enable::No("no timeline open")
461 }868 }
462 // Dimmed and saying why rather than clicked and refused afterwards: the869 // Dimmed and saying why rather than clicked and refused afterwards: the
463 // row's own grey already says the file cannot join this timeline.870 // row's own grey already says the file cannot join this timeline.
464- RowItem::Add if !ctx.usable => Enable::No("it cannot join this one"),871+ RowItem::Add | RowItem::Insert if !ctx.usable => Enable::No("it cannot join this one"),
465 // A file the engine cannot read has nothing to play and nothing to872 // A file the engine cannot read has nothing to play and nothing to
466 // make a stand-in from: hidden rather than dimmed, the way the two873 // make a stand-in from: hidden rather than dimmed, the way the two
467 // removes are, because neither verb has a state that would light it.874 // removes are, because neither verb has a state that would light it.
468 RowItem::Preview | RowItem::Proxy if !ctx.usable => Enable::Hidden("it cannot be read"),875 RowItem::Preview | RowItem::Proxy if !ctx.usable => Enable::Hidden("it cannot be read"),
469- // The two removes are one verb with two shapes, and exactly one of876+ // The two removes are listed together, always (DESIGN §6.7): the plain
470- // them is ever on the plate: the plain one while nothing plays the877+ // one is refused while a clip plays the file, and the clips-too one is
471- // source, the clips-too one while something does. Hidden rather than878+ // refused while none does, each saying why in the column where its
472- // dimmed, because a dimmed "Remove" sitting above a live "Remove —879+ // chord would be. Dimmed rather than hidden, so the pointer can see
473- // with its clips" is two rows arguing about the same act.880+ // both ways out and which one applies right now.
474- RowItem::Remove if ctx.placed > 0 => Enable::Hidden("clips play it"),881+ RowItem::Remove if ctx.placed > 0 => Enable::No("It's used on the timeline"),
475- RowItem::RemoveWithClips if ctx.placed == 0 => Enable::Hidden("nothing plays it"),882+ RowItem::RemoveWithClips if ctx.placed == 0 => Enable::No("no clip uses it"),
476 // Neither of these touches the timeline: a file can be found on disk and883 // Neither of these touches the timeline: a file can be found on disk and
477 // described whatever the editor is doing, with no timeline at all.884 // described whatever the editor is doing, with no timeline at all.
478 _ => Enable::Yes,885 _ => Enable::Yes,
@@ -506,10 +913,21 @@ pub(crate) fn menu_rows_h(rows: usize, viewport: Size<Pixels>) -> f32 {
506 /// frame reads as a list that was cut, not one that ended. Never past the top913 /// frame reads as a list that was cut, not one that ended. Never past the top
507 /// or left edge, so a window smaller than the menu loses the bottom of it914 /// or left edge, so a window smaller than the menu loses the bottom of it
508 /// rather than the top, where the items are.915 /// rather than the top, where the items are.
916+#[cfg(test)]
509 pub(crate) fn menu_at(at: Point<Pixels>, viewport: Size<Pixels>, height: f32) -> (f32, f32) {917 pub(crate) fn menu_at(at: Point<Pixels>, viewport: Size<Pixels>, height: f32) -> (f32, f32) {
918+ menu_at_w(at, viewport, MENU_W, height)
919+}
920+
921+/// [`menu_at`] for a plate that fits its content and so is `width` wide.
922+pub(crate) fn menu_at_w(
923+ at: Point<Pixels>,
924+ viewport: Size<Pixels>,
925+ width: f32,
926+ height: f32,
927+) -> (f32, f32) {
510 let fit = |v: f32, size: f32, room: f32| v.min(room - MENU_EDGE - size).max(MENU_EDGE);928 let fit = |v: f32, size: f32, room: f32| v.min(room - MENU_EDGE - size).max(MENU_EDGE);
511 (929 (
512- fit(f32::from(at.x), MENU_W, f32::from(viewport.width)),930+ fit(f32::from(at.x), width, f32::from(viewport.width)),
513 fit(f32::from(at.y), height, f32::from(viewport.height)),931 fit(f32::from(at.y), height, f32::from(viewport.height)),
514 )932 )
515 }933 }
crates/app/src/output_window.rsadded+163 -0
@@ -0,0 +1,163 @@
1+//! The video output window (View > Video output window): a window of its own
2+//! that shows the program picture and nothing else -- full-bleed on black,
3+//! letterboxed -- for a client monitor or a second screen, the way an NLE
4+//! feeds its full-screen video output.
5+//!
6+//! No second decode. The picture is the very frame the viewer holds in
7+//! [`Player::image`], which this window reads at each paint. The main window
8+//! repaints this one whenever it renders ([`Player::render`]), so the output
9+//! follows the playhead and a scrub. The window is session state only
10+//! ([`Player::output`]): it is not in the project file and is not reopened.
11+
12+use crate::*;
13+use gpui::Entity;
14+
15+/// The picture's surround: true black whatever the UI theme, since a client display is not chrome and should not go pale under a light theme.
16+const VIDEO_BLACK: u32 = 0x000000;
17+
18+/// The output window's root view: the picture, read from the player on each paint.
19+pub(crate) struct OutputView {
20+ player: Entity<Player>,
21+ focus: FocusHandle,
22+}
23+
24+impl OutputView {
25+ /// Closes the window and clears the player's record of it. Esc and a double-click both end here.
26+ fn close(&self, window: &mut Window, cx: &mut Context<Self>) {
27+ self.player.update(cx, |player, cx| {
28+ player.output = None;
29+ cx.notify();
30+ });
31+ window.remove_window();
32+ }
33+}
34+
35+impl Render for OutputView {
36+ fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
37+ let image = self.player.read(cx).image.clone();
38+ div()
39+ .id("video-output")
40+ .relative()
41+ .flex()
42+ .size_full()
43+ .bg(rgb(VIDEO_BLACK))
44+ .track_focus(&self.focus)
45+ .on_key_down(cx.listener(|this, event: &KeyDownEvent, window, cx| {
46+ if event.keystroke.key == "escape" {
47+ this.close(window, cx);
48+ }
49+ }))
50+ .on_click(cx.listener(|this, event: &ClickEvent, window, cx| {
51+ if event.click_count() == 2 {
52+ this.close(window, cx);
53+ }
54+ }))
55+ .when_some(image, |d, image| d.child(letterboxed_image(image)))
56+ }
57+}
58+
59+/// Opens the output window on `display` (the primary one when `None`), fullscreen there,
60+/// and hands the keyboard to it so Esc works at once. `None` when the window would not open.
61+pub(crate) fn open(player: Entity<Player>, display: Option<DisplayId>, cx: &mut App) -> Option<WindowHandle<OutputView>> {
62+ // Always a named display: an unnamed window lands wherever the system puts it, not on the
63+ // screen the menu ticked.
64+ let screen = display.and_then(|id| cx.find_display(id)).or_else(|| cx.displays().into_iter().next());
65+ let bounds = match &screen {
66+ Some(screen) => screen.bounds(),
67+ None => Bounds::centered(None, size(px(1280.), px(720.)), cx),
68+ };
69+ let display = screen.map(|screen| screen.id());
70+ let handle = cx
71+ .open_window(
72+ WindowOptions {
73+ window_bounds: Some(WindowBounds::Fullscreen(bounds)),
74+ display_id: display,
75+ titlebar: None,
76+ app_id: Some("edith".to_string()),
77+ ..Default::default()
78+ },
79+ move |window, cx| {
80+ let view = cx.new(|cx| OutputView { player, focus: cx.focus_handle() });
81+ let focus = view.read(cx).focus.clone();
82+ window.focus(&focus);
83+ view
84+ },
85+ )
86+ .ok()?;
87+ Some(handle)
88+}
89+
90+impl Player {
91+ /// The display the output window goes to: the one picked, else the first the system lists.
92+ pub(crate) fn output_target(&self) -> Option<DisplayId> {
93+ self.output_display.or(self.output_displays.first().map(|(id, _)| *id))
94+ }
95+
96+ /// Each frame, before the picture is painted: the display list the View menu reads, the
97+ /// output window's record (cleared if the window was closed by the system), and a repaint
98+ /// of that window, which shows the same picture as this one.
99+ pub(crate) fn sync_output(&mut self, cx: &mut Context<Self>) {
100+ // Numbered left to right, top to bottom: the system lists screens in no fixed order.
101+ let mut screens = cx.displays();
102+ screens.sort_by_key(|screen| {
103+ let origin = screen.bounds().origin;
104+ (f32::from(origin.x) as i64, f32::from(origin.y) as i64)
105+ });
106+ self.output_displays = screens
107+ .iter()
108+ .enumerate()
109+ .map(|(i, screen)| {
110+ let bounds = screen.bounds();
111+ let (w, h) = (f32::from(bounds.size.width), f32::from(bounds.size.height));
112+ (screen.id(), format!("Display {} ({} × {})", i + 1, w, h).into())
113+ })
114+ .collect();
115+ if let Some(open) = self.output {
116+ match open.update(cx, |_, _, cx| cx.notify()) {
117+ Ok(()) => {}
118+ Err(_) => self.output = None,
119+ }
120+ }
121+ }
122+
123+ /// View > Video output window: opens the window on the target display, or closes it.
124+ pub(crate) fn toggle_output_window(&mut self, cx: &mut Context<Self>) {
125+ if self.output.is_some() {
126+ self.close_output(cx);
127+ } else {
128+ self.open_output(cx);
129+ }
130+ }
131+
132+ /// View > Output display: the window moves to the display picked, if it is open now.
133+ pub(crate) fn set_output_display(&mut self, index: usize, cx: &mut Context<Self>) {
134+ let Some((id, _)) = self.output_displays.get(index).cloned() else {
135+ return;
136+ };
137+ self.output_display = Some(id);
138+ if self.output.is_some() {
139+ self.close_output(cx);
140+ self.open_output(cx);
141+ }
142+ }
143+
144+ /// Opens the window once the current update has finished: the window paints as it opens,
145+ /// and that paint reads this player, which the update is still holding.
146+ fn open_output(&mut self, cx: &mut Context<Self>) {
147+ let player = cx.entity();
148+ let display = self.output_display;
149+ cx.defer(move |cx| {
150+ let handle = output_window::open(player.clone(), display, cx);
151+ player.update(cx, |player, cx| {
152+ player.output = handle;
153+ cx.notify();
154+ });
155+ });
156+ }
157+
158+ fn close_output(&mut self, cx: &mut Context<Self>) {
159+ if let Some(open) = self.output.take() {
160+ let _ = open.update(cx, |_, window, _| window.remove_window());
161+ }
162+ }
163+}
crates/app/src/player/accent.rsadded+104 -0
@@ -0,0 +1,104 @@
1+//! The accent colour on the window's side: Vivid and the hue slider's drags, the Custom hex being
2+//! typed, and keeping what is in force ([`crate::ui::theme`] owns the colours themselves).
3+
4+use crate::*;
5+use crate::player::text_field::{FieldKey, TextField};
6+use crate::ui::theme;
7+
8+/// Which accent slider a hand is on.
9+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10+pub(crate) enum AccentSlider {
11+ Vivid,
12+ Hue,
13+}
14+
15+/// Vivid under a press at `along` (0..1 of the track).
16+pub(crate) fn vivid_at(along: f32) -> u8 {
17+ (along.clamp(0., 1.) * 100.).round() as u8
18+}
19+
20+/// The custom colour with its hue turned to `along` of the wheel. A grey has no hue to turn, so it
21+/// starts from a soft mid colour instead.
22+pub(crate) fn recoloured(rgb: u32, along: f32) -> u32 {
23+ let (l, c, _) = theme::to_oklch(rgb);
24+ let (l, c) = match c < 0.02 {
25+ true => (0.78, 0.09),
26+ false => (l, c),
27+ };
28+ theme::from_oklch(l, c, f64::from(along.clamp(0., 1.)) * 359.)
29+}
30+
31+impl Player {
32+ /// Writes the accent in force to the config file; a failure is said once.
33+ pub(crate) fn keep_accent(&mut self) {
34+ if let Err(e) = theme::save_accent() {
35+ let path = theme::accent_path();
36+ self.notify_user(format!("Accent colour could not be kept — {} — {e}", path.display()).into());
37+ }
38+ }
39+
40+ /// A press or drag sample on an accent slider, live; the file is written when the hand lets go.
41+ pub(crate) fn drag_accent(&mut self, slider: AccentSlider, x: Pixels, cx: &mut Context<Self>) {
42+ match slider {
43+ AccentSlider::Vivid => theme::set_vivid(vivid_at(frac_along(x, self.accent_vivid_bar.get()))),
44+ AccentSlider::Hue => {
45+ let now = theme::custom_colour().unwrap_or(theme::CUSTOM_DEFAULT);
46+ theme::set_custom(recoloured(now, frac_along(x, self.accent_hue_bar.get())));
47+ }
48+ }
49+ cx.notify();
50+ }
51+
52+ /// The hand let go of an accent slider.
53+ pub(crate) fn end_accent_drag(&mut self) {
54+ if self.accent_drag.take().is_some() {
55+ self.keep_accent();
56+ }
57+ }
58+
59+ /// A press on the hex field: it opens for typing with all of it selected.
60+ pub(crate) fn begin_accent_hex(&mut self, cx: &mut Context<Self>) {
61+ let now = theme::custom_colour().map_or(String::new(), |c| format!("#{c:06x}"));
62+ self.accent_hex = Some(TextField::selected(now));
63+ cx.notify();
64+ }
65+
66+ /// Leaves the hex field. The last good colour is already in force (every valid edit applies at
67+ /// once), so an invalid text is simply dropped.
68+ pub(crate) fn commit_accent_hex(&mut self, cx: &mut Context<Self>) {
69+ if self.accent_hex.take().is_some() {
70+ self.keep_accent();
71+ cx.notify();
72+ }
73+ }
74+
75+ /// The keyboard while the hex is being typed: enter keeps, escape leaves.
76+ pub(crate) fn accent_key(&mut self, key: &str, ctrl: bool, alt: bool, key_char: Option<&str>, cx: &mut Context<Self>) {
77+ let Some(field) = self.accent_hex.as_mut() else { return };
78+ let result = field.key(key, ctrl, alt, key_char, 7);
79+ field.text.retain(|c| c.is_ascii_alphanumeric() || c == '#');
80+ let typed = theme::parse_hex(&field.text);
81+ match result {
82+ FieldKey::Commit | FieldKey::Cancel => self.commit_accent_hex(cx),
83+ FieldKey::Edited => {
84+ if let Some(rgb) = typed {
85+ theme::set_custom(rgb);
86+ }
87+ }
88+ }
89+ cx.notify();
90+ }
91+}
92+
93+#[cfg(test)]
94+mod tests {
95+ use super::*;
96+
97+ #[test]
98+ fn vivid_follows_the_track_and_hue_keeps_its_colour_family() {
99+ assert_eq!((vivid_at(0.), vivid_at(0.5), vivid_at(1.), vivid_at(7.)), (0, 50, 100, 100));
100+ let turned = recoloured(0xff4d8d, 0.6);
101+ assert_ne!(turned, 0xff4d8d);
102+ assert_ne!(recoloured(0x808080, 0.3), 0x808080);
103+ }
104+}
crates/app/src/player/actions.rsmodified+807 -37
@@ -1,13 +1,92 @@
1 //! Every action arrives here: the one dispatch, the notice queue, and the1 //! Every action arrives here: the one dispatch, the notice queue, and the
2 //! delegations to the oracle that say whether an action can be asked for.2 //! delegations to the oracle that say whether an action can be asked for.
3 3
4+use super::editkeys::Part;
5+use super::timeline_edit::Switch;
4 use crate::*;6 use crate::*;
5 7
8+/// The name an action's step carries in Undo, Redo and the toast: its menu name without the
9+/// ellipsis a dialog-opening row wears. `None` for Undo and Redo, which take a step back
10+/// rather than make one, and for a name too long to read in a menu row.
11+pub(crate) fn step_name(action: ActionId) -> Option<&'static str> {
12+ let name = match action {
13+ ActionId::Undo | ActionId::Redo => return None,
14+ ActionId::ClipEnabled => "Clip enabled",
15+ ActionId::ClipLabel => "Clip label",
16+ _ => action.label().trim_end_matches('\u{2026}'),
17+ };
18+ (name.chars().count() < 30).then_some(name)
19+}
20+
21+/// What Undo or Redo says on a menu row and in a tooltip: the step it takes back or walks to
22+/// by name, plain "Undo" or "Redo" for a step nobody named, and "Nothing to undo" or
23+/// "Nothing to redo" when no step is left.
24+pub(crate) fn step_row_name(redo: bool, depth: usize, name: Option<&str>) -> String {
25+ let verb = if redo { "Redo" } else { "Undo" };
26+ match (depth, name) {
27+ (0, _) => format!("Nothing to {}", verb.to_lowercase()),
28+ (_, Some(name)) => format!("{verb} {name}"),
29+ (_, None) => verb.to_string(),
30+ }
31+}
32+
33+/// The toast after a step is taken back or walked forward: "Undid Split", "Redid Split", or
34+/// plain "Undone" and "Redone" for a step nobody named.
35+pub(crate) fn step_toast(redo: bool, name: Option<&str>) -> String {
36+ match (redo, name) {
37+ (false, Some(name)) => format!("Undid {name}"),
38+ (true, Some(name)) => format!("Redid {name}"),
39+ (false, None) => "Undone".to_string(),
40+ (true, None) => "Redone".to_string(),
41+ }
42+}
43+
6 impl Player {44 impl Player {
45+ /// What Undo and Redo are called on a menu row or a toolbar tooltip: the action's own
46+ /// name, except that they name the step they take back or walk forward to
47+ /// ([`step_row_name`]).
48+ pub(crate) fn action_name(&self, action: ActionId) -> String {
49+ let session = self.session.as_ref();
50+ match action {
51+ ActionId::Undo => {
52+ let depth = session.map_or(0, |s| s.undo_depth());
53+ step_row_name(false, depth, session.and_then(|s| s.undo_label()))
54+ }
55+ ActionId::Redo => {
56+ let depth = session.map_or(0, |s| s.redo_depth());
57+ step_row_name(true, depth, session.and_then(|s| s.redo_label()))
58+ }
59+ _ => action.label().to_string(),
60+ }
61+ }
62+
7 /// What an action does, wherever it was asked for -- a stroke, or the clip63 /// What an action does, wherever it was asked for -- a stroke, or the clip
8 /// menu item that names the same action. One table, so the two can never64 /// menu item that names the same action. One table, so the two can never
9- /// come to mean different things.65+ /// come to mean different things. The step an edit pushes is named after it
66+ /// ([`step_name`]), so Undo and Redo can say what they take back.
10 pub(crate) fn act(&mut self, action: ActionId, window: &mut Window, cx: &mut Context<Self>) {67 pub(crate) fn act(&mut self, action: ActionId, window: &mut Window, cx: &mut Context<Self>) {
68+ let mark = self.session.as_mut().map(PlaybackSession::step_mark);
69+ self.run_action(action, window, cx);
70+ if let (Some(mark), Some(name)) = (mark, step_name(action))
71+ && let Some(session) = self.session.as_mut()
72+ {
73+ session.name_step(mark, name);
74+ }
75+ }
76+
77+ /// Runs one write -- a card's, a gesture's -- and names the step it pushed, if it pushed
78+ /// one: a live sample pushes none, so only the committing write names anything.
79+ pub(crate) fn named_step<T>(&mut self, name: &str, write: impl FnOnce(&mut Self) -> T) -> T {
80+ let mark = self.session.as_mut().map(PlaybackSession::step_mark);
81+ let out = write(self);
82+ if let (Some(mark), Some(session)) = (mark, self.session.as_mut()) {
83+ session.name_step(mark, name);
84+ }
85+ out
86+ }
87+
88+ /// The dispatch itself, behind [`Player::act`], which names the step it leaves.
89+ fn run_action(&mut self, action: ActionId, window: &mut Window, cx: &mut Context<Self>) {
11 // Two doors, one oracle. This used to be the asymmetry the whole90 // Two doors, one oracle. This used to be the asymmetry the whole
12 // toolbar was built on: the buttons dimmed themselves off91 // toolbar was built on: the buttons dimmed themselves off
13 // [`enable`] while the keyboard walked straight past it, so with no92 // [`enable`] while the keyboard walked straight past it, so with no
@@ -20,7 +99,7 @@ impl Player {
20 // A state refusal is spoken: the thing exists and cannot happen99 // A state refusal is spoken: the thing exists and cannot happen
21 // *now*, which is exactly what a silent key press fails to say.100 // *now*, which is exactly what a silent key press fails to say.
22 Enable::No(why) => {101 Enable::No(why) => {
23- self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into());102+ self.notify_user(format!("{} — {why}", action.label()).into());
24 cx.notify();103 cx.notify();
25 return;104 return;
26 }105 }
@@ -57,6 +136,19 @@ impl Player {
57 | ActionId::Cut136 | ActionId::Cut
58 | ActionId::Regroup137 | ActionId::Regroup
59 | ActionId::Detach138 | ActionId::Detach
139+ | ActionId::Reverse
140+ | ActionId::NewSolid
141+ | ActionId::NewGradient
142+ | ActionId::NewCountdown
143+ | ActionId::NewBars
144+ | ActionId::NewTone
145+ | ActionId::NewBarsAndTone
146+ | ActionId::NewAdjustment
147+ | ActionId::NewRectangle
148+ | ActionId::NewEllipse
149+ | ActionId::NewLine
150+ | ActionId::NewArrow
151+ | ActionId::NewTitle
60 | ActionId::Group152 | ActionId::Group
61 | ActionId::Delete153 | ActionId::Delete
62 | ActionId::Lift154 | ActionId::Lift
@@ -84,6 +176,11 @@ impl Player {
84 // twice over, which is the lesser fault beside arming once for176 // twice over, which is the lesser fault beside arming once for
85 // a removal that did not happen.177 // a removal that did not happen.
86 | ActionId::Visualizer178 | ActionId::Visualizer
179+ | ActionId::NestClips
180+ | ActionId::BreakApart
181+ | ActionId::NewSequence
182+ | ActionId::DuplicateSequence
183+ | ActionId::DeleteSequence
87 ) {184 ) {
88 self.mark_dirty();185 self.mark_dirty();
89 }186 }
@@ -95,6 +192,43 @@ impl Player {
95 self.loop_on = !self.loop_on;192 self.loop_on = !self.loop_on;
96 cx.notify();193 cx.notify();
97 }194 }
195+ ActionId::PlayAround => self.play_around(cx),
196+ // The clips' waveforms: kept with the project's view, so it reopens as it was left.
197+ ActionId::ToggleWaveforms => {
198+ self.waveforms = !self.waveforms;
199+ self.save_view_state();
200+ cx.notify();
201+ }
202+ // Sound while a ruler scrub is paused: kept with the view, like the waveforms.
203+ ActionId::ToggleScrubAudio => {
204+ self.scrub_audio = !self.scrub_audio;
205+ self.save_view_state();
206+ cx.notify();
207+ }
208+ // The shuttle (DESIGN §10.2): L plays forward and J backward, each press
209+ // while it runs stepping the rate 1x, 2x, 4x; K stops.
210+ ActionId::ShuttleBack => self.shuttle(false, cx),
211+ ActionId::ShuttleStop => {
212+ if let Some(session) = self.active_session_mut().filter(|s| s.is_playing()) {
213+ session.pause();
214+ session.set_rate(1.0);
215+ }
216+ cx.notify();
217+ }
218+ ActionId::ShuttleForward => self.shuttle(true, cx),
219+ // The shortcuts sheet: the same toggle the `?` stroke makes.
220+ ActionId::ShowKeys => {
221+ if self.keys_open {
222+ self.keys_open = false;
223+ cx.notify();
224+ } else {
225+ self.show_keys(cx);
226+ }
227+ }
228+ ActionId::About => {
229+ self.about_open = !self.about_open;
230+ cx.notify();
231+ }
98 ActionId::StepBack => self.step(-1, cx),232 ActionId::StepBack => self.step(-1, cx),
99 ActionId::StepForward => self.step(1, cx),233 ActionId::StepForward => self.step(1, cx),
100 // A second is however many frames this timeline runs at.234 // A second is however many frames this timeline runs at.
@@ -103,27 +237,71 @@ impl Player {
103 // The ends, as a step nothing can be far enough from.237 // The ends, as a step nothing can be far enough from.
104 ActionId::GoStart => self.step(i64::MIN, cx),238 ActionId::GoStart => self.step(i64::MIN, cx),
105 ActionId::GoEnd => self.step(i64::MAX, cx),239 ActionId::GoEnd => self.step(i64::MAX, cx),
240+ ActionId::GoToTime => self.open_time_entry(cx),
106 // Not a step at all: the grid these land on is the *source's*, and241 // Not a step at all: the grid these land on is the *source's*, and
107 // where the next one is depends on the file rather than on the rate.242 // where the next one is depends on the file rather than on the rate.
108 ActionId::PrevSyncPoint => self.jump_sync(false, cx),243 ActionId::PrevSyncPoint => self.jump_sync(false, cx),
109 ActionId::NextSyncPoint => self.jump_sync(true, cx),244 ActionId::NextSyncPoint => self.jump_sync(true, cx),
245+ // While a library item is previewed the marks are the item's own
246+ // (the source monitor's in/out); otherwise the timeline's range.
247+ ActionId::SetIn if self.preview_session.is_some() => self.mark_source(true, cx),
248+ ActionId::SetOut if self.preview_session.is_some() => self.mark_source(false, cx),
249+ ActionId::ClearRange if self.preview_session.is_some() => self.clear_source_marks(cx),
110 ActionId::SetIn => self.set_in(cx),250 ActionId::SetIn => self.set_in(cx),
111 ActionId::SetOut => self.set_out(cx),251 ActionId::SetOut => self.set_out(cx),
112 ActionId::ClearRange => {252 ActionId::ClearRange => {
113 self.range = None;253 self.range = None;
114 cx.notify();254 cx.notify();
115 }255 }
256+ ActionId::RenderInOut => self.render_preview(false, cx),
257+ ActionId::RenderAll => self.render_preview(true, cx),
258+ ActionId::CancelRender => self.cancel_render(),
259+ ActionId::DeleteRenderFiles => self.delete_render_files(cx),
260+ ActionId::InsertSource => self.source_edit(engine::SourceEdit::Insert, cx),
261+ ActionId::OverwriteSource => self.source_edit(engine::SourceEdit::Overwrite, cx),
116 ActionId::Export => self.open_export(cx),262 ActionId::Export => self.open_export(cx),
117 // Asked before the first overwrite of a file this window never263 // Asked before the first overwrite of a file this window never
118 // put there ([`Player::save_guarded`]); the window's own file264 // put there ([`Player::save_guarded`]); the window's own file
119 // saves straight through.265 // saves straight through.
120 ActionId::Save => self.save_guarded(cx),266 ActionId::Save => self.save_guarded(cx),
267+ ActionId::ReloadProject => self.reload_request(cx),
268+ ActionId::NewProject => self.open_new_project(cx),
269+ ActionId::SaveVersion => self.open_save_version(cx),
270+ ActionId::SaveTemplate => self.open_save_template(cx),
271+ ActionId::ExportCaptions => self.open_export_captions(cx),
272+ ActionId::Versions => self.open_versions(cx),
273+ ActionId::CollectMedia => self.open_collect(cx),
274+ ActionId::ProjectNotes => self.open_project_notes(cx),
275+ ActionId::ExportTimelineOtio => self.export_timeline("otio", cx),
276+ ActionId::ExportTimelineFcpxml => self.export_timeline("fcpxml", cx),
277+ ActionId::ExportTimelineEdl => self.export_timeline("edl", cx),
278+ ActionId::ImportTimelineOtio => self.pick_and_import(cx),
121 ActionId::Copy => self.copy_selected(),279 ActionId::Copy => self.copy_selected(),
122 ActionId::Paste => self.paste(cx),280 ActionId::Paste => self.paste(cx),
123 ActionId::Cut => self.cut(cx),281 ActionId::Cut => self.cut(cx),
124 ActionId::Regroup => self.regroup(cx),282 ActionId::Regroup => self.regroup(cx),
125 ActionId::Crossfade => self.crossfade_selected(cx),283 ActionId::Crossfade => self.crossfade_selected(cx),
126 ActionId::Dissolve => self.dissolve_selected(cx),284 ActionId::Dissolve => self.dissolve_selected(cx),
285+ ActionId::TransitionDissolve
286+ | ActionId::TransitionDipBlack
287+ | ActionId::TransitionDipWhite
288+ | ActionId::TransitionWipeLeft
289+ | ActionId::TransitionWipeRight
290+ | ActionId::TransitionWipeUp
291+ | ActionId::TransitionWipeDown
292+ | ActionId::TransitionSlideLeft
293+ | ActionId::TransitionSlideRight
294+ | ActionId::TransitionSlideUp
295+ | ActionId::TransitionSlideDown
296+ | ActionId::TransitionPushLeft
297+ | ActionId::TransitionPushRight
298+ | ActionId::TransitionPushUp
299+ | ActionId::TransitionPushDown
300+ | ActionId::TransitionZoom => {
301+ if let Some(kind) = action.transition_kind() {
302+ self.set_transition_kind(kind, cx);
303+ }
304+ }
127 ActionId::Detach => self.detach(cx),305 ActionId::Detach => self.detach(cx),
128 ActionId::Group => self.group(cx),306 ActionId::Group => self.group(cx),
129 ActionId::Select => self.select_under_playhead(cx),307 ActionId::Select => self.select_under_playhead(cx),
@@ -131,33 +309,89 @@ impl Player {
131 ActionId::SelectPrev => self.select_step(false, cx),309 ActionId::SelectPrev => self.select_step(false, cx),
132 ActionId::SelectAll => self.select_all(cx),310 ActionId::SelectAll => self.select_all(cx),
133 // Last in escape's precedence chain (render.rs): nothing else311 // Last in escape's precedence chain (render.rs): nothing else
134- // claimed the key, so it just empties the selection.312+ // claimed the key, so it empties every selection the timeline
135- ActionId::Deselect => {313+ // holds -- clips, a picked gap, a title and a caption -- and the
136- self.selected = Selection::new();314+ // Clip tab goes back to what it shows with nothing picked.
137- cx.notify();315+ ActionId::Deselect => self.clear_picks(cx),
316+ // A picked gap is what Delete closes (DESIGN §7); a clip mark or
317+ // nothing at all falls through to the clip path as before.
318+ ActionId::Delete if self.gap_pick().is_some() => self.close_selected_gap(cx),
319+ // A picked envelope key is what Delete takes out before a clip is.
320+ ActionId::Delete if self.gain_pick.is_some() => {
321+ self.gain_delete_pick(cx);
138 }322 }
139 ActionId::Delete => self.delete_selected(cx),323 ActionId::Delete => self.delete_selected(cx),
140 ActionId::Lift => self.lift_selected(cx),324 ActionId::Lift => self.lift_selected(cx),
325+ ActionId::CloseGap => self.close_gap_here(cx),
326+ ActionId::Freeze => self.freeze_frame(cx),
327+ ActionId::PasteAttributes => self.paste_attributes(
328+ &[Part::Color, Part::Effects, Part::Transform, Part::Speed, Part::Audio],
329+ cx,
330+ ),
331+ ActionId::PasteColor => self.paste_attributes(&[Part::Color], cx),
332+ ActionId::PasteEffects => self.paste_attributes(&[Part::Effects], cx),
333+ ActionId::PasteTransform => self.paste_attributes(&[Part::Transform], cx),
334+ ActionId::PasteSpeed => self.paste_attributes(&[Part::Speed], cx),
335+ ActionId::PasteAudio => self.paste_attributes(&[Part::Audio], cx),
336+ ActionId::MatchFrame => self.match_frame(cx),
337+ ActionId::ReplaceEdit => self.replace_edit(cx),
338+ ActionId::SelectForward => self.select_forward(false, cx),
339+ ActionId::SelectForwardAll => self.select_forward(true, cx),
340+ ActionId::ExtendAudio => self.split_edit(true, cx),
341+ ActionId::CutSelectedWords => self.delete_selected_words(cx),
342+ ActionId::ExtendVideo => self.split_edit(false, cx),
343+ ActionId::NudgeBack => self.nudge_selected(-1, cx),
344+ ActionId::NudgeForward => self.nudge_selected(1, cx),
345+ ActionId::NudgeBack10 => self.nudge_selected(-10, cx),
346+ ActionId::NudgeForward10 => self.nudge_selected(10, cx),
141 ActionId::Color => self.open_color(cx),347 ActionId::Color => self.open_color(cx),
348+ ActionId::AutoColour => self.auto_colour(cx),
349+ ActionId::SaveLook => {
350+ if self.color_open.is_none() {
351+ self.open_color(cx);
352+ }
353+ self.begin_look_save(cx);
354+ }
355+ ActionId::CompareOff => self.set_compare(crate::viewer_view::Compare::Off, cx),
356+ ActionId::CompareSplit => self.set_compare(crate::viewer_view::Compare::Split, cx),
357+ ActionId::CompareSide => self.set_compare(crate::viewer_view::Compare::Side, cx),
142 ActionId::Transform => self.open_transform(cx),358 ActionId::Transform => self.open_transform(cx),
143- ActionId::Fit => self.cycle_fit(cx),359+ ActionId::Effects => self.open_effects(cx),
144- ActionId::Resolution => self.cycle_resolution(cx),360+ ActionId::KeyPlacement => self.toggle_key_here(engine::project::KeyKind::Placement, cx),
361+ ActionId::KeyOpacity => self.toggle_key_here(engine::project::KeyKind::Opacity, cx),
362+ ActionId::KeyColor => self.toggle_key_here(engine::project::KeyKind::Color, cx),
363+ ActionId::KeyEasing => self.open_key_easing(self.ledger_anchor(LedgerItem::Clip), cx),
364+ ActionId::Fit => self.open_fit_list(self.ledger_anchor(LedgerItem::Clip), cx),
365+ ActionId::Resolution => self.open_picker(Pick::Resolution, self.ledger_anchor(LedgerItem::Size), cx),
145 // The playhead is what a key zoom is aimed at: it is the one place366 // The playhead is what a key zoom is aimed at: it is the one place
146 // on the timeline the user is certainly looking at, and keeping it367 // on the timeline the user is certainly looking at, and keeping it
147 // still is what every editor does.368 // still is what every editor does.
148 ActionId::ZoomIn => self.zoom(ZOOM_STEP, None, cx),369 ActionId::ZoomIn => self.zoom(ZOOM_STEP, None, cx),
149 ActionId::ZoomOut => self.zoom(1. / ZOOM_STEP, None, cx),370 ActionId::ZoomOut => self.zoom(1. / ZOOM_STEP, None, cx),
150 ActionId::ZoomFit => self.zoom_fit(cx),371 ActionId::ZoomFit => self.zoom_fit(cx),
372+ ActionId::ZoomToSelection => self.zoom_to_selection(cx),
373+ ActionId::TrackSmall => self.set_all_track_sizes(crate::ui::bench_stance::TrackSize::Small, cx),
374+ ActionId::TrackMedium => self.set_all_track_sizes(crate::ui::bench_stance::TrackSize::Medium, cx),
375+ ActionId::TrackLarge => self.set_all_track_sizes(crate::ui::bench_stance::TrackSize::Large, cx),
376+ ActionId::TracksSmaller => self.step_track_sizes(false, cx),
377+ ActionId::TracksLarger => self.step_track_sizes(true, cx),
151 ActionId::Undo => {378 ActionId::Undo => {
379+ let name = self.session.as_ref().and_then(|s| s.undo_label().map(str::to_string));
152 if self.undo(cx) {380 if self.undo(cx) {
153 self.mark_dirty();381 self.mark_dirty();
382+ self.settle_saved_point();
383+ self.notify_user(step_toast(false, name.as_deref()).into());
154 }384 }
155 }385 }
156 ActionId::Redo => {386 ActionId::Redo => {
387+ let name = self.session.as_ref().and_then(|s| s.redo_label().map(str::to_string));
157 if self.redo(cx) {388 if self.redo(cx) {
158 self.mark_dirty();389 self.mark_dirty();
390+ self.settle_saved_point();
391+ self.notify_user(step_toast(true, name.as_deref()).into());
159 }392 }
160 }393 }
394+ ActionId::History => self.open_history(cx),
161 ActionId::AddVideoLane => self.add_lane(LaneKind::Video, cx),395 ActionId::AddVideoLane => self.add_lane(LaneKind::Video, cx),
162 ActionId::AddAudioLane => self.add_lane(LaneKind::Audio, cx),396 ActionId::AddAudioLane => self.add_lane(LaneKind::Audio, cx),
163 // The last track of that kind: the one the add key put there, so the397 // The last track of that kind: the one the add key put there, so the
@@ -174,15 +408,96 @@ impl Player {
174 // the list, the file itself joining nothing.408 // the list, the file itself joining nothing.
175 ActionId::ImportSubtitles => self.pick_and_add_subtitles(cx),409 ActionId::ImportSubtitles => self.pick_and_add_subtitles(cx),
176 ActionId::AddFiles => self.pick_and_import(cx),410 ActionId::AddFiles => self.pick_and_import(cx),
411+ ActionId::OpenProject => self.pick_open_project(cx),
177 ActionId::PasteFilePath => self.paste_file_path(cx),412 ActionId::PasteFilePath => self.paste_file_path(cx),
178 ActionId::ToggleMute => self.set_volume(|volume| volume.muted = !volume.muted, cx),413 ActionId::ToggleMute => self.set_volume(|volume| volume.muted = !volume.muted, cx),
179 ActionId::VolumeUp => self.set_volume(|volume| volume.step(true), cx),414 ActionId::VolumeUp => self.set_volume(|volume| volume.step(true), cx),
180 ActionId::VolumeDown => self.set_volume(|volume| volume.step(false), cx),415 ActionId::VolumeDown => self.set_volume(|volume| volume.step(false), cx),
181 ActionId::Equalizer => self.open_eq(cx),416 ActionId::Equalizer => self.open_eq(cx),
182 ActionId::Speed => self.open_speed(cx),417 ActionId::Speed => self.open_speed(cx),
418+ ActionId::Reverse => self.toggle_reverse(cx),
419+ ActionId::ClipEnabled => self.toggle_clip_enabled(cx),
420+ ActionId::ClipLabel => self.open_label_list(cx),
421+ ActionId::NewSolid
422+ | ActionId::NewGradient
423+ | ActionId::NewCountdown
424+ | ActionId::NewBars
425+ | ActionId::NewAdjustment
426+ | ActionId::NewRectangle
427+ | ActionId::NewEllipse
428+ | ActionId::NewLine
429+ | ActionId::NewArrow => self.new_generator(action, cx),
430+ ActionId::NewTone | ActionId::NewBarsAndTone => self.new_tone(action, cx),
431+ ActionId::NewTitle => self.new_title(cx),
432+ ActionId::NewBin => self.new_bin(0, Vec::new(), cx),
433+ ActionId::NewBinInside => self.new_bin_inside_selected(cx),
434+ ActionId::RenameBin => self.rename_selected_bin(cx),
435+ ActionId::RemoveBin => self.remove_selected_bin(cx),
436+ ActionId::ToggleFavourite => self.toggle_favourite_picked(cx),
437+ ActionId::MoveToBin => self.bin_picker_here(cx),
438+ ActionId::ShowFavourites => self.show_favourites(true, cx),
439+ ActionId::ShowAllMedia => self.show_favourites(false, cx),
440+ ActionId::SpeedRampUp => self.set_ramp_preset(RampPreset::Up, cx),
441+ ActionId::SpeedRampDown => self.set_ramp_preset(RampPreset::Down, cx),
442+ ActionId::SpeedRampSlowFastSlow => self.set_ramp_preset(RampPreset::SlowFastSlow, cx),
443+ ActionId::SpeedRampFastSlowFast => self.set_ramp_preset(RampPreset::FastSlowFast, cx),
444+ ActionId::SpeedRampKey => self.add_ramp_key(cx),
445+ ActionId::SpeedRampClear => self.clear_ramp(cx),
183 ActionId::Silence => self.open_silence(cx),446 ActionId::Silence => self.open_silence(cx),
447+ ActionId::Normalize => self.open_tools(crate::player::tools::Tool::Normalize, cx),
448+ // Starts the listening straight away; the Tools card opens under it so the
449+ // progress (and any plain reason it cannot start) is on screen.
450+ ActionId::Captions => {
451+ self.open_tools(crate::player::tools::Tool::Captions, cx);
452+ self.start_listening(false, cx);
453+ }
454+ ActionId::Fillers => self.open_tools(crate::player::tools::Tool::Fillers, cx),
455+ ActionId::Voiceover => self.open_tools(crate::player::tools::Tool::Voiceover, cx),
456+ ActionId::RecordVoiceover => self.open_record_voiceover(cx),
184 ActionId::Visualizer => self.create_visualizer(cx),457 ActionId::Visualizer => self.create_visualizer(cx),
458+ ActionId::MarkBeats => self.open_beats(cx),
459+ ActionId::Reframe => self.reframe_selected(cx),
460+ ActionId::TrackMask => self.track_selected_mask(cx),
461+ ActionId::NestClips => self.nest_selected(cx),
462+ ActionId::CreateMulticam => self.create_multicam_selected(cx),
463+ ActionId::FlattenMulticam => self.flatten_multicam_selected(cx),
464+ ActionId::ToggleAngleMonitor => self.toggle_angle_monitor(cx),
465+ ActionId::Angle1 => self.switch_angle_here(1, cx),
466+ ActionId::Angle2 => self.switch_angle_here(2, cx),
467+ ActionId::Angle3 => self.switch_angle_here(3, cx),
468+ ActionId::Angle4 => self.switch_angle_here(4, cx),
469+ ActionId::Angle5 => self.switch_angle_here(5, cx),
470+ ActionId::Angle6 => self.switch_angle_here(6, cx),
471+ ActionId::Angle7 => self.switch_angle_here(7, cx),
472+ ActionId::Angle8 => self.switch_angle_here(8, cx),
473+ ActionId::Angle9 => self.switch_angle_here(9, cx),
474+ ActionId::BreakApart => self.break_apart_selected(cx),
475+ ActionId::OpenCompound => self.open_compound_selected(cx),
476+ ActionId::CloseCompound => self.close_compound(cx),
477+ ActionId::NewSequence => self.new_sequence(cx),
478+ ActionId::DuplicateSequence => self.duplicate_sequence(cx),
479+ ActionId::RenameSequence => self.begin_seq_edit(cx),
480+ ActionId::DeleteSequence => self.delete_sequence(cx),
481+ ActionId::RenameLane => {
482+ // From the palette there is no head to name: the selected clip's track, else V1.
483+ let lane = self.selected.anchor().map_or(Lane::V1, |(lane, _)| lane);
484+ self.begin_lane_edit(lane, cx)
485+ }
185 ActionId::Mix => self.open_mix(None, cx),486 ActionId::Mix => self.open_mix(None, cx),
487+ ActionId::CleanVoice => match self.voice_target_lane() {
488+ Some(lane) => self.clean_mix_voice(lane, engine::voice::Strength::Medium, cx),
489+ None => {
490+ self.notify_user("Nothing to clean — no audio track has sound".into());
491+ cx.notify();
492+ }
493+ },
494+ ActionId::VoiceDynamics => {
495+ let lane = self.voice_target_lane();
496+ self.open_mix(lane, cx);
497+ if let Some(lane) = lane.filter(|&l| !self.mix_voice_open(l)) {
498+ self.toggle_voice_section(lane, cx);
499+ }
500+ }
186 ActionId::SubtitleStyle => self.open_subtitle_style(cx),501 ActionId::SubtitleStyle => self.open_subtitle_style(cx),
187 ActionId::ToggleSnap => self.toggle_snap(cx),502 ActionId::ToggleSnap => self.toggle_snap(cx),
188 ActionId::ToggleSubtitles => self.toggle_subtitles(cx),503 ActionId::ToggleSubtitles => self.toggle_subtitles(cx),
@@ -192,6 +507,25 @@ impl Player {
192 // At the window's corner, since a stroke names no place -- and507 // At the window's corner, since a stroke names no place -- and
193 // [`menu_at`] keeps it on screen from there.508 // [`menu_at`] keeps it on screen from there.
194 ActionId::Theme => self.open_picker(Pick::Theme, Point::default(), cx),509 ActionId::Theme => self.open_picker(Pick::Theme, Point::default(), cx),
510+ ActionId::AccentColour => self.open_picker(Pick::Accent, Point::default(), cx),
511+ ActionId::ToggleOutputWindow => self.toggle_output_window(cx),
512+ ActionId::OutputDisplay => self.open_picker(Pick::OutputDisplay, Point::default(), cx),
513+ ActionId::ViewZoom => {
514+ let at = self.viewer_anchor(0);
515+ self.picker_under(Pick::ViewZoom, at, cx)
516+ },
517+ ActionId::PlaybackQuality => {
518+ let at = self.viewer_anchor(1);
519+ self.picker_under(Pick::ViewQuality, at, cx)
520+ },
521+ ActionId::GuideMask => {
522+ let at = self.viewer_anchor(3);
523+ self.picker_under(Pick::ViewMask, at, cx)
524+ },
525+ ActionId::GuideStyle => {
526+ let at = self.viewer_anchor(2);
527+ self.picker_under(Pick::ViewGuides, at, cx)
528+ }
195 // Not the window's own toggle alone -- every consumer video529 // Not the window's own toggle alone -- every consumer video
196 // player fullscreens the *picture*, chrome and all, not just the530 // player fullscreens the *picture*, chrome and all, not just the
197 // OS frame around it -- so this flips both: `player_fullscreen`531 // OS frame around it -- so this flips both: `player_fullscreen`
@@ -213,8 +547,21 @@ impl Player {
213 // `cycle_on_key_down`) are unreachable dead code -- the ring never547 // `cycle_on_key_down`) are unreachable dead code -- the ring never
214 // starts. Lands on the cycle's first stop (`stance::SURFACE_CYCLE`548 // starts. Lands on the cycle's first stop (`stance::SURFACE_CYCLE`
215 // -- the dock); a second Tab from there walks it same as ever.549 // -- the dock); a second Tab from there walks it same as ever.
550+ // F6 walks the same cycle Tab does, one panel per press, from wherever the focus is
551+ // now (the media panel when it is on none of them), and names where it landed.
216 ActionId::FocusPanels => {552 ActionId::FocusPanels => {
217- self.focus_surface(crate::ui::stance::Surface::Dock, window, cx);553+ use crate::ui::stance::{Surface, next_surface};
554+ let now = [Surface::Dock, Surface::Bench, Surface::Inspector]
555+ .into_iter()
556+ .find(|s| self.focus_handle(*s).is_focused(window));
557+ let to = now.map_or(Surface::Dock, |s| next_surface(s, false));
558+ self.focus_surface(to, window, cx);
559+ let name = match to {
560+ Surface::Bench => "the timeline",
561+ Surface::Dock if self.dock_src_active => "Media",
562+ Surface::Dock | Surface::Inspector => "the side panel",
563+ };
564+ self.notify_user(format!("Focus moved to {name}").into());
218 }565 }
219 // `^esc` (or whatever the keymap now binds it to) reaches here566 // `^esc` (or whatever the keymap now binds it to) reaches here
220 // through the plain `act()` dispatch even while an export is567 // through the plain `act()` dispatch even while an export is
@@ -230,6 +577,14 @@ impl Player {
230 // clip ([`Selection::anchor`]) -- the oracle already refused577 // clip ([`Selection::anchor`]) -- the oracle already refused
231 // every one of these with nothing marked, so an anchor is here578 // every one of these with nothing marked, so an anchor is here
232 // to read.579 // to read.
580+ ActionId::AddMarker => self.add_marker_here(cx),
581+ ActionId::MarkerHere => self.add_marker_at_menu(cx),
582+ ActionId::RenameMarker => self.rename_marker_at_pick(cx),
583+ ActionId::DeleteMarker => self.delete_marker_at_pick(cx),
584+ ActionId::PlayheadHere => self.playhead_at_menu(cx),
585+ ActionId::NextMarker => self.jump_marker(true, cx),
586+ ActionId::PrevMarker => self.jump_marker(false, cx),
587+ ActionId::Markers => self.open_markers(cx),
233 ActionId::WalkCutNext => self.walk_cut(true, cx),588 ActionId::WalkCutNext => self.walk_cut(true, cx),
234 ActionId::WalkCutPrev => self.walk_cut(false, cx),589 ActionId::WalkCutPrev => self.walk_cut(false, cx),
235 ActionId::WalkCutNext10 => self.walk_cut_stride(true, 10, cx),590 ActionId::WalkCutNext10 => self.walk_cut_stride(true, 10, cx),
@@ -245,8 +600,18 @@ impl Player {
245 // Trim-to-playhead (debt #42): the same `Edge::Start`/`Edge::End`600 // Trim-to-playhead (debt #42): the same `Edge::Start`/`Edge::End`
246 // split as the nudge pair above, at the playhead's frame instead601 // split as the nudge pair above, at the playhead's frame instead
247 // of a one-frame detent.602 // of a one-frame detent.
248- ActionId::TrimInToPlayhead => self.trim_cut_to_playhead(Edge::Start, cx),603+ ActionId::TrimInToPlayhead => self.trim_cut_to_playhead(Edge::Start, false, cx),
249- ActionId::TrimOutToPlayhead => self.trim_cut_to_playhead(Edge::End, cx),604+ ActionId::TrimOutToPlayhead => self.trim_cut_to_playhead(Edge::End, false, cx),
605+ ActionId::RippleTrimInToPlayhead => self.trim_cut_to_playhead(Edge::Start, true, cx),
606+ ActionId::RippleTrimOutToPlayhead => self.trim_cut_to_playhead(Edge::End, true, cx),
607+ // Roll, slip and slide at frame detents, the keyboard's version of
608+ // the shift-drags ([`Player::pro_nudge`]).
609+ ActionId::RollBack => self.pro_nudge(ProKind::Roll, -1, cx),
610+ ActionId::RollForward => self.pro_nudge(ProKind::Roll, 1, cx),
611+ ActionId::SlipBack => self.pro_nudge(ProKind::Slip, -1, cx),
612+ ActionId::SlipForward => self.pro_nudge(ProKind::Slip, 1, cx),
613+ ActionId::SlideBack => self.pro_nudge(ProKind::Slide, -1, cx),
614+ ActionId::SlideForward => self.pro_nudge(ProKind::Slide, 1, cx),
250 }615 }
251 }616 }
252 617
@@ -257,7 +622,7 @@ impl Player {
257 match enable_lane(action, lane, self.ctx(None)) {622 match enable_lane(action, lane, self.ctx(None)) {
258 Enable::Yes => {}623 Enable::Yes => {}
259 Enable::No(why) => {624 Enable::No(why) => {
260- self.notify_user(format!("{} — {why}", action.label().to_uppercase()).into());625+ self.notify_user(format!("{} — {why}", action.label()).into());
261 cx.notify();626 cx.notify();
262 return;627 return;
263 }628 }
@@ -265,6 +630,7 @@ impl Player {
265 }630 }
266 match action {631 match action {
267 ActionId::Mix => self.open_mix(Some(lane), cx),632 ActionId::Mix => self.open_mix(Some(lane), cx),
633+ ActionId::RenameLane => self.begin_lane_edit(lane, cx),
268 // The arm rides the door's own answer, like every arm in this634 // The arm rides the door's own answer, like every arm in this
269 // window: `remove_lane` refuses a track that still holds clips or635 // window: `remove_lane` refuses a track that still holds clips or
270 // captions, and the last track of its kind, and arming before the636 // captions, and the last track of its kind, and arming before the
@@ -283,7 +649,105 @@ impl Player {
283 /// refuses would otherwise fill the queue with one sentence, and the count649 /// refuses would otherwise fill the queue with one sentence, and the count
284 /// on the bar would be a count of how long the key was held.650 /// on the bar would be a count of how long the key was held.
285 pub(crate) fn notify_user(&mut self, message: SharedString) {651 pub(crate) fn notify_user(&mut self, message: SharedString) {
286- push_notice(&mut self.notices, message);652+ if !message.starts_with(EXPORT_DONE) {
653+ push_notice(&mut self.notices, message);
654+ return;
655+ }
656+ // An export's outcome carries the way to its file: the toast's buttons
657+ // play it or reveal it (DESIGN §8). Every other message has no button.
658+ let path = self.export_path.clone();
659+ self.notify_user_actions(
660+ message,
661+ vec![
662+ ToastAction::Play(path.clone()),
663+ ToastAction::ShowInFolder(path),
664+ ],
665+ );
666+ }
667+
668+ /// [`Player::notify_user`] for a message whose toast has a button: the one
669+ /// door that takes an action, and otherwise the same queue and the same
670+ /// policy.
671+ pub(crate) fn notify_user_action(&mut self, message: SharedString, action: ToastAction) {
672+ self.notify_user_actions(message, vec![action]);
673+ }
674+
675+ /// [`Player::notify_user_action`] for a toast with up to two buttons, drawn
676+ /// in the order given.
677+ pub(crate) fn notify_user_actions(&mut self, message: SharedString, actions: Vec<ToastAction>) {
678+ let tone = Tone::of(&message);
679+ push_toast(&mut self.notices, message, tone, actions);
680+ }
681+
682+ /// A toast's button was pressed: the toast goes, and the action at `index`
683+ /// runs. Any other button on it goes with the toast.
684+ pub(crate) fn toast_action(&mut self, id: u64, index: usize, cx: &mut Context<Self>) {
685+ let Some(action) = self
686+ .notices
687+ .iter()
688+ .find(|toast| toast.id == id)
689+ .and_then(|toast| toast.actions.get(index).cloned())
690+ else {
691+ return;
692+ };
693+ remove_toast(&mut self.notices, id);
694+ match action {
695+ ToastAction::Undo => {
696+ if self.undo(cx) {
697+ self.mark_dirty();
698+ }
699+ }
700+ // The refusal was about the lock, so the lock is what goes: one
701+ // undo step, the same as the head's own switch.
702+ ToastAction::Unlock(lane) => self.set_lane_switch(lane, Switch::Locked, false, cx),
703+ // Another process starting: off the UI thread, as the library's
704+ // own Reveal does.
705+ ToastAction::ShowInFolder(path) => {
706+ cx.background_executor()
707+ .spawn(async move { show_in_file_manager(&path) })
708+ .detach();
709+ }
710+ // Same shape as Reveal: the player is another process, so it is
711+ // started off the UI thread and nothing here waits on it.
712+ ToastAction::Reload => self.reload_from_disk(cx),
713+ // The toast is the whole of it: the window keeps what it holds.
714+ ToastAction::KeepMine => {}
715+ ToastAction::Recover => self.recover_from_sidecar(cx),
716+ ToastAction::Discard => self.discard_recovery(),
717+ ToastAction::SaveThenOpen(path) => {
718+ self.save_project(cx);
719+ // A refused save keeps the edits: the other project waits.
720+ if !self.edited_since_save {
721+ self.import(&path, cx);
722+ }
723+ }
724+ ToastAction::OpenDiscarding(path) => {
725+ // The edits are being let go, so their autosave must not come back as "recovery".
726+ for armed in [true, false] {
727+ if let Some(autosave) = Self::autosave_target(&self.project_path, armed) {
728+ let _ = std::fs::remove_file(autosave);
729+ }
730+ }
731+ self.autosave_dirty = false;
732+ self.edited_since_save = false;
733+ self.import(&path, cx);
734+ }
735+ ToastAction::Play(path) => {
736+ cx.background_executor()
737+ .spawn(async move { open_in_default_player(&path) })
738+ .detach();
739+ }
740+ }
741+ cx.notify();
742+ }
743+
744+ /// A toast leaves by its own ✕, or by its timer. A missing id is not an
745+ /// error: the timer for a toast that was already dismissed fires into
746+ /// nothing, and that is the point of the id.
747+ pub(crate) fn dismiss_toast(&mut self, id: u64, cx: &mut Context<Self>) {
748+ if remove_toast(&mut self.notices, id) {
749+ cx.notify();
750+ }
287 }751 }
288 752
289 /// The magnet off and on again, in words: a snap that stops working753 /// The magnet off and on again, in words: a snap that stops working
@@ -294,21 +758,87 @@ impl Player {
294 self.snap_cue = None;758 self.snap_cue = None;
295 self.ghost.clear();759 self.ghost.clear();
296 self.notify_user(match self.snap {760 self.notify_user(match self.snap {
297- true => "SNAP ON".into(),761+ true => "Snap on".into(),
298- false => "SNAP OFF".into(),762+ false => "Snap off".into(),
299 });763 });
300 cx.notify();764 cx.notify();
301 }765 }
302 766
303- /// The keys list, from its key, from the spine's `?`, from the dock's own767+ /// The command palette (DESIGN §4.4), from Ctrl+K, the spine's `commands`
304- /// KEYS tab or from a menu row: the dock swings to that tab, scrolled to768+ /// or a menu row. It opens empty with its field ready for typing, and the
305- /// the top -- a list that opens where the last look left it would hide769+ /// whole list under it.
306- /// most of itself for a reason nobody remembers.
307 pub(crate) fn show_actions(&mut self, cx: &mut Context<Self>) {770 pub(crate) fn show_actions(&mut self, cx: &mut Context<Self>) {
771+ self.palette_open = true;
772+ self.palette_query.clear();
773+ self.palette_sel = 0;
774+ self.palette_scroll.set_offset(point(px(0.), px(0.)));
775+ // One card at a time, the rule the other cards follow.
776+ self.export_open = false;
777+ cx.notify();
778+ }
779+
780+ /// The keys list, from the spine's `?`: the dock swings to its KEYS tab,
781+ /// scrolled to the top -- a list that opens where the last look left it
782+ /// would hide most of itself for a reason nobody remembers.
783+ pub(crate) fn show_keys(&mut self, cx: &mut Context<Self>) {
308 self.keys_open = true;784 self.keys_open = true;
309 self.scroll_keys(None);785 self.scroll_keys(None);
310 // One card at a time, the rule the other cards follow.786 // One card at a time, the rule the other cards follow.
311 self.export_open = false;787 self.export_open = false;
788+ self.transcript_open = false;
789+ cx.notify();
790+ }
791+
792+ /// The palette's rows for what its field holds now, best match first.
793+ pub(crate) fn palette_list(&self) -> Vec<crate::menus::PaletteRow> {
794+ crate::menus::palette_rows(&self.palette_query, |a| self.enable(a, None))
795+ }
796+
797+ /// Moves the palette highlight by `by` rows, clamped to the list, and
798+ /// scrolls it into view.
799+ pub(crate) fn palette_move(&mut self, by: isize) {
800+ let rows = self.palette_list();
801+ if rows.is_empty() {
802+ self.palette_sel = 0;
803+ return;
804+ }
805+ let last = rows.len() - 1;
806+ self.palette_sel = (self.palette_sel as isize + by).clamp(0, last as isize) as usize;
807+ let grouped = self.palette_query.trim().is_empty();
808+ let child = crate::menus::palette_child_index(&rows, self.palette_sel, grouped);
809+ self.palette_scroll.scroll_to_item(child);
810+ }
811+
812+ /// Runs the highlighted palette row. A runnable row closes the palette
813+ /// first, so an action that opens a card is not drawn under it. A refused
814+ /// row goes through [`Player::act`], which says why as a toast, and the
815+ /// palette stays open for another pick.
816+ pub(crate) fn palette_run(&mut self, window: &mut Window, cx: &mut Context<Self>) {
817+ // The design kit's gallery is reached by typing its name; it is no
818+ // action, so it has no row, no key and no menu entry.
819+ if self.palette_query.trim().eq_ignore_ascii_case(crate::ui::gallery::PALETTE_PHRASE) {
820+ self.palette_open = false;
821+ self.palette_query.clear();
822+ crate::ui::gallery::set_open(true);
823+ cx.notify();
824+ return;
825+ }
826+ let rows = self.palette_list();
827+ let Some(row) = rows.get(self.palette_sel).copied() else {
828+ cx.notify();
829+ return;
830+ };
831+ if crate::menus::palette_closes_on_run(row) {
832+ self.palette_open = false;
833+ self.palette_query.clear();
834+ // Command search reopening itself from its own row would be a
835+ // palette that cannot be left by picking from it.
836+ if row.action == ActionId::ShowActions {
837+ cx.notify();
838+ return;
839+ }
840+ }
841+ self.act(row.action, window, cx);
312 cx.notify();842 cx.notify();
313 }843 }
314 844
@@ -367,9 +897,36 @@ impl Player {
367 ///897 ///
368 /// The player's half of [`enable`]: it reads the state, the table decides.898 /// The player's half of [`enable`]: it reads the state, the table decides.
369 pub(crate) fn enable(&self, action: ActionId, on: Option<(Lane, usize)>) -> Enable {899 pub(crate) fn enable(&self, action: ActionId, on: Option<(Lane, usize)>) -> Enable {
900+ // A display list of one has nothing to choose between: the row is not drawn.
901+ if action == ActionId::OutputDisplay && self.output_displays.len() < 2 {
902+ return Enable::Hidden("only one display");
903+ }
904+ // A transition joins the clip to the one after it, so a picture clip
905+ // with nothing right after it has no join to draw: said before the
906+ // table, as the state of this moment, the way the menu row says why.
907+ if action.transition_kind().is_some() && self.lacks_successor(on) {
908+ return Enable::No("no clip after this one");
909+ }
370 enable(action, self.ctx(on))910 enable(action, self.ctx(on))
371 }911 }
372 912
913+ /// Whether the picture clip the question is about (or the marked one) has
914+ /// no clip butted up against its right-hand end on its lane. Sound and
915+ /// caption lanes answer `false`: the table refuses those by their class.
916+ fn lacks_successor(&self, on: Option<(Lane, usize)>) -> bool {
917+ let Some(session) = &self.session else {
918+ return false;
919+ };
920+ let Some((lane, idx)) = on.or(self.selected.anchor()) else {
921+ return false;
922+ };
923+ if lane.kind != LaneKind::Video {
924+ return false;
925+ }
926+ let clips = session.lane_clips(lane);
927+ clips.get(idx).is_some_and(|clip| !clips.get(idx + 1).is_some_and(|next| next.start == clip.end()))
928+ }
929+
373 /// The state every one of those questions is asked against, read off the930 /// The state every one of those questions is asked against, read off the
374 /// player once: [`menu_items`] filters a whole menu with it, so the rows a931 /// player once: [`menu_items`] filters a whole menu with it, so the rows a
375 /// menu draws and the answers it dims them by come from the same reading.932 /// menu draws and the answers it dims them by come from the same reading.
@@ -379,7 +936,7 @@ impl Player {
379 };936 };
380 let on = on.or(self.selected.anchor());937 let on = on.or(self.selected.anchor());
381 let clip =938 let clip =
382- on.and_then(|(lane, idx)| session.lane_clips(lane).get(idx).map(|clip| (*clip, lane)));939+ on.and_then(|(lane, idx)| session.lane_clips(lane).get(idx).map(|clip| (clip.clone(), lane)));
383 let caption = on.is_some_and(|(lane, idx)| {940 let caption = on.is_some_and(|(lane, idx)| {
384 lane.kind == LaneKind::Subtitle && idx < session.sub_lane(lane).len()941 lane.kind == LaneKind::Subtitle && idx < session.sub_lane(lane).len()
385 });942 });
@@ -396,7 +953,14 @@ impl Player {
396 }953 }
397 let pick_lanes = lanes.len();954 let pick_lanes = lanes.len();
398 Ctx {955 Ctx {
399- clip,956+ clip: clip.clone(),
957+ // A selected title is taken off by Delete the way a picked gap is closed by it.
958+ gap: self.gap_pick().is_some() || self.title_target().is_some(),
959+ gap_here: self.gap_here().is_some(),
960+ clip_here: !self.under_playhead().is_empty(),
961+ words: self.transcript.selection().is_some(),
962+ rendering: self.render.as_ref().is_some_and(|(job, _)| !job.is_finished()),
963+ asset: self.selected_asset.is_some() || self.source_target.is_some(),
400 // The same pair read in the other index space: a subtitle lane's964 // The same pair read in the other index space: a subtitle lane's
401 // own, where the box that was clicked is a caption.965 // own, where the box that was clicked is a caption.
402 caption,966 caption,
@@ -406,7 +970,7 @@ impl Player {
406 .and_then(|s| s.link)970 .and_then(|s| s.link)
407 })971 })
408 .flatten(),972 .flatten(),
409- image: clip.is_some_and(|(clip, _)| {973+ image: clip.as_ref().is_some_and(|(clip, _)| {
410 session974 session
411 .sources()975 .sources()
412 .get(clip.source)976 .get(clip.source)
@@ -418,12 +982,16 @@ impl Player {
418 // scan whatever lane it sits on -- said before the row is drawn982 // scan whatever lane it sits on -- said before the row is drawn
419 // rather than after the scan comes back empty983 // rather than after the scan comes back empty
420 // ([`Player::start_silence_scan`]'s `Ok(None)` arm).984 // ([`Player::start_silence_scan`]'s `Ok(None)` arm).
421- no_sound: clip.is_some_and(|(clip, _)| {985+ no_sound: clip.as_ref().is_some_and(|(clip, _)| {
422 session986 session
423 .sources()987 .sources()
424 .get(clip.source)988 .get(clip.source)
425 .is_some_and(|s| self.streams.get(&s.path).is_some_and(Vec::is_empty))989 .is_some_and(|s| self.streams.get(&s.path).is_some_and(Vec::is_empty))
426 }),990 }),
991+ // The clip or caption the question is about, or anything picked,
992+ // sits on a locked lane ([`oracle::enable`] refuses the edits).
993+ locked: on.is_some_and(|(lane, _)| session.lane_locked(lane))
994+ || lanes.iter().any(|&lane| session.lane_locked(lane)),
427 playhead: frame_at(session.now(), self.fps),995 playhead: frame_at(session.now(), self.fps),
428 timeline: true,996 timeline: true,
429 clipboard: !self.clipboard.is_empty(),997 clipboard: !self.clipboard.is_empty(),
@@ -432,6 +1000,45 @@ impl Player {
432 exporting: self.exporting().is_some(),1000 exporting: self.exporting().is_some(),
433 picks: picks.len(),1001 picks: picks.len(),
434 pick_lanes,1002 pick_lanes,
1003+ nothing_to_undo: session.undo_depth() == 0,
1004+ nothing_to_redo: session.redo_depth() == 0,
1005+ alone: clip.as_ref().is_some_and(|(c, _)| {
1006+ // Its link is shared by no other clip (the lane's own index
1007+ // is the clip itself).
1008+ c.link.is_some_and(|id| {
1009+ session
1010+ .lanes()
1011+ .into_iter()
1012+ .map(|l| {
1013+ session
1014+ .lane_clips(l)
1015+ .iter()
1016+ .filter(|o| o.link == Some(id))
1017+ .count()
1018+ + session.sub_lane(l).iter().filter(|s| s.link == Some(id)).count()
1019+ })
1020+ .sum::<usize>()
1021+ <= 1
1022+ })
1023+ }),
1024+ no_partner: on.is_some_and(|(lane, idx)| {
1025+ clip.is_some() && crate::timeline_math::span_partner(session, lane, idx).is_none()
1026+ }),
1027+ compound: clip.as_ref().is_some_and(|(c, _)| engine::project::is_sequence_source(c.source)),
1028+ // Any piece of a multicam clip counts: the one asked about, any picked, or (with
1029+ // nothing selected) the one under the playhead.
1030+ multicam: on.is_some_and(|(lane, idx)| session.multicam_at(lane, idx).is_some())
1031+ || picks.iter().any(|&(lane, idx)| session.multicam_at(lane, idx).is_some())
1032+ || (on.is_none() && self.multicam_here().is_some()),
1033+ media_picks: self.picked_sources().len(),
1034+ monitor: self.angle_monitor,
1035+ angles_here: self.multicam_here().map_or(0, |u| u.names.len()),
1036+ sequences: session.sequences().len(),
1037+ sequence_used: session.sequences().iter().any(|q| q.active && q.used > 0),
1038+ parent: !self.seq_trail.is_empty(),
1039+ no_join: !session.lanes().into_iter().any(|l| {
1040+ rejoinable(session.lane_clips(l), frame_at(session.now(), self.fps))
1041+ }),
435 }1042 }
436 }1043 }
437 1044
@@ -452,6 +1059,8 @@ impl Player {
452 .flat_map(|lane| session.lane_clips(lane))1059 .flat_map(|lane| session.lane_clips(lane))
453 .filter(|c| c.source == idx)1060 .filter(|c| c.source == idx)
454 .count()1061 .count()
1062+ // ...and the clips inside the other sequences, which play it too.
1063+ + session.source_uses_parked(idx).iter().map(|u| u.1).sum::<usize>()
455 })1064 })
456 });1065 });
457 let sources = self1066 let sources = self
@@ -475,6 +1084,16 @@ impl Player {
475 .iter()1084 .iter()
476 .any(|row| row.path == path && row.stream == stream && row.unusable.is_none()),1085 .any(|row| row.path == path && row.stream == stream && row.unusable.is_none()),
477 placed,1086 placed,
1087+ proxy_stops: matches!(
1088+ self.proxies.get(path),
1089+ Some(Proxy::Making(_) | Proxy::Cancelling(_))
1090+ ),
1091+ starred: sources.iter().any(|s| s.path == path && s.audio_stream == stream && s.fav),
1092+ offline: self
1093+ .session
1094+ .as_ref()
1095+ .is_some_and(|s| s.offline_sources().iter().any(|(_, p)| p == path)),
1096+ media_picks: self.picked_sources().len(),
478 }1097 }
479 }1098 }
480 1099
@@ -495,8 +1114,12 @@ impl Player {
495 || self.color_open.is_some()1114 || self.color_open.is_some()
496 || self.transform_open.is_some()1115 || self.transform_open.is_some()
497 || self.speed_open.is_some()1116 || self.speed_open.is_some()
1117+ || self.effects_open.is_some()
498 || self.silence_open.is_some()1118 || self.silence_open.is_some()
499 || self.mix_open1119 || self.mix_open
1120+ || self.markers_open
1121+ || self.history_open
1122+ || self.tools.is_some()
500 {1123 {
501 Repeat::Card1124 Repeat::Card
502 } else {1125 } else {
@@ -512,12 +1135,20 @@ impl Player {
512 return;1135 return;
513 };1136 };
514 match item {1137 match item {
1138+ RowItem::Relink => {
1139+ self.library_menu = None;
1140+ self.relink_pick(menu.path.clone(), cx);
1141+ }
515 RowItem::Properties => {1142 RowItem::Properties => {
516 if let Some(open) = &mut self.library_menu {1143 if let Some(open) = &mut self.library_menu {
517 open.details = true;1144 open.details = true;
518 }1145 }
519 }1146 }
520 RowItem::Add => {1147 RowItem::Add => {
1148+ self.library_menu = None;
1149+ self.append_source(&menu.path, menu.stream, cx);
1150+ }
1151+ RowItem::Insert => {
521 self.library_menu = None;1152 self.library_menu = None;
522 self.insert_source(&menu.path, menu.stream, None, None, cx);1153 self.insert_source(&menu.path, menu.stream, None, None, cx);
523 }1154 }
@@ -535,6 +1166,10 @@ impl Player {
535 self.library_menu = None;1166 self.library_menu = None;
536 self.open_preview(&menu.path, menu.stream, cx);1167 self.open_preview(&menu.path, menu.stream, cx);
537 }1168 }
1169+ RowItem::CreateMulticam => {
1170+ self.library_menu = None;
1171+ self.create_multicam_selected(cx);
1172+ }
538 RowItem::Proxy => {1173 RowItem::Proxy => {
539 self.library_menu = None;1174 self.library_menu = None;
540 let stops = matches!(1175 let stops = matches!(
@@ -543,6 +1178,18 @@ impl Player {
543 );1178 );
544 self.toggle_proxy(&menu.path, stops, cx);1179 self.toggle_proxy(&menu.path, stops, cx);
545 }1180 }
1181+ RowItem::Favourite => {
1182+ self.library_menu = None;
1183+ self.toggle_favourite_of(menu.path.clone(), menu.stream, cx);
1184+ }
1185+ RowItem::MoveToBin => {
1186+ self.bin_picker(menu.at, cx);
1187+ }
1188+ RowItem::NewBin => {
1189+ self.library_menu = None;
1190+ let rows = self.rows_for((menu.path.clone(), menu.stream));
1191+ self.new_bin(0, rows, cx);
1192+ }
546 RowItem::Reveal => {1193 RowItem::Reveal => {
547 self.library_menu = None;1194 self.library_menu = None;
548 // Another process starting: off the UI thread, exactly as the1195 // Another process starting: off the UI thread, exactly as the
@@ -555,6 +1202,30 @@ impl Player {
555 cx.notify();1202 cx.notify();
556 }1203 }
557 1204
1205+ /// The key-routed door into the picked row ([`crate::ui::dock_stance::media_key`]).
1206+ /// No row menu is open on that path, so the row is the one
1207+ /// [`Player::selected_asset`] names; the calls are the menu's own.
1208+ pub(crate) fn act_on_picked_row(&mut self, item: RowItem, cx: &mut Context<Self>) {
1209+ let Some((path, stream)) = self.selected_asset.clone() else {
1210+ return;
1211+ };
1212+ match item {
1213+ RowItem::Preview => self.open_preview(&path, stream, cx),
1214+ // Asked of the row oracle like the menu's own Add: this key is a
1215+ // second door to the same edit list, and an export is reading it.
1216+ RowItem::Add => match crate::oracle::row_enable(item, self.row_ctx(&path, stream)) {
1217+ Enable::No(why) => self.notify_user(format!("Add — {why}").into()),
1218+ _ => self.append_source(&path, stream, cx),
1219+ },
1220+ RowItem::Insert => match crate::oracle::row_enable(item, self.row_ctx(&path, stream)) {
1221+ Enable::No(why) => self.notify_user(format!("Insert — {why}").into()),
1222+ _ => self.insert_source(&path, stream, None, None, cx),
1223+ },
1224+ _ => {}
1225+ }
1226+ cx.notify();
1227+ }
1228+
558 /// Marks the playhead as an export's in point. `ordered_range` keeps the1229 /// Marks the playhead as an export's in point. `ordered_range` keeps the
559 /// pair legal whichever one lands past the other.1230 /// pair legal whichever one lands past the other.
560 pub(crate) fn set_in(&mut self, cx: &mut Context<Self>) {1231 pub(crate) fn set_in(&mut self, cx: &mut Context<Self>) {
@@ -562,8 +1233,8 @@ impl Player {
562 return;1233 return;
563 };1234 };
564 let at = frame_at(session.now(), self.fps);1235 let at = frame_at(session.now(), self.fps);
565- let out = self.range.map_or(at, |(_, e)| e);1236+ let len = frame_at(session.timeline_duration(), self.fps);
566- self.range = Some(ordered_range(at, out));1237+ self.range = Some(mark_in(self.range, at, len));
567 cx.notify();1238 cx.notify();
568 }1239 }
569 1240
@@ -573,8 +1244,7 @@ impl Player {
573 return;1244 return;
574 };1245 };
575 let at = frame_at(session.now(), self.fps);1246 let at = frame_at(session.now(), self.fps);
576- let start = self.range.map_or(at, |(s, _)| s);1247+ self.range = Some(mark_out(self.range, at));
577- self.range = Some(ordered_range(start, at));
578 cx.notify();1248 cx.notify();
579 }1249 }
580 1250
@@ -668,7 +1338,7 @@ impl Player {
668 /// the playhead instead of wherever the pointer stopped. The oracle1338 /// the playhead instead of wherever the pointer stopped. The oracle
669 /// already refused this with no subject cut or a playhead off it, so an1339 /// already refused this with no subject cut or a playhead off it, so an
670 /// anchor and a frame are here to read.1340 /// anchor and a frame are here to read.
671- pub(crate) fn trim_cut_to_playhead(&mut self, edge: Edge, cx: &mut Context<Self>) {1341+ pub(crate) fn trim_cut_to_playhead(&mut self, edge: Edge, ripple: bool, cx: &mut Context<Self>) {
672 let Some((lane, idx)) = self.selected.anchor() else {1342 let Some((lane, idx)) = self.selected.anchor() else {
673 return;1343 return;
674 };1344 };
@@ -676,10 +1346,10 @@ impl Player {
676 return;1346 return;
677 };1347 };
678 let to = frame_at(session.now(), self.fps);1348 let to = frame_at(session.now(), self.fps);
679- let trimmed = self1349+ let trimmed = self.session.as_mut().is_some_and(|s| match ripple {
680- .session1350+ true => s.ripple_trim_clip(lane, idx, edge, to),
681- .as_mut()1351+ false => s.trim_clip(lane, idx, edge, to),
682- .is_some_and(|s| s.trim_clip(lane, idx, edge, to));1352+ });
683 if trimmed {1353 if trimmed {
684 // The door's own answer again: an edge the playhead is already on is1354 // The door's own answer again: an edge the playhead is already on is
685 // `false`, no undo step, and nothing for the unsaved ghost to be1355 // `false`, no undo step, and nothing for the unsaved ghost to be
@@ -706,7 +1376,7 @@ impl Player {
706 /// start frame. Space is what starts it, playing or not.1376 /// start frame. Space is what starts it, playing or not.
707 pub(crate) fn toggle_loop_trim(&mut self, cx: &mut Context<Self>) {1377 pub(crate) fn toggle_loop_trim(&mut self, cx: &mut Context<Self>) {
708 if self.loop_trim.take().is_some() {1378 if self.loop_trim.take().is_some() {
709- self.notify_user("LOOP-TRIM OFF".into());1379+ self.notify_user("Loop trim off".into());
710 cx.notify();1380 cx.notify();
711 return;1381 return;
712 }1382 }
@@ -715,7 +1385,7 @@ impl Player {
715 };1385 };
716 self.loop_trim = self.cut_span(lane, idx);1386 self.loop_trim = self.cut_span(lane, idx);
717 if self.loop_trim.is_some() {1387 if self.loop_trim.is_some() {
718- self.notify_user("LOOP-TRIM ON".into());1388+ self.notify_user("Loop trim on".into());
719 }1389 }
720 cx.notify();1390 cx.notify();
721 }1391 }
@@ -734,6 +1404,9 @@ impl Player {
734 let stepped = self.step_history(PlaybackSession::undo);1404 let stepped = self.step_history(PlaybackSession::undo);
735 if stepped {1405 if stepped {
736 self.selected.clear();1406 self.selected.clear();
1407+ // A cue's number can name another cue after the step.
1408+ self.drop_sel_cue();
1409+ self.cue_menu = None;
737 }1410 }
738 cx.notify();1411 cx.notify();
739 stepped1412 stepped
@@ -744,6 +1417,9 @@ impl Player {
744 let stepped = self.step_history(PlaybackSession::redo);1417 let stepped = self.step_history(PlaybackSession::redo);
745 if stepped {1418 if stepped {
746 self.selected.clear();1419 self.selected.clear();
1420+ // A cue's number can name another cue after the step.
1421+ self.drop_sel_cue();
1422+ self.cue_menu = None;
747 }1423 }
748 cx.notify();1424 cx.notify();
749 stepped1425 stepped
@@ -762,7 +1438,7 @@ impl Player {
762 /// `false` where there was nothing to step: no session at all, or a history1438 /// `false` where there was nothing to step: no session at all, or a history
763 /// step that refused ([`PlaybackSession::undo`]'s own answer), in which case1439 /// step that refused ([`PlaybackSession::undo`]'s own answer), in which case
764 /// nothing in the window moves either.1440 /// nothing in the window moves either.
765- fn step_history(&mut self, step: fn(&mut PlaybackSession) -> bool) -> bool {1441+ pub(crate) fn step_history(&mut self, step: impl FnOnce(&mut PlaybackSession) -> bool) -> bool {
766 let mut caches = SessionCaches {1442 let mut caches = SessionCaches {
767 fps: self.fps,1443 fps: self.fps,
768 proxies_on: self.proxies_on,1444 proxies_on: self.proxies_on,
@@ -864,7 +1540,7 @@ pub(crate) fn history_step(
864 before: &HistoryBefore,1540 before: &HistoryBefore,
865 caches: &mut SessionCaches,1541 caches: &mut SessionCaches,
866 session: &mut PlaybackSession,1542 session: &mut PlaybackSession,
867- step: fn(&mut PlaybackSession) -> bool,1543+ step: impl FnOnce(&mut PlaybackSession) -> bool,
868 ) -> Option<HistoryOutcome> {1544 ) -> Option<HistoryOutcome> {
869 if !step(session) {1545 if !step(session) {
870 return None;1546 return None;
@@ -885,6 +1561,25 @@ pub(crate) fn history_step(
885 /// whichever came second into the pair `Player::start_export` wants a range in1561 /// whichever came second into the pair `Player::start_export` wants a range in
886 /// -- and never an empty one, since a single frame marked in and out twice is1562 /// -- and never an empty one, since a single frame marked in and out twice is
887 /// still a frame to export.1563 /// still a frame to export.
1564+/// The range after an in mark at `at` on a timeline `len` frames long. A lone
1565+/// in runs to the end, and an in at or past the out point does too -- the pair
1566+/// is never a single frame the person did not ask for (that was a 0 s export).
1567+pub(crate) fn mark_in(range: Option<(u32, u32)>, at: u32, len: u32) -> (u32, u32) {
1568+ match range {
1569+ Some((_, out)) if at < out => (at, out),
1570+ _ => ordered_range(at, len.max(at)),
1571+ }
1572+}
1573+
1574+/// The out mark's pair: a lone out starts at the top, and an out at or before
1575+/// the in point does too.
1576+pub(crate) fn mark_out(range: Option<(u32, u32)>, at: u32) -> (u32, u32) {
1577+ match range {
1578+ Some((start, _)) if at > start => (start, at),
1579+ _ => ordered_range(0, at),
1580+ }
1581+}
1582+
888 pub(crate) fn ordered_range(a: u32, b: u32) -> (u32, u32) {1583 pub(crate) fn ordered_range(a: u32, b: u32) -> (u32, u32) {
889 let (start, end) = if a <= b { (a, b) } else { (b, a) };1584 let (start, end) = if a <= b { (a, b) } else { (b, a) };
890 if start == end {1585 if start == end {
@@ -894,9 +1589,84 @@ pub(crate) fn ordered_range(a: u32, b: u32) -> (u32, u32) {
894 }1589 }
895 }1590 }
896 1591
1592+/// Opens a written file in the desktop's default player, the same way
1593+/// [`show_in_file_manager`] reveals one: `xdg-open` hands the path to whatever
1594+/// the user has registered for it. Failure is silent here, as the reveal's is:
1595+/// the file is on disk and the toast's other button still reaches it.
1596+pub(crate) fn open_in_default_player(path: &std::path::Path) {
1597+ let path = std::fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf());
1598+ let _ = std::process::Command::new("xdg-open").arg(&path).status();
1599+}
1600+
1601+/// Whether two halves of one take meet at `frame` on a lane's clips: touching
1602+/// on the timeline and consecutive frames of the same source -- what a cut
1603+/// leaves and Regroup closes.
1604+pub(crate) fn rejoinable(clips: &[Clip], frame: u32) -> bool {
1605+ clips.windows(2).any(|w| {
1606+ let (a, b) = (&w[0], &w[1]);
1607+ a.end() == frame
1608+ && b.start == frame
1609+ && a.source == b.source
1610+ && a.reversed == b.reversed
1611+ && match a.reversed {
1612+ true => a.in_frame == b.out_frame,
1613+ false => a.out_frame == b.in_frame,
1614+ }
1615+ })
1616+}
1617+
897 #[cfg(test)]1618 #[cfg(test)]
898 mod tests {1619 mod tests {
899- use super::ordered_range;1620+ use super::{mark_in, mark_out, ordered_range, step_name, step_row_name, step_toast};
1621+ use crate::keymap::ActionId;
1622+
1623+ /// Undo and Redo name the step they take back or walk to, and say so when none is left;
1624+ /// the toast names the step it just took. An unnamed step reads as plain Undo.
1625+ #[test]
1626+ fn undo_and_redo_name_their_step_in_the_menu_and_the_toast() {
1627+ assert_eq!(step_row_name(false, 2, Some("Split")), "Undo Split");
1628+ assert_eq!(step_row_name(false, 1, None), "Undo");
1629+ assert_eq!(step_row_name(false, 0, Some("Split")), "Nothing to undo");
1630+ assert_eq!(step_row_name(true, 1, Some("Add marker")), "Redo Add marker");
1631+ assert_eq!(step_row_name(true, 1, None), "Redo");
1632+ assert_eq!(step_row_name(true, 0, None), "Nothing to redo");
1633+ assert_eq!(step_toast(false, Some("Split")), "Undid Split");
1634+ assert_eq!(step_toast(true, Some("Split")), "Redid Split");
1635+ assert_eq!(step_toast(false, None), "Undone");
1636+ assert_eq!(step_toast(true, None), "Redone");
1637+ }
1638+
1639+ /// A step takes its name from the action's menu name, without the ellipsis. Undo and Redo,
1640+ /// and a name too long for a menu row, carry none.
1641+ #[test]
1642+ fn a_step_takes_its_menu_name() {
1643+ assert_eq!(step_name(ActionId::Cut), Some("Split"));
1644+ assert_eq!(step_name(ActionId::Color), Some("Colour"));
1645+ assert_eq!(step_name(ActionId::AddMarker), Some("Add marker"));
1646+ assert_eq!(step_name(ActionId::Delete), Some("Delete"));
1647+ assert_eq!(step_name(ActionId::ClipEnabled), Some("Clip enabled"));
1648+ assert_eq!(step_name(ActionId::Undo), None);
1649+ assert_eq!(step_name(ActionId::Redo), None);
1650+ for action in ActionId::ALL {
1651+ if let Some(name) = step_name(action) {
1652+ assert!(name.chars().count() < 30, "{action:?} names its step {name:?}, too long");
1653+ assert!(!name.contains('\u{2026}'), "{action:?} keeps the ellipsis in {name:?}");
1654+ }
1655+ }
1656+ }
1657+
1658+ #[test]
1659+ fn lone_marks_run_to_the_end_or_the_top() {
1660+ // The user's bug: I (or O) on its own made a one-frame range.
1661+ assert_eq!(mark_in(None, 0, 3120), (0, 3120));
1662+ assert_eq!(mark_in(None, 120, 3120), (120, 3120));
1663+ assert_eq!(mark_out(None, 3120), (0, 3120));
1664+ assert_eq!(mark_in(Some((10, 50)), 20, 3120), (20, 50));
1665+ assert_eq!(mark_in(Some((10, 50)), 60, 3120), (60, 3120));
1666+ assert_eq!(mark_out(Some((10, 50)), 40), (10, 40));
1667+ assert_eq!(mark_out(Some((10, 50)), 5), (0, 5));
1668+ assert_eq!(mark_in(None, 3120, 3120), (3120, 3121));
1669+ }
900 1670
901 #[test]1671 #[test]
902 fn ordered_range_never_empty_and_swaps_a_reversed_pair() {1672 fn ordered_range_never_empty_and_swaps_a_reversed_pair() {
crates/app/src/player/beats.rsadded+201 -0
@@ -0,0 +1,201 @@
1+//! Mark the beats: the card that listens to a sound clip and puts a comment marker on each
2+//! beat, so a cut can be made on the music. The listening runs on the background executor
3+//! the way a silence scan does; the markers land in one undo step.
4+
5+use crate::export_ui::audio_half;
6+use crate::*;
7+use engine::beats::{self, Found};
8+use std::time::{Duration, Instant};
9+
10+/// What the card's three choices mean: every beat, every second beat, every fourth beat.
11+pub(crate) const BEAT_EVERY: [usize; 3] = [1, 2, 4];
12+
13+impl Player {
14+ /// Opens the mark-the-beats card on the sound of the clip the hand is on, or the one under
15+ /// the playhead. A picture with no sound says so and opens nothing.
16+ pub(crate) fn open_beats(&mut self, cx: &mut Context<Self>) {
17+ if self.exporting().is_some() {
18+ return;
19+ }
20+ let Some(session) = &self.session else {
21+ self.notify_user("Nothing to mark — no file open".into());
22+ cx.notify();
23+ return;
24+ };
25+ let anchor = self
26+ .selected
27+ .anchor()
28+ .or_else(|| session.video_clip_at(session.now()));
29+ let Some(anchor) = anchor else {
30+ self.notify_user("No clip is picked or under the playhead, so there is no sound to mark".into());
31+ cx.notify();
32+ return;
33+ };
34+ let (lane, idx) = audio_half(session, anchor);
35+ let has_sound = session.lane_clips(lane).get(idx).and_then(|clip| {
36+ let source = session.sources().get(clip.source)?;
37+ Some(!engine::is_image(&source.path))
38+ });
39+ if has_sound != Some(true) {
40+ self.notify_user("The clip has no sound, so it has no beats to mark".into());
41+ cx.notify();
42+ return;
43+ }
44+ self.close_other_cards();
45+ self.beats_open = Some((lane, idx));
46+ self.beats_scan = None;
47+ self.context_menu = None;
48+ cx.notify();
49+ }
50+
51+ /// Whether the selected clip (or the sound half of a picture) has a sound to listen to.
52+ pub(crate) fn beats_available(&self) -> bool {
53+ let Some(session) = &self.session else {
54+ return false;
55+ };
56+ let anchor = self
57+ .selected
58+ .anchor()
59+ .or_else(|| session.video_clip_at(session.now()));
60+ let Some(anchor) = anchor else {
61+ return false;
62+ };
63+ let (lane, idx) = audio_half(session, anchor);
64+ session
65+ .lane_clips(lane)
66+ .get(idx)
67+ .and_then(|clip| session.sources().get(clip.source))
68+ .is_some_and(|source| !engine::is_image(&source.path))
69+ }
70+
71+ /// Takes the section down. A listening that is still running lands into nothing.
72+ pub(crate) fn close_beats(&mut self) {
73+ self.beats_open = None;
74+ self.beats_scan = None;
75+ }
76+
77+ /// Starts listening to the clip the card is on. The analysis is off the UI thread; the card
78+ /// shows its clock until it lands.
79+ pub(crate) fn start_beats(&mut self, cx: &mut Context<Self>) {
80+ let Some((lane, idx)) = self.beats_open else {
81+ return;
82+ };
83+ if self.beats_scan.is_some() {
84+ return;
85+ }
86+ let fps = self.fps;
87+ let found = self.session.as_ref().and_then(|session| {
88+ let clip = session.lane_clips(lane).get(idx)?.clone();
89+ let source = session.sources().get(clip.source)?.clone();
90+ Some((clip, source))
91+ });
92+ let Some((clip, source)) = found else {
93+ self.close_beats();
94+ self.notify_user("The clip is gone, so there is no sound to mark".into());
95+ cx.notify();
96+ return;
97+ };
98+ let every = BEAT_EVERY[self.beats_every.min(BEAT_EVERY.len() - 1)];
99+ let range = (f64::from(clip.in_frame) / fps, f64::from(clip.out_frame) / fps);
100+ self.beats_scan = Some(Instant::now());
101+ let task = cx.background_executor().spawn(async move {
102+ beats::detect(&source.path, source.audio_stream, range)
103+ });
104+ cx.spawn(async move |this, cx| {
105+ let landed = task.await;
106+ this.update(cx, |this, cx| {
107+ this.land_beats(lane, idx, every, fps, landed, cx);
108+ })
109+ .ok();
110+ })
111+ .detach();
112+ // The card's clock: a repaint a quarter second while the listening runs, and none after.
113+ cx.spawn(async move |this, cx| {
114+ loop {
115+ cx.background_executor().timer(Duration::from_millis(250)).await;
116+ let running = this
117+ .update(cx, |this, cx| {
118+ cx.notify();
119+ this.beats_scan.is_some()
120+ })
121+ .unwrap_or(false);
122+ if !running {
123+ break;
124+ }
125+ }
126+ })
127+ .detach();
128+ cx.notify();
129+ }
130+
131+ /// Puts the beats the analysis found on the clip, replacing the clip's earlier beat markers,
132+ /// in one undo step, and says what it did.
133+ fn land_beats(
134+ &mut self,
135+ lane: Lane,
136+ idx: usize,
137+ every: usize,
138+ fps: f64,
139+ landed: engine::Result<Found>,
140+ cx: &mut Context<Self>,
141+ ) {
142+ // Closed while listening: the result is for a card nobody has now.
143+ if self.beats_scan.take().is_none() {
144+ return;
145+ }
146+ self.beats_last = Some(match &landed {
147+ Ok(Found::Beats { bpm, times }) => {
148+ let n = beats::every_nth(times, every).len();
149+ format!("Last run: {n} beats at {bpm:.0} BPM")
150+ }
151+ Ok(Found::NoAudio) | Ok(Found::Silent) => "Last run: no sound to mark".to_string(),
152+ Ok(Found::NoPulse) => "Last run: no steady beat found".to_string(),
153+ Err(_) => "Last run: failed".to_string(),
154+ });
155+ match landed {
156+ Ok(Found::Beats { bpm, times }) => {
157+ let Some(session) = self.session.as_mut() else {
158+ cx.notify();
159+ return;
160+ };
161+ let Some(clip) = session.lane_clips(lane).get(idx).cloned() else {
162+ self.beats_last = Some("Last run: the clip is gone".to_string());
163+ self.notify_user("The clip is gone; no markers were added".into());
164+ cx.notify();
165+ return;
166+ };
167+ let frames = beats::timeline_beats(&clip, fps, &beats::every_nth(&times, every));
168+ session.begin_batch();
169+ let old = beats::beat_marker_indices(session.markers(), clip.start, clip.end());
170+ for &i in old.iter().rev() {
171+ session.remove_marker(i);
172+ }
173+ let mut refused = None;
174+ for &frame in &frames {
175+ if let Err(e) = session.add_marker(beats::beat_marker(frame)) {
176+ refused = Some(e);
177+ break;
178+ }
179+ }
180+ session.end_batch();
181+ if let Some(e) = refused {
182+ self.notify_user(format!("Marking the beats failed — {e}").into());
183+ } else if frames.is_empty() {
184+ self.notify_user("No beat falls inside this clip".into());
185+ } else {
186+ self.notify_user_action(
187+ format!("Marked {} beats at {:.0} BPM", frames.len(), bpm).into(),
188+ ToastAction::Undo,
189+ );
190+ }
191+ }
192+ Ok(Found::NoAudio) => self.notify_user("The clip has no sound, so it has no beats to mark".into()),
193+ Ok(Found::Silent) => self.notify_user("No beat to mark — the sound is silent".into()),
194+ Ok(Found::NoPulse) => {
195+ self.notify_user("No steady beat found in this sound to mark".into())
196+ }
197+ Err(e) => self.notify_user(format!("Marking the beats failed — {e}").into()),
198+ }
199+ cx.notify();
200+ }
201+}
crates/app/src/player/bins.rsadded+324 -0
@@ -0,0 +1,324 @@
1+//! The media library's bins and favourites (project format v51): named folders that hold
2+//! sources, and a star per source. Everything here is an edit of the project -- one undo step
3+//! each -- and a label only: no picture or sound is rebuilt.
4+
5+use crate::*;
6+use engine::project::MAX_BIN_NAME_CHARS;
7+
8+impl Player {
9+ /// The source a library row stands for, if it is one (a file's further audio streams are
10+ /// listed before they are sources).
11+ fn source_of_row(&self, path: &Path, stream: usize) -> Option<usize> {
12+ self.session.as_ref()?.sources().iter().position(|s| s.path == path && s.audio_stream == stream)
13+ }
14+
15+ /// The rows an action on "the picked media" means: the multi-pick when there is one, else
16+ /// the one row selected.
17+ pub(crate) fn picked_assets(&self) -> Vec<(PathBuf, usize)> {
18+ if self.asset_picks.is_empty() {
19+ self.selected_asset.iter().cloned().collect()
20+ } else {
21+ self.asset_picks.clone()
22+ }
23+ }
24+
25+ /// Rows to act on when `row` is the one a gesture landed on: the whole multi-pick if the row
26+ /// is in it, else the row alone.
27+ pub(crate) fn rows_for(&self, row: (PathBuf, usize)) -> Vec<(PathBuf, usize)> {
28+ if self.asset_picks.contains(&row) { self.asset_picks.clone() } else { vec![row] }
29+ }
30+
31+ fn library_editable(&mut self, cx: &mut Context<Self>) -> bool {
32+ if self.session.is_none() {
33+ return false;
34+ }
35+ if self.exporting().is_some() {
36+ self.notify_user("The library cannot change while an export runs".into());
37+ cx.notify();
38+ return false;
39+ }
40+ true
41+ }
42+
43+ /// Makes a bin inside bin `parent` (`0`: at the top), holding `with` if any, named in place so
44+ /// typing replaces "New bin". One undo step.
45+ pub(crate) fn new_bin(&mut self, parent: u32, with: Vec<(PathBuf, usize)>, cx: &mut Context<Self>) {
46+ if !self.library_editable(cx) {
47+ return;
48+ }
49+ let Some(session) = self.session.as_mut() else { return };
50+ let taken = |name: &str, bins: &[engine::Bin]| bins.iter().any(|b| b.parent == parent && b.name.eq_ignore_ascii_case(name));
51+ let mut name = "New bin".to_string();
52+ let mut n = 1;
53+ while taken(&name, session.bins()) {
54+ n += 1;
55+ name = format!("New bin {n}");
56+ }
57+ let indexes: Vec<usize> = with
58+ .iter()
59+ .filter_map(|(path, stream)| session.sources().iter().position(|s| s.path == *path && s.audio_stream == *stream))
60+ .collect();
61+ session.begin_batch();
62+ let made = session.create_bin(&name, parent).and_then(|id| session.move_to_bin(&indexes, id).map(|_| id));
63+ session.end_batch();
64+ match made {
65+ Ok(id) => {
66+ self.mark_dirty();
67+ self.collapsed_bins.remove(&id);
68+ self.collapsed_bins.remove(&parent);
69+ self.selected_bin = Some(id);
70+ self.bin_edit = Some((id, crate::player::text_field::TextField::selected(name)));
71+ self.context_menu = None;
72+ self.library_menu = None;
73+ }
74+ Err(e) => self.notify_user(format!("No new bin — {e}").into()),
75+ }
76+ cx.notify();
77+ }
78+
79+ /// Starts retyping bin `id`'s name on its row.
80+ pub(crate) fn begin_bin_edit(&mut self, id: u32, cx: &mut Context<Self>) {
81+ if !self.library_editable(cx) {
82+ return;
83+ }
84+ let name = self.session.as_ref().and_then(|s| s.bins().iter().find(|b| b.id == id)).map(|b| b.name.clone());
85+ if let Some(name) = name {
86+ self.selected_bin = Some(id);
87+ self.context_menu = None;
88+ self.library_menu = None;
89+ self.bin_edit = Some((id, crate::player::text_field::TextField::selected(name)));
90+ }
91+ cx.notify();
92+ }
93+
94+ /// Writes what was typed as the bin's name (one undo step); an empty or taken name is said
95+ /// out loud and the old one stays.
96+ pub(crate) fn commit_bin_edit(&mut self, cx: &mut Context<Self>) {
97+ let Some((id, field)) = self.bin_edit.take() else { return };
98+ if let Some(session) = self.session.as_mut() {
99+ match session.rename_bin(id, &field.text) {
100+ Ok(true) => self.mark_dirty(),
101+ Ok(false) => {}
102+ Err(e) => self.notify_user(format!("Not renamed — {e}").into()),
103+ }
104+ }
105+ cx.notify();
106+ }
107+
108+ /// The keyboard while a bin's name is being retyped: enter saves, escape gives up, the rest is text.
109+ pub(crate) fn bin_edit_key(&mut self, key: &str, ctrl: bool, alt: bool, key_char: Option<&str>, cx: &mut Context<Self>) {
110+ use crate::player::text_field::FieldKey;
111+ let Some((_, field)) = self.bin_edit.as_mut() else { return };
112+ match field.key(key, ctrl, alt, key_char, MAX_BIN_NAME_CHARS) {
113+ FieldKey::Cancel => self.bin_edit = None,
114+ FieldKey::Commit => self.commit_bin_edit(cx),
115+ FieldKey::Edited => {}
116+ }
117+ cx.notify();
118+ }
119+
120+ /// Folds or opens a bin's rows; remembered while the project is open.
121+ pub(crate) fn toggle_bin_open(&mut self, id: u32, cx: &mut Context<Self>) {
122+ if !self.collapsed_bins.remove(&id) {
123+ self.collapsed_bins.insert(id);
124+ }
125+ // Remembered with the project's view, like the viewer zoom.
126+ self.save_view_state();
127+ cx.notify();
128+ }
129+
130+ /// The New bin inside action: a bin in the bin picked in the list. Only a top-level bin
131+ /// holds bins, so inside a nested one it makes a sibling.
132+ pub(crate) fn new_bin_inside_selected(&mut self, cx: &mut Context<Self>) {
133+ let parent = self
134+ .selected_bin
135+ .and_then(|id| self.session.as_ref()?.bins().iter().find(|b| b.id == id).map(|b| if b.parent == 0 { b.id } else { b.parent }));
136+ match parent {
137+ Some(parent) => self.new_bin(parent, Vec::new(), cx),
138+ None => {
139+ self.notify_user("No bin is selected".into());
140+ cx.notify();
141+ }
142+ }
143+ }
144+
145+ /// Opens a bin row's menu at the pointer; the bin is picked first, so the verbs act on it.
146+ pub(crate) fn open_bin_menu(&mut self, id: u32, at: Point<Pixels>, cx: &mut Context<Self>) {
147+ if self.modal() || self.session.is_none() {
148+ return;
149+ }
150+ self.selected_bin = Some(id);
151+ self.library_menu = None;
152+ self.context_menu = Some(ContextMenu {
153+ lane: Lane::V1,
154+ on: MenuOn::Bin,
155+ at,
156+ details: false,
157+ adjust: false,
158+ compound: false,
159+ });
160+ cx.notify();
161+ }
162+
163+ /// The Rename bin action: the bin picked in the list.
164+ pub(crate) fn rename_selected_bin(&mut self, cx: &mut Context<Self>) {
165+ match self.selected_bin {
166+ Some(id) => self.begin_bin_edit(id, cx),
167+ None => {
168+ self.notify_user("No bin is selected".into());
169+ cx.notify();
170+ }
171+ }
172+ }
173+
174+ /// The Remove bin action: the bin picked in the list.
175+ pub(crate) fn remove_selected_bin(&mut self, cx: &mut Context<Self>) {
176+ match self.selected_bin {
177+ Some(id) => self.remove_bin(id, cx),
178+ None => {
179+ self.notify_user("No bin is selected".into());
180+ cx.notify();
181+ }
182+ }
183+ }
184+
185+ /// Removes bin `id`; what it held stays in the library, one level up. One undo step.
186+ pub(crate) fn remove_bin(&mut self, id: u32, cx: &mut Context<Self>) {
187+ if !self.library_editable(cx) {
188+ return;
189+ }
190+ let Some(session) = self.session.as_mut() else { return };
191+ let name = session.bins().iter().find(|b| b.id == id).map(|b| b.name.clone()).unwrap_or_default();
192+ match session.remove_bin(id) {
193+ Ok(moved) => {
194+ self.mark_dirty();
195+ if self.selected_bin == Some(id) {
196+ self.selected_bin = None;
197+ }
198+ if self.bin_edit.as_ref().is_some_and(|(b, _)| *b == id) {
199+ self.bin_edit = None;
200+ }
201+ self.context_menu = None;
202+ let tail = match moved {
203+ 0 => String::new(),
204+ 1 => " — its file moved up".to_string(),
205+ n => format!(" — its {n} files moved up"),
206+ };
207+ self.notify_user(format!("Removed bin {name}{tail}").into());
208+ }
209+ Err(e) => self.notify_user(format!("Bin not removed — {e}").into()),
210+ }
211+ cx.notify();
212+ }
213+
214+ /// Files `rows` in bin `bin` (`0`: out of every bin). One undo step.
215+ pub(crate) fn move_assets_to_bin(&mut self, rows: Vec<(PathBuf, usize)>, bin: u32, cx: &mut Context<Self>) {
216+ if !self.library_editable(cx) {
217+ return;
218+ }
219+ let indexes: Vec<usize> = rows.iter().filter_map(|(p, s)| self.source_of_row(p, *s)).collect();
220+ let Some(session) = self.session.as_mut() else { return };
221+ let name = session.bins().iter().find(|b| b.id == bin).map(|b| b.name.clone());
222+ match session.move_to_bin(&indexes, bin) {
223+ Ok(0) => {}
224+ Ok(n) => {
225+ self.mark_dirty();
226+ self.collapsed_bins.remove(&bin);
227+ let what = if n == 1 { "1 file".to_string() } else { format!("{n} files") };
228+ let msg = match name {
229+ Some(name) => format!("Moved {what} to {name}"),
230+ None => format!("Moved {what} out of its bin"),
231+ };
232+ self.notify_user(msg.into());
233+ }
234+ Err(e) => self.notify_user(format!("Not moved — {e}").into()),
235+ }
236+ cx.notify();
237+ }
238+
239+ /// Stars `rows`, or takes the star off when every one has it. One undo step.
240+ pub(crate) fn toggle_favourite_rows(&mut self, rows: Vec<(PathBuf, usize)>, cx: &mut Context<Self>) {
241+ if !self.library_editable(cx) {
242+ return;
243+ }
244+ let indexes: Vec<usize> = rows.iter().filter_map(|(p, s)| self.source_of_row(p, *s)).collect();
245+ let Some(session) = self.session.as_mut() else { return };
246+ if indexes.is_empty() {
247+ return;
248+ }
249+ let all_starred = indexes.iter().all(|&i| session.sources().get(i).is_some_and(|s| s.fav));
250+ match session.set_favourite(&indexes, !all_starred) {
251+ Ok(0) => {}
252+ Ok(_) => self.mark_dirty(),
253+ Err(e) => self.notify_user(format!("Not starred — {e}").into()),
254+ }
255+ cx.notify();
256+ }
257+
258+ /// The star on one row (or on the whole multi-pick it is part of).
259+ pub(crate) fn toggle_favourite_of(&mut self, path: PathBuf, stream: usize, cx: &mut Context<Self>) {
260+ let rows = self.rows_for((path, stream));
261+ self.toggle_favourite_rows(rows, cx);
262+ }
263+
264+ /// The Favourite media action: the picked media.
265+ pub(crate) fn toggle_favourite_picked(&mut self, cx: &mut Context<Self>) {
266+ let rows = self.picked_assets();
267+ if rows.is_empty() {
268+ self.notify_user("No media is selected".into());
269+ cx.notify();
270+ return;
271+ }
272+ self.toggle_favourite_rows(rows, cx);
273+ }
274+
275+ /// The list of bins to file the picked media in, hung at `at`.
276+ pub(crate) fn bin_picker(&mut self, at: Point<Pixels>, cx: &mut Context<Self>) {
277+ self.picker_under(Pick::Bin, at, cx);
278+ }
279+
280+ /// [`Self::bin_picker`] from the palette: at the dock, for the picked media.
281+ pub(crate) fn bin_picker_here(&mut self, cx: &mut Context<Self>) {
282+ if self.picked_assets().is_empty() {
283+ self.notify_user("No media is selected".into());
284+ cx.notify();
285+ return;
286+ }
287+ self.bin_picker(point(px(24.), px(200.)), cx);
288+ }
289+
290+ /// The media list shows only the starred sources (`true`) or all of them.
291+ pub(crate) fn show_favourites(&mut self, only: bool, cx: &mut Context<Self>) {
292+ crate::ui::dock_stance::set_fav_only(only);
293+ cx.notify();
294+ }
295+
296+ /// The rows of the list `Pick::Bin` offers: "No bin", then every bin by its path, the one
297+ /// the first picked row is in marked.
298+ pub(crate) fn bin_choices(&self) -> Vec<ChoiceRow> {
299+ let Some(session) = &self.session else { return Vec::new() };
300+ let here = self
301+ .picked_assets()
302+ .first()
303+ .and_then(|(p, s)| session.sources().iter().find(|x| x.path == *p && x.audio_stream == *s))
304+ .map_or(0, |s| s.bin);
305+ let bins = session.bins();
306+ let path_of = |id: u32| {
307+ let b = bins.iter().find(|b| b.id == id);
308+ match b.map(|b| b.parent) {
309+ Some(p) if p != 0 => format!("{} / {}", bins.iter().find(|x| x.id == p).map_or("", |x| x.name.as_str()), b.map_or("", |b| b.name.as_str())),
310+ _ => b.map(|b| b.name.clone()).unwrap_or_default(),
311+ }
312+ };
313+ let mut ordered: Vec<&engine::Bin> = bins.iter().filter(|b| b.parent == 0).collect();
314+ let mut out = Vec::new();
315+ out.push((Choice::Bin(0), "No bin".into(), "top level".into(), here == 0));
316+ for top in ordered.drain(..) {
317+ out.push((Choice::Bin(top.id), top.name.clone().into(), "".into(), here == top.id));
318+ for child in bins.iter().filter(|b| b.parent == top.id) {
319+ out.push((Choice::Bin(child.id), path_of(child.id).into(), "".into(), here == child.id));
320+ }
321+ }
322+ out
323+ }
324+}
crates/app/src/player/blur.rsadded+237 -0
@@ -0,0 +1,237 @@
1+//! Leaving a text field: a click on anything that is not text, or a chord that is not a
2+//! text-editing one, takes the keyboard back to the room instead of letting the field keep it.
3+
4+use crate::*;
5+
6+/// Whether a stroke belongs to the app rather than to a field being typed into: any Ctrl or Alt
7+/// chord except the editing ones (Ctrl+A, C, V, X, Z on their own).
8+pub(crate) fn is_app_chord(key: &str, ctrl: bool, shift: bool, alt: bool) -> bool {
9+ if !ctrl && !alt {
10+ return false;
11+ }
12+ !(ctrl && !alt && !shift && matches!(key, "a" | "c" | "v" | "x" | "z"))
13+}
14+
15+/// Where a stroke goes while a text field is open: into the field, or out of it to the room's
16+/// keymap. Every stroke is the field's except an app chord (Ctrl+K, Alt+T, Ctrl+Y ...), and an
17+/// editing chord (Ctrl+A, C, V, X, Z) is the field's too.
18+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
19+pub(crate) enum Route {
20+ Field,
21+ Room,
22+}
23+
24+/// The dispatch rule for an open field: one place, so every field (current and future) takes its
25+/// keys the same way. A field that is not open never takes a stroke.
26+pub(crate) fn route(field_open: bool, key: &str, ctrl: bool, shift: bool, alt: bool) -> Route {
27+ match field_open && !is_app_chord(key, ctrl, shift, alt) {
28+ true => Route::Field,
29+ false => Route::Room,
30+ }
31+}
32+
33+/// Escape in a search box: clears the words when there are some (the box stays open for the next
34+/// words), and leaves the box when it is empty. Never passed on.
35+pub(crate) fn search_escape_clears(text: &str) -> bool {
36+ !text.is_empty()
37+}
38+
39+impl Player {
40+ /// Whether any text field (a rename, a path, a filter, a hex, a number) is taking keys.
41+ pub(crate) fn any_text_field(&self) -> bool {
42+ (self.export_open && self.export_sheet.field.is_some())
43+ || self.cue_edit.is_some()
44+ || self.cue_num.is_some()
45+ || self.still_num.is_some()
46+ || self.transition_edit.is_some()
47+ || self.marker_edit.is_some()
48+ || self.seq_edit.is_some()
49+ || self.title_draft.is_some()
50+ || self.title_hex.is_some()
51+ || self.gen_hex.is_some()
52+ || self.accent_hex.is_some()
53+ || self.lane_edit.is_some()
54+ || self.time_edit.is_some()
55+ || self.look_name.is_some()
56+ || self.bin_edit.is_some()
57+ || crate::ui::cards::numedit::typing()
58+ || self.tools.as_ref().is_some_and(|t| t.typing)
59+ || self.dock_filter_edit
60+ || self.transcript.search_edit
61+ }
62+
63+ /// The one door every open text field takes the keyboard through, ahead of the palette, the
64+ /// chords, the cards and the keymap. `true` when a field took the stroke; `false` when no
65+ /// field is open or an app chord left the field (the field is closed and the chord runs).
66+ pub(crate) fn text_field_key(&mut self, event: &KeyDownEvent, window: &mut Window, cx: &mut Context<Self>) -> bool {
67+ let key = event.keystroke.key.as_str();
68+ let (ctrl, shift, alt) = (event.keystroke.modifiers.control, event.keystroke.modifiers.shift, event.keystroke.modifiers.alt);
69+ let key_char = event.keystroke.key_char.as_deref();
70+ if route(self.any_text_field(), key, ctrl, shift, alt) == Route::Room {
71+ if self.any_text_field() {
72+ self.blur_text_fields(window, cx);
73+ }
74+ return false;
75+ }
76+ if self.export_open && self.export_sheet.field.is_some() {
77+ self.export_field_key(key, ctrl, alt, key_char, cx);
78+ } else if self.cue_edit.is_some() {
79+ self.cue_edit_key(key, ctrl, shift, alt, key_char, cx);
80+ } else if self.time_edit.is_some() {
81+ self.time_edit_key(key, ctrl, alt, key_char, cx);
82+ } else if self.look_name.is_some() {
83+ self.look_name_key(key, ctrl, alt, key_char, cx);
84+ } else if self.transition_edit.is_some() {
85+ self.transition_key(key, cx);
86+ } else if self.cue_num.is_some() {
87+ self.cue_num_key(key, ctrl, alt, key_char, cx);
88+ } else if self.still_num.is_some() {
89+ self.still_num_key(key, ctrl, alt, key_char, cx);
90+ } else if self.marker_edit.is_some() {
91+ self.marker_edit_key(key, ctrl, alt, key_char, cx);
92+ } else if self.seq_edit.is_some() {
93+ self.seq_edit_key(key, ctrl, alt, key_char, cx);
94+ } else if self.title_draft.is_some() || self.title_hex.is_some() {
95+ self.title_key(key, ctrl, shift, alt, key_char, cx);
96+ } else if self.gen_hex.is_some() {
97+ self.gen_key(key, ctrl, alt, key_char, cx);
98+ } else if self.accent_hex.is_some() {
99+ self.accent_key(key, ctrl, alt, key_char, cx);
100+ } else if self.lane_edit.is_some() {
101+ self.lane_edit_key(key, ctrl, alt, key_char, cx);
102+ } else if self.bin_edit.is_some() {
103+ self.bin_edit_key(key, ctrl, alt, key_char, cx);
104+ } else if crate::ui::cards::numedit::typing() {
105+ crate::ui::cards::numedit::key(self, key, ctrl, alt, key_char, cx);
106+ } else if self.tools.as_ref().is_some_and(|t| t.typing) {
107+ self.tools_type_key(key, ctrl, alt, key_char, cx);
108+ } else if self.dock_filter_edit {
109+ self.dock_filter_key(key, ctrl, alt, key_char, window, cx);
110+ } else if self.transcript.search_edit {
111+ self.transcript_key(key, ctrl, shift, alt, true, cx);
112+ }
113+ cx.notify();
114+ true
115+ }
116+
117+ /// The Sources search box: letters narrow the list, Escape clears the words and then leaves
118+ /// the box, and no stroke is passed on.
119+ fn dock_filter_key(
120+ &mut self,
121+ key: &str,
122+ ctrl: bool,
123+ alt: bool,
124+ key_char: Option<&str>,
125+ window: &mut Window,
126+ cx: &mut Context<Self>,
127+ ) {
128+ match key {
129+ "escape" if search_escape_clears(&self.dock_filter) => self.dock_filter.clear(),
130+ "escape" | "enter" => {
131+ self.dock_filter_edit = false;
132+ window.focus(&self.focus);
133+ }
134+ "backspace" => {
135+ self.dock_filter.pop();
136+ }
137+ _ => {
138+ if let Some(chars) = key_char.filter(|_| !ctrl && !alt) {
139+ self.dock_filter.extend(chars.chars().filter(|c| !c.is_control()));
140+ }
141+ }
142+ }
143+ cx.notify();
144+ }
145+
146+ /// Takes every open field's text as it stands and gives the keyboard back to the room. An
147+ /// export name or folder that is refused stays open with its note: the typed text is never
148+ /// dropped, and the export is blocked until it is fixed (see `commit_pending_field`).
149+ pub(crate) fn blur_text_fields(&mut self, window: &mut Window, cx: &mut Context<Self>) {
150+ if self.export_sheet.field.is_some() {
151+ self.commit_field();
152+ }
153+ if self.cue_edit.is_some() {
154+ self.commit_cue_edit(cx);
155+ self.cue_edit = None;
156+ }
157+ if self.marker_edit.is_some() {
158+ self.marker_edit_key("enter", false, false, None, cx);
159+ self.marker_edit = None;
160+ }
161+ if self.seq_edit.is_some() {
162+ self.seq_edit_key("enter", false, false, None, cx);
163+ self.seq_edit = None;
164+ }
165+ // A click away commits the words, as enter does: they are written as one undo step.
166+ if self.title_draft.is_some() || self.title_hex.is_some() {
167+ self.commit_title_draft(cx);
168+ self.title_hex = None;
169+ }
170+ if self.gen_hex.is_some() {
171+ self.gen_key("enter", false, false, None, cx);
172+ self.gen_hex = None;
173+ }
174+ self.commit_accent_hex(cx);
175+ if self.lane_edit.is_some() {
176+ self.lane_edit_key("enter", false, false, None, cx);
177+ self.lane_edit = None;
178+ }
179+ if self.bin_edit.is_some() {
180+ self.bin_edit_key("enter", false, false, None, cx);
181+ self.bin_edit = None;
182+ }
183+ // Go to time is cancelled by a click elsewhere: the click then does its own job (a
184+ // timeline click seeks), and nothing is typed into a time that was not entered.
185+ self.time_edit = None;
186+ // The look name stays open: its Save and Cancel buttons sit under the card, and a click on
187+ // Save must still find the name there.
188+ if let Some(t) = self.tools.as_mut() {
189+ t.typing = false;
190+ }
191+ self.dock_filter_edit = false;
192+ self.transcript.search_edit = false;
193+ window.focus(&self.focus);
194+ cx.notify();
195+ }
196+}
197+
198+#[cfg(test)]
199+mod tests {
200+ use super::*;
201+
202+ #[test]
203+ fn an_open_field_takes_every_stroke_but_an_app_chord() {
204+ // Letters, the arrows, Escape, Backspace and the editing chords are the field's.
205+ for key in ["f", "l", "backspace", "delete", "left", "home", "escape", "enter"] {
206+ assert_eq!(route(true, key, false, false, false), Route::Field, "{key}");
207+ }
208+ for key in ["a", "c", "v", "x", "z"] {
209+ assert_eq!(route(true, key, true, false, false), Route::Field, "ctrl+{key}");
210+ }
211+ // An app chord leaves the field and runs.
212+ assert_eq!(route(true, "k", true, false, false), Route::Room);
213+ assert_eq!(route(true, "t", false, false, true), Route::Room);
214+ assert_eq!(route(true, "y", true, false, false), Route::Room);
215+ // No open field: nothing is taken, so the room's keymap sees every stroke.
216+ assert_eq!(route(false, "f", false, false, false), Route::Room);
217+ assert_eq!(route(false, "a", true, false, false), Route::Room);
218+ }
219+
220+ #[test]
221+ fn escape_in_a_search_box_clears_words_first_and_only_then_leaves() {
222+ assert!(search_escape_clears("fractal"));
223+ assert!(!search_escape_clears(""));
224+ }
225+
226+ #[test]
227+ fn only_text_editing_chords_stay_with_a_field() {
228+ assert!(!is_app_chord("k", false, false, false));
229+ assert!(is_app_chord("k", true, false, false));
230+ assert!(is_app_chord("t", false, false, true));
231+ assert!(is_app_chord("z", true, true, false));
232+ assert!(is_app_chord("y", true, false, false));
233+ for k in ["a", "c", "v", "x", "z"] {
234+ assert!(!is_app_chord(k, true, false, false));
235+ }
236+ }
237+}
crates/app/src/player/caption_cues.rsadded+506 -0
@@ -0,0 +1,506 @@
1+//! Captions as blocks of their own on a subtitle lane, the way an NLE draws them: each cue is a
2+//! block with its words inside, a click picks that one cue, an edge drag trims it and a body drag
3+//! moves it between its neighbours, and a right-click opens the caption menu.
4+//!
5+//! The engine keeps the words on the **track** and a lane only holds windows of it
6+//! ([`engine::project::SubClip`]), so every edit here is a cue edit on the track
7+//! ([`PlaybackSession::set_cue_times`], [`PlaybackSession::merge_cue_next`],
8+//! [`PlaybackSession::split_cues_at`], [`PlaybackSession::delete_cue`]): one undo step each, and the
9+//! placement is never touched.
10+
11+use engine::PlaybackSession;
12+use engine::project::MIN_CUE_US;
13+
14+use crate::*;
15+
16+/// Which part of a cue block a drag holds.
17+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18+pub(crate) enum CueGrab {
19+ Start,
20+ End,
21+ Body,
22+}
23+
24+/// A caption being dragged. All times are on the track's own clock; the pointer is turned into
25+/// that clock through the placement that shows the cue ([`PlaybackSession::cue_track_us_at`]).
26+#[derive(Clone, Copy, Debug)]
27+pub(crate) struct CueDrag {
28+ pub(crate) lane: Lane,
29+ pub(crate) track: usize,
30+ pub(crate) cue: usize,
31+ pub(crate) grab: CueGrab,
32+ /// Where the pointer stood at the press.
33+ pub(crate) press_us: i64,
34+ /// The cue's times at the press, and as the drag has them now.
35+ pub(crate) orig: (i64, i64),
36+ pub(crate) now: (i64, i64),
37+ /// The neighbours' walls ([`PlaybackSession::cue_room`]).
38+ pub(crate) room: (i64, i64),
39+}
40+
41+/// A number of the caption panel: where the caption starts and ends on the timeline. Its length
42+/// is the difference of the two, so it only reads.
43+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
44+pub(crate) enum CueNum {
45+ Start,
46+ End,
47+}
48+
49+/// A panel number being dragged sideways: the number it is, where the drag began, the value it
50+/// has now, and whether the pointer has left the press. Written once on the release, so a scrub
51+/// is one undo step; a press that never moves is a click that types the number instead.
52+#[derive(Clone, Copy, Debug)]
53+pub(crate) struct CueNumScrub {
54+ pub(crate) which: CueNum,
55+ pub(crate) x0: f32,
56+ pub(crate) v0: i64,
57+ pub(crate) cur: i64,
58+ pub(crate) moved: bool,
59+}
60+
61+/// Seconds a panel number moves per pixel of drag (a fine drag, with shift, moves a tenth).
62+const CUE_NUM_SECS_PER_PX: f64 = 0.02;
63+
64+/// The value a panel number scrubs to: `v0` moved by `dx` pixels, on whole frames, inside the
65+/// range a caption can span (a frame, up to ten hours).
66+pub(crate) fn scrubbed_us(v0: i64, dx: f32, fine: bool, fps: f64) -> i64 {
67+ let fps = if fps.is_finite() && fps > 0. { fps } else { 25. };
68+ let secs = crate::ui::kit::scrub_value(v0 as f64 / 1e6, dx, CUE_NUM_SECS_PER_PX, fine, 0., 36_000.);
69+ ((secs * fps).round() / fps * 1e6).round() as i64
70+}
71+
72+/// The open caption menu: the cue it names and where the click was.
73+#[derive(Clone, Copy, Debug)]
74+pub(crate) struct CueMenu {
75+ pub(crate) lane: Lane,
76+ pub(crate) track: usize,
77+ pub(crate) cue: usize,
78+ pub(crate) at: Point<Pixels>,
79+}
80+
81+/// Where a drag leaves a cue: the edge in the hand follows `to`, a body keeps its length, and
82+/// every result stays inside `room` and at least [`MIN_CUE_US`] long.
83+pub(crate) fn dragged_times(grab: CueGrab, orig: (i64, i64), room: (i64, i64), press: i64, to: i64) -> (i64, i64) {
84+ match grab {
85+ CueGrab::Start => (to.clamp(room.0, (orig.1 - MIN_CUE_US).max(room.0)), orig.1),
86+ CueGrab::End => (orig.0, to.clamp((orig.0 + MIN_CUE_US).min(room.1), room.1)),
87+ CueGrab::Body => {
88+ let by = (to - press).clamp(room.0 - orig.0, room.1 - orig.1);
89+ (orig.0 + by, orig.1 + by)
90+ }
91+ }
92+}
93+
94+impl Player {
95+ /// The cue `(lane, track, cue)` if it is still there and a text one.
96+ fn cue_ref(&self, track: usize, cue: usize) -> Option<&engine::subtitle::Cue> {
97+ self.session.as_ref()?.subtitles().get(track)?.cues.get(cue)
98+ }
99+
100+ /// Lets go of the selected caption, and of what its panel was holding open.
101+ pub(crate) fn drop_sel_cue(&mut self) {
102+ self.sel_cue = None;
103+ self.cue_num = None;
104+ self.cue_num_scrub = None;
105+ if self.cue_edit.as_ref().is_some_and(|e| e.in_panel) {
106+ self.cue_edit = None;
107+ }
108+ }
109+
110+ /// Picks one cue: the placement's own selection goes, so the ring is on the one block.
111+ pub(crate) fn select_cue(&mut self, lane: Lane, track: usize, cue: usize, cx: &mut Context<Self>) {
112+ if self.lane_locked_refusal(lane) {
113+ return;
114+ }
115+ self.drop_title_selection(cx);
116+ self.selected.clear();
117+ self.gap = None;
118+ self.cue_menu = None;
119+ self.cue_num = None;
120+ self.cue_num_scrub = None;
121+ self.sel_cue = Some((lane, track, cue));
122+ cx.notify();
123+ }
124+
125+ /// The track's clock under window x, for the cue's placement, with the pointer snapped to
126+ /// whole frames (a cue edge lands on a frame, as every cut does).
127+ fn cue_us_under(&self, lane: Lane, track: usize, cue: usize, x: Pixels) -> Option<i64> {
128+ let secs = self.scale.time_at(px_along(x, self.ruler.get()));
129+ let tl_us = ((secs * self.fps).round() / self.fps * 1e6).round() as i64;
130+ self.session.as_ref()?.cue_track_us_at(lane, track, cue, tl_us)
131+ }
132+
133+ /// A press on a cue's edge or body: picks it and arms the drag. Nothing is written until the
134+ /// release, and a press that never moves is only the pick.
135+ pub(crate) fn start_cue_drag(
136+ &mut self,
137+ lane: Lane,
138+ track: usize,
139+ cue: usize,
140+ grab: CueGrab,
141+ x: Pixels,
142+ cx: &mut Context<Self>,
143+ ) {
144+ if self.covers_room() || self.exporting().is_some() || self.lane_locked_refusal(lane) {
145+ return;
146+ }
147+ let Some(c) = self.cue_ref(track, cue).filter(|c| c.image.is_none()) else {
148+ return;
149+ };
150+ let orig = (c.start_us, c.end_us);
151+ let Some(room) = self.session.as_ref().and_then(|s| s.cue_room(track, cue)) else {
152+ return;
153+ };
154+ let press_us = self.cue_us_under(lane, track, cue, x).unwrap_or(orig.0);
155+ self.select_cue(lane, track, cue, cx);
156+ self.cue_drag = Some(CueDrag { lane, track, cue, grab, press_us, orig, now: orig, room });
157+ cx.notify();
158+ }
159+
160+ /// The pointer moved with a cue held.
161+ pub(crate) fn cue_drag_to(&mut self, x: Pixels, cx: &mut Context<Self>) {
162+ let Some(drag) = self.cue_drag else {
163+ return;
164+ };
165+ let Some(to) = self.cue_us_under(drag.lane, drag.track, drag.cue, x) else {
166+ return;
167+ };
168+ let now = dragged_times(drag.grab, drag.orig, drag.room, drag.press_us, to);
169+ if now != drag.now {
170+ self.cue_drag = Some(CueDrag { now, ..drag });
171+ cx.notify();
172+ }
173+ }
174+
175+ /// The release: the whole drag reaches the engine as one edit, so it is one undo step.
176+ pub(crate) fn commit_cue_drag(&mut self, cx: &mut Context<Self>) {
177+ let Some(drag) = self.cue_drag.take() else {
178+ return;
179+ };
180+ if drag.now != drag.orig
181+ && let Some(session) = self.session.as_mut()
182+ {
183+ match session.set_cue_times(drag.track, drag.cue, drag.now.0, drag.now.1) {
184+ Ok(true) => self.mark_dirty(),
185+ Ok(false) => {}
186+ Err(e) => self.notify_user(format!("Caption not changed — {e}").into()),
187+ }
188+ }
189+ cx.notify();
190+ }
191+
192+ /// The times a cue is drawn at while it is being dragged, if it is the one.
193+ pub(crate) fn dragged_cue(&self, track: usize, cue: usize) -> Option<CueDrag> {
194+ self.cue_drag.filter(|d| (d.track, d.cue) == (track, cue))
195+ }
196+
197+ /// The selected caption's own numbers on the timeline: `(start, end)` in microseconds, through
198+ /// the placement that shows it. `None` when the selection no longer names a shown caption.
199+ pub(crate) fn sel_cue_span(&self) -> Option<(Lane, usize, usize, i64, i64)> {
200+ let (lane, track, cue) = self.sel_cue?;
201+ let span = self
202+ .session
203+ .as_ref()?
204+ .sub_lane_cue_spans(lane)
205+ .into_iter()
206+ .find(|s| s.track == track && s.cue == cue)?;
207+ Some((lane, track, cue, span.start_us, span.end_us))
208+ }
209+
210+ /// The caption panel's text field was pressed: the words open for typing in the panel.
211+ pub(crate) fn open_panel_cue_edit(&mut self, cx: &mut Context<Self>) {
212+ let Some((lane, track, cue)) = self.sel_cue else {
213+ return;
214+ };
215+ if self.cue_edit.as_ref().is_some_and(|e| (e.track, e.cue) == (track, cue)) {
216+ return;
217+ }
218+ self.cue_edit = None;
219+ self.open_cue_edit(lane, track, cue, cx);
220+ if let Some(edit) = self.cue_edit.as_mut() {
221+ edit.in_panel = true;
222+ }
223+ }
224+
225+ /// A number of the panel was pressed: it opens for typing on what it shows.
226+ pub(crate) fn begin_cue_num(&mut self, which: CueNum, cx: &mut Context<Self>) {
227+ self.commit_cue_edit(cx);
228+ let Some((_, _, _, start, end)) = self.sel_cue_span() else {
229+ return;
230+ };
231+ let us = match which {
232+ CueNum::Start => start,
233+ CueNum::End => end,
234+ };
235+ self.cue_num = Some((which, crate::ui::kit::NumberEdit::begin(&cue_secs(us))));
236+ cx.notify();
237+ }
238+
239+ /// A panel number was pressed for a drag: the number follows the pointer sideways until the
240+ /// button comes up ([`Player::cue_num_scrub_end`]). Nothing is written before the release.
241+ pub(crate) fn begin_cue_num_scrub(&mut self, which: CueNum, x: f32, cx: &mut Context<Self>) {
242+ self.commit_cue_edit(cx);
243+ let Some((lane, _, _, start, end)) = self.sel_cue_span() else {
244+ return;
245+ };
246+ if self.session.as_ref().is_some_and(|s| s.lane_locked(lane)) {
247+ return;
248+ }
249+ let v0 = match which {
250+ CueNum::Start => start,
251+ CueNum::End => end,
252+ };
253+ self.cue_num_scrub = Some(CueNumScrub { which, x0: x, v0, cur: v0, moved: false });
254+ cx.notify();
255+ }
256+
257+ /// The pointer moved with a panel number held: the number shows the value it would take.
258+ pub(crate) fn cue_num_scrub_move(&mut self, x: f32, fine: bool, cx: &mut Context<Self>) {
259+ let Some(s) = self.cue_num_scrub else {
260+ return;
261+ };
262+ let dx = x - s.x0;
263+ let cur = scrubbed_us(s.v0, dx, fine, self.fps);
264+ let moved = s.moved || dx.abs() > 3.;
265+ if cur != s.cur || moved != s.moved {
266+ self.cue_num_scrub = Some(CueNumScrub { cur, moved, ..s });
267+ cx.notify();
268+ }
269+ }
270+
271+ /// The button came up over a panel number: a drag that moved is written as one cue edit.
272+ /// A press that never moved is left to the field's click, which types it. `true` when a
273+ /// scrub was in flight, so the release goes no further.
274+ pub(crate) fn cue_num_scrub_end(&mut self, cx: &mut Context<Self>) -> bool {
275+ let Some(s) = self.cue_num_scrub.take() else {
276+ return false;
277+ };
278+ if s.moved && s.cur != s.v0 {
279+ self.set_cue_num(s.which, s.cur, cx);
280+ } else {
281+ cx.notify();
282+ }
283+ true
284+ }
285+
286+ /// Escape while a caption's words are typed: they are given up, as a title's are, so the old
287+ /// words stay and a toast says so. `false` when no words were being typed.
288+ pub(crate) fn escape_cue_edit(&mut self) -> bool {
289+ if self.cue_edit.take().is_none() {
290+ return false;
291+ }
292+ self.notify_user("Caption edit cancelled".into());
293+ true
294+ }
295+
296+ /// The keyboard while a caption's words are typed, in the box over its block or in the Clip
297+ /// tab's panel: enter saves, shift+enter starts a new line, escape gives up, Ctrl+A selects the
298+ /// words, and the rest is text.
299+ pub(crate) fn cue_edit_key(&mut self, key: &str, ctrl: bool, shift: bool, alt: bool, key_char: Option<&str>, cx: &mut Context<Self>) {
300+ match key {
301+ "escape" => {
302+ self.escape_cue_edit();
303+ }
304+ "enter" if shift => {
305+ if let Some(edit) = self.cue_edit.as_mut() {
306+ edit.newline();
307+ }
308+ }
309+ "enter" => self.commit_cue_edit(cx),
310+ "backspace" => {
311+ if let Some(edit) = self.cue_edit.as_mut() {
312+ edit.backspace();
313+ }
314+ }
315+ "a" if ctrl && !alt => {
316+ if let Some(edit) = self.cue_edit.as_mut() {
317+ edit.select_all();
318+ }
319+ }
320+ _ => {
321+ // The character the layout made, not the key's name: a non-ASCII letter has no
322+ // key name. A chord with ctrl or alt is not a letter.
323+ if !ctrl
324+ && !alt
325+ && let Some(edit) = self.cue_edit.as_mut()
326+ && let Some(chars) = key_char
327+ {
328+ for c in chars.chars() {
329+ edit.typed(c);
330+ }
331+ }
332+ }
333+ }
334+ cx.notify();
335+ }
336+
337+ /// One key while a panel number is typed: Enter writes it, Escape drops it.
338+ pub(crate) fn cue_num_key(&mut self, key: &str, ctrl: bool, alt: bool, key_char: Option<&str>, cx: &mut Context<Self>) {
339+ use crate::player::text_field::FieldKey;
340+ let Some((which, mut edit)) = self.cue_num.take() else {
341+ return;
342+ };
343+ if self.sel_cue.is_none() {
344+ return cx.notify();
345+ }
346+ match edit.key(key, ctrl, alt, key_char) {
347+ FieldKey::Edited => self.cue_num = Some((which, edit)),
348+ FieldKey::Cancel => {}
349+ FieldKey::Commit => {
350+ if let Some(secs) = edit.commit(0., 36_000.) {
351+ self.set_cue_num(which, (secs * 1e6).round() as i64, cx);
352+ }
353+ }
354+ }
355+ cx.notify();
356+ }
357+
358+ /// Writes one panel number as one cue edit: the times are the timeline's, turned into the
359+ /// track's clock, and kept inside the neighbours and at least [`MIN_CUE_US`] long.
360+ pub(crate) fn set_cue_num(&mut self, which: CueNum, us: i64, cx: &mut Context<Self>) {
361+ let Some((lane, track, cue, _, _)) = self.sel_cue_span() else {
362+ return;
363+ };
364+ if self.lane_locked_refusal(lane) {
365+ return;
366+ }
367+ let Some(session) = self.session.as_ref() else {
368+ return;
369+ };
370+ let Some(room) = session.cue_room(track, cue) else {
371+ return;
372+ };
373+ let Some(c) = self.cue_ref(track, cue).filter(|c| c.image.is_none()) else {
374+ return;
375+ };
376+ let (s0, e0) = (c.start_us, c.end_us);
377+ let to_track = |tl: i64| session.cue_track_us_at(lane, track, cue, tl).unwrap_or(tl);
378+ let (s, e) = match which {
379+ CueNum::Start => (to_track(us).clamp(room.0, (e0 - MIN_CUE_US).max(room.0)), e0),
380+ CueNum::End => (s0, to_track(us).clamp((s0 + MIN_CUE_US).min(room.1), room.1)),
381+ };
382+ if (s, e) == (s0, e0) {
383+ return;
384+ }
385+ if let Some(session) = self.session.as_mut() {
386+ match session.set_cue_times(track, cue, s, e) {
387+ Ok(true) => self.mark_dirty(),
388+ Ok(false) => {}
389+ Err(e) => self.notify_user(format!("Caption not changed — {e}").into()),
390+ }
391+ }
392+ cx.notify();
393+ }
394+
395+ /// Opens the caption menu on a cue (a right-click on its block).
396+ pub(crate) fn open_cue_menu(&mut self, lane: Lane, track: usize, cue: usize, at: Point<Pixels>, cx: &mut Context<Self>) {
397+ if !self.menu_allowed() || self.lane_locked_refusal(lane) {
398+ return;
399+ }
400+ self.context_menu = None;
401+ self.drop_title_selection(cx);
402+ self.sel_cue = Some((lane, track, cue));
403+ self.selected.clear();
404+ self.gap = None;
405+ self.cue_menu = Some(CueMenu { lane, track, cue, at });
406+ cx.notify();
407+ }
408+
409+ /// Why Split at playhead cannot run on this cue, if it cannot.
410+ pub(crate) fn cue_split_why(&self, m: CueMenu) -> Option<&'static str> {
411+ let session = self.session.as_ref()?;
412+ let c = self.cue_ref(m.track, m.cue)?;
413+ if c.image.is_some() {
414+ return Some("A picture caption cannot be split");
415+ }
416+ let at = session.cue_track_us_at(m.lane, m.track, m.cue, (session.now() * 1e6).round() as i64);
417+ match at {
418+ Some(t) if c.start_us < t && t < c.end_us => None,
419+ _ => Some("Move the playhead onto this caption first"),
420+ }
421+ }
422+
423+ /// Why Merge with next cannot run on this cue, if it cannot.
424+ pub(crate) fn cue_merge_why(&self, m: CueMenu) -> Option<&'static str> {
425+ let cues = &self.session.as_ref()?.subtitles().get(m.track)?.cues;
426+ match (cues.get(m.cue), cues.get(m.cue + 1)) {
427+ (Some(a), Some(b)) if a.image.is_none() && b.image.is_none() => None,
428+ (Some(a), Some(_)) if a.image.is_some() => Some("A picture caption cannot be merged"),
429+ _ => Some("This is the last caption"),
430+ }
431+ }
432+
433+ /// Splits the cue at the playhead.
434+ pub(crate) fn split_cue_at_playhead(&mut self, m: CueMenu, cx: &mut Context<Self>) {
435+ self.cue_menu = None;
436+ if let Some(why) = self.cue_split_why(m) {
437+ self.notify_user(why.into());
438+ return cx.notify();
439+ }
440+ let Some(session) = self.session.as_mut() else {
441+ return;
442+ };
443+ let now = (session.now() * 1e6).round() as i64;
444+ if let Some(t) = session.cue_track_us_at(m.lane, m.track, m.cue, now)
445+ && session.split_cues_at(m.track, t)
446+ {
447+ self.sel_cue = Some((m.lane, m.track, m.cue));
448+ self.mark_dirty();
449+ } else {
450+ self.notify_user("Not split — a caption needs a word on each side".into());
451+ }
452+ cx.notify();
453+ }
454+
455+ /// Joins the cue with the next one.
456+ pub(crate) fn merge_cue_with_next(&mut self, m: CueMenu, cx: &mut Context<Self>) {
457+ self.cue_menu = None;
458+ let Some(session) = self.session.as_mut() else {
459+ return;
460+ };
461+ match session.merge_cue_next(m.track, m.cue) {
462+ Ok(()) => self.mark_dirty(),
463+ Err(e) => self.notify_user(format!("Not merged — {e}").into()),
464+ }
465+ cx.notify();
466+ }
467+
468+ /// Takes the cue out of its track.
469+ pub(crate) fn delete_cue_at(&mut self, m: CueMenu, cx: &mut Context<Self>) {
470+ self.cue_menu = None;
471+ if self.lane_locked_refusal(m.lane) {
472+ return;
473+ }
474+ if let Some(session) = self.session.as_mut()
475+ && PlaybackSession::delete_cue(session, m.track, m.cue)
476+ {
477+ self.drop_sel_cue();
478+ self.mark_dirty();
479+ }
480+ cx.notify();
481+ }
482+}
483+
484+/// Seconds as the panel's fields show them: two places.
485+pub(crate) fn cue_secs(us: i64) -> String {
486+ format!("{:.2}", us as f64 / 1e6)
487+}
488+
489+#[cfg(test)]
490+mod tests {
491+ use super::*;
492+
493+ #[test]
494+ fn a_dragged_cue_stays_inside_its_neighbours_and_keeps_its_length() {
495+ let (orig, room) = ((3_000_000, 5_000_000), (2_000_000, 6_000_000));
496+ // An edge stops at the neighbour and at the other edge less the minimum.
497+ assert_eq!(dragged_times(CueGrab::Start, orig, room, 0, 1_000_000), (2_000_000, 5_000_000));
498+ assert_eq!(dragged_times(CueGrab::Start, orig, room, 0, 9_000_000), (5_000_000 - MIN_CUE_US, 5_000_000));
499+ assert_eq!(dragged_times(CueGrab::End, orig, room, 0, 9_000_000), (3_000_000, 6_000_000));
500+ assert_eq!(dragged_times(CueGrab::End, orig, room, 0, 0), (3_000_000, 3_000_000 + MIN_CUE_US));
501+ // A body moves as a whole and stops when either end meets a wall.
502+ assert_eq!(dragged_times(CueGrab::Body, orig, room, 4_000_000, 4_500_000), (3_500_000, 5_500_000));
503+ assert_eq!(dragged_times(CueGrab::Body, orig, room, 4_000_000, 9_000_000), (4_000_000, 6_000_000));
504+ assert_eq!(dragged_times(CueGrab::Body, orig, room, 4_000_000, 0), (2_000_000, 4_000_000));
505+ }
506+}
crates/app/src/player/cards.rsmodified+2605 -285

Diff too large; view file

@@ -1,38 +1,474 @@
1 //! The cards the window opens over itself: the pickers, colour, speed,1 //! The cards the window opens over itself: the pickers, colour, speed,
2 //! silence, the mixer and the equalizer.2 //! silence, the mixer and the equalizer.
3 3
4+use crate::player::project_dialogs::PathFor;
4 use crate::ui::settings_stance::SettingsTab;5 use crate::ui::settings_stance::SettingsTab;
5 use crate::*;6 use crate::*;
7+use engine::project::KeyKind;
8+use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
9+use std::sync::{Arc, Mutex};
6 10
7-impl Player {11+/// An auto reframe being measured on a thread ([`Player::start_reframe`]).
8- /// Cycles the *project's* resolution through [`RESOLUTIONS`], starting from12+pub(crate) struct ReframeRun {
9- /// the media's own -- the one size that must stay reachable, since a project13+ lane: Lane,
10- /// moved off it has no other way back (the resolution is not an undo step).14+ idx: usize,
11- /// Every clip is recomposed onto it, so this is what makes "the project15+ job: engine::reframe::ReframeJob,
12- /// resolution and the media's are different things" a thing a user can see.16+ progress: Arc<AtomicU32>,
13- pub(crate) fn cycle_resolution(&mut self, cx: &mut Context<Self>) {17+ cancel: Arc<AtomicBool>,
14- if self.exporting().is_some() {18+ result: Arc<Mutex<Option<Result<engine::reframe::Subject, String>>>>,
19+}
20+
21+/// The transform card's More fold: the crop rows live under it, closed by
22+/// default and remembered per panel like every other fold.
23+pub(crate) const TRANSFORM_CROP_FOLD: &str = "transform-crop";
24+
25+/// How many transform rows sit above the crop fold: Position X and Y, Scale
26+/// and Rotation. The crop rows are the bands after them.
27+pub(crate) const TRANSFORM_MAIN_BANDS: usize = 4;
28+
29+/// A keyboard nudge on a position row, in canvas pixels.
30+pub(crate) const POSITION_NUDGE_PX: f32 = 10.;
31+/// The scale a picture in picture takes: the Place row's corner pick, and the
32+/// Picture in picture button, both put a full-size clip at this size.
33+pub(crate) const PIP_SCALE: f32 = 0.3;
34+
35+/// Position X and Y, the first two transform rows. The engine keeps them as a
36+/// fraction of the canvas, so the card reads and drags them in pixels.
37+pub(crate) fn is_position_band(band: usize) -> bool {
38+ band < 2
39+}
40+
41+/// The canvas span a position band's fraction is taken over: the width for X,
42+/// the height for Y.
43+fn position_span(band: usize, canvas: (u32, u32)) -> f32 {
44+ if band == 0 { canvas.0 } else { canvas.1 }.max(1) as f32
45+}
46+
47+/// A position on its whole-pixel grid, clamped to the band's range. A drag and
48+/// a readout agree on the pixel the picture lands on, not a 5% step.
49+pub(crate) fn snap_position_px(band: usize, value: f32, canvas: (u32, u32)) -> f32 {
50+ let (_, low, high) = TRANSFORM_BANDS[band];
51+ let span = position_span(band, canvas);
52+ ((value * span).round() / span).clamp(low, high)
53+}
54+
55+/// What an apply acts on: the previewed regions and the lanes they reach.
56+type Previewed = (Vec<(u32, u32)>, Vec<Lane>);
57+/// Where a slider bar was last laid out, read back by its drag handler.
58+type BarCell = Rc<Cell<Bounds<Pixels>>>;
59+
60+/// The quietest a meter shows, in dBFS: the bottom of its bar.
61+pub(crate) const METER_FLOOR_DB: f32 = -60.;
62+/// How fast a meter falls back once the sound drops, in dB a second.
63+const METER_FALL_DB_PER_S: f32 = 20.;
64+/// How long a peak marker holds before it starts to fall.
65+const METER_HOLD_S: f32 = 1.;
66+/// A pause between two reads longer than this (a stalled window, a sleep) is
67+/// counted as this long, so the meters do not fall through the floor at once.
68+const METER_MAX_DT_S: f32 = 0.25;
69+
70+/// dBFS of a linear peak, floored at [`METER_FLOOR_DB`].
71+pub(crate) fn meter_db(peak: f32) -> f32 {
72+ match peak > 0. {
73+ true => (20. * peak.log10()).max(METER_FLOOR_DB),
74+ false => METER_FLOOR_DB,
75+ }
76+}
77+
78+/// One level meter: how loud the sound is now, and the marker that holds the
79+/// loudest it has been for [`METER_HOLD_S`]. Attacks at once and falls at a
80+/// fixed rate, so a short peak reads, and a steady one reads as steady.
81+#[derive(Clone, Copy, Debug, PartialEq)]
82+pub(crate) struct MixMeter {
83+ /// dBFS, at or above [`METER_FLOOR_DB`].
84+ pub(crate) level_db: f32,
85+ /// dBFS of the held marker.
86+ pub(crate) hold_db: f32,
87+ /// When the marker last rose; `None` before its first reading.
88+ held_at: Option<Instant>,
89+ /// When this meter was last read, for the fall between two reads.
90+ read_at: Option<Instant>,
91+}
92+
93+impl Default for MixMeter {
94+ /// Silent, with nothing held.
95+ fn default() -> Self {
96+ Self {
97+ level_db: METER_FLOOR_DB,
98+ hold_db: METER_FLOOR_DB,
99+ held_at: None,
100+ read_at: None,
101+ }
102+ }
103+}
104+
105+impl MixMeter {
106+ /// Takes one reading: `peak` is the linear level the sound reached since
107+ /// the last read ([`engine::Levels`]), `now` when it was read.
108+ pub(crate) fn feed(&mut self, peak: f32, now: Instant) {
109+ let peak_db = meter_db(peak);
110+ let dt = self
111+ .read_at
112+ .map_or(0., |at| now.saturating_duration_since(at).as_secs_f32())
113+ .min(METER_MAX_DT_S);
114+ self.read_at = Some(now);
115+ self.level_db = fall(self.level_db, peak_db, dt);
116+ if peak_db >= self.hold_db {
117+ self.hold_db = peak_db;
118+ self.held_at = Some(now);
119+ } else if self
120+ .held_at
121+ .is_none_or(|at| now.saturating_duration_since(at).as_secs_f32() >= METER_HOLD_S)
122+ {
123+ self.hold_db = fall(self.hold_db, peak_db, dt);
124+ }
125+ }
126+
127+ /// Back to silence: what a paused or stopped meter shows.
128+ pub(crate) fn reset(&mut self) {
129+ *self = Self::default();
130+ }
131+}
132+
133+/// `shown` after `dt` seconds with `peak` read: it rises at once to `peak` and
134+/// otherwise falls at [`METER_FALL_DB_PER_S`], never below `peak`.
135+fn fall(shown: f32, peak: f32, dt: f32) -> f32 {
136+ match peak >= shown {
137+ true => peak,
138+ false => (shown - METER_FALL_DB_PER_S * dt).max(peak),
139+ }
140+}
141+
142+/// The shortest time between two reads of the transport's master meter: 30 Hz is plenty for a
143+/// bar and keeps the engine's peaks (and the repaint they cost) off the per-frame path.
144+pub(crate) const MASTER_METER_EVERY_S: f32 = 1. / 30.;
145+/// How long the clip lamp stays lit after a sample reached full scale.
146+pub(crate) const CLIP_LAMP_S: f32 = 3.;
147+/// A linear peak this high is a clipped sample (0 dBFS, with a hair of float slack).
148+pub(crate) const CLIP_PEAK: f32 = 0.999;
149+
150+/// The transport's stereo master meter: a [`MixMeter`] per side, read at most
151+/// [`MASTER_METER_EVERY_S`] apart, and the clip lamp's latch.
152+#[derive(Default)]
153+pub(crate) struct MasterMeter {
154+ pub(crate) lr: [MixMeter; 2],
155+ read_at: Option<Instant>,
156+ clip_at: Option<Instant>,
157+}
158+
159+impl MasterMeter {
160+ /// One frame's step. Playing, it reads `peaks` (left, right) if the last read was long enough
161+ /// ago -- otherwise it leaves them in the engine to pile up for the next read -- and lights
162+ /// the lamp for a clipped peak. Not playing, everything falls to silence at once.
163+ pub(crate) fn step(&mut self, playing: bool, peaks: impl FnOnce() -> [f32; 2], now: Instant) {
164+ if !playing {
165+ *self = Self::default();
15 return;166 return;
16 }167 }
17- let Some(session) = &mut self.session else {168+ if self
18- // No media yet to derive a "native" size from: cycle the plain169+ .read_at
19- // list and hold the pick until the first file opens170+ .is_some_and(|at| now.saturating_duration_since(at).as_secs_f32() < MASTER_METER_EVERY_S)
20- // ([`Player::install_media`]), the same way a size picked from171+ {
21- // the list does ([`apply_resolution`](Self::apply_resolution)).
22- let at = self
23- .pending_settings
24- .0
25- .and_then(|c| RESOLUTIONS.iter().position(|&s| s == c));
26- let (w, h) = RESOLUTIONS[at.map_or(0, |at| (at + 1) % RESOLUTIONS.len())];
27- self.apply_resolution(w, h, cx);
28 return;172 return;
29- };173+ }
30- let (width, height) = next_resolution(session.resolution(), session.native_resolution());174+ self.read_at = Some(now);
31- self.apply_resolution(width, height, cx);175+ let peaks = peaks();
176+ for (meter, peak) in self.lr.iter_mut().zip(peaks) {
177+ meter.feed(peak, now);
178+ }
179+ if peaks.iter().any(|&p| p >= CLIP_PEAK) {
180+ self.clip_at = Some(now);
181+ }
182+ }
183+
184+ /// Whether the clip lamp is lit at `now`.
185+ pub(crate) fn clipped(&self, now: Instant) -> bool {
186+ self.clip_at
187+ .is_some_and(|at| now.saturating_duration_since(at).as_secs_f32() < CLIP_LAMP_S)
188+ }
189+}
190+
191+/// The mix card's own state between frames: the meters it reads and the bars
192+/// its sliders are read against. Behind a `RefCell` on [`Player`], because the
193+/// card draws from `&self` and a meter has to be read at the moment it is drawn.
194+#[derive(Default)]
195+pub(crate) struct MixPanel {
196+ meters: Vec<(Lane, MixMeter)>,
197+ master: MixMeter,
198+ master_meter: MasterMeter,
199+ gain_bars: Vec<(Lane, Rc<Cell<Bounds<Pixels>>>)>,
200+ /// The selected clip's volume bar.
201+ pub(crate) clip_bar: Rc<Cell<Bounds<Pixels>>>,
202+ /// The selected clip's pitch track.
203+ pub(crate) pitch_bar: Rc<Cell<Bounds<Pixels>>>,
204+ ceiling_bar: Rc<Cell<Bounds<Pixels>>>,
205+ /// The bars of the voice-dynamics sliders, one per lane and setting.
206+ voice_bars: Vec<((Lane, VoiceParam), BarCell)>,
207+ /// The lanes whose dynamics section is unfolded. Folded is the default: a
208+ /// strip is a fader first.
209+ voice_open: Vec<Lane>,
210+}
211+
212+/// One of a lane's voice processors ([`engine::voice`]).
213+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
214+pub(crate) enum VoiceProc {
215+ Gate,
216+ Nr,
217+ Comp,
218+ Deess,
219+}
220+
221+impl VoiceProc {
222+ pub(crate) const ALL: [VoiceProc; 4] = [Self::Gate, Self::Nr, Self::Comp, Self::Deess];
223+
224+ pub(crate) fn label(self) -> &'static str {
225+ match self {
226+ Self::Gate => "Gate",
227+ Self::Nr => "Noise reduction",
228+ Self::Comp => "Compressor",
229+ Self::Deess => "De-esser",
230+ }
231+ }
232+
233+ pub(crate) fn is_on(self, fx: &engine::voice::VoiceFx) -> bool {
234+ match self {
235+ Self::Gate => fx.gate.on,
236+ Self::Nr => fx.nr.on,
237+ Self::Comp => fx.comp.on,
238+ Self::Deess => fx.deess.on,
239+ }
240+ }
241+
242+ /// The sliders that belong to this processor.
243+ pub(crate) fn params(self) -> &'static [VoiceParam] {
244+ match self {
245+ Self::Gate => &[VoiceParam::GateThreshold],
246+ Self::Nr => &[VoiceParam::NrStrength],
247+ Self::Comp => &[
248+ VoiceParam::CompThreshold,
249+ VoiceParam::CompRatio,
250+ VoiceParam::CompMakeup,
251+ ],
252+ Self::Deess => &[VoiceParam::DeessThreshold, VoiceParam::DeessAmount],
253+ }
254+ }
255+}
256+
257+/// One slider of the dynamics section.
258+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
259+pub(crate) enum VoiceParam {
260+ GateThreshold,
261+ NrStrength,
262+ CompThreshold,
263+ CompRatio,
264+ CompMakeup,
265+ DeessThreshold,
266+ DeessAmount,
267+}
268+
269+impl VoiceParam {
270+ pub(crate) fn label(self) -> &'static str {
271+ match self {
272+ Self::GateThreshold | Self::CompThreshold | Self::DeessThreshold => "Threshold",
273+ Self::NrStrength => "Strength",
274+ Self::CompRatio => "Ratio",
275+ Self::CompMakeup => "Makeup",
276+ Self::DeessAmount => "Amount",
277+ }
278+ }
279+
280+ /// The range the slider spans and the step a value snaps to.
281+ pub(crate) fn range(self) -> (f32, f32, f32) {
282+ match self {
283+ Self::GateThreshold => (-80., -10., 1.),
284+ Self::NrStrength | Self::DeessAmount => (0., 1., 0.05),
285+ Self::CompThreshold | Self::DeessThreshold => (-60., 0., 1.),
286+ Self::CompRatio => (1., 10., 0.5),
287+ Self::CompMakeup => (0., 18., 0.5),
288+ }
289+ }
290+
291+ pub(crate) fn get(self, fx: &engine::voice::VoiceFx) -> f32 {
292+ match self {
293+ Self::GateThreshold => fx.gate.threshold_db,
294+ Self::NrStrength => fx.nr.strength,
295+ Self::CompThreshold => fx.comp.threshold_db,
296+ Self::CompRatio => fx.comp.ratio,
297+ Self::CompMakeup => fx.comp.makeup(),
298+ Self::DeessThreshold => fx.deess.threshold_db,
299+ Self::DeessAmount => fx.deess.amount,
300+ }
301+ }
302+
303+ /// Writes `v` snapped to the step. A makeup typed by hand turns the
304+ /// automatic makeup off, as the MCP op does.
305+ pub(crate) fn set(self, fx: &mut engine::voice::VoiceFx, v: f32) {
306+ let (lo, hi, step) = self.range();
307+ let v = ((v.clamp(lo, hi) / step).round() * step).clamp(lo, hi);
308+ match self {
309+ Self::GateThreshold => fx.gate.threshold_db = v,
310+ Self::NrStrength => fx.nr.strength = v,
311+ Self::CompThreshold => fx.comp.threshold_db = v,
312+ Self::CompRatio => fx.comp.ratio = v,
313+ Self::CompMakeup => {
314+ fx.comp.makeup_db = v;
315+ fx.comp.auto_makeup = false;
316+ }
317+ Self::DeessThreshold => fx.deess.threshold_db = v,
318+ Self::DeessAmount => fx.deess.amount = v,
319+ }
320+ }
321+
322+ pub(crate) fn text(self, v: f32) -> String {
323+ match self {
324+ Self::GateThreshold | Self::CompThreshold | Self::DeessThreshold => {
325+ format!("{v:.0} dB")
326+ }
327+ Self::NrStrength | Self::DeessAmount => format!("{:.0}%", v * 100.),
328+ Self::CompRatio => format!("{v:.1}:1"),
329+ Self::CompMakeup => format!("{v:+.1} dB"),
330+ }
331+ }
332+}
333+
334+/// One audio lane as the card draws it this frame.
335+pub(crate) struct MixStrip {
336+ pub(crate) lane: Lane,
337+ pub(crate) meter: MixMeter,
338+ pub(crate) bar: Rc<Cell<Bounds<Pixels>>>,
339+}
340+
341+/// The mix card's readings for one frame.
342+pub(crate) struct MixReading {
343+ pub(crate) strips: Vec<MixStrip>,
344+ pub(crate) master: MixMeter,
345+ pub(crate) ceiling_bar: Rc<Cell<Bounds<Pixels>>>,
346+}
347+
348+/// The slider a mix drag is moving: a track's fader or the limiter's ceiling.
349+#[derive(Clone, Copy, Debug, PartialEq)]
350+pub(crate) enum MixDrag {
351+ Gain(Lane),
352+ /// The selected clip's own volume ([`PlaybackSession::set_clip_gain`]).
353+ Clip(Lane, usize),
354+ /// The selected clip's pitch in semitones ([`PlaybackSession::set_clip_pitch`]).
355+ Pitch(Lane, usize),
356+ Ceiling,
357+ Voice(Lane, VoiceParam),
358+}
359+
360+/// The pointer's place along a slider's bar, 0..1, or `None` when the bar has
361+/// not been drawn yet.
362+pub(crate) fn bar_fraction(bar: Bounds<Pixels>, x: Pixels) -> Option<f32> {
363+ (bar.size.width > px(0.)).then(|| frac_along(x, bar))
364+}
365+
366+/// A value on a range, from its place along the slider.
367+pub(crate) fn value_at(fraction: f32, lo: f32, hi: f32) -> f32 {
368+ lo + fraction.clamp(0., 1.) * (hi - lo)
369+}
370+
371+/// Where a track's gain sits on its fader, 0..1. The working range, -24..+12 dB, takes the
372+/// most of the travel (80%); the quiet tail down to -60 dB takes the rest, so a drag near a
373+/// working level moves the gain in fine steps.
374+const GAIN_KNEE_DB: f32 = -24.0;
375+const GAIN_KNEE_AT: f32 = 0.2;
376+
377+pub(crate) fn gain_fraction(db: f32, hi: f32) -> f32 {
378+ let lo = engine::project::MIN_GAIN_DB;
379+ let at = match db < GAIN_KNEE_DB {
380+ true => (db - lo) / (GAIN_KNEE_DB - lo) * GAIN_KNEE_AT,
381+ false => GAIN_KNEE_AT + (db - GAIN_KNEE_DB) / (hi - GAIN_KNEE_DB) * (1. - GAIN_KNEE_AT),
382+ };
383+ at.clamp(0., 1.)
384+}
385+
386+/// The gain a place along the fader reads: the inverse of [`gain_fraction`].
387+pub(crate) fn gain_at(fraction: f32, hi: f32) -> f32 {
388+ let lo = engine::project::MIN_GAIN_DB;
389+ let f = fraction.clamp(0., 1.);
390+ match f < GAIN_KNEE_AT {
391+ true => lo + f / GAIN_KNEE_AT * (GAIN_KNEE_DB - lo),
392+ false => GAIN_KNEE_DB + (f - GAIN_KNEE_AT) / (1. - GAIN_KNEE_AT) * (hi - GAIN_KNEE_DB),
32 }393 }
394+}
395+
396+/// The toggled solo set: `lane` leaves it when it is in it, and joins it when
397+/// it is not.
398+pub(crate) fn solo_toggled(solo: &[Lane], lane: Lane) -> Vec<Lane> {
399+ match solo.contains(&lane) {
400+ true => solo.iter().copied().filter(|&l| l != lane).collect(),
401+ false => solo.iter().copied().chain([lane]).collect(),
402+ }
403+}
404+
405+/// Which meter reads `lane`, given the audio lanes that hold something, in the
406+/// order the engine's levels are kept. An empty track has none; a timeline
407+/// with no sound at all reads its `A1` as the one slot.
408+pub(crate) fn meter_slot_in(sounding: &[Lane], lane: Lane) -> Option<usize> {
409+ match sounding.is_empty() {
410+ true => (lane == Lane::A1).then_some(0),
411+ false => sounding.iter().position(|&l| l == lane),
412+ }
413+}
414+
415+/// One frame's reading into a meter: the peak while the sound plays, silence
416+/// otherwise.
417+fn feed_meter(meter: &mut MixMeter, playing: bool, peak: f32, now: Instant) {
418+ match playing {
419+ true => meter.feed(peak, now),
420+ false => meter.reset(),
421+ }
422+}
423+
424+/// Gets the entry for `lane`, adding a default one the first time it is asked for.
425+fn lane_entry<T: Default>(items: &mut Vec<(Lane, T)>, lane: Lane) -> &mut T {
426+ let at = match items.iter().position(|(l, _)| *l == lane) {
427+ Some(at) => at,
428+ None => {
429+ items.push((lane, T::default()));
430+ items.len() - 1
431+ }
432+ };
433+ &mut items[at].1
434+}
435+
436+/// Where a rate (in thousandths) sits on the speed bar, 0..1. The bar is
437+/// logarithmic, so every doubling takes the same travel: a quarter to a half is
438+/// as far along as two to four.
439+pub(crate) fn speed_fraction(permille: f32) -> f32 {
440+ let lo = f32::from(Speed::MIN.permille());
441+ let hi = f32::from(Speed::MAX.permille());
442+ ((permille / lo).ln() / (hi / lo).ln()).clamp(0., 1.)
443+}
444+
445+/// The rate under a fraction of the speed bar, on the [`SPEED_STEP`] grid.
446+/// Real time is on the grid (1000 divides by 50), so a pointer can land on it.
447+pub(crate) fn speed_on_bar(along: f32) -> Speed {
448+ let lo = f32::from(Speed::MIN.permille());
449+ let hi = f32::from(Speed::MAX.permille());
450+ let raw = lo * (hi / lo).powf(along.clamp(0., 1.));
451+ speed_at((raw / SPEED_STEP as f32).round() as i32 * SPEED_STEP)
452+}
453+
454+
455+/// The next row the arrow keys land on from `from`, skipping the platform's internal fonts (a
456+/// name with a leading dot), which the card does not show. Row 0 and the default row never hide,
457+/// so the walk always ends.
458+fn sub_row_step(fonts: &[String], rows: usize, from: usize, down: bool) -> usize {
459+ let mut r = from;
460+ loop {
461+ r = if down { (r + 1) % rows } else { (r + rows - 1) % rows };
462+ let hidden = r >= SUB_ROW_FIRST_FAMILY && fonts[r - SUB_ROW_FIRST_FAMILY].starts_with('.');
463+ if !hidden || r == from {
464+ return r;
465+ }
466+ }
467+}
33 468
34- /// The project resized, whichever asked: the stroke that steps to the next469+impl Player {
35- /// size and the list that names one outright come through here. With no470+ /// The project resized, whichever asked: the list that names a size
471+ /// outright comes through here. With no
36 /// timeline yet the size is held as [`Player::pending_settings`] instead of472 /// timeline yet the size is held as [`Player::pending_settings`] instead of
37 /// being written anywhere -- there is no session to write it onto -- and473 /// being written anywhere -- there is no session to write it onto -- and
38 /// applied the moment the first one exists.474 /// applied the moment the first one exists.
@@ -43,13 +479,13 @@ impl Player {
43 // behind it to arm it ([`Player::act`]'s list is the action479 // behind it to arm it ([`Player::act`]'s list is the action
44 // doors only).480 // doors only).
45 self.mark_dirty();481 self.mark_dirty();
46- self.notify_user(format!("PROJECT: {width}x{height}").into());482+ self.notify_user(format!("Project: {width}x{height}").into());
47 self.reset_after_reseek();483 self.reset_after_reseek();
48 }484 }
49 } else {485 } else {
50 self.pending_settings.0 = Some((width, height));486 self.pending_settings.0 = Some((width, height));
51 self.notify_user(487 self.notify_user(
52- format!("PROJECT: {width}x{height} — takes effect on the next file opened").into(),488+ format!("Project: {width}x{height} — takes effect on the next file opened").into(),
53 );489 );
54 }490 }
55 cx.notify();491 cx.notify();
@@ -68,7 +504,7 @@ impl Player {
68 // [`Self::apply_resolution`]'s own reason. Armed after the504 // [`Self::apply_resolution`]'s own reason. Armed after the
69 // session's own reads, since the borrow outlives nothing.505 // session's own reads, since the borrow outlives nothing.
70 self.mark_dirty();506 self.mark_dirty();
71- self.notify_user(format!("PROJECT: {} fps", fps_label(fps)).into());507+ self.notify_user(format!("Project: {} fps", fps_label(fps)).into());
72 self.reset_after_reseek();508 self.reset_after_reseek();
73 }509 }
74 } else if fps.is_finite() && fps > 0.0 {510 } else if fps.is_finite() && fps > 0.0 {
@@ -78,7 +514,7 @@ impl Player {
78 self.pending_settings.1 = Some(fps);514 self.pending_settings.1 = Some(fps);
79 self.notify_user(515 self.notify_user(
80 format!(516 format!(
81- "PROJECT: {} fps — takes effect on the next file opened",517+ "Project: {} fps — takes effect on the next file opened",
82 fps_label(fps)518 fps_label(fps)
83 )519 )
84 .into(),520 .into(),
@@ -110,7 +546,7 @@ impl Player {
110 }546 }
111 self.notify_user(547 self.notify_user(
112 format!(548 format!(
113- "PROJECT SOUND: {} — takes effect on the next seek, edit or reopen",549+ "Project sound: {} — takes effect on the next seek, edit or reopen",
114 label(rate)550 label(rate)
115 )551 )
116 .into(),552 .into(),
@@ -119,7 +555,7 @@ impl Player {
119 self.pending_settings.2 = rate;555 self.pending_settings.2 = rate;
120 self.notify_user(556 self.notify_user(
121 format!(557 format!(
122- "PROJECT SOUND: {} — takes effect on the next file opened",558+ "Project sound: {} — takes effect on the next file opened",
123 label(rate)559 label(rate)
124 )560 )
125 .into(),561 .into(),
@@ -128,6 +564,48 @@ impl Player {
128 cx.notify();564 cx.notify();
129 }565 }
130 566
567+ /// The settings page's still image length, opened for typing in seconds.
568+ pub(crate) fn begin_still_num(&mut self, cx: &mut Context<Self>) {
569+ let Some(session) = &self.session else {
570+ return;
571+ };
572+ self.still_num = Some(crate::ui::kit::NumberEdit::begin(&format!("{:.1}", session.still_secs())));
573+ cx.notify();
574+ }
575+
576+ /// One key while the still length is typed: Enter writes it (clamped to the range a still may
577+ /// be), Escape drops it.
578+ pub(crate) fn still_num_key(&mut self, key: &str, ctrl: bool, alt: bool, key_char: Option<&str>, cx: &mut Context<Self>) {
579+ use crate::player::text_field::FieldKey;
580+ let Some(mut edit) = self.still_num.take() else {
581+ return;
582+ };
583+ match edit.key(key, ctrl, alt, key_char) {
584+ FieldKey::Edited => self.still_num = Some(edit),
585+ FieldKey::Cancel => {}
586+ FieldKey::Commit => {
587+ if let Some(secs) = edit.commit(engine::project::STILL_MIN_SECS, engine::project::STILL_MAX_SECS) {
588+ self.apply_still_secs(secs, cx);
589+ }
590+ }
591+ }
592+ cx.notify();
593+ }
594+
595+ /// The project's still length set: stills placed from now on take it, and the ones already
596+ /// on the timeline keep theirs. One undo step, and the project reads unsaved.
597+ pub(crate) fn apply_still_secs(&mut self, secs: f64, cx: &mut Context<Self>) {
598+ let changed = match &mut self.session {
599+ Some(session) => session.set_still_secs(secs).then(|| session.still_secs()),
600+ None => None,
601+ };
602+ if let Some(now) = changed {
603+ self.mark_dirty();
604+ self.notify_user(format!("Still image length: {now:.1} s").into());
605+ }
606+ cx.notify();
607+ }
608+
131 /// The project's HDR media shown another way: the list names a rendition and609 /// The project's HDR media shown another way: the list names a rendition and
132 /// this is where it happens, the way [`apply_resolution`](Self::apply_resolution)610 /// this is where it happens, the way [`apply_resolution`](Self::apply_resolution)
133 /// is for a size. The engine remaps the frame under the playhead at once611 /// is for a size. The engine remaps the frame under the playhead at once
@@ -159,10 +637,66 @@ impl Player {
159 .unwrap_or(0);637 .unwrap_or(0);
160 self.context_menu = None;638 self.context_menu = None;
161 self.library_menu = None;639 self.library_menu = None;
162- self.picker = Some(Picker { of, at, sel });640+ self.picker = Some(Picker { of, at, sel, floored: true, above: None });
163 cx.notify();641 cx.notify();
164 }642 }
165 643
644+ /// [`Self::open_picker`] for a list that hangs from the foot of a control in the dock, where
645+ /// the picture and timeline floor has nothing to protect.
646+ pub(crate) fn picker_under(&mut self, of: Pick, at: Point<Pixels>, cx: &mut Context<Self>) {
647+ self.open_picker(of, at, cx);
648+ if let Some(p) = &mut self.picker {
649+ p.floored = false;
650+ }
651+ }
652+
653+ /// [`Self::open_picker`] for a dropdown box: the list hangs from the foot of the control that
654+ /// holds `click` (or its top, when there is no room below), never from the pointer.
655+ pub(crate) fn picker_at_control(&mut self, of: Pick, click: Point<Pixels>, cx: &mut Context<Self>) {
656+ match crate::ui::anchor::control_at(click) {
657+ Some(control) => {
658+ let (at, above) = crate::ui::anchor::hang(control);
659+ self.open_picker(of, at, cx);
660+ if let Some(p) = &mut self.picker {
661+ p.floored = false;
662+ p.above = Some(above);
663+ }
664+ }
665+ None => self.picker_under(of, click, cx),
666+ }
667+ }
668+
669+ /// The list a menu-bar row opens beside itself, `None` while its setting has nothing to offer.
670+ pub(crate) fn menu_pick(&self, action: ActionId) -> Option<Pick> {
671+ match action {
672+ ActionId::Resolution => Some(Pick::Resolution),
673+ ActionId::ViewZoom => Some(Pick::ViewZoom),
674+ ActionId::OutputDisplay => Some(Pick::OutputDisplay),
675+ ActionId::PlaybackQuality => Some(Pick::ViewQuality),
676+ ActionId::GuideMask => Some(Pick::ViewMask),
677+ ActionId::GuideStyle => Some(Pick::ViewGuides),
678+ ActionId::Fit => self.fit_target().ok().map(|(lane, idx)| Pick::Fit(lane, idx)),
679+ ActionId::ClipLabel => self.label_target().map(|(lane, idx)| Pick::Label(lane, idx)),
680+ ActionId::KeyEasing => {
681+ let kind = self.ease_kind();
682+ self.key_here(kind).map(|_| Pick::KeyEase(kind))
683+ }
684+ _ => None,
685+ }
686+ }
687+
688+ /// Where a list opened from the keyboard hangs: the status-bar item it is about, so it never
689+ /// opens at wherever the pointer was left. A list about the selected clip hangs from the
690+ /// clip readout, which names that clip.
691+ pub(crate) fn ledger_anchor(&self, of: LedgerItem) -> Point<Pixels> {
692+ let cells = match of {
693+ LedgerItem::Size | LedgerItem::Clip => &self.ledger_readout,
694+ };
695+ Some(cells.get())
696+ .filter(|b| b.size.width > px(0.))
697+ .map_or(point(px(600.), px(700.)), |b| point(b.origin.x, b.origin.y))
698+ }
699+
166 /// A row of the open list was picked. Closes the list first -- the rule700 /// A row of the open list was picked. Closes the list first -- the rule
167 /// every menu item here follows -- then does exactly what the stroke for701 /// every menu item here follows -- then does exactly what the stroke for
168 /// that setting does, through the same door.702 /// that setting does, through the same door.
@@ -173,7 +707,24 @@ impl Player {
173 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),707 Choice::Fps(fps) => self.apply_frame_rate(fps, cx),
174 Choice::SampleRate(rate) => self.apply_sample_rate(rate, cx),708 Choice::SampleRate(rate) => self.apply_sample_rate(rate, cx),
175 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),709 Choice::Fit(lane, idx, fit) => self.apply_fit(lane, idx, fit, cx),
710+ Choice::Label(lane, idx, label) => self.apply_label(lane, idx, label, cx),
711+ Choice::MarkerColor(idx, color) => self.set_marker_color(idx, color, cx),
712+ Choice::KeyEase(kind, ease) => self.set_key_ease_here(kind, ease, cx),
176 Choice::Tone(preset) => self.apply_tone(preset, cx),713 Choice::Tone(preset) => self.apply_tone(preset, cx),
714+ Choice::ViewZoom(zoom) => self.set_viewer_zoom(zoom, cx),
715+ Choice::OutputDisplay(index) => self.set_output_display(index, cx),
716+ Choice::ViewQuality(q) => {
717+ self.viewer.quality = q;
718+ self.viewer_changed(cx);
719+ }
720+ Choice::ViewGuides(g) => {
721+ self.viewer.guide = g;
722+ self.viewer_changed(cx);
723+ }
724+ Choice::ViewMask(m) => {
725+ self.viewer.mask = m;
726+ self.viewer_changed(cx);
727+ }
177 // The project's, like the tone map above and unlike the palette728 // The project's, like the tone map above and unlike the palette
178 // below: kept in the `.edith` and read straight back out of the729 // below: kept in the `.edith` and read straight back out of the
179 // session by the card and by the export.730 // session by the card and by the export.
@@ -188,17 +739,42 @@ impl Player {
188 if let Err(e) = ui::theme::save(id) {739 if let Err(e) = ui::theme::save(id) {
189 let path = ui::theme::config_path();740 let path = ui::theme::config_path();
190 self.notify_user(741 self.notify_user(
191- format!("THEME COULD NOT BE KEPT — {} — {e}", path.display()).into(),742+ format!("Theme could not be kept — {} — {e}", path.display()).into(),
192 );743 );
193 }744 }
194 cx.notify();745 cx.notify();
195 }746 }
747+ // Kept for the next launch; a file that cannot be written is said, as the theme's is.
748+ Choice::Autosave(secs) => {
749+ self.autosave_secs = secs;
750+ if let Err(e) = crate::player::library::save_autosave_pref(secs) {
751+ self.notify_user(format!("Autosave setting could not be kept: {e}").into());
752+ }
753+ cx.notify();
754+ }
755+ Choice::Accent(a) => {
756+ ui::theme::set_accent(a);
757+ self.keep_accent();
758+ cx.notify();
759+ }
196 // The same field the row's key steps, set outright: a list picks a760 // The same field the row's key steps, set outright: a list picks a
197 // value, it does not step to one.761 // value, it does not step to one.
198 Choice::AudioRate(kbps) => {762 Choice::AudioRate(kbps) => {
199 self.audio_kbps = kbps;763 self.audio_kbps = kbps;
764+ self.export_sheet.custom = true;
765+ cx.notify();
766+ }
767+ // The same door the Picture row's `c` steps through, so a refusal
768+ // is still said and the destination still follows the format.
769+ Choice::Picture(format) => {
770+ self.set_format(format);
200 cx.notify();771 cx.notify();
201 }772 }
773+ Choice::Export(pick) => self.apply_export_pick(pick, cx),
774+ Choice::Bin(bin) => {
775+ let rows = self.picked_assets();
776+ self.move_assets_to_bin(rows, bin, cx)
777+ }
202 }778 }
203 }779 }
204 780
@@ -209,6 +785,59 @@ impl Player {
209 // The palette is not the project's, so it is offered before the785 // The palette is not the project's, so it is offered before the
210 // timeline is asked about: an empty window is painted too, and its786 // timeline is asked about: an empty window is painted too, and its
211 // Theme button is live there like the snap beside it.787 // Theme button is live there like the snap beside it.
788+ if let Pick::Export(row) = of {
789+ return self.export_choices(row);
790+ }
791+ match of {
792+ Pick::ViewZoom => {
793+ return crate::viewer_view::Zoom::ALL
794+ .into_iter()
795+ .map(|z| (Choice::ViewZoom(z), z.label().into(), "".into(), z == self.viewer.zoom))
796+ .collect();
797+ }
798+ Pick::OutputDisplay => {
799+ let target = self.output_target();
800+ return self
801+ .output_displays
802+ .iter()
803+ .enumerate()
804+ .map(|(i, (id, name))| (Choice::OutputDisplay(i), name.clone(), "".into(), Some(*id) == target))
805+ .collect();
806+ }
807+ Pick::ViewQuality => {
808+ return crate::viewer_view::Quality::ALL
809+ .into_iter()
810+ .map(|q| (Choice::ViewQuality(q), q.label().into(), q.detail().into(), q == self.viewer.quality))
811+ .collect();
812+ }
813+ Pick::ViewGuides => {
814+ return crate::viewer_view::Guide::ALL
815+ .into_iter()
816+ .map(|g| (Choice::ViewGuides(g), g.label().into(), g.detail().into(), g == self.viewer.guide))
817+ .collect();
818+ }
819+ Pick::ViewMask => {
820+ return crate::viewer_view::Mask::ALL
821+ .into_iter()
822+ .map(|m| (Choice::ViewMask(m), m.label().into(), m.detail().into(), m == self.viewer.mask))
823+ .collect();
824+ }
825+ Pick::Bin => return self.bin_choices(),
826+ _ => {}
827+ }
828+ if of == Pick::Autosave {
829+ return crate::player::library::AUTOSAVE_CHOICES
830+ .into_iter()
831+ .map(|secs| (Choice::Autosave(secs), crate::player::library::autosave_label(secs).into(), crate::player::library::autosave_detail(secs).into(), secs == self.autosave_secs))
832+ .collect();
833+ }
834+ if of == Pick::Accent {
835+ let picked = ui::theme::accent();
836+ return ui::theme::AccentId::ALL
837+ .into_iter()
838+ .map(|a| (Choice::Accent(a), a.label().into(), "".into(), a == picked))
839+ .collect();
840+ }
212 if of == Pick::Theme {841 if of == Pick::Theme {
213 return ui::theme::PaletteId::ALL842 return ui::theme::PaletteId::ALL
214 .into_iter()843 .into_iter()
@@ -222,6 +851,17 @@ impl Player {
222 })851 })
223 .collect();852 .collect();
224 }853 }
854+ // The file an export is written as is this computer's pick, not the
855+ // project's, so the list is offered before a timeline is asked about
856+ // -- a refusal rides each row it applies to, and is empty without a
857+ // session to refuse anything.
858+ if of == Pick::Picture {
859+ return crate::ui::settings_stance::picture_choices(self.format, |f| {
860+ self.session
861+ .as_ref()
862+ .and_then(|session| format_refusal(session, f))
863+ });
864+ }
225 let Some(session) = &self.session else {865 let Some(session) = &self.session else {
226 // Resolution and rate are reachable before any file is open --866 // Resolution and rate are reachable before any file is open --
227 // they hold as `pending_settings` until one is ([`apply_resolution`],867 // they hold as `pending_settings` until one is ([`apply_resolution`],
@@ -247,7 +887,34 @@ impl Player {
247 Pick::Tone => tone_choices(session.tone()),887 Pick::Tone => tone_choices(session.tone()),
248 Pick::Encoder => encoder_choices(session.encoder_seat()),888 Pick::Encoder => encoder_choices(session.encoder_seat()),
249 // Answered above, with or without a timeline.889 // Answered above, with or without a timeline.
250- Pick::Theme => Vec::new(),890+ Pick::KeyEase(kind) => {
891+ let here = self.key_here(kind);
892+ engine::transform::KeyEase::ALL
893+ .into_iter()
894+ .map(|ease| (Choice::KeyEase(kind, ease), crate::export_ui::ease_label(ease).into(), "".into(), here == Some(ease)))
895+ .collect()
896+ }
897+ Pick::Label(lane, idx) => {
898+ let here = session.mark_of(lane, idx).label;
899+ std::iter::once((Choice::Label(lane, idx, 0), "None".into(), "".into(), here == 0))
900+ .chain(engine::project::LABELS.iter().enumerate().map(|(i, (name, _))| {
901+ let n = i as u8 + 1;
902+ (Choice::Label(lane, idx, n), (*name).into(), "".into(), here == n)
903+ }))
904+ .collect()
905+ }
906+ Pick::MarkerColor(idx) => {
907+ let here = session.markers().get(idx).map(|m| m.color);
908+ engine::project::MarkerColor::ALL
909+ .into_iter()
910+ .map(|c| {
911+ let name = c.name();
912+ let label = format!("{}{}", name[..1].to_uppercase(), &name[1..]);
913+ (Choice::MarkerColor(idx, c), label.into(), "".into(), here == Some(c))
914+ })
915+ .collect()
916+ }
917+ Pick::Theme | Pick::Accent | Pick::Picture | Pick::Export(_) | Pick::ViewZoom | Pick::OutputDisplay | Pick::ViewQuality | Pick::ViewMask | Pick::ViewGuides | Pick::Bin | Pick::Autosave => Vec::new(),
251 }918 }
252 }919 }
253 920
@@ -262,7 +929,7 @@ impl Player {
262 return;929 return;
263 }930 }
264 let Some(session) = &self.session else {931 let Some(session) = &self.session else {
265- self.notify_user("NOTHING TO GRADE — no file open".into());932+ self.notify_user("Nothing to grade — no file open".into());
266 cx.notify();933 cx.notify();
267 return;934 return;
268 };935 };
@@ -279,7 +946,7 @@ impl Player {
279 match caption_media_half(session, (lane, idx), LaneKind::Video) {946 match caption_media_half(session, (lane, idx), LaneKind::Video) {
280 Some(half) => Some(half),947 Some(half) => Some(half),
281 None => {948 None => {
282- self.notify_user("NOTHING TO GRADE — a caption has no picture".into());949+ self.notify_user("Nothing to grade — a caption has no picture".into());
283 cx.notify();950 cx.notify();
284 return;951 return;
285 }952 }
@@ -295,16 +962,17 @@ impl Player {
295 // One card at a time: `close_card` is the single list of962 // One card at a time: `close_card` is the single list of
296 // every flag that means "a card is up", so opening this one963 // every flag that means "a card is up", so opening this one
297 // starts by closing all of them.964 // starts by closing all of them.
298- self.close_card();965+ self.close_other_cards();
299 self.color_open = Some(clip);966 self.color_open = Some(clip);
300- self.color_band = 0;967+ self.color_band = section_bands(self.color_section).start;
301 self.color_dragging = false;968 self.color_dragging = false;
969+ self.color_wheel_drag = None;
302 // A sample the last card held back belongs to the clip it was970 // A sample the last card held back belongs to the clip it was
303 // dragged on, and this may be another one.971 // dragged on, and this may be another one.
304 self.pending_color = None;972 self.pending_color = None;
305 self.context_menu = None;973 self.context_menu = None;
306 }974 }
307- None => self.notify_user("NOTHING TO GRADE — no clip under the playhead".into()),975+ None => self.notify_user("Nothing to grade — no clip under the playhead".into()),
308 }976 }
309 cx.notify();977 cx.notify();
310 }978 }
@@ -317,9 +985,10 @@ impl Player {
317 if let Some(params) = self.pending_color {985 if let Some(params) = self.pending_color {
318 return params;986 return params;
319 }987 }
988+ let frame = self.key_frame();
320 self.color_open989 self.color_open
321 .zip(self.session.as_ref())990 .zip(self.session.as_ref())
322- .and_then(|((lane, idx), session)| session.color_of(lane, idx).copied())991+ .and_then(|((lane, idx), session)| session.color_at(lane, idx, frame))
323 .unwrap_or_default()992 .unwrap_or_default()
324 }993 }
325 994
@@ -338,19 +1007,42 @@ impl Player {
338 /// (`PlaybackSession::set_color_live`). Either way the engine reseeks, so1007 /// (`PlaybackSession::set_color_live`). Either way the engine reseeks, so
339 /// the picture -- and the histogram counted off it -- is regraded at once.1008 /// the picture -- and the histogram counted off it -- is regraded at once.
340 pub(crate) fn write_color(&mut self, params: ColorParams, live: bool, cx: &mut Context<Self>) {1009 pub(crate) fn write_color(&mut self, params: ColorParams, live: bool, cx: &mut Context<Self>) {
1010+ self.named_step("Colour", |this| this.write_color_now(params, live, cx));
1011+ }
1012+
1013+ pub(crate) fn write_color_now(&mut self, params: ColorParams, live: bool, cx: &mut Context<Self>) {
341 // Any write supersedes a held sample, whichever way it arrived -- a key,1014 // Any write supersedes a held sample, whichever way it arrived -- a key,
342 // a reset, or the flush that took this one out of the stash.1015 // a reset, or the flush that took this one out of the stash.
343 self.pending_color = None;1016 self.pending_color = None;
1017+ let frame = self.key_frame();
344 let Some((lane, idx)) = self.color_open else {1018 let Some((lane, idx)) = self.color_open else {
345 return;1019 return;
346 };1020 };
347 let Some(session) = &mut self.session else {1021 let Some(session) = &mut self.session else {
348 return;1022 return;
349 };1023 };
350- let grade = Some(params).filter(|p| !p.is_identity());1024+ // A LUT is kept even at intensity 0: the file is the hand's choice, and
351- let took = match live {1025+ // the next pull of the bar is on it.
352- true => session.set_color_live(lane, idx, grade),1026+ let grade = Some(params).filter(|p| !p.is_identity() || p.look.lut.is_some());
353- false => session.set_color(lane, idx, grade),1027+ let keyed = session.is_keyed(lane, idx, KeyKind::Color);
1028+ let base = session.color_of(lane, idx).copied().unwrap_or_default();
1029+ let took = if keyed && base.look != params.look {
1030+ // The look holds under the keys: it is the clip's own grade's,
1031+ // written there whatever the keys say about the sliders.
1032+ let base = Some(ColorParams { look: params.look, ..base })
1033+ .filter(|p| !p.is_identity() || p.look.lut.is_some());
1034+ match live {
1035+ true => session.set_color_live(lane, idx, base),
1036+ false => session.set_color(lane, idx, base),
1037+ }
1038+ } else if keyed {
1039+ // A keyed grade: the slider writes the key on the playhead.
1040+ session.put_color_key_at(lane, idx, frame, params, !live)
1041+ } else {
1042+ match live {
1043+ true => session.set_color_live(lane, idx, grade),
1044+ false => session.set_color(lane, idx, grade),
1045+ }
354 };1046 };
355 if took {1047 if took {
356 self.mark_dirty();1048 self.mark_dirty();
@@ -359,13 +1051,88 @@ impl Player {
359 cx.notify();1051 cx.notify();
360 }1052 }
361 1053
1054+ /// Shows another section of the colour card; the arrows then walk its sliders.
1055+ pub(crate) fn show_color_section(&mut self, section: ColorSection, cx: &mut Context<Self>) {
1056+ self.color_section = section;
1057+ self.color_band = section_bands(section).start;
1058+ cx.notify();
1059+ }
1060+
1061+ /// What the graph over the colour controls shows. A scope is counted off the
1062+ /// next frame; the one on screen is counted now, so the switch shows at once.
1063+ pub(crate) fn show_scope(&mut self, view: ScopeView, cx: &mut Context<Self>) {
1064+ self.scope_view = view;
1065+ self.scopes = None;
1066+ if view != ScopeView::Histogram
1067+ && let Some(image) = &self.image
1068+ && let Some(frame) = image.as_bytes(0)
1069+ {
1070+ let size = image.size(0);
1071+ let (w, h) = (size.width.0 as usize, size.height.0 as usize);
1072+ self.scopes = Some(engine::scopes::compute(frame, w, h, SCOPE_COLS));
1073+ }
1074+ cx.notify();
1075+ }
1076+
1077+ /// Asks for a `.cube` file and puts it on the card's clip at full intensity,
1078+ /// or -- `relink` -- points every clip using the clip's current LUT at it.
1079+ /// The chooser runs off the UI thread; a file that cannot be read is said so
1080+ /// and changes nothing.
1081+ pub(crate) fn pick_lut(&mut self, relink: bool, cx: &mut Context<Self>) {
1082+ let picked = cx.background_executor().spawn(async { pick_file("edith — LUT (.cube)") });
1083+ cx.spawn(async move |this, cx| {
1084+ let picked = picked.await;
1085+ this.update(cx, |this, cx| match picked {
1086+ Ok(Some(path)) => this.set_lut(&path, relink, cx),
1087+ Ok(None) => {}
1088+ // No chooser here: the same question, typed.
1089+ Err(_) => this.open_path_entry(PathFor::Lut { relink }, cx),
1090+ })
1091+ .ok();
1092+ })
1093+ .detach();
1094+ }
1095+
1096+ pub(crate) fn set_lut(&mut self, path: &Path, relink: bool, cx: &mut Context<Self>) {
1097+ let r = engine::cube::LutRef::reload(path);
1098+ if let Some(why) = r.problem() {
1099+ self.notify_user(format!("That LUT cannot be used: {why}").into());
1100+ cx.notify();
1101+ return;
1102+ }
1103+ let mut params = self.color_params();
1104+ let old = params.look.lut;
1105+ if relink && let (Some(old), Some(session)) = (old, &mut self.session) {
1106+ let n = session.relink_lut(&old.path(), path);
1107+ if n > 0 {
1108+ self.mark_dirty();
1109+ self.reset_after_reseek();
1110+ self.notify_user(format!("Relinked the LUT on {}", count_noun(n, "clip", "clips")).into());
1111+ }
1112+ cx.notify();
1113+ return;
1114+ }
1115+ params.look.lut = Some(r);
1116+ params.look.lut_mix = 1.;
1117+ self.set_color(params, cx);
1118+ }
1119+
1120+ /// Takes the LUT off the card's clip; the rest of its grade stays.
1121+ pub(crate) fn clear_lut(&mut self, cx: &mut Context<Self>) {
1122+ let mut params = self.color_params();
1123+ params.look.lut = None;
1124+ params.look.lut_mix = 1.;
1125+ self.set_color(params, cx);
1126+ }
1127+
362 /// Moves the picked slider by `steps` of [`COLOR_STEP`], clamped to that1128 /// Moves the picked slider by `steps` of [`COLOR_STEP`], clamped to that
363 /// band's range. One edit, so one undo step per press.1129 /// band's range. One edit, so one undo step per press.
364 pub(crate) fn nudge_color(&mut self, steps: f32, cx: &mut Context<Self>) {1130 pub(crate) fn nudge_color(&mut self, steps: f32, cx: &mut Context<Self>) {
365 let mut params = self.color_params();1131 let mut params = self.color_params();
366- let (_, low, high) = COLOR_BANDS[self.color_band];1132+ let (band, wheel, curve) = (self.color_band, self.color_wheel, self.color_curve);
367- let value = band_mut(&mut params, self.color_band);1133+ let (_, low, high, step) = band_spec(band);
368- *value = (*value + steps * COLOR_STEP).clamp(low, high);1134+ let value = (band_value(&params, band, wheel, curve) + steps * step).clamp(low, high);
1135+ set_band(&mut params, band, wheel, curve, value);
369 self.set_color(params, cx);1136 self.set_color(params, cx);
370 }1137 }
371 1138
@@ -388,15 +1155,19 @@ impl Player {
388 /// thirty-nine of them and freeze the window for the sum. What is written is1155 /// thirty-nine of them and freeze the window for the sum. What is written is
389 /// one grade per frame the worker actually delivers.1156 /// one grade per frame the worker actually delivers.
390 pub(crate) fn drag_color(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {1157 pub(crate) fn drag_color(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {
391- let (_, low, high) = COLOR_BANDS[self.color_band];1158+ let (band, wheel, curve) = (self.color_band, self.color_wheel, self.color_curve);
392- let along = frac_along(x, self.color_bars[self.color_band].get());1159+ let (_, low, high, step) = band_spec(band);
393- let value = color_snap(low + along * (high - low)).clamp(low, high);1160+ let along = frac_along(x, self.color_bars[band].get());
1161+ // The basic bands land on the keys' grid; the wheels and curves on a
1162+ // finer one of their own, since a hundredth of a lift already shows.
1163+ let raw = low + along * (high - low);
1164+ let value = if band < WHEEL_BAND { color_snap(raw) } else { (raw / step).round() * step };
1165+ let value = value.clamp(low, high);
394 let mut params = self.color_params();1166 let mut params = self.color_params();
395- let at = band_mut(&mut params, self.color_band);1167+ if band_value(&params, band, wheel, curve) == value && !first {
396- if *at == value && !first {
397 return;1168 return;
398 }1169 }
399- *at = value;1170+ set_band(&mut params, band, wheel, curve, value);
400 let busy = self.seek_since.is_some();1171 let busy = self.seek_since.is_some();
401 match stash_or_write(&mut self.pending_color, params, first, busy) {1172 match stash_or_write(&mut self.pending_color, params, first, busy) {
402 Some(params) => self.write_color(params, !first, cx),1173 Some(params) => self.write_color(params, !first, cx),
@@ -406,6 +1177,45 @@ impl Player {
406 }1177 }
407 }1178 }
408 1179
1180+ /// One pointer sample on a colour wheel: the puck (`master` false) sets the
1181+ /// wheel's R, G and B offsets from its place on the pad, the bar under it sets
1182+ /// the master. `first` is the press, which takes the undo step.
1183+ pub(crate) fn drag_wheel(&mut self, wheel: usize, master: bool, at: gpui::Point<Pixels>, first: bool, cx: &mut Context<Self>) {
1184+ let mut params = self.color_params();
1185+ self.color_wheel = wheel;
1186+ if master {
1187+ let along = frac_along(at.x, self.color_masters[wheel].get());
1188+ let v = wheel_snap(along * 2. - 1.);
1189+ set_band(&mut params, WHEEL_BAND, wheel, self.color_curve, v);
1190+ self.color_band = WHEEL_BAND;
1191+ } else {
1192+ let b = self.color_pads[wheel].get();
1193+ let (w, h) = (f32::from(b.size.width).max(1.), f32::from(b.size.height).max(1.));
1194+ let x = (f32::from(at.x - b.origin.x) - w / 2.) / (w / 2.);
1195+ let y = (h / 2. - f32::from(at.y - b.origin.y)) / (h / 2.);
1196+ for (i, v) in wheel_offsets(x, y).into_iter().enumerate() {
1197+ set_band(&mut params, WHEEL_BAND + 1 + i, wheel, self.color_curve, wheel_snap(v));
1198+ }
1199+ self.color_band = WHEEL_BAND + 1;
1200+ }
1201+ let busy = self.seek_since.is_some();
1202+ match stash_or_write(&mut self.pending_color, params, first, busy) {
1203+ Some(params) => self.write_color(params, !first, cx),
1204+ None => cx.notify(),
1205+ }
1206+ }
1207+
1208+ /// Double-click on a wheel: its puck back to the centre (`master` false) or
1209+ /// its master back to zero.
1210+ pub(crate) fn reset_wheel(&mut self, wheel: usize, master: bool, cx: &mut Context<Self>) {
1211+ let mut params = self.color_params();
1212+ let bands = if master { WHEEL_BAND..WHEEL_BAND + 1 } else { WHEEL_BAND + 1..CURVE_BAND };
1213+ for band in bands {
1214+ set_band(&mut params, band, wheel, self.color_curve, 0.);
1215+ }
1216+ self.set_color(params, cx);
1217+ }
1218+
409 /// Opens the transform card on the clip a placement would go on --1219 /// Opens the transform card on the clip a placement would go on --
410 /// [`open_color`](Self::open_color)'s own rule, since it targets the same1220 /// [`open_color`](Self::open_color)'s own rule, since it targets the same
411 /// clip a grade would.1221 /// clip a grade would.
@@ -414,7 +1224,7 @@ impl Player {
414 return;1224 return;
415 }1225 }
416 let Some(session) = &self.session else {1226 let Some(session) = &self.session else {
417- self.notify_user("NOTHING TO PLACE — no file open".into());1227+ self.notify_user("Nothing to place — no file open".into());
418 cx.notify();1228 cx.notify();
419 return;1229 return;
420 };1230 };
@@ -423,7 +1233,7 @@ impl Player {
423 match caption_media_half(session, (lane, idx), LaneKind::Video) {1233 match caption_media_half(session, (lane, idx), LaneKind::Video) {
424 Some(half) => Some(half),1234 Some(half) => Some(half),
425 None => {1235 None => {
426- self.notify_user("NOTHING TO PLACE — a caption has no picture".into());1236+ self.notify_user("Nothing to place — a caption has no picture".into());
427 cx.notify();1237 cx.notify();
428 return;1238 return;
429 }1239 }
@@ -435,14 +1245,17 @@ impl Player {
435 match target {1245 match target {
436 Some(clip) => {1246 Some(clip) => {
437 // One card at a time -- `close_card`'s own rule.1247 // One card at a time -- `close_card`'s own rule.
438- self.close_card();1248+ self.close_other_cards();
439 self.transform_open = Some(clip);1249 self.transform_open = Some(clip);
440 self.transform_band = 0;1250 self.transform_band = 0;
441 self.transform_dragging = false;1251 self.transform_dragging = false;
442 self.pending_transform = None;1252 self.pending_transform = None;
1253+ self.place_open = false;
1254+ self.title_in_open = false;
1255+ self.title_out_open = false;
443 self.context_menu = None;1256 self.context_menu = None;
444 }1257 }
445- None => self.notify_user("NOTHING TO PLACE — no clip under the playhead".into()),1258+ None => self.notify_user("Nothing to place — no clip under the playhead".into()),
446 }1259 }
447 cx.notify();1260 cx.notify();
448 }1261 }
@@ -453,9 +1266,16 @@ impl Player {
453 if let Some(params) = self.pending_transform {1266 if let Some(params) = self.pending_transform {
454 return params;1267 return params;
455 }1268 }
1269+ let frame = self.key_frame();
456 self.transform_open1270 self.transform_open
457 .zip(self.session.as_ref())1271 .zip(self.session.as_ref())
458- .and_then(|((lane, idx), session)| session.transform_of(lane, idx).copied())1272+ .map(|((lane, idx), session)| {
1273+ let mut params = session.transform_at(lane, idx, frame).unwrap_or_default();
1274+ if session.is_keyed(lane, idx, KeyKind::Opacity) {
1275+ params.opacity = session.opacity_at(lane, idx, frame);
1276+ }
1277+ params
1278+ })
459 .unwrap_or_default()1279 .unwrap_or_default()
460 }1280 }
461 1281
@@ -468,24 +1288,44 @@ impl Player {
468 /// Both writes: `live` is the one that takes no undo step, which is what1288 /// Both writes: `live` is the one that takes no undo step, which is what
469 /// every sample *inside* a drag goes through --1289 /// every sample *inside* a drag goes through --
470 /// [`write_color`](Self::write_color)'s own rule.1290 /// [`write_color`](Self::write_color)'s own rule.
471- pub(crate) fn write_transform(1291+ pub(crate) fn write_transform(&mut self, params: TransformParams, live: bool, cx: &mut Context<Self>) {
472- &mut self,1292+ self.named_step("Transform", |this| this.write_transform_now(params, live, cx));
473- params: TransformParams,1293+ }
474- live: bool,1294+
475- cx: &mut Context<Self>,1295+ fn write_transform_now(&mut self, params: TransformParams, live: bool, cx: &mut Context<Self>) {
476- ) {
477 self.pending_transform = None;1296 self.pending_transform = None;
1297+ let frame = self.key_frame();
478 let Some((lane, idx)) = self.transform_open else {1298 let Some((lane, idx)) = self.transform_open else {
479 return;1299 return;
480 };1300 };
481 let Some(session) = &mut self.session else {1301 let Some(session) = &mut self.session else {
482 return;1302 return;
483 };1303 };
484- let placement = Some(params).filter(|p| !p.is_identity());1304+ let mut params = params;
485- let took = match live {1305+ let mut took = false;
486- true => session.set_transform_live(lane, idx, placement),1306+ if session.is_keyed(lane, idx, KeyKind::Opacity) {
487- false => session.set_transform(lane, idx, placement),1307+ // Keyed opacity: the slider writes its key, and the placement keeps
488- };1308+ // the opacity it had.
1309+ if session.opacity_at(lane, idx, frame) != params.opacity {
1310+ took = session.put_opacity_key_at(lane, idx, frame, params.opacity, !live);
1311+ }
1312+ params.opacity = session
1313+ .transform_at(lane, idx, frame)
1314+ .map_or(1.0, |t| t.opacity);
1315+ }
1316+ if session.is_keyed(lane, idx, KeyKind::Placement) {
1317+ if session.transform_at(lane, idx, frame) != Some(params) {
1318+ took |= session.put_transform_key_at(lane, idx, frame, params, !live && !took);
1319+ }
1320+ } else {
1321+ let placement = Some(params).filter(|p| !p.is_identity());
1322+ if session.transform_at(lane, idx, frame) != placement || !took {
1323+ took |= match live {
1324+ true => session.set_transform_live(lane, idx, placement),
1325+ false => session.set_transform(lane, idx, placement),
1326+ };
1327+ }
1328+ }
489 if took {1329 if took {
490 self.mark_dirty();1330 self.mark_dirty();
491 self.reset_after_reseek();1331 self.reset_after_reseek();
@@ -493,39 +1333,158 @@ impl Player {
493 cx.notify();1333 cx.notify();
494 }1334 }
495 1335
496- /// Moves the picked slider by `steps` -- [`nudge_color`](Self::nudge_color)'s1336+ /// The canvas the placement is measured on: position is a fraction of it,
497- /// own rule, except rotation wraps into its range on1337+ /// so the pixel readout and the pixel drag both need its size. The card
498- /// [`transform_snap`] instead of clamping.1338+ /// only opens with a file, so the project default stands in for nothing.
499- pub(crate) fn nudge_transform(&mut self, steps: f32, cx: &mut Context<Self>) {1339+ pub(crate) fn transform_canvas(&self) -> (u32, u32) {
1340+ self.session
1341+ .as_ref()
1342+ .map_or((1920, 1080), |session| session.resolution())
1343+ }
1344+
1345+ /// The pixel size of the picture the card's clip shows, as the engine
1346+ /// measures it: a video's from its probed facts, a still's from its header.
1347+ /// `None` for sound, a generated clip, or a video whose facts are still
1348+ /// being read.
1349+ pub(crate) fn clip_picture_size(&self, lane: Lane, idx: usize) -> Option<(u32, u32)> {
1350+ let session = self.session.as_ref()?;
1351+ let clip = session.lane_clips(lane).get(idx)?;
1352+ let path = &session.sources().get(clip.source)?.path;
1353+ if engine::is_image(path) {
1354+ return engine::decode::image_size(path).ok();
1355+ }
1356+ let video = self.facts.get(path)?.as_ref()?.video.as_ref()?;
1357+ Some((video.width, video.height))
1358+ }
1359+
1360+ /// Puts the card's clip in `corner`, at `scale` when one is given. Without
1361+ /// one, a corner pick on a clip still at full size makes it a picture in
1362+ /// picture ([`PIP_SCALE`]), so the picture is smaller than the frame it sits
1363+ /// in. Keeps the default corner margin. One undo step, as every placement is
1364+ /// ([`set_transform`](Self::set_transform)).
1365+ pub(crate) fn place_in_corner(&mut self, corner: engine::transform::Corner, scale: Option<f32>, cx: &mut Context<Self>) {
1366+ let Some((lane, idx)) = self.transform_open else {
1367+ return;
1368+ };
1369+ let Some(size) = self.clip_picture_size(lane, idx) else {
1370+ return;
1371+ };
500 let mut params = self.transform_params();1372 let mut params = self.transform_params();
501- let (_, low, high) = TRANSFORM_BANDS[self.transform_band];1373+ if let Some(scale) = scale {
502- let step = if self.transform_band == ROTATE_BAND {1374+ params.scale = scale;
503- ROTATE_STEP1375+ } else if corner != engine::transform::Corner::Centre && params.scale == TransformParams::default().scale {
1376+ params.scale = PIP_SCALE;
1377+ }
1378+ let canvas = self.transform_canvas();
1379+ let (x, y) = engine::transform::corner_placement(corner, &params, size, canvas, engine::transform::CORNER_MARGIN_PX);
1380+ params.pos_x = x;
1381+ params.pos_y = y;
1382+ self.set_transform(params, cx);
1383+ }
1384+
1385+ /// Puts the picture at `scale` as a scale change: a picture in a corner stays
1386+ /// in that corner ([`engine::transform::keep_corner`]), at the card's clip's
1387+ /// own picture size. `old` is what the picture was before the change.
1388+ pub(crate) fn scaled_in_place(&self, old: TransformParams, new: TransformParams) -> TransformParams {
1389+ let Some((lane, idx)) = self.transform_open else {
1390+ return new;
1391+ };
1392+ let (Some(size), canvas) = (self.clip_picture_size(lane, idx), self.transform_canvas()) else {
1393+ return new;
1394+ };
1395+ engine::transform::keep_corner(&old, new, size, canvas, engine::transform::CORNER_MARGIN_PX)
1396+ }
1397+
1398+ /// Whether the crop rows are unfolded.
1399+ pub(crate) fn transform_crop_open(&self) -> bool {
1400+ self.folds.contains(TRANSFORM_CROP_FOLD)
1401+ }
1402+
1403+ /// Opens or closes the crop rows and remembers it. Closing them moves a
1404+ /// picked crop row back to the first one, so the arrows never move a slider
1405+ /// nobody can see.
1406+ pub(crate) fn toggle_transform_crop(&mut self, cx: &mut Context<Self>) {
1407+ if self.folds.contains(TRANSFORM_CROP_FOLD) {
1408+ self.folds.remove(TRANSFORM_CROP_FOLD);
1409+ if self.transform_band >= TRANSFORM_MAIN_BANDS {
1410+ self.transform_band = 0;
1411+ }
1412+ } else {
1413+ self.folds.insert(TRANSFORM_CROP_FOLD.to_owned());
1414+ }
1415+ save_folds(&self.folds);
1416+ cx.notify();
1417+ }
1418+
1419+ /// Moves the picked row one down or up, skipping the crop rows while their
1420+ /// fold is shut.
1421+ pub(crate) fn move_transform_band(&mut self, down: bool) {
1422+ let n = if self.transform_crop_open() {
1423+ TRANSFORM_BANDS.len()
504 } else {1424 } else {
505- TRANSFORM_STEP1425+ TRANSFORM_MAIN_BANDS
506 };1426 };
507- let value = transform_band_mut(&mut params, self.transform_band);1427+ if self.transform_band >= n {
508- let raw = *value + steps * step;1428+ self.transform_band = 0;
509- *value = if self.transform_band == ROTATE_BAND {1429+ }
510- transform_snap(self.transform_band, raw)1430+ self.transform_band = if down {
1431+ (self.transform_band + 1) % n
511 } else {1432 } else {
512- raw.clamp(low, high)1433+ (self.transform_band + n - 1) % n
513 };1434 };
1435+ }
1436+
1437+ /// Moves the picked slider by `steps` -- [`nudge_color`](Self::nudge_color)'s
1438+ /// own rule, except rotation wraps into its range on [`transform_snap`]
1439+ /// instead of clamping, and a position moves in whole canvas pixels.
1440+ pub(crate) fn nudge_transform(&mut self, steps: f32, cx: &mut Context<Self>) {
1441+ let mut params = self.transform_params();
1442+ let band = self.transform_band;
1443+ let (_, low, high) = TRANSFORM_BANDS[band];
1444+ let canvas = self.transform_canvas();
1445+ let old = params;
1446+ let value = transform_band_mut(&mut params, band);
1447+ *value = if band == ROTATE_BAND {
1448+ transform_snap(band, *value + steps * ROTATE_STEP)
1449+ } else if is_position_band(band) {
1450+ let raw = *value + steps * POSITION_NUDGE_PX / position_span(band, canvas);
1451+ snap_position_px(band, raw, canvas)
1452+ } else {
1453+ (*value + steps * TRANSFORM_STEP).clamp(low, high)
1454+ };
1455+ if band == SCALE_BAND {
1456+ params = self.scaled_in_place(old, params);
1457+ }
514 self.set_transform(params, cx);1458 self.set_transform(params, cx);
515 }1459 }
516 1460
517 /// Where the pointer sits along a slider, as that band's value --1461 /// Where the pointer sits along a slider, as that band's value --
518- /// [`drag_color`](Self::drag_color)'s own rule.1462+ /// [`drag_color`](Self::drag_color)'s own rule, on the pixel grid for a
1463+ /// position.
519 pub(crate) fn drag_transform(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {1464 pub(crate) fn drag_transform(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {
520- let (_, low, high) = TRANSFORM_BANDS[self.transform_band];1465+ if self.opacity_drag {
521- let along = frac_along(x, self.transform_bars[self.transform_band].get());1466+ self.drag_opacity(x, first, cx);
522- let value = transform_snap(self.transform_band, low + along * (high - low));1467+ return;
523- let mut params = self.transform_params();1468+ }
524- let at = transform_band_mut(&mut params, self.transform_band);1469+ let band = self.transform_band;
1470+ let (low, high) = slider_range(band);
1471+ let along = frac_along(x, self.transform_bars[band].get());
1472+ let raw = low + along * (high - low);
1473+ let value = if is_position_band(band) {
1474+ snap_position_px(band, raw, self.transform_canvas())
1475+ } else {
1476+ transform_snap(band, raw)
1477+ };
1478+ let old = self.transform_params();
1479+ let mut params = old;
1480+ let at = transform_band_mut(&mut params, band);
525 if *at == value && !first {1481 if *at == value && !first {
526 return;1482 return;
527 }1483 }
528 *at = value;1484 *at = value;
1485+ if band == SCALE_BAND {
1486+ params = self.scaled_in_place(old, params);
1487+ }
529 let busy = self.seek_since.is_some();1488 let busy = self.seek_since.is_some();
530 match stash_or_write(&mut self.pending_transform, params, first, busy) {1489 match stash_or_write(&mut self.pending_transform, params, first, busy) {
531 Some(params) => self.write_transform(params, !first, cx),1490 Some(params) => self.write_transform(params, !first, cx),
@@ -533,24 +1492,34 @@ impl Player {
533 }1492 }
534 }1493 }
535 1494
536- /// Opens the speed card on the clip whose rate is to change: the selected1495+ /// Where the pointer sits along the opacity bar, as the clip's opacity, on a
537- /// one, or -- with nothing selected -- the clip the picture is coming from,1496+ /// whole percent. The row shares the transform card's drag flag, so the root
538- /// which is what a person means by "this shot". Either half of a take will1497+ /// hands its samples here while [`Self::opacity_drag`] is set.
539- /// do: a rate applies to the whole group, so opening it on the sound and1498+ pub(crate) fn drag_opacity(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {
540- /// opening it on the picture are the same card.1499+ let value = (frac_along(x, self.opacity_bar.get()) * 100.).round() / 100.;
541- pub(crate) fn open_speed(&mut self, cx: &mut Context<Self>) {1500+ let mut params = self.transform_params();
542- if self.exporting().is_some() {1501+ if params.opacity == value && !first {
543 return;1502 return;
544 }1503 }
545- let Some(session) = &self.session else {1504+ params.opacity = value;
546- self.notify_user("NOTHING TO RE-TIME — no file open".into());1505+ let busy = self.seek_since.is_some();
1506+ match stash_or_write(&mut self.pending_transform, params, first, busy) {
1507+ Some(params) => self.write_transform(params, !first, cx),
1508+ None => cx.notify(),
1509+ }
1510+ }
1511+
1512+ /// The clip a speed action acts on: the selected one, or the clip the picture
1513+ /// is coming from. A caption names the clip it was pinned to, and a caption in
1514+ /// no group has no rate -- said out loud, since a card that reads 1.00x and
1515+ /// writes nothing is worse than a refusal. `None` when there is nothing to act on,
1516+ /// and the refusal has been said.
1517+ pub(crate) fn speed_anchor(&mut self, cx: &mut Context<Self>) -> Option<(Lane, usize)> {
1518+ let Some(session) = self.session.as_ref() else {
1519+ self.notify_user("Nothing to re-time — no file open".into());
547 cx.notify();1520 cx.notify();
548- return;1521+ return None;
549 };1522 };
550- // A caption the hand is on names the clip it was pinned to, and the
551- // card opens on that. A caption in no group has no rate to change and
552- // nothing behind it that does: said out loud, rather than a card that
553- // reads 1.00x and writes nothing.
554 let anchor = match self1523 let anchor = match self
555 .selected1524 .selected
556 .anchor()1525 .anchor()
@@ -561,26 +1530,50 @@ impl Player {
561 Some(half) => Some(half),1530 Some(half) => Some(half),
562 None => {1531 None => {
563 self.notify_user(1532 self.notify_user(
564- "NOTHING TO RE-TIME — a caption has no speed of its own".into(),1533+ "Nothing to re-time — a caption has no speed of its own".into(),
565 );1534 );
566 cx.notify();1535 cx.notify();
567- return;1536+ None
568 }1537 }
569 }1538 }
570 }1539 }
571 other => other,1540 other => other,
572 };1541 };
1542+ if anchor.is_none() {
1543+ self.notify_user("Nothing to re-time — no clip under the playhead".into());
1544+ cx.notify();
1545+ }
1546+ anchor
1547+ }
1548+
1549+ /// Opens the speed card on the clip whose rate is to change: the selected
1550+ /// one, or -- with nothing selected -- the clip the picture is coming from,
1551+ /// which is what a person means by "this shot". Either half of a take will
1552+ /// do: a rate applies to the whole group, so opening it on the sound and
1553+ /// opening it on the picture are the same card.
1554+ pub(crate) fn open_speed(&mut self, cx: &mut Context<Self>) {
1555+ if self.exporting().is_some() {
1556+ return;
1557+ }
1558+ let anchor = self.speed_anchor(cx);
573 match anchor {1559 match anchor {
574 Some(clip) => {1560 Some(clip) => {
575 // One card at a time -- `close_card`'s own rule.1561 // One card at a time -- `close_card`'s own rule.
576- self.close_card();1562+ self.close_other_cards();
577 self.speed_open = Some(clip);1563 self.speed_open = Some(clip);
578 self.speed_dragging = false;1564 self.speed_dragging = false;
579 // The colour card's rule: a held sample is the last clip's.1565 // The colour card's rule: a held sample is the last clip's.
580 self.pending_speed = None;1566 self.pending_speed = None;
1567+ self.ramp_key_speed = None;
1568+ // A clip that already ramps opens on its keys.
1569+ self.speed_ramp_mode = self
1570+ .session
1571+ .as_ref()
1572+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1573+ .is_some_and(|c| !c.speed_keys.is_empty());
581 self.context_menu = None;1574 self.context_menu = None;
582 }1575 }
583- None => self.notify_user("NOTHING TO RE-TIME — no clip under the playhead".into()),1576+ None => return,
584 }1577 }
585 cx.notify();1578 cx.notify();
586 }1579 }
@@ -591,6 +1584,10 @@ impl Player {
591 if let Some(speed) = self.pending_speed {1584 if let Some(speed) = self.pending_speed {
592 return speed;1585 return speed;
593 }1586 }
1587+ // The ramp mode's bar is the next key's speed, not the clip's.
1588+ if self.speed_ramp_mode {
1589+ return self.ramp_key_speed.unwrap_or_else(|| self.ramp_default_speed());
1590+ }
594 self.speed_open1591 self.speed_open
595 .zip(self.session.as_ref())1592 .zip(self.session.as_ref())
596 .map_or(Speed::NORMAL, |((lane, idx), session)| {1593 .map_or(Speed::NORMAL, |((lane, idx), session)| {
@@ -600,8 +1597,8 @@ impl Player {
600 1597
601 /// Writes a rate at the card's clip and its whole group -- one undo step for1598 /// Writes a rate at the card's clip and its whole group -- one undo step for
602 /// the lot ([`engine::PlaybackSession::set_speed`]). The engine reseeks, so1599 /// the lot ([`engine::PlaybackSession::set_speed`]). The engine reseeks, so
603- /// the picture runs at the new rate and the sound is resampled from the next1600+ /// the picture runs at the new rate and the sound is time-stretched from the
604- /// chunk on; a refusal (a slower clip would run into its neighbour) comes1601+ /// next chunk on, pitch kept; a refusal (a slower clip would run into its neighbour) comes
605 /// back in the engine's own words and *names* the clip in the way, because1602 /// back in the engine's own words and *names* the clip in the way, because
606 /// "it did not fit" is not something a person can go and fix.1603 /// "it did not fit" is not something a person can go and fix.
607 pub(crate) fn set_speed(&mut self, speed: Speed, cx: &mut Context<Self>) {1604 pub(crate) fn set_speed(&mut self, speed: Speed, cx: &mut Context<Self>) {
@@ -613,8 +1610,18 @@ impl Player {
613 /// 2.00x is one undo press and lands back where the hand picked it up, and1610 /// 2.00x is one undo press and lands back where the hand picked it up, and
614 /// the whole linked group comes back with it.1611 /// the whole linked group comes back with it.
615 pub(crate) fn write_speed(&mut self, speed: Speed, live: bool, cx: &mut Context<Self>) {1612 pub(crate) fn write_speed(&mut self, speed: Speed, live: bool, cx: &mut Context<Self>) {
1613+ self.named_step("Speed", |this| this.write_speed_now(speed, live, cx));
1614+ }
1615+
1616+ fn write_speed_now(&mut self, speed: Speed, live: bool, cx: &mut Context<Self>) {
616 // The colour card's rule: a write supersedes whatever a drag was holding.1617 // The colour card's rule: a write supersedes whatever a drag was holding.
617 self.pending_speed = None;1618 self.pending_speed = None;
1619+ if self.speed_ramp_mode {
1620+ // Nothing is written until a key is added: the bar picks its speed.
1621+ self.ramp_key_speed = Some(speed);
1622+ cx.notify();
1623+ return;
1624+ }
618 let Some((lane, idx)) = self.speed_open else {1625 let Some((lane, idx)) = self.speed_open else {
619 return;1626 return;
620 };1627 };
@@ -637,6 +1644,441 @@ impl Player {
637 cx.notify();1644 cx.notify();
638 }1645 }
639 1646
1647+ /// Reverses the clip the speed card is open on, or the one the menu and the
1648+ /// palette mean (the selection, else the picture under the playhead --
1649+ /// `open_speed`'s rule), and its whole group: one undo step. Said once on
1650+ /// the toast so the toggle has an answer when the card is closed.
1651+ pub(crate) fn toggle_reverse(&mut self, cx: &mut Context<Self>) {
1652+ let Some(session) = &self.session else {
1653+ self.notify_user("Nothing to reverse — no file open".into());
1654+ cx.notify();
1655+ return;
1656+ };
1657+ let anchor = self
1658+ .selected
1659+ .anchor()
1660+ .or_else(|| session.video_clip_at(session.now()))
1661+ .filter(|(lane, _)| lane.kind != LaneKind::Subtitle);
1662+ match anchor {
1663+ Some((lane, idx)) => {
1664+ let on = !session.reversed_of(lane, idx);
1665+ self.write_reverse(lane, idx, on, cx);
1666+ }
1667+ None => {
1668+ self.notify_user("Nothing to reverse — select a clip".into());
1669+ cx.notify();
1670+ }
1671+ }
1672+ }
1673+
1674+ /// Writes the direction at `(lane, idx)` and its group
1675+ /// ([`engine::PlaybackSession::set_reverse`]); the engine reseeks, so the
1676+ /// picture and the sound run the new way from the next frame.
1677+ pub(crate) fn write_reverse(&mut self, lane: Lane, idx: usize, on: bool, cx: &mut Context<Self>) {
1678+ let Some(session) = &mut self.session else {
1679+ return;
1680+ };
1681+ match session.set_reverse(lane, idx, on) {
1682+ Ok(()) => {
1683+ self.mark_dirty();
1684+ self.reset_after_reseek();
1685+ }
1686+ Err(e) => self.notify_user(e.to_string().into()),
1687+ }
1688+ cx.notify();
1689+ }
1690+
1691+ /// The clip a ramp edit acts on: the open card's, else the speed actions' own pick.
1692+ fn ramp_target(&mut self, cx: &mut Context<Self>) -> Option<(Lane, usize)> {
1693+ match self.speed_open {
1694+ Some(clip) => Some(clip),
1695+ None => self.speed_anchor(cx),
1696+ }
1697+ }
1698+
1699+ /// The playhead's frame counted from the start of the clip at `clip`, when the
1700+ /// playhead is on it.
1701+ fn ramp_playhead(&self, clip: (Lane, usize)) -> Option<u32> {
1702+ let session = self.session.as_ref()?;
1703+ let c = session.lane_clips(clip.0).get(clip.1)?;
1704+ let at = crate::subs::frame_at(session.now(), self.fps);
1705+ (at >= c.start && at < c.end()).then(|| at - c.start)
1706+ }
1707+
1708+ /// The speed the ramp runs at the playhead on the card's clip (or the clip's
1709+ /// constant one without a ramp): what the bar holds for the next key until a
1710+ /// hand moves it.
1711+ pub(crate) fn ramp_default_speed(&self) -> Speed {
1712+ let Some(clip) = self.speed_open else {
1713+ return Speed::NORMAL;
1714+ };
1715+ let Some(c) = self
1716+ .session
1717+ .as_ref()
1718+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1719+ else {
1720+ return Speed::NORMAL;
1721+ };
1722+ match self.ramp_playhead(clip) {
1723+ Some(rel) if !c.speed_keys.is_empty() => {
1724+ engine::project::ramp_speed_at(&c.speed_keys, rel)
1725+ }
1726+ _ => c.speed,
1727+ }
1728+ }
1729+
1730+ /// Writes `keys` as the ramp of `clip` and its group -- one undo step -- and
1731+ /// reseeks. Empty keys clear the ramp. A refusal (the longer clip would run into
1732+ /// its neighbour) comes back in the engine's words, as the constant rate's does.
1733+ fn write_ramp(&mut self, clip: (Lane, usize), keys: &[engine::project::SpeedKey], cx: &mut Context<Self>) {
1734+ let Some(session) = &mut self.session else {
1735+ return;
1736+ };
1737+ let before = session.lane_clips(clip.0).get(clip.1).map(|c| c.frames());
1738+ match session.set_speed_ramp(clip.0, clip.1, keys) {
1739+ Ok(()) => {
1740+ let after = self.session.as_ref().and_then(|s| s.lane_clips(clip.0).get(clip.1)).map(|c| c.frames());
1741+ self.mark_dirty();
1742+ self.reset_after_reseek();
1743+ if self.speed_open == Some(clip) {
1744+ self.speed_ramp_mode = !keys.is_empty() || self.speed_ramp_mode;
1745+ self.ramp_key_speed = None;
1746+ }
1747+ // A ramp that runs shorter leaves its space empty: nothing ripples, so say so.
1748+ if let (Some(before), Some(after)) = (before, after)
1749+ && after < before
1750+ {
1751+ let secs = f64::from(after) / self.fps.max(1.);
1752+ self.notify_user(
1753+ format!("Shortened to {secs:.1} s. The space after it is empty: Close gap removes it.").into(),
1754+ );
1755+ }
1756+ }
1757+ Err(e) => self.notify_user(e.to_string().into()),
1758+ }
1759+ cx.notify();
1760+ }
1761+
1762+ /// Lays a ramp shape across the target clip's length on the timeline.
1763+ pub(crate) fn set_ramp_preset(&mut self, preset: RampPreset, cx: &mut Context<Self>) {
1764+ if self.exporting().is_some() {
1765+ return;
1766+ }
1767+ let Some(clip) = self.ramp_target(cx) else {
1768+ return;
1769+ };
1770+ let frames = self
1771+ .session
1772+ .as_ref()
1773+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1774+ .map_or(0, Clip::frames);
1775+ match preset.keys(frames) {
1776+ Some(keys) => {
1777+ self.write_ramp(clip, &keys, cx);
1778+ if self.speed_open == Some(clip) {
1779+ self.speed_ramp_mode = true;
1780+ }
1781+ }
1782+ None => {
1783+ self.notify_user("This clip is too short for that speed ramp".into());
1784+ cx.notify();
1785+ }
1786+ }
1787+ }
1788+
1789+ /// Puts a key at the playhead on the target clip: the bar's speed when the card
1790+ /// is up, else the speed the ramp already runs there. The first key on a clip with
1791+ /// no ramp is joined by one at its start holding the constant speed, so the ramp
1792+ /// eases into the key instead of being a constant at it.
1793+ pub(crate) fn add_ramp_key(&mut self, cx: &mut Context<Self>) {
1794+ if self.exporting().is_some() {
1795+ return;
1796+ }
1797+ let Some(clip) = self.ramp_target(cx) else {
1798+ return;
1799+ };
1800+ let Some(rel) = self.ramp_playhead(clip) else {
1801+ self.notify_user("Put the playhead on the clip to key its speed there".into());
1802+ cx.notify();
1803+ return;
1804+ };
1805+ let Some(c) = self
1806+ .session
1807+ .as_ref()
1808+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1809+ .cloned()
1810+ else {
1811+ return;
1812+ };
1813+ let speed = match self.speed_open == Some(clip) && self.speed_ramp_mode {
1814+ true => self.card_speed(),
1815+ false => match c.speed_keys.is_empty() {
1816+ true => c.speed,
1817+ false => engine::project::ramp_speed_at(&c.speed_keys, rel),
1818+ },
1819+ };
1820+ let base = match c.speed_keys.is_empty() && rel > 0 {
1821+ true => vec![engine::project::SpeedKey { at: 0, speed: c.speed }],
1822+ false => c.speed_keys.clone(),
1823+ };
1824+ match ramp_with_key(&base, rel, speed) {
1825+ Some(keys) => self.write_ramp(clip, &keys, cx),
1826+ None => {
1827+ self.notify_user(
1828+ format!("A speed ramp holds at most {} keys", engine::project::MAX_SPEED_KEYS)
1829+ .into(),
1830+ );
1831+ cx.notify();
1832+ }
1833+ }
1834+ }
1835+
1836+ /// Takes the `i`th key off the card's ramp.
1837+ pub(crate) fn remove_ramp_key(&mut self, i: usize, cx: &mut Context<Self>) {
1838+ let Some(clip) = self.speed_open else {
1839+ return;
1840+ };
1841+ let Some(c) = self
1842+ .session
1843+ .as_ref()
1844+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1845+ else {
1846+ return;
1847+ };
1848+ let keys = ramp_without_key(&c.speed_keys, i);
1849+ self.write_ramp(clip, &keys, cx);
1850+ }
1851+
1852+ /// Moves the `i`th key's speed by `steps` quarters.
1853+ pub(crate) fn step_ramp_key(&mut self, i: usize, steps: i32, cx: &mut Context<Self>) {
1854+ let Some(clip) = self.speed_open else {
1855+ return;
1856+ };
1857+ let Some(c) = self
1858+ .session
1859+ .as_ref()
1860+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1861+ else {
1862+ return;
1863+ };
1864+ let keys = ramp_key_stepped(&c.speed_keys, i, steps);
1865+ self.write_ramp(clip, &keys, cx);
1866+ }
1867+
1868+ /// Takes the target clip's speed ramp off: its constant speed comes back.
1869+ pub(crate) fn clear_ramp(&mut self, cx: &mut Context<Self>) {
1870+ if self.exporting().is_some() {
1871+ return;
1872+ }
1873+ let Some(clip) = self.ramp_target(cx) else {
1874+ return;
1875+ };
1876+ let had = self
1877+ .session
1878+ .as_ref()
1879+ .and_then(|s| s.lane_clips(clip.0).get(clip.1))
1880+ .is_some_and(|c| !c.speed_keys.is_empty());
1881+ if had {
1882+ self.write_ramp(clip, &[], cx);
1883+ }
1884+ if self.speed_open == Some(clip) {
1885+ self.speed_ramp_mode = false;
1886+ self.ramp_key_speed = None;
1887+ }
1888+ cx.notify();
1889+ }
1890+
1891+ /// Starts an auto reframe of the clip: its subject is found on a thread of its
1892+ /// own ([`engine::reframe::analyse`]), shown as a percent in the status bar, and
1893+ /// [`Self::poll_reframe`] writes the keys -- one undo step -- when it lands.
1894+ pub(crate) fn start_reframe(&mut self, lane: Lane, idx: usize, cx: &mut Context<Self>) {
1895+ if self.reframe_run.is_some() {
1896+ self.notify_user("Auto reframe is already measuring a clip".into());
1897+ cx.notify();
1898+ return;
1899+ }
1900+ let Some(job) = self.session.as_ref().and_then(|s| s.reframe_job(lane, idx)) else {
1901+ self.notify_user("Auto reframe: select a video clip".into());
1902+ cx.notify();
1903+ return;
1904+ };
1905+ let run = ReframeRun {
1906+ lane,
1907+ idx,
1908+ job: job.clone(),
1909+ progress: Arc::new(AtomicU32::new(0)),
1910+ cancel: Arc::new(AtomicBool::new(false)),
1911+ result: Arc::new(Mutex::new(None)),
1912+ };
1913+ let (progress, cancel, result) = (run.progress.clone(), run.cancel.clone(), run.result.clone());
1914+ std::thread::spawn(move || {
1915+ let r = engine::reframe::analyse(&job.path, job.lo, job.hi, &progress, &cancel).map_err(|e| e.to_string());
1916+ if let Ok(mut slot) = result.lock() {
1917+ *slot = Some(r);
1918+ }
1919+ });
1920+ self.reframe_run = Some(run);
1921+ cx.notify();
1922+ }
1923+
1924+ /// Auto reframe of the selected clip ([`ActionId::Reframe`]).
1925+ pub(crate) fn reframe_selected(&mut self, cx: &mut Context<Self>) {
1926+ match self.selected.anchor() {
1927+ Some((lane, idx)) => self.start_reframe(lane, idx, cx),
1928+ None => {
1929+ self.notify_user("Auto reframe: select a video clip".into());
1930+ cx.notify();
1931+ }
1932+ }
1933+ }
1934+
1935+ /// Stops the running reframe measurement.
1936+ pub(crate) fn cancel_reframe(&mut self, cx: &mut Context<Self>) {
1937+ if let Some(run) = &self.reframe_run {
1938+ run.cancel.store(true, Ordering::Relaxed);
1939+ }
1940+ cx.notify();
1941+ }
1942+
1943+ /// The status bar's words for a running reframe, `Reframing 42%`.
1944+ pub(crate) fn reframe_words(&self) -> Option<String> {
1945+ let run = self.reframe_run.as_ref()?;
1946+ Some(format!("Reframing {}%", run.progress.load(Ordering::Relaxed) / 10))
1947+ }
1948+
1949+ /// Lands a finished reframe: the keys are written if the clip is still the one
1950+ /// that was measured, and a failure or a stop is said once.
1951+ pub(crate) fn poll_reframe(&mut self) {
1952+ let Some(run) = &self.reframe_run else { return };
1953+ let Some(outcome) = run.result.lock().ok().and_then(|mut r| r.take()) else { return };
1954+ let run = self.reframe_run.take().expect("checked above");
1955+ let said = match outcome {
1956+ Err(e) if run.cancel.load(Ordering::Relaxed) => {
1957+ let _ = e;
1958+ "Auto reframe stopped".to_string()
1959+ }
1960+ Err(e) => format!("Auto reframe failed: {e}"),
1961+ Ok(subject) => {
1962+ let Some(session) = &mut self.session else { return };
1963+ // The clip may have moved or changed while it was measured.
1964+ let same = session
1965+ .reframe_job(run.lane, run.idx)
1966+ .is_some_and(|j| j.path == run.job.path && (j.lo, j.hi) == (run.job.lo, run.job.hi) && j.target.in_frame == run.job.target.in_frame);
1967+ if !same {
1968+ "Auto reframe: the clip changed while it was measured; run it again".to_string()
1969+ } else {
1970+ let keys = engine::reframe::keys(&subject, &run.job.target, engine::reframe::DEFAULT_SMOOTHNESS);
1971+ let n = keys.len();
1972+ if session.apply_reframe(run.lane, run.idx, keys) {
1973+ self.reframed = Some((run.lane, run.idx, n));
1974+ self.mark_dirty();
1975+ self.reset_after_reseek();
1976+ format!("Reframed to the project with {n} key{} (Ctrl+Z undoes it)", if n == 1 { "" } else { "s" })
1977+ } else {
1978+ "Auto reframe: no change — the clip is already framed this way".to_string()
1979+ }
1980+ }
1981+ }
1982+ };
1983+ self.notify_user(said.into());
1984+ }
1985+
1986+ /// Turns the clip's stabilisation on with `st`, or off with `None`, as one
1987+ /// undo step. Turning it on starts its analysis in the background, and the
1988+ /// clip is waited on ([`Self::poll_stabilise`]) until it lands.
1989+ pub(crate) fn write_stabilise(
1990+ &mut self,
1991+ lane: Lane,
1992+ idx: usize,
1993+ st: Option<engine::stabilise::Stabilise>,
1994+ cx: &mut Context<Self>,
1995+ ) {
1996+ let Some(session) = &mut self.session else {
1997+ return;
1998+ };
1999+ if session.set_stabilise(lane, idx, st) {
2000+ self.mark_dirty();
2001+ self.reset_after_reseek();
2002+ }
2003+ self.wait_stabilise(lane, idx);
2004+ cx.notify();
2005+ }
2006+
2007+ /// Sets how the clip's interlaced source is deinterlaced (one undo step).
2008+ pub(crate) fn write_deinterlace(
2009+ &mut self,
2010+ lane: Lane,
2011+ idx: usize,
2012+ mode: engine::project::Deinterlace,
2013+ cx: &mut Context<Self>,
2014+ ) {
2015+ if self.lane_locked_refusal(lane) {
2016+ cx.notify();
2017+ return;
2018+ }
2019+ let Some(session) = &mut self.session else {
2020+ return;
2021+ };
2022+ if session.set_deinterlace(lane, idx, mode) {
2023+ self.mark_dirty();
2024+ }
2025+ cx.notify();
2026+ }
2027+
2028+ /// Starts (again, after a failure) the clip's analysis and waits on it.
2029+ pub(crate) fn wait_stabilise(&mut self, lane: Lane, idx: usize) {
2030+ let Some(session) = &self.session else {
2031+ return;
2032+ };
2033+ if session.stabilise_of(lane, idx).is_none() {
2034+ return;
2035+ }
2036+ if let (Some(range), Some(engine::stabilise::Status::Running(_))) =
2037+ (session.stabilise_range(lane, idx), session.stabilise_start(lane, idx))
2038+ && !self.stab_waiting.contains(&range)
2039+ {
2040+ self.stab_waiting.push(range);
2041+ }
2042+ }
2043+
2044+ /// Stops the clip's running analysis; the clip stays switched on and plays
2045+ /// as it is until it is analysed.
2046+ pub(crate) fn cancel_stabilise(&mut self, lane: Lane, idx: usize, cx: &mut Context<Self>) {
2047+ if let Some(session) = &self.session {
2048+ session.stabilise_cancel(lane, idx);
2049+ }
2050+ cx.notify();
2051+ }
2052+
2053+ /// Lands every finished analysis: the picture is redrawn with its
2054+ /// correction, and a failure is said once.
2055+ pub(crate) fn poll_stabilise(&mut self) {
2056+ if self.stab_waiting.is_empty() {
2057+ return;
2058+ }
2059+ let mut landed = false;
2060+ let mut said = Vec::new();
2061+ self.stab_waiting.retain(|(path, lo, hi)| match engine::stabilise::status(path, *lo, *hi) {
2062+ engine::stabilise::Status::Running(_) => true,
2063+ engine::stabilise::Status::Ready => {
2064+ landed = true;
2065+ false
2066+ }
2067+ engine::stabilise::Status::Failed(e) => {
2068+ said.push(format!("Stabilise stopped for {}: {e}", file_name(path)));
2069+ false
2070+ }
2071+ engine::stabilise::Status::Missing => false,
2072+ });
2073+ if landed && let Some(session) = &mut self.session {
2074+ session.stabilise_refresh();
2075+ self.reset_after_reseek();
2076+ }
2077+ for text in said {
2078+ self.notify_user(text.into());
2079+ }
2080+ }
2081+
640 /// One [`SPEED_STEP`] per keystroke, clamped to what a [`Speed`] can hold.2082 /// One [`SPEED_STEP`] per keystroke, clamped to what a [`Speed`] can hold.
641 pub(crate) fn nudge_speed(&mut self, steps: i32, cx: &mut Context<Self>) {2083 pub(crate) fn nudge_speed(&mut self, steps: i32, cx: &mut Context<Self>) {
642 let at = i32::from(self.card_speed().permille()) + steps * SPEED_STEP;2084 let at = i32::from(self.card_speed().permille()) + steps * SPEED_STEP;
@@ -644,26 +2086,19 @@ impl Player {
644 }2086 }
645 2087
646 /// Where the pointer sits along the bar, as a rate: the left end is2088 /// Where the pointer sits along the bar, as a rate: the left end is
647- /// [`Speed::MIN`] and the right end [`Speed::MAX`], on the same2089+ /// [`Speed::MIN`] and the right end [`Speed::MAX`], on a log scale, and
648- /// [`SPEED_STEP`] grid the keys move on -- so a drag can land on exactly2090+ /// snapped to the same [`SPEED_STEP`] grid the keys move on -- so a drag can
649- /// 1.00x and the same drag twice is one entry, not forty.2091+ /// land on exactly 1.00x and the same drag twice is one entry, not forty.
650 /// `first` is the press: it takes the undo step the whole gesture rolls back2092 /// `first` is the press: it takes the undo step the whole gesture rolls back
651 /// to, and every sample after it is live -- the colour card's rule, for the2093 /// to, and every sample after it is live -- the colour card's rule, for the
652 /// colour card's reason.2094 /// colour card's reason.
653 pub(crate) fn drag_speed(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {2095 pub(crate) fn drag_speed(&mut self, x: Pixels, first: bool, cx: &mut Context<Self>) {
654 let along = frac_along(x, self.speed_bar.get());2096 let along = frac_along(x, self.speed_bar.get());
655- let lo = f32::from(Speed::MIN.permille());
656- let hi = f32::from(Speed::MAX.permille());
657- let raw = lo + along * (hi - lo);
658- // Snapped to the grid, then to real time itself when it is within half a
659- // step of it: 1.00x is the one value a hand must be able to hit, and
660- // nothing about the bar's geometry guarantees a pixel lands on it.
661- let stepped = (raw / SPEED_STEP as f32).round() as i32 * SPEED_STEP;
662 // Held back while the worker is busy, the colour card's way and for a2097 // Held back while the worker is busy, the colour card's way and for a
663 // sharper reason: a live rate also restarts the sound, so a sweep that2098 // sharper reason: a live rate also restarts the sound, so a sweep that
664 // wrote every step would restart it forty times.2099 // wrote every step would restart it forty times.
665 let busy = self.seek_since.is_some();2100 let busy = self.seek_since.is_some();
666- match stash_or_write(&mut self.pending_speed, speed_at(stepped), first, busy) {2101+ match stash_or_write(&mut self.pending_speed, speed_on_bar(along), first, busy) {
667 Some(speed) => self.write_speed(speed, !first, cx),2102 Some(speed) => self.write_speed(speed, !first, cx),
668 None => cx.notify(),2103 None => cx.notify(),
669 }2104 }
@@ -709,7 +2144,7 @@ impl Player {
709 return;2144 return;
710 }2145 }
711 let Some(session) = &self.session else {2146 let Some(session) = &self.session else {
712- self.notify_user("NOTHING TO SCAN — no file open".into());2147+ self.notify_user("Nothing to scan — no file open".into());
713 cx.notify();2148 cx.notify();
714 return;2149 return;
715 };2150 };
@@ -727,7 +2162,7 @@ impl Player {
727 Some(half) => Some(half),2162 Some(half) => Some(half),
728 None => {2163 None => {
729 self.notify_user(2164 self.notify_user(
730- "NOTHING TO SCAN — a caption has no sound of its own".into(),2165+ "Nothing to scan — a caption has no sound of its own".into(),
crates/app/src/player/editkeys.rsadded+635 -0

Diff too large; view file

@@ -0,0 +1,635 @@
1+//! The timeline-editing verbs every NLE has and edith lacked: close the gap
2+//! under the playhead, freeze a frame, paste attributes, match frame, replace
3+//! edit, select forward, split edits and the nudge. Each is one [`ActionId`], so
4+//! the menu row, the stroke and the palette are the same door, and each is one
5+//! undo step (a verb that touches several clips wraps them in a batch).
6+
7+use crate::*;
8+
9+pub(crate) use engine::editkeys::{matched_source, nudge, paste_look, look_of, replace_plan, split_edit_in, CopiedLook, Part, PasteReport};
10+
11+/// The clips that have not ended by `frame` on each of `lanes`: what select
12+/// track forward marks. A locked lane is left out, as Select All leaves it.
13+pub(crate) fn forward_picks(session: &PlaybackSession, frame: u32, lanes: &[Lane]) -> Selection {
14+ let mut picked = Selection::new();
15+ for &l in lanes.iter().filter(|l| l.kind != LaneKind::Subtitle) {
16+ if session.lane_locked(l) {
17+ continue;
18+ }
19+ for (i, c) in session.lane_clips(l).iter().enumerate() {
20+ if c.end() > frame {
21+ picked.add((l, i));
22+ }
23+ }
24+ }
25+ picked
26+}
27+
28+/// The selection a box makes: every clip or caption crossing frames `f1..=f2`
29+/// on the lanes whose bed spans overlap `rows` (top, bottom). `beds` is each
30+/// lane's `(top, bottom)`. `base` is kept when the box adds to the selection.
31+pub(crate) fn marquee_picks(
32+ session: &PlaybackSession,
33+ beds: &[(Lane, f32, f32)],
34+ rows: (f32, f32),
35+ frames: (u32, u32),
36+ base: Selection,
37+) -> Selection {
38+ let mut picked = base;
39+ for &(lane, top, bottom) in beds {
40+ if bottom <= rows.0 || top >= rows.1 || session.lane_locked(lane) {
41+ continue;
42+ }
43+ match lane.kind {
44+ LaneKind::Subtitle => {
45+ for (i, s) in session.sub_lane(lane).iter().enumerate() {
46+ if s.start <= frames.1 && s.end() > frames.0 {
47+ picked.add((lane, i));
48+ }
49+ }
50+ }
51+ _ => {
52+ for (i, c) in session.lane_clips(lane).iter().enumerate() {
53+ if c.start <= frames.1 && c.end() > frames.0 {
54+ picked.add((lane, i));
55+ }
56+ }
57+ }
58+ }
59+ }
60+ picked
61+}
62+
63+/// The first gap `frame` stands in, lanes in the order they are drawn.
64+pub(crate) fn gap_under(session: &PlaybackSession, frame: u32) -> Option<(Lane, u32, u32)> {
65+ session
66+ .lanes()
67+ .into_iter()
68+ .filter(|l| l.kind != LaneKind::Subtitle)
69+ .find_map(|l| crate::timeline_math::between_clips(session.gap_at(l, frame)).map(|(start, frames)| (l, start, frames)))
70+}
71+
72+
73+/// How long a freeze frame holds, in seconds.
74+pub(crate) const FREEZE_SECS: f64 = 2.;
75+/// How far a freeze may move the playhead to the nearest frame a slowed clip can be cut at.
76+const FREEZE_REACH: u32 = 12;
77+
78+/// The file a still is kept in: `title.png`, or `title 2.png`, `title 3.png`... where a name
79+/// holds other pixels. A name already holding these bytes is reused, so a repeat freeze of
80+/// the same frame adds no file.
81+fn still_path(dir: &Path, title: &str, bytes: &[u8]) -> Result<PathBuf, String> {
82+ std::fs::create_dir_all(dir).map_err(|e| format!("cannot create {}: {e}", dir.display()))?;
83+ let mut n = 1;
84+ loop {
85+ let path = dir.join(still_name(title, n));
86+ match std::fs::read(&path) {
87+ Ok(old) if old == bytes => return Ok(path),
88+ Ok(_) => n += 1,
89+ Err(_) => {
90+ std::fs::write(&path, bytes).map_err(|e| format!("cannot write {}: {e}", path.display()))?;
91+ return Ok(path);
92+ }
93+ }
94+ }
95+}
96+
97+/// The name the `n`th still with `title` is kept under: the first is the title alone.
98+pub(crate) fn still_name(title: &str, n: u32) -> String {
99+ match n {
100+ 1 => format!("{title}.png"),
101+ n => format!("{title} {n}.png"),
102+ }
103+}
104+
105+impl Player {
106+ fn playhead_frame(&self) -> u32 {
107+ self.session.as_ref().map_or(0, |s| frame_at(s.now(), self.fps))
108+ }
109+
110+ /// The gap Close gap acts on: the picked one, else the first gap the
111+ /// playhead stands in, lanes in the order they are drawn.
112+ pub(crate) fn gap_here(&self) -> Option<(Lane, u32, u32)> {
113+ if let Some(pick) = self.gap_pick() {
114+ return Some((pick.lane, pick.start, pick.frames));
115+ }
116+ gap_under(self.session.as_ref()?, self.playhead_frame())
117+ }
118+
119+ /// Close gap: ripples shut the gap under the playhead (or the picked one),
120+ /// scoped like the right-click and Delete-on-a-gap doors.
121+ pub(crate) fn close_gap_here(&mut self, cx: &mut Context<Self>) {
122+ if self.exporting().is_some() {
123+ return;
124+ }
125+ let Some((lane, start, frames)) = self.gap_here() else {
126+ self.notify_user("Close gap — no gap under the playhead".into());
127+ cx.notify();
128+ return;
129+ };
130+ if self.lane_locked_refusal(lane) {
131+ cx.notify();
132+ return;
133+ }
134+ self.close_gap(lane, start, frames, cx);
135+ if self.gap_pick().is_none() {
136+ self.gap = None;
137+ }
138+ }
139+
140+ /// The clip a playhead verb acts on: the selected one when the playhead is
141+ /// over it, else the first clip under the playhead, video first.
142+ fn clip_here(&self) -> Option<(Lane, usize)> {
143+ let under = self.under_playhead();
144+ self.selected
145+ .anchor()
146+ .filter(|pick| under.contains(pick))
147+ .or_else(|| under.first().copied())
148+ }
149+
150+ /// Freeze frame: holds the picture the playhead shows for [`FREEZE_SECS`].
151+ /// Every lane is cut at the playhead and what follows moves later, as the
152+ /// MCP `freeze` op does with `insert: true`; the still is composed from the
153+ /// timeline (grade, effects and all) and kept in `freeze/` beside the
154+ /// project. One undo step.
155+ pub(crate) fn freeze_frame(&mut self, cx: &mut Context<Self>) {
156+ if self.exporting().is_some() {
157+ return;
158+ }
159+ // The picture the hand is holding (the selected clip when the playhead is over it), else
160+ // the first picture under the playhead: a PiP above a clip does not take the freeze.
161+ let under = self.under_playhead();
162+ let Some((lane, idx)) = self
163+ .clip_here()
164+ .filter(|(l, _)| l.kind == LaneKind::Video)
165+ .or_else(|| under.iter().copied().find(|(l, _)| l.kind == LaneKind::Video))
166+ else {
167+ self.notify_user("Freeze frame — no picture under the playhead".into());
168+ cx.notify();
169+ return;
170+ };
171+ let Some(dir) = self.project_path.parent().filter(|_| !self.project_path.as_os_str().is_empty()) else {
172+ self.notify_user("Freeze frame — the project is unsaved, and the still is kept beside it".into());
173+ cx.notify();
174+ return;
175+ };
176+ let dir = dir.join("freeze");
177+ let playhead = self.playhead_frame();
178+ let at = playhead;
179+ let fps = self.fps;
180+ let dur = (FREEZE_SECS * fps).round() as u32;
181+ let Some(session) = self.session.as_ref() else {
182+ return;
183+ };
184+ // A slowed clip can be cut only where its rate lands on a whole source frame: the still
185+ // is taken at the nearest such frame, so the held picture and the cut are the same frame.
186+ let at = session.cut_frame_near(at, FREEZE_REACH).unwrap_or(at);
187+ // The still is named for the clip it holds, so the timeline reads "Freeze – <clip>".
188+ let title = session
189+ .lane_clips(lane)
190+ .get(idx)
191+ .and_then(|c| session.sources().get(c.source))
192+ .and_then(|src| src.path.file_stem())
193+ .map_or_else(|| "Freeze".to_string(), |s| format!("Freeze \u{2013} {}", s.to_string_lossy()));
194+ if let Some(locked) = session.lanes().into_iter().find(|&l| session.lane_locked(l)) {
195+ self.lane_locked_refusal(locked);
196+ cx.notify();
197+ return;
198+ }
199+ let (proj, meta) = session.export_snapshot();
200+ let png = match engine::export::compose_at(&proj, &meta, at, meta.width, meta.height)
201+ .map_err(|e| e.to_string())
202+ .and_then(|frame| {
203+ let bytes = engine::decode::to_png_bytes(&frame).map_err(|e| e.to_string())?;
204+ still_path(&dir, &title, &bytes)
205+ }) {
206+ Ok(path) => path,
207+ Err(e) => {
208+ self.notify_user(format!("Freeze frame — {e}").into());
209+ cx.notify();
210+ return;
211+ }
212+ };
213+ let Some(session) = self.session.as_mut() else {
214+ return;
215+ };
216+ session.begin_batch();
217+ let done = Self::freeze_edit(session, at, dur, fps, lane, &png);
218+ session.end_batch();
219+ match done {
220+ Ok(moved) => {
221+ self.selected.clear();
222+ self.reset_after_reseek();
223+ self.mark_dirty();
224+ // Said plainly when the still landed off the playhead, so the picture the person sees
225+ // and the frame the toast names are never different without a word about it. When the
226+ // clips after it moved, the toast says so: the hold is a ripple, not an overwrite.
227+ let held = format!("for {FREEZE_SECS:.1} s");
228+ let ripple = match moved {
229+ true => format!(" \u{00b7} later clips moved {FREEZE_SECS:.1} s"),
230+ false => String::new(),
231+ };
232+ let msg = match at == playhead {
233+ true => format!("Froze {} {held}{ripple}", timecode(f64::from(at) / fps, fps)),
234+ false => format!(
235+ "Freeze frame added at {} (nearest frame the speed ramp allows){ripple}",
236+ timecode(f64::from(at) / fps, fps)
237+ ),
238+ };
239+ self.notify_user_action(msg.into(), ToastAction::Undo);
240+ }
241+ Err(e) => {
242+ // A refusal part-way (a slowed clip that cannot be cut here) leaves its cuts in the
243+ // batch's one step: take that step back so a refused freeze changes nothing.
244+ if let Some(session) = self.session.as_mut() {
245+ session.undo();
246+ }
247+ self.reset_after_reseek();
248+ self.notify_user(format!("Freeze frame — {e}").into());
249+ }
250+ }
251+ cx.notify();
252+ }
253+
254+ /// The edit of a freeze, inside the caller's batch.
255+ pub(crate) fn freeze_edit(
256+ session: &mut PlaybackSession,
257+ at: u32,
258+ dur: u32,
259+ fps: f64,
260+ lane: Lane,
261+ png: &Path,
262+ ) -> Result<bool, String> {
263+ let n = match session.sources().iter().position(|s| s.path == png) {
264+ Some(i) => i,
265+ None => session.import(png).map_err(|e| format!("cannot import the still: {e}"))?,
266+ };
267+ if dur > session.file_frames(png) {
268+ return Err("that is longer than a still can be held".into());
269+ }
270+ let straddles = |s: &PlaybackSession| {
271+ s.lanes().into_iter().filter(|l| l.kind != LaneKind::Subtitle).any(|l| {
272+ s.lane_clips(l).iter().any(|c| c.start < at && at < c.end())
273+ })
274+ };
275+ if straddles(session) {
276+ session.cut_at(f64::from(at) / fps);
277+ if straddles(session) {
278+ return Err("a slowed clip cannot be cut at this frame".into());
279+ }
280+ }
281+ let mut picks: Vec<(Lane, usize)> = Vec::new();
282+ for l in session.lanes() {
283+ match l.kind {
284+ LaneKind::Subtitle => {
285+ picks.extend(session.sub_lane(l).iter().enumerate().filter(|(_, c)| c.start >= at).map(|(i, _)| (l, i)));
286+ }
287+ _ => picks.extend(session.lane_clips(l).iter().enumerate().filter(|(_, c)| c.start >= at).map(|(i, _)| (l, i))),
288+ }
289+ }
290+ let first_media = picks.iter().copied().find(|(l, _)| l.kind != LaneKind::Subtitle);
291+ match first_media {
292+ Some((dl, di)) => {
293+ let start = session.lane_clips(dl)[di].start + dur;
294+ if !session.move_selection_to(&picks, dl, di, dl, start) {
295+ return Err("what follows cannot all move later".into());
296+ }
297+ }
298+ None => {
299+ for &(l, i) in picks.iter().rev() {
300+ let start = session.sub_lane(l)[i].start + dur;
301+ session.move_sub(l, i, l, start).map_err(|e| e.to_string())?;
302+ }
303+ }
304+ }
305+ let tail: Vec<usize> =
306+ session.titles().iter().enumerate().filter(|(_, t)| t.start >= at).map(|(i, _)| i).collect();
307+ for &i in tail.iter().rev() {
308+ let mut t = session.titles()[i].clone();
309+ t.start += dur;
310+ session.set_title(i, t);
311+ }
312+ session.remap_chapters(|f| if f >= at { f + dur } else { f });
313+ session.remap_markers(|f| if f >= at { f + dur } else { f });
314+ if !session.place_at(lane, f64::from(at) / fps, Clip::source_range(n, 0, dur)) {
315+ return Err("the still would not go there".into());
316+ }
317+ // Whether anything after the still moved to make room for it.
318+ Ok(!picks.is_empty())
319+ }
320+
321+ /// The look of the selected clip, read for a copy.
322+ pub(crate) fn capture_look(&self) -> Option<CopiedLook> {
323+ look_of(self.session.as_ref()?, self.selected.anchor()?)
324+ }
325+
326+ /// Paste attributes: the copied clip's `parts` onto every selected clip.
327+ /// A picture part reaches the picture of each pick (the video half of an
328+ /// audio pick's take), the audio part the sound. One undo step.
329+ pub(crate) fn paste_attributes(&mut self, parts: &[Part], cx: &mut Context<Self>) {
330+ if self.exporting().is_some() {
331+ return;
332+ }
333+ let Some(look) = self.copied_look.clone() else {
334+ self.notify_user("Paste attributes — nothing copied yet".into());
335+ cx.notify();
336+ return;
337+ };
338+ let picks: Vec<(Lane, usize)> =
339+ self.marks().0.into_iter().filter(|(l, _)| l.kind != LaneKind::Subtitle).collect();
340+ if picks.is_empty() {
341+ self.notify_user("Paste attributes — select the clips to paste onto".into());
342+ cx.notify();
343+ return;
344+ }
345+ if let Some(lane) = self.marked_locked_lane() {
346+ self.lane_locked_refusal(lane);
347+ cx.notify();
348+ return;
349+ }
350+ let Some(session) = self.session.as_mut() else {
351+ return;
352+ };
353+ let PasteReport { touched, words, why } = paste_look(session, &look, &picks, parts);
354+ self.reset_after_reseek();
355+ if touched > 0 {
356+ self.mark_dirty();
357+ let mut text = format!("Pasted {} onto {} clip(s)", words.join(", "), picks.len());
358+ if !why.is_empty() {
359+ text.push_str(&format!(" — {}", why.join("; ")));
360+ }
361+ self.notify_user_action(text.into(), ToastAction::Undo);
362+ } else if why.is_empty() {
363+ self.notify_user("Paste attributes — they already match".into());
364+ } else {
365+ self.notify_user(format!("Paste attributes — {}", why.join("; ")).into());
366+ }
367+ cx.notify();
368+ }
369+
370+ /// Match frame: opens the source of the clip under the playhead in the
371+ /// library preview, parked on the frame the playhead shows.
372+ pub(crate) fn match_frame(&mut self, cx: &mut Context<Self>) {
373+ if self.exporting().is_some() {
374+ return;
375+ }
376+ let Some((lane, idx)) = self.clip_here() else {
377+ self.notify_user("Match frame — nothing under the playhead".into());
378+ cx.notify();
379+ return;
380+ };
381+ let (frame, fps) = (self.playhead_frame(), self.fps);
382+ let Some(session) = self.session.as_ref() else {
383+ return;
384+ };
385+ let Some((path, stream, secs)) = matched_source(session, (lane, idx), frame, fps) else {
386+ self.notify_user("Match frame — a compound clip plays a sequence, not a file".into());
387+ cx.notify();
388+ return;
389+ };
390+ self.open_preview(&path, stream, cx);
391+ if self.preview_session.is_none() {
392+ return;
393+ }
394+ self.selected_asset = Some((path.clone(), stream));
395+ self.seek(secs, cx);
396+ if let Some(p) = self.preview_session.as_mut() {
397+ p.pause();
398+ }
399+ self.notify_user(
400+ format!("Matched frame {} of {}; esc returns to the timeline", timecode(secs, fps), file_name(&path))
401+ .into(),
crates/app/src/player/effects.rsadded+457 -0

Diff too large; view file

crates/app/src/player/export.rsmodified+1027 -86

Diff too large; view file

crates/app/src/player/generators.rsadded+523 -0

Diff too large; view file

crates/app/src/player/grading.rsadded+230 -0

Diff too large; view file

crates/app/src/player/keyframes.rsadded+234 -0

Diff too large; view file

crates/app/src/player/lane_names.rsadded+82 -0

Diff too large; view file

crates/app/src/player/library.rsmodified+1368 -249

Diff too large; view file

crates/app/src/player/markers.rsadded+340 -0

Diff too large; view file

crates/app/src/player/mod.rsmodified+24 -0

Diff too large; view file

crates/app/src/player/multicam.rsadded+433 -0

Diff too large; view file

crates/app/src/player/pan.rsadded+112 -0

Diff too large; view file

crates/app/src/player/pro_trim.rsadded+183 -0

Diff too large; view file

crates/app/src/player/project_dialogs.rsadded+1172 -0

Diff too large; view file

crates/app/src/player/render_cache.rsadded+180 -0

Diff too large; view file

crates/app/src/player/sections.rsadded+193 -0

Diff too large; view file

crates/app/src/player/sequences.rsadded+287 -0

Diff too large; view file

crates/app/src/player/text_field.rsadded+70 -0

Diff too large; view file

crates/app/src/player/timeline_edit.rsmodified+1272 -180

Diff too large; view file

crates/app/src/player/titling.rsadded+503 -0

Diff too large; view file

crates/app/src/player/tools.rsadded+901 -0

Diff too large; view file

crates/app/src/player/transcript.rsadded+599 -0

Diff too large; view file

crates/app/src/player/transport.rsmodified+238 -17

Diff too large; view file

crates/app/src/player/view.rsmodified+195 -66

Diff too large; view file

crates/app/src/player/voice_record.rsadded+273 -0

Diff too large; view file

crates/app/src/recent.rsadded+236 -0

Diff too large; view file

crates/app/src/render.rsmodified+173 -10

Diff too large; view file

crates/app/src/subs.rsmodified+268 -15

Diff too large; view file

crates/app/src/tests/audio_lane.rsadded+53 -0

Diff too large; view file

crates/app/src/tests/autosave.rsadded+270 -0

Diff too large; view file

crates/app/src/tests/caps.rsadded+83 -0

Diff too large; view file

crates/app/src/tests/capsel.rsadded+54 -0

Diff too large; view file

crates/app/src/tests/cards.rsmodified+1274 -400

Diff too large; view file

crates/app/src/tests/clip_envelope.rsadded+183 -0

Diff too large; view file

crates/app/src/tests/creator.rsadded+352 -0

Diff too large; view file

crates/app/src/tests/dlg.rsadded+33 -0

Diff too large; view file

crates/app/src/tests/editing.rsmodified+941 -140

Diff too large; view file

crates/app/src/tests/editkeys.rsadded+351 -0

Diff too large; view file

crates/app/src/tests/export_sheet.rsadded+683 -0

Diff too large; view file

crates/app/src/tests/fixes1.rsadded+83 -0

Diff too large; view file

crates/app/src/tests/follow.rsadded+112 -0

Diff too large; view file

crates/app/src/tests/generators.rsadded+123 -0

Diff too large; view file

crates/app/src/tests/hspeed.rsadded+57 -0

Diff too large; view file

crates/app/src/tests/lane_names.rsadded+69 -0

Diff too large; view file

crates/app/src/tests/layout.rsmodified+1140 -738

Diff too large; view file

crates/app/src/tests/left.rsadded+34 -0

Diff too large; view file

crates/app/src/tests/medfix.rsadded+34 -0

Diff too large; view file

crates/app/src/tests/media.rsmodified+294 -80

Diff too large; view file

crates/app/src/tests/menu_wire.rsadded+304 -0

Diff too large; view file

crates/app/src/tests/mod.rsmodified+77 -36

Diff too large; view file

crates/app/src/tests/multicam.rsadded+133 -0

Diff too large; view file

crates/app/src/tests/nocycle.rsadded+120 -0

Diff too large; view file

crates/app/src/tests/polish4.rsadded+151 -0

Diff too large; view file

crates/app/src/tests/polish5.rsadded+150 -0

Diff too large; view file

crates/app/src/tests/reg.rsadded+34 -0

Diff too large; view file

crates/app/src/tests/seq2.rsadded+43 -0

Diff too large; view file

crates/app/src/tests/titles.rsadded+287 -0

Diff too large; view file

crates/app/src/tests/tlfix.rsadded+22 -0

Diff too large; view file

crates/app/src/tests/touch.rsadded+26 -0

Diff too large; view file

crates/app/src/tests/track_height.rsadded+126 -0

Diff too large; view file

crates/app/src/tests/view.rsmodified+239 -114

Diff too large; view file

crates/app/src/tests/vis.rsadded+28 -0

Diff too large; view file

crates/app/src/timeline_math.rsmodified+383 -23

Diff too large; view file

crates/app/src/titles.rsadded+120 -0

Diff too large; view file

crates/app/src/transform_ui.rsmodified+23 -2

Diff too large; view file

crates/app/src/transport.rsmodified+20 -8

Diff too large; view file

crates/app/src/ui/anchor.rsadded+78 -0

Diff too large; view file

crates/app/src/ui/bench_stance.rsdeleted+0 -1507

Diff too large; view file

crates/app/src/ui/bench_stance/clip.rsadded+1563 -0

Diff too large; view file

crates/app/src/ui/bench_stance/clip_envelope.rsadded+233 -0

Diff too large; view file

crates/app/src/ui/bench_stance/lane.rsadded+1082 -0

Diff too large; view file

crates/app/src/ui/bench_stance/mod.rsadded+735 -0

Diff too large; view file

crates/app/src/ui/bench_stance/overview.rsadded+479 -0

Diff too large; view file

crates/app/src/ui/bench_stance/ruler.rsadded+603 -0

Diff too large; view file

crates/app/src/ui/bench_stance/sub.rsadded+531 -0

Diff too large; view file

crates/app/src/ui/bench_stance/titles_row.rsadded+108 -0

Diff too large; view file

crates/app/src/ui/cards.rsdeleted+0 -2447

Diff too large; view file

crates/app/src/ui/cards/beats.rsadded+79 -0

Diff too large; view file

crates/app/src/ui/cards/caption.rsadded+233 -0

Diff too large; view file

crates/app/src/ui/cards/color.rsadded+751 -0

Diff too large; view file

crates/app/src/ui/cards/common.rsadded+386 -0

Diff too large; view file

crates/app/src/ui/cards/effects.rsadded+477 -0

Diff too large; view file

crates/app/src/ui/cards/eq.rsadded+563 -0

Diff too large; view file

crates/app/src/ui/cards/export.rsadded+1588 -0

Diff too large; view file

crates/app/src/ui/cards/generator.rsadded+207 -0

Diff too large; view file

crates/app/src/ui/cards/history.rsadded+124 -0

Diff too large; view file

crates/app/src/ui/cards/keys.rsadded+244 -0

Diff too large; view file

crates/app/src/ui/cards/markers.rsadded+200 -0

Diff too large; view file

crates/app/src/ui/cards/mix.rsadded+1134 -0

Diff too large; view file

crates/app/src/ui/cards/mod.rsadded+26 -0

Diff too large; view file

crates/app/src/ui/cards/numedit.rsadded+236 -0

Diff too large; view file

crates/app/src/ui/cards/silence.rsadded+360 -0

Diff too large; view file

crates/app/src/ui/cards/speed.rsadded+411 -0

Diff too large; view file

crates/app/src/ui/cards/substyle.rsadded+651 -0

Diff too large; view file

crates/app/src/ui/cards/title.rsadded+498 -0

Diff too large; view file

crates/app/src/ui/cards/tools.rsadded+721 -0

Diff too large; view file

crates/app/src/ui/cards/transform.rsadded+790 -0

Diff too large; view file

crates/app/src/ui/choice.rsadded+228 -0

Diff too large; view file

crates/app/src/ui/dock_stance.rsmodified+2537 -831

Diff too large; view file

crates/app/src/ui/gallery.rsadded+636 -0

Diff too large; view file

crates/app/src/ui/icons.rsadded+275 -0

Diff too large; view file

crates/app/src/ui/kit.rsadded+1379 -0

Diff too large; view file

crates/app/src/ui/library.rsmodified+154 -131

Diff too large; view file

crates/app/src/ui/menubar.rsadded+1215 -0

Diff too large; view file

crates/app/src/ui/mod.rsmodified+10 -0

Diff too large; view file

crates/app/src/ui/overlays.rsmodified+748 -247

Diff too large; view file

crates/app/src/ui/popup.rsadded+489 -0

Diff too large; view file

crates/app/src/ui/preview.rsmodified+934 -205

Diff too large; view file

crates/app/src/ui/project_dialogs.rsadded+930 -0

Diff too large; view file

crates/app/src/ui/settings_stance.rsmodified+1840 -584

Diff too large; view file

crates/app/src/ui/stance.rsmodified+1042 -368

Diff too large; view file

crates/app/src/ui/theme.rsmodified+919 -75

Diff too large; view file

crates/app/src/ui/timeband_stance.rsmodified+482 -666

Diff too large; view file

crates/app/src/ui/toolbar.rsadded+425 -0

Diff too large; view file

crates/app/src/ui/transcript_panel.rsadded+444 -0

Diff too large; view file

crates/app/src/ui/type_scale.rsmodified+124 -14

Diff too large; view file

crates/app/src/ui/widgets.rsmodified+1333 -192

Diff too large; view file

crates/app/src/view_state.rsadded+349 -0

Diff too large; view file

crates/app/src/viewer_view.rsadded+1008 -0

Diff too large; view file

crates/engine-audio/Cargo.tomldeleted+0 -15

Diff too large; view file

crates/engine-audio/src/lib.rsdeleted+0 -832

Diff too large; view file

crates/engine-hw/Cargo.tomlmodified+13 -9

Diff too large; view file

crates/engine-hw/src/bin/hw-child.rsadded+7 -0

Diff too large; view file

crates/engine-hw/src/child.rsadded+476 -0

Diff too large; view file

crates/engine-hw/src/enc_ec.rsadded+232 -0

Diff too large; view file

crates/engine-hw/src/lib.rsmodified+413 -1811

Diff too large; view file

crates/engine-hw/src/slice_fix.rsdeleted+0 -527

Diff too large; view file

crates/engine/Cargo.tomlmodified+122 -66

Diff too large; view file

crates/engine/examples/bench.rsmodified+28 -2

Diff too large; view file

crates/engine/examples/dump_frame.rsmodified+1 -1

Diff too large; view file

crates/engine/examples/export_audio_cost.rsmodified+1 -1

Diff too large; view file

crates/engine/examples/probe_fps.rsmodified+9 -36

Diff too large; view file

crates/engine/src/adts.rsadded+213 -0

Diff too large; view file

crates/engine/src/ao.rsmodified+54 -188

Diff too large; view file

crates/engine/src/audio.rsmodified+2536 -688

Diff too large; view file

crates/engine/src/auto_color.rsadded+172 -0

Diff too large; view file

crates/engine/src/beats.rsadded+456 -0

Diff too large; view file

crates/engine/src/bin/hw-encode-child.rsdeleted+0 -262

Diff too large; view file

crates/engine/src/caps.rsmodified+7 -7

Diff too large; view file

crates/engine/src/captionanim.rsadded+596 -0

Diff too large; view file

crates/engine/src/clock.rsmodified+120 -5

Diff too large; view file

crates/engine/src/collect.rsadded+313 -0

Diff too large; view file

crates/engine/src/color.rsmodified+833 -28

Diff too large; view file

crates/engine/src/colorspace.rsmodified+448 -48

Diff too large; view file

crates/engine/src/convert.rsmodified+32 -12

Diff too large; view file

crates/engine/src/cube.rsadded+382 -0

Diff too large; view file

crates/engine/src/decode.rsmodified+1799 -656

Diff too large; view file

crates/engine/src/decode/dnxhd.rsadded+23 -0

Diff too large; view file

crates/engine/src/decode/dv.rsadded+25 -0

Diff too large; view file

crates/engine/src/decode/hevc.rsadded+670 -0

Diff too large; view file

crates/engine/src/decode/intra.rsadded+452 -0

Diff too large; view file

crates/engine/src/decode/mjpeg.rsadded+23 -0

Diff too large; view file

crates/engine/src/decode/mpeg2.rsadded+228 -0

Diff too large; view file

crates/engine/src/decode/mpeg4.rsadded+159 -0

Diff too large; view file